From 7c2953f37c46470ef541243034aeaa21aebede3d Mon Sep 17 00:00:00 2001 From: John Hall Date: Thu, 7 Nov 2024 09:27:38 -0500 Subject: [PATCH] add working tableau viz component with jwt auth to frontend --- assets/index-f19a5a1d.js | 1404 +++++++++++++++++++ docs/assets/index-f19a5a1d.js | 1404 +++++++++++++++++++ docs/cisco/eda.html | 28 +- docs/cisco/index.html | 28 +- docs/frontend/dist/assets/index-f19a5a1d.js | 1404 +++++++++++++++++++ docs/frontend/dist/index.html | 16 +- docs/index.html | 18 +- docs/site_libs/bootstrap/bootstrap.min.css | 2 +- frontend | 2 +- index.qmd | 2 +- package-lock.json | 329 ++++- src/custom.scss | 6 + 12 files changed, 4561 insertions(+), 82 deletions(-) create mode 100644 assets/index-f19a5a1d.js create mode 100644 docs/assets/index-f19a5a1d.js create mode 100644 docs/frontend/dist/assets/index-f19a5a1d.js diff --git a/assets/index-f19a5a1d.js b/assets/index-f19a5a1d.js new file mode 100644 index 0000000..3b82c9d --- /dev/null +++ b/assets/index-f19a5a1d.js @@ -0,0 +1,1404 @@ +function bL(t,e){for(var n=0;na[u]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const u of document.querySelectorAll('link[rel="modulepreload"]'))a(u);new MutationObserver(u=>{for(const d of u)if(d.type==="childList")for(const _ of d.addedNodes)_.tagName==="LINK"&&_.rel==="modulepreload"&&a(_)}).observe(document,{childList:!0,subtree:!0});function n(u){const d={};return u.integrity&&(d.integrity=u.integrity),u.referrerPolicy&&(d.referrerPolicy=u.referrerPolicy),u.crossOrigin==="use-credentials"?d.credentials="include":u.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function a(u){if(u.ep)return;u.ep=!0;const d=n(u);fetch(u.href,d)}})();var $e=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function XE(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function WM(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var n=function a(){return this instanceof a?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(a){var u=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(n,a,u.get?u:{enumerable:!0,get:function(){return t[a]}})}),n}var GM={exports:{}},xr={};/** + * @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 Rm=Symbol.for("react.element"),wL=Symbol.for("react.portal"),EL=Symbol.for("react.fragment"),SL=Symbol.for("react.strict_mode"),TL=Symbol.for("react.profiler"),AL=Symbol.for("react.provider"),IL=Symbol.for("react.context"),CL=Symbol.for("react.forward_ref"),kL=Symbol.for("react.suspense"),PL=Symbol.for("react.memo"),DL=Symbol.for("react.lazy"),lC=Symbol.iterator;function ML(t){return t===null||typeof t!="object"?null:(t=lC&&t[lC]||t["@@iterator"],typeof t=="function"?t:null)}var HM={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},qM=Object.assign,ZM={};function Md(t,e,n){this.props=t,this.context=e,this.refs=ZM,this.updater=n||HM}Md.prototype.isReactComponent={};Md.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=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,t,e,"setState")};Md.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function KM(){}KM.prototype=Md.prototype;function YE(t,e,n){this.props=t,this.context=e,this.refs=ZM,this.updater=n||HM}var QE=YE.prototype=new KM;QE.constructor=YE;qM(QE,Md.prototype);QE.isPureReactComponent=!0;var cC=Array.isArray,XM=Object.prototype.hasOwnProperty,JE={current:null},YM={key:!0,ref:!0,__self:!0,__source:!0};function QM(t,e,n){var a,u={},d=null,_=null;if(e!=null)for(a in e.ref!==void 0&&(_=e.ref),e.key!==void 0&&(d=""+e.key),e)XM.call(e,a)&&!YM.hasOwnProperty(a)&&(u[a]=e[a]);var l=arguments.length-2;if(l===1)u.children=n;else if(1>>1,et=qe[je];if(0>>1;jeu(ur,gt))Xtu(Pr,ur)?(qe[je]=Pr,qe[Xt]=gt,je=Xt):(qe[je]=ur,qe[it]=gt,je=it);else if(Xtu(Pr,gt))qe[je]=Pr,qe[Xt]=gt,je=Xt;else break e}}return Tt}function u(qe,Tt){var gt=qe.sortIndex-Tt.sortIndex;return gt!==0?gt:qe.id-Tt.id}if(typeof performance=="object"&&typeof performance.now=="function"){var d=performance;t.unstable_now=function(){return d.now()}}else{var _=Date,l=_.now();t.unstable_now=function(){return _.now()-l}}var w=[],T=[],C=1,P=null,z=3,W=!1,U=!1,j=!1,L=typeof setTimeout=="function"?setTimeout:null,V=typeof clearTimeout=="function"?clearTimeout:null,R=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function F(qe){for(var Tt=n(T);Tt!==null;){if(Tt.callback===null)a(T);else if(Tt.startTime<=qe)a(T),Tt.sortIndex=Tt.expirationTime,e(w,Tt);else break;Tt=n(T)}}function H(qe){if(j=!1,F(qe),!U)if(n(w)!==null)U=!0,Ut(Q);else{var Tt=n(T);Tt!==null&&cr(H,Tt.startTime-qe)}}function Q(qe,Tt){U=!1,j&&(j=!1,V(ge),ge=-1),W=!0;var gt=z;try{for(F(Tt),P=n(w);P!==null&&(!(P.expirationTime>Tt)||qe&&!Be());){var je=P.callback;if(typeof je=="function"){P.callback=null,z=P.priorityLevel;var et=je(P.expirationTime<=Tt);Tt=t.unstable_now(),typeof et=="function"?P.callback=et:P===n(w)&&a(w),F(Tt)}else a(w);P=n(w)}if(P!==null)var nt=!0;else{var it=n(T);it!==null&&cr(H,it.startTime-Tt),nt=!1}return nt}finally{P=null,z=gt,W=!1}}var te=!1,se=null,ge=-1,xe=5,Ee=-1;function Be(){return!(t.unstable_now()-Eeqe||125je?(qe.sortIndex=gt,e(T,qe),n(w)===null&&qe===n(T)&&(j?(V(ge),ge=-1):j=!0,cr(H,gt-je))):(qe.sortIndex=et,e(w,qe),U||W||(U=!0,Ut(Q))),qe},t.unstable_shouldYield=Be,t.unstable_wrapCallback=function(qe){var Tt=z;return function(){var gt=z;z=Tt;try{return qe.apply(this,arguments)}finally{z=gt}}}})(rz);tz.exports=rz;var LL=tz.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 BL=St,Uo=LL;function yt(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ow=Object.prototype.hasOwnProperty,NL=/^[: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]*$/,hC={},dC={};function UL(t){return Ow.call(dC,t)?!0:Ow.call(hC,t)?!1:NL.test(t)?dC[t]=!0:(hC[t]=!0,!1)}function jL(t,e,n,a){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return a?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function VL(t,e,n,a){if(e===null||typeof e>"u"||jL(t,e,n,a))return!0;if(a)return!1;if(n!==null)switch(n.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function to(t,e,n,a,u,d,_){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=a,this.attributeNamespace=u,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=d,this.removeEmptyString=_}var Ai={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Ai[t]=new to(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Ai[e]=new to(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Ai[t]=new to(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Ai[t]=new to(t,2,!1,t,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(t){Ai[t]=new to(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Ai[t]=new to(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Ai[t]=new to(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Ai[t]=new to(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Ai[t]=new to(t,5,!1,t.toLowerCase(),null,!1,!1)});var tS=/[\-:]([a-z])/g;function rS(t){return t[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(t){var e=t.replace(tS,rS);Ai[e]=new to(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(tS,rS);Ai[e]=new to(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(tS,rS);Ai[e]=new to(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Ai[t]=new to(t,1,!1,t.toLowerCase(),null,!1,!1)});Ai.xlinkHref=new to("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Ai[t]=new to(t,1,!1,t.toLowerCase(),null,!0,!0)});function nS(t,e,n,a){var u=Ai.hasOwnProperty(e)?Ai[e]:null;(u!==null?u.type!==0:a||!(2l||u[_]!==d[l]){var w=` +`+u[_].replace(" at new "," at ");return t.displayName&&w.includes("")&&(w=w.replace("",t.displayName)),w}while(1<=_&&0<=l);break}}}finally{P1=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?Xf(t):""}function $L(t){switch(t.tag){case 5:return Xf(t.type);case 16:return Xf("Lazy");case 13:return Xf("Suspense");case 19:return Xf("SuspenseList");case 0:case 2:case 15:return t=D1(t.type,!1),t;case 11:return t=D1(t.type.render,!1),t;case 1:return t=D1(t.type,!0),t;default:return""}}function Nw(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case td:return"Fragment";case ed:return"Portal";case Fw:return"Profiler";case iS:return"StrictMode";case Lw:return"Suspense";case Bw:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case oz:return(t.displayName||"Context")+".Consumer";case iz:return(t._context.displayName||"Context")+".Provider";case oS:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case aS:return e=t.displayName||null,e!==null?e:Nw(t.type)||"Memo";case ec:e=t._payload,t=t._init;try{return Nw(t(e))}catch{}}return null}function WL(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Nw(e);case 8:return e===iS?"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 e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function gc(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function sz(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function GL(t){var e=sz(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),a=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var u=n.get,d=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return u.call(this)},set:function(_){a=""+_,d.call(this,_)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return a},setValue:function(_){a=""+_},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function Ig(t){t._valueTracker||(t._valueTracker=GL(t))}function lz(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),a="";return t&&(a=sz(t)?t.checked?"true":"false":t.value),t=a,t!==n?(e.setValue(t),!0):!1}function Jy(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function Uw(t,e){var n=e.checked;return Pn({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function fC(t,e){var n=e.defaultValue==null?"":e.defaultValue,a=e.checked!=null?e.checked:e.defaultChecked;n=gc(e.value!=null?e.value:n),t._wrapperState={initialChecked:a,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function cz(t,e){e=e.checked,e!=null&&nS(t,"checked",e,!1)}function jw(t,e){cz(t,e);var n=gc(e.value),a=e.type;if(n!=null)a==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(a==="submit"||a==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?Vw(t,e.type,n):e.hasOwnProperty("defaultValue")&&Vw(t,e.type,gc(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function mC(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var a=e.type;if(!(a!=="submit"&&a!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function Vw(t,e,n){(e!=="number"||Jy(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var Yf=Array.isArray;function md(t,e,n,a){if(t=t.options,e){e={};for(var u=0;u"+e.valueOf().toString()+"",e=Cg.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function dm(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var em={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},HL=["Webkit","ms","Moz","O"];Object.keys(em).forEach(function(t){HL.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),em[e]=em[t]})});function pz(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||em.hasOwnProperty(t)&&em[t]?(""+e).trim():e+"px"}function fz(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var a=n.indexOf("--")===0,u=pz(n,e[n],a);n==="float"&&(n="cssFloat"),a?t.setProperty(n,u):t[n]=u}}var qL=Pn({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 Gw(t,e){if(e){if(qL[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(yt(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(yt(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(yt(61))}if(e.style!=null&&typeof e.style!="object")throw Error(yt(62))}}function Hw(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){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 qw=null;function sS(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Zw=null,gd=null,yd=null;function _C(t){if(t=Lm(t)){if(typeof Zw!="function")throw Error(yt(280));var e=t.stateNode;e&&(e=U_(e),Zw(t.stateNode,t.type,e))}}function mz(t){gd?yd?yd.push(t):yd=[t]:gd=t}function gz(){if(gd){var t=gd,e=yd;if(yd=gd=null,_C(t),e)for(t=0;t>>=0,t===0?32:31-(iB(t)/oB|0)|0}var kg=64,Pg=4194304;function Qf(t){switch(t&-t){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 t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function n_(t,e){var n=t.pendingLanes;if(n===0)return 0;var a=0,u=t.suspendedLanes,d=t.pingedLanes,_=n&268435455;if(_!==0){var l=_&~u;l!==0?a=Qf(l):(d&=_,d!==0&&(a=Qf(d)))}else _=n&~u,_!==0?a=Qf(_):d!==0&&(a=Qf(d));if(a===0)return 0;if(e!==0&&e!==a&&!(e&u)&&(u=a&-a,d=e&-e,u>=d||u===16&&(d&4194240)!==0))return e;if(a&4&&(a|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=a;0n;n++)e.push(t);return e}function Om(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Wa(e),t[e]=n}function cB(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var a=t.eventTimes;for(t=t.expirationTimes;0=rm),IC=String.fromCharCode(32),CC=!1;function Fz(t,e){switch(t){case"keyup":return LB.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Lz(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var rd=!1;function NB(t,e){switch(t){case"compositionend":return Lz(e);case"keypress":return e.which!==32?null:(CC=!0,IC);case"textInput":return t=e.data,t===IC&&CC?null:t;default:return null}}function UB(t,e){if(rd)return t==="compositionend"||!mS&&Fz(t,e)?(t=Rz(),Fy=dS=ic=null,rd=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:n,offset:e-t};t=a}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=MC(n)}}function jz(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?jz(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function Vz(){for(var t=window,e=Jy();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=Jy(t.document)}return e}function gS(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function KB(t){var e=Vz(),n=t.focusedElem,a=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&jz(n.ownerDocument.documentElement,n)){if(a!==null&&gS(n)){if(e=a.start,t=a.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var u=n.textContent.length,d=Math.min(a.start,u);a=a.end===void 0?d:Math.min(a.end,u),!t.extend&&d>a&&(u=a,a=d,d=u),u=zC(n,d);var _=zC(n,a);u&&_&&(t.rangeCount!==1||t.anchorNode!==u.node||t.anchorOffset!==u.offset||t.focusNode!==_.node||t.focusOffset!==_.offset)&&(e=e.createRange(),e.setStart(u.node,u.offset),t.removeAllRanges(),d>a?(t.addRange(e),t.extend(_.node,_.offset)):(e.setEnd(_.node,_.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,nd=null,eE=null,im=null,tE=!1;function RC(t,e,n){var a=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;tE||nd==null||nd!==Jy(a)||(a=nd,"selectionStart"in a&&gS(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),im&&_m(im,a)||(im=a,a=a_(eE,"onSelect"),0ad||(t.current=sE[ad],sE[ad]=null,ad--)}function on(t,e){ad++,sE[ad]=t.current,t.current=e}var yc={},Wi=bc(yc),go=bc(!1),ku=yc;function Sd(t,e){var n=t.type.contextTypes;if(!n)return yc;var a=t.stateNode;if(a&&a.__reactInternalMemoizedUnmaskedChildContext===e)return a.__reactInternalMemoizedMaskedChildContext;var u={},d;for(d in n)u[d]=e[d];return a&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=u),u}function yo(t){return t=t.childContextTypes,t!=null}function l_(){dn(go),dn(Wi)}function jC(t,e,n){if(Wi.current!==yc)throw Error(yt(168));on(Wi,e),on(go,n)}function Yz(t,e,n){var a=t.stateNode;if(e=e.childContextTypes,typeof a.getChildContext!="function")return n;a=a.getChildContext();for(var u in a)if(!(u in e))throw Error(yt(108,WL(t)||"Unknown",u));return Pn({},n,a)}function c_(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||yc,ku=Wi.current,on(Wi,t),on(go,go.current),!0}function VC(t,e,n){var a=t.stateNode;if(!a)throw Error(yt(169));n?(t=Yz(t,e,ku),a.__reactInternalMemoizedMergedChildContext=t,dn(go),dn(Wi),on(Wi,t)):dn(go),on(go,n)}var tl=null,j_=!1,G1=!1;function Qz(t){tl===null?tl=[t]:tl.push(t)}function s8(t){j_=!0,Qz(t)}function wc(){if(!G1&&tl!==null){G1=!0;var t=0,e=Kr;try{var n=tl;for(Kr=1;t>=_,u-=_,il=1<<32-Wa(e)+u|n<ge?(xe=se,se=null):xe=se.sibling;var Ee=z(V,se,F[ge],H);if(Ee===null){se===null&&(se=xe);break}t&&se&&Ee.alternate===null&&e(V,se),R=d(Ee,R,ge),te===null?Q=Ee:te.sibling=Ee,te=Ee,se=xe}if(ge===F.length)return n(V,se),gn&&xu(V,ge),Q;if(se===null){for(;gege?(xe=se,se=null):xe=se.sibling;var Be=z(V,se,Ee.value,H);if(Be===null){se===null&&(se=xe);break}t&&se&&Be.alternate===null&&e(V,se),R=d(Be,R,ge),te===null?Q=Be:te.sibling=Be,te=Be,se=xe}if(Ee.done)return n(V,se),gn&&xu(V,ge),Q;if(se===null){for(;!Ee.done;ge++,Ee=F.next())Ee=P(V,Ee.value,H),Ee!==null&&(R=d(Ee,R,ge),te===null?Q=Ee:te.sibling=Ee,te=Ee);return gn&&xu(V,ge),Q}for(se=a(V,se);!Ee.done;ge++,Ee=F.next())Ee=W(se,V,ge,Ee.value,H),Ee!==null&&(t&&Ee.alternate!==null&&se.delete(Ee.key===null?ge:Ee.key),R=d(Ee,R,ge),te===null?Q=Ee:te.sibling=Ee,te=Ee);return t&&se.forEach(function(Fe){return e(V,Fe)}),gn&&xu(V,ge),Q}function L(V,R,F,H){if(typeof F=="object"&&F!==null&&F.type===td&&F.key===null&&(F=F.props.children),typeof F=="object"&&F!==null){switch(F.$$typeof){case Ag:e:{for(var Q=F.key,te=R;te!==null;){if(te.key===Q){if(Q=F.type,Q===td){if(te.tag===7){n(V,te.sibling),R=u(te,F.props.children),R.return=V,V=R;break e}}else if(te.elementType===Q||typeof Q=="object"&&Q!==null&&Q.$$typeof===ec&&GC(Q)===te.type){n(V,te.sibling),R=u(te,F.props),R.ref=Pf(V,te,F),R.return=V,V=R;break e}n(V,te);break}else e(V,te);te=te.sibling}F.type===td?(R=Cu(F.props.children,V.mode,H,F.key),R.return=V,V=R):(H=Wy(F.type,F.key,F.props,null,V.mode,H),H.ref=Pf(V,R,F),H.return=V,V=H)}return _(V);case ed:e:{for(te=F.key;R!==null;){if(R.key===te)if(R.tag===4&&R.stateNode.containerInfo===F.containerInfo&&R.stateNode.implementation===F.implementation){n(V,R.sibling),R=u(R,F.children||[]),R.return=V,V=R;break e}else{n(V,R);break}else e(V,R);R=R.sibling}R=J1(F,V.mode,H),R.return=V,V=R}return _(V);case ec:return te=F._init,L(V,R,te(F._payload),H)}if(Yf(F))return U(V,R,F,H);if(Tf(F))return j(V,R,F,H);Lg(V,F)}return typeof F=="string"&&F!==""||typeof F=="number"?(F=""+F,R!==null&&R.tag===6?(n(V,R.sibling),R=u(R,F),R.return=V,V=R):(n(V,R),R=Q1(F,V.mode,H),R.return=V,V=R),_(V)):n(V,R)}return L}var Ad=r4(!0),n4=r4(!1),d_=bc(null),p_=null,cd=null,xS=null;function bS(){xS=cd=p_=null}function wS(t){var e=d_.current;dn(d_),t._currentValue=e}function uE(t,e,n){for(;t!==null;){var a=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,a!==null&&(a.childLanes|=e)):a!==null&&(a.childLanes&e)!==e&&(a.childLanes|=e),t===n)break;t=t.return}}function vd(t,e){p_=t,xS=cd=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(mo=!0),t.firstContext=null)}function ha(t){var e=t._currentValue;if(xS!==t)if(t={context:t,memoizedValue:e,next:null},cd===null){if(p_===null)throw Error(yt(308));cd=t,p_.dependencies={lanes:0,firstContext:t}}else cd=cd.next=t;return e}var Su=null;function ES(t){Su===null?Su=[t]:Su.push(t)}function i4(t,e,n,a){var u=e.interleaved;return u===null?(n.next=n,ES(e)):(n.next=u.next,u.next=n),e.interleaved=n,cl(t,a)}function cl(t,e){t.lanes|=e;var n=t.alternate;for(n!==null&&(n.lanes|=e),n=t,t=t.return;t!==null;)t.childLanes|=e,n=t.alternate,n!==null&&(n.childLanes|=e),n=t,t=t.return;return n.tag===3?n.stateNode:null}var tc=!1;function SS(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function o4(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function al(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function hc(t,e,n){var a=t.updateQueue;if(a===null)return null;if(a=a.shared,Dr&2){var u=a.pending;return u===null?e.next=e:(e.next=u.next,u.next=e),a.pending=e,cl(t,n)}return u=a.interleaved,u===null?(e.next=e,ES(a)):(e.next=u.next,u.next=e),a.interleaved=e,cl(t,n)}function By(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194240)!==0)){var a=e.lanes;a&=t.pendingLanes,n|=a,e.lanes=n,cS(t,n)}}function HC(t,e){var n=t.updateQueue,a=t.alternate;if(a!==null&&(a=a.updateQueue,n===a)){var u=null,d=null;if(n=n.firstBaseUpdate,n!==null){do{var _={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};d===null?u=d=_:d=d.next=_,n=n.next}while(n!==null);d===null?u=d=e:d=d.next=e}else u=d=e;n={baseState:a.baseState,firstBaseUpdate:u,lastBaseUpdate:d,shared:a.shared,effects:a.effects},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}function f_(t,e,n,a){var u=t.updateQueue;tc=!1;var d=u.firstBaseUpdate,_=u.lastBaseUpdate,l=u.shared.pending;if(l!==null){u.shared.pending=null;var w=l,T=w.next;w.next=null,_===null?d=T:_.next=T,_=w;var C=t.alternate;C!==null&&(C=C.updateQueue,l=C.lastBaseUpdate,l!==_&&(l===null?C.firstBaseUpdate=T:l.next=T,C.lastBaseUpdate=w))}if(d!==null){var P=u.baseState;_=0,C=T=w=null,l=d;do{var z=l.lane,W=l.eventTime;if((a&z)===z){C!==null&&(C=C.next={eventTime:W,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var U=t,j=l;switch(z=e,W=n,j.tag){case 1:if(U=j.payload,typeof U=="function"){P=U.call(W,P,z);break e}P=U;break e;case 3:U.flags=U.flags&-65537|128;case 0:if(U=j.payload,z=typeof U=="function"?U.call(W,P,z):U,z==null)break e;P=Pn({},P,z);break e;case 2:tc=!0}}l.callback!==null&&l.lane!==0&&(t.flags|=64,z=u.effects,z===null?u.effects=[l]:z.push(l))}else W={eventTime:W,lane:z,tag:l.tag,payload:l.payload,callback:l.callback,next:null},C===null?(T=C=W,w=P):C=C.next=W,_|=z;if(l=l.next,l===null){if(l=u.shared.pending,l===null)break;z=l,l=z.next,z.next=null,u.lastBaseUpdate=z,u.shared.pending=null}}while(1);if(C===null&&(w=P),u.baseState=w,u.firstBaseUpdate=T,u.lastBaseUpdate=C,e=u.shared.interleaved,e!==null){u=e;do _|=u.lane,u=u.next;while(u!==e)}else d===null&&(u.shared.lanes=0);Mu|=_,t.lanes=_,t.memoizedState=P}}function qC(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;en?n:4,t(!0);var a=q1.transition;q1.transition={};try{t(!1),e()}finally{Kr=n,q1.transition=a}}function w4(){return da().memoizedState}function h8(t,e,n){var a=pc(t);if(n={lane:a,action:n,hasEagerState:!1,eagerState:null,next:null},E4(t))S4(e,n);else if(n=i4(t,e,n,a),n!==null){var u=Ji();Ga(n,t,a,u),T4(n,e,a)}}function d8(t,e,n){var a=pc(t),u={lane:a,action:n,hasEagerState:!1,eagerState:null,next:null};if(E4(t))S4(e,u);else{var d=t.alternate;if(t.lanes===0&&(d===null||d.lanes===0)&&(d=e.lastRenderedReducer,d!==null))try{var _=e.lastRenderedState,l=d(_,n);if(u.hasEagerState=!0,u.eagerState=l,Za(l,_)){var w=e.interleaved;w===null?(u.next=u,ES(e)):(u.next=w.next,w.next=u),e.interleaved=u;return}}catch{}finally{}n=i4(t,e,u,a),n!==null&&(u=Ji(),Ga(n,t,a,u),T4(n,e,a))}}function E4(t){var e=t.alternate;return t===kn||e!==null&&e===kn}function S4(t,e){om=g_=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function T4(t,e,n){if(n&4194240){var a=e.lanes;a&=t.pendingLanes,n|=a,e.lanes=n,cS(t,n)}}var y_={readContext:ha,useCallback:Fi,useContext:Fi,useEffect:Fi,useImperativeHandle:Fi,useInsertionEffect:Fi,useLayoutEffect:Fi,useMemo:Fi,useReducer:Fi,useRef:Fi,useState:Fi,useDebugValue:Fi,useDeferredValue:Fi,useTransition:Fi,useMutableSource:Fi,useSyncExternalStore:Fi,useId:Fi,unstable_isNewReconciler:!1},p8={readContext:ha,useCallback:function(t,e){return ws().memoizedState=[t,e===void 0?null:e],t},useContext:ha,useEffect:KC,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,Uy(4194308,4,y4.bind(null,e,t),n)},useLayoutEffect:function(t,e){return Uy(4194308,4,t,e)},useInsertionEffect:function(t,e){return Uy(4,2,t,e)},useMemo:function(t,e){var n=ws();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var a=ws();return e=n!==void 0?n(e):e,a.memoizedState=a.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},a.queue=t,t=t.dispatch=h8.bind(null,kn,t),[a.memoizedState,t]},useRef:function(t){var e=ws();return t={current:t},e.memoizedState=t},useState:ZC,useDebugValue:MS,useDeferredValue:function(t){return ws().memoizedState=t},useTransition:function(){var t=ZC(!1),e=t[0];return t=u8.bind(null,t[1]),ws().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var a=kn,u=ws();if(gn){if(n===void 0)throw Error(yt(407));n=n()}else{if(n=e(),mi===null)throw Error(yt(349));Du&30||c4(a,e,n)}u.memoizedState=n;var d={value:n,getSnapshot:e};return u.queue=d,KC(h4.bind(null,a,d,t),[t]),a.flags|=2048,Am(9,u4.bind(null,a,d,n,e),void 0,null),n},useId:function(){var t=ws(),e=mi.identifierPrefix;if(gn){var n=ol,a=il;n=(a&~(1<<32-Wa(a)-1)).toString(32)+n,e=":"+e+"R"+n,n=Sm++,0<\/script>",t=t.removeChild(t.firstChild)):typeof a.is=="string"?t=_.createElement(n,{is:a.is}):(t=_.createElement(n),n==="select"&&(_=t,a.multiple?_.multiple=!0:a.size&&(_.size=a.size))):t=_.createElementNS(t,n),t[Es]=e,t[bm]=a,O4(t,e,!1,!1),e.stateNode=t;e:{switch(_=Hw(n,a),n){case"dialog":hn("cancel",t),hn("close",t),u=a;break;case"iframe":case"object":case"embed":hn("load",t),u=a;break;case"video":case"audio":for(u=0;ukd&&(e.flags|=128,a=!0,Df(d,!1),e.lanes=4194304)}else{if(!a)if(t=m_(_),t!==null){if(e.flags|=128,a=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),Df(d,!0),d.tail===null&&d.tailMode==="hidden"&&!_.alternate&&!gn)return Li(e),null}else 2*Ln()-d.renderingStartTime>kd&&n!==1073741824&&(e.flags|=128,a=!0,Df(d,!1),e.lanes=4194304);d.isBackwards?(_.sibling=e.child,e.child=_):(n=d.last,n!==null?n.sibling=_:e.child=_,d.last=_)}return d.tail!==null?(e=d.tail,d.rendering=e,d.tail=e.sibling,d.renderingStartTime=Ln(),e.sibling=null,n=Cn.current,on(Cn,a?n&1|2:n&1),e):(Li(e),null);case 22:case 23:return BS(),a=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==a&&(e.flags|=8192),a&&e.mode&1?Fo&1073741824&&(Li(e),e.subtreeFlags&6&&(e.flags|=8192)):Li(e),null;case 24:return null;case 25:return null}throw Error(yt(156,e.tag))}function b8(t,e){switch(_S(e),e.tag){case 1:return yo(e.type)&&l_(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Id(),dn(go),dn(Wi),IS(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return AS(e),null;case 13:if(dn(Cn),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(yt(340));Td()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return dn(Cn),null;case 4:return Id(),null;case 10:return wS(e.type._context),null;case 22:case 23:return BS(),null;case 24:return null;default:return null}}var Ng=!1,$i=!1,w8=typeof WeakSet=="function"?WeakSet:Set,Rt=null;function ud(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(a){On(t,e,a)}else n.current=null}function vE(t,e,n){try{n()}catch(a){On(t,e,a)}}var ak=!1;function E8(t,e){if(rE=i_,t=Vz(),gS(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var a=n.getSelection&&n.getSelection();if(a&&a.rangeCount!==0){n=a.anchorNode;var u=a.anchorOffset,d=a.focusNode;a=a.focusOffset;try{n.nodeType,d.nodeType}catch{n=null;break e}var _=0,l=-1,w=-1,T=0,C=0,P=t,z=null;t:for(;;){for(var W;P!==n||u!==0&&P.nodeType!==3||(l=_+u),P!==d||a!==0&&P.nodeType!==3||(w=_+a),P.nodeType===3&&(_+=P.nodeValue.length),(W=P.firstChild)!==null;)z=P,P=W;for(;;){if(P===t)break t;if(z===n&&++T===u&&(l=_),z===d&&++C===a&&(w=_),(W=P.nextSibling)!==null)break;P=z,z=P.parentNode}P=W}n=l===-1||w===-1?null:{start:l,end:w}}else n=null}n=n||{start:0,end:0}}else n=null;for(nE={focusedElem:t,selectionRange:n},i_=!1,Rt=e;Rt!==null;)if(e=Rt,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,Rt=t;else for(;Rt!==null;){e=Rt;try{var U=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(U!==null){var j=U.memoizedProps,L=U.memoizedState,V=e.stateNode,R=V.getSnapshotBeforeUpdate(e.elementType===e.type?j:Ua(e.type,j),L);V.__reactInternalSnapshotBeforeUpdate=R}break;case 3:var F=e.stateNode.containerInfo;F.nodeType===1?F.textContent="":F.nodeType===9&&F.documentElement&&F.removeChild(F.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(yt(163))}}catch(H){On(e,e.return,H)}if(t=e.sibling,t!==null){t.return=e.return,Rt=t;break}Rt=e.return}return U=ak,ak=!1,U}function am(t,e,n){var a=e.updateQueue;if(a=a!==null?a.lastEffect:null,a!==null){var u=a=a.next;do{if((u.tag&t)===t){var d=u.destroy;u.destroy=void 0,d!==void 0&&vE(e,n,d)}u=u.next}while(u!==a)}}function W_(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var a=n.create;n.destroy=a()}n=n.next}while(n!==e)}}function xE(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function B4(t){var e=t.alternate;e!==null&&(t.alternate=null,B4(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[Es],delete e[bm],delete e[aE],delete e[o8],delete e[a8])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function N4(t){return t.tag===5||t.tag===3||t.tag===4}function sk(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||N4(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function bE(t,e,n){var a=t.tag;if(a===5||a===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=s_));else if(a!==4&&(t=t.child,t!==null))for(bE(t,e,n),t=t.sibling;t!==null;)bE(t,e,n),t=t.sibling}function wE(t,e,n){var a=t.tag;if(a===5||a===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(a!==4&&(t=t.child,t!==null))for(wE(t,e,n),t=t.sibling;t!==null;)wE(t,e,n),t=t.sibling}var Si=null,ja=!1;function Gl(t,e,n){for(n=n.child;n!==null;)U4(t,e,n),n=n.sibling}function U4(t,e,n){if(Ts&&typeof Ts.onCommitFiberUnmount=="function")try{Ts.onCommitFiberUnmount(F_,n)}catch{}switch(n.tag){case 5:$i||ud(n,e);case 6:var a=Si,u=ja;Si=null,Gl(t,e,n),Si=a,ja=u,Si!==null&&(ja?(t=Si,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):Si.removeChild(n.stateNode));break;case 18:Si!==null&&(ja?(t=Si,n=n.stateNode,t.nodeType===8?W1(t.parentNode,n):t.nodeType===1&&W1(t,n),gm(t)):W1(Si,n.stateNode));break;case 4:a=Si,u=ja,Si=n.stateNode.containerInfo,ja=!0,Gl(t,e,n),Si=a,ja=u;break;case 0:case 11:case 14:case 15:if(!$i&&(a=n.updateQueue,a!==null&&(a=a.lastEffect,a!==null))){u=a=a.next;do{var d=u,_=d.destroy;d=d.tag,_!==void 0&&(d&2||d&4)&&vE(n,e,_),u=u.next}while(u!==a)}Gl(t,e,n);break;case 1:if(!$i&&(ud(n,e),a=n.stateNode,typeof a.componentWillUnmount=="function"))try{a.props=n.memoizedProps,a.state=n.memoizedState,a.componentWillUnmount()}catch(l){On(n,e,l)}Gl(t,e,n);break;case 21:Gl(t,e,n);break;case 22:n.mode&1?($i=(a=$i)||n.memoizedState!==null,Gl(t,e,n),$i=a):Gl(t,e,n);break;default:Gl(t,e,n)}}function lk(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new w8),e.forEach(function(a){var u=M8.bind(null,t,a);n.has(a)||(n.add(a),a.then(u,u))})}}function Ba(t,e){var n=e.deletions;if(n!==null)for(var a=0;au&&(u=_),a&=~d}if(a=u,a=Ln()-a,a=(120>a?120:480>a?480:1080>a?1080:1920>a?1920:3e3>a?3e3:4320>a?4320:1960*T8(a/1960))-a,10t?16:t,oc===null)var a=!1;else{if(t=oc,oc=null,x_=0,Dr&6)throw Error(yt(331));var u=Dr;for(Dr|=4,Rt=t.current;Rt!==null;){var d=Rt,_=d.child;if(Rt.flags&16){var l=d.deletions;if(l!==null){for(var w=0;wLn()-FS?Iu(t,0):OS|=n),_o(t,e)}function Z4(t,e){e===0&&(t.mode&1?(e=Pg,Pg<<=1,!(Pg&130023424)&&(Pg=4194304)):e=1);var n=Ji();t=cl(t,e),t!==null&&(Om(t,e,n),_o(t,n))}function D8(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),Z4(t,n)}function M8(t,e){var n=0;switch(t.tag){case 13:var a=t.stateNode,u=t.memoizedState;u!==null&&(n=u.retryLane);break;case 19:a=t.stateNode;break;default:throw Error(yt(314))}a!==null&&a.delete(e),Z4(t,n)}var K4;K4=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||go.current)mo=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return mo=!1,v8(t,e,n);mo=!!(t.flags&131072)}else mo=!1,gn&&e.flags&1048576&&Jz(e,h_,e.index);switch(e.lanes=0,e.tag){case 2:var a=e.type;jy(t,e),t=e.pendingProps;var u=Sd(e,Wi.current);vd(e,n),u=kS(null,e,a,t,u,n);var d=PS();return e.flags|=1,typeof u=="object"&&u!==null&&typeof u.render=="function"&&u.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,yo(a)?(d=!0,c_(e)):d=!1,e.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,SS(e),u.updater=$_,e.stateNode=u,u._reactInternals=e,dE(e,a,t,n),e=mE(null,e,a,!0,d,n)):(e.tag=0,gn&&d&&yS(e),Qi(null,e,u,n),e=e.child),e;case 16:a=e.elementType;e:{switch(jy(t,e),t=e.pendingProps,u=a._init,a=u(a._payload),e.type=a,u=e.tag=R8(a),t=Ua(a,t),u){case 0:e=fE(null,e,a,t,n);break e;case 1:e=nk(null,e,a,t,n);break e;case 11:e=tk(null,e,a,t,n);break e;case 14:e=rk(null,e,a,Ua(a.type,t),n);break e}throw Error(yt(306,a,""))}return e;case 0:return a=e.type,u=e.pendingProps,u=e.elementType===a?u:Ua(a,u),fE(t,e,a,u,n);case 1:return a=e.type,u=e.pendingProps,u=e.elementType===a?u:Ua(a,u),nk(t,e,a,u,n);case 3:e:{if(M4(e),t===null)throw Error(yt(387));a=e.pendingProps,d=e.memoizedState,u=d.element,o4(t,e),f_(e,a,null,n);var _=e.memoizedState;if(a=_.element,d.isDehydrated)if(d={element:a,isDehydrated:!1,cache:_.cache,pendingSuspenseBoundaries:_.pendingSuspenseBoundaries,transitions:_.transitions},e.updateQueue.baseState=d,e.memoizedState=d,e.flags&256){u=Cd(Error(yt(423)),e),e=ik(t,e,a,n,u);break e}else if(a!==u){u=Cd(Error(yt(424)),e),e=ik(t,e,a,n,u);break e}else for(Lo=uc(e.stateNode.containerInfo.firstChild),Bo=e,gn=!0,Va=null,n=n4(e,null,a,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Td(),a===u){e=ul(t,e,n);break e}Qi(t,e,a,n)}e=e.child}return e;case 5:return a4(e),t===null&&cE(e),a=e.type,u=e.pendingProps,d=t!==null?t.memoizedProps:null,_=u.children,iE(a,u)?_=null:d!==null&&iE(a,d)&&(e.flags|=32),D4(t,e),Qi(t,e,_,n),e.child;case 6:return t===null&&cE(e),null;case 13:return z4(t,e,n);case 4:return TS(e,e.stateNode.containerInfo),a=e.pendingProps,t===null?e.child=Ad(e,null,a,n):Qi(t,e,a,n),e.child;case 11:return a=e.type,u=e.pendingProps,u=e.elementType===a?u:Ua(a,u),tk(t,e,a,u,n);case 7:return Qi(t,e,e.pendingProps,n),e.child;case 8:return Qi(t,e,e.pendingProps.children,n),e.child;case 12:return Qi(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(a=e.type._context,u=e.pendingProps,d=e.memoizedProps,_=u.value,on(d_,a._currentValue),a._currentValue=_,d!==null)if(Za(d.value,_)){if(d.children===u.children&&!go.current){e=ul(t,e,n);break e}}else for(d=e.child,d!==null&&(d.return=e);d!==null;){var l=d.dependencies;if(l!==null){_=d.child;for(var w=l.firstContext;w!==null;){if(w.context===a){if(d.tag===1){w=al(-1,n&-n),w.tag=2;var T=d.updateQueue;if(T!==null){T=T.shared;var C=T.pending;C===null?w.next=w:(w.next=C.next,C.next=w),T.pending=w}}d.lanes|=n,w=d.alternate,w!==null&&(w.lanes|=n),uE(d.return,n,e),l.lanes|=n;break}w=w.next}}else if(d.tag===10)_=d.type===e.type?null:d.child;else if(d.tag===18){if(_=d.return,_===null)throw Error(yt(341));_.lanes|=n,l=_.alternate,l!==null&&(l.lanes|=n),uE(_,n,e),_=d.sibling}else _=d.child;if(_!==null)_.return=d;else for(_=d;_!==null;){if(_===e){_=null;break}if(d=_.sibling,d!==null){d.return=_.return,_=d;break}_=_.return}d=_}Qi(t,e,u.children,n),e=e.child}return e;case 9:return u=e.type,a=e.pendingProps.children,vd(e,n),u=ha(u),a=a(u),e.flags|=1,Qi(t,e,a,n),e.child;case 14:return a=e.type,u=Ua(a,e.pendingProps),u=Ua(a.type,u),rk(t,e,a,u,n);case 15:return k4(t,e,e.type,e.pendingProps,n);case 17:return a=e.type,u=e.pendingProps,u=e.elementType===a?u:Ua(a,u),jy(t,e),e.tag=1,yo(a)?(t=!0,c_(e)):t=!1,vd(e,n),A4(e,a,u),dE(e,a,u,n),mE(null,e,a,!0,t,n);case 19:return R4(t,e,n);case 22:return P4(t,e,n)}throw Error(yt(156,e.tag))};function X4(t,e){return Ez(t,e)}function z8(t,e,n,a){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=a,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ca(t,e,n,a){return new z8(t,e,n,a)}function US(t){return t=t.prototype,!(!t||!t.isReactComponent)}function R8(t){if(typeof t=="function")return US(t)?1:0;if(t!=null){if(t=t.$$typeof,t===oS)return 11;if(t===aS)return 14}return 2}function fc(t,e){var n=t.alternate;return n===null?(n=ca(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function Wy(t,e,n,a,u,d){var _=2;if(a=t,typeof t=="function")US(t)&&(_=1);else if(typeof t=="string")_=5;else e:switch(t){case td:return Cu(n.children,u,d,e);case iS:_=8,u|=8;break;case Fw:return t=ca(12,n,e,u|2),t.elementType=Fw,t.lanes=d,t;case Lw:return t=ca(13,n,e,u),t.elementType=Lw,t.lanes=d,t;case Bw:return t=ca(19,n,e,u),t.elementType=Bw,t.lanes=d,t;case az:return H_(n,u,d,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case iz:_=10;break e;case oz:_=9;break e;case oS:_=11;break e;case aS:_=14;break e;case ec:_=16,a=null;break e}throw Error(yt(130,t==null?t:typeof t,""))}return e=ca(_,n,e,u),e.elementType=t,e.type=a,e.lanes=d,e}function Cu(t,e,n,a){return t=ca(7,t,a,e),t.lanes=n,t}function H_(t,e,n,a){return t=ca(22,t,a,e),t.elementType=az,t.lanes=n,t.stateNode={isHidden:!1},t}function Q1(t,e,n){return t=ca(6,t,null,e),t.lanes=n,t}function J1(t,e,n){return e=ca(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function O8(t,e,n,a,u){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=z1(0),this.expirationTimes=z1(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=z1(0),this.identifierPrefix=a,this.onRecoverableError=u,this.mutableSourceEagerHydrationData=null}function jS(t,e,n,a,u,d,_,l,w){return t=new O8(t,e,n,l,w),e===1?(e=1,d===!0&&(e|=8)):e=0,d=ca(3,null,null,e),t.current=d,d.stateNode=t,d.memoizedState={element:a,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},SS(d),t}function F8(t,e,n){var a=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(eR)}catch(t){console.error(t)}}eR(),ez.exports=jo;var GS=ez.exports,tR,gk=GS;tR=gk.createRoot,gk.hydrateRoot;const j8="Logging",V8="NoHubcallbackProvidedException";var Oo;(function(t){t.DEBUG="DEBUG",t.ERROR="ERROR",t.INFO="INFO",t.WARN="WARN",t.VERBOSE="VERBOSE",t.NONE="NONE"})(Oo||(Oo={}));const yk={VERBOSE:1,DEBUG:2,INFO:3,WARN:4,ERROR:5,NONE:6};class Ha{constructor(e,n=Oo.WARN){this.name=e,this.level=n,this._pluggables=[]}_padding(e){return e<10?"0"+e:""+e}_ts(){const e=new Date;return[this._padding(e.getMinutes()),this._padding(e.getSeconds())].join(":")+"."+e.getMilliseconds()}configure(e){return e?(this._config=e,this._config):this._config}_log(e,...n){let a=this.level;Ha.LOG_LEVEL&&(a=Ha.LOG_LEVEL),typeof window<"u"&&window.LOG_LEVEL&&(a=window.LOG_LEVEL);const u=yk[a];if(!(yk[e]>=u))return;let _=console.log.bind(console);e===Oo.ERROR&&console.error&&(_=console.error.bind(console)),e===Oo.WARN&&console.warn&&(_=console.warn.bind(console)),Ha.BIND_ALL_LOG_LEVELS&&(e===Oo.INFO&&console.info&&(_=console.info.bind(console)),e===Oo.DEBUG&&console.debug&&(_=console.debug.bind(console)));const l=`[${e}] ${this._ts()} ${this.name}`;let w="";if(n.length===1&&typeof n[0]=="string")w=`${l} - ${n[0]}`,_(w);else if(n.length===1)w=`${l} ${n[0]}`,_(l,n[0]);else if(typeof n[0]=="string"){let T=n.slice(1);T.length===1&&(T=T[0]),w=`${l} - ${n[0]} ${T}`,_(`${l} - ${n[0]}`,T)}else w=`${l} ${n}`,_(l,n);for(const T of this._pluggables){const C={message:w,timestamp:Date.now()};T.pushLogs([C])}}log(...e){this._log(Oo.INFO,...e)}info(...e){this._log(Oo.INFO,...e)}warn(...e){this._log(Oo.WARN,...e)}error(...e){this._log(Oo.ERROR,...e)}debug(...e){this._log(Oo.DEBUG,...e)}verbose(...e){this._log(Oo.VERBOSE,...e)}addPluggable(e){e&&e.getCategoryName()===j8&&(this._pluggables.push(e),e.configure(this._config))}listPluggables(){return this._pluggables}}Ha.LOG_LEVEL=null;Ha.BIND_ALL_LOG_LEVELS=!1;class Is extends Error{constructor({message:e,name:n,recoverySuggestion:a,underlyingError:u}){super(e),this.name=n,this.underlyingError=u,this.recoverySuggestion=a,this.constructor=Is,Object.setPrototypeOf(this,Is.prototype)}}var Cm;(function(t){t.NoEndpointId="NoEndpointId",t.PlatformNotSupported="PlatformNotSupported",t.Unknown="Unknown",t.NetworkError="NetworkError"})(Cm||(Cm={}));const rR=(t,e=Is)=>(n,a,u)=>{const{message:d,recoverySuggestion:_}=t[a];if(!n)throw new e({name:a,message:u?`${d} ${u}`:d,recoverySuggestion:_})},E_=typeof Symbol<"u"?Symbol("amplify_default"):"@@amplify_default",zf=new Ha("Hub");class $8{constructor(e){this.listeners=new Map,this.protectedChannels=["core","auth","api","analytics","interactions","pubsub","storage","ui","xr"],this.name=e}_remove(e,n){const a=this.listeners.get(e);if(!a){zf.warn(`No listeners for ${e}`);return}this.listeners.set(e,[...a.filter(({callback:u})=>u!==n)])}dispatch(e,n,a,u){typeof e=="string"&&this.protectedChannels.indexOf(e)>-1&&(u===E_||zf.warn(`WARNING: ${e} is protected and dispatching on it can have unintended consequences`));const d={channel:e,payload:{...n},source:a,patternInfo:[]};try{this._toListeners(d)}catch(_){zf.error(_)}}listen(e,n,a="noname"){let u;if(typeof n!="function")throw new Is({name:V8,message:"No callback supplied to Hub"});u=n;let d=this.listeners.get(e);return d||(d=[],this.listeners.set(e,d)),d.push({name:a,callback:u}),()=>{this._remove(e,u)}}_toListeners(e){const{channel:n,payload:a}=e,u=this.listeners.get(n);u&&u.forEach(d=>{zf.debug(`Dispatching to ${n} with `,a);try{d.callback(e)}catch(_){zf.error(_)}})}}const IE=new $8("__default__"),W8=()=>{if(typeof window<"u"&&typeof window.atob=="function")return window.atob;if(typeof atob=="function")return atob;throw new Is({name:"Base64EncoderError",message:"Cannot resolve the `atob` function from the environment."})},G8={convert(t){return W8()(t)}};var rl;(function(t){t.AuthTokenConfigException="AuthTokenConfigException",t.AuthUserPoolAndIdentityPoolException="AuthUserPoolAndIdentityPoolException",t.AuthUserPoolException="AuthUserPoolException",t.InvalidIdentityPoolIdException="InvalidIdentityPoolIdException",t.OAuthNotConfigureException="OAuthNotConfigureException"})(rl||(rl={}));const H8={[rl.AuthTokenConfigException]:{message:"Auth Token Provider not configured.",recoverySuggestion:"Make sure to call Amplify.configure in your app."},[rl.AuthUserPoolAndIdentityPoolException]:{message:"Auth UserPool or IdentityPool not configured.",recoverySuggestion:"Make sure to call Amplify.configure in your app with UserPoolId and IdentityPoolId."},[rl.AuthUserPoolException]:{message:"Auth UserPool not configured.",recoverySuggestion:"Make sure to call Amplify.configure in your app with userPoolId and userPoolClientId."},[rl.InvalidIdentityPoolIdException]:{message:"Invalid identity pool id provided.",recoverySuggestion:"Make sure a valid identityPoolId is given in the config."},[rl.OAuthNotConfigureException]:{message:"oauth param not configured.",recoverySuggestion:"Make sure to call Amplify.configure with oauth parameter in your app."}},nR=rR(H8);function po(t){let e=!0;t?e=!!t.userPoolId&&!!t.userPoolClientId:e=!1,nR(e,rl.AuthUserPoolException)}function Gy(t){const e=!!(t!=null&&t.identityPoolId);nR(e,rl.InvalidIdentityPoolIdException)}function km(t){const e=t.split(".");if(e.length!==3)throw new Error("Invalid token");try{const a=e[1].replace(/-/g,"+").replace(/_/g,"/"),u=decodeURIComponent(G8.convert(a).split("").map(_=>`%${`00${_.charCodeAt(0).toString(16)}`.slice(-2)}`).join("")),d=JSON.parse(u);return{toString:()=>t,payload:d}}catch{throw new Error("Invalid token payload")}}const iR=t=>{const e=Reflect.ownKeys(t);for(const n of e){const a=t[n];(a&&typeof a=="object"||typeof a=="function")&&iR(a)}return Object.freeze(t)},q8=new Ha("parseAWSExports"),Z8={API_KEY:"apiKey",AWS_IAM:"iam",AMAZON_COGNITO_USER_POOLS:"userPool",OPENID_CONNECT:"oidc",NONE:"none",AWS_LAMBDA:"lambda",LAMBDA:"lambda"},K8=(t={})=>{var it,ur,Xt,Pr,Yt,si;if(!Object.prototype.hasOwnProperty.call(t,"aws_project_region"))throw new Is({name:"InvalidParameterException",message:"Invalid config parameter.",recoverySuggestion:"Ensure passing the config object imported from `amplifyconfiguration.json`."});const{aws_appsync_apiKey:e,aws_appsync_authenticationType:n,aws_appsync_graphqlEndpoint:a,aws_appsync_region:u,aws_bots_config:d,aws_cognito_identity_pool_id:_,aws_cognito_sign_up_verification_method:l,aws_cognito_mfa_configuration:w,aws_cognito_mfa_types:T,aws_cognito_password_protection_settings:C,aws_cognito_verification_mechanisms:P,aws_cognito_signup_attributes:z,aws_cognito_social_providers:W,aws_cognito_username_attributes:U,aws_mandatory_sign_in:j,aws_mobile_analytics_app_id:L,aws_mobile_analytics_app_region:V,aws_user_files_s3_bucket:R,aws_user_files_s3_bucket_region:F,aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing:H,aws_user_pools_id:Q,aws_user_pools_web_client_id:te,geo:se,oauth:ge,predictions:xe,aws_cloud_logic_custom:Ee,Notifications:Be,modelIntrospection:Fe}=t,Ve={};L&&(Ve.Analytics={Pinpoint:{appId:L,region:V}});const{InAppMessaging:kt,Push:Dt}=Be??{};if(kt!=null&&kt.AWSPinpoint||Dt!=null&&Dt.AWSPinpoint){if(kt!=null&&kt.AWSPinpoint){const{appId:mr,region:Vt}=kt.AWSPinpoint;Ve.Notifications={InAppMessaging:{Pinpoint:{appId:mr,region:Vt}}}}if(Dt!=null&&Dt.AWSPinpoint){const{appId:mr,region:Vt}=Dt.AWSPinpoint;Ve.Notifications={...Ve.Notifications,PushNotification:{Pinpoint:{appId:mr,region:Vt}}}}}if(Array.isArray(d)&&(Ve.Interactions={LexV1:Object.fromEntries(d.map(mr=>[mr.name,mr]))}),a){const mr=Z8[n];mr||q8.debug(`Invalid authentication type ${n}. Falling back to IAM.`),Ve.API={GraphQL:{endpoint:a,apiKey:e,region:u,defaultAuthMode:mr??"iam"}},Fe&&(Ve.API.GraphQL.modelIntrospection=Fe)}const Ut=w?{status:w&&w.toLowerCase(),totpEnabled:(T==null?void 0:T.includes("TOTP"))??!1,smsEnabled:(T==null?void 0:T.includes("SMS"))??!1}:void 0,cr=C?{minLength:C.passwordPolicyMinLength,requireLowercase:((it=C.passwordPolicyCharacters)==null?void 0:it.includes("REQUIRES_LOWERCASE"))??!1,requireUppercase:((ur=C.passwordPolicyCharacters)==null?void 0:ur.includes("REQUIRES_UPPERCASE"))??!1,requireNumbers:((Xt=C.passwordPolicyCharacters)==null?void 0:Xt.includes("REQUIRES_NUMBERS"))??!1,requireSpecialCharacters:((Pr=C.passwordPolicyCharacters)==null?void 0:Pr.includes("REQUIRES_SYMBOLS"))??!1}:void 0,Tt=Array.from(new Set([...P??[],...z??[]])).reduce((mr,Vt)=>({...mr,[Vt.toLowerCase()]:{required:!0}}),{}),gt=(U==null?void 0:U.includes("EMAIL"))??!1,je=(U==null?void 0:U.includes("PHONE_NUMBER"))??!1;(_||Q)&&(Ve.Auth={Cognito:{identityPoolId:_,allowGuestAccess:j!=="enable",signUpVerificationMethod:l,userAttributes:Tt,userPoolClientId:te,userPoolId:Q,mfa:Ut,passwordFormat:cr,loginWith:{username:!(gt||je),email:gt,phone:je}}});const et=ge?Object.keys(ge).length>0:!1,nt=W?W.length>0:!1;if(Ve.Auth&&et&&(Ve.Auth.Cognito.loginWith={...Ve.Auth.Cognito.loginWith,oauth:{...X8(ge),...nt&&{providers:Y8(W)}}}),R&&(Ve.Storage={S3:{bucket:R,region:F,dangerouslyConnectToHttpEndpointForTesting:H}}),se){const{amazon_location_service:mr}=se;Ve.Geo={LocationService:{maps:mr.maps,geofenceCollections:mr.geofenceCollections,searchIndices:mr.search_indices,region:mr.region}}}if(Ee&&(Ve.API={...Ve.API,REST:Ee.reduce((mr,Vt)=>{const{name:Ii,endpoint:qr,region:pn,service:Tr}=Vt;return{...mr,[Ii]:{endpoint:qr,...Tr?{service:Tr}:void 0,...pn?{region:pn}:void 0}}},{})}),xe){const{VoiceId:mr}=((si=(Yt=xe==null?void 0:xe.convert)==null?void 0:Yt.speechGenerator)==null?void 0:si.defaults)??{};Ve.Predictions=mr?{...xe,convert:{...xe.convert,speechGenerator:{...xe.convert.speechGenerator,defaults:{voiceId:mr}}}}:xe}return Ve},_k=t=>(t==null?void 0:t.split(","))??[],X8=({domain:t,scope:e,redirectSignIn:n,redirectSignOut:a,responseType:u})=>({domain:t,scopes:e,redirectSignIn:_k(n),redirectSignOut:_k(a),responseType:u}),Y8=t=>t.map(e=>{const n=e.toLowerCase();return n.charAt(0).toUpperCase()+n.slice(1)}),Q8=Symbol("oauth-listener");function J8(t){const{version:e}=t;return e?e.startsWith("1"):!1}function e6(t){if(!t)return;const{bucket_name:e,aws_region:n,buckets:a}=t;return{S3:{bucket:e,region:n,buckets:a&&h6(a)}}}function t6(t){if(!t)return;const{user_pool_id:e,user_pool_client_id:n,identity_pool_id:a,password_policy:u,mfa_configuration:d,mfa_methods:_,unauthenticated_identities_enabled:l,oauth:w,username_attributes:T,standard_required_attributes:C}=t,P={Cognito:{userPoolId:e,userPoolClientId:n}};return a&&(P.Cognito={...P.Cognito,identityPoolId:a}),u&&(P.Cognito.passwordFormat={requireLowercase:u.require_lowercase,requireNumbers:u.require_numbers,requireUppercase:u.require_uppercase,requireSpecialCharacters:u.require_symbols,minLength:u.min_length??6}),d&&(P.Cognito.mfa={status:u6(d),smsEnabled:_==null?void 0:_.includes("SMS"),totpEnabled:_==null?void 0:_.includes("TOTP")}),l&&(P.Cognito.allowGuestAccess=l),w&&(P.Cognito.loginWith={oauth:{domain:w.domain,redirectSignIn:w.redirect_sign_in_uri,redirectSignOut:w.redirect_sign_out_uri,responseType:w.response_type==="token"?"token":"code",scopes:w.scopes,providers:c6(w.identity_providers)}}),T&&(P.Cognito.loginWith={...P.Cognito.loginWith,email:T.includes("email"),phone:T.includes("phone_number"),username:T.includes("username")}),C&&(P.Cognito.userAttributes=C.reduce((z,W)=>({...z,[W]:{required:!0}}),{})),P}function r6(t){if(!(t!=null&&t.amazon_pinpoint))return;const{amazon_pinpoint:e}=t;return{Pinpoint:{appId:e.app_id,region:e.aws_region}}}function n6(t){if(!t)return;const{aws_region:e,geofence_collections:n,maps:a,search_indices:u}=t;return{LocationService:{region:e,searchIndices:u,geofenceCollections:n,maps:a}}}function i6(t){if(!t)return;const{aws_region:e,default_authorization_type:n,url:a,api_key:u,model_introspection:d}=t;return{GraphQL:{endpoint:a,defaultAuthMode:l6(n),region:e,apiKey:u,modelIntrospection:d}}}function o6(t){if(!t)return;const{aws_region:e,channels:n,amazon_pinpoint_app_id:a}=t,u=n.includes("IN_APP_MESSAGING"),d=n.includes("APNS")||n.includes("FCM");if(!(u||d))return;const _={};return u&&(_.InAppMessaging={Pinpoint:{appId:a,region:e}}),d&&(_.PushNotification={Pinpoint:{appId:a,region:e}}),_}function a6(t){const e={};return t.storage&&(e.Storage=e6(t.storage)),t.auth&&(e.Auth=t6(t.auth)),t.analytics&&(e.Analytics=r6(t.analytics)),t.geo&&(e.Geo=n6(t.geo)),t.data&&(e.API=i6(t.data)),t.notifications&&(e.Notifications=o6(t.notifications)),e}const s6={AMAZON_COGNITO_USER_POOLS:"userPool",API_KEY:"apiKey",AWS_IAM:"iam",AWS_LAMBDA:"lambda",OPENID_CONNECT:"oidc"};function l6(t){return s6[t]}const vk={GOOGLE:"Google",LOGIN_WITH_AMAZON:"Amazon",FACEBOOK:"Facebook",SIGN_IN_WITH_APPLE:"Apple"};function c6(t=[]){return t.reduce((e,n)=>(vk[n]!==void 0&&e.push(vk[n]),e),[])}function u6(t){return t==="OPTIONAL"?"optional":t==="REQUIRED"?"on":"off"}function h6(t){const e={};return t.forEach(({name:n,bucket_name:a,aws_region:u})=>{if(n in e)throw new Error(`Duplicate friendly name found: ${n}. Name must be unique.`);e[n]={bucketName:a,region:u}}),e}const oR=t=>Object.keys(t).some(e=>e.startsWith("aws_"))?K8(t):J8(t)?a6(t):t;function xk({expiresAt:t,clockDrift:e}){return Date.now()+e>t}class d6{configure(e,n){this.authConfig=e,this.authOptions=n}async fetchAuthSession(e={}){var d,_,l,w,T,C;let n,a;const u=await this.getTokens(e);return u?(a=(_=(d=u.accessToken)==null?void 0:d.payload)==null?void 0:_.sub,n=await((w=(l=this.authOptions)==null?void 0:l.credentialsProvider)==null?void 0:w.getCredentialsAndIdentityId({authConfig:this.authConfig,tokens:u,authenticated:!0,forceRefresh:e.forceRefresh}))):n=await((C=(T=this.authOptions)==null?void 0:T.credentialsProvider)==null?void 0:C.getCredentialsAndIdentityId({authConfig:this.authConfig,authenticated:!1,forceRefresh:e.forceRefresh})),{tokens:u,credentials:n==null?void 0:n.credentials,identityId:n==null?void 0:n.identityId,userSub:a}}async clearCredentials(){var e,n;await((n=(e=this.authOptions)==null?void 0:e.credentialsProvider)==null?void 0:n.clearCredentialsAndIdentityId())}async getTokens(e){var n,a;return await((a=(n=this.authOptions)==null?void 0:n.tokenProvider)==null?void 0:a.getTokens(e))??void 0}}const p6=t=>new TextEncoder().encode(t);typeof Buffer<"u"&&Buffer.from;for(let t=0;t<256;t++){let e=t.toString(16).toLowerCase();e.length===1&&(e=`0${e}`)}var Zn;(function(t){t.WebUnknown="0",t.React="1",t.NextJs="2",t.Angular="3",t.VueJs="4",t.Nuxt="5",t.Svelte="6",t.ServerSideUnknown="100",t.ReactSSR="101",t.NextJsSSR="102",t.AngularSSR="103",t.VueJsSSR="104",t.NuxtSSR="105",t.SvelteSSR="106",t.ReactNative="201",t.Expo="202"})(Zn||(Zn={}));var bk;(function(t){t.API="api",t.Auth="auth",t.Analytics="analytics",t.DataStore="datastore",t.Geo="geo",t.InAppMessaging="inappmessaging",t.Interactions="interactions",t.Predictions="predictions",t.PubSub="pubsub",t.PushNotification="pushnotification",t.Storage="storage"})(bk||(bk={}));var wk;(function(t){t.Record="1",t.IdentifyUser="2"})(wk||(wk={}));var Ek;(function(t){t.GraphQl="1",t.Get="2",t.Post="3",t.Put="4",t.Patch="5",t.Del="6",t.Head="7"})(Ek||(Ek={}));var Sk;(function(t){t.SignUp="1",t.ConfirmSignUp="2",t.ResendSignUpCode="3",t.SignIn="4",t.FetchMFAPreference="6",t.UpdateMFAPreference="7",t.SetUpTOTP="10",t.VerifyTOTPSetup="11",t.ConfirmSignIn="12",t.DeleteUserAttributes="15",t.DeleteUser="16",t.UpdateUserAttributes="17",t.FetchUserAttributes="18",t.ConfirmUserAttribute="22",t.SignOut="26",t.UpdatePassword="27",t.ResetPassword="28",t.ConfirmResetPassword="29",t.FederatedSignIn="30",t.RememberDevice="32",t.ForgetDevice="33",t.FetchDevices="34",t.SendUserAttributeVerificationCode="35",t.SignInWithRedirect="36"})(Sk||(Sk={}));var Tk;(function(t){t.Subscribe="1",t.GraphQl="2"})(Tk||(Tk={}));var Ak;(function(t){t.SearchByText="0",t.SearchByCoordinates="1",t.SearchForSuggestions="2",t.SearchByPlaceId="3",t.SaveGeofences="4",t.GetGeofence="5",t.ListGeofences="6",t.DeleteGeofences="7"})(Ak||(Ak={}));var Ik;(function(t){t.SyncMessages="1",t.IdentifyUser="2",t.NotifyMessageInteraction="3"})(Ik||(Ik={}));var Ck;(function(t){t.None="0"})(Ck||(Ck={}));var kk;(function(t){t.Convert="1",t.Identify="2",t.Interpret="3"})(kk||(kk={}));var Pk;(function(t){t.Subscribe="1"})(Pk||(Pk={}));var Dk;(function(t){t.InitializePushNotifications="1",t.IdentifyUser="2"})(Dk||(Dk={}));var Mk;(function(t){t.UploadData="1",t.DownloadData="2",t.List="3",t.Copy="4",t.Remove="5",t.GetProperties="6",t.GetUrl="7"})(Mk||(Mk={}));const Y_=()=>typeof global<"u",Od=()=>typeof window<"u",aR=()=>typeof document<"u",HS=()=>typeof process<"u",Pm=(t,e)=>!!Object.keys(t).find(n=>n.startsWith(e));function f6(){const t=a=>a.startsWith("_react")||a.startsWith("__react"),e=a=>Object.keys(a).find(t),n=()=>Array.from(document.querySelectorAll("[id]"));return aR()&&n().some(e)}function m6(){return HS()&&typeof process.env<"u"&&!!Object.keys(process.env).find(t=>t.includes("react"))}function g6(){return Od()&&Pm(window,"__VUE")}function y6(){return Y_()&&Pm(global,"__VUE")}function _6(){return Od()&&Pm(window,"__SVELTE")}function v6(){return HS()&&typeof process.env<"u"&&!!Object.keys(process.env).find(t=>t.includes("svelte"))}function x6(){return Od()&&window.next&&typeof window.next=="object"}function b6(){return Y_()&&(Pm(global,"__next")||Pm(global,"__NEXT"))}function w6(){return Od()&&(window.__NUXT__!==void 0||window.$nuxt!==void 0)}function E6(){return Y_()&&typeof global.__NUXT_PATHS__<"u"}function S6(){const t=!!(aR()&&document.querySelector("[ng-version]")),e=!!(Od()&&typeof window.ng<"u");return t||e}function T6(){var t;return HS()&&typeof process.env=="object"&&((t={}.npm_lifecycle_script)==null?void 0:t.startsWith("ng "))||!1}function A6(){return typeof navigator<"u"&&typeof navigator.product<"u"&&navigator.product==="ReactNative"}function I6(){return Y_()&&typeof global.expo<"u"}function C6(){return Od()}const k6=[{platform:Zn.Expo,detectionMethod:I6},{platform:Zn.ReactNative,detectionMethod:A6},{platform:Zn.NextJs,detectionMethod:x6},{platform:Zn.Nuxt,detectionMethod:w6},{platform:Zn.Angular,detectionMethod:S6},{platform:Zn.React,detectionMethod:f6},{platform:Zn.VueJs,detectionMethod:g6},{platform:Zn.Svelte,detectionMethod:_6},{platform:Zn.WebUnknown,detectionMethod:C6},{platform:Zn.NextJsSSR,detectionMethod:b6},{platform:Zn.NuxtSSR,detectionMethod:E6},{platform:Zn.ReactSSR,detectionMethod:m6},{platform:Zn.VueJsSSR,detectionMethod:y6},{platform:Zn.AngularSSR,detectionMethod:T6},{platform:Zn.SvelteSSR,detectionMethod:v6}];function P6(){var t;return((t=k6.find(e=>e.detectionMethod()))==null?void 0:t.platform)||Zn.ServerSideUnknown}const D6=()=>typeof window<"u"&&typeof window.document<"u";class M6{constructor(){this.oAuthListener=void 0,this.resourcesConfig={},this.libraryOptions={},this.Auth=new d6}configure(e,n){const a=oR(e);this.resourcesConfig=a,n&&(this.libraryOptions=n),this.resourcesConfig=iR(this.resourcesConfig),this.Auth.configure(this.resourcesConfig.Auth,this.libraryOptions.Auth),IE.dispatch("core",{event:"configure",data:this.resourcesConfig},"Configure",E_),this.notifyOAuthListener()}getConfig(){return this.resourcesConfig}[Q8](e){var n,a,u;(a=(n=this.resourcesConfig.Auth)==null?void 0:n.Cognito.loginWith)!=null&&a.oauth?e((u=this.resourcesConfig.Auth)==null?void 0:u.Cognito):this.oAuthListener=e}notifyOAuthListener(){var e,n,a;!((n=(e=this.resourcesConfig.Auth)==null?void 0:e.Cognito.loginWith)!=null&&n.oauth)||!this.oAuthListener||(this.oAuthListener((a=this.resourcesConfig.Auth)==null?void 0:a.Cognito),this.oAuthListener=void 0)}}const Js=new M6,Q_=t=>{const{headers:e,statusCode:n}=t;return{...z6(t)?t.$metadata:{},httpStatusCode:n,requestId:e["x-amzn-requestid"]??e["x-amzn-request-id"]??e["x-amz-request-id"],extendedRequestId:e["x-amz-id-2"],cfId:e["x-amz-cf-id"]}},z6=t=>typeof(t==null?void 0:t.$metadata)=="object",Nm=async t=>{if(!t||t.statusCode<300)return;const e=await J_(t),a=(_=>{const[l]=_.toString().split(/[,:]+/);return l.includes("#")?l.split("#")[1]:l})(t.headers["x-amzn-errortype"]??e.code??e.__type??"UnknownError"),u=e.message??e.Message??"Unknown error",d=new Error(u);return Object.assign(d,{name:a,$metadata:Q_(t)})},J_=async t=>{if(!t.body)throw new Error("Missing response payload");const e=await t.body.json();return Object.assign(e,{$metadata:Q_(t)})},qS=(t,e,n,a)=>async(u,d)=>{const _={...a,...u},l=await _.endpointResolver(_,d),w=await e(d,l),T=await t(w,{..._});return n(T)},sR={id:"aws",outputs:{dnsSuffix:"amazonaws.com"},regionRegex:"^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$",regions:["aws-global"]},R6={partitions:[sR,{id:"aws-cn",outputs:{dnsSuffix:"amazonaws.com.cn"},regionRegex:"^cn\\-\\w+\\-\\d+$",regions:["aws-cn-global"]}]},lR=t=>{const{partitions:e}=R6;for(const{regions:n,outputs:a,regionRegex:u}of e){const d=new RegExp(u);if(n.includes(t)||d.test(t))return a.dnsSuffix}return sR.outputs.dnsSuffix},O6=3,F6=({maxAttempts:t=O6,retryDecider:e,computeDelay:n,abortSignal:a})=>{if(t<1)throw new Error("maxAttempts must be greater than 0");return(u,d)=>async function(l){let w,T=d.attemptsCount??0,C;const P=()=>{if(C)return zk(C,T),C;throw zk(w,T),w};for(;!(a!=null&&a.aborted)&&TT?d.attemptsCount??0:T+1,d.attemptsCount=T,await e(C,w)){if(!(a!=null&&a.aborted)&&T{if(e!=null&&e.aborted)return Promise.resolve();let n,a;const u=new Promise(d=>{a=d,n=setTimeout(d,t)});return e==null||e.addEventListener("abort",function d(_){clearTimeout(n),e==null||e.removeEventListener("abort",d),a()}),u},zk=(t,e)=>{Object.prototype.toString.call(t)==="[object Object]"&&(t.$metadata={...t.$metadata??{},attempts:e})},B6=({userAgentHeader:t="x-amz-user-agent",userAgentValue:e=""})=>n=>async function(u){if(e.trim().length===0)return await n(u);{const d=t.toLowerCase();return u.headers[d]=u.headers[d]?`${u.headers[d]} ${e}`:e,await n(u)}},ZS=(t,e)=>(n,a)=>{const u={};let d=_=>t(_,a);for(let _=e.length-1;_>=0;_--){const l=e[_];d=l(a)(d,u)}return d(n)},eb=t=>{let e;return()=>(e||(e=t()),e)},N6=t=>!["HEAD","GET","DELETE"].includes(t.toUpperCase()),U6=async({url:t,method:e,headers:n,body:a},{abortSignal:u,cache:d,withCrossDomainCredentials:_})=>{var P;let l;try{l=await fetch(t,{method:e,headers:n,body:N6(e)?a:void 0,signal:u,cache:d,credentials:_?"include":"same-origin"})}catch(z){throw z instanceof TypeError?new Is({name:Cm.NetworkError,message:"A network error has occurred.",underlyingError:z}):z}const w={};(P=l.headers)==null||P.forEach((z,W)=>{w[W.toLowerCase()]=z});const T={statusCode:l.status,headers:w,body:null},C=Object.assign(l.body??{},{text:eb(()=>l.text()),blob:eb(()=>l.blob()),json:eb(()=>l.json())});return{...T,body:C}},cR=ZS(U6,[B6,F6]),j6=5*60*1e3;function V6(t=j6){return a=>{const u=2**a*100+100*Math.random();return u>t?!1:u}}const Rk=5*60*1e3,uR=t=>{const n=V6(Rk)(t);return n===!1?Rk:n},$6=["AuthFailure","InvalidSignatureException","RequestExpired","RequestInTheFuture","RequestTimeTooSkewed","SignatureDoesNotMatch","BadRequestException"],W6=t=>!!t&&$6.includes(t),hR=t=>async(e,n)=>{const a=n??await t(e)??void 0,u=(a==null?void 0:a.code)||(a==null?void 0:a.name),d=e==null?void 0:e.statusCode;return Z6(n)||q6(d,u)||W6(u)||K6(d,u)},G6=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException"],H6=["TimeoutError","RequestTimeout","RequestTimeoutException"],q6=(t,e)=>t===429||!!e&&G6.includes(e),Z6=t=>(t==null?void 0:t.name)==="Network error",K6=(t,e)=>!!t&&[500,502,503,504].includes(t)||!!e&&H6.includes(e),CE=URL,X6="6.6.0";let cm;const Hy=[];let S_=!1;const Y6=10,Q6=10,J6=1e3,dR=()=>{var t;if(!cm){if(cm=P6(),S_)for(;Hy.length;)(t=Hy.pop())==null||t();else Hy.forEach(e=>{e()});Ok(Zn.ServerSideUnknown,Y6),Ok(Zn.WebUnknown,Q6)}return cm},eN=t=>{S_||Hy.push(t)};function tN(){cm=void 0}function Ok(t,e){cm===t&&!S_&&setTimeout(()=>{tN(),S_=!0,setTimeout(dR,J6)},e)}const rN={},nN=(t,e)=>{var n,a;return(a=(n=rN[t])==null?void 0:n[e])==null?void 0:a.additionalDetails},iN="aws-amplify",oN=({category:t,action:e}={})=>{const n=[[iN,X6]];if(t&&n.push([t,e]),n.push(["framework",dR()]),t&&e){const a=nN(t,e);a&&a.forEach(u=>{n.push(u)})}return n},KS=t=>oN(t).map(([a,u])=>a&&u?`${a}/${u}`:a).join(" "),aN="cognito-identity",sN=({region:t})=>({url:new CE(`https://cognito-identity.${t}.${lR(t)}`)}),lN=()=>t=>async function(n){return n.headers["cache-control"]="no-store",t(n)},pR=ZS(cR,[lN]),XS={service:aN,endpointResolver:sN,retryDecider:hR(Nm),computeDelay:uR,userAgentValue:KS(),cache:"no-store"};eN(()=>{XS.userAgentValue=KS()});const fR=t=>({"content-type":"application/x-amz-json-1.1","x-amz-target":`AWSCognitoIdentityService.${t}`}),mR=({url:t},e,n)=>({headers:e,url:t,body:n,method:"POST"}),cN=(t,e)=>{const n=fR("GetId"),a=JSON.stringify(t);return mR(e,n,a)},uN=async t=>{if(t.statusCode>=300)throw await Nm(t);return{IdentityId:(await J_(t)).IdentityId,$metadata:Q_(t)}},hN=qS(pR,cN,uN,XS),dN=(t,e)=>{const n=fR("GetCredentialsForIdentity"),a=JSON.stringify(t);return mR(e,n,a)},pN=async t=>{if(t.statusCode>=300)throw await Nm(t);{const e=await J_(t);return{IdentityId:e.IdentityId,Credentials:fN(e.Credentials),$metadata:Q_(t)}}},fN=({AccessKeyId:t,SecretKey:e,SessionToken:n,Expiration:a}={})=>({AccessKeyId:t,SecretKey:e,SessionToken:n,Expiration:a&&new Date(a*1e3)}),Fk=qS(pR,dN,pN,XS);class Vg extends Is{constructor(){super({name:Cm.PlatformNotSupported,message:"Function not supported on current platform"})}}class gR{constructor(e){this.storage=e}async setItem(e,n){if(!this.storage)throw new Vg;this.storage.setItem(e,n)}async getItem(e){if(!this.storage)throw new Vg;return this.storage.getItem(e)}async removeItem(e){if(!this.storage)throw new Vg;this.storage.removeItem(e)}async clear(){if(!this.storage)throw new Vg;this.storage.clear()}}class yR{constructor(){this.storage=new Map}get length(){return this.storage.size}key(e){return e>this.length-1?null:Array.from(this.storage.keys())[e]}setItem(e,n){this.storage.set(e,n)}getItem(e){return this.storage.get(e)??null}removeItem(e){this.storage.delete(e)}clear(){this.storage.clear()}}const mN=()=>typeof window<"u"&&window.localStorage?window.localStorage:new yR,gN=()=>typeof window<"u"&&window.sessionStorage?window.sessionStorage:new yR;class yN extends gR{constructor(){super(mN())}}class _N extends gR{constructor(){super(gN())}}/*! js-cookie v3.0.5 | MIT */function $g(t){for(var e=1;e"u")){_=$g({},e,_),typeof _.expires=="number"&&(_.expires=new Date(Date.now()+_.expires*864e5)),_.expires&&(_.expires=_.expires.toUTCString()),u=encodeURIComponent(u).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var l="";for(var w in _)_[w]&&(l+="; "+w,_[w]!==!0&&(l+="="+_[w].split(";")[0]));return document.cookie=u+"="+t.write(d,u)+l}}function a(u){if(!(typeof document>"u"||arguments.length&&!u)){for(var d=document.cookie?document.cookie.split("; "):[],_={},l=0;lthis.removeItem(a));await Promise.all(n)}getData(){return{path:this.path,expires:this.expires,domain:this.domain,secure:this.secure,...this.sameSite&&{sameSite:this.sameSite}}}}const Dm=new yN;new _N;const xN=t=>{let e;return async(...n)=>e||(e=new Promise((a,u)=>{t(...n).then(d=>{a(d)}).catch(d=>{u(d)}).finally(()=>{e=void 0})}),e)};class Dn extends Is{constructor(e){super(e),this.constructor=Dn,Object.setPrototypeOf(this,Dn.prototype)}}function _R(t){if(!t||t.name==="Error"||t instanceof TypeError)throw new Dn({name:Cm.Unknown,message:"An unknown error has occurred.",underlyingError:t})}const vR="cognito-idp",bN=({region:t})=>{var u;const e=(u=Js.getConfig().Auth)==null?void 0:u.Cognito,n=e==null?void 0:e.userPoolEndpoint,a=new CE(`https://${vR}.${t}.${lR(t)}`);return{url:n?new CE(n):a}},wN=()=>(t,e)=>async function(a){return a.headers["cache-control"]="no-store",t(a)},EN=ZS(cR,[wN]),SN={service:vR,endpointResolver:bN,retryDecider:hR(Nm),computeDelay:uR,userAgentValue:KS(),cache:"no-store"},TN=t=>({"content-type":"application/x-amz-json-1.1","x-amz-target":`AWSCognitoIdentityProviderService.${t}`}),AN=({url:t},e,n)=>({headers:e,url:t,body:n,method:"POST"}),IN=t=>(e,n)=>{const a=TN(t),u=JSON.stringify(e);return AN(n,a,u)},CN=()=>async t=>{if(t.statusCode>=300){const e=await Nm(t);throw _R(e),new Dn({name:e.name,message:e.message})}else return await J_(t)},kN=qS(EN,IN("InitiateAuth"),CN(),SN);function PN(t){const e=t==null?void 0:t.split("_")[0];if(!t||t.indexOf("_")<0||!e||typeof e!="string")throw new Dn({name:"InvalidUserPoolId",message:"Invalid user pool id provided."});return e}function PE(t){if(!t||!t.includes(":"))throw new Dn({name:"InvalidIdentityPoolIdException",message:"Invalid identity pool id provided.",recoverySuggestion:"Make sure a valid identityPoolId is given in the config."});return t.split(":")[0]}const xR="UserUnAuthenticatedException",DN="InvalidRedirectException",MN="InvalidAppSchemeException",zN="InvalidPreferredRedirectUrlException";new Dn({name:DN,message:"signInRedirect or signOutRedirect had an invalid format or was not found.",recoverySuggestion:"Please make sure the signIn/Out redirect in your oauth config is valid."});new Dn({name:MN,message:"A valid non-http app scheme was not found in the config.",recoverySuggestion:"Please make sure a valid custom app scheme is present in the config."});new Dn({name:zN,message:"The given preferredRedirectUrl does not match any items in the redirectSignOutUrls array from the config.",recoverySuggestion:"Please make sure a matching preferredRedirectUrl is provided."});const RN="InvalidOriginException";new Dn({name:RN,message:"redirect is coming from a different origin. The oauth flow needs to be initiated from the same origin",recoverySuggestion:"Please call signInWithRedirect from the same origin."});const ON="TokenRefreshException";function FN(t){if(!t||!t.idToken)throw new Dn({name:xR,message:"User needs to be authenticated to call this API.",recoverySuggestion:"Sign in before calling this API again."})}const LN=new Dn({name:ON,message:`Token refresh is not supported when authenticated with the 'implicit grant' (token) oauth flow. + Please change your oauth configuration to use 'code grant' flow.`,recoverySuggestion:`Please logout and change your Amplify configuration to use "code grant" flow. + E.g { responseType: 'code' }`}),BN=new Dn({name:xR,message:"User needs to be authenticated to call this API.",recoverySuggestion:"Sign in before calling this API again."});function NN(t){if(VN(t))throw LN;if(!jN(t))throw BN}const UN={inflightOAuth:"inflightOAuth",oauthSignIn:"oauthSignIn",oauthPKCE:"oauthPKCE",oauthState:"oauthState"};function bR(t){return(t==null?void 0:t.accessToken)||(t==null?void 0:t.idToken)}function jN(t){return bR(t)&&(t==null?void 0:t.refreshToken)}function VN(t){return bR(t)&&!(t!=null&&t.refreshToken)}function $N({username:t,userPoolId:e,userPoolClientId:n}){if(typeof window>"u")return;const a=window.AmazonCognitoAdvancedSecurityData;if(typeof a>"u")return;const u=a.getData(t,e,n);return u?{EncodedData:u}:{}}const WN=async({tokens:t,authConfig:e,username:n})=>{var z,W;po(e==null?void 0:e.Cognito);const a=PN(e.Cognito.userPoolId);NN(t);const u=t.refreshToken,d={REFRESH_TOKEN:u};(z=t.deviceMetadata)!=null&&z.deviceKey&&(d.DEVICE_KEY=t.deviceMetadata.deviceKey);const _=$N({username:n,userPoolId:e.Cognito.userPoolId,userPoolClientId:e.Cognito.userPoolClientId}),{AuthenticationResult:l}=await kN({region:a},{ClientId:(W=e==null?void 0:e.Cognito)==null?void 0:W.userPoolClientId,AuthFlow:"REFRESH_TOKEN_AUTH",AuthParameters:d,UserContextData:_}),w=km((l==null?void 0:l.AccessToken)??""),T=l!=null&&l.IdToken?km(l.IdToken):void 0,{iat:C}=w.payload;if(!C)throw new Dn({name:"iatNotFoundException",message:"iat not found in access token"});const P=C*1e3-new Date().getTime();return{accessToken:w,idToken:T,clockDrift:P,refreshToken:u,username:n}},GN=xN(WN),HN={accessToken:"accessToken",idToken:"idToken",oidcProvider:"oidcProvider",clockDrift:"clockDrift",refreshToken:"refreshToken",deviceKey:"deviceKey",randomPasswordKey:"randomPasswordKey",deviceGroupKey:"deviceGroupKey",signInDetails:"signInDetails",oauthMetadata:"oauthMetadata"};var T_;(function(t){t.InvalidAuthTokens="InvalidAuthTokens"})(T_||(T_={}));const qN={[T_.InvalidAuthTokens]:{message:"Invalid tokens.",recoverySuggestion:"Make sure the tokens are valid."}},ZN=rR(qN);class KN{constructor(){this.name="CognitoIdentityServiceProvider"}getKeyValueStorage(){if(!this.keyValueStorage)throw new Dn({name:"KeyValueStorageNotFoundException",message:"KeyValueStorage was not found in TokenStore"});return this.keyValueStorage}setKeyValueStorage(e){this.keyValueStorage=e}setAuthConfig(e){this.authConfig=e}async loadTokens(){try{const e=await this.getAuthKeys(),n=await this.getKeyValueStorage().getItem(e.accessToken);if(!n)throw new Dn({name:"NoSessionFoundException",message:"Auth session was not found. Make sure to call signIn."});const a=km(n),u=await this.getKeyValueStorage().getItem(e.idToken),d=u?km(u):void 0,_=await this.getKeyValueStorage().getItem(e.refreshToken)??void 0,l=await this.getKeyValueStorage().getItem(e.clockDrift)??"0",w=Number.parseInt(l),T=await this.getKeyValueStorage().getItem(e.signInDetails),C={accessToken:a,idToken:d,refreshToken:_,deviceMetadata:await this.getDeviceMetadata()??void 0,clockDrift:w,username:await this.getLastAuthUser()};return T&&(C.signInDetails=JSON.parse(T)),C}catch{return null}}async storeTokens(e){ZN(e!==void 0,T_.InvalidAuthTokens),await this.clearTokens();const n=e.username;await this.getKeyValueStorage().setItem(this.getLastAuthUserKey(),n);const a=await this.getAuthKeys();await this.getKeyValueStorage().setItem(a.accessToken,e.accessToken.toString()),e.idToken&&await this.getKeyValueStorage().setItem(a.idToken,e.idToken.toString()),e.refreshToken&&await this.getKeyValueStorage().setItem(a.refreshToken,e.refreshToken),e.deviceMetadata&&(e.deviceMetadata.deviceKey&&await this.getKeyValueStorage().setItem(a.deviceKey,e.deviceMetadata.deviceKey),e.deviceMetadata.deviceGroupKey&&await this.getKeyValueStorage().setItem(a.deviceGroupKey,e.deviceMetadata.deviceGroupKey),await this.getKeyValueStorage().setItem(a.randomPasswordKey,e.deviceMetadata.randomPassword)),e.signInDetails&&await this.getKeyValueStorage().setItem(a.signInDetails,JSON.stringify(e.signInDetails)),await this.getKeyValueStorage().setItem(a.clockDrift,`${e.clockDrift}`)}async clearTokens(){const e=await this.getAuthKeys();await Promise.all([this.getKeyValueStorage().removeItem(e.accessToken),this.getKeyValueStorage().removeItem(e.idToken),this.getKeyValueStorage().removeItem(e.clockDrift),this.getKeyValueStorage().removeItem(e.refreshToken),this.getKeyValueStorage().removeItem(e.signInDetails),this.getKeyValueStorage().removeItem(this.getLastAuthUserKey()),this.getKeyValueStorage().removeItem(e.oauthMetadata)])}async getDeviceMetadata(e){const n=await this.getAuthKeys(e),a=await this.getKeyValueStorage().getItem(n.deviceKey),u=await this.getKeyValueStorage().getItem(n.deviceGroupKey),d=await this.getKeyValueStorage().getItem(n.randomPasswordKey);return d&&u&&a?{deviceKey:a,deviceGroupKey:u,randomPassword:d}:null}async clearDeviceMetadata(e){const n=await this.getAuthKeys(e);await Promise.all([this.getKeyValueStorage().removeItem(n.deviceKey),this.getKeyValueStorage().removeItem(n.deviceGroupKey),this.getKeyValueStorage().removeItem(n.randomPasswordKey)])}async getAuthKeys(e){var a;po((a=this.authConfig)==null?void 0:a.Cognito);const n=e??await this.getLastAuthUser();return XN(this.name,`${this.authConfig.Cognito.userPoolClientId}.${n}`)}getLastAuthUserKey(){var n;po((n=this.authConfig)==null?void 0:n.Cognito);const e=this.authConfig.Cognito.userPoolClientId;return`${this.name}.${e}.LastAuthUser`}async getLastAuthUser(){return await this.getKeyValueStorage().getItem(this.getLastAuthUserKey())??"username"}async setOAuthMetadata(e){const{oauthMetadata:n}=await this.getAuthKeys();await this.getKeyValueStorage().setItem(n,JSON.stringify(e))}async getOAuthMetadata(){const{oauthMetadata:e}=await this.getAuthKeys(),n=await this.getKeyValueStorage().getItem(e);return n&&JSON.parse(n)}}const XN=(t,e)=>YS(HN)(`${t}`,e);function YS(t){const e=Object.values({...t});return(n,a)=>e.reduce((u,d)=>({...u,[d]:`${n}.${a}.${d}`}),{})}const Bk="amplify-signin-with-hostedUI",ds="CognitoIdentityServiceProvider";class YN{constructor(e){this.keyValueStorage=e}async clearOAuthInflightData(){po(this.cognitoConfig);const e=ps(ds,this.cognitoConfig.userPoolClientId);await Promise.all([this.keyValueStorage.removeItem(e.inflightOAuth),this.keyValueStorage.removeItem(e.oauthPKCE),this.keyValueStorage.removeItem(e.oauthState)])}async clearOAuthData(){po(this.cognitoConfig);const e=ps(ds,this.cognitoConfig.userPoolClientId);return await this.clearOAuthInflightData(),await this.keyValueStorage.removeItem(Bk),this.keyValueStorage.removeItem(e.oauthSignIn)}loadOAuthState(){po(this.cognitoConfig);const e=ps(ds,this.cognitoConfig.userPoolClientId);return this.keyValueStorage.getItem(e.oauthState)}storeOAuthState(e){po(this.cognitoConfig);const n=ps(ds,this.cognitoConfig.userPoolClientId);return this.keyValueStorage.setItem(n.oauthState,e)}loadPKCE(){po(this.cognitoConfig);const e=ps(ds,this.cognitoConfig.userPoolClientId);return this.keyValueStorage.getItem(e.oauthPKCE)}storePKCE(e){po(this.cognitoConfig);const n=ps(ds,this.cognitoConfig.userPoolClientId);return this.keyValueStorage.setItem(n.oauthPKCE,e)}setAuthConfig(e){this.cognitoConfig=e}async loadOAuthInFlight(){po(this.cognitoConfig);const e=ps(ds,this.cognitoConfig.userPoolClientId);return await this.keyValueStorage.getItem(e.inflightOAuth)==="true"}async storeOAuthInFlight(e){po(this.cognitoConfig);const n=ps(ds,this.cognitoConfig.userPoolClientId);await this.keyValueStorage.setItem(n.inflightOAuth,`${e}`)}async loadOAuthSignIn(){var d;po(this.cognitoConfig);const e=ps(ds,this.cognitoConfig.userPoolClientId),n=await this.keyValueStorage.getItem(Bk),[a,u]=((d=await this.keyValueStorage.getItem(e.oauthSignIn))==null?void 0:d.split(","))??[];return{isOAuthSignIn:a==="true"||n==="true",preferPrivateSession:u==="true"}}async storeOAuthSignIn(e,n=!1){po(this.cognitoConfig);const a=ps(ds,this.cognitoConfig.userPoolClientId);await this.keyValueStorage.setItem(a.oauthSignIn,`${e},${n}`)}}const ps=(t,e)=>YS(UN)(t,e),Nk=new YN(Dm),QN=[],JN=t=>{QN.push(t)};class eU{constructor(){this.waitForInflightOAuth=D6()?async()=>{if(await Nk.loadOAuthInFlight())return this.inflightPromise?this.inflightPromise:(this.inflightPromise=new Promise((e,n)=>{JN(e)}),this.inflightPromise)}:async()=>{}}setAuthConfig(e){Nk.setAuthConfig(e.Cognito),this.authConfig=e}setTokenRefresher(e){this.tokenRefresher=e}setAuthTokenStore(e){this.tokenStore=e}getTokenStore(){if(!this.tokenStore)throw new Dn({name:"EmptyTokenStoreException",message:"TokenStore not set"});return this.tokenStore}getTokenRefresher(){if(!this.tokenRefresher)throw new Dn({name:"EmptyTokenRefresherException",message:"TokenRefresher not set"});return this.tokenRefresher}async getTokens(e){var _,l,w,T,C;let n;try{po((_=this.authConfig)==null?void 0:_.Cognito)}catch{return null}await this.waitForInflightOAuth(),this.inflightPromise=void 0,n=await this.getTokenStore().loadTokens();const a=await this.getTokenStore().getLastAuthUser();if(n===null)return null;const u=!!(n!=null&&n.idToken)&&xk({expiresAt:(((w=(l=n.idToken)==null?void 0:l.payload)==null?void 0:w.exp)??0)*1e3,clockDrift:n.clockDrift??0}),d=xk({expiresAt:(((C=(T=n.accessToken)==null?void 0:T.payload)==null?void 0:C.exp)??0)*1e3,clockDrift:n.clockDrift??0});return(e!=null&&e.forceRefresh||u||d)&&(n=await this.refreshTokens({tokens:n,username:a}),n===null)?null:{accessToken:n==null?void 0:n.accessToken,idToken:n==null?void 0:n.idToken,signInDetails:n==null?void 0:n.signInDetails}}async refreshTokens({tokens:e,username:n}){try{const{signInDetails:a}=e,u=await this.getTokenRefresher()({tokens:e,authConfig:this.authConfig,username:n});return u.signInDetails=a,await this.setTokens({tokens:u}),IE.dispatch("auth",{event:"tokenRefresh"},"Auth",E_),u}catch(a){return this.handleErrors(a)}}handleErrors(e){if(_R(e),e.message!=="Network error"&&this.clearTokens(),IE.dispatch("auth",{event:"tokenRefresh_failure",data:{error:e}},"Auth",E_),e.name.startsWith("NotAuthorizedException"))return null;throw e}async setTokens({tokens:e}){return this.getTokenStore().storeTokens(e)}async clearTokens(){return this.getTokenStore().clearTokens()}getDeviceMetadata(e){return this.getTokenStore().getDeviceMetadata(e)}clearDeviceMetadata(e){return this.getTokenStore().clearDeviceMetadata(e)}setOAuthMetadata(e){return this.getTokenStore().setOAuthMetadata(e)}getOAuthMetadata(){return this.getTokenStore().getOAuthMetadata()}}class tU{constructor(){this.authTokenStore=new KN,this.authTokenStore.setKeyValueStorage(Dm),this.tokenOrchestrator=new eU,this.tokenOrchestrator.setAuthTokenStore(this.authTokenStore),this.tokenOrchestrator.setTokenRefresher(GN)}getTokens({forceRefresh:e}={forceRefresh:!1}){return this.tokenOrchestrator.getTokens({forceRefresh:e})}setKeyValueStorage(e){this.authTokenStore.setKeyValueStorage(e)}setAuthConfig(e){this.authTokenStore.setAuthConfig(e),this.tokenOrchestrator.setAuthConfig(e)}}const Gg=new tU,rU={identityId:"identityId"},nU=new Ha("DefaultIdentityIdStore");class iU{setAuthConfig(e){Gy(e.Cognito),this.authConfig=e,this._authKeys=oU("Cognito",e.Cognito.identityPoolId)}constructor(e){this._authKeys={},this.keyValueStorage=e}async loadIdentityId(){var e;Gy((e=this.authConfig)==null?void 0:e.Cognito);try{if(this._primaryIdentityId)return{id:this._primaryIdentityId,type:"primary"};{const n=await this.keyValueStorage.getItem(this._authKeys.identityId);return n?{id:n,type:"guest"}:null}}catch(n){return nU.log("Error getting stored IdentityId.",n),null}}async storeIdentityId(e){var n;Gy((n=this.authConfig)==null?void 0:n.Cognito),e.type==="guest"?(this.keyValueStorage.setItem(this._authKeys.identityId,e.id),this._primaryIdentityId=void 0):(this._primaryIdentityId=e.id,this.keyValueStorage.removeItem(this._authKeys.identityId))}async clearIdentityId(){this._primaryIdentityId=void 0,await this.keyValueStorage.removeItem(this._authKeys.identityId)}}const oU=(t,e)=>YS(rU)(`com.amplify.${t}`,e);function wR(t){const e=km(t).payload.iss,n={};if(!e)throw new Dn({name:"InvalidIdTokenException",message:"Invalid Idtoken."});const a=e.replace(/(^\w+:|^)\/\//,"");return n[a]=t,n}const aU=new Ha("CognitoIdentityIdProvider");async function sU({tokens:t,authConfig:e,identityIdStore:n}){n.setAuthConfig({Cognito:e});let a=await n.loadIdentityId();if(t){if(a&&a.type==="primary")return a.id;{const u=t.idToken?wR(t.idToken.toString()):{},d=await Uk(u,e);a&&a.id===d&&aU.debug(`The guest identity ${a.id} has become the primary identity.`),a={id:d,type:"primary"}}}else{if(a&&a.type==="guest")return a.id;a={id:await Uk({},e),type:"guest"}}return n.storeIdentityId(a),a.id}async function Uk(t,e){const n=e==null?void 0:e.identityPoolId,a=PE(n),u=(await hN({region:a},{IdentityPoolId:n,Logins:t})).IdentityId;if(!u)throw new Dn({name:"GetIdResponseException",message:"Received undefined response from getId operation",recoverySuggestion:"Make sure to pass a valid identityPoolId in the configuration."});return u}const Hg=new Ha("CognitoCredentialsProvider"),jk=50*60*1e3;class lU{constructor(e){this._nextCredentialsRefresh=0,this._identityIdStore=e}async clearCredentialsAndIdentityId(){Hg.debug("Clearing out credentials and identityId"),this._credentialsAndIdentityId=void 0,await this._identityIdStore.clearIdentityId()}async clearCredentials(){Hg.debug("Clearing out in-memory credentials"),this._credentialsAndIdentityId=void 0}async getCredentialsAndIdentityId(e){const n=e.authenticated,{tokens:a}=e,{authConfig:u}=e;try{Gy(u==null?void 0:u.Cognito)}catch{return}if(!n&&!u.Cognito.allowGuestAccess)return;const{forceRefresh:d}=e,_=this.hasTokenChanged(a),l=await sU({tokens:a,authConfig:u.Cognito,identityIdStore:this._identityIdStore});return(d||_)&&this.clearCredentials(),n?(FN(a),this.credsForOIDCTokens(u.Cognito,a,l)):this.getGuestCredentials(l,u.Cognito)}async getGuestCredentials(e,n){if(this._credentialsAndIdentityId&&!this.isPastTTL()&&this._credentialsAndIdentityId.isAuthenticatedCreds===!1)return Hg.info("returning stored credentials as they neither past TTL nor expired."),this._credentialsAndIdentityId;this.clearCredentials();const a=PE(n.identityPoolId),u=await Fk({region:a},{IdentityId:e});if(u.Credentials&&u.Credentials.AccessKeyId&&u.Credentials.SecretKey){this._nextCredentialsRefresh=new Date().getTime()+jk;const d={credentials:{accessKeyId:u.Credentials.AccessKeyId,secretAccessKey:u.Credentials.SecretKey,sessionToken:u.Credentials.SessionToken,expiration:u.Credentials.Expiration},identityId:e},_=u.IdentityId;return _&&(d.identityId=_,this._identityIdStore.storeIdentityId({id:_,type:"guest"})),this._credentialsAndIdentityId={...d,isAuthenticatedCreds:!1},d}else throw new Dn({name:"CredentialsNotFoundException",message:"Cognito did not respond with either Credentials, AccessKeyId or SecretKey."})}async credsForOIDCTokens(e,n,a){var l;if(this._credentialsAndIdentityId&&!this.isPastTTL()&&this._credentialsAndIdentityId.isAuthenticatedCreds===!0)return Hg.debug("returning stored credentials as they neither past TTL nor expired."),this._credentialsAndIdentityId;this.clearCredentials();const u=n.idToken?wR(n.idToken.toString()):{},d=PE(e.identityPoolId),_=await Fk({region:d},{IdentityId:a,Logins:u});if(_.Credentials&&_.Credentials.AccessKeyId&&_.Credentials.SecretKey){const w={credentials:{accessKeyId:_.Credentials.AccessKeyId,secretAccessKey:_.Credentials.SecretKey,sessionToken:_.Credentials.SessionToken,expiration:_.Credentials.Expiration},identityId:a};this._credentialsAndIdentityId={...w,isAuthenticatedCreds:!0,associatedIdToken:(l=n.idToken)==null?void 0:l.toString()},this._nextCredentialsRefresh=new Date().getTime()+jk;const T=_.IdentityId;return T&&(w.identityId=T,this._identityIdStore.storeIdentityId({id:T,type:"primary"})),w}else throw new Dn({name:"CredentialsException",message:"Cognito did not respond with either Credentials, AccessKeyId or SecretKey."})}isPastTTL(){return this._nextCredentialsRefresh===void 0?!0:this._nextCredentialsRefresh<=Date.now()}hasTokenChanged(e){var n,a;return!!e&&!!((n=this._credentialsAndIdentityId)!=null&&n.associatedIdToken)&&((a=e.idToken)==null?void 0:a.toString())!==this._credentialsAndIdentityId.associatedIdToken}}const cU=new lU(new iU(Dm)),uU={configure(t,e){const n=oR(t);if(!n.Auth){Js.configure(n,e);return}if(e!=null&&e.Auth){Js.configure(n,e);return}if(!Js.libraryOptions.Auth){Gg.setAuthConfig(n.Auth),Gg.setKeyValueStorage(e!=null&&e.ssr?new Lk({sameSite:"lax"}):Dm),Js.configure(n,{...e,Auth:{tokenProvider:Gg,credentialsProvider:cU}});return}if(e){e.ssr!==void 0&&Gg.setKeyValueStorage(e.ssr?new Lk({sameSite:"lax"}):Dm),Js.configure(n,{Auth:Js.libraryOptions.Auth,...e});return}Js.configure(n)},getConfig(){return Js.getConfig()}};/* + * Frontend UI component library for the CORI Data API + * {@link https://github.com/ruralinnovation/cori.data.api} + * @copyright Rural Innovation Strategies, Inc. + * @license ISC + */var hU={oauth:{domain:"authcori.auth.us-east-1.amazoncognito.com"}},dU="us-east-1",pU="us-east-1_QeA4600FA",fU="5eusi16g0o2q1g1rr5ehgudodm",mU="authcori.auth.us-east-1.amazoncognito.com",gU="us-east-1",yU="us-east-1:2194a76a-fa3d-4c33-999e-e3c4b2b049ee",_U=["EMAIL"],vU=["EMAIL","OPENID"],xU=["EMAIL","OPENID"],bU={passwordPolicyMinLength:8,passwordPolicyCharacters:["REQUIRES_NUMBERS","REQUIRES_LOWERCASE","REQUIRES_UPPERCASE","REQUIRES_SYMBOLS"]},wU="https://bdkxhfgus5dztobic7gvn5ymue.appsync-api.us-east-1.amazonaws.com/graphql",EU="us-east-1",SU="da2-yexc3mow25fc3amaendi4vscuq",TU="API_KEY",AU="AMAZON_COGNITO_USER_POOLS,AWS_IAM",IU={version:1,models:{Todo:{name:"Todo",fields:{id:{name:"id",isArray:!1,type:"ID",isRequired:!0,attributes:[]},content:{name:"content",isArray:!1,type:"String",isRequired:!1,attributes:[]},owner:{name:"owner",isArray:!1,type:"String",isRequired:!1,attributes:[]},createdAt:{name:"createdAt",isArray:!1,type:"AWSDateTime",isRequired:!0,attributes:[]},updatedAt:{name:"updatedAt",isArray:!1,type:"AWSDateTime",isRequired:!0,attributes:[]}},syncable:!0,pluralName:"Todos",attributes:[{type:"model",properties:{}},{type:"key",properties:{fields:["id"]}},{type:"auth",properties:{rules:[{provider:"userPools",ownerField:"owner",allow:"owner",identityClaim:"cognito:username",operations:["create","update","delete","read"]},{allow:"public",operations:["read"]}]}}],primaryKeyInfo:{isCustomPrimaryKey:!1,primaryKeyFieldName:"id",sortKeyFieldNames:[]}}},enums:{},nonModels:{}},CU={Auth:hU,aws_project_region:dU,aws_user_pools_id:pU,aws_user_pools_web_client_id:fU,aws_cognito_domain:mU,aws_cognito_region:gU,aws_cognito_identity_pool_id:yU,aws_cognito_signup_attributes:_U,aws_cognito_username_attributes:vU,aws_cognito_verification_mechanisms:xU,aws_cognito_password_protection_settings:bU,aws_appsync_graphqlEndpoint:wU,aws_appsync_region:EU,aws_appsync_apiKey:SU,aws_appsync_authenticationType:TU,aws_appsync_additionalAuthenticationTypes:AU,modelIntrospection:IU};/* + * Frontend UI component library for the CORI Data API + * {@link https://github.com/ruralinnovation/cori.data.api} + * @copyright Rural Innovation Strategies, Inc. + * @license ISC + */uU.configure(CU);const kU={domain:void 0,region:void 0,identityPoolId:void 0,userPoolId:void 0,userPoolClientId:void 0};St.createContext(kU);function ER(t,e){return function(){return t.apply(e,arguments)}}const{toString:PU}=Object.prototype,{getPrototypeOf:QS}=Object,ev=(t=>e=>{const n=PU.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Ka=t=>(t=t.toLowerCase(),e=>ev(e)===t),tv=t=>e=>typeof e===t,{isArray:Fd}=Array,Mm=tv("undefined");function DU(t){return t!==null&&!Mm(t)&&t.constructor!==null&&!Mm(t.constructor)&&No(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const SR=Ka("ArrayBuffer");function MU(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&SR(t.buffer),e}const zU=tv("string"),No=tv("function"),TR=tv("number"),rv=t=>t!==null&&typeof t=="object",RU=t=>t===!0||t===!1,qy=t=>{if(ev(t)!=="object")return!1;const e=QS(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},OU=Ka("Date"),FU=Ka("File"),LU=Ka("Blob"),BU=Ka("FileList"),NU=t=>rv(t)&&No(t.pipe),UU=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||No(t.append)&&((e=ev(t))==="formdata"||e==="object"&&No(t.toString)&&t.toString()==="[object FormData]"))},jU=Ka("URLSearchParams"),[VU,$U,WU,GU]=["ReadableStream","Request","Response","Headers"].map(Ka),HU=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Um(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let a,u;if(typeof t!="object"&&(t=[t]),Fd(t))for(a=0,u=t.length;a0;)if(u=n[a],e===u.toLowerCase())return u;return null}const Au=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),IR=t=>!Mm(t)&&t!==Au;function DE(){const{caseless:t}=IR(this)&&this||{},e={},n=(a,u)=>{const d=t&&AR(e,u)||u;qy(e[d])&&qy(a)?e[d]=DE(e[d],a):qy(a)?e[d]=DE({},a):Fd(a)?e[d]=a.slice():e[d]=a};for(let a=0,u=arguments.length;a(Um(e,(u,d)=>{n&&No(u)?t[d]=ER(u,n):t[d]=u},{allOwnKeys:a}),t),ZU=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),KU=(t,e,n,a)=>{t.prototype=Object.create(e.prototype,a),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},XU=(t,e,n,a)=>{let u,d,_;const l={};if(e=e||{},t==null)return e;do{for(u=Object.getOwnPropertyNames(t),d=u.length;d-- >0;)_=u[d],(!a||a(_,t,e))&&!l[_]&&(e[_]=t[_],l[_]=!0);t=n!==!1&&QS(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},YU=(t,e,n)=>{t=String(t),(n===void 0||n>t.length)&&(n=t.length),n-=e.length;const a=t.indexOf(e,n);return a!==-1&&a===n},QU=t=>{if(!t)return null;if(Fd(t))return t;let e=t.length;if(!TR(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},JU=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&QS(Uint8Array)),ej=(t,e)=>{const a=(t&&t[Symbol.iterator]).call(t);let u;for(;(u=a.next())&&!u.done;){const d=u.value;e.call(t,d[0],d[1])}},tj=(t,e)=>{let n;const a=[];for(;(n=t.exec(e))!==null;)a.push(n);return a},rj=Ka("HTMLFormElement"),nj=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,a,u){return a.toUpperCase()+u}),Vk=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),ij=Ka("RegExp"),CR=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),a={};Um(n,(u,d)=>{let _;(_=e(u,d,t))!==!1&&(a[d]=_||u)}),Object.defineProperties(t,a)},oj=t=>{CR(t,(e,n)=>{if(No(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const a=t[n];if(No(a)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},aj=(t,e)=>{const n={},a=u=>{u.forEach(d=>{n[d]=!0})};return Fd(t)?a(t):a(String(t).split(e)),n},sj=()=>{},lj=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e,tb="abcdefghijklmnopqrstuvwxyz",$k="0123456789",kR={DIGIT:$k,ALPHA:tb,ALPHA_DIGIT:tb+tb.toUpperCase()+$k},cj=(t=16,e=kR.ALPHA_DIGIT)=>{let n="";const{length:a}=e;for(;t--;)n+=e[Math.random()*a|0];return n};function uj(t){return!!(t&&No(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}const hj=t=>{const e=new Array(10),n=(a,u)=>{if(rv(a)){if(e.indexOf(a)>=0)return;if(!("toJSON"in a)){e[u]=a;const d=Fd(a)?[]:{};return Um(a,(_,l)=>{const w=n(_,u+1);!Mm(w)&&(d[l]=w)}),e[u]=void 0,d}}return a};return n(t,0)},dj=Ka("AsyncFunction"),pj=t=>t&&(rv(t)||No(t))&&No(t.then)&&No(t.catch),PR=((t,e)=>t?setImmediate:e?((n,a)=>(Au.addEventListener("message",({source:u,data:d})=>{u===Au&&d===n&&a.length&&a.shift()()},!1),u=>{a.push(u),Au.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",No(Au.postMessage)),fj=typeof queueMicrotask<"u"?queueMicrotask.bind(Au):typeof process<"u"&&process.nextTick||PR,Ye={isArray:Fd,isArrayBuffer:SR,isBuffer:DU,isFormData:UU,isArrayBufferView:MU,isString:zU,isNumber:TR,isBoolean:RU,isObject:rv,isPlainObject:qy,isReadableStream:VU,isRequest:$U,isResponse:WU,isHeaders:GU,isUndefined:Mm,isDate:OU,isFile:FU,isBlob:LU,isRegExp:ij,isFunction:No,isStream:NU,isURLSearchParams:jU,isTypedArray:JU,isFileList:BU,forEach:Um,merge:DE,extend:qU,trim:HU,stripBOM:ZU,inherits:KU,toFlatObject:XU,kindOf:ev,kindOfTest:Ka,endsWith:YU,toArray:QU,forEachEntry:ej,matchAll:tj,isHTMLForm:rj,hasOwnProperty:Vk,hasOwnProp:Vk,reduceDescriptors:CR,freezeMethods:oj,toObjectSet:aj,toCamelCase:nj,noop:sj,toFiniteNumber:lj,findKey:AR,global:Au,isContextDefined:IR,ALPHABET:kR,generateString:cj,isSpecCompliantForm:uj,toJSONObject:hj,isAsyncFn:dj,isThenable:pj,setImmediate:PR,asap:fj};function ar(t,e,n,a,u){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),a&&(this.request=a),u&&(this.response=u,this.status=u.status?u.status:null)}Ye.inherits(ar,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Ye.toJSONObject(this.config),code:this.code,status:this.status}}});const DR=ar.prototype,MR={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{MR[t]={value:t}});Object.defineProperties(ar,MR);Object.defineProperty(DR,"isAxiosError",{value:!0});ar.from=(t,e,n,a,u,d)=>{const _=Object.create(DR);return Ye.toFlatObject(t,_,function(w){return w!==Error.prototype},l=>l!=="isAxiosError"),ar.call(_,t.message,e,n,a,u),_.cause=t,_.name=t.name,d&&Object.assign(_,d),_};const mj=null;function ME(t){return Ye.isPlainObject(t)||Ye.isArray(t)}function zR(t){return Ye.endsWith(t,"[]")?t.slice(0,-2):t}function Wk(t,e,n){return t?t.concat(e).map(function(u,d){return u=zR(u),!n&&d?"["+u+"]":u}).join(n?".":""):e}function gj(t){return Ye.isArray(t)&&!t.some(ME)}const yj=Ye.toFlatObject(Ye,{},null,function(e){return/^is[A-Z]/.test(e)});function nv(t,e,n){if(!Ye.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=Ye.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(j,L){return!Ye.isUndefined(L[j])});const a=n.metaTokens,u=n.visitor||C,d=n.dots,_=n.indexes,w=(n.Blob||typeof Blob<"u"&&Blob)&&Ye.isSpecCompliantForm(e);if(!Ye.isFunction(u))throw new TypeError("visitor must be a function");function T(U){if(U===null)return"";if(Ye.isDate(U))return U.toISOString();if(!w&&Ye.isBlob(U))throw new ar("Blob is not supported. Use a Buffer instead.");return Ye.isArrayBuffer(U)||Ye.isTypedArray(U)?w&&typeof Blob=="function"?new Blob([U]):Buffer.from(U):U}function C(U,j,L){let V=U;if(U&&!L&&typeof U=="object"){if(Ye.endsWith(j,"{}"))j=a?j:j.slice(0,-2),U=JSON.stringify(U);else if(Ye.isArray(U)&&gj(U)||(Ye.isFileList(U)||Ye.endsWith(j,"[]"))&&(V=Ye.toArray(U)))return j=zR(j),V.forEach(function(F,H){!(Ye.isUndefined(F)||F===null)&&e.append(_===!0?Wk([j],H,d):_===null?j:j+"[]",T(F))}),!1}return ME(U)?!0:(e.append(Wk(L,j,d),T(U)),!1)}const P=[],z=Object.assign(yj,{defaultVisitor:C,convertValue:T,isVisitable:ME});function W(U,j){if(!Ye.isUndefined(U)){if(P.indexOf(U)!==-1)throw Error("Circular reference detected in "+j.join("."));P.push(U),Ye.forEach(U,function(V,R){(!(Ye.isUndefined(V)||V===null)&&u.call(e,V,Ye.isString(R)?R.trim():R,j,z))===!0&&W(V,j?j.concat(R):[R])}),P.pop()}}if(!Ye.isObject(t))throw new TypeError("data must be an object");return W(t),e}function Gk(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(a){return e[a]})}function JS(t,e){this._pairs=[],t&&nv(t,this,e)}const RR=JS.prototype;RR.append=function(e,n){this._pairs.push([e,n])};RR.toString=function(e){const n=e?function(a){return e.call(this,a,Gk)}:Gk;return this._pairs.map(function(u){return n(u[0])+"="+n(u[1])},"").join("&")};function _j(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function OR(t,e,n){if(!e)return t;const a=n&&n.encode||_j,u=n&&n.serialize;let d;if(u?d=u(e,n):d=Ye.isURLSearchParams(e)?e.toString():new JS(e,n).toString(a),d){const _=t.indexOf("#");_!==-1&&(t=t.slice(0,_)),t+=(t.indexOf("?")===-1?"?":"&")+d}return t}class vj{constructor(){this.handlers=[]}use(e,n,a){return this.handlers.push({fulfilled:e,rejected:n,synchronous:a?a.synchronous:!1,runWhen:a?a.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Ye.forEach(this.handlers,function(a){a!==null&&e(a)})}}const Hk=vj,FR={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},xj=typeof URLSearchParams<"u"?URLSearchParams:JS,bj=typeof FormData<"u"?FormData:null,wj=typeof Blob<"u"?Blob:null,Ej={isBrowser:!0,classes:{URLSearchParams:xj,FormData:bj,Blob:wj},protocols:["http","https","file","blob","url","data"]},eT=typeof window<"u"&&typeof document<"u",zE=typeof navigator=="object"&&navigator||void 0,Sj=eT&&(!zE||["ReactNative","NativeScript","NS"].indexOf(zE.product)<0),Tj=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),Aj=eT&&window.location.href||"http://localhost",Ij=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:eT,hasStandardBrowserEnv:Sj,hasStandardBrowserWebWorkerEnv:Tj,navigator:zE,origin:Aj},Symbol.toStringTag,{value:"Module"})),vo={...Ij,...Ej};function Cj(t,e){return nv(t,new vo.classes.URLSearchParams,Object.assign({visitor:function(n,a,u,d){return vo.isNode&&Ye.isBuffer(n)?(this.append(a,n.toString("base64")),!1):d.defaultVisitor.apply(this,arguments)}},e))}function kj(t){return Ye.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function Pj(t){const e={},n=Object.keys(t);let a;const u=n.length;let d;for(a=0;a=n.length;return _=!_&&Ye.isArray(u)?u.length:_,w?(Ye.hasOwnProp(u,_)?u[_]=[u[_],a]:u[_]=a,!l):((!u[_]||!Ye.isObject(u[_]))&&(u[_]=[]),e(n,a,u[_],d)&&Ye.isArray(u[_])&&(u[_]=Pj(u[_])),!l)}if(Ye.isFormData(t)&&Ye.isFunction(t.entries)){const n={};return Ye.forEachEntry(t,(a,u)=>{e(kj(a),u,n,0)}),n}return null}function Dj(t,e,n){if(Ye.isString(t))try{return(e||JSON.parse)(t),Ye.trim(t)}catch(a){if(a.name!=="SyntaxError")throw a}return(n||JSON.stringify)(t)}const tT={transitional:FR,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){const a=n.getContentType()||"",u=a.indexOf("application/json")>-1,d=Ye.isObject(e);if(d&&Ye.isHTMLForm(e)&&(e=new FormData(e)),Ye.isFormData(e))return u?JSON.stringify(LR(e)):e;if(Ye.isArrayBuffer(e)||Ye.isBuffer(e)||Ye.isStream(e)||Ye.isFile(e)||Ye.isBlob(e)||Ye.isReadableStream(e))return e;if(Ye.isArrayBufferView(e))return e.buffer;if(Ye.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let l;if(d){if(a.indexOf("application/x-www-form-urlencoded")>-1)return Cj(e,this.formSerializer).toString();if((l=Ye.isFileList(e))||a.indexOf("multipart/form-data")>-1){const w=this.env&&this.env.FormData;return nv(l?{"files[]":e}:e,w&&new w,this.formSerializer)}}return d||u?(n.setContentType("application/json",!1),Dj(e)):e}],transformResponse:[function(e){const n=this.transitional||tT.transitional,a=n&&n.forcedJSONParsing,u=this.responseType==="json";if(Ye.isResponse(e)||Ye.isReadableStream(e))return e;if(e&&Ye.isString(e)&&(a&&!this.responseType||u)){const _=!(n&&n.silentJSONParsing)&&u;try{return JSON.parse(e)}catch(l){if(_)throw l.name==="SyntaxError"?ar.from(l,ar.ERR_BAD_RESPONSE,this,null,this.response):l}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:vo.classes.FormData,Blob:vo.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Ye.forEach(["delete","get","head","post","put","patch"],t=>{tT.headers[t]={}});const rT=tT,Mj=Ye.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),zj=t=>{const e={};let n,a,u;return t&&t.split(` +`).forEach(function(_){u=_.indexOf(":"),n=_.substring(0,u).trim().toLowerCase(),a=_.substring(u+1).trim(),!(!n||e[n]&&Mj[n])&&(n==="set-cookie"?e[n]?e[n].push(a):e[n]=[a]:e[n]=e[n]?e[n]+", "+a:a)}),e},qk=Symbol("internals");function Rf(t){return t&&String(t).trim().toLowerCase()}function Zy(t){return t===!1||t==null?t:Ye.isArray(t)?t.map(Zy):String(t)}function Rj(t){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let a;for(;a=n.exec(t);)e[a[1]]=a[2];return e}const Oj=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function rb(t,e,n,a,u){if(Ye.isFunction(a))return a.call(this,e,n);if(u&&(e=n),!!Ye.isString(e)){if(Ye.isString(a))return e.indexOf(a)!==-1;if(Ye.isRegExp(a))return a.test(e)}}function Fj(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,a)=>n.toUpperCase()+a)}function Lj(t,e){const n=Ye.toCamelCase(" "+e);["get","set","has"].forEach(a=>{Object.defineProperty(t,a+n,{value:function(u,d,_){return this[a].call(this,e,u,d,_)},configurable:!0})})}class iv{constructor(e){e&&this.set(e)}set(e,n,a){const u=this;function d(l,w,T){const C=Rf(w);if(!C)throw new Error("header name must be a non-empty string");const P=Ye.findKey(u,C);(!P||u[P]===void 0||T===!0||T===void 0&&u[P]!==!1)&&(u[P||w]=Zy(l))}const _=(l,w)=>Ye.forEach(l,(T,C)=>d(T,C,w));if(Ye.isPlainObject(e)||e instanceof this.constructor)_(e,n);else if(Ye.isString(e)&&(e=e.trim())&&!Oj(e))_(zj(e),n);else if(Ye.isHeaders(e))for(const[l,w]of e.entries())d(w,l,a);else e!=null&&d(n,e,a);return this}get(e,n){if(e=Rf(e),e){const a=Ye.findKey(this,e);if(a){const u=this[a];if(!n)return u;if(n===!0)return Rj(u);if(Ye.isFunction(n))return n.call(this,u,a);if(Ye.isRegExp(n))return n.exec(u);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=Rf(e),e){const a=Ye.findKey(this,e);return!!(a&&this[a]!==void 0&&(!n||rb(this,this[a],a,n)))}return!1}delete(e,n){const a=this;let u=!1;function d(_){if(_=Rf(_),_){const l=Ye.findKey(a,_);l&&(!n||rb(a,a[l],l,n))&&(delete a[l],u=!0)}}return Ye.isArray(e)?e.forEach(d):d(e),u}clear(e){const n=Object.keys(this);let a=n.length,u=!1;for(;a--;){const d=n[a];(!e||rb(this,this[d],d,e,!0))&&(delete this[d],u=!0)}return u}normalize(e){const n=this,a={};return Ye.forEach(this,(u,d)=>{const _=Ye.findKey(a,d);if(_){n[_]=Zy(u),delete n[d];return}const l=e?Fj(d):String(d).trim();l!==d&&delete n[d],n[l]=Zy(u),a[l]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const n=Object.create(null);return Ye.forEach(this,(a,u)=>{a!=null&&a!==!1&&(n[u]=e&&Ye.isArray(a)?a.join(", "):a)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,n])=>e+": "+n).join(` +`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...n){const a=new this(e);return n.forEach(u=>a.set(u)),a}static accessor(e){const a=(this[qk]=this[qk]={accessors:{}}).accessors,u=this.prototype;function d(_){const l=Rf(_);a[l]||(Lj(u,_),a[l]=!0)}return Ye.isArray(e)?e.forEach(d):d(e),this}}iv.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Ye.reduceDescriptors(iv.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(a){this[n]=a}}});Ye.freezeMethods(iv);const qa=iv;function nb(t,e){const n=this||rT,a=e||n,u=qa.from(a.headers);let d=a.data;return Ye.forEach(t,function(l){d=l.call(n,d,u.normalize(),e?e.status:void 0)}),u.normalize(),d}function BR(t){return!!(t&&t.__CANCEL__)}function Ld(t,e,n){ar.call(this,t??"canceled",ar.ERR_CANCELED,e,n),this.name="CanceledError"}Ye.inherits(Ld,ar,{__CANCEL__:!0});function NR(t,e,n){const a=n.config.validateStatus;!n.status||!a||a(n.status)?t(n):e(new ar("Request failed with status code "+n.status,[ar.ERR_BAD_REQUEST,ar.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function Bj(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function Nj(t,e){t=t||10;const n=new Array(t),a=new Array(t);let u=0,d=0,_;return e=e!==void 0?e:1e3,function(w){const T=Date.now(),C=a[d];_||(_=T),n[u]=w,a[u]=T;let P=d,z=0;for(;P!==u;)z+=n[P++],P=P%t;if(u=(u+1)%t,u===d&&(d=(d+1)%t),T-_{n=C,u=null,d&&(clearTimeout(d),d=null),t.apply(null,T)};return[(...T)=>{const C=Date.now(),P=C-n;P>=a?_(T,C):(u=T,d||(d=setTimeout(()=>{d=null,_(u)},a-P)))},()=>u&&_(u)]}const A_=(t,e,n=3)=>{let a=0;const u=Nj(50,250);return Uj(d=>{const _=d.loaded,l=d.lengthComputable?d.total:void 0,w=_-a,T=u(w),C=_<=l;a=_;const P={loaded:_,total:l,progress:l?_/l:void 0,bytes:w,rate:T||void 0,estimated:T&&l&&C?(l-_)/T:void 0,event:d,lengthComputable:l!=null,[e?"download":"upload"]:!0};t(P)},n)},Zk=(t,e)=>{const n=t!=null;return[a=>e[0]({lengthComputable:n,total:t,loaded:a}),e[1]]},Kk=t=>(...e)=>Ye.asap(()=>t(...e)),jj=vo.hasStandardBrowserEnv?function(){const e=vo.navigator&&/(msie|trident)/i.test(vo.navigator.userAgent),n=document.createElement("a");let a;function u(d){let _=d;return e&&(n.setAttribute("href",_),_=n.href),n.setAttribute("href",_),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}return a=u(window.location.href),function(_){const l=Ye.isString(_)?u(_):_;return l.protocol===a.protocol&&l.host===a.host}}():function(){return function(){return!0}}(),Vj=vo.hasStandardBrowserEnv?{write(t,e,n,a,u,d){const _=[t+"="+encodeURIComponent(e)];Ye.isNumber(n)&&_.push("expires="+new Date(n).toGMTString()),Ye.isString(a)&&_.push("path="+a),Ye.isString(u)&&_.push("domain="+u),d===!0&&_.push("secure"),document.cookie=_.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function $j(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function Wj(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function UR(t,e){return t&&!$j(e)?Wj(t,e):e}const Xk=t=>t instanceof qa?{...t}:t;function Ru(t,e){e=e||{};const n={};function a(T,C,P){return Ye.isPlainObject(T)&&Ye.isPlainObject(C)?Ye.merge.call({caseless:P},T,C):Ye.isPlainObject(C)?Ye.merge({},C):Ye.isArray(C)?C.slice():C}function u(T,C,P){if(Ye.isUndefined(C)){if(!Ye.isUndefined(T))return a(void 0,T,P)}else return a(T,C,P)}function d(T,C){if(!Ye.isUndefined(C))return a(void 0,C)}function _(T,C){if(Ye.isUndefined(C)){if(!Ye.isUndefined(T))return a(void 0,T)}else return a(void 0,C)}function l(T,C,P){if(P in e)return a(T,C);if(P in t)return a(void 0,T)}const w={url:d,method:d,data:d,baseURL:_,transformRequest:_,transformResponse:_,paramsSerializer:_,timeout:_,timeoutMessage:_,withCredentials:_,withXSRFToken:_,adapter:_,responseType:_,xsrfCookieName:_,xsrfHeaderName:_,onUploadProgress:_,onDownloadProgress:_,decompress:_,maxContentLength:_,maxBodyLength:_,beforeRedirect:_,transport:_,httpAgent:_,httpsAgent:_,cancelToken:_,socketPath:_,responseEncoding:_,validateStatus:l,headers:(T,C)=>u(Xk(T),Xk(C),!0)};return Ye.forEach(Object.keys(Object.assign({},t,e)),function(C){const P=w[C]||u,z=P(t[C],e[C],C);Ye.isUndefined(z)&&P!==l||(n[C]=z)}),n}const jR=t=>{const e=Ru({},t);let{data:n,withXSRFToken:a,xsrfHeaderName:u,xsrfCookieName:d,headers:_,auth:l}=e;e.headers=_=qa.from(_),e.url=OR(UR(e.baseURL,e.url),t.params,t.paramsSerializer),l&&_.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):"")));let w;if(Ye.isFormData(n)){if(vo.hasStandardBrowserEnv||vo.hasStandardBrowserWebWorkerEnv)_.setContentType(void 0);else if((w=_.getContentType())!==!1){const[T,...C]=w?w.split(";").map(P=>P.trim()).filter(Boolean):[];_.setContentType([T||"multipart/form-data",...C].join("; "))}}if(vo.hasStandardBrowserEnv&&(a&&Ye.isFunction(a)&&(a=a(e)),a||a!==!1&&jj(e.url))){const T=u&&d&&Vj.read(d);T&&_.set(u,T)}return e},Gj=typeof XMLHttpRequest<"u",Hj=Gj&&function(t){return new Promise(function(n,a){const u=jR(t);let d=u.data;const _=qa.from(u.headers).normalize();let{responseType:l,onUploadProgress:w,onDownloadProgress:T}=u,C,P,z,W,U;function j(){W&&W(),U&&U(),u.cancelToken&&u.cancelToken.unsubscribe(C),u.signal&&u.signal.removeEventListener("abort",C)}let L=new XMLHttpRequest;L.open(u.method.toUpperCase(),u.url,!0),L.timeout=u.timeout;function V(){if(!L)return;const F=qa.from("getAllResponseHeaders"in L&&L.getAllResponseHeaders()),Q={data:!l||l==="text"||l==="json"?L.responseText:L.response,status:L.status,statusText:L.statusText,headers:F,config:t,request:L};NR(function(se){n(se),j()},function(se){a(se),j()},Q),L=null}"onloadend"in L?L.onloadend=V:L.onreadystatechange=function(){!L||L.readyState!==4||L.status===0&&!(L.responseURL&&L.responseURL.indexOf("file:")===0)||setTimeout(V)},L.onabort=function(){L&&(a(new ar("Request aborted",ar.ECONNABORTED,t,L)),L=null)},L.onerror=function(){a(new ar("Network Error",ar.ERR_NETWORK,t,L)),L=null},L.ontimeout=function(){let H=u.timeout?"timeout of "+u.timeout+"ms exceeded":"timeout exceeded";const Q=u.transitional||FR;u.timeoutErrorMessage&&(H=u.timeoutErrorMessage),a(new ar(H,Q.clarifyTimeoutError?ar.ETIMEDOUT:ar.ECONNABORTED,t,L)),L=null},d===void 0&&_.setContentType(null),"setRequestHeader"in L&&Ye.forEach(_.toJSON(),function(H,Q){L.setRequestHeader(Q,H)}),Ye.isUndefined(u.withCredentials)||(L.withCredentials=!!u.withCredentials),l&&l!=="json"&&(L.responseType=u.responseType),T&&([z,U]=A_(T,!0),L.addEventListener("progress",z)),w&&L.upload&&([P,W]=A_(w),L.upload.addEventListener("progress",P),L.upload.addEventListener("loadend",W)),(u.cancelToken||u.signal)&&(C=F=>{L&&(a(!F||F.type?new Ld(null,t,L):F),L.abort(),L=null)},u.cancelToken&&u.cancelToken.subscribe(C),u.signal&&(u.signal.aborted?C():u.signal.addEventListener("abort",C)));const R=Bj(u.url);if(R&&vo.protocols.indexOf(R)===-1){a(new ar("Unsupported protocol "+R+":",ar.ERR_BAD_REQUEST,t));return}L.send(d||null)})},qj=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let a=new AbortController,u;const d=function(T){if(!u){u=!0,l();const C=T instanceof Error?T:this.reason;a.abort(C instanceof ar?C:new Ld(C instanceof Error?C.message:C))}};let _=e&&setTimeout(()=>{_=null,d(new ar(`timeout ${e} of ms exceeded`,ar.ETIMEDOUT))},e);const l=()=>{t&&(_&&clearTimeout(_),_=null,t.forEach(T=>{T.unsubscribe?T.unsubscribe(d):T.removeEventListener("abort",d)}),t=null)};t.forEach(T=>T.addEventListener("abort",d));const{signal:w}=a;return w.unsubscribe=()=>Ye.asap(l),w}},Zj=qj,Kj=function*(t,e){let n=t.byteLength;if(!e||n{const u=Xj(t,e);let d=0,_,l=w=>{_||(_=!0,a&&a(w))};return new ReadableStream({async pull(w){try{const{done:T,value:C}=await u.next();if(T){l(),w.close();return}let P=C.byteLength;if(n){let z=d+=P;n(z)}w.enqueue(new Uint8Array(C))}catch(T){throw l(T),T}},cancel(w){return l(w),u.return()}},{highWaterMark:2})},ov=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",VR=ov&&typeof ReadableStream=="function",Qj=ov&&(typeof TextEncoder=="function"?(t=>e=>t.encode(e))(new TextEncoder):async t=>new Uint8Array(await new Response(t).arrayBuffer())),$R=(t,...e)=>{try{return!!t(...e)}catch{return!1}},Jj=VR&&$R(()=>{let t=!1;const e=new Request(vo.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),Qk=64*1024,RE=VR&&$R(()=>Ye.isReadableStream(new Response("").body)),I_={stream:RE&&(t=>t.body)};ov&&(t=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!I_[e]&&(I_[e]=Ye.isFunction(t[e])?n=>n[e]():(n,a)=>{throw new ar(`Response type '${e}' is not supported`,ar.ERR_NOT_SUPPORT,a)})})})(new Response);const eV=async t=>{if(t==null)return 0;if(Ye.isBlob(t))return t.size;if(Ye.isSpecCompliantForm(t))return(await new Request(vo.origin,{method:"POST",body:t}).arrayBuffer()).byteLength;if(Ye.isArrayBufferView(t)||Ye.isArrayBuffer(t))return t.byteLength;if(Ye.isURLSearchParams(t)&&(t=t+""),Ye.isString(t))return(await Qj(t)).byteLength},tV=async(t,e)=>{const n=Ye.toFiniteNumber(t.getContentLength());return n??eV(e)},rV=ov&&(async t=>{let{url:e,method:n,data:a,signal:u,cancelToken:d,timeout:_,onDownloadProgress:l,onUploadProgress:w,responseType:T,headers:C,withCredentials:P="same-origin",fetchOptions:z}=jR(t);T=T?(T+"").toLowerCase():"text";let W=Zj([u,d&&d.toAbortSignal()],_),U;const j=W&&W.unsubscribe&&(()=>{W.unsubscribe()});let L;try{if(w&&Jj&&n!=="get"&&n!=="head"&&(L=await tV(C,a))!==0){let Q=new Request(e,{method:"POST",body:a,duplex:"half"}),te;if(Ye.isFormData(a)&&(te=Q.headers.get("content-type"))&&C.setContentType(te),Q.body){const[se,ge]=Zk(L,A_(Kk(w)));a=Yk(Q.body,Qk,se,ge)}}Ye.isString(P)||(P=P?"include":"omit");const V="credentials"in Request.prototype;U=new Request(e,{...z,signal:W,method:n.toUpperCase(),headers:C.normalize().toJSON(),body:a,duplex:"half",credentials:V?P:void 0});let R=await fetch(U);const F=RE&&(T==="stream"||T==="response");if(RE&&(l||F&&j)){const Q={};["status","statusText","headers"].forEach(xe=>{Q[xe]=R[xe]});const te=Ye.toFiniteNumber(R.headers.get("content-length")),[se,ge]=l&&Zk(te,A_(Kk(l),!0))||[];R=new Response(Yk(R.body,Qk,se,()=>{ge&&ge(),j&&j()}),Q)}T=T||"text";let H=await I_[Ye.findKey(I_,T)||"text"](R,t);return!F&&j&&j(),await new Promise((Q,te)=>{NR(Q,te,{data:H,headers:qa.from(R.headers),status:R.status,statusText:R.statusText,config:t,request:U})})}catch(V){throw j&&j(),V&&V.name==="TypeError"&&/fetch/i.test(V.message)?Object.assign(new ar("Network Error",ar.ERR_NETWORK,t,U),{cause:V.cause||V}):ar.from(V,V&&V.code,t,U)}}),OE={http:mj,xhr:Hj,fetch:rV};Ye.forEach(OE,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const Jk=t=>`- ${t}`,nV=t=>Ye.isFunction(t)||t===null||t===!1,WR={getAdapter:t=>{t=Ye.isArray(t)?t:[t];const{length:e}=t;let n,a;const u={};for(let d=0;d`adapter ${l} `+(w===!1?"is not supported by the environment":"is not available in the build"));let _=e?d.length>1?`since : +`+d.map(Jk).join(` +`):" "+Jk(d[0]):"as no adapter specified";throw new ar("There is no suitable adapter to dispatch the request "+_,"ERR_NOT_SUPPORT")}return a},adapters:OE};function ib(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Ld(null,t)}function eP(t){return ib(t),t.headers=qa.from(t.headers),t.data=nb.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),WR.getAdapter(t.adapter||rT.adapter)(t).then(function(a){return ib(t),a.data=nb.call(t,t.transformResponse,a),a.headers=qa.from(a.headers),a},function(a){return BR(a)||(ib(t),a&&a.response&&(a.response.data=nb.call(t,t.transformResponse,a.response),a.response.headers=qa.from(a.response.headers))),Promise.reject(a)})}const GR="1.7.7",nT={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{nT[t]=function(a){return typeof a===t||"a"+(e<1?"n ":" ")+t}});const tP={};nT.transitional=function(e,n,a){function u(d,_){return"[Axios v"+GR+"] Transitional option '"+d+"'"+_+(a?". "+a:"")}return(d,_,l)=>{if(e===!1)throw new ar(u(_," has been removed"+(n?" in "+n:"")),ar.ERR_DEPRECATED);return n&&!tP[_]&&(tP[_]=!0,console.warn(u(_," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(d,_,l):!0}};function iV(t,e,n){if(typeof t!="object")throw new ar("options must be an object",ar.ERR_BAD_OPTION_VALUE);const a=Object.keys(t);let u=a.length;for(;u-- >0;){const d=a[u],_=e[d];if(_){const l=t[d],w=l===void 0||_(l,d,t);if(w!==!0)throw new ar("option "+d+" must be "+w,ar.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new ar("Unknown option "+d,ar.ERR_BAD_OPTION)}}const FE={assertOptions:iV,validators:nT},Hl=FE.validators;class C_{constructor(e){this.defaults=e,this.interceptors={request:new Hk,response:new Hk}}async request(e,n){try{return await this._request(e,n)}catch(a){if(a instanceof Error){let u;Error.captureStackTrace?Error.captureStackTrace(u={}):u=new Error;const d=u.stack?u.stack.replace(/^.+\n/,""):"";try{a.stack?d&&!String(a.stack).endsWith(d.replace(/^.+\n.+\n/,""))&&(a.stack+=` +`+d):a.stack=d}catch{}}throw a}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=Ru(this.defaults,n);const{transitional:a,paramsSerializer:u,headers:d}=n;a!==void 0&&FE.assertOptions(a,{silentJSONParsing:Hl.transitional(Hl.boolean),forcedJSONParsing:Hl.transitional(Hl.boolean),clarifyTimeoutError:Hl.transitional(Hl.boolean)},!1),u!=null&&(Ye.isFunction(u)?n.paramsSerializer={serialize:u}:FE.assertOptions(u,{encode:Hl.function,serialize:Hl.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let _=d&&Ye.merge(d.common,d[n.method]);d&&Ye.forEach(["delete","get","head","post","put","patch","common"],U=>{delete d[U]}),n.headers=qa.concat(_,d);const l=[];let w=!0;this.interceptors.request.forEach(function(j){typeof j.runWhen=="function"&&j.runWhen(n)===!1||(w=w&&j.synchronous,l.unshift(j.fulfilled,j.rejected))});const T=[];this.interceptors.response.forEach(function(j){T.push(j.fulfilled,j.rejected)});let C,P=0,z;if(!w){const U=[eP.bind(this),void 0];for(U.unshift.apply(U,l),U.push.apply(U,T),z=U.length,C=Promise.resolve(n);P{if(!a._listeners)return;let d=a._listeners.length;for(;d-- >0;)a._listeners[d](u);a._listeners=null}),this.promise.then=u=>{let d;const _=new Promise(l=>{a.subscribe(l),d=l}).then(u);return _.cancel=function(){a.unsubscribe(d)},_},e(function(d,_,l){a.reason||(a.reason=new Ld(d,_,l),n(a.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const e=new AbortController,n=a=>{e.abort(a)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new iT(function(u){e=u}),cancel:e}}}const oV=iT;function aV(t){return function(n){return t.apply(null,n)}}function sV(t){return Ye.isObject(t)&&t.isAxiosError===!0}const LE={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(LE).forEach(([t,e])=>{LE[e]=t});const lV=LE;function HR(t){const e=new Ky(t),n=ER(Ky.prototype.request,e);return Ye.extend(n,Ky.prototype,e,{allOwnKeys:!0}),Ye.extend(n,e,null,{allOwnKeys:!0}),n.create=function(u){return HR(Ru(t,u))},n}const Xn=HR(rT);Xn.Axios=Ky;Xn.CanceledError=Ld;Xn.CancelToken=oV;Xn.isCancel=BR;Xn.VERSION=GR;Xn.toFormData=nv;Xn.AxiosError=ar;Xn.Cancel=Xn.CanceledError;Xn.all=function(e){return Promise.all(e)};Xn.spread=aV;Xn.isAxiosError=sV;Xn.mergeConfig=Ru;Xn.AxiosHeaders=qa;Xn.formToJSON=t=>LR(Ye.isHTMLForm(t)?new FormData(t):t);Xn.getAdapter=WR.getAdapter;Xn.HttpStatusCode=lV;Xn.default=Xn;const cV=Xn;/* + * Frontend UI component library for the CORI Data API + * {@link https://github.com/ruralinnovation/cori.data.api} + * @copyright Rural Innovation Strategies, Inc. + * @license ISC + */const dd="https://cori-data-api.ruralinnovation.us/",BE=cV.create({baseURL:dd,headers:{"Content-Type":"application/json"}}),ob={},qR={apiClient:BE,authenticated:!1,authenticated_user:null,autoSignOut:null,baseURL:dd,token:null,data:{get:()=>ob,set:t=>{for(const e in t)t.hasOwnProperty[e]&&(ob[e]=t)}},setData:t=>{for(const e in t)t.hasOwnProperty[e]&&(ob[e]=t)}},ZR=St.createContext(qR);let qg=!1,rP=!1;function uV(t){const[e,n]=St.useState(Object.assign(Object.assign({},qR),{baseURL:t.baseURL?t.baseURL:dd,setData:a}));function a(u){const d=e;n(Object.assign(Object.assign({},d),{data:Object.assign(Object.assign({},d.data),u),setData:a}))}return t.baseURL&&t.baseURL.length>0&&BE.interceptors.request.use(u=>(u.baseURL=t.baseURL,console.log("API baseURL updated:",u.baseURL),u),u=>Promise.reject(u)),St.useEffect(()=>{if(n(Object.assign(Object.assign({},e),{autoSignOut:t.signOut&&typeof t.signOut=="function"?()=>{const{signOut:u}=t;u(),window.alert("Please refresh this session by clicking the browser's reload button!"),window.location=window.location.protocol+"//"+window.location.host+window.location.pathname}:null,baseURL:t.baseURL?t.baseURL:dd})),t.fetchAuthSession){const{fetchAuthSession:u}=t;u().then(_=>{if(!qg){const l=_.tokens;if(console.log("API tokens:",l),l&&l.hasOwnProperty("idToken")&&(qg=!0,console.log("API Session is authenticated:",qg),console.log("API Session config:",_),console.log("idToken:",l.idToken),BE.interceptors.request.use(w=>{const T=l.idToken;return T&&(w.headers.Authorization=`Bearer ${T}`),t.baseURL&&(w.baseURL=t.baseURL),w},w=>Promise.reject(w)),n(Object.assign(Object.assign({},e),{authenticated:!0,autoSignOut:t.signOut&&typeof t.signOut=="function"?()=>{const{signOut:w}=t;w(),window.alert("Please refresh this session by clicking the browser's reload button!"),window.location=window.location.protocol+"//"+window.location.host+window.location.pathname}:null,baseURL:t.baseURL||dd,token:l.idToken})),t.getCurrentUser)){const{getCurrentUser:w}=t;w().then(C=>{rP||(rP=!0,console.log("API User is authenticated:",qg),console.log("API User:",C),console.log("API User type:",C.constructor.name),n(Object.assign(Object.assign({},e),{authenticated:!0,authenticated_user:C,autoSignOut:t.signOut&&typeof t.signOut=="function"?()=>{const{signOut:P}=t;P(),window.alert("Please refresh this session by clicking the browser's reload button!"),window.location=window.location.protocol+"//"+window.location.host+window.location.pathname}:null,baseURL:t.baseURL||dd,token:l.idToken})))})}}})}},[]),C1.createElement(C1.Fragment,null,C1.createElement(ZR.Provider,{value:e},t.children))}const hV="modulepreload",dV=function(t){return"/"+t},nP={},pV=function(e,n,a){if(!n||n.length===0)return e();const u=document.getElementsByTagName("link");return Promise.all(n.map(d=>{if(d=dV(d),d in nP)return;nP[d]=!0;const _=d.endsWith(".css"),l=_?'[rel="stylesheet"]':"";if(!!a)for(let C=u.length-1;C>=0;C--){const P=u[C];if(P.href===d&&(!_||P.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${d}"]${l}`))return;const T=document.createElement("link");if(T.rel=_?"stylesheet":hV,_||(T.as="script",T.crossOrigin=""),T.href=d,document.head.appendChild(T),_)return new Promise((C,P)=>{T.addEventListener("load",C),T.addEventListener("error",()=>P(new Error(`Unable to preload CSS for ${d}`)))})})).then(()=>e()).catch(d=>{const _=new Event("vite:preloadError",{cancelable:!0});if(_.payload=d,window.dispatchEvent(_),!_.defaultPrevented)throw d})},fV=St.createContext(null);function mV(t,e){const n=Array.isArray(t)?t[0]:t?t.x:0,a=Array.isArray(t)?t[1]:t?t.y:0,u=Array.isArray(e)?e[0]:e?e.x:0,d=Array.isArray(e)?e[1]:e?e.y:0;return n===u&&a===d}function nl(t,e){if(t===e)return!0;if(!t||!e)return!1;if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let n=0;n{let u=null;"interactive"in a&&(u=Object.assign({},a),delete u.interactive);const d=e[a.ref];if(d){u=u||Object.assign({},a),delete u.ref;for(const _ of yV)_ in d&&(u[_]=d[_])}return u||a});return{...t,layers:n}}const lP={version:8,sources:{},layers:[]},cP={mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",click:"onClick",dblclick:"onDblClick",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mouseout:"onMouseOut",contextmenu:"onContextMenu",touchstart:"onTouchStart",touchend:"onTouchEnd",touchmove:"onTouchMove",touchcancel:"onTouchCancel"},ab={movestart:"onMoveStart",move:"onMove",moveend:"onMoveEnd",dragstart:"onDragStart",drag:"onDrag",dragend:"onDragEnd",zoomstart:"onZoomStart",zoom:"onZoom",zoomend:"onZoomEnd",rotatestart:"onRotateStart",rotate:"onRotate",rotateend:"onRotateEnd",pitchstart:"onPitchStart",pitch:"onPitch",pitchend:"onPitchEnd"},uP={wheel:"onWheel",boxzoomstart:"onBoxZoomStart",boxzoomend:"onBoxZoomEnd",boxzoomcancel:"onBoxZoomCancel",resize:"onResize",load:"onLoad",render:"onRender",idle:"onIdle",remove:"onRemove",data:"onData",styledata:"onStyleData",sourcedata:"onSourceData",error:"onError"},_V=["minZoom","maxZoom","minPitch","maxPitch","maxBounds","projection","renderWorldCopies"],vV=["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate","touchPitch"];class Pd{constructor(e,n,a){this._map=null,this._internalUpdate=!1,this._inRender=!1,this._hoveredFeatures=null,this._deferredEvents={move:!1,zoom:!1,pitch:!1,rotate:!1},this._onEvent=u=>{const d=this.props[uP[u.type]];d?d(u):u.type==="error"&&console.error(u.error)},this._onPointerEvent=u=>{(u.type==="mousemove"||u.type==="mouseout")&&this._updateHover(u);const d=this.props[cP[u.type]];d&&(this.props.interactiveLayerIds&&u.type!=="mouseover"&&u.type!=="mouseout"&&(u.features=this._hoveredFeatures||this._queryRenderedFeatures(u.point)),d(u),delete u.features)},this._onCameraEvent=u=>{if(!this._internalUpdate){const d=this.props[ab[u.type]];d&&d(u)}u.type in this._deferredEvents&&(this._deferredEvents[u.type]=!1)},this._MapClass=e,this.props=n,this._initialize(a)}get map(){return this._map}get transform(){return this._renderTransform}setProps(e){const n=this.props;this.props=e;const a=this._updateSettings(e,n);a&&this._createShadowTransform(this._map);const u=this._updateSize(e),d=this._updateViewState(e,!0);this._updateStyle(e,n),this._updateStyleComponents(e,n),this._updateHandlers(e,n),(a||u||d&&!this._map.isMoving())&&this.redraw()}static reuse(e,n){const a=Pd.savedMaps.pop();if(!a)return null;const u=a.map,d=u.getContainer();for(n.className=d.className;d.childNodes.length>0;)n.appendChild(d.childNodes[0]);u._container=n;const _=u._resizeObserver;_&&(_.disconnect(),_.observe(n)),a.setProps({...e,styleDiffing:!1}),u.resize();const{initialViewState:l}=e;return l&&(l.bounds?u.fitBounds(l.bounds,{...l.fitBoundsOptions,duration:0}):a._updateViewState(l,!1)),u.isStyleLoaded()?u.fire("load"):u.once("styledata",()=>u.fire("load")),u._update(),a}_initialize(e){const{props:n}=this,{mapStyle:a=lP}=n,u={...n,...n.initialViewState,accessToken:n.mapboxAccessToken||xV()||null,container:e,style:sP(a)},d=u.initialViewState||u.viewState||u;if(Object.assign(u,{center:[d.longitude||0,d.latitude||0],zoom:d.zoom||0,pitch:d.pitch||0,bearing:d.bearing||0}),n.gl){const C=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=()=>(HTMLCanvasElement.prototype.getContext=C,n.gl)}const _=new this._MapClass(u);d.padding&&_.setPadding(d.padding),n.cursor&&(_.getCanvas().style.cursor=n.cursor),this._createShadowTransform(_);const l=_._render;_._render=C=>{this._inRender=!0,l.call(_,C),this._inRender=!1};const w=_._renderTaskQueue.run;_._renderTaskQueue.run=C=>{w.call(_._renderTaskQueue,C),this._onBeforeRepaint()},_.on("render",()=>this._onAfterRepaint());const T=_.fire;_.fire=this._fireEvent.bind(this,T),_.on("resize",()=>{this._renderTransform.resize(_.transform.width,_.transform.height)}),_.on("styledata",()=>{this._updateStyleComponents(this.props,{}),iP(_.transform,this._renderTransform)}),_.on("sourcedata",()=>this._updateStyleComponents(this.props,{}));for(const C in cP)_.on(C,this._onPointerEvent);for(const C in ab)_.on(C,this._onCameraEvent);for(const C in uP)_.on(C,this._onEvent);this._map=_}recycle(){const n=this.map.getContainer().querySelector("[mapboxgl-children]");n==null||n.remove(),Pd.savedMaps.push(this)}destroy(){this._map.remove()}redraw(){const e=this._map;!this._inRender&&e.style&&(e._frame&&(e._frame.cancel(),e._frame=null),e._render())}_createShadowTransform(e){const n=gV(e.transform);e.painter.transform=n,this._renderTransform=n}_updateSize(e){const{viewState:n}=e;if(n){const a=this._map;if(n.width!==a.transform.width||n.height!==a.transform.height)return a.resize(),!0}return!1}_updateViewState(e,n){if(this._internalUpdate)return!1;const a=this._map,u=this._renderTransform,{zoom:d,pitch:_,bearing:l}=u,w=a.isMoving();w&&(u.cameraElevationReference="sea");const T=aP(u,{...oP(a.transform),...e});if(w&&(u.cameraElevationReference="ground"),T&&n){const C=this._deferredEvents;C.move=!0,C.zoom||(C.zoom=d!==u.zoom),C.rotate||(C.rotate=l!==u.bearing),C.pitch||(C.pitch=_!==u.pitch)}return w||aP(a.transform,e),T}_updateSettings(e,n){const a=this._map;let u=!1;for(const d of _V)if(d in e&&!nl(e[d],n[d])){u=!0;const _=a[`set${d[0].toUpperCase()}${d.slice(1)}`];_==null||_.call(a,e[d])}return u}_updateStyle(e,n){if(e.cursor!==n.cursor&&(this._map.getCanvas().style.cursor=e.cursor||""),e.mapStyle!==n.mapStyle){const{mapStyle:a=lP,styleDiffing:u=!0}=e,d={diff:u};return"localIdeographFontFamily"in e&&(d.localIdeographFontFamily=e.localIdeographFontFamily),this._map.setStyle(sP(a),d),!0}return!1}_updateStyleComponents(e,n){const a=this._map;let u=!1;return a.isStyleLoaded()&&("light"in e&&a.setLight&&!nl(e.light,n.light)&&(u=!0,a.setLight(e.light)),"fog"in e&&a.setFog&&!nl(e.fog,n.fog)&&(u=!0,a.setFog(e.fog)),"terrain"in e&&a.setTerrain&&!nl(e.terrain,n.terrain)&&(!e.terrain||a.getSource(e.terrain.source))&&(u=!0,a.setTerrain(e.terrain))),u}_updateHandlers(e,n){var a,u;const d=this._map;let _=!1;for(const l of vV){const w=(a=e[l])!==null&&a!==void 0?a:!0,T=(u=n[l])!==null&&u!==void 0?u:!0;nl(w,T)||(_=!0,w?d[l].enable(w):d[l].disable())}return _}_queryRenderedFeatures(e){const n=this._map,a=n.transform,{interactiveLayerIds:u=[]}=this.props;try{return n.transform=this._renderTransform,n.queryRenderedFeatures(e,{layers:u.filter(n.getLayer.bind(n))})}catch{return[]}finally{n.transform=a}}_updateHover(e){var n;const{props:a}=this;if(a.interactiveLayerIds&&(a.onMouseMove||a.onMouseEnter||a.onMouseLeave)){const d=e.type,_=((n=this._hoveredFeatures)===null||n===void 0?void 0:n.length)>0,l=this._queryRenderedFeatures(e.point),w=l.length>0;!w&&_&&(e.type="mouseleave",this._onPointerEvent(e)),this._hoveredFeatures=l,w&&!_&&(e.type="mouseenter",this._onPointerEvent(e)),e.type=d}else this._hoveredFeatures=null}_fireEvent(e,n,a){const u=this._map,d=u.transform,_=typeof n=="string"?n:n.type;return _==="move"&&this._updateViewState(this.props,!1),_ in ab&&(typeof n=="object"&&(n.viewState=oP(d)),this._map.isMoving())?(u.transform=this._renderTransform,e.call(u,n,a),u.transform=d,u):(e.call(u,n,a),u)}_onBeforeRepaint(){const e=this._map;this._internalUpdate=!0;for(const a in this._deferredEvents)this._deferredEvents[a]&&e.fire(a);this._internalUpdate=!1;const n=this._map.transform;e.transform=this._renderTransform,this._onAfterRepaint=()=>{iP(this._renderTransform,n),e.transform=n}}}Pd.savedMaps=[];function xV(){let t=null;if(typeof location<"u"){const e=/access_token=([^&\/]*)/.exec(location.search);t=e&&e[1]}try{t=t||void 0}catch{}try{t=t||{}.REACT_APP_MAPBOX_ACCESS_TOKEN}catch{}return t}const bV=["setMaxBounds","setMinZoom","setMaxZoom","setMinPitch","setMaxPitch","setRenderWorldCopies","setProjection","setStyle","addSource","removeSource","addLayer","removeLayer","setLayerZoomRange","setFilter","setPaintProperty","setLayoutProperty","setLight","setTerrain","setFog","remove"];function wV(t){if(!t)return null;const e=t.map,n={getMap:()=>e,getCenter:()=>t.transform.center,getZoom:()=>t.transform.zoom,getBearing:()=>t.transform.bearing,getPitch:()=>t.transform.pitch,getPadding:()=>t.transform.padding,getBounds:()=>t.transform.getBounds(),project:a=>{const u=e.transform;e.transform=t.transform;const d=e.project(a);return e.transform=u,d},unproject:a=>{const u=e.transform;e.transform=t.transform;const d=e.unproject(a);return e.transform=u,d},queryTerrainElevation:(a,u)=>{const d=e.transform;e.transform=t.transform;const _=e.queryTerrainElevation(a,u);return e.transform=d,_},queryRenderedFeatures:(a,u)=>{const d=e.transform;e.transform=t.transform;const _=e.queryRenderedFeatures(a,u);return e.transform=d,_}};for(const a of EV(e))!(a in n)&&!bV.includes(a)&&(n[a]=e[a].bind(e));return n}function EV(t){const e=new Set;let n=t;for(;n;){for(const a of Object.getOwnPropertyNames(n))a[0]!=="_"&&typeof t[a]=="function"&&a!=="fire"&&a!=="setEventedParent"&&e.add(a);n=Object.getPrototypeOf(n)}return Array.from(e)}const SV=typeof document<"u"?St.useLayoutEffect:St.useEffect,TV=["baseApiUrl","maxParallelImageRequests","workerClass","workerCount","workerUrl"];function AV(t,e){for(const a of TV)a in e&&(t[a]=e[a]);const{RTLTextPlugin:n="https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.js"}=e;n&&t.getRTLTextPluginStatus&&t.getRTLTextPluginStatus()==="unavailable"&&t.setRTLTextPlugin(n,a=>{a&&console.error(a)},!0)}const av=St.createContext(null);function IV(t,e,n){const a=St.useContext(fV),[u,d]=St.useState(null),_=St.useRef(),{current:l}=St.useRef({mapLib:null,map:null});St.useEffect(()=>{const C=t.mapLib;let P=!0,z;return Promise.resolve(C||n).then(W=>{if(!P)return;if(!W)throw new Error("Invalid mapLib");const U="Map"in W?W:W.default;if(!U.Map)throw new Error("Invalid mapLib");if(AV(U,t),!U.supported||U.supported(t))t.reuseMaps&&(z=Pd.reuse(t,_.current)),z||(z=new Pd(U.Map,t,_.current)),l.map=wV(z),l.mapLib=U,d(z),a==null||a.onMapMount(l.map,t.id);else throw new Error("Map is not supported by this browser")}).catch(W=>{const{onError:U}=t;U?U({type:"error",target:null,originalEvent:null,error:W}):console.error(W)}),()=>{P=!1,z&&(a==null||a.onMapUnmount(t.id),t.reuseMaps?z.recycle():z.destroy())}},[]),SV(()=>{u&&u.setProps(t)}),St.useImperativeHandle(e,()=>l.map,[u]);const w=St.useMemo(()=>({position:"relative",width:"100%",height:"100%",...t.style}),[t.style]),T={height:"100%"};return St.createElement("div",{id:t.id,ref:_,style:w},u&&St.createElement(av.Provider,{value:l},St.createElement("div",{"mapboxgl-children":"",style:T},t.children)))}const CV=/box|flex|grid|column|lineHeight|fontWeight|opacity|order|tabSize|zIndex/;function Lu(t,e){if(!t||!e)return;const n=t.style;for(const a in e){const u=e[a];Number.isFinite(u)&&!CV.test(a)?n[a]=`${u}px`:n[a]=u}}function kV(t,e){const{map:n,mapLib:a}=St.useContext(av),u=St.useRef({props:t});u.current.props=t;const d=St.useMemo(()=>{let j=!1;St.Children.forEach(t.children,R=>{R&&(j=!0)});const L={...t,element:j?document.createElement("div"):null},V=new a.Marker(L);return V.setLngLat([t.longitude,t.latitude]),V.getElement().addEventListener("click",R=>{var F,H;(H=(F=u.current.props).onClick)===null||H===void 0||H.call(F,{type:"click",target:V,originalEvent:R})}),V.on("dragstart",R=>{var F,H;const Q=R;Q.lngLat=d.getLngLat(),(H=(F=u.current.props).onDragStart)===null||H===void 0||H.call(F,Q)}),V.on("drag",R=>{var F,H;const Q=R;Q.lngLat=d.getLngLat(),(H=(F=u.current.props).onDrag)===null||H===void 0||H.call(F,Q)}),V.on("dragend",R=>{var F,H;const Q=R;Q.lngLat=d.getLngLat(),(H=(F=u.current.props).onDragEnd)===null||H===void 0||H.call(F,Q)}),V},[]);St.useEffect(()=>(d.addTo(n.getMap()),()=>{d.remove()}),[]);const{longitude:_,latitude:l,offset:w,style:T,draggable:C=!1,popup:P=null,rotation:z=0,rotationAlignment:W="auto",pitchAlignment:U="auto"}=t;return St.useEffect(()=>{Lu(d.getElement(),T)},[T]),St.useImperativeHandle(e,()=>d,[]),(d.getLngLat().lng!==_||d.getLngLat().lat!==l)&&d.setLngLat([_,l]),w&&!mV(d.getOffset(),w)&&d.setOffset(w),d.isDraggable()!==C&&d.setDraggable(C),d.getRotation()!==z&&d.setRotation(z),d.getRotationAlignment()!==W&&d.setRotationAlignment(W),d.getPitchAlignment()!==U&&d.setPitchAlignment(U),d.getPopup()!==P&&d.setPopup(P),GS.createPortal(t.children,d.getElement())}const PV=St.memo(St.forwardRef(kV));function hP(t){return new Set(t?t.trim().split(/\s+/):[])}function DV(t,e){const{map:n,mapLib:a}=St.useContext(av),u=St.useMemo(()=>document.createElement("div"),[]),d=St.useRef({props:t});d.current.props=t;const _=St.useMemo(()=>{const l={...t},w=new a.Popup(l);return w.setLngLat([t.longitude,t.latitude]),w.once("open",T=>{var C,P;(P=(C=d.current.props).onOpen)===null||P===void 0||P.call(C,T)}),w},[]);if(St.useEffect(()=>{const l=w=>{var T,C;(C=(T=d.current.props).onClose)===null||C===void 0||C.call(T,w)};return _.on("close",l),_.setDOMContent(u).addTo(n.getMap()),()=>{_.off("close",l),_.isOpen()&&_.remove()}},[]),St.useEffect(()=>{Lu(_.getElement(),t.style)},[t.style]),St.useImperativeHandle(e,()=>_,[]),_.isOpen()&&((_.getLngLat().lng!==t.longitude||_.getLngLat().lat!==t.latitude)&&_.setLngLat([t.longitude,t.latitude]),t.offset&&!nl(_.options.offset,t.offset)&&_.setOffset(t.offset),(_.options.anchor!==t.anchor||_.options.maxWidth!==t.maxWidth)&&(_.options.anchor=t.anchor,_.setMaxWidth(t.maxWidth)),_.options.className!==t.className)){const l=hP(_.options.className),w=hP(t.className);for(const T of l)w.has(T)||_.removeClassName(T);for(const T of w)l.has(T)||_.addClassName(T);_.options.className=t.className}return GS.createPortal(t.children,u)}St.memo(St.forwardRef(DV));function Bd(t,e,n,a){const u=St.useContext(av),d=St.useMemo(()=>t(u),[]);return St.useEffect(()=>{const _=a||n||e,l=typeof e=="function"&&typeof n=="function"?e:null,w=typeof n=="function"?n:typeof e=="function"?e:null,{map:T}=u;return T.hasControl(d)||(T.addControl(d,_==null?void 0:_.position),l&&l(u)),()=>{w&&w(u),T.hasControl(d)&&T.removeControl(d)}},[]),d}function MV(t){const e=Bd(({mapLib:n})=>new n.AttributionControl(t),{position:t.position});return St.useEffect(()=>{Lu(e._container,t.style)},[t.style]),null}St.memo(MV);function zV(t){const e=Bd(({mapLib:n})=>new n.FullscreenControl({container:t.containerId&&document.getElementById(t.containerId)}),{position:t.position});return St.useEffect(()=>{Lu(e._controlContainer,t.style)},[t.style]),null}St.memo(zV);function RV(t,e){const n=St.useRef({props:t}),a=Bd(({mapLib:u})=>{const d=new u.GeolocateControl(t),_=d._setupUI;return d._setupUI=l=>{d._container.hasChildNodes()||_(l)},d.on("geolocate",l=>{var w,T;(T=(w=n.current.props).onGeolocate)===null||T===void 0||T.call(w,l)}),d.on("error",l=>{var w,T;(T=(w=n.current.props).onError)===null||T===void 0||T.call(w,l)}),d.on("outofmaxbounds",l=>{var w,T;(T=(w=n.current.props).onOutOfMaxBounds)===null||T===void 0||T.call(w,l)}),d.on("trackuserlocationstart",l=>{var w,T;(T=(w=n.current.props).onTrackUserLocationStart)===null||T===void 0||T.call(w,l)}),d.on("trackuserlocationend",l=>{var w,T;(T=(w=n.current.props).onTrackUserLocationEnd)===null||T===void 0||T.call(w,l)}),d},{position:t.position});return n.current.props=t,St.useImperativeHandle(e,()=>a,[]),St.useEffect(()=>{Lu(a._container,t.style)},[t.style]),null}const OV=St.memo(St.forwardRef(RV));function FV(t){const e=Bd(({mapLib:n})=>new n.NavigationControl(t),{position:t.position});return St.useEffect(()=>{Lu(e._container,t.style)},[t.style]),null}const LV=St.memo(FV);function BV(t){const e=Bd(({mapLib:d})=>new d.ScaleControl(t),{position:t.position}),n=St.useRef(t),a=n.current;n.current=t;const{style:u}=t;return t.maxWidth!==void 0&&t.maxWidth!==a.maxWidth&&(e.options.maxWidth=t.maxWidth),t.unit!==void 0&&t.unit!==a.unit&&e.setUnit(t.unit),St.useEffect(()=>{Lu(e._container,u)},[u]),null}const NV=St.memo(BV),UV=pV(()=>Promise.resolve().then(()=>_$),void 0),jV=(()=>St.forwardRef(function(e,n){return IV(e,n,UV)}))(),KR=PV,VV=LV,$V=OV,WV=NV;var Nd=HV,GV=Object.prototype.hasOwnProperty;function HV(){for(var t={},e=0;e-1};Gi.prototype.value=function(t){if(this.selected=t,this.el.value=this.getItemValue(t),document.createEvent){var e=document.createEvent("HTMLEvents");e.initEvent("change",!0,!1),this.el.dispatchEvent(e)}else this.el.fireEvent("onchange")};Gi.prototype.getCandidates=function(t){var e={pre:"",post:"",extract:(function(a){return this.getItemValue(a)}).bind(this)},n;this.options.filter?(n=XV.filter(this.query,this.data,e),n=n.map((function(a){return{original:a.original,string:this.render(a.original,a.string)}}).bind(this))):n=this.data.map((function(a){var u=this.render(a);return{original:a,string:u}}).bind(this)),t(n)};Gi.prototype.getItemValue=function(t){return t};Gi.prototype.render=function(t,e){if(e)return e;for(var n=t.original?this.getItemValue(t.original):this.getItemValue(t),a=this.normalize(n),u=a.lastIndexOf(this.query);u>-1;){var d=u+this.query.length;n=n.slice(0,u)+""+n.slice(u,d)+""+n.slice(d),u=a.slice(0,u).lastIndexOf(this.query)}return n};Gi.prototype.renderError=function(t){this.list.drawError(t)};var QV=Gi,YR=QV,JV=YR;typeof window<"u"&&(window.Suggestions=YR);var e7="Expected a function",dP=0/0,t7="[object Symbol]",r7=/^\s+|\s+$/g,n7=/^[-+]0x[0-9a-f]+$/i,i7=/^0b[01]+$/i,o7=/^0o[0-7]+$/i,a7=parseInt,s7=typeof $e=="object"&&$e&&$e.Object===Object&&$e,l7=typeof self=="object"&&self&&self.Object===Object&&self,c7=s7||l7||Function("return this")(),u7=Object.prototype,h7=u7.toString,d7=Math.max,p7=Math.min,sb=function(){return c7.Date.now()};function f7(t,e,n){var a,u,d,_,l,w,T=0,C=!1,P=!1,z=!0;if(typeof t!="function")throw new TypeError(e7);e=pP(e)||0,NE(n)&&(C=!!n.leading,P="maxWait"in n,d=P?d7(pP(n.maxWait)||0,e):d,z="trailing"in n?!!n.trailing:z);function W(te){var se=a,ge=u;return a=u=void 0,T=te,_=t.apply(ge,se),_}function U(te){return T=te,l=setTimeout(V,e),C?W(te):_}function j(te){var se=te-w,ge=te-T,xe=e-se;return P?p7(xe,d-ge):xe}function L(te){var se=te-w,ge=te-T;return w===void 0||se>=e||se<0||P&&ge>=d}function V(){var te=sb();if(L(te))return R(te);l=setTimeout(V,j(te))}function R(te){return l=void 0,z&&a?W(te):(a=u=void 0,_)}function F(){l!==void 0&&clearTimeout(l),T=0,a=w=u=l=void 0}function H(){return l===void 0?_:R(sb())}function Q(){var te=sb(),se=L(te);if(a=arguments,u=this,w=te,se){if(l===void 0)return U(w);if(P)return l=setTimeout(V,e),W(w)}return l===void 0&&(l=setTimeout(V,e)),_}return Q.cancel=F,Q.flush=H,Q}function NE(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function m7(t){return!!t&&typeof t=="object"}function g7(t){return typeof t=="symbol"||m7(t)&&h7.call(t)==t7}function pP(t){if(typeof t=="number")return t;if(g7(t))return dP;if(NE(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=NE(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=t.replace(r7,"");var n=i7.test(t);return n||o7.test(t)?a7(t.slice(2),n?2:8):n7.test(t)?dP:+t}var y7=f7,oT={exports:{}},bd=typeof Reflect=="object"?Reflect:null,fP=bd&&typeof bd.apply=="function"?bd.apply:function(e,n,a){return Function.prototype.apply.call(e,n,a)},Xy;bd&&typeof bd.ownKeys=="function"?Xy=bd.ownKeys:Object.getOwnPropertySymbols?Xy=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Xy=function(e){return Object.getOwnPropertyNames(e)};function _7(t){console&&console.warn&&console.warn(t)}var QR=Number.isNaN||function(e){return e!==e};function Jr(){Jr.init.call(this)}oT.exports=Jr;oT.exports.once=w7;Jr.EventEmitter=Jr;Jr.prototype._events=void 0;Jr.prototype._eventsCount=0;Jr.prototype._maxListeners=void 0;var mP=10;function sv(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(Jr,"defaultMaxListeners",{enumerable:!0,get:function(){return mP},set:function(t){if(typeof t!="number"||t<0||QR(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");mP=t}});Jr.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};Jr.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||QR(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function JR(t){return t._maxListeners===void 0?Jr.defaultMaxListeners:t._maxListeners}Jr.prototype.getMaxListeners=function(){return JR(this)};Jr.prototype.emit=function(e){for(var n=[],a=1;a0&&(_=n[0]),_ instanceof Error)throw _;var l=new Error("Unhandled error."+(_?" ("+_.message+")":""));throw l.context=_,l}var w=d[e];if(w===void 0)return!1;if(typeof w=="function")fP(w,this,n);else for(var T=w.length,C=i3(w,T),a=0;a0&&_.length>u&&!_.warned){_.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+_.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=t,l.type=e,l.count=_.length,_7(l)}return t}Jr.prototype.addListener=function(e,n){return e3(this,e,n,!1)};Jr.prototype.on=Jr.prototype.addListener;Jr.prototype.prependListener=function(e,n){return e3(this,e,n,!0)};function v7(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function t3(t,e,n){var a={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},u=v7.bind(a);return u.listener=n,a.wrapFn=u,u}Jr.prototype.once=function(e,n){return sv(n),this.on(e,t3(this,e,n)),this};Jr.prototype.prependOnceListener=function(e,n){return sv(n),this.prependListener(e,t3(this,e,n)),this};Jr.prototype.removeListener=function(e,n){var a,u,d,_,l;if(sv(n),u=this._events,u===void 0)return this;if(a=u[e],a===void 0)return this;if(a===n||a.listener===n)--this._eventsCount===0?this._events=Object.create(null):(delete u[e],u.removeListener&&this.emit("removeListener",e,a.listener||n));else if(typeof a!="function"){for(d=-1,_=a.length-1;_>=0;_--)if(a[_]===n||a[_].listener===n){l=a[_].listener,d=_;break}if(d<0)return this;d===0?a.shift():x7(a,d),a.length===1&&(u[e]=a[0]),u.removeListener!==void 0&&this.emit("removeListener",e,l||n)}return this};Jr.prototype.off=Jr.prototype.removeListener;Jr.prototype.removeAllListeners=function(e){var n,a,u;if(a=this._events,a===void 0)return this;if(a.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):a[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete a[e]),this;if(arguments.length===0){var d=Object.keys(a),_;for(u=0;u=0;u--)this.removeListener(e,n[u]);return this};function r3(t,e,n){var a=t._events;if(a===void 0)return[];var u=a[e];return u===void 0?[]:typeof u=="function"?n?[u.listener||u]:[u]:n?b7(u):i3(u,u.length)}Jr.prototype.listeners=function(e){return r3(this,e,!0)};Jr.prototype.rawListeners=function(e){return r3(this,e,!1)};Jr.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):n3.call(t,e)};Jr.prototype.listenerCount=n3;function n3(t){var e=this._events;if(e!==void 0){var n=e[t];if(typeof n=="function")return 1;if(n!==void 0)return n.length}return 0}Jr.prototype.eventNames=function(){return this._eventsCount>0?Xy(this._events):[]};function i3(t,e){for(var n=new Array(e),a=0;a]*)>(.*)/);if(!e)return null;var n=e[1],a=e[2].split(";"),u=null,d=a.reduce(function(_,l){var w=A7(l);return w?w.key==="rel"?(u||(u=w.value),_):(_[w.key]=w.value,_):_},{});return u?{url:n,rel:u,params:d}:null}function C7(t){return t?t.split(/,\s*=400){var _=new yP({request:t,body:e.response,statusCode:e.status});a(_);return}n(e)};var d=t.body;typeof d=="string"?e.send(d):d?e.send(JSON.stringify(d)):u?e.send(u):e.send(),k_[t.id]=e}).then(function(n){return U7(t,n)})}function s3(t,e){var n=t.url(e),a=new window.XMLHttpRequest;return a.open(t.method,n),Object.keys(t.headers).forEach(function(u){a.setRequestHeader(u,t.headers[u])}),a}function j7(t){return Promise.resolve().then(function(){var e=s3(t,t.client.accessToken);return a3(t,e)})}var V7={browserAbort:N7,sendRequestXhr:a3,browserSend:j7,createRequestXhr:s3},P_={exports:{}};/*! http://mths.be/base64 v0.1.0 by @mathias | MIT license */P_.exports;(function(t,e){(function(n){var a=e,u=t&&t.exports==a&&t,d=typeof $e=="object"&&$e;(d.global===d||d.window===d)&&(n=d);var _=function(U){this.message=U};_.prototype=new Error,_.prototype.name="InvalidCharacterError";var l=function(U){throw new _(U)},w="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",T=/[\t\n\f\r ]/g,C=function(U){U=String(U).replace(T,"");var j=U.length;j%4==0&&(U=U.replace(/==?$/,""),j=U.length),(j%4==1||/[^+a-zA-Z0-9/]/.test(U))&&l("Invalid character: the string to be decoded is not correctly encoded.");for(var L=0,V,R,F="",H=-1;++H>(-2*L&6)));return F},P=function(U){U=String(U),/[^\0-\xFF]/.test(U)&&l("The string to be encoded contains characters outside of the Latin1 range.");for(var j=U.length%3,L="",V=-1,R,F,H,Q,te=U.length-j;++V>18&63)+w.charAt(Q>>12&63)+w.charAt(Q>>6&63)+w.charAt(Q&63);return j==2?(R=U.charCodeAt(V)<<8,F=U.charCodeAt(++V),Q=R+F,L+=w.charAt(Q>>10)+w.charAt(Q>>4&63)+w.charAt(Q<<2&63)+"="):j==1&&(Q=U.charCodeAt(V),L+=w.charAt(Q>>2)+w.charAt(Q<<4&63)+"=="),L},z={encode:P,decode:C,version:"0.1.0"};if(a&&!a.nodeType)if(u)u.exports=z;else for(var W in z)z.hasOwnProperty(W)&&(a[W]=z[W]);else n.base64=z})($e)})(P_,P_.exports);var $7=P_.exports,W7=$7,cb={};function G7(t){if(cb[t])return cb[t];var e=t.split("."),n=e[0],a=e[1];if(!a)throw new Error("Invalid token");var u=H7(a),d={usage:n,user:u.u};return fu(u,"a")&&(d.authorization=u.a),fu(u,"exp")&&(d.expires=u.exp*1e3),fu(u,"iat")&&(d.created=u.iat*1e3),fu(u,"scopes")&&(d.scopes=u.scopes),fu(u,"client")&&(d.client=u.client),fu(u,"ll")&&(d.lastLogin=u.ll),fu(u,"iu")&&(d.impersonator=u.iu),cb[t]=d,d}function H7(t){try{return JSON.parse(W7.decode(t))}catch{throw new Error("Invalid token")}}function fu(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var l3=G7,c3={exports:{}};(function(t){var e=Object.prototype.hasOwnProperty,n="~";function a(){}Object.create&&(a.prototype=Object.create(null),new a().__proto__||(n=!1));function u(w,T,C){this.fn=w,this.context=T,this.once=C||!1}function d(w,T,C,P,z){if(typeof C!="function")throw new TypeError("The listener must be a function");var W=new u(C,P||w,z),U=n?n+T:T;return w._events[U]?w._events[U].fn?w._events[U]=[w._events[U],W]:w._events[U].push(W):(w._events[U]=W,w._eventsCount++),w}function _(w,T){--w._eventsCount===0?w._events=new a:delete w._events[T]}function l(){this._events=new a,this._eventsCount=0}l.prototype.eventNames=function(){var T=[],C,P;if(this._eventsCount===0)return T;for(P in C=this._events)e.call(C,P)&&T.push(n?P.slice(1):P);return Object.getOwnPropertySymbols?T.concat(Object.getOwnPropertySymbols(C)):T},l.prototype.listeners=function(T){var C=n?n+T:T,P=this._events[C];if(!P)return[];if(P.fn)return[P.fn];for(var z=0,W=P.length,U=new Array(W);zd.length?_:d})}};an.equal=function(e){return function(a){if(a!==e)return JSON.stringify(e)}};an.oneOf=function(){var e=Array.isArray(arguments[0])?arguments[0]:Array.prototype.slice.call(arguments),n=e.map(function(a){return an.equal(a)});return an.oneOfType.apply(this,n)};an.range=function(e){var n=e[0],a=e[1];return function(d){var _=vc(an.number,d);if(_||da)return"number between "+n+" & "+a+" (inclusive)"}};an.any=function(){};an.boolean=function(e){if(typeof e!="boolean")return"boolean"};an.number=function(e){if(typeof e!="number")return"number"};an.plainArray=function(e){if(!Array.isArray(e))return"array"};an.plainObject=function(e){if(!h9(e))return"object"};an.string=function(e){if(typeof e!="string")return"string"};an.func=function(e){if(typeof e!="function")return"function"};function vc(t,e){if(!(e==null&&!t.hasOwnProperty("__required"))){var n=t(e);if(n)return Array.isArray(n)?n:[n]}}function lT(t,e){var n=t.length,a=t[n-1],u=t.slice(0,n-1);return u.length===0&&(u=[y3]),e=d9(e,{path:u}),typeof a=="function"?a(e):v3(e,f9(a))}function p9(t){return t.length<2?t[0]:t.length===2?t.join(" or "):t.slice(0,-1).join(", ")+", or "+t.slice(-1)}function f9(t){return"must be "+m9(t)+"."}function m9(t){return/^an? /.test(t)?t:/^[aeiou]/i.test(t)?"an "+t:/^[a-z]/i.test(t)?"a "+t:t}function v3(t,e){var n=x3(t.path),a=t.path.join(".")+" "+e,u=n?"Item at position ":"";return u+a}function x3(t){return typeof t[t.length-1]=="number"||typeof t[0]=="number"}function g9(t){return Object.keys(t||{}).map(function(e){return{key:e,value:t[e]}})}an.validate=vc;an.processMessage=lT;var y9=an,_9=Nd,wd=y9;function v9(t){if(typeof window<"u")return t instanceof $e.Blob||t instanceof $e.ArrayBuffer?void 0:"Blob or ArrayBuffer";if(!(typeof t=="string"||t.pipe!==void 0))return"Filename or Readable stream"}function x9(t,e){return wd.assert(wd.strictShape(t),e)}function b9(t){var e="date";if(typeof t=="boolean")return e;try{var n=new Date(t);if(n.getTime&&isNaN(n.getTime()))return e}catch{return e}}function w9(t){return wd.tuple(wd.number,wd.number)(t)}var E9=_9(wd,{file:v9,date:b9,coordinates:w9,assertShape:x9});function S9(t,e){var n=function(a,u){return e.indexOf(a)!==-1&&u!==void 0};return typeof e=="function"&&(n=e),Object.keys(t).filter(function(a){return n(a,t[a])}).reduce(function(a,u){return a[u]=t[u],a},{})}var T9=S9;function A9(t,e){return Object.keys(t).reduce(function(n,a){return n[a]=e(a,t[a]),n},{})}var I9=A9,C9=I9;function k9(t){return C9(t,function(e,n){return typeof n=="boolean"?JSON.stringify(n):n})}var P9=k9,D9=p3,M9=g3;function z9(t){return function(e){var n;D9.prototype.isPrototypeOf(e)?n=e:n=M9(e);var a=Object.create(t);return a.client=n,a}}var R9=z9,b3=Nd,Cr=E9,D_=T9,w3=P9,O9=R9,cT={},E3=["country","region","postcode","district","place","locality","neighborhood","address","poi","poi.landmark"];cT.forwardGeocode=function(t){Cr.assertShape({query:Cr.required(Cr.string),mode:Cr.oneOf("mapbox.places","mapbox.places-permanent"),countries:Cr.arrayOf(Cr.string),proximity:Cr.oneOf(Cr.coordinates,"ip"),types:Cr.arrayOf(Cr.oneOf(E3)),autocomplete:Cr.boolean,bbox:Cr.arrayOf(Cr.number),limit:Cr.number,language:Cr.arrayOf(Cr.string),routing:Cr.boolean,fuzzyMatch:Cr.boolean,worldview:Cr.string})(t),t.mode=t.mode||"mapbox.places";var e=w3(b3({country:t.countries},D_(t,["proximity","types","autocomplete","bbox","limit","language","routing","fuzzyMatch","worldview"])));return this.client.createRequest({method:"GET",path:"/geocoding/v5/:mode/:query.json",params:D_(t,["mode","query"]),query:e})};cT.reverseGeocode=function(t){Cr.assertShape({query:Cr.required(Cr.coordinates),mode:Cr.oneOf("mapbox.places","mapbox.places-permanent"),countries:Cr.arrayOf(Cr.string),types:Cr.arrayOf(Cr.oneOf(E3)),bbox:Cr.arrayOf(Cr.number),limit:Cr.number,language:Cr.arrayOf(Cr.string),reverseMode:Cr.oneOf("distance","score"),routing:Cr.boolean,worldview:Cr.string})(t),t.mode=t.mode||"mapbox.places";var e=w3(b3({country:t.countries},D_(t,["country","types","bbox","limit","language","reverseMode","routing","worldview"])));return this.client.createRequest({method:"GET",path:"/geocoding/v5/:mode/:query.json",params:D_(t,["mode","query"]),query:e})};var F9=O9(cT),L9=self.crypto||self.msCrypto,uT="-_",mc=36;for(;mc--;)uT+=mc.toString(36);mc=36;for(;mc---10;)uT+=mc.toString(36).toUpperCase();var B9=function(t){var e="",n=L9.getRandomValues(new Uint8Array(t||21));for(mc=t||21;mc--;)e+=uT[n[mc]&63];return e},N9=B9;function S3(t){this.origin=t.origin||"https://api.mapbox.com",this.endpoint="events/v2",this.access_token=t.accessToken,this.version="0.2.0",this.sessionID=this.generateSessionID(),this.userAgent=this.getUserAgent(),this.options=t,this.send=this.send.bind(this),this.countries=t.countries?t.countries.split(","):null,this.types=t.types?t.types.split(","):null,this.bbox=t.bbox?t.bbox:null,this.language=t.language?t.language.split(","):null,this.limit=t.limit?+t.limit:null,this.locale=navigator.language||null,this.enableEventLogging=this.shouldEnableLogging(t),this.eventQueue=new Array,this.flushInterval=t.flushInterval||1e3,this.maxQueueSize=t.maxQueueSize||100,this.timer=this.flushInterval?setTimeout(this.flush.bind(this),this.flushInterval):null,this.lastSentInput="",this.lastSentIndex=0}S3.prototype={select:function(t,e){var n=this.getSelectedIndex(t,e),a=this.getEventPayload("search.select",e);if(a.resultIndex=n,a.resultPlaceName=t.place_name,a.resultId=t.id,!(n===this.lastSentIndex&&a.queryString===this.lastSentInput||n==-1)&&(this.lastSentIndex=n,this.lastSentInput=a.queryString,!!a.queryString))return this.push(a)},start:function(t){var e=this.getEventPayload("search.start",t);if(e.queryString)return this.push(e)},keyevent:function(t,e){if(t.key&&!(t.metaKey||[9,27,37,39,13,38,40].indexOf(t.keyCode)!==-1)){var n=this.getEventPayload("search.keystroke",e);if(n.lastAction=t.key,!!n.queryString)return this.push(n)}},send:function(t,e){if(!this.enableEventLogging)return e?e():void 0;var n=this.getRequestOptions(t);this.request(n,(function(a){if(a)return this.handleError(a,e);if(e)return e()}).bind(this))},getRequestOptions:function(t){Array.isArray(t)||(t=[t]);var e={method:"POST",host:this.origin,path:this.endpoint+"?access_token="+this.access_token,headers:{"Content-Type":"application/json"},body:JSON.stringify(t)};return e},getEventPayload:function(t,e){var n;e.options.proximity?n=[e.options.proximity.longitude,e.options.proximity.latitude]:n=null;var a=e._map?e._map.getZoom():void 0,u={event:t,created:+new Date,sessionIdentifier:this.sessionID,country:this.countries,userAgent:this.userAgent,language:this.language,bbox:this.bbox,types:this.types,endpoint:"mapbox.places",autocomplete:e.options.autocomplete,fuzzyMatch:e.options.fuzzyMatch,proximity:n,limit:e.options.limit,routing:e.options.routing,worldview:e.options.worldview,mapZoom:a,keyboardLocale:this.locale};return t==="search.select"?u.queryString=e.inputString:t!="search.select"&&e._inputEl?u.queryString=e._inputEl.value:u.queryString=e.inputString,u},request:function(t,e){var n=new XMLHttpRequest;n.onreadystatechange=function(){if(this.readyState==4)return this.status==204?e(null):e(this.statusText)},n.open(t.method,t.host+"/"+t.path,!0);for(var a in t.headers){var u=t.headers[a];n.setRequestHeader(a,u)}n.send(t.body)},handleError:function(t,e){if(e)return e(t)},generateSessionID:function(){return N9()},getUserAgent:function(){return"mapbox-gl-geocoder."+this.version+"."+navigator.userAgent},getSelectedIndex:function(t,e){if(e._typeahead){var n=e._typeahead.data,a=t.id,u=n.map(function(_){return _.id}),d=u.indexOf(a);return d}},shouldEnableLogging:function(t){return!(t.enableEventLogging===!1||t.origin&&t.origin.indexOf("api.mapbox.com")==-1||t.localGeocoder||t.filter)},flush:function(){this.eventQueue.length>0&&(this.send(this.eventQueue),this.eventQueue=new Array),this.timer&&clearTimeout(this.timer),this.flushInterval&&(this.timer=setTimeout(this.flush.bind(this),this.flushInterval))},push:function(t,e){this.eventQueue.push(t),(this.eventQueue.length>=this.maxQueueSize||e)&&this.flush()},remove:function(){this.flush()}};var U9=S3,j9={de:"Suche",it:"Ricerca",en:"Search",nl:"Zoeken",fr:"Chercher",ca:"Cerca",he:"לחפש",ja:"サーチ",lv:"Meklēt",pt:"Procurar",sr:"Претрага",zh:"搜索",cs:"Vyhledávání",hu:"Keresés",ka:"ძიება",nb:"Søke",sk:"Vyhľadávanie",th:"ค้นหา",fi:"Hae",is:"Leita",ko:"수색",pl:"Szukaj",sl:"Iskanje",fa:"جستجو",ru:"Поиск"},V9={placeholder:j9},T3={exports:{}};(function(t){(function(e,n,a){t.exports?t.exports=a():e[n]=a()})($e,"subtag",function(){var e="",n=/^([a-zA-Z]{2,3})(?:[_-]+([a-zA-Z]{3})(?=$|[_-]+))?(?:[_-]+([a-zA-Z]{4})(?=$|[_-]+))?(?:[_-]+([a-zA-Z]{2}|[0-9]{3})(?=$|[_-]+))?/;function a(w){return w.match(n)||[]}function u(w){return a(w).filter(function(T,C){return T&&C})}function d(w){return w=a(w),{language:w[1]||e,extlang:w[2]||e,script:w[3]||e,region:w[4]||e}}function _(w,T,C){Object.defineProperty(w,T,{value:C,enumerable:!0})}function l(w,T,C){function P(z){return a(z)[w]||e}_(P,"pattern",T),_(d,C,P)}return l(1,/^[a-zA-Z]{2,3}$/,"language"),l(2,/^[a-zA-Z]{3}$/,"extlang"),l(3,/^[a-zA-Z]{4}$/,"script"),l(4,/^[a-zA-Z]{2}$|^[0-9]{3}$/,"region"),_(d,"split",u),d})})(T3);var $9=T3.exports,W9=JV,G9=y7,wu=Nd,H9=S7.EventEmitter,xP=T7,bP=l9,wP=F9,q9=U9,Z9=V9,K9=$9;const ql={FORWARD:0,LOCAL:1,REVERSE:2};function A3(t){this._eventEmitter=new H9,this.options=wu({},this.options,t),this.inputString="",this.fresh=!0,this.lastSelected=null}A3.prototype={options:{zoom:16,flyTo:!0,trackProximity:!0,minLength:2,reverseGeocode:!1,limit:5,origin:"https://api.mapbox.com",enableEventLogging:!0,marker:!0,mapboxgl:null,collapsed:!1,clearAndBlurOnEsc:!1,clearOnBlur:!1,getItemValue:function(t){return t.place_name},render:function(t){var e=t.place_name.split(",");return'
'+e[0]+'
'+e.splice(1,e.length).join(",")+"
"}},addTo:function(t){function e(n,a){if(!document.body.contains(a))throw new Error("Element provided to #addTo() exists, but is not in the DOM");const u=n.onAdd();a.appendChild(u)}if(t._controlContainer)t.addControl(this);else if(t instanceof HTMLElement)e(this,t);else if(typeof t=="string"){const n=document.querySelectorAll(t);if(n.length===0)throw new Error("Element ",t,"not found.");if(n.length>1)throw new Error("Geocoder can only be added to a single html element");e(this,n[0])}else throw new Error("Error: addTo must be a mapbox-gl-js map, an html element, or a CSS selector query for a single html element")},onAdd:function(t){if(t&&typeof t!="string"&&(this._map=t),this.setLanguage(),this.options.localGeocoderOnly||(this.geocoderService=wP(bP({accessToken:this.options.accessToken,origin:this.options.origin}))),this.options.localGeocoderOnly&&!this.options.localGeocoder)throw new Error("A localGeocoder function must be specified to use localGeocoderOnly mode");this.eventManager=new q9(this.options),this._onChange=this._onChange.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onPaste=this._onPaste.bind(this),this._onBlur=this._onBlur.bind(this),this._showButton=this._showButton.bind(this),this._hideButton=this._hideButton.bind(this),this._onQueryResult=this._onQueryResult.bind(this),this.clear=this.clear.bind(this),this._updateProximity=this._updateProximity.bind(this),this._collapse=this._collapse.bind(this),this._unCollapse=this._unCollapse.bind(this),this._clear=this._clear.bind(this),this._clearOnBlur=this._clearOnBlur.bind(this);var e=this.container=document.createElement("div");e.className="mapboxgl-ctrl-geocoder mapboxgl-ctrl";var n=this.createIcon("search",'');this._inputEl=document.createElement("input"),this._inputEl.type="text",this._inputEl.className="mapboxgl-ctrl-geocoder--input",this.setPlaceholder(),this.options.collapsed&&(this._collapse(),this.container.addEventListener("mouseenter",this._unCollapse),this.container.addEventListener("mouseleave",this._collapse),this._inputEl.addEventListener("focus",this._unCollapse)),(this.options.collapsed||this.options.clearOnBlur)&&this._inputEl.addEventListener("blur",this._onBlur),this._inputEl.addEventListener("keydown",G9(this._onKeyDown,200)),this._inputEl.addEventListener("paste",this._onPaste),this._inputEl.addEventListener("change",this._onChange),this.container.addEventListener("mouseenter",this._showButton),this.container.addEventListener("mouseleave",this._hideButton),this._inputEl.addEventListener("keyup",(function(d){this.eventManager.keyevent(d,this)}).bind(this));var a=document.createElement("div");a.classList.add("mapboxgl-ctrl-geocoder--pin-right"),this._clearEl=document.createElement("button"),this._clearEl.setAttribute("aria-label","Clear"),this._clearEl.addEventListener("click",this.clear),this._clearEl.className="mapboxgl-ctrl-geocoder--button";var u=this.createIcon("close",'');return this._clearEl.appendChild(u),this._loadingEl=this.createIcon("loading",''),a.appendChild(this._clearEl),a.appendChild(this._loadingEl),e.appendChild(n),e.appendChild(this._inputEl),e.appendChild(a),this._typeahead=new W9(this._inputEl,[],{filter:!1,minLength:this.options.minLength,limit:this.options.limit}),this.setRenderFunction(this.options.render),this._typeahead.getItemValue=this.options.getItemValue,this.mapMarker=null,this._handleMarker=this._handleMarker.bind(this),this._map&&(this.options.trackProximity&&(this._updateProximity(),this._map.on("moveend",this._updateProximity)),this._mapboxgl=this.options.mapboxgl,!this._mapboxgl&&this.options.marker&&(console.error("No mapboxgl detected in options. Map markers are disabled. Please set options.mapboxgl."),this.options.marker=!1)),e},createIcon:function(t,e){var n=document.createElementNS("http://www.w3.org/2000/svg","svg");if(n.setAttribute("class","mapboxgl-ctrl-geocoder--icon mapboxgl-ctrl-geocoder--icon-"+t),n.setAttribute("viewBox","0 0 18 18"),n.setAttribute("xml:space","preserve"),n.setAttribute("width",18),n.setAttribute("height",18),"innerHTML"in n)n.innerHTML=e;else{var a=document.createElement("div");a.innerHTML=""+e.valueOf().toString()+"";var u=a.firstChild,d=u.firstChild;n.appendChild(d)}return n},onRemove:function(){return this.container.parentNode.removeChild(this.container),this.options.trackProximity&&this._map&&this._map.off("moveend",this._updateProximity),this._removeMarker(),this._map=null,this},_onPaste:function(t){var e=(t.clipboardData||window.clipboardData).getData("text");e.length>=this.options.minLength&&this._geocode(e)},_onKeyDown:function(t){var e=27,n=9;if(t.keyCode===e&&this.options.clearAndBlurOnEsc)return this._clear(t),this._inputEl.blur();var a=t.target&&t.target.shadowRoot?t.target.shadowRoot.activeElement:t.target,u=a?a.value:"";if(!u)return this.fresh=!0,t.keyCode!==n&&this.clear(t),this._clearEl.style.display="none";t.metaKey||[n,e,37,39,13,38,40].indexOf(t.keyCode)!==-1||a.value.length>=this.options.minLength&&this._geocode(a.value)},_showButton:function(){this._typeahead.selected&&(this._clearEl.style.display="block")},_hideButton:function(){this._typeahead.selected&&(this._clearEl.style.display="none")},_onBlur:function(t){this.options.clearOnBlur&&this._clearOnBlur(t),this.options.collapsed&&this._collapse()},_onChange:function(){var t=this._typeahead.selected;if(t&&JSON.stringify(t)!==this.lastSelected){if(this._clearEl.style.display="none",this.options.flyTo){var e;if(t.properties&&xP[t.properties.short_code])e=wu({},this.options.flyTo),this._map&&this._map.fitBounds(xP[t.properties.short_code].bbox,e);else if(t.bbox){var n=t.bbox;e=wu({},this.options.flyTo),this._map&&this._map.fitBounds([[n[0],n[1]],[n[2],n[3]]],e)}else{var a={zoom:this.options.zoom};e=wu({},a,this.options.flyTo),t.center?e.center=t.center:t.geometry&&t.geometry.type&&t.geometry.type==="Point"&&t.geometry.coordinates&&(e.center=t.geometry.coordinates),this._map&&this._map.flyTo(e)}}this.options.marker&&this._mapboxgl&&this._handleMarker(t),this._inputEl.focus(),this._inputEl.scrollLeft=0,this._inputEl.setSelectionRange(0,0),this.lastSelected=JSON.stringify(t),this._eventEmitter.emit("result",{result:t}),this.eventManager.select(t,this)}},_requestType:function(t,e){var n;const a=/^[ ]*(-?\d+\.?\d*)[, ]+(-?\d+\.?\d*)[ ]*$/;return t.localGeocoderOnly?n=ql.LOCAL:t.reverseGeocode&&a.test(e)?n=ql.REVERSE:n=ql.FORWARD,n},_setupConfig:function(t,e){const n=["bbox","limit","proximity","countries","types","language","reverseMode","mode","autocomplete","fuzzyMatch","routing","worldview"],a=/[\s,]+/;var u=this,d=n.reduce(function(l,w){if(u.options[w]===void 0||u.options[w]===null)return l;["countries","types","language"].indexOf(w)>-1?l[w]=u.options[w].split(a):l[w]=u.options[w];const T=typeof u.options[w].longitude=="number"&&typeof u.options[w].latitude=="number";if(w==="proximity"&&T){const C=u.options[w].longitude,P=u.options[w].latitude;l[w]=[C,P]}return l},{});switch(t){case ql.REVERSE:{var _=e.split(a).map(function(l){return parseFloat(l,10)}).reverse();d.types&&d.types[0],d=wu(d,{query:_,limit:1}),["proximity","autocomplete","fuzzyMatch","bbox"].forEach(function(l){l in d&&delete d[l]})}break;case ql.FORWARD:/^[ ]*(-?\d+\.?\d*)[, ]+(-?\d+\.?\d*)*[ ]*$/.test(e)&&(e=e.replace(/,/g," ")),d=wu(d,{query:e});break}return d},_geocode:function(t){this.inputString=t,this._loadingEl.style.display="block",this._eventEmitter.emit("loading",{query:t});const e=this._requestType(this.options,t),n=this._setupConfig(e,t);var a;switch(e){case ql.LOCAL:a=Promise.resolve();break;case ql.FORWARD:a=this.geocoderService.forwardGeocode(n).send();break;case ql.REVERSE:a=this.geocoderService.reverseGeocode(n).send();break}var u=this.options.localGeocoder?this.options.localGeocoder(t)||[]:[],d=[],_=null;return a.catch((function(l){_=l}).bind(this)).then((function(l){this._loadingEl.style.display="none";var w={};return l?l.statusCode=="200"&&(w=l.body,w.request=l.request,w.headers=l.headers):w={type:"FeatureCollection",features:[]},w.config=n,this.fresh&&(this.eventManager.start(this),this.fresh=!1),w.features=w.features?u.concat(w.features):u,this.options.externalGeocoder?(d=this.options.externalGeocoder(t,w.features)||[],d.then(function(T){return w.features=w.features?T.concat(w.features):T,w},function(){return w})):w}).bind(this)).then((function(l){if(_)throw _;this.options.filter&&l.features.length&&(l.features=l.features.filter(this.options.filter)),l.features.length?(this._clearEl.style.display="block",this._eventEmitter.emit("results",l),this._typeahead.update(l.features)):(this._clearEl.style.display="none",this._typeahead.selected=null,this._renderNoResults(),this._eventEmitter.emit("results",l))}).bind(this)).catch((function(l){this._loadingEl.style.display="none",u.length&&this.options.localGeocoder||d.length&&this.options.externalGeocoder?(this._clearEl.style.display="block",this._typeahead.update(u)):(this._clearEl.style.display="none",this._typeahead.selected=null,this._renderError()),this._eventEmitter.emit("results",{features:u}),this._eventEmitter.emit("error",{error:l})}).bind(this)),a},_clear:function(t){t&&t.preventDefault(),this._inputEl.value="",this._typeahead.selected=null,this._typeahead.clear(),this._onChange(),this._clearEl.style.display="none",this._removeMarker(),this.lastSelected=null,this._eventEmitter.emit("clear"),this.fresh=!0},clear:function(t){this._clear(t),this._inputEl.focus()},_clearOnBlur:function(t){var e=this;t.relatedTarget&&e._clear(t)},_onQueryResult:function(t){var e=t.body;if(e.features.length){var n=e.features[0];this._typeahead.selected=n,this._inputEl.value=n.place_name,this._onChange()}},_updateProximity:function(){if(this._map)if(this._map.getZoom()>9){var t=this._map.getCenter().wrap();this.setProximity({longitude:t.lng,latitude:t.lat})}else this.setProximity(null)},_collapse:function(){!this._inputEl.value&&this._inputEl!==document.activeElement&&this.container.classList.add("mapboxgl-ctrl-geocoder--collapsed")},_unCollapse:function(){this.container.classList.remove("mapboxgl-ctrl-geocoder--collapsed")},query:function(t){return this._geocode(t).then(this._onQueryResult),this},_renderError:function(){var t="
There was an error reaching the server
";this._renderMessage(t)},_renderNoResults:function(){var t="
No results found
";this._renderMessage(t)},_renderMessage:function(t){this._typeahead.update([]),this._typeahead.selected=null,this._typeahead.clear(),this._typeahead.renderError(t)},_getPlaceholderText:function(){if(this.options.placeholder)return this.options.placeholder;if(this.options.language){var t=this.options.language.split(",")[0],e=K9.language(t),n=Z9.placeholder[e];if(n)return n}return"Search"},setInput:function(t){return this._inputEl.value=t,this._typeahead.selected=null,this._typeahead.clear(),t.length>=this.options.minLength&&this._geocode(t),this},setProximity:function(t){return this.options.proximity=t,this},getProximity:function(){return this.options.proximity},setRenderFunction:function(t){return t&&typeof t=="function"&&(this._typeahead.render=t),this},getRenderFunction:function(){return this._typeahead.render},setLanguage:function(t){var e=navigator.language||navigator.userLanguage||navigator.browserLanguage;return this.options.language=t||this.options.language||e,this},getLanguage:function(){return this.options.language},getZoom:function(){return this.options.zoom},setZoom:function(t){return this.options.zoom=t,this},getFlyTo:function(){return this.options.flyTo},setFlyTo:function(t){return this.options.flyTo=t,this},getPlaceholder:function(){return this.options.placeholder},setPlaceholder:function(t){return this.placeholder=t||this._getPlaceholderText(),this._inputEl.placeholder=this.placeholder,this._inputEl.setAttribute("aria-label",this.placeholder),this},getBbox:function(){return this.options.bbox},setBbox:function(t){return this.options.bbox=t,this},getCountries:function(){return this.options.countries},setCountries:function(t){return this.options.countries=t,this},getTypes:function(){return this.options.types},setTypes:function(t){return this.options.types=t,this},getMinLength:function(){return this.options.minLength},setMinLength:function(t){return this.options.minLength=t,this._typeahead&&(this._typeahead.options.minLength=t),this},getLimit:function(){return this.options.limit},setLimit:function(t){return this.options.limit=t,this._typeahead&&(this._typeahead.options.limit=t),this},getFilter:function(){return this.options.filter},setFilter:function(t){return this.options.filter=t,this},setOrigin:function(t){return this.options.origin=t,this.geocoderService=wP(bP({accessToken:this.options.accessToken,origin:this.options.origin})),this},getOrigin:function(){return this.options.origin},setAutocomplete:function(t){return this.options.autocomplete=t,this},getAutocomplete:function(){return this.options.autocomplete},setFuzzyMatch:function(t){return this.options.fuzzyMatch=t,this},getFuzzyMatch:function(){return this.options.fuzzyMatch},setRouting:function(t){return this.options.routing=t,this},getRouting:function(){return this.options.routing},setWorldview:function(t){return this.options.worldview=t,this},getWorldview:function(){return this.options.worldview},_handleMarker:function(t){if(this._map){this._removeMarker();var e={color:"#4668F2"},n=wu({},e,this.options.marker);return this.mapMarker=new this._mapboxgl.Marker(n),t.center?this.mapMarker.setLngLat(t.center).addTo(this._map):t.geometry&&t.geometry.type&&t.geometry.type==="Point"&&t.geometry.coordinates&&this.mapMarker.setLngLat(t.geometry.coordinates).addTo(this._map),this}},_removeMarker:function(){this.mapMarker&&(this.mapMarker.remove(),this.mapMarker=null)},on:function(t,e){return this._eventEmitter.on(t,e),this},off:function(t,e){return this._eventEmitter.removeListener(t,e),this.eventManager.remove(),this}};var X9=A3;const Y9=XE(X9);/* + * Frontend UI component library for the CORI Data API + * {@link https://github.com/ruralinnovation/cori.data.api} + * @copyright Rural Innovation Strategies, Inc. + * @license ISC + */function Q9(t){const[e,n]=St.useState(null),a=Object.assign({},t),u=Bd(()=>{const d=new Y9(Object.assign(Object.assign({},a),{marker:e||!1,accessToken:a.mapboxAccessToken}));return a.onLoading&&d.on("loading",a.onLoading),a.onResults&&d.on("results",a.onResults),a.onResult&&d.on("result",_=>{var l;a.onResult!==void 0&&a.onResult(_);const{result:w}=_,T=w&&(w.center||((l=w.geometry)===null||l===void 0?void 0:l.type)==="Point"&&w.geometry.coordinates);if(T&&a.marker){const C=typeof a.marker=="object"?a.marker:{};n(St.createElement(KR,Object.assign({},C,{longitude:T[0],latitude:T[1]})))}else n(null)}),a.onError&&d.on("error",a.onError),d},{position:a.position});return u.hasOwnProperty("_map")&&u._map&&(u.getProximity()!==a.proximity&&a.proximity!==void 0&&u.setProximity(a.proximity),u.getRenderFunction()!==a.render&&a.render!==void 0&&u.setRenderFunction(a.render),u.getLanguage()!==a.language&&a.language!==void 0&&u.setLanguage(a.language),u.getZoom()!==a.zoom&&a.zoom!==void 0&&u.setZoom(a.zoom),u.getFlyTo()!==a.flyTo&&a.flyTo!==void 0&&u.setFlyTo(a.flyTo),u.getPlaceholder()!==a.placeholder&&a.placeholder!==void 0&&u.setPlaceholder(a.placeholder),u.getCountries()!==a.countries&&a.countries!==void 0&&u.setCountries(a.countries),u.getTypes()!==a.types&&a.types!==void 0&&u.setTypes(a.types),u.getMinLength()!==a.minLength&&a.minLength!==void 0&&u.setMinLength(a.minLength),u.getLimit()!==a.limit&&a.limit!==void 0&&u.setLimit(a.limit),u.getFilter()!==a.filter&&a.filter!==void 0&&u.setFilter(a.filter),u.getOrigin()!==a.origin&&a.origin!==void 0&&u.setOrigin(a.origin),u.getAutocomplete()!==a.autocomplete&&a.autocomplete!==void 0&&u.setAutocomplete(a.autocomplete),u.getFuzzyMatch()!==a.fuzzyMatch&&a.fuzzyMatch!==void 0&&u.setFuzzyMatch(a.fuzzyMatch),u.getRouting()!==a.routing&&a.routing!==void 0&&u.setRouting(a.routing),u.getWorldview()!==a.worldview&&a.worldview!==void 0&&u.setWorldview(a.worldview)),e}/* + * Frontend UI component library for the CORI Data API + * {@link https://github.com/ruralinnovation/cori.data.api} + * @copyright Rural Innovation Strategies, Inc. + * @license ISC + */var J9=8,e$="LIVE - CORI light basemap - county labels",t$={"mapbox:type":"default","mapbox:origin":"light-v10","mapbox:autocomposite":!0,"mapbox:groups":{"1444855769305.6016":{name:"Tunnels",collapsed:!0},"1444855786460.0557":{name:"Roads",collapsed:!0},"1444855799204.86":{name:"Bridges",collapsed:!0},"1444934295202.7542":{name:"Admin boundaries",collapsed:!1}},"mapbox:sdk-support":{js:"0.54.0",android:"7.4.0",ios:"4.10.0"},"mapbox:uiParadigm":"layers","mapbox:thumb":"data:image/webp;base64,UklGRmAJAABXRUJQVlA4TFQJAAAvO8AOAPX4drZtmWTXts7/wMzUqCCLGZOCMjCzbfx/1jFYYr9m+zeF5Gqx8bj3bozqqoouhWLj6dCYQqn+K1W6Vb1HB+Nn+HqXMatDQowkSVJTM/xwkv+mwu1OF8S2kRxJ7PyjfbMzs6a7+j8Be9jFwDSO7Za6ajtXwy/CHsEeYqSRsWzFQAbkSKlndkzfLGcN0zHLlJYZyNmbaOFmTdM0apq3d+t5Y906dr68rJ16zskdY1kaCWdraPJQE8CKlJazrjk+nrVM2/y0Q8ZpQtFux7BmD3bG8fxnncEJvUfnnPObbeMBsKIKWwJLA5PS8njL3DLP4CPmpnkG4+PxuFaBT22n9wiwUuTNx93WpXE+s4bmwJJyWCFwVAX3SJuMZ8fb5ic/uYKb5qc/HY+XqSvlgEmPIYI91BF5/X6fOW3Hpn0x7BGCGMgOIUVMAPdLSmn8xk/+ddM0zT/NUlqmDDhHT0NSj4pzfDEiNh53M7rOC/ElKUxkESgctcF75jilNBuP35gtU2kUjLo1fQicFbF5v7lCb488VM7WALsaKYd2zVFMDJBTSmn50/F4uY8oH9g2dlja+Pv3HebWDpZz2CAZV8BymTpIaTYb/3SZ9qXU6tvEuVU4hpI2Xye6NVcGNl5gQmAtIFJK47Qcj4/vYUcXT2V/e+hiR0dKjfeJAXNqGGNjZyGHYGhSSrPZcjkbH+83Acwe6dm7BBtfXc6umi7y9rHj4OwwIMkKSw5gmVJqm/FsNhvPlmlc+PcAb+MGLpNvvzvdHEb//8OovHFcQ+Yq/v9FAAPYcsiPFeA6pdTGbLkcz8YpXVyWKaW1nwkYRs7diBfOOr8KN/XMr5rQ0a5ZP9bB2pgIyCgcIBlYpJT6JqXl+HicUjv5Y0rp+jbBBm1ktlJfyo4HjVCu55uvNWTWNgGEcRjHAhvXJeOfjmep/JFd4HvbAxzyF3Odt55noJNjJLBCyEgTLJk6peO0PB7PlmVLsAG10hVYoHr+7tb9Xnc+Gq9LkmUp5EAAOaWOWc5mhcmkYAH+9Y69oGxQ5rm+/blu2ZcnO8ieP+xiF/UnHn5CsSdvpGRwWo4fz5bj8QTIKdUqxA4DhjDSXN3bt/Ha18gPbdnClr2jx9/+C/GJd2vFG1e2C6uWywDw0KQAUNdOEHYNtdW/9Ppr//pCNFKyMNiw+I5lm+I8GpNlnQuACwNyDES2sNDdYzNgTqQqy4CycbYlyn/fGMJR56jXN5Bxl/k8lnLsCjmL/zgc0lfHoSnKIiaEXOZssAXrI0t7EE3HQLYenf4V9p3x7Le+duJxX2Uu4IN6w2A8AvZRYLMfBfv7gOs6f/4Qh9THjV3bkxx+9L5vzc/c983rz+06z4+BKDFWCKySTMgGEOW5ydRzy6pCJj76rcn68b9LrtNns3fqsW0A+cjYLlkRkjH3+nFcfyKbqtCX7v4vzs98Z5ulUMGaHrGvbYdldC/acUDMI+ogY9183D4xWa0atXp1Br1lYw5HKnGOiHB2CO/nHtr6vCTlx0cmz3Gsv3eHObHhVctqJNe877Ab7FbtEc2e1A6XKBS5tkS5X360Y9aVjhVZn9gJGwSNx7N9/c6ZCgLgO3R6exWZUku4tlww9q0U0NLnbVRPI7tw57hOOqLMqjr1TIaJXRYSZIVsii+vgOg4skLzlWTD3c//qfA+yp242/sFnDDP4So+huswWBjmlsucf4/xnfEEj8BG783+2+m1R/Cwpne5evS5sQcLGVuteLpeZ7t/G9xbff0Z2zLAfWyKHbTUtLDN0QHWoN5OvctX2717l9Pva6cXffKx4bCViTpG+tVNnNTa5To8WwdB2UMAAw2Zon5/ALs1zbroWo0Y4X6velAf1fMDOyYxtTE8CTd9B3XbZaOa7TodvmY9vT4jvkIrjFmfqvz74xFhs1bO88CeoLNJpRweGiaO6s0RMyD5SJu+O73drb1VV6tOo9aXe3UGdR4CQ54G9w7T69Pt06SzDDx8Hqf1kXqv+rVsSi2rSZ6bubRsjXZYAOrTBwatmpl3mvaI2tXLv/+bbsw9QFv16qXf50bdXd7OZbV7/XOnV6/3p9ml79Y1ZDzSwgXLPLmji9aluLFNAQ9oAxZdfaknii934lsv8XK2bcAjuF9Pr6/O5W/1a0BhTB523M/AWetlA3tmaFOmXUO5w1i2AQLY0+L3n6c4MEOlxchsfJZ6hhtxcSoAnriA7AlgABsJMGZOcfFHk+sMho1j6TdNfOzUi6rwNkXLqsFl2GDLMjmA36dexbYL3nzu+M2J8ZIFfPpBwZZCtilmwEVh+P79qDeifhpzKNl4Pvdv2mupHWSAAUPx+47wnrFx4b4NBocBs4uqJf0XpTady3fw3Mhy/nZW2/5EGHBYVRgb3IEpWqZ0BlsZA7aFW5fuMyencAAHhvuQ8ye+/fD/fvUw4/vvtso8oiDLYLhPX08oOgYl4u6xhubkBMIc/hqo+UQYYmWxr3MIq5CJN2mq5wDKOdew+XfldefSRoX6NZKV69dHAMXLeD/AddTuqU85SNTfH1s4fAR07k8ekrXJlWXqeDtMNhXYR0F5VQKOHGHxcnyJ79kMC/ousDIHp7Zm2CMaCsbK1psuubIKWlaZrZyzye1oO4cmYwCZty45t7eYTIB/AiMHWlV+U9yrjE3k/E/yv9chv6lqOrXQ2oyrr1lzZ8DyAuNQR28WDBhTqMAR7/7MEACWb5ubKeJ7VUxdW8haAAK7otSADZji39Rd2pUKxPyjO8HTp+AHDmFccMG5BLBsF7xYrOIWzjJtvVtw/sKHF/sLgL9vCYxs4YKHZh8Zm1U1nZqa/PTXBuwdMiLP7OLgrULXSAaBsYRs38GW/rtgyWyMlV9EMSMdAKtGqu7Td3BzPBgxAOrjqKZ0wj16DETYvrZc31VRqj24OoBzp4u7vpT7zvk4OqBEuT4seAG4DFeWbLQ+9ZJclv13AxI8+yvIA/qFKR+AwSIfCVAFYJdAoG99F0uAASJ+7Xi5EzjuZk6s0hOYTLCZqwIsl4NhOjk0QLgQkevcYqaLo5VxjzyzJ/ltOJTB8wgDqICNVX3/cUwBt5OcFdkG/4OAbDbok6v49AOAgnrQJKaTmMi5qmKxcLBaev4vkeePDFjAp+cUg2cm51YN1WMoN56HKE4rgx0vnz19+Fc/ub79ZLILKw5pa4UxHOSSqQE="},r$=[-72.26808525539167,43.37747275058169],n$=10.873762090608595,i$=0,o$=2,a$={composite:{url:"mapbox://mapbox.mapbox-terrain-v2,mapbox.mapbox-streets-v8,ruralinno.2pv0vm2z,ruralinno.3v9y79ly,ruralinno.5639ssfg,ruralinno.c504wkuy,ruralinno.7stpbs93,ruralinno.cwz2k5qc,ruralinno.1joudpqe",type:"vector"}},s$="mapbox://sprites/ruralinno/cl010e7b7001p15pe3l0306hv/68n9slz9mfbus83an19oqbf32",l$="mapbox://fonts/ruralinno/{fontstack}/{range}.pbf",c$=[{id:"land",type:"background",layout:{},paint:{"background-color":"hsl(55, 0%, 100%)"}},{id:"landcover",type:"fill",source:"composite","source-layer":"landcover",maxzoom:7,layout:{},paint:{"fill-color":"hsl(0, 0%, 100%)","fill-opacity":["interpolate",["exponential",1.5],["zoom"],2,.1,7,0],"fill-antialias":!1}},{id:"national-park",type:"fill",source:"composite","source-layer":"landuse_overlay",minzoom:5,filter:["==",["get","class"],"national_park"],layout:{},paint:{"fill-color":"hsla(150, 6%, 93%, 0.63)","fill-opacity":["interpolate",["linear"],["zoom"],5,0,6,.5]}},{id:"landuse",type:"fill",source:"composite","source-layer":"landuse",minzoom:5,filter:["match",["get","class"],["park","airport","glacier","pitch","sand"],!0,!1],layout:{},paint:{"fill-opacity":["interpolate",["linear"],["zoom"],5,0,6,["match",["get","class"],"glacier",.5,1]],"fill-color":"hsl(150, 0%, 100%)"}},{id:"water-shadow",type:"fill",source:"composite","source-layer":"water",layout:{},paint:{"fill-translate-anchor":"viewport","fill-translate":["interpolate",["exponential",1.2],["zoom"],7,["literal",[0,0]],16,["literal",[-1,-1]]],"fill-color":"hsl(185, 7%, 73%)"}},{id:"waterway",type:"line",source:"composite","source-layer":"waterway",minzoom:8,layout:{"line-cap":["step",["zoom"],"butt",11,"round"],"line-join":"round"},paint:{"line-color":"hsl(187, 9%, 81%)","line-width":["interpolate",["exponential",1.3],["zoom"],9,["match",["get","class"],["canal","river"],.1,0],20,["match",["get","class"],["canal","river"],8,3]],"line-opacity":["interpolate",["linear"],["zoom"],8,0,8.5,1]}},{id:"water",type:"fill",source:"composite","source-layer":"water",layout:{},paint:{"fill-color":"#cad2d3","fill-opacity":.5}},{id:"hillshade",type:"fill",source:"composite","source-layer":"hillshade",minzoom:6,layout:{},paint:{"fill-color":["match",["get","class"],"shadow","hsl(0, 0%, 35%)","hsl(0, 0%, 100%)"],"fill-opacity":["interpolate",["linear"],["zoom"],12,["match",["get","level"],[67,56],.02,[89,78],.01,.015],15,0]}},{id:"land-structure-polygon",type:"fill",source:"composite","source-layer":"structure",minzoom:21.1,filter:["all",["==",["geometry-type"],"Polygon"],["==",["get","class"],"land"]],layout:{},paint:{"fill-color":"hsl(156, 20%, 95%)"}},{id:"land-structure-line",type:"line",source:"composite","source-layer":"structure",minzoom:13,filter:["all",["==",["geometry-type"],"LineString"],["==",["get","class"],"land"]],layout:{"line-cap":"round"},paint:{"line-width":["interpolate",["exponential",1.99],["zoom"],14,.75,20,40],"line-color":"hsl(156, 20%, 95%)"}},{id:"aeroway-polygon",type:"fill",source:"composite","source-layer":"aeroway",minzoom:11,filter:["all",["==",["geometry-type"],"Polygon"],["match",["get","type"],["runway","taxiway","helipad"],!0,!1]],layout:{},paint:{"fill-opacity":["interpolate",["linear"],["zoom"],11,0,11.5,1],"fill-color":"hsl(0, 0%, 97%)"}},{id:"aeroway-line",type:"line",source:"composite","source-layer":"aeroway",minzoom:9,filter:["==",["geometry-type"],"LineString"],layout:{},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],9,["match",["get","type"],"runway",1,.5],18,["match",["get","type"],"runway",80,20]],"line-color":"hsl(0, 0%, 97%)"}},{id:"building-outline",type:"line",source:"composite","source-layer":"building",minzoom:15,filter:["all",["!=",["get","type"],"building:part"],["==",["get","underground"],"false"]],layout:{},paint:{"line-color":"hsl(55, 3%, 87%)","line-width":["interpolate",["exponential",1.5],["zoom"],15,.75,20,3],"line-opacity":["interpolate",["linear"],["zoom"],15,0,16,1]}},{id:"building",type:"fill",source:"composite","source-layer":"building",minzoom:15,filter:["all",["!=",["get","type"],"building:part"],["==",["get","underground"],"false"]],layout:{},paint:{"fill-outline-color":"hsl(55, 3%, 87%)","fill-opacity":["interpolate",["linear"],["zoom"],15,0,16,1],"fill-color":"hsl(55, 5%, 91%)"}},{id:"tunnel-street-minor-low",type:"line",metadata:{"mapbox:group":"1444855769305.6016"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["==",["get","structure"],"tunnel"],["step",["zoom"],["match",["get","class"],["street","street_limited","track","primary_link"],!0,!1],14,["match",["get","class"],["street","street_limited","track","primary_link","secondary_link","tertiary_link","service"],!0,!1]],["==",["geometry-type"],"LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],12,.5,14,["match",["get","class"],["street","street_limited","primary_link"],2,"track",1,.5],18,["match",["get","class"],["street","street_limited","primary_link"],18,12]],"line-color":"hsl(185, 7%, 88%)","line-opacity":["step",["zoom"],1,14,0]}},{id:"tunnel-street-minor-case",type:"line",metadata:{"mapbox:group":"1444855769305.6016"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["==",["get","structure"],"tunnel"],["step",["zoom"],["match",["get","class"],["street","street_limited","track","primary_link"],!0,!1],14,["match",["get","class"],["street","street_limited","track","primary_link","secondary_link","tertiary_link","service"],!0,!1]],["==",["geometry-type"],"LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],12,.75,20,2],"line-color":"hsl(185, 12%, 89%)","line-gap-width":["interpolate",["exponential",1.5],["zoom"],12,.5,14,["match",["get","class"],["street","street_limited","primary_link"],2,"track",1,.5],18,["match",["get","class"],["street","street_limited","primary_link"],18,12]],"line-opacity":["step",["zoom"],0,14,1],"line-dasharray":[3,3]}},{id:"tunnel-primary-secondary-tertiary-case",type:"line",metadata:{"mapbox:group":"1444855769305.6016"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["==",["get","structure"],"tunnel"],["match",["get","class"],["primary","secondary","tertiary"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],10,["match",["get","class"],"primary",1,.75],18,2],"line-color":"hsl(185, 12%, 89%)","line-gap-width":["interpolate",["exponential",1.5],["zoom"],5,["match",["get","class"],"primary",.75,.1],18,["match",["get","class"],"primary",32,26]],"line-dasharray":[3,3]}},{id:"tunnel-major-link-case",type:"line",metadata:{"mapbox:group":"1444855769305.6016"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["==",["get","structure"],"tunnel"],["match",["get","class"],["motorway_link","trunk_link"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],12,.75,20,2],"line-color":"hsl(185, 12%, 89%)","line-gap-width":["interpolate",["exponential",1.5],["zoom"],12,.5,14,2,18,18],"line-dasharray":[3,3]}},{id:"tunnel-motorway-trunk-case",type:"line",metadata:{"mapbox:group":"1444855769305.6016"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["==",["get","structure"],"tunnel"],["match",["get","class"],["motorway","trunk"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],10,1,18,2],"line-color":"hsl(185, 12%, 89%)","line-gap-width":["interpolate",["exponential",1.5],["zoom"],5,.75,18,32],"line-dasharray":[3,3]}},{id:"tunnel-construction",type:"line",metadata:{"mapbox:group":"1444855769305.6016"},source:"composite","source-layer":"road",minzoom:14,filter:["all",["==",["get","structure"],"tunnel"],["==",["get","class"],"construction"],["==",["geometry-type"],"LineString"]],layout:{},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],14,2,18,18],"line-color":"hsl(187, 7%, 88%)","line-dasharray":["step",["zoom"],["literal",[.4,.8]],15,["literal",[.3,.6]],16,["literal",[.2,.3]],17,["literal",[.2,.25]],18,["literal",[.15,.15]]]}},{id:"tunnel-path",type:"line",metadata:{"mapbox:group":"1444855769305.6016"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["==",["get","structure"],"tunnel"],["==",["get","class"],"path"],["!=",["get","type"],"steps"],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],15,1,18,4],"line-dasharray":["step",["zoom"],["literal",[1,0]],15,["literal",[1.75,1]],16,["literal",[1,.75]],17,["literal",[1,.5]]],"line-color":"hsl(0, 0%, 85%)"}},{id:"tunnel-steps",type:"line",metadata:{"mapbox:group":"1444855769305.6016"},source:"composite","source-layer":"road",minzoom:14,filter:["all",["==",["get","structure"],"tunnel"],["==",["get","class"],"steps"],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],15,1,16,1.6,18,6],"line-color":"hsl(0, 0%, 85%)","line-dasharray":["step",["zoom"],["literal",[1,0]],15,["literal",[1.75,1]],16,["literal",[1,.75]],17,["literal",[.3,.3]]]}},{id:"tunnel-major-link",type:"line",metadata:{"mapbox:group":"1444855769305.6016"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["==",["get","structure"],"tunnel"],["match",["get","class"],["motorway_link","trunk_link"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],12,.5,14,2,18,18],"line-color":"hsl(187, 7%, 88%)"}},{id:"tunnel-pedestrian",type:"line",metadata:{"mapbox:group":"1444855769305.6016"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["==",["get","structure"],"tunnel"],["==",["get","class"],"pedestrian"],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],14,.5,18,12],"line-color":"hsl(187, 7%, 88%)","line-dasharray":["step",["zoom"],["literal",[1,0]],15,["literal",[1.5,.4]],16,["literal",[1,.2]]]}},{id:"tunnel-street-minor",type:"line",metadata:{"mapbox:group":"1444855769305.6016"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["==",["get","structure"],"tunnel"],["step",["zoom"],["match",["get","class"],["street","street_limited","track","primary_link"],!0,!1],14,["match",["get","class"],["street","street_limited","track","primary_link","secondary_link","tertiary_link","service"],!0,!1]],["==",["geometry-type"],"LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],12,.5,14,["match",["get","class"],["street","street_limited","primary_link"],2,"track",1,.5],18,["match",["get","class"],["street","street_limited","primary_link"],18,12]],"line-color":"hsl(187, 7%, 88%)","line-opacity":["step",["zoom"],0,14,1]}},{id:"tunnel-primary-secondary-tertiary",type:"line",metadata:{"mapbox:group":"1444855769305.6016"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["==",["get","structure"],"tunnel"],["match",["get","class"],["primary","secondary","tertiary"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],5,["match",["get","class"],"primary",.75,.1],18,["match",["get","class"],"primary",32,26]],"line-color":"hsl(187, 7%, 88%)"}},{id:"tunnel-motorway-trunk",type:"line",metadata:{"mapbox:group":"1444855769305.6016"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["==",["get","structure"],"tunnel"],["match",["get","class"],["motorway","trunk"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],5,.75,18,32],"line-color":"hsl(187, 7%, 88%)"}},{id:"road-pedestrian-case",type:"line",metadata:{"mapbox:group":"1444855786460.0557"},source:"composite","source-layer":"road",minzoom:12,filter:["all",["==",["get","class"],"pedestrian"],["match",["get","structure"],["none","ford"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],14,2,18,14.5],"line-color":"hsl(156, 12%, 92%)","line-opacity":["step",["zoom"],0,14,1]}},{id:"road-minor-low",type:"line",metadata:{"mapbox:group":"1444855786460.0557"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["step",["zoom"],["==",["get","class"],"track"],14,["match",["get","class"],["track","secondary_link","tertiary_link","service"],!0,!1]],["match",["get","structure"],["none","ford"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],14,["match",["get","class"],"track",1,.5],18,12],"line-color":"hsl(0, 0%, 100%)","line-opacity":["step",["zoom"],1,14,0]}},{id:"road-street-low",type:"line",metadata:{"mapbox:group":"1444855786460.0557"},source:"composite","source-layer":"road",minzoom:11,filter:["all",["match",["get","class"],["street","street_limited","primary_link"],!0,!1],["match",["get","structure"],["none","ford"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],12,.5,14,2,18,18],"line-color":"hsl(0, 0%, 100%)","line-opacity":["step",["zoom"],1,14,0]}},{id:"road-minor-case",type:"line",metadata:{"mapbox:group":"1444855786460.0557"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["step",["zoom"],["==",["get","class"],"track"],14,["match",["get","class"],["track","secondary_link","tertiary_link","service"],!0,!1]],["match",["get","structure"],["none","ford"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],12,.75,20,2],"line-color":"hsl(156, 12%, 92%)","line-gap-width":["interpolate",["exponential",1.5],["zoom"],14,["match",["get","class"],"track",1,.5],18,12],"line-opacity":["step",["zoom"],0,14,1]}},{id:"road-street-case",type:"line",metadata:{"mapbox:group":"1444855786460.0557"},source:"composite","source-layer":"road",minzoom:11,filter:["all",["match",["get","class"],["street","street_limited","primary_link"],!0,!1],["match",["get","structure"],["none","ford"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],12,.75,20,2],"line-color":"hsl(156, 12%, 92%)","line-gap-width":["interpolate",["exponential",1.5],["zoom"],12,.5,14,2,18,18],"line-opacity":["step",["zoom"],0,14,1]}},{id:"road-secondary-tertiary-case",type:"line",metadata:{"mapbox:group":"1444855786460.0557"},source:"composite","source-layer":"road",minzoom:9.3,filter:["all",["match",["get","class"],["secondary","tertiary"],!0,!1],["match",["get","structure"],["none","ford"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],10,.75,18,2],"line-color":"hsl(156, 12%, 92%)","line-gap-width":["interpolate",["exponential",1.5],["zoom"],5,.1,18,26]}},{id:"road-primary-case",type:"line",metadata:{"mapbox:group":"1444855786460.0557"},source:"composite","source-layer":"road",minzoom:9.9,filter:["all",["==",["get","class"],"primary"],["match",["get","structure"],["none","ford"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],10,1,18,2],"line-color":"hsl(156, 12%, 92%)","line-gap-width":["interpolate",["exponential",1.5],["zoom"],5,.75,18,32]}},{id:"road-major-link-case",type:"line",metadata:{"mapbox:group":"1444855786460.0557"},source:"composite","source-layer":"road",minzoom:10,filter:["all",["match",["get","class"],["motorway_link","trunk_link"],!0,!1],["match",["get","structure"],["none","ford"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],12,.75,20,2],"line-color":"hsl(156, 12%, 92%)","line-gap-width":["interpolate",["exponential",1.5],["zoom"],12,.5,14,2,18,18],"line-opacity":["step",["zoom"],0,11,1]}},{id:"road-motorway-trunk-case",type:"line",metadata:{"mapbox:group":"1444855786460.0557"},source:"composite","source-layer":"road",minzoom:8.5,filter:["all",["match",["get","class"],["motorway","trunk"],!0,!1],["match",["get","structure"],["none","ford"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],10,1,18,2],"line-color":"hsl(156, 12%, 92%)","line-gap-width":["interpolate",["exponential",1.5],["zoom"],5,.75,18,32],"line-opacity":["step",["zoom"],["match",["get","class"],"motorway",1,0],6,1]}},{id:"road-construction",type:"line",metadata:{"mapbox:group":"1444855786460.0557"},source:"composite","source-layer":"road",minzoom:14,filter:["all",["==",["get","class"],"construction"],["match",["get","structure"],["none","ford"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],14,2,18,18],"line-color":"hsl(0, 0%, 100%)","line-dasharray":["step",["zoom"],["literal",[.4,.8]],15,["literal",[.3,.6]],16,["literal",[.2,.3]],17,["literal",[.2,.25]],18,["literal",[.15,.15]]]}},{id:"road-path",type:"line",metadata:{"mapbox:group":"1444855786460.0557"},source:"composite","source-layer":"road",minzoom:12,filter:["all",["==",["get","class"],"path"],["step",["zoom"],["!",["match",["get","type"],["steps","sidewalk","crossing"],!0,!1]],16,["!=",["get","type"],"steps"]],["match",["get","structure"],["none","ford"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],13,.5,14,1,15,1,18,4],"line-color":"hsl(0, 0%, 100%)","line-dasharray":["step",["zoom"],["literal",[1,0]],15,["literal",[1.75,1]],16,["literal",[1,.75]],17,["literal",[1,.5]]]}},{id:"road-steps",type:"line",metadata:{"mapbox:group":"1444855786460.0557"},source:"composite","source-layer":"road",minzoom:14,filter:["all",["==",["get","type"],"steps"],["match",["get","structure"],["none","ford"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],15,1,16,1.6,18,6],"line-color":"hsl(0, 0%, 100%)","line-dasharray":["step",["zoom"],["literal",[1,0]],15,["literal",[1.75,1]],16,["literal",[1,.75]],17,["literal",[.3,.3]]]}},{id:"road-major-link",type:"line",metadata:{"mapbox:group":"1444855786460.0557"},source:"composite","source-layer":"road",minzoom:10,filter:["all",["match",["get","class"],["motorway_link","trunk_link"],!0,!1],["match",["get","structure"],["none","ford"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],12,.5,14,2,18,18],"line-color":"hsl(0, 0%, 100%)"}},{id:"road-pedestrian",type:"line",metadata:{"mapbox:group":"1444855786460.0557"},source:"composite","source-layer":"road",minzoom:12,filter:["all",["==",["get","class"],"pedestrian"],["match",["get","structure"],["none","ford"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],14,.5,18,12],"line-color":"hsl(0, 0%, 100%)","line-dasharray":["step",["zoom"],["literal",[1,0]],15,["literal",[1.5,.4]],16,["literal",[1,.2]]]}},{id:"road-minor",type:"line",metadata:{"mapbox:group":"1444855786460.0557"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["step",["zoom"],["==",["get","class"],"track"],14,["match",["get","class"],["track","secondary_link","tertiary_link","service"],!0,!1]],["match",["get","structure"],["none","ford"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],14,["match",["get","class"],"track",1,.5],18,12],"line-color":"hsl(0, 0%, 100%)","line-opacity":["step",["zoom"],0,14,1]}},{id:"road-street",type:"line",metadata:{"mapbox:group":"1444855786460.0557"},source:"composite","source-layer":"road",minzoom:11,filter:["all",["match",["get","class"],["street","street_limited","primary_link"],!0,!1],["match",["get","structure"],["none","ford"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],12,.5,14,2,18,18],"line-color":"hsl(0, 0%, 100%)","line-opacity":["step",["zoom"],0,14,1]}},{id:"road-secondary-tertiary",type:"line",metadata:{"mapbox:group":"1444855786460.0557"},source:"composite","source-layer":"road",filter:["all",["match",["get","class"],["secondary","tertiary"],!0,!1],["match",["get","structure"],["none","ford"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],5,.1,18,22],"line-color":"hsl(0, 0%, 100%)"}},{id:"road-primary",type:"line",metadata:{"mapbox:group":"1444855786460.0557"},source:"composite","source-layer":"road",minzoom:9,filter:["all",["==",["get","class"],"primary"],["match",["get","structure"],["none","ford"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round","line-cap":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],5,.75,18,32],"line-color":"#f6eac1","line-opacity":["interpolate",["linear"],["zoom"],6,0,8,["match",["get","class"],["trunk"],.2,0],16,["match",["get","class"],["trunk"],1,.81]]}},{id:"road-motorway-trunk",type:"line",metadata:{"mapbox:group":"1444855786460.0557"},source:"composite","source-layer":"road",minzoom:8,filter:["all",["match",["get","class"],["motorway","trunk"],!0,!1],["match",["get","structure"],["none","ford"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],5,.5,18,32],"line-color":["match",["get","class"],["motorway"],"hsl(26, 100%, 68%)","#f2d163"],"line-opacity":["interpolate",["linear"],["zoom"],6,["match",["get","class"],["trunk"],.3,0],8,.4,18,.7]}},{id:"road-rail",type:"line",metadata:{"mapbox:group":"1444855786460.0557"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["match",["get","class"],["major_rail","minor_rail"],!0,!1],["match",["get","structure"],["none","ford"],!0,!1]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],14,.5,20,1],"line-color":"hsl(156, 12%, 92%)"}},{id:"bridge-pedestrian-case",type:"line",metadata:{"mapbox:group":"1444855799204.86"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["==",["get","structure"],"bridge"],["==",["get","class"],"pedestrian"],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],14,2,18,14.5],"line-opacity":["step",["zoom"],0,14,1],"line-color":"hsl(156, 12%, 92%)"}},{id:"bridge-street-minor-low",type:"line",metadata:{"mapbox:group":"1444855799204.86"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["==",["get","structure"],"bridge"],["step",["zoom"],["match",["get","class"],["street","street_limited","track","primary_link"],!0,!1],14,["match",["get","class"],["street","street_limited","track","primary_link","secondary_link","tertiary_link","service"],!0,!1]],["==",["geometry-type"],"LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],12,.5,14,["match",["get","class"],["street","street_limited","primary_link"],2,"track",1,.5],18,["match",["get","class"],["street","street_limited","primary_link"],18,12]],"line-color":"hsl(0, 0%, 100%)","line-opacity":["step",["zoom"],1,14,0]}},{id:"bridge-street-minor-case",type:"line",metadata:{"mapbox:group":"1444855799204.86"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["==",["get","structure"],"bridge"],["step",["zoom"],["match",["get","class"],["street","street_limited","track","primary_link"],!0,!1],14,["match",["get","class"],["street","street_limited","track","primary_link","secondary_link","tertiary_link","service"],!0,!1]],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],12,.75,20,2],"line-opacity":["step",["zoom"],0,14,1],"line-gap-width":["interpolate",["exponential",1.5],["zoom"],12,.5,14,["match",["get","class"],["street","street_limited","primary_link"],2,"track",1,.5],18,["match",["get","class"],["street","street_limited","primary_link"],18,12]],"line-color":"hsl(156, 12%, 92%)"}},{id:"bridge-primary-secondary-tertiary-case",type:"line",metadata:{"mapbox:group":"1444855799204.86"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["==",["get","structure"],"bridge"],["match",["get","class"],["primary","secondary","tertiary"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],10,["match",["get","class"],"primary",1,.75],18,2],"line-opacity":["step",["zoom"],0,10,1],"line-gap-width":["interpolate",["exponential",1.5],["zoom"],5,["match",["get","class"],"primary",.75,.1],18,["match",["get","class"],"primary",32,26]],"line-color":"hsl(156, 12%, 92%)"}},{id:"bridge-major-link-case",type:"line",metadata:{"mapbox:group":"1444855799204.86"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["==",["get","structure"],"bridge"],["match",["get","class"],["motorway_link","trunk_link"],!0,!1],["<=",["get","layer"],1],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],12,.75,20,2],"line-gap-width":["interpolate",["exponential",1.5],["zoom"],12,.5,14,2,18,18],"line-color":"hsl(156, 12%, 92%)"}},{id:"bridge-motorway-trunk-case",type:"line",metadata:{"mapbox:group":"1444855799204.86"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["==",["get","structure"],"bridge"],["match",["get","class"],["motorway","trunk"],!0,!1],["<=",["get","layer"],1],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],10,1,18,2],"line-gap-width":["interpolate",["exponential",1.5],["zoom"],5,.75,18,32],"line-color":"hsl(156, 12%, 92%)"}},{id:"bridge-construction",type:"line",metadata:{"mapbox:group":"1444855799204.86"},source:"composite","source-layer":"road",minzoom:14,filter:["all",["==",["get","structure"],"bridge"],["==",["get","class"],"construction"],["==",["geometry-type"],"LineString"]],layout:{},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],14,2,18,18],"line-dasharray":["step",["zoom"],["literal",[.4,.8]],15,["literal",[.3,.6]],16,["literal",[.2,.3]],17,["literal",[.2,.25]],18,["literal",[.15,.15]]],"line-color":"hsl(156, 0%, 100%)"}},{id:"bridge-path",type:"line",metadata:{"mapbox:group":"1444855799204.86"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["==",["get","structure"],"bridge"],["==",["get","class"],"path"],["!=",["get","type"],"steps"],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],15,1,18,4],"line-color":"hsl(0, 0%, 100%)","line-dasharray":["step",["zoom"],["literal",[1,0]],15,["literal",[1.75,1]],16,["literal",[1,.75]],17,["literal",[1,.5]]]}},{id:"bridge-steps",type:"line",metadata:{"mapbox:group":"1444855799204.86"},source:"composite","source-layer":"road",minzoom:14,filter:["all",["==",["get","type"],"steps"],["==",["get","structure"],"bridge"],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],15,1,16,1.6,18,6],"line-color":"hsl(0, 0%, 100%)","line-dasharray":["step",["zoom"],["literal",[1,0]],15,["literal",[1.75,1]],16,["literal",[1,.75]],17,["literal",[.3,.3]]]}},{id:"bridge-major-link",type:"line",metadata:{"mapbox:group":"1444855799204.86"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["==",["get","structure"],"bridge"],["match",["get","class"],["motorway_link","trunk_link"],!0,!1],["<=",["get","layer"],1],["==",["geometry-type"],"LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],12,.5,14,2,18,18],"line-color":"hsl(0, 0%, 100%)"}},{id:"bridge-pedestrian",type:"line",metadata:{"mapbox:group":"1444855799204.86"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["==",["get","structure"],"bridge"],["==",["get","class"],"pedestrian"],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],14,.5,18,12],"line-color":"hsl(0, 0%, 100%)","line-dasharray":["step",["zoom"],["literal",[1,0]],15,["literal",[1.5,.4]],16,["literal",[1,.2]]]}},{id:"bridge-street-minor",type:"line",metadata:{"mapbox:group":"1444855799204.86"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["==",["get","structure"],"bridge"],["step",["zoom"],["match",["get","class"],["street","street_limited","track","primary_link"],!0,!1],14,["match",["get","class"],["street","street_limited","track","primary_link","secondary_link","tertiary_link","service"],!0,!1]],["==",["geometry-type"],"LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],12,.5,14,["match",["get","class"],["street","street_limited","primary_link"],2,"track",1,.5],18,["match",["get","class"],["street","street_limited","primary_link"],18,12]],"line-color":"hsl(0, 0%, 100%)","line-opacity":["step",["zoom"],0,14,1]}},{id:"bridge-primary-secondary-tertiary",type:"line",metadata:{"mapbox:group":"1444855799204.86"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["==",["get","structure"],"bridge"],["match",["get","class"],["primary","secondary","tertiary"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],5,["match",["get","class"],"primary",.75,.1],18,["match",["get","class"],"primary",32,26]],"line-color":"hsl(0, 0%, 100%)"}},{id:"bridge-motorway-trunk",type:"line",metadata:{"mapbox:group":"1444855799204.86"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["==",["get","structure"],"bridge"],["match",["get","class"],["motorway","trunk"],!0,!1],["<=",["get","layer"],1],["==",["geometry-type"],"LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],5,.75,18,32],"line-color":"hsl(0, 0%, 100%)"}},{id:"bridge-rail",type:"line",metadata:{"mapbox:group":"1444855799204.86"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["==",["get","structure"],"bridge"],["match",["get","class"],["major_rail","minor_rail"],!0,!1]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],14,.5,20,1],"line-color":"hsl(156, 12%, 92%)"}},{id:"bridge-major-link-2-case",type:"line",metadata:{"mapbox:group":"1444855799204.86"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["==",["get","structure"],"bridge"],[">=",["get","layer"],2],["match",["get","class"],["motorway_link","trunk_link"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],12,.75,20,2],"line-color":"hsl(156, 12%, 92%)","line-gap-width":["interpolate",["exponential",1.5],["zoom"],12,.5,14,2,18,18]}},{id:"bridge-motorway-trunk-2-case",type:"line",metadata:{"mapbox:group":"1444855799204.86"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["==",["get","structure"],"bridge"],[">=",["get","layer"],2],["match",["get","class"],["motorway","trunk"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],10,1,18,2],"line-color":"hsl(156, 12%, 92%)","line-gap-width":["interpolate",["exponential",1.5],["zoom"],5,.75,18,32]}},{id:"bridge-major-link-2",type:"line",metadata:{"mapbox:group":"1444855799204.86"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["==",["get","structure"],"bridge"],[">=",["get","layer"],2],["match",["get","class"],["motorway_link","trunk_link"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],12,.5,14,2,18,18],"line-color":"hsl(0, 0%, 100%)"}},{id:"bridge-motorway-trunk-2",type:"line",metadata:{"mapbox:group":"1444855799204.86"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["==",["get","structure"],"bridge"],[">=",["get","layer"],2],["match",["get","class"],["motorway","trunk"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],5,.75,18,32],"line-color":"hsl(0, 0%, 100%)"}},{id:"admin-1-boundary-bg",type:"line",metadata:{"mapbox:group":"1444934295202.7542"},source:"composite","source-layer":"admin",filter:["all",["==",["get","admin_level"],1],["==",["get","maritime"],"false"],["match",["get","worldview"],["all","US"],!0,!1]],layout:{"line-join":"bevel"},paint:{"line-blur":["interpolate",["linear"],["zoom"],3,0,8,3],"line-width":["interpolate",["linear"],["zoom"],7,3.75,12,5.5],"line-opacity":["interpolate",["linear"],["zoom"],7,0,8,.75],"line-dasharray":[1,0],"line-translate":[0,0],"line-color":"hsl(0, 0%, 84%)"}},{id:"admin-0-boundary-bg",type:"line",metadata:{"mapbox:group":"1444934295202.7542"},source:"composite","source-layer":"admin",minzoom:1,filter:["all",["==",["get","admin_level"],0],["==",["get","maritime"],"false"],["match",["get","worldview"],["all","US"],!0,!1]],paint:{"line-width":["interpolate",["linear"],["zoom"],3,3.5,10,8],"line-color":"hsl(0, 0%, 84%)","line-opacity":["interpolate",["linear"],["zoom"],3,0,4,.5],"line-translate":[0,0],"line-blur":["interpolate",["linear"],["zoom"],3,0,10,2]}},{id:"admin-1-boundary",type:"line",metadata:{"mapbox:group":"1444934295202.7542"},source:"composite","source-layer":"admin",filter:["all",["==",["get","admin_level"],1],["==",["get","maritime"],"false"],["match",["get","worldview"],["all","US"],!0,!1]],layout:{"line-join":"round","line-cap":"round"},paint:{"line-width":["interpolate",["linear"],["zoom"],7,.75,12,1.5],"line-opacity":["interpolate",["linear"],["zoom"],2,0,3,1],"line-color":["interpolate",["linear"],["zoom"],3,"hsl(0, 0%, 80%)",7,"hsl(0, 0%, 70%)"]}},{id:"admin-0-boundary",type:"line",metadata:{"mapbox:group":"1444934295202.7542"},source:"composite","source-layer":"admin",minzoom:1,filter:["all",["==",["get","admin_level"],0],["==",["get","disputed"],"false"],["==",["get","maritime"],"false"],["match",["get","worldview"],["all","US"],!0,!1]],layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":"hsl(0, 0%, 62%)","line-width":["interpolate",["linear"],["zoom"],3,.5,10,2]}},{id:"admin-0-boundary-disputed",type:"line",metadata:{"mapbox:group":"1444934295202.7542"},source:"composite","source-layer":"admin",minzoom:1,filter:["all",["==",["get","disputed"],"true"],["==",["get","admin_level"],0],["==",["get","maritime"],"false"],["match",["get","worldview"],["all","US"],!0,!1]],layout:{"line-join":"round"},paint:{"line-dasharray":[1.5,1.5],"line-color":"hsl(0, 0%, 62%)","line-width":["interpolate",["linear"],["zoom"],3,.5,10,2]}},{id:"county_border",type:"line",metadata:{"mapbox:group":"1444934295202.7542"},source:"composite","source-layer":"attr_county_labels_pg-155yvu",minzoom:6,maxzoom:12,paint:{"line-width":["interpolate",["linear"],["zoom"],5,.5,9,1.7,18,2],"line-color":"hsl(0, 0%, 59%)","line-opacity":["interpolate",["linear"],["zoom"],5,.2,9,.5,18,1]}},{id:"cousub_border",type:"line",source:"composite","source-layer":"attr_cousub_labels_less_pl-9lemol",minzoom:8,maxzoom:14,layout:{},paint:{"line-color":"hsl(0, 3%, 38%)","line-width":["interpolate",["linear"],["zoom"],0,1,6,1,22,1],"line-opacity":["interpolate",["linear"],["zoom"],7,.1,18,.2]}},{id:"place_border",type:"line",source:"composite","source-layer":"attr_place_labels_less_pl-0n1bxr",minzoom:8,maxzoom:14,paint:{"line-color":"hsla(0, 0%, 58%, 0.62)","line-dasharray":[3,2]}},{id:"road-label",type:"symbol",source:"composite","source-layer":"road",minzoom:10,filter:["step",["zoom"],["match",["get","class"],["motorway","trunk","primary","secondary","tertiary"],!0,!1],12,["match",["get","class"],["motorway","trunk","primary","secondary","tertiary","pedestrian","street","street_limited"],!0,!1],15,["match",["get","class"],["ferry","golf","path"],!1,!0]],layout:{"text-size":["interpolate",["linear"],["zoom"],10,["match",["get","class"],["motorway","trunk","primary","secondary","tertiary"],10,["motorway_link","trunk_link","primary_link","secondary_link","tertiary_link","pedestrian","street","street_limited"],9,6.5],18,["match",["get","class"],["motorway","trunk","primary","secondary","tertiary"],16,["motorway_link","trunk_link","primary_link","secondary_link","tertiary_link","pedestrian","street","street_limited"],14,13]],"text-max-angle":30,"text-font":["DIN Offc Pro Regular","Arial Unicode MS Regular"],"symbol-placement":"line","text-padding":1,"text-rotation-alignment":"map","text-pitch-alignment":"viewport","text-field":["coalesce",["get","name_en"],["get","name"]],"text-letter-spacing":.01},paint:{"text-color":"hsl(0, 0%, 42%)","text-halo-color":["match",["get","class"],["motorway","trunk"],"hsla(0, 0%, 100%, 0.75)","hsl(0, 0%, 100%)"],"text-halo-blur":1,"text-halo-width":.1}},{id:"waterway-label",type:"symbol",source:"composite","source-layer":"natural_label",minzoom:13,filter:["all",["match",["get","class"],["canal","river","stream"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"text-font":["DIN Offc Pro Italic","Arial Unicode MS Regular"],"text-max-angle":30,"symbol-spacing":["interpolate",["linear",1],["zoom"],15,250,17,400],"text-size":["interpolate",["linear"],["zoom"],13,12,18,16],"symbol-placement":"line","text-pitch-alignment":"viewport","text-field":["coalesce",["get","name_en"],["get","name"]]},paint:{"text-color":"hsl(187, 7%, 51%)"}},{id:"natural-line-label",type:"symbol",source:"composite","source-layer":"natural_label",minzoom:4,filter:["all",["match",["get","class"],["glacier","landform"],!0,!1],["==",["geometry-type"],"LineString"],["<=",["get","filterrank"],1]],layout:{"text-size":["step",["zoom"],["step",["get","sizerank"],18,5,12],17,["step",["get","sizerank"],18,13,12]],"text-max-angle":30,"text-field":["coalesce",["get","name_en"],["get","name"]],"text-font":["DIN Offc Pro Medium","Arial Unicode MS Regular"],"symbol-placement":"line-center","text-pitch-alignment":"viewport"},paint:{"text-halo-width":.5,"text-halo-color":"hsl(0, 0%, 100%)","text-halo-blur":.5,"text-color":"hsl(0, 0%, 42%)"}},{id:"natural-point-label",type:"symbol",source:"composite","source-layer":"natural_label",minzoom:4,filter:["all",["match",["get","class"],["dock","glacier","landform","water_feature","wetland"],!0,!1],["==",["geometry-type"],"Point"],["<=",["get","filterrank"],1]],layout:{"text-size":["step",["zoom"],["step",["get","sizerank"],18,5,12],17,["step",["get","sizerank"],18,13,12]],"text-field":["coalesce",["get","name_en"],["get","name"]],"text-font":["DIN Offc Pro Medium","Arial Unicode MS Regular"],"text-offset":["literal",[0,0]]},paint:{"text-color":"hsl(0, 0%, 42%)","text-halo-color":"hsl(0, 0%, 100%)","text-halo-width":.5,"text-halo-blur":.5}},{id:"water-line-label",type:"symbol",source:"composite","source-layer":"natural_label",filter:["all",["match",["get","class"],["bay","ocean","reservoir","sea","water"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"text-size":["interpolate",["linear"],["zoom"],7,["step",["get","sizerank"],24,6,18,12,12],10,["step",["get","sizerank"],18,9,12],18,["step",["get","sizerank"],18,9,16]],"text-max-angle":30,"text-letter-spacing":["match",["get","class"],"ocean",.25,["sea","bay"],.15,0],"text-font":["DIN Offc Pro Italic","Arial Unicode MS Regular"],"symbol-placement":"line-center","text-pitch-alignment":"viewport","text-field":["coalesce",["get","name_en"],["get","name"]]},paint:{"text-color":"hsl(187, 7%, 51%)"}},{id:"water-point-label",type:"symbol",source:"composite","source-layer":"natural_label",filter:["all",["match",["get","class"],["bay","ocean","reservoir","sea","water"],!0,!1],["==",["geometry-type"],"Point"]],layout:{"text-line-height":1.3,"text-size":["interpolate",["linear"],["zoom"],7,["step",["get","sizerank"],24,6,18,12,12],10,["step",["get","sizerank"],18,9,12]],"text-font":["DIN Offc Pro Italic","Arial Unicode MS Regular"],"text-field":["coalesce",["get","name_en"],["get","name"]],"text-letter-spacing":["match",["get","class"],"ocean",.25,["bay","sea"],.15,.01],"text-max-width":["match",["get","class"],"ocean",4,"sea",5,["bay","water"],7,10]},paint:{"text-color":"hsl(187, 7%, 51%)"}},{id:"poi-label",type:"symbol",source:"composite","source-layer":"poi_label",minzoom:6,filter:["<=",["get","filterrank"],1],layout:{"text-size":["step",["zoom"],["step",["get","sizerank"],18,5,12],17,["step",["get","sizerank"],18,13,12]],"text-font":["DIN Offc Pro Medium","Arial Unicode MS Regular"],"text-field":["coalesce",["get","name_en"],["get","name"]]},paint:{"text-halo-color":"hsl(0, 0%, 100%)","text-halo-width":.1,"text-halo-blur":.5,"text-color":["step",["zoom"],["step",["get","sizerank"],"hsl(0, 0%, 66%)",5,"hsl(230, 0%, 56%)"],17,["step",["get","sizerank"],"hsl(0, 0%, 66%)",13,"hsl(0, 0%, 56%)"]]}},{id:"airport-label",type:"symbol",source:"composite","source-layer":"airport_label",minzoom:8,layout:{"text-line-height":1.1,"text-size":["step",["get","sizerank"],18,9,12],"icon-image":["step",["get","sizerank"],["concat",["get","maki"],"-15"],9,["concat",["get","maki"],"-11"]],"text-font":["DIN Offc Pro Medium","Arial Unicode MS Regular"],visibility:"none","text-offset":[0,.75],"text-rotation-alignment":"viewport","text-anchor":"top","text-field":["step",["get","sizerank"],["coalesce",["get","name_en"],["get","name"]],15,["get","ref"]],"text-letter-spacing":.01,"text-max-width":9},paint:{"text-color":"hsla(0, 0%, 42%, 0)","text-halo-color":"hsl(0, 0%, 100%)","text-halo-width":1,"text-opacity":0}},{id:"settlement-subdivision-label",type:"symbol",source:"composite","source-layer":"place_label",minzoom:10,maxzoom:15,filter:["all",["==",["get","class"],"settlement_subdivision"],["<=",["get","filterrank"],4]],layout:{"text-field":["coalesce",["get","name_en"],["get","name"]],"text-transform":"uppercase","text-font":["DIN Offc Pro Regular","Arial Unicode MS Regular"],"text-letter-spacing":["match",["get","type"],"suburb",.15,.1],"text-max-width":7,"text-padding":3,"text-size":["interpolate",["cubic-bezier",.5,0,1,1],["zoom"],11,["match",["get","type"],"suburb",11,10.5],15,["match",["get","type"],"suburb",17,16]],visibility:"none"},paint:{"text-halo-color":"hsl(0, 0%, 100%)","text-color":"hsl(0, 0%, 62%)","text-halo-blur":.5,"text-halo-width":.1}},{id:"state-label",type:"symbol",source:"composite","source-layer":"place_label",minzoom:3,maxzoom:9,filter:["==",["get","class"],"state"],layout:{"text-size":["interpolate",["cubic-bezier",.85,.7,.65,1],["zoom"],4,["step",["get","symbolrank"],10,6,9.5,7,9],9,["step",["get","symbolrank"],24,6,18,7,14]],"text-transform":"uppercase","text-font":["DIN Offc Pro Bold","Arial Unicode MS Bold"],"text-field":["step",["zoom"],["step",["get","symbolrank"],["coalesce",["get","name_en"],["get","name"]],5,["coalesce",["get","abbr"],["get","name_en"],["get","name"]]],5,["coalesce",["get","name_en"],["get","name"]]],"text-letter-spacing":.15,"text-max-width":6},paint:{"text-halo-color":"hsl(0, 0%, 100%)","text-color":"hsl(0, 0%, 66%)","text-halo-width":.1}},{id:"county_label",type:"symbol",source:"composite","source-layer":"attr_county_labels-5i5o0f",minzoom:7.5,maxzoom:14,layout:{"text-field":["step",["zoom"],["upcase",["to-string",["get","name"]]],6,["upcase",["to-string",["get","name"]]],10,["upcase",["to-string",["get","namelsad"]]],22,["upcase",["to-string",["get","namelsad"]]]],"text-font":["step",["zoom"],["literal",["Open Sans Regular","Arial Unicode MS Regular"]],6,["literal",["Montserrat Medium","Arial Unicode MS Regular"]],8,["literal",["Montserrat Medium","Arial Unicode MS Regular"]],11,["literal",["Montserrat Medium","Arial Unicode MS Regular"]],22,["literal",["Montserrat Medium","Arial Unicode MS Regular"]]],"text-size":["interpolate",["linear"],["zoom"],0,0,6,6,6.5,10,7.5,14,9,30,11,75,14,85],"text-allow-overlap":["step",["zoom"],!1,5,!1,10,!1,11,!0],"text-max-width":5,"text-ignore-placement":["step",["zoom"],!1,6,!1,9,!0,12,!0,22,!0]},paint:{"text-color":"hsl(0, 0%, 48%)","text-opacity":["interpolate",["linear"],["zoom"],6.49999,1,6.5,.7,8,.3,11,.1,16,.05]}},{id:"cousub_label",type:"symbol",source:"composite","source-layer":"attr_cousub_labels_plus_pt-0kx5lj",minzoom:9,layout:{"text-field":["upcase",["get","display_name"]],"text-size":["interpolate",["linear"],["zoom"],7.9,0,8,8,9,10,14,30],"text-max-width":5,"text-line-height":1.1,visibility:"none"},paint:{"text-color":"hsla(0, 0%, 31%, 0.76)","text-halo-width":10,"text-halo-color":"hsl(0, 0%, 100%)"}},{id:"place-label new",type:"symbol",source:"composite","source-layer":"rural_places-4rf4i9",minzoom:9,filter:["match",["get","census_boundary_year"],[2020],!0,!1],layout:{"text-line-height":1.1,"text-size":["interpolate",["cubic-bezier",.2,0,.9,1],["zoom"],3,["step",["get","symbolrank"],12,9,11,10,10.5,12,9.5,14,8.5,16,6.5,17,4],15,["step",["get","symbolrank"],28,9,26,10,23,11,21,12,20,13,19,15,17]],"icon-image":["case",["==",["get","capital"],2],"border-dot-13",["step",["get","symbolrank"],"dot-11",9,"dot-10",11,"dot-9"]],"text-font":["Montserrat Medium","Arial Unicode MS Regular"],"text-justify":["step",["zoom"],["match",["get","text_anchor"],["left","bottom-left","top-left"],"left",["right","bottom-right","top-right"],"right","center"],8,"center"],visibility:"none","text-offset":["step",["zoom"],["match",["get","capital"],2,["match",["get","text_anchor"],"bottom",["literal",[0,-.3]],"bottom-left",["literal",[.3,-.1]],"left",["literal",[.45,.1]],"top-left",["literal",[.3,.1]],"top",["literal",[0,.3]],"top-right",["literal",[-.3,.1]],"right",["literal",[-.45,0]],"bottom-right",["literal",[-.3,-.1]],["literal",[0,-.3]]],["match",["get","text_anchor"],"bottom",["literal",[0,-.25]],"bottom-left",["literal",[.2,-.05]],"left",["literal",[.4,.05]],"top-left",["literal",[.2,.05]],"top",["literal",[0,.25]],"top-right",["literal",[-.2,.05]],"right",["literal",[-.4,.05]],"bottom-right",["literal",[-.2,-.05]],["literal",[0,-.25]]]],8,["literal",[0,0]]],"text-anchor":["step",["zoom"],["get","text_anchor"],8,"center"],"text-field":["coalesce",["get","NAME"]],"text-max-width":7},paint:{"text-color":["step",["get","symbolrank"],"hsl(0, 2%, 61%)",11,"hsl(0, 1%, 68%)",16,"hsl(0, 1%, 75%)"],"text-halo-color":"hsl(0, 0%, 100%)","icon-opacity":["step",["zoom"],1,8,0],"text-halo-blur":1,"text-halo-width":.1}},{id:"settlement-label",type:"symbol",source:"composite","source-layer":"place_label",maxzoom:10.76,filter:["all",["<=",["get","filterrank"],3],["==",["get","class"],"settlement"],["step",["zoom"],!0,12,[">=",["get","symbolrank"],11],13,[">=",["get","symbolrank"],12]]],layout:{"text-line-height":1.1,"text-size":["interpolate",["cubic-bezier",.2,0,.9,1],["zoom"],3,["step",["get","symbolrank"],12,9,11,10,10.5,12,9.5,14,8.5,16,6.5,17,4],15,["step",["get","symbolrank"],28,9,26,10,23,11,21,12,20,13,19,15,17]],"icon-image":["case",["==",["get","capital"],2],"border-dot-13",["step",["get","symbolrank"],"dot-11",9,"dot-10",11,"dot-9"]],"text-font":["step",["zoom"],["literal",["DIN Offc Pro Regular","Arial Unicode MS Regular"]],8,["step",["get","symbolrank"],["literal",["DIN Offc Pro Medium","Arial Unicode MS Regular"]],11,["literal",["DIN Offc Pro Regular","Arial Unicode MS Regular"]]],10,["step",["get","symbolrank"],["literal",["DIN Offc Pro Medium","Arial Unicode MS Regular"]],12,["literal",["DIN Offc Pro Regular","Arial Unicode MS Regular"]]],11,["step",["get","symbolrank"],["literal",["DIN Offc Pro Medium","Arial Unicode MS Regular"]],13,["literal",["DIN Offc Pro Regular","Arial Unicode MS Regular"]]],12,["step",["get","symbolrank"],["literal",["DIN Offc Pro Medium","Arial Unicode MS Regular"]],15,["literal",["DIN Offc Pro Regular","Arial Unicode MS Regular"]]],13,["literal",["DIN Offc Pro Medium","Arial Unicode MS Regular"]]],"text-justify":["step",["zoom"],["match",["get","text_anchor"],["left","bottom-left","top-left"],"left",["right","bottom-right","top-right"],"right","center"],8,"center"],"text-offset":["step",["zoom"],["match",["get","capital"],2,["match",["get","text_anchor"],"bottom",["literal",[0,-.3]],"bottom-left",["literal",[.3,-.1]],"left",["literal",[.45,.1]],"top-left",["literal",[.3,.1]],"top",["literal",[0,.3]],"top-right",["literal",[-.3,.1]],"right",["literal",[-.45,0]],"bottom-right",["literal",[-.3,-.1]],["literal",[0,-.3]]],["match",["get","text_anchor"],"bottom",["literal",[0,-.25]],"bottom-left",["literal",[.2,-.05]],"left",["literal",[.4,.05]],"top-left",["literal",[.2,.05]],"top",["literal",[0,.25]],"top-right",["literal",[-.2,.05]],"right",["literal",[-.4,.05]],"bottom-right",["literal",[-.2,-.05]],["literal",[0,-.25]]]],8,["literal",[0,0]]],"text-anchor":["step",["zoom"],["get","text_anchor"],8,"center"],"text-field":["coalesce",["get","name_en"],["get","name"]],"text-max-width":7},paint:{"text-color":["step",["get","symbolrank"],"hsl(0, 0%, 42%)",11,"hsl(0, 0%, 55%)",16,"hsl(0, 0%, 62%)"],"text-halo-color":"hsl(0, 0%, 100%)","icon-opacity":["step",["zoom"],1,8,0],"text-halo-blur":1,"text-halo-width":.1}},{id:"wwb2s-places_lat_lon",type:"symbol",source:"composite","source-layer":"places_lat_lon-awryh9",minzoom:10.75,maxzoom:20,filter:["all",[">=",["get","pop"],101],[">",["get","pct_rural"],0],["step",["zoom"],!0,13,[">=",["get","symbolrank"],11],14,[">=",["get","symbolrank"],13]]],layout:{"text-line-height":1.1,"text-size":["step",["get","symbolrank"],20,9,18,10,16,11,14,12,12],"icon-image":["case",["==",["get","capital"],2],"border-dot-13",["step",["get","symbolrank"],"dot-11",9,"dot-10",11,"dot-9"]],"text-font":["step",["zoom"],["literal",["DIN Offc Pro Regular","Arial Unicode MS Regular"]],8,["step",["get","symbolrank"],["literal",["DIN Offc Pro Medium","Arial Unicode MS Regular"]],11,["literal",["DIN Offc Pro Regular","Arial Unicode MS Regular"]]],10,["step",["get","symbolrank"],["literal",["DIN Offc Pro Medium","Arial Unicode MS Regular"]],12,["literal",["DIN Offc Pro Regular","Arial Unicode MS Regular"]]],11,["step",["get","symbolrank"],["literal",["DIN Offc Pro Medium","Arial Unicode MS Regular"]],13,["literal",["DIN Offc Pro Regular","Arial Unicode MS Regular"]]],12,["step",["get","symbolrank"],["literal",["DIN Offc Pro Medium","Arial Unicode MS Regular"]],15,["literal",["DIN Offc Pro Regular","Arial Unicode MS Regular"]]],13,["literal",["DIN Offc Pro Medium","Arial Unicode MS Regular"]]],"text-justify":["step",["zoom"],["match",["get","text_anchor"],["left","bottom-left","top-left"],"left",["right","bottom-right","top-right"],"right","center"],8,"center"],"text-offset":["step",["zoom"],["match",["get","capital"],2,["match",["get","text_anchor"],"bottom",["literal",[0,-.3]],"bottom-left",["literal",[.3,-.1]],"left",["literal",[.45,.1]],"top-left",["literal",[.3,.1]],"top",["literal",[0,.3]],"top-right",["literal",[-.3,.1]],"right",["literal",[-.45,0]],"bottom-right",["literal",[-.3,-.1]],["literal",[0,-.3]]],["match",["get","text_anchor"],"bottom",["literal",[0,-.25]],"bottom-left",["literal",[.2,-.05]],"left",["literal",[.4,.05]],"top-left",["literal",[.2,.05]],"top",["literal",[0,.25]],"top-right",["literal",[-.2,.05]],"right",["literal",[-.4,.05]],"bottom-right",["literal",[-.2,-.05]],["literal",[0,-.25]]]],8,["literal",[0,0]]],"text-anchor":["step",["zoom"],["get","text_anchor"],8,"center"],"text-field":["coalesce",["get","NAME"],["get","name"]],"text-max-width":7},paint:{"text-halo-color":"hsl(0, 0%, 100%)","icon-opacity":["step",["zoom"],1,8,0],"text-halo-blur":1,"text-halo-width":.1,"text-color":["interpolate",["linear"],["zoom"],0,"hsl(0, 0%, 62%)",22,"#000000"],"text-opacity":["interpolate",["linear"],["zoom"],7,0,9,.97,22,1]}},{id:"custom-pattern",type:"fill",source:"composite","source-layer":"attr_county_labels_pg-155yvu",minzoom:6,layout:{visibility:"none"},paint:{"fill-color":"hsla(303, 73%, 74%, 0.66)","fill-pattern":"stripe-4"}}],u$="2022-02-24T13:16:14.872Z",h$="2024-07-11T16:18:50.102Z",d$="cl010e7b7001p15pe3l0306hv",p$="ruralinno",f$="private",m$=!1,g$={version:J9,name:e$,metadata:t$,center:r$,zoom:n$,bearing:i$,pitch:o$,sources:a$,sprite:s$,glyphs:l$,layers:c$,created:u$,modified:h$,id:d$,owner:p$,visibility:f$,protected:!1,draft:m$};/* + * Frontend UI component library for the CORI Data API + * {@link https://github.com/ruralinnovation/cori.data.api} + * @copyright Rural Innovation Strategies, Inc. + * @license ISC + */Object.assign({},g$);var I3={exports:{}};(function(t,e){(function(n,a){t.exports=a()})($e,function(){var n,a,u;function d(l,w){if(!n)n=w;else if(!a)a=w;else{var T="self.onerror = function() { console.error('An error occurred while parsing the WebWorker bundle. This is most likely due to improper transpilation by Babel; please see https://docs.mapbox.com/mapbox-gl-js/guides/install/#transpiling'); }; var sharedChunk = {}; ("+n+")(sharedChunk); ("+a+")(sharedChunk); self.onerror = null;",C={};n(C),u=w(C),typeof window<"u"&&window&&window.URL&&window.URL.createObjectURL&&(u.workerUrl=window.URL.createObjectURL(new Blob([T],{type:"text/javascript"})))}}d(["exports"],function(l){var w=typeof self<"u"?self:{},T="2.15.0";let C;const P={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){if(C==null){const i=/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i;try{C={}.API_URL_REGEX!=null?new RegExp({}.API_URL_REGEX):i}catch{C=i}}return C},get API_TILEJSON_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/v[0-9]*\/.*\.json.*$)/i},get API_SPRITE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*\/sprite.*\..*$)/i},get API_FONTS_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/fonts\/v[0-9]*\/)(.*\.pbf.*$)/i},get API_STYLE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*$)/i},get API_CDN_URL_REGEX(){return/^((https?:)?\/\/)?api\.mapbox\.c(n|om)(\/mapbox-gl-js\/)(.*$)/i},get EVENTS_URL(){if(!P.API_URL)return null;try{const i=new URL(P.API_URL);return i.hostname==="api.mapbox.cn"?"https://events.mapbox.cn/events/v2":i.hostname==="api.mapbox.com"?"https://events.mapbox.com/events/v2":null}catch{return null}},SESSION_PATH:"/map-sessions/v1",FEEDBACK_URL:"https://apps.mapbox.com/feedback",TILE_URL_VERSION:"v4",RASTER_URL_PREFIX:"raster/v1",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,MAX_PARALLEL_IMAGE_REQUESTS:16},z={supported:!1,testSupport:function(i){!j&&U&&(L?V(i):W=i)}};let W,U,j=!1,L=!1;function V(i){const r=i.createTexture();i.bindTexture(i.TEXTURE_2D,r);try{if(i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,U),i.isContextLost())return;z.supported=!0}catch{}i.deleteTexture(r),j=!0}w.document&&(U=w.document.createElement("img"),U.onload=function(){W&&V(W),W=null,L=!0},U.onerror=function(){j=!0,W=null},U.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const R="01";function F(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var H=Q;function Q(i,r,o,c){this.cx=3*i,this.bx=3*(o-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*r,this.by=3*(c-r)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=r,this.p2x=o,this.p2y=c}Q.prototype={sampleCurveX:function(i){return((this.ax*i+this.bx)*i+this.cx)*i},sampleCurveY:function(i){return((this.ay*i+this.by)*i+this.cy)*i},sampleCurveDerivativeX:function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},solveCurveX:function(i,r){if(r===void 0&&(r=1e-6),i<0)return 0;if(i>1)return 1;for(var o=i,c=0;c<8;c++){var p=this.sampleCurveX(o)-i;if(Math.abs(p)p?y=o:x=o,o=.5*(x-y)+y;return o},solve:function(i,r){return this.sampleCurveY(this.solveCurveX(i,r))}};var te=F(H),se=ge;function ge(i,r){this.x=i,this.y=r}ge.prototype={clone:function(){return new ge(this.x,this.y)},add:function(i){return this.clone()._add(i)},sub:function(i){return this.clone()._sub(i)},multByPoint:function(i){return this.clone()._multByPoint(i)},divByPoint:function(i){return this.clone()._divByPoint(i)},mult:function(i){return this.clone()._mult(i)},div:function(i){return this.clone()._div(i)},rotate:function(i){return this.clone()._rotate(i)},rotateAround:function(i,r){return this.clone()._rotateAround(i,r)},matMult:function(i){return this.clone()._matMult(i)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(i){return this.x===i.x&&this.y===i.y},dist:function(i){return Math.sqrt(this.distSqr(i))},distSqr:function(i){var r=i.x-this.x,o=i.y-this.y;return r*r+o*o},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(i){return Math.atan2(this.y-i.y,this.x-i.x)},angleWith:function(i){return this.angleWithSep(i.x,i.y)},angleWithSep:function(i,r){return Math.atan2(this.x*r-this.y*i,this.x*i+this.y*r)},_matMult:function(i){var r=i[2]*this.x+i[3]*this.y;return this.x=i[0]*this.x+i[1]*this.y,this.y=r,this},_add:function(i){return this.x+=i.x,this.y+=i.y,this},_sub:function(i){return this.x-=i.x,this.y-=i.y,this},_mult:function(i){return this.x*=i,this.y*=i,this},_div:function(i){return this.x/=i,this.y/=i,this},_multByPoint:function(i){return this.x*=i.x,this.y*=i.y,this},_divByPoint:function(i){return this.x/=i.x,this.y/=i.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var i=this.y;return this.y=this.x,this.x=-i,this},_rotate:function(i){var r=Math.cos(i),o=Math.sin(i),c=o*this.x+r*this.y;return this.x=r*this.x-o*this.y,this.y=c,this},_rotateAround:function(i,r){var o=Math.cos(i),c=Math.sin(i),p=r.y+c*(this.x-r.x)+o*(this.y-r.y);return this.x=r.x+o*(this.x-r.x)-c*(this.y-r.y),this.y=p,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},ge.convert=function(i){return i instanceof ge?i:Array.isArray(i)?new ge(i[0],i[1]):i};var xe=F(se);const Ee=Math.PI/180,Be=180/Math.PI;function Fe(i){return i*Ee}function Ve(i){return i*Be}const kt=[[0,0],[1,0],[1,1],[0,1]];function Dt(i){if(i<=0)return 0;if(i>=1)return 1;const r=i*i,o=r*i;return 4*(i<.5?o:3*(i-r)+o-.75)}function Ut(i,r,o,c){const p=new te(i,r,o,c);return function(m){return p.solve(m)}}const cr=Ut(.25,.1,.25,1);function qe(i,r,o){return Math.min(o,Math.max(r,i))}function Tt(i,r,o){return(o=qe((o-i)/(r-i),0,1))*o*(3-2*o)}function gt(i,r,o){const c=o-r,p=((i-r)%c+c)%c+r;return p===r?o:p}function je(i,r,o){if(!i.length)return o(null,[]);let c=i.length;const p=new Array(i.length);let m=null;i.forEach((y,x)=>{r(y,(E,S)=>{E&&(m=E),p[x]=S,--c==0&&o(m,p)})})}function et(i){const r=[];for(const o in i)r.push(i[o]);return r}function nt(i,...r){for(const o of r)for(const c in o)i[c]=o[c];return i}let it=1;function ur(){return it++}function Xt(){return function i(r){return r?(r^Math.random()*(16>>r/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,i)}()}function Pr(i){return i<=1?1:Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function Yt(i){return!!i&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(i)}function si(i,r){i.forEach(o=>{r[o]&&(r[o]=r[o].bind(r))})}function mr(i,r){return i.indexOf(r,i.length-r.length)!==-1}function Vt(i,r,o){const c={};for(const p in i)c[p]=r.call(o||this,i[p],p,i);return c}function Ii(i,r,o){const c={};for(const p in i)r.call(o||this,i[p],p,i)&&(c[p]=i[p]);return c}function qr(i){return Array.isArray(i)?i.map(qr):typeof i=="object"&&i?Vt(i,qr):i}const pn={};function Tr(i){pn[i]||(typeof console<"u"&&console.warn(i),pn[i]=!0)}function Bn(i,r,o){return(o.y-i.y)*(r.x-i.x)>(r.y-i.y)*(o.x-i.x)}function ma(i){let r=0;for(let o,c,p=0,m=i.length,y=m-1;p@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(o,c,p,m)=>{const y=p||m;return r[c]=!y||y.toLowerCase(),""}),r["max-age"]){const o=parseInt(r["max-age"],10);isNaN(o)?delete r["max-age"]:r["max-age"]=o}return r}let bo=null;function Nn(i){if(bo==null){const r=i.navigator?i.navigator.userAgent:null;bo=!!i.safari||!(!r||!(/\b(iPad|iPhone|iPod)\b/.test(r)||r.match("Safari")&&!r.match("Chrome")))}return bo}function Un(i){try{const r=w[i];return r.setItem("_mapbox_test_",1),r.removeItem("_mapbox_test_"),!0}catch{return!1}}function Qn(i,r){return[i[4*r],i[4*r+1],i[4*r+2],i[4*r+3]]}const wo="mapbox-tiles";let Ps=500,Eo=50,jn,Wo;function Qa(){try{return w.caches}catch{}}function Go(){Qa()&&!jn&&(jn=w.caches.open(wo))}function Hi(i){const r=i.indexOf("?");if(r<0)return i;const o=function(p){const m=p.indexOf("?");return m>0?p.slice(m+1).split("&"):[]}(i),c=o.filter(p=>{const m=p.split("=");return m[0]==="language"||m[0]==="worldview"});return c.length?`${i.slice(0,r)}?${c.join("&")}`:i.slice(0,r)}let So=1/0;const ga={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};typeof Object.freeze=="function"&&Object.freeze(ga);class To extends Error{constructor(r,o,c){o===401&&Pe(c)&&(r+=": you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes"),super(r),this.status=o,this.url=c}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}const Ho=yi()?()=>self.worker&&self.worker.referrer:()=>(w.location.protocol==="blob:"?w.parent:w).location.href,ya=function(i,r){if(!(/^file:/.test(o=i.url)||/^file:/.test(Ho())&&!/^\w+:/.test(o))){if(w.fetch&&w.Request&&w.AbortController&&w.Request.prototype.hasOwnProperty("signal"))return function(c,p){const m=new w.AbortController,y=new w.Request(c.url,{method:c.method||"GET",body:c.body,credentials:c.credentials,headers:c.headers,referrer:Ho(),referrerPolicy:c.referrerPolicy,signal:m.signal});let x=!1,E=!1;const S=(k=y.url).indexOf("sku=")>0&&Pe(k);var k;c.type==="json"&&y.headers.set("Accept","application/json");const M=($,G,K)=>{if(E)return;if($&&$.message!=="SecurityError"&&Tr($.toString()),G&&K)return O(G);const ee=Date.now();w.fetch(y).then(le=>{if(le.ok){const me=S?le.clone():null;return O(le,me,ee)}return p(new To(le.statusText,le.status,c.url))}).catch(le=>{le.name!=="AbortError"&&p(new Error(`${le.message} ${c.url}`))})},O=($,G,K)=>{(c.type==="arrayBuffer"?$.arrayBuffer():c.type==="json"?$.json():$.text()).then(ee=>{E||(G&&K&&function(le,me,ce){if(Go(),!jn)return;const pe={status:me.status,statusText:me.statusText,headers:new w.Headers};me.headers.forEach((Oe,Me)=>pe.headers.set(Me,Oe));const _e=Yn(me.headers.get("Cache-Control")||"");if(_e["no-store"])return;_e["max-age"]&&pe.headers.set("Expires",new Date(ce+1e3*_e["max-age"]).toUTCString());const ye=pe.headers.get("Expires");ye&&(new Date(ye).getTime()-ce<42e4||function(Oe,Me){if(Wo===void 0)try{new Response(new ReadableStream),Wo=!0}catch{Wo=!1}Wo?Me(Oe.body):Oe.blob().then(Me)}(me,Oe=>{const Me=new w.Response(Oe,pe);Go(),jn&&jn.then(He=>He.put(Hi(le.url),Me)).catch(He=>Tr(He.message))}))}(y,G,K),x=!0,p(null,ee,$.headers.get("Cache-Control"),$.headers.get("Expires")))}).catch(ee=>{E||p(new Error(ee.message))})};return S?function($,G){if(Go(),!jn)return G(null);const K=Hi($.url);jn.then(ee=>{ee.match(K).then(le=>{const me=function(ce){if(!ce)return!1;const pe=new Date(ce.headers.get("Expires")||0),_e=Yn(ce.headers.get("Cache-Control")||"");return pe>Date.now()&&!_e["no-cache"]}(le);ee.delete(K),me&&ee.put(K,le.clone()),G(null,le,me)}).catch(G)}).catch(G)}(y,M):M(null,null),{cancel:()=>{E=!0,x||m.abort()}}}(i,r);if(yi()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,r,void 0,!0)}var o;return function(c,p){const m=new w.XMLHttpRequest;m.open(c.method||"GET",c.url,!0),c.type==="arrayBuffer"&&(m.responseType="arraybuffer");for(const y in c.headers)m.setRequestHeader(y,c.headers[y]);return c.type==="json"&&(m.responseType="text",m.setRequestHeader("Accept","application/json")),m.withCredentials=c.credentials==="include",m.onerror=()=>{p(new Error(m.statusText))},m.onload=()=>{if((m.status>=200&&m.status<300||m.status===0)&&m.response!==null){let y=m.response;if(c.type==="json")try{y=JSON.parse(m.response)}catch(x){return p(x)}p(null,y,m.getResponseHeader("Cache-Control"),m.getResponseHeader("Expires"))}else p(new To(m.statusText,m.status,c.url))},m.send(c.body),{cancel:()=>m.abort()}}(i,r)},Ja=function(i,r){return ya(nt(i,{type:"arrayBuffer"}),r)};function Ds(i){const r=w.document.createElement("a");return r.href=i,r.protocol===w.document.location.protocol&&r.host===w.document.location.host}const fe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let X,Y;X=[],Y=0;const de=function(i,r){if(z.supported&&(i.headers||(i.headers={}),i.headers.accept="image/webp,*/*"),Y>=P.MAX_PARALLEL_IMAGE_REQUESTS){const m={requestParameters:i,callback:r,cancelled:!1,cancel(){this.cancelled=!0}};return X.push(m),m}Y++;let o=!1;const c=()=>{if(!o)for(o=!0,Y--;X.length&&Y{c(),m?r(m):y&&(w.createImageBitmap?function(S,k){const M=new w.Blob([new Uint8Array(S)],{type:"image/png"});w.createImageBitmap(M).then(O=>{k(null,O)}).catch(O=>{k(new Error(`Could not load image because of ${O.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(y,(S,k)=>r(S,k,x,E)):function(S,k){const M=new w.Image,O=w.URL;M.onload=()=>{k(null,M),O.revokeObjectURL(M.src),M.onload=null,w.requestAnimationFrame(()=>{M.src=fe})},M.onerror=()=>k(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const $=new w.Blob([new Uint8Array(S)],{type:"image/png"});M.src=S.byteLength?O.createObjectURL($):fe}(y,(S,k)=>r(S,k,x,E)))});return{cancel:()=>{p.cancel(),c()}}},ve="NO_ACCESS_TOKEN";function Ae(i){return i.indexOf("mapbox:")===0}function Pe(i){return P.API_URL_REGEX.test(i)}function ke(i){return P.API_CDN_URL_REGEX.test(i)}function Te(i){return P.API_STYLE_REGEX.test(i)&&!Le(i)}function Le(i){return P.API_SPRITE_REGEX.test(i)}const dt=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function mt(i){const r=i.match(dt);if(!r)throw new Error("Unable to parse URL object");return{protocol:r[1],authority:r[2],path:r[3]||"/",params:r[4]?r[4].split("&"):[]}}function ct(i){const r=i.params.length?`?${i.params.join("&")}`:"";return`${i.protocol}://${i.authority}${i.path}${r}`}const Ft="mapbox.eventData";function jt(i){if(!i)return null;const r=i.split(".");if(!r||r.length!==3)return null;try{return JSON.parse(decodeURIComponent(w.atob(r[1]).split("").map(o=>"%"+("00"+o.charCodeAt(0).toString(16)).slice(-2)).join("")))}catch{return null}}class Wt{constructor(r){this.type=r,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(r){const o=jt(P.ACCESS_TOKEN);let c="";return c=o&&o.u?w.btoa(encodeURIComponent(o.u).replace(/%([0-9A-F]{2})/g,(p,m)=>String.fromCharCode(+("0x"+m)))):P.ACCESS_TOKEN||"",r?`${Ft}.${r}:${c}`:`${Ft}:${c}`}fetchEventData(){const r=Un("localStorage"),o=this.getStorageKey(),c=this.getStorageKey("uuid");if(r)try{const p=w.localStorage.getItem(o);p&&(this.eventData=JSON.parse(p));const m=w.localStorage.getItem(c);m&&(this.anonId=m)}catch{Tr("Unable to read from LocalStorage")}}saveEventData(){const r=Un("localStorage"),o=this.getStorageKey(),c=this.getStorageKey("uuid");if(r)try{w.localStorage.setItem(c,this.anonId),Object.keys(this.eventData).length>=1&&w.localStorage.setItem(o,JSON.stringify(this.eventData))}catch{Tr("Unable to write to LocalStorage")}}processRequests(r){}postEvent(r,o,c,p){if(!P.EVENTS_URL)return;const m=mt(P.EVENTS_URL);m.params.push(`access_token=${p||P.ACCESS_TOKEN||""}`);const y={event:this.type,created:new Date(r).toISOString()},x=o?nt(y,o):y,E={url:ct(m),headers:{"Content-Type":"text/plain"},body:JSON.stringify([x])};this.pendingRequest=function(S,k){return ya(nt(S,{method:"POST"}),k)}(E,S=>{this.pendingRequest=null,c(S),this.saveEventData(),this.processRequests(p)})}queueRequest(r,o){this.queue.push(r),this.processRequests(o)}}const Qt=new class extends Wt{constructor(i){super("appUserTurnstile"),this._customAccessToken=i}postTurnstileEvent(i,r){P.EVENTS_URL&&P.ACCESS_TOKEN&&Array.isArray(i)&&i.some(o=>Ae(o)||Pe(o))&&this.queueRequest(Date.now(),r)}processRequests(i){if(this.pendingRequest||this.queue.length===0)return;this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const r=jt(P.ACCESS_TOKEN),o=r?r.u:P.ACCESS_TOKEN;let c=o!==this.eventData.tokenU;Yt(this.anonId)||(this.anonId=Xt(),c=!0);const p=this.queue.shift();if(this.eventData.lastSuccess){const m=new Date(this.eventData.lastSuccess),y=new Date(p),x=(p-this.eventData.lastSuccess)/864e5;c=c||x>=1||x<-1||m.getDate()!==y.getDate()}else c=!0;c?this.postEvent(p,{sdkIdentifier:"mapbox-gl-js",sdkVersion:T,skuId:R,"enabled.telemetry":!1,userId:this.anonId},m=>{m||(this.eventData.lastSuccess=p,this.eventData.tokenU=o)},i):this.processRequests()}},or=Qt.postTurnstileEvent.bind(Qt),en=new class extends Wt{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(i,r,o,c){this.skuToken=r,this.errorCb=c,P.EVENTS_URL&&(o||P.ACCESS_TOKEN?this.queueRequest({id:i,timestamp:Date.now()},o):this.errorCb(new Error(ve)))}processRequests(i){if(this.pendingRequest||this.queue.length===0)return;const{id:r,timestamp:o}=this.queue.shift();r&&this.success[r]||(this.anonId||this.fetchEventData(),Yt(this.anonId)||(this.anonId=Xt()),this.postEvent(o,{sdkIdentifier:"mapbox-gl-js",sdkVersion:T,skuId:R,skuToken:this.skuToken,userId:this.anonId},c=>{c?this.errorCb(c):r&&(this.success[r]=!0)},i))}},yn=en.postMapLoadEvent.bind(en),li=new class extends Wt{constructor(){super("gljs.performance")}postPerformanceEvent(i,r){P.EVENTS_URL&&(i||P.ACCESS_TOKEN)&&this.queueRequest({timestamp:Date.now(),performanceData:r},i)}processRequests(i){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:r,performanceData:o}=this.queue.shift(),c=function(p){const m=w.performance.getEntriesByType("resource"),y=w.performance.getEntriesByType("mark"),x=function(O){const $={};if(O){for(const G in O)if(G!=="other")for(const K of O[G]){const ee=`${G}ResolveRangeMin`,le=`${G}ResolveRangeMax`,me=`${G}RequestCount`,ce=`${G}RequestCachedCount`;$[ee]=Math.min($[ee]||1/0,K.startTime),$[le]=Math.max($[le]||-1/0,K.responseEnd);const pe=_e=>{$[_e]===void 0&&($[_e]=0),++$[_e]};K.transferSize!==void 0&&K.transferSize===0&&pe(ce),pe(me)}}return $}(function(O,$){const G={};if(O)for(const K of O){const ee=$(K);G[ee]===void 0&&(G[ee]=[]),G[ee].push(K)}return G}(m,e0)),E=w.devicePixelRatio,S=w.navigator.connection||w.navigator.mozConnection||w.navigator.webkitConnection,k={counters:[],metadata:[],attributes:[]},M=(O,$,G)=>{G!=null&&O.push({name:$,value:G.toString()})};for(const O in x)M(k.counters,O,x[O]);if(p.interactionRange[0]!==1/0&&p.interactionRange[1]!==-1/0&&(M(k.counters,"interactionRangeMin",p.interactionRange[0]),M(k.counters,"interactionRangeMax",p.interactionRange[1])),y)for(const O of Object.keys(ml)){const $=ml[O],G=y.find(K=>K.name===$);G&&M(k.counters,$,G.startTime)}return M(k.counters,"visibilityHidden",p.visibilityHidden),M(k.attributes,"style",function(O){if(O)for(const $ of O){const G=$.name.split("?")[0];if(Te(G)){const K=G.split("/").slice(-2);if(K.length===2)return`mapbox://styles/${K[0]}/${K[1]}`}}}(m)),M(k.attributes,"terrainEnabled",p.terrainEnabled?"true":"false"),M(k.attributes,"fogEnabled",p.fogEnabled?"true":"false"),M(k.attributes,"projection",p.projection),M(k.attributes,"zoom",p.zoom),M(k.metadata,"devicePixelRatio",E),M(k.metadata,"connectionEffectiveType",S?S.effectiveType:void 0),M(k.metadata,"navigatorUserAgent",w.navigator.userAgent),M(k.metadata,"screenWidth",w.screen.width),M(k.metadata,"screenHeight",w.screen.height),M(k.metadata,"windowWidth",w.innerWidth),M(k.metadata,"windowHeight",w.innerHeight),M(k.metadata,"mapWidth",p.width/E),M(k.metadata,"mapHeight",p.height/E),M(k.metadata,"webglRenderer",p.renderer),M(k.metadata,"webglVendor",p.vendor),M(k.metadata,"sdkVersion",T),M(k.metadata,"sdkIdentifier","mapbox-gl-js"),k}(o);for(const p of c.metadata);for(const p of c.counters);for(const p of c.attributes);this.postEvent(r,c,()=>{},i)}},zn=li.postPerformanceEvent.bind(li),qo=new class extends Wt{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(i,r,o,c){if(!P.API_URL||!P.SESSION_PATH)return;const p=mt(P.API_URL+P.SESSION_PATH);p.params.push(`sku=${r||""}`),p.params.push(`access_token=${c||P.ACCESS_TOKEN||""}`);const m={url:ct(p),headers:{"Content-Type":"text/plain"}};this.pendingRequest=function(y,x){return ya(nt(y,{method:"GET"}),x)}(m,y=>{this.pendingRequest=null,o(y),this.saveEventData(),this.processRequests(c)})}getSessionAPI(i,r,o,c){this.skuToken=r,this.errorCb=c,P.SESSION_PATH&&P.API_URL&&(o||P.ACCESS_TOKEN?this.queueRequest({id:i,timestamp:Date.now()},o):this.errorCb(new Error(ve)))}processRequests(i){if(this.pendingRequest||this.queue.length===0)return;const{id:r,timestamp:o}=this.queue.shift();r&&this.success[r]||this.getSession(o,this.skuToken,c=>{c?this.errorCb(c):r&&(this.success[r]=!0)},i)}},Vn=qo.getSessionAPI.bind(qo),_i=new Set,ml={create:"create",load:"load",fullLoad:"fullLoad"},Zv={mark(i){w.performance.mark(i)},measure(i,r,o){w.performance.measure(i,r,o)}};function e0(i){const r=i.name.split("?")[0];return ke(r)&&r.includes("mapbox-gl.js")?"javascript":ke(r)&&r.includes("mapbox-gl.css")?"css":function(o){return P.API_FONTS_REGEX.test(o)}(r)?"fontRange":Le(r)?"sprite":Te(r)?"style":function(o){return P.API_TILEJSON_REGEX.test(o)}(r)?"tilejson":"other"}const br=w.performance;function qd(i){const r=i?i.url.toString():void 0;return br.getEntriesByName(r)}let Ic,Zd,$u,Zo;const _a={now:()=>$u!==void 0?$u:w.performance.now(),setNow(i){$u=i},restoreNow(){$u=void 0},frame(i){const r=w.requestAnimationFrame(i);return{cancel:()=>w.cancelAnimationFrame(r)}},getImageData(i,r=0){const{width:o,height:c}=i;Zo||(Zo=w.document.createElement("canvas"));const p=Zo.getContext("2d",{willReadFrequently:!0});if(!p)throw new Error("failed to create canvas 2d context");return(o>Zo.width||c>Zo.height)&&(Zo.width=o,Zo.height=c),p.clearRect(-r,-r,o+2*r,c+2*r),p.drawImage(i,0,0,o,c),p.getImageData(-r,-r,o+2*r,c+2*r)},resolveURL:i=>(Ic||(Ic=w.document.createElement("a")),Ic.href=i,Ic.href),get devicePixelRatio(){return w.devicePixelRatio},get prefersReducedMotion(){return!!w.matchMedia&&(Zd==null&&(Zd=w.matchMedia("(prefers-reduced-motion: reduce)")),Zd.matches)}};function Kd(i,r,o){o[i]&&o[i].indexOf(r)!==-1||(o[i]=o[i]||[],o[i].push(r))}function Xd(i,r,o){if(o&&o[i]){const c=o[i].indexOf(r);c!==-1&&o[i].splice(c,1)}}class Ms{constructor(r,o={}){nt(this,o),this.type=r}}class va extends Ms{constructor(r,o={}){super("error",nt({error:r},o))}}class Cc{on(r,o){return this._listeners=this._listeners||{},Kd(r,o,this._listeners),this}off(r,o){return Xd(r,o,this._listeners),Xd(r,o,this._oneTimeListeners),this}once(r,o){return o?(this._oneTimeListeners=this._oneTimeListeners||{},Kd(r,o,this._oneTimeListeners),this):new Promise(c=>this.once(r,c))}fire(r,o){typeof r=="string"&&(r=new Ms(r,o||{}));const c=r.type;if(this.listens(c)){r.target=this;const p=this._listeners&&this._listeners[c]?this._listeners[c].slice():[];for(const x of p)x.call(this,r);const m=this._oneTimeListeners&&this._oneTimeListeners[c]?this._oneTimeListeners[c].slice():[];for(const x of m)Xd(c,x,this._oneTimeListeners),x.call(this,r);const y=this._eventedParent;y&&(nt(r,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),y.fire(r))}else r instanceof va&&console.error(r.error);return this}listens(r){return!!(this._listeners&&this._listeners[r]&&this._listeners[r].length>0||this._oneTimeListeners&&this._oneTimeListeners[r]&&this._oneTimeListeners[r].length>0||this._eventedParent&&this._eventedParent.listens(r))}setEventedParent(r,o){return this._eventedParent=r,this._eventedParentData=o,this}}var Ge=JSON.parse('{"$version":8,"$root":{"version":{"required":true,"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"},"terrain":{"type":"terrain"},"fog":{"type":"fog"},"sources":{"required":true,"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string"},"transition":{"type":"transition"},"projection":{"type":"projection"},"layers":{"required":true,"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":true,"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":false},"*":{"type":"*"}},"source_raster":{"type":{"required":true,"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":false},"*":{"type":"*"}},"source_raster_dem":{"type":{"required":true,"type":"enum","values":{"raster-dem":{}}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512,"units":"pixels"},"attribution":{"type":"string"},"encoding":{"type":"enum","values":{"terrarium":{},"mapbox":{}},"default":"mapbox"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_geojson":{"type":{"required":true,"type":"enum","values":{"geojson":{}}},"data":{"type":"*"},"maxzoom":{"type":"number","default":18},"attribution":{"type":"string"},"buffer":{"type":"number","default":128,"maximum":512,"minimum":0},"filter":{"type":"*"},"tolerance":{"type":"number","default":0.375},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":50,"minimum":0},"clusterMaxZoom":{"type":"number"},"clusterMinPoints":{"type":"number"},"clusterProperties":{"type":"*"},"lineMetrics":{"type":"boolean","default":false},"generateId":{"type":"boolean","default":false},"promoteId":{"type":"promoteId"}},"source_video":{"type":{"required":true,"type":"enum","values":{"video":{}}},"urls":{"required":true,"type":"array","value":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"required":true,"type":"enum","values":{"image":{}}},"url":{"required":true,"type":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"layer":{"id":{"type":"string","required":true},"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"raster":{},"hillshade":{},"background":{},"sky":{}},"required":true},"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_sky"],"layout_background":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_sky":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_fill":{"fill-sort-key":{"type":"number","expression":{"interpolated":false,"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":false,"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"},"fill-extrusion-edge-radius":{"type":"number","private":true,"default":0,"minimum":0,"maximum":1,"property-type":"constant"}},"layout_line":{"line-cap":{"type":"enum","values":{"butt":{},"round":{},"square":{}},"default":"butt","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-join":{"type":"enum","values":{"bevel":{},"round":{},"miter":{}},"default":"miter","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"requires":[{"line-join":"miter"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-round-limit":{"type":"number","default":1.05,"requires":[{"line-join":"round"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-sort-key":{"type":"number","expression":{"interpolated":false,"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":false,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-spacing":{"type":"number","default":250,"minimum":1,"units":"pixels","requires":[{"symbol-placement":"line"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","values":{"auto":{},"viewport-y":{},"source":{}},"default":"auto","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{"type":"boolean","default":false,"requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{"type":"boolean","default":false,"requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-optional":{"type":"boolean","default":false,"requires":["icon-image","text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["icon-image"],"expression":{"interpolated":false,"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":true,"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":false,"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":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-image":{"type":"resolvedImage","tokens":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{"type":"number","default":0,"period":360,"units":"degrees","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{"type":"number","default":2,"minimum":0,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-keep-upright":{"type":"boolean","default":false,"requires":["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"requires":["icon-image"],"expression":{"interpolated":true,"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":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-field":{"type":"formatted","default":"","tokens":true,"expression":{"interpolated":false,"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":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{"type":"number","default":10,"minimum":0,"units":"ems","requires":["text-field",{"symbol-placement":["point"]}],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"units":"ems","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"units":"ems","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-justify":{"type":"enum","values":{"auto":{},"left":{},"center":{},"right":{}},"default":"center","requires":["text-field"],"expression":{"interpolated":false,"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":true,"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":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-anchor":{"type":"enum","values":{"center":{},"left":{},"right":{},"top":{},"bottom":{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},"default":"center","requires":["text-field",{"!":"text-variable-anchor"}],"expression":{"interpolated":false,"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":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":{},"vertical":{}},"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-rotate":{"type":"number","default":0,"period":360,"units":"degrees","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-padding":{"type":"number","default":2,"minimum":0,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-keep-upright":{"type":"boolean","default":true,"requires":["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-transform":{"type":"enum","values":{"none":{},"uppercase":{},"lowercase":{}},"default":"none","requires":["text-field"],"expression":{"interpolated":false,"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":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{"type":"boolean","default":false,"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{"type":"boolean","default":false,"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-optional":{"type":"boolean","default":false,"requires":["text-field","icon-image"],"expression":{"interpolated":false,"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_symbol":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature","pitch","distance-from-center"]}},"filter_fill":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_line":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_circle":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_fill-extrusion":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_heatmap":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_operator":{"type":"enum","values":{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},"in":{},"!in":{},"all":{},"any":{},"none":{},"has":{},"!has":{},"within":{}}},"geometry_type":{"type":"enum","values":{"Point":{},"LineString":{},"Polygon":{}}},"function":{"expression":{"type":"expression"},"stops":{"type":"array","value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"type":{"type":"enum","values":{"identity":{},"exponential":{},"interval":{},"categorical":{}},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":{},"lab":{},"hcl":{}},"default":"rgb"},"default":{"type":"*","required":false}},"function_stop":{"type":"array","minimum":0,"maximum":24,"value":["number","color"],"length":2},"expression":{"type":"array","value":"*","minimum":1},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"high-color":{"type":"color","property-type":"data-constant","default":"#245cdf","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"space-color":{"type":"color","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"horizon-blend":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"star-intensity":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":{},"viewport":{}},"property-type":"data-constant","transition":false,"expression":{"interpolated":false,"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":{},"equalEarth":{},"equirectangular":{},"lambertConformalConic":{},"mercator":{},"naturalEarth":{},"winkelTripel":{},"globe":{}},"default":"mercator","required":true},"center":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-180,-90],"maximum":[180,90],"transition":false,"requires":[{"name":["albers","lambertConformalConic"]}]},"parallels":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-90,-90],"maximum":[90,90],"transition":false,"requires":[{"name":["albers","lambertConformalConic"]}]}},"terrain":{"source":{"type":"string","required":true},"exaggeration":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true,"requires":["source"]}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background","paint_sky"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"fill-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","transition":true,"requires":[{"!":"fill-pattern"},{"fill-antialias":true}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["fill-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-pattern":{"type":"resolvedImage","transition":false,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"fill-extrusion-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["fill-extrusion-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{"type":"resolvedImage","transition":false,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"units":"meters","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"units":"meters","transition":true,"requires":["fill-extrusion-height"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-ambient-occlusion-intensity":{"property-type":"data-constant","type":"number","private":true,"default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-radius":{"property-type":"data-constant","type":"number","private":true,"default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true,"requires":["fill-extrusion-edge-radius"]},"fill-extrusion-rounded-roof":{"type":"boolean","default":true,"requires":["fill-extrusion-edge-radius"],"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"line-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["line-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"transition":false,"units":"line widths","requires":[{"!":"line-pattern"}],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern":{"type":"resolvedImage","transition":false,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-gradient":{"type":"color","transition":false,"requires":[{"!":"line-pattern"},{"source":"geojson","has":{"lineMetrics":true}}],"expression":{"interpolated":true,"parameters":["line-progress"]},"property-type":"color-ramp"},"line-trim-offset":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"transition":false,"requires":[{"source":"geojson","has":{"lineMetrics":true}}],"property-type":"constant"}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["circle-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{}},"default":"viewport","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"transition":false,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"heatmap-color":{"type":"color","default":["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],"transition":false,"expression":{"interpolated":true,"parameters":["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{"type":"color","default":"#000000","transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["icon-image","icon-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{"type":"color","default":"#000000","transition":true,"overridable":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["text-field","text-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"units":"degrees","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-resampling":{"type":"enum","values":{"linear":{},"nearest":{}},"default":"linear","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"transition":false,"units":"milliseconds","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"transition":false,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"viewport","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_background":{"background-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"background-pattern"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"background-pattern":{"type":"resolvedImage","transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":{},"atmosphere":{}},"default":"atmosphere","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"units":"degrees","minimum":[0,0],"maximum":[360,180],"transition":false,"requires":[{"sky-type":"atmosphere"}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun-intensity":{"type":"number","requires":[{"sky-type":"atmosphere"}],"default":10,"minimum":0,"maximum":100,"transition":false,"property-type":"data-constant"},"sky-gradient-center":{"type":"array","requires":[{"sky-type":"gradient"}],"value":"number","default":[0,0],"length":2,"units":"degrees","minimum":[0,0],"maximum":[360,180],"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient-radius":{"type":"number","requires":[{"sky-type":"gradient"}],"default":90,"minimum":0,"maximum":180,"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"transition":false,"requires":[{"sky-type":"gradient"}],"expression":{"interpolated":true,"parameters":["sky-radial-progress"]},"property-type":"color-ramp"},"sky-atmosphere-halo-color":{"type":"color","default":"white","transition":false,"requires":[{"sky-type":"atmosphere"}],"property-type":"data-constant"},"sky-atmosphere-color":{"type":"color","default":"white","transition":false,"requires":[{"sky-type":"atmosphere"}],"property-type":"data-constant"},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"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"},"color-ramp":{"type":"property-type"},"data-constant":{"type":"property-type"},"constant":{"type":"property-type"}},"promoteId":{"*":{"type":"string"}}}');function xa(i,...r){for(const o of r)for(const c in o)i[c]=o[c];return i}function _n(i){return i instanceof Number||i instanceof String||i instanceof Boolean?i.valueOf():i}function $n(i){if(Array.isArray(i))return i.map($n);if(i instanceof Object&&!(i instanceof Number||i instanceof String||i instanceof Boolean)){const r={};for(const o in i)r[o]=$n(i[o]);return r}return _n(i)}class t0 extends Error{constructor(r,o){super(o),this.message=o,this.key=r}}var Ko=t0;class Yd{constructor(r,o=[]){this.parent=r,this.bindings={};for(const[c,p]of o)this.bindings[c]=p}concat(r){return new Yd(this,r)}get(r){if(this.bindings[r])return this.bindings[r];if(this.parent)return this.parent.get(r);throw new Error(`${r} not found in scope.`)}has(r){return!!this.bindings[r]||!!this.parent&&this.parent.has(r)}}var r0=Yd;const gl={kind:"null"},bt={kind:"number"},ir={kind:"string"},tr={kind:"boolean"},qi={kind:"color"},Ao={kind:"object"},rr={kind:"value"},Zi={kind:"collator"},kc={kind:"formatted"},zs={kind:"resolvedImage"};function ro(i,r){return{kind:"array",itemType:i,N:r}}function Xr(i){if(i.kind==="array"){const r=Xr(i.itemType);return typeof i.N=="number"?`array<${r}, ${i.N}>`:i.itemType.kind==="value"?"array":`array<${r}>`}return i.kind}const n0=[gl,bt,ir,tr,qi,kc,Ao,ro(rr),zs];function ba(i,r){if(r.kind==="error")return null;if(i.kind==="array"){if(r.kind==="array"&&(r.N===0&&r.itemType.kind==="value"||!ba(i.itemType,r.itemType))&&(typeof i.N!="number"||i.N===r.N))return null}else{if(i.kind===r.kind)return null;if(i.kind==="value"){for(const o of n0)if(!ba(o,r))return null}}return`Expected ${Xr(i)} but found ${Xr(r)} instead.`}function Pc(i,r){return r.some(o=>o.kind===i.kind)}function Dc(i,r){return r.some(o=>o==="null"?i===null:o==="array"?Array.isArray(i):o==="object"?i&&!Array.isArray(i)&&typeof i=="object":o===typeof i)}var Qd,i0={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function Mc(i){return(i=Math.round(i))<0?0:i>255?255:i}function zc(i){return Mc(i[i.length-1]==="%"?parseFloat(i)/100*255:parseInt(i))}function Wu(i){return(r=i[i.length-1]==="%"?parseFloat(i)/100:parseFloat(i))<0?0:r>1?1:r;var r}function yl(i,r,o){return o<0?o+=1:o>1&&(o-=1),6*o<1?i+(r-i)*o*6:2*o<1?r:3*o<2?i+(r-i)*(2/3-o)*6:i}try{Qd={}.parseCSSColor=function(i){var r,o=i.replace(/ /g,"").toLowerCase();if(o in i0)return i0[o].slice();if(o[0]==="#")return o.length===4?(r=parseInt(o.substr(1),16))>=0&&r<=4095?[(3840&r)>>4|(3840&r)>>8,240&r|(240&r)>>4,15&r|(15&r)<<4,1]:null:o.length===7&&(r=parseInt(o.substr(1),16))>=0&&r<=16777215?[(16711680&r)>>16,(65280&r)>>8,255&r,1]:null;var c=o.indexOf("("),p=o.indexOf(")");if(c!==-1&&p+1===o.length){var m=o.substr(0,c),y=o.substr(c+1,p-(c+1)).split(","),x=1;switch(m){case"rgba":if(y.length!==4)return null;x=Wu(y.pop());case"rgb":return y.length!==3?null:[zc(y[0]),zc(y[1]),zc(y[2]),x];case"hsla":if(y.length!==4)return null;x=Wu(y.pop());case"hsl":if(y.length!==3)return null;var E=(parseFloat(y[0])%360+360)%360/360,S=Wu(y[1]),k=Wu(y[2]),M=k<=.5?k*(S+1):k+S-k*S,O=2*k-M;return[Mc(255*yl(O,M,E+1/3)),Mc(255*yl(O,M,E)),Mc(255*yl(O,M,E-1/3)),x];default:return null}}return null}}catch{}class Ci{constructor(r,o,c,p=1){this.r=r,this.g=o,this.b=c,this.a=p}static parse(r){if(!r)return;if(r instanceof Ci)return r;if(typeof r!="string")return;const o=Qd(r);return o?new Ci(o[0]/255*o[3],o[1]/255*o[3],o[2]/255*o[3],o[3]):void 0}toString(){const[r,o,c,p]=this.toArray();return`rgba(${Math.round(r)},${Math.round(o)},${Math.round(c)},${p})`}toArray(){const{r,g:o,b:c,a:p}=this;return p===0?[0,0,0,0]:[255*r/p,255*o/p,255*c/p,p]}toArray01(){const{r,g:o,b:c,a:p}=this;return p===0?[0,0,0,0]:[r/p,o/p,c/p,p]}toArray01PremultipliedAlpha(){const{r,g:o,b:c,a:p}=this;return[r,o,c,p]}}Ci.black=new Ci(0,0,0,1),Ci.white=new Ci(1,1,1,1),Ci.transparent=new Ci(0,0,0,0),Ci.red=new Ci(1,0,0,1),Ci.blue=new Ci(0,0,1,1);var fn=Ci;class Jd{constructor(r,o,c){this.sensitivity=r?o?"variant":"case":o?"accent":"base",this.locale=c,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(r,o){return this.collator.compare(r,o)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class ep{constructor(r,o,c,p,m){this.text=r.normalize?r.normalize():r,this.image=o,this.scale=c,this.fontStack=p,this.textColor=m}}class ki{constructor(r){this.sections=r}static fromString(r){return new ki([new ep(r,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(r=>r.text.length!==0||r.image&&r.image.name.length!==0)}static factory(r){return r instanceof ki?r:ki.fromString(r)}toString(){return this.sections.length===0?"":this.sections.map(r=>r.text).join("")}serialize(){const r=["format"];for(const o of this.sections){if(o.image){r.push(["image",o.image.name]);continue}r.push(o.text);const c={};o.fontStack&&(c["text-font"]=["literal",o.fontStack.split(",")]),o.scale&&(c["font-scale"]=o.scale),o.textColor&&(c["text-color"]=["rgba"].concat(o.textColor.toArray())),r.push(c)}return r}}class no{constructor(r){this.name=r.name,this.available=r.available}toString(){return this.name}static fromString(r){return r?new no({name:r,available:!1}):null}serialize(){return["image",this.name]}}function o0(i,r,o,c){return typeof i=="number"&&i>=0&&i<=255&&typeof r=="number"&&r>=0&&r<=255&&typeof o=="number"&&o>=0&&o<=255?c===void 0||typeof c=="number"&&c>=0&&c<=1?null:`Invalid rgba value [${[i,r,o,c].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof c=="number"?[i,r,o,c]:[i,r,o]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Rc(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof fn||i instanceof Jd||i instanceof ki||i instanceof no)return!0;if(Array.isArray(i)){for(const r of i)if(!Rc(r))return!1;return!0}if(typeof i=="object"){for(const r in i)if(!Rc(i[r]))return!1;return!0}return!1}function ln(i){if(i===null)return gl;if(typeof i=="string")return ir;if(typeof i=="boolean")return tr;if(typeof i=="number")return bt;if(i instanceof fn)return qi;if(i instanceof Jd)return Zi;if(i instanceof ki)return kc;if(i instanceof no)return zs;if(Array.isArray(i)){const r=i.length;let o;for(const c of i){const p=ln(c);if(o){if(o===p)continue;o=rr;break}o=p}return ro(o||rr,r)}return Ao}function Oc(i){const r=typeof i;return i===null?"":r==="string"||r==="number"||r==="boolean"?String(i):i instanceof fn||i instanceof ki||i instanceof no?i.toString():JSON.stringify(i)}class tp{constructor(r,o){this.type=r,this.value=o}static parse(r,o){if(r.length!==2)return o.error(`'literal' expression requires exactly one argument, but found ${r.length-1} instead.`);if(!Rc(r[1]))return o.error("invalid value");const c=r[1];let p=ln(c);const m=o.expectedType;return p.kind!=="array"||p.N!==0||!m||m.kind!=="array"||typeof m.N=="number"&&m.N!==0||(p=m),new tp(p,c)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return this.type.kind==="array"||this.type.kind==="object"?["literal",this.value]:this.value instanceof fn?["rgba"].concat(this.value.toArray()):this.value instanceof ki?this.value.serialize():this.value}}var Rs=tp,Jn=class{constructor(i){this.name="ExpressionEvaluationError",this.message=i}toJSON(){return this.message}};const rp={string:ir,number:bt,boolean:tr,object:Ao};class np{constructor(r,o){this.type=r,this.args=o}static parse(r,o){if(r.length<2)return o.error("Expected at least one argument.");let c,p=1;const m=r[0];if(m==="array"){let x,E;if(r.length>2){const S=r[1];if(typeof S!="string"||!(S in rp)||S==="object")return o.error('The item type argument of "array" must be one of string, number, boolean',1);x=rp[S],p++}else x=rr;if(r.length>3){if(r[2]!==null&&(typeof r[2]!="number"||r[2]<0||r[2]!==Math.floor(r[2])))return o.error('The length argument to "array" must be a positive integer literal',2);E=r[2],p++}c=ro(x,E)}else c=rp[m];const y=[];for(;pr.outputDefined())}serialize(){const r=this.type,o=[r.kind];if(r.kind==="array"){const c=r.itemType;if(c.kind==="string"||c.kind==="number"||c.kind==="boolean"){o.push(c.kind);const p=r.N;(typeof p=="number"||this.args.length>1)&&o.push(p)}}return o.concat(this.args.map(c=>c.serialize()))}}var wa=np;class es{constructor(r){this.type=kc,this.sections=r}static parse(r,o){if(r.length<2)return o.error("Expected at least one argument.");const c=r[1];if(!Array.isArray(c)&&typeof c=="object")return o.error("First argument must be an image or text section.");const p=[];let m=!1;for(let y=1;y<=r.length-1;++y){const x=r[y];if(m&&typeof x=="object"&&!Array.isArray(x)){m=!1;let E=null;if(x["font-scale"]&&(E=o.parse(x["font-scale"],1,bt),!E))return null;let S=null;if(x["text-font"]&&(S=o.parse(x["text-font"],1,ro(ir)),!S))return null;let k=null;if(x["text-color"]&&(k=o.parse(x["text-color"],1,qi),!k))return null;const M=p[p.length-1];M.scale=E,M.font=S,M.textColor=k}else{const E=o.parse(r[y],1,rr);if(!E)return null;const S=E.type.kind;if(S!=="string"&&S!=="value"&&S!=="null"&&S!=="resolvedImage")return o.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");m=!0,p.push({content:E,scale:null,font:null,textColor:null})}}return new es(p)}evaluate(r){return new ki(this.sections.map(o=>{const c=o.content.evaluate(r);return ln(c)===zs?new ep("",c,null,null,null):new ep(Oc(c),null,o.scale?o.scale.evaluate(r):null,o.font?o.font.evaluate(r).join(","):null,o.textColor?o.textColor.evaluate(r):null)}))}eachChild(r){for(const o of this.sections)r(o.content),o.scale&&r(o.scale),o.font&&r(o.font),o.textColor&&r(o.textColor)}outputDefined(){return!1}serialize(){const r=["format"];for(const o of this.sections){r.push(o.content.serialize());const c={};o.scale&&(c["font-scale"]=o.scale.serialize()),o.font&&(c["text-font"]=o.font.serialize()),o.textColor&&(c["text-color"]=o.textColor.serialize()),r.push(c)}return r}}class Gu{constructor(r){this.type=zs,this.input=r}static parse(r,o){if(r.length!==2)return o.error("Expected two arguments.");const c=o.parse(r[1],1,ir);return c?new Gu(c):o.error("No image name provided.")}evaluate(r){const o=this.input.evaluate(r),c=no.fromString(o);return c&&r.availableImages&&(c.available=r.availableImages.indexOf(o)>-1),c}eachChild(r){r(this.input)}outputDefined(){return!1}serialize(){return["image",this.input.serialize()]}}const Kv={"to-boolean":tr,"to-color":qi,"to-number":bt,"to-string":ir};class ip{constructor(r,o){this.type=r,this.args=o}static parse(r,o){if(r.length<2)return o.error("Expected at least one argument.");const c=r[0];if((c==="to-boolean"||c==="to-string")&&r.length!==2)return o.error("Expected one argument.");const p=Kv[c],m=[];for(let y=1;y4?`Invalid rbga value ${JSON.stringify(o)}: expected an array containing either three or four numeric values.`:o0(o[0],o[1],o[2],o[3]),!c))return new fn(o[0]/255,o[1]/255,o[2]/255,o[3])}throw new Jn(c||`Could not parse color from value '${typeof o=="string"?o:String(JSON.stringify(o))}'`)}if(this.type.kind==="number"){let o=null;for(const c of this.args){if(o=c.evaluate(r),o===null)return 0;const p=Number(o);if(!isNaN(p))return p}throw new Jn(`Could not convert ${JSON.stringify(o)} to number.`)}return this.type.kind==="formatted"?ki.fromString(Oc(this.args[0].evaluate(r))):this.type.kind==="resolvedImage"?no.fromString(Oc(this.args[0].evaluate(r))):Oc(this.args[0].evaluate(r))}eachChild(r){this.args.forEach(r)}outputDefined(){return this.args.every(r=>r.outputDefined())}serialize(){if(this.type.kind==="formatted")return new es([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if(this.type.kind==="resolvedImage")return new Gu(this.args[0]).serialize();const r=[`to-${this.type.kind}`];return this.eachChild(o=>{r.push(o.serialize())}),r}}var _l=ip;const Xo=["Unknown","Point","LineString","Polygon"];var op=class{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null}id(){return this.feature&&this.feature.id!==void 0?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?Xo[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||{}}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const i=this.featureDistanceData.center,r=this.featureDistanceData.scale,{x:o,y:c}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(o*r-i[0])+this.featureDistanceData.bearing[1]*(c*r-i[1])}return 0}parseColor(i){let r=this._parseColorCache[i];return r||(r=this._parseColorCache[i]=fn.parse(i)),r}};class Os{constructor(r,o,c,p){this.name=r,this.type=o,this._evaluate=c,this.args=p}evaluate(r){return this._evaluate(r,this.args)}eachChild(r){this.args.forEach(r)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map(r=>r.serialize()))}static parse(r,o){const c=r[0],p=Os.definitions[c];if(!p)return o.error(`Unknown expression "${c}". If you wanted a literal array, use ["literal", [...]].`,0);const m=Array.isArray(p)?p[0]:p.type,y=Array.isArray(p)?[[p[1],p[2]]]:p.overloads,x=y.filter(([S])=>!Array.isArray(S)||S.length===r.length-1);let E=null;for(const[S,k]of x){E=new hp(o.registry,o.path,null,o.scope);const M=[];let O=!1;for(let $=1;${return O=M,Array.isArray(O)?`(${O.map(Xr).join(", ")})`:`(${Xr(O.type)}...)`;var O}).join(" | "),k=[];for(let M=1;M=r[2]||i[1]<=r[1]||i[3]>=r[3])}function Lc(i,r){const o=(180+i[0])/360,c=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i[1]*Math.PI/360)))/360,p=Math.pow(2,r.z);return[Math.round(o*p*Sa),Math.round(c*p*Sa)]}function a0(i,r,o){const c=i[0]-r[0],p=i[1]-r[1],m=i[0]-o[0],y=i[1]-o[1];return c*y-m*p==0&&c*m<=0&&p*y<=0}function qu(i,r){let o=!1;for(let y=0,x=r.length;y(c=i)[1]!=(m=E[S+1])[1]>c[1]&&c[0]<(m[0]-p[0])*(c[1]-p[1])/(m[1]-p[1])+p[0]&&(o=!o)}}var c,p,m;return o}function ap(i,r){for(let o=0;o0&&x<0||y<0&&x>0}function xl(i,r,o){for(const S of o)for(let k=0;ko[2]){const p=.5*c;let m=i[0]-o[0]>p?-c:o[0]-i[0]>p?c:0;m===0&&(m=i[0]-o[2]>p?-c:o[2]-i[0]>p?c:0),i[0]+=m}Hu(r,i)}function l0(i,r,o,c){const p=Math.pow(2,c.z)*Sa,m=[c.x*Sa,c.y*Sa],y=[];if(!i)return y;for(const x of i)for(const E of x){const S=[E.x+m[0],E.y+m[1]];cp(S,r,o,p),y.push(S)}return y}function up(i,r,o,c){const p=Math.pow(2,c.z)*Sa,m=[c.x*Sa,c.y*Sa],y=[];if(!i)return y;for(const E of i){const S=[];for(const k of E){const M=[k.x+m[0],k.y+m[1]];Hu(r,M),S.push(M)}y.push(S)}if(r[2]-r[0]<=p/2){(x=r)[0]=x[1]=1/0,x[2]=x[3]=-1/0;for(const E of y)for(const S of E)cp(S,r,o,p)}var x;return y}class bl{constructor(r,o){this.type=tr,this.geojson=r,this.geometries=o}static parse(r,o){if(r.length!==2)return o.error(`'within' expression requires exactly one argument, but found ${r.length-1} instead.`);if(Rc(r[1])){const c=r[1];if(c.type==="FeatureCollection")for(let p=0;p{r&&!wl(o)&&(r=!1)}),r}function Ta(i){if(i instanceof Ea&&i.name==="feature-state")return!1;let r=!0;return i.eachChild(o=>{r&&!Ta(o)&&(r=!1)}),r}function Fs(i,r){if(i instanceof Ea&&r.indexOf(i.name)>=0)return!1;let o=!0;return i.eachChild(c=>{o&&!Fs(c,r)&&(o=!1)}),o}class Ku{constructor(r,o){this.type=o.type,this.name=r,this.boundExpression=o}static parse(r,o){if(r.length!==2||typeof r[1]!="string")return o.error("'var' expression requires exactly one string literal argument.");const c=r[1];return o.scope.has(c)?new Ku(c,o.scope.get(c)):o.error(`Unknown variable "${c}". Make sure "${c}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(r){return this.boundExpression.evaluate(r)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}var c0=Ku;class Bc{constructor(r,o=[],c,p=new r0,m=[]){this.registry=r,this.path=o,this.key=o.map(y=>`[${y}]`).join(""),this.scope=p,this.errors=m,this.expectedType=c}parse(r,o,c,p,m={}){return o?this.concat(o,c,p)._parse(r,m):this._parse(r,m)}_parse(r,o){function c(p,m,y){return y==="assert"?new wa(m,[p]):y==="coerce"?new _l(m,[p]):p}if(r!==null&&typeof r!="string"&&typeof r!="boolean"&&typeof r!="number"||(r=["literal",r]),Array.isArray(r)){if(r.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const p=r[0];if(typeof p!="string")return this.error(`Expression name must be a string, but found ${typeof p} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const m=this.registry[p];if(m){let y=m.parse(r,this);if(!y)return null;if(this.expectedType){const x=this.expectedType,E=y.type;if(x.kind!=="string"&&x.kind!=="number"&&x.kind!=="boolean"&&x.kind!=="object"&&x.kind!=="array"||E.kind!=="value")if(x.kind!=="color"&&x.kind!=="formatted"&&x.kind!=="resolvedImage"||E.kind!=="value"&&E.kind!=="string"){if(this.checkSubtype(x,E))return null}else y=c(y,x,o.typeAnnotation||"coerce");else y=c(y,x,o.typeAnnotation||"assert")}if(!(y instanceof Rs)&&y.type.kind!=="resolvedImage"&&dp(y)){const x=new op;try{y=new Rs(y.type,y.evaluate(x))}catch(E){return this.error(E.message),null}}return y}return this.error(`Unknown expression "${p}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(r===void 0?"'undefined' value invalid. Use null instead.":typeof r=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof r} instead.`)}concat(r,o,c){const p=typeof r=="number"?this.path.concat(r):this.path,m=c?this.scope.concat(c):this.scope;return new Bc(this.registry,p,o||null,m,this.errors)}error(r,...o){const c=`${this.key}${o.map(p=>`[${p}]`).join("")}`;this.errors.push(new Ko(c,r))}checkSubtype(r,o){const c=ba(r,o);return c&&this.error(c),c}}var hp=Bc;function dp(i){if(i instanceof c0)return dp(i.boundExpression);if(i instanceof Ea&&i.name==="error"||i instanceof Fc||i instanceof Zu)return!1;const r=i instanceof _l||i instanceof wa;let o=!0;return i.eachChild(c=>{o=r?o&&dp(c):o&&c instanceof Rs}),!!o&&wl(i)&&Fs(i,["zoom","heatmap-density","line-progress","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center"])}function Xu(i,r){const o=i.length-1;let c,p,m=0,y=o,x=0;for(;m<=y;)if(x=Math.floor((m+y)/2),c=i[x],p=i[x+1],c<=r){if(x===o||rr))throw new Jn("Input is not a number.");y=x-1}return 0}class Yu{constructor(r,o,c){this.type=r,this.input=o,this.labels=[],this.outputs=[];for(const[p,m]of c)this.labels.push(p),this.outputs.push(m)}static parse(r,o){if(r.length-1<4)return o.error(`Expected at least 4 arguments, but found only ${r.length-1}.`);if((r.length-1)%2!=0)return o.error("Expected an even number of arguments.");const c=o.parse(r[1],1,bt);if(!c)return null;const p=[];let m=null;o.expectedType&&o.expectedType.kind!=="value"&&(m=o.expectedType);for(let y=1;y=x)return o.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',S);const M=o.parse(E,k,m);if(!M)return null;m=m||M.type,p.push([x,M])}return new Yu(m,c,p)}evaluate(r){const o=this.labels,c=this.outputs;if(o.length===1)return c[0].evaluate(r);const p=this.input.evaluate(r);if(p<=o[0])return c[0].evaluate(r);const m=o.length;return p>=o[m-1]?c[m-1].evaluate(r):c[Xu(o,p)].evaluate(r)}eachChild(r){r(this.input);for(const o of this.outputs)r(o)}outputDefined(){return this.outputs.every(r=>r.outputDefined())}serialize(){const r=["step",this.input.serialize()];for(let o=0;o0&&r.push(this.labels[o]),r.push(this.outputs[o].serialize());return r}}var pp=Yu;function dr(i,r,o){return i*(1-o)+r*o}var Nc=Object.freeze({__proto__:null,array:function(i,r,o){return i.map((c,p)=>dr(c,r[p],o))},color:function(i,r,o){return new fn(dr(i.r,r.r,o),dr(i.g,r.g,o),dr(i.b,r.b,o),dr(i.a,r.a,o))},number:dr});const u0=.95047,fp=1.08883,h0=4/29,Ls=6/29,mp=3*Ls*Ls,Yv=Ls*Ls*Ls,Qv=Math.PI/180,Jv=180/Math.PI;function gp(i){return i>Yv?Math.pow(i,1/3):i/mp+h0}function yp(i){return i>Ls?i*i*i:mp*(i-h0)}function _p(i){return 255*(i<=.0031308?12.92*i:1.055*Math.pow(i,1/2.4)-.055)}function Qu(i){return(i/=255)<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function d0(i){const r=Qu(i.r),o=Qu(i.g),c=Qu(i.b),p=gp((.4124564*r+.3575761*o+.1804375*c)/u0),m=gp((.2126729*r+.7151522*o+.072175*c)/1);return{l:116*m-16,a:500*(p-m),b:200*(m-gp((.0193339*r+.119192*o+.9503041*c)/fp)),alpha:i.a}}function p0(i){let r=(i.l+16)/116,o=isNaN(i.a)?r:r+i.a/500,c=isNaN(i.b)?r:r-i.b/200;return r=1*yp(r),o=u0*yp(o),c=fp*yp(c),new fn(_p(3.2404542*o-1.5371385*r-.4985314*c),_p(-.969266*o+1.8760108*r+.041556*c),_p(.0556434*o-.2040259*r+1.0572252*c),i.alpha)}function ex(i,r,o){const c=r-i;return i+o*(c>180||c<-180?c-360*Math.round(c/360):c)}const Uc={forward:d0,reverse:p0,interpolate:function(i,r,o){return{l:dr(i.l,r.l,o),a:dr(i.a,r.a,o),b:dr(i.b,r.b,o),alpha:dr(i.alpha,r.alpha,o)}}},El={forward:function(i){const{l:r,a:o,b:c}=d0(i),p=Math.atan2(c,o)*Jv;return{h:p<0?p+360:p,c:Math.sqrt(o*o+c*c),l:r,alpha:i.a}},reverse:function(i){const r=i.h*Qv,o=i.c;return p0({l:i.l,a:Math.cos(r)*o,b:Math.sin(r)*o,alpha:i.alpha})},interpolate:function(i,r,o){return{h:ex(i.h,r.h,o),c:dr(i.c,r.c,o),l:dr(i.l,r.l,o),alpha:dr(i.alpha,r.alpha,o)}}};var vp=Object.freeze({__proto__:null,hcl:El,lab:Uc});class jc{constructor(r,o,c,p,m){this.type=r,this.operator=o,this.interpolation=c,this.input=p,this.labels=[],this.outputs=[];for(const[y,x]of m)this.labels.push(y),this.outputs.push(x)}static interpolationFactor(r,o,c,p){let m=0;if(r.name==="exponential")m=xp(o,r.base,c,p);else if(r.name==="linear")m=xp(o,1,c,p);else if(r.name==="cubic-bezier"){const y=r.controlPoints;m=new te(y[0],y[1],y[2],y[3]).solve(xp(o,1,c,p))}return m}static parse(r,o){let[c,p,m,...y]=r;if(!Array.isArray(p)||p.length===0)return o.error("Expected an interpolation type expression.",1);if(p[0]==="linear")p={name:"linear"};else if(p[0]==="exponential"){const S=p[1];if(typeof S!="number")return o.error("Exponential interpolation requires a numeric base.",1,1);p={name:"exponential",base:S}}else{if(p[0]!=="cubic-bezier")return o.error(`Unknown interpolation type ${String(p[0])}`,1,0);{const S=p.slice(1);if(S.length!==4||S.some(k=>typeof k!="number"||k<0||k>1))return o.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);p={name:"cubic-bezier",controlPoints:S}}}if(r.length-1<4)return o.error(`Expected at least 4 arguments, but found only ${r.length-1}.`);if((r.length-1)%2!=0)return o.error("Expected an even number of arguments.");if(m=o.parse(m,2,bt),!m)return null;const x=[];let E=null;c==="interpolate-hcl"||c==="interpolate-lab"?E=qi:o.expectedType&&o.expectedType.kind!=="value"&&(E=o.expectedType);for(let S=0;S=k)return o.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',O);const G=o.parse(M,$,E);if(!G)return null;E=E||G.type,x.push([k,G])}return E.kind==="number"||E.kind==="color"||E.kind==="array"&&E.itemType.kind==="number"&&typeof E.N=="number"?new jc(E,c,p,m,x):o.error(`Type ${Xr(E)} is not interpolatable.`)}evaluate(r){const o=this.labels,c=this.outputs;if(o.length===1)return c[0].evaluate(r);const p=this.input.evaluate(r);if(p<=o[0])return c[0].evaluate(r);const m=o.length;if(p>=o[m-1])return c[m-1].evaluate(r);const y=Xu(o,p),x=jc.interpolationFactor(this.interpolation,p,o[y],o[y+1]),E=c[y].evaluate(r),S=c[y+1].evaluate(r);return this.operator==="interpolate"?Nc[this.type.kind.toLowerCase()](E,S,x):this.operator==="interpolate-hcl"?El.reverse(El.interpolate(El.forward(E),El.forward(S),x)):Uc.reverse(Uc.interpolate(Uc.forward(E),Uc.forward(S),x))}eachChild(r){r(this.input);for(const o of this.outputs)r(o)}outputDefined(){return this.outputs.every(r=>r.outputDefined())}serialize(){let r;r=this.interpolation.name==="linear"?["linear"]:this.interpolation.name==="exponential"?this.interpolation.base===1?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier"].concat(this.interpolation.controlPoints);const o=[this.operator,r,this.input.serialize()];for(let c=0;cba(p,x.type));return new Ju(y?rr:c,m)}evaluate(r){let o,c=null,p=0;for(const m of this.args){if(p++,c=m.evaluate(r),c&&c instanceof no&&!c.available&&(o||(o=c),c=null,p===this.args.length))return o;if(c!==null)break}return c}eachChild(r){this.args.forEach(r)}outputDefined(){return this.args.every(r=>r.outputDefined())}serialize(){const r=["coalesce"];return this.eachChild(o=>{r.push(o.serialize())}),r}}var bp=Ju;class eh{constructor(r,o){this.type=o.type,this.bindings=[].concat(r),this.result=o}evaluate(r){return this.result.evaluate(r)}eachChild(r){for(const o of this.bindings)r(o[1]);r(this.result)}static parse(r,o){if(r.length<4)return o.error(`Expected at least 3 arguments, but found ${r.length-1} instead.`);const c=[];for(let m=1;m=c.length)throw new Jn(`Array index out of bounds: ${o} > ${c.length-1}.`);if(o!==Math.floor(o))throw new Jn(`Array index must be an integer, but found ${o} instead.`);return c[o]}eachChild(r){r(this.index),r(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}var tx=wp;class Ep{constructor(r,o){this.type=tr,this.needle=r,this.haystack=o}static parse(r,o){if(r.length!==3)return o.error(`Expected 2 arguments, but found ${r.length-1} instead.`);const c=o.parse(r[1],1,rr),p=o.parse(r[2],2,rr);return c&&p?Pc(c.type,[tr,ir,bt,gl,rr])?new Ep(c,p):o.error(`Expected first argument to be of type boolean, string, number or null, but found ${Xr(c.type)} instead`):null}evaluate(r){const o=this.needle.evaluate(r),c=this.haystack.evaluate(r);if(c==null)return!1;if(!Dc(o,["boolean","string","number","null"]))throw new Jn(`Expected first argument to be of type boolean, string, number or null, but found ${Xr(ln(o))} instead.`);if(!Dc(c,["string","array"]))throw new Jn(`Expected second argument to be of type array or string, but found ${Xr(ln(c))} instead.`);return c.indexOf(o)>=0}eachChild(r){r(this.needle),r(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}var th=Ep;class Vc{constructor(r,o,c){this.type=bt,this.needle=r,this.haystack=o,this.fromIndex=c}static parse(r,o){if(r.length<=2||r.length>=5)return o.error(`Expected 3 or 4 arguments, but found ${r.length-1} instead.`);const c=o.parse(r[1],1,rr),p=o.parse(r[2],2,rr);if(!c||!p)return null;if(!Pc(c.type,[tr,ir,bt,gl,rr]))return o.error(`Expected first argument to be of type boolean, string, number or null, but found ${Xr(c.type)} instead`);if(r.length===4){const m=o.parse(r[3],3,bt);return m?new Vc(c,p,m):null}return new Vc(c,p)}evaluate(r){const o=this.needle.evaluate(r),c=this.haystack.evaluate(r);if(!Dc(o,["boolean","string","number","null"]))throw new Jn(`Expected first argument to be of type boolean, string, number or null, but found ${Xr(ln(o))} instead.`);if(!Dc(c,["string","array"]))throw new Jn(`Expected second argument to be of type array or string, but found ${Xr(ln(c))} instead.`);if(this.fromIndex){const p=this.fromIndex.evaluate(r);return c.indexOf(o,p)}return c.indexOf(o)}eachChild(r){r(this.needle),r(this.haystack),this.fromIndex&&r(this.fromIndex)}outputDefined(){return!1}serialize(){if(this.fromIndex!=null&&this.fromIndex!==void 0){const r=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),r]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}var m0=Vc;class Sp{constructor(r,o,c,p,m,y){this.inputType=r,this.type=o,this.input=c,this.cases=p,this.outputs=m,this.otherwise=y}static parse(r,o){if(r.length<5)return o.error(`Expected at least 4 arguments, but found only ${r.length-1}.`);if(r.length%2!=1)return o.error("Expected an even number of arguments.");let c,p;o.expectedType&&o.expectedType.kind!=="value"&&(p=o.expectedType);const m={},y=[];for(let S=2;SNumber.MAX_SAFE_INTEGER)return O.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof G=="number"&&Math.floor(G)!==G)return O.error("Numeric branch labels must be integer values.");if(c){if(O.checkSubtype(c,ln(G)))return null}else c=ln(G);if(m[String(G)]!==void 0)return O.error("Branch labels must be unique.");m[String(G)]=y.length}const $=o.parse(M,S,p);if(!$)return null;p=p||$.type,y.push($)}const x=o.parse(r[1],1,rr);if(!x)return null;const E=o.parse(r[r.length-1],r.length-1,p);return E?x.type.kind!=="value"&&o.concat(1).checkSubtype(c,x.type)?null:new Sp(c,p,x,m,y,E):null}evaluate(r){const o=this.input.evaluate(r);return(ln(o)===this.inputType&&this.outputs[this.cases[o]]||this.otherwise).evaluate(r)}eachChild(r){r(this.input),this.outputs.forEach(r),r(this.otherwise)}outputDefined(){return this.outputs.every(r=>r.outputDefined())&&this.otherwise.outputDefined()}serialize(){const r=["match",this.input.serialize()],o=Object.keys(this.cases).sort(),c=[],p={};for(const y of o){const x=p[this.cases[y]];x===void 0?(p[this.cases[y]]=c.length,c.push([this.cases[y],[y]])):c[x][1].push(y)}const m=y=>this.inputType.kind==="number"?Number(y):y;for(const[y,x]of c)r.push(x.length===1?m(x[0]):x.map(m)),r.push(this.outputs[y].serialize());return r.push(this.otherwise.serialize()),r}}var rx=Sp;class Tp{constructor(r,o,c){this.type=r,this.branches=o,this.otherwise=c}static parse(r,o){if(r.length<4)return o.error(`Expected at least 3 arguments, but found only ${r.length-1}.`);if(r.length%2!=0)return o.error("Expected an odd number of arguments.");let c;o.expectedType&&o.expectedType.kind!=="value"&&(c=o.expectedType);const p=[];for(let y=1;yo.outputDefined())&&this.otherwise.outputDefined()}serialize(){const r=["case"];return this.eachChild(o=>{r.push(o.serialize())}),r}}var g0=Tp;class $c{constructor(r,o,c,p){this.type=r,this.input=o,this.beginIndex=c,this.endIndex=p}static parse(r,o){if(r.length<=2||r.length>=5)return o.error(`Expected 3 or 4 arguments, but found ${r.length-1} instead.`);const c=o.parse(r[1],1,rr),p=o.parse(r[2],2,bt);if(!c||!p)return null;if(!Pc(c.type,[ro(rr),ir,rr]))return o.error(`Expected first argument to be of type array or string, but found ${Xr(c.type)} instead`);if(r.length===4){const m=o.parse(r[3],3,bt);return m?new $c(c.type,c,p,m):null}return new $c(c.type,c,p)}evaluate(r){const o=this.input.evaluate(r),c=this.beginIndex.evaluate(r);if(!Dc(o,["string","array"]))throw new Jn(`Expected first argument to be of type array or string, but found ${Xr(ln(o))} instead.`);if(this.endIndex){const p=this.endIndex.evaluate(r);return o.slice(c,p)}return o.slice(c)}eachChild(r){r(this.input),r(this.beginIndex),this.endIndex&&r(this.endIndex)}outputDefined(){return!1}serialize(){if(this.endIndex!=null&&this.endIndex!==void 0){const r=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),r]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}var y0=$c;function rh(i,r){return i==="=="||i==="!="?r.kind==="boolean"||r.kind==="string"||r.kind==="number"||r.kind==="null"||r.kind==="value":r.kind==="string"||r.kind==="number"||r.kind==="value"}function _0(i,r,o,c){return c.compare(r,o)===0}function Sl(i,r,o){const c=i!=="=="&&i!=="!=";return class C3{constructor(m,y,x){this.type=tr,this.lhs=m,this.rhs=y,this.collator=x,this.hasUntypedArgument=m.type.kind==="value"||y.type.kind==="value"}static parse(m,y){if(m.length!==3&&m.length!==4)return y.error("Expected two or three arguments.");const x=m[0];let E=y.parse(m[1],1,rr);if(!E)return null;if(!rh(x,E.type))return y.concat(1).error(`"${x}" comparisons are not supported for type '${Xr(E.type)}'.`);let S=y.parse(m[2],2,rr);if(!S)return null;if(!rh(x,S.type))return y.concat(2).error(`"${x}" comparisons are not supported for type '${Xr(S.type)}'.`);if(E.type.kind!==S.type.kind&&E.type.kind!=="value"&&S.type.kind!=="value")return y.error(`Cannot compare types '${Xr(E.type)}' and '${Xr(S.type)}'.`);c&&(E.type.kind==="value"&&S.type.kind!=="value"?E=new wa(S.type,[E]):E.type.kind!=="value"&&S.type.kind==="value"&&(S=new wa(E.type,[S])));let k=null;if(m.length===4){if(E.type.kind!=="string"&&S.type.kind!=="string"&&E.type.kind!=="value"&&S.type.kind!=="value")return y.error("Cannot use collator to compare non-string types.");if(k=y.parse(m[3],3,Zi),!k)return null}return new C3(E,S,k)}evaluate(m){const y=this.lhs.evaluate(m),x=this.rhs.evaluate(m);if(c&&this.hasUntypedArgument){const E=ln(y),S=ln(x);if(E.kind!==S.kind||E.kind!=="string"&&E.kind!=="number")throw new Jn(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${E.kind}, ${S.kind}) instead.`)}if(this.collator&&!c&&this.hasUntypedArgument){const E=ln(y),S=ln(x);if(E.kind!=="string"||S.kind!=="string")return r(m,y,x)}return this.collator?o(m,y,x,this.collator.evaluate(m)):r(m,y,x)}eachChild(m){m(this.lhs),m(this.rhs),this.collator&&m(this.collator)}outputDefined(){return!0}serialize(){const m=[i];return this.eachChild(y=>{m.push(y.serialize())}),m}}}const nx=Sl("==",function(i,r,o){return r===o},_0),ix=Sl("!=",function(i,r,o){return r!==o},function(i,r,o,c){return!_0(0,r,o,c)}),ox=Sl("<",function(i,r,o){return r",function(i,r,o){return r>o},function(i,r,o,c){return c.compare(r,o)>0}),sx=Sl("<=",function(i,r,o){return r<=o},function(i,r,o,c){return c.compare(r,o)<=0}),v0=Sl(">=",function(i,r,o){return r>=o},function(i,r,o,c){return c.compare(r,o)>=0});class nh{constructor(r,o,c,p,m,y){this.type=ir,this.number=r,this.locale=o,this.currency=c,this.unit=p,this.minFractionDigits=m,this.maxFractionDigits=y}static parse(r,o){if(r.length!==3)return o.error("Expected two arguments.");const c=o.parse(r[1],1,bt);if(!c)return null;const p=r[2];if(typeof p!="object"||Array.isArray(p))return o.error("NumberFormat options argument must be an object.");let m=null;if(p.locale&&(m=o.parse(p.locale,1,ir),!m))return null;let y=null;if(p.currency&&(y=o.parse(p.currency,1,ir),!y))return null;let x=null;if(p.unit&&(x=o.parse(p.unit,1,ir),!x))return null;let E=null;if(p["min-fraction-digits"]&&(E=o.parse(p["min-fraction-digits"],1,bt),!E))return null;let S=null;return p["max-fraction-digits"]&&(S=o.parse(p["max-fraction-digits"],1,bt),!S)?null:new nh(c,m,y,x,E,S)}evaluate(r){return new Intl.NumberFormat(this.locale?this.locale.evaluate(r):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(r):void 0,unit:this.unit?this.unit.evaluate(r):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(r):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(r):void 0}).format(this.number.evaluate(r))}eachChild(r){r(this.number),this.locale&&r(this.locale),this.currency&&r(this.currency),this.unit&&r(this.unit),this.minFractionDigits&&r(this.minFractionDigits),this.maxFractionDigits&&r(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const r={};return this.locale&&(r.locale=this.locale.serialize()),this.currency&&(r.currency=this.currency.serialize()),this.unit&&(r.unit=this.unit.serialize()),this.minFractionDigits&&(r["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(r["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),r]}}class Tl{constructor(r){this.type=bt,this.input=r}static parse(r,o){if(r.length!==2)return o.error(`Expected 1 argument, but found ${r.length-1} instead.`);const c=o.parse(r[1],1);return c?c.type.kind!=="array"&&c.type.kind!=="string"&&c.type.kind!=="value"?o.error(`Expected argument of type string or array, but found ${Xr(c.type)} instead.`):new Tl(c):null}evaluate(r){const o=this.input.evaluate(r);if(typeof o=="string"||Array.isArray(o))return o.length;throw new Jn(`Expected value to be of type string or array, but found ${Xr(ln(o))} instead.`)}eachChild(r){r(this.input)}outputDefined(){return!1}serialize(){const r=["length"];return this.eachChild(o=>{r.push(o.serialize())}),r}}const x0={"==":nx,"!=":ix,">":ax,"<":ox,">=":v0,"<=":sx,array:wa,at:tx,boolean:wa,case:g0,coalesce:bp,collator:Fc,format:es,image:Gu,in:th,"index-of":m0,interpolate:Yo,"interpolate-hcl":Yo,"interpolate-lab":Yo,length:Tl,let:f0,literal:Rs,match:rx,number:wa,"number-format":nh,object:wa,slice:y0,step:pp,string:wa,"to-boolean":_l,"to-color":_l,"to-number":_l,"to-string":_l,var:c0,within:Zu};function b0(i,[r,o,c,p]){r=r.evaluate(i),o=o.evaluate(i),c=c.evaluate(i);const m=p?p.evaluate(i):1,y=o0(r,o,c,m);if(y)throw new Jn(y);return new fn(r/255*m,o/255*m,c/255*m,m)}function Aa(i,r){return i in r}function ih(i,r){const o=r[i];return o===void 0?null:o}function io(i){return{type:i}}Ea.register(x0,{error:[{kind:"error"},[ir],(i,[r])=>{throw new Jn(r.evaluate(i))}],typeof:[ir,[rr],(i,[r])=>Xr(ln(r.evaluate(i)))],"to-rgba":[ro(bt,4),[qi],(i,[r])=>r.evaluate(i).toArray()],rgb:[qi,[bt,bt,bt],b0],rgba:[qi,[bt,bt,bt,bt],b0],has:{type:tr,overloads:[[[ir],(i,[r])=>Aa(r.evaluate(i),i.properties())],[[ir,Ao],(i,[r,o])=>Aa(r.evaluate(i),o.evaluate(i))]]},get:{type:rr,overloads:[[[ir],(i,[r])=>ih(r.evaluate(i),i.properties())],[[ir,Ao],(i,[r,o])=>ih(r.evaluate(i),o.evaluate(i))]]},"feature-state":[rr,[ir],(i,[r])=>ih(r.evaluate(i),i.featureState||{})],properties:[Ao,[],i=>i.properties()],"geometry-type":[ir,[],i=>i.geometryType()],id:[rr,[],i=>i.id()],zoom:[bt,[],i=>i.globals.zoom],pitch:[bt,[],i=>i.globals.pitch||0],"distance-from-center":[bt,[],i=>i.distanceFromCenter()],"heatmap-density":[bt,[],i=>i.globals.heatmapDensity||0],"line-progress":[bt,[],i=>i.globals.lineProgress||0],"sky-radial-progress":[bt,[],i=>i.globals.skyRadialProgress||0],accumulated:[rr,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[bt,io(bt),(i,r)=>{let o=0;for(const c of r)o+=c.evaluate(i);return o}],"*":[bt,io(bt),(i,r)=>{let o=1;for(const c of r)o*=c.evaluate(i);return o}],"-":{type:bt,overloads:[[[bt,bt],(i,[r,o])=>r.evaluate(i)-o.evaluate(i)],[[bt],(i,[r])=>-r.evaluate(i)]]},"/":[bt,[bt,bt],(i,[r,o])=>r.evaluate(i)/o.evaluate(i)],"%":[bt,[bt,bt],(i,[r,o])=>r.evaluate(i)%o.evaluate(i)],ln2:[bt,[],()=>Math.LN2],pi:[bt,[],()=>Math.PI],e:[bt,[],()=>Math.E],"^":[bt,[bt,bt],(i,[r,o])=>Math.pow(r.evaluate(i),o.evaluate(i))],sqrt:[bt,[bt],(i,[r])=>Math.sqrt(r.evaluate(i))],log10:[bt,[bt],(i,[r])=>Math.log(r.evaluate(i))/Math.LN10],ln:[bt,[bt],(i,[r])=>Math.log(r.evaluate(i))],log2:[bt,[bt],(i,[r])=>Math.log(r.evaluate(i))/Math.LN2],sin:[bt,[bt],(i,[r])=>Math.sin(r.evaluate(i))],cos:[bt,[bt],(i,[r])=>Math.cos(r.evaluate(i))],tan:[bt,[bt],(i,[r])=>Math.tan(r.evaluate(i))],asin:[bt,[bt],(i,[r])=>Math.asin(r.evaluate(i))],acos:[bt,[bt],(i,[r])=>Math.acos(r.evaluate(i))],atan:[bt,[bt],(i,[r])=>Math.atan(r.evaluate(i))],min:[bt,io(bt),(i,r)=>Math.min(...r.map(o=>o.evaluate(i)))],max:[bt,io(bt),(i,r)=>Math.max(...r.map(o=>o.evaluate(i)))],abs:[bt,[bt],(i,[r])=>Math.abs(r.evaluate(i))],round:[bt,[bt],(i,[r])=>{const o=r.evaluate(i);return o<0?-Math.round(-o):Math.round(o)}],floor:[bt,[bt],(i,[r])=>Math.floor(r.evaluate(i))],ceil:[bt,[bt],(i,[r])=>Math.ceil(r.evaluate(i))],"filter-==":[tr,[ir,rr],(i,[r,o])=>i.properties()[r.value]===o.value],"filter-id-==":[tr,[rr],(i,[r])=>i.id()===r.value],"filter-type-==":[tr,[ir],(i,[r])=>i.geometryType()===r.value],"filter-<":[tr,[ir,rr],(i,[r,o])=>{const c=i.properties()[r.value],p=o.value;return typeof c==typeof p&&c{const o=i.id(),c=r.value;return typeof o==typeof c&&o":[tr,[ir,rr],(i,[r,o])=>{const c=i.properties()[r.value],p=o.value;return typeof c==typeof p&&c>p}],"filter-id->":[tr,[rr],(i,[r])=>{const o=i.id(),c=r.value;return typeof o==typeof c&&o>c}],"filter-<=":[tr,[ir,rr],(i,[r,o])=>{const c=i.properties()[r.value],p=o.value;return typeof c==typeof p&&c<=p}],"filter-id-<=":[tr,[rr],(i,[r])=>{const o=i.id(),c=r.value;return typeof o==typeof c&&o<=c}],"filter->=":[tr,[ir,rr],(i,[r,o])=>{const c=i.properties()[r.value],p=o.value;return typeof c==typeof p&&c>=p}],"filter-id->=":[tr,[rr],(i,[r])=>{const o=i.id(),c=r.value;return typeof o==typeof c&&o>=c}],"filter-has":[tr,[rr],(i,[r])=>r.value in i.properties()],"filter-has-id":[tr,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[tr,[ro(ir)],(i,[r])=>r.value.indexOf(i.geometryType())>=0],"filter-id-in":[tr,[ro(rr)],(i,[r])=>r.value.indexOf(i.id())>=0],"filter-in-small":[tr,[ir,ro(rr)],(i,[r,o])=>o.value.indexOf(i.properties()[r.value])>=0],"filter-in-large":[tr,[ir,ro(rr)],(i,[r,o])=>function(c,p,m,y){for(;m<=y;){const x=m+y>>1;if(p[x]===c)return!0;p[x]>c?y=x-1:m=x+1}return!1}(i.properties()[r.value],o.value,0,o.value.length-1)],all:{type:tr,overloads:[[[tr,tr],(i,[r,o])=>r.evaluate(i)&&o.evaluate(i)],[io(tr),(i,r)=>{for(const o of r)if(!o.evaluate(i))return!1;return!0}]]},any:{type:tr,overloads:[[[tr,tr],(i,[r,o])=>r.evaluate(i)||o.evaluate(i)],[io(tr),(i,r)=>{for(const o of r)if(o.evaluate(i))return!0;return!1}]]},"!":[tr,[tr],(i,[r])=>!r.evaluate(i)],"is-supported-script":[tr,[ir],(i,[r])=>{const o=i.globals&&i.globals.isSupportedScript;return!o||o(r.evaluate(i))}],upcase:[ir,[ir],(i,[r])=>r.evaluate(i).toUpperCase()],downcase:[ir,[ir],(i,[r])=>r.evaluate(i).toLowerCase()],concat:[ir,io(rr),(i,r)=>r.map(o=>Oc(o.evaluate(i))).join("")],"resolved-locale":[ir,[Zi],(i,[r])=>r.evaluate(i).resolvedLocale()]});var Wc=x0;function w0(i){return{result:"success",value:i}}function Bs(i){return{result:"error",value:i}}function Al(i){return i["property-type"]==="data-driven"}function oh(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function ah(i){return!!i.expression&&i.expression.interpolated}function pr(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":i===null?"null":typeof i}function Gc(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function E0(i){return i}function sh(i,r){const o=r.type==="color",c=i.stops&&typeof i.stops[0][0]=="object",p=c||!(c||i.property!==void 0),m=i.type||(ah(r)?"exponential":"interval");if(o&&((i=xa({},i)).stops&&(i.stops=i.stops.map(S=>[S[0],fn.parse(S[1])])),i.default=fn.parse(i.default?i.default:r.default)),i.colorSpace&&i.colorSpace!=="rgb"&&!vp[i.colorSpace])throw new Error(`Unknown color space: ${i.colorSpace}`);let y,x,E;if(m==="exponential")y=Ia;else if(m==="interval")y=lh;else if(m==="categorical"){y=S0,x=Object.create(null);for(const S of i.stops)x[S[0]]=S[1];E=typeof i.stops[0][0]}else{if(m!=="identity")throw new Error(`Unknown function type "${m}"`);y=T0}if(c){const S={},k=[];for(let $=0;$$[0]),evaluate:({zoom:$},G)=>Ia({stops:M,base:i.base},r,$).evaluate($,G)}}if(p){const S=m==="exponential"?{name:"exponential",base:i.base!==void 0?i.base:1}:null;return{kind:"camera",interpolationType:S,interpolationFactor:Yo.interpolationFactor.bind(void 0,S),zoomStops:i.stops.map(k=>k[0]),evaluate:({zoom:k})=>y(i,r,k,x,E)}}return{kind:"source",evaluate(S,k){const M=k&&k.properties?k.properties[i.property]:void 0;return M===void 0?Il(i.default,r.default):y(i,r,M,x,E)}}}function Il(i,r,o){return i!==void 0?i:r!==void 0?r:o!==void 0?o:void 0}function S0(i,r,o,c,p){return Il(typeof o===p?c[o]:void 0,i.default,r.default)}function lh(i,r,o){if(pr(o)!=="number")return Il(i.default,r.default);const c=i.stops.length;if(c===1||o<=i.stops[0][0])return i.stops[0][1];if(o>=i.stops[c-1][0])return i.stops[c-1][1];const p=Xu(i.stops.map(m=>m[0]),o);return i.stops[p][1]}function Ia(i,r,o){const c=i.base!==void 0?i.base:1;if(pr(o)!=="number")return Il(i.default,r.default);const p=i.stops.length;if(p===1||o<=i.stops[0][0])return i.stops[0][1];if(o>=i.stops[p-1][0])return i.stops[p-1][1];const m=Xu(i.stops.map(k=>k[0]),o),y=function(k,M,O,$){const G=$-O,K=k-O;return G===0?0:M===1?K/G:(Math.pow(M,K)-1)/(Math.pow(M,G)-1)}(o,c,i.stops[m][0],i.stops[m+1][0]),x=i.stops[m][1],E=i.stops[m+1][1];let S=Nc[r.type]||E0;if(i.colorSpace&&i.colorSpace!=="rgb"){const k=vp[i.colorSpace];S=(M,O)=>k.reverse(k.interpolate(k.forward(M),k.forward(O),y))}return typeof x.evaluate=="function"?{evaluate(...k){const M=x.evaluate.apply(void 0,k),O=E.evaluate.apply(void 0,k);if(M!==void 0&&O!==void 0)return S(M,O,y)}}:S(x,E,y)}function T0(i,r,o){return r.type==="color"?o=fn.parse(o):r.type==="formatted"?o=ki.fromString(o.toString()):r.type==="resolvedImage"?o=no.fromString(o.toString()):pr(o)===r.type||r.type==="enum"&&r.values[o]||(o=void 0),Il(o,i.default,r.default)}class ch{constructor(r,o){this.expression=r,this._warningHistory={},this._evaluator=new op,this._defaultValue=o?function(c){return c.type==="color"&&(Gc(c.default)||Array.isArray(c.default))?new fn(0,0,0,0):c.type==="color"?fn.parse(c.default)||null:c.default===void 0?null:c.default}(o):null,this._enumValues=o&&o.type==="enum"?o.values:null}evaluateWithoutErrorHandling(r,o,c,p,m,y,x,E){return this._evaluator.globals=r,this._evaluator.feature=o,this._evaluator.featureState=c,this._evaluator.canonical=p||null,this._evaluator.availableImages=m||null,this._evaluator.formattedSection=y,this._evaluator.featureTileCoord=x||null,this._evaluator.featureDistanceData=E||null,this.expression.evaluate(this._evaluator)}evaluate(r,o,c,p,m,y,x,E){this._evaluator.globals=r,this._evaluator.feature=o||null,this._evaluator.featureState=c||null,this._evaluator.canonical=p||null,this._evaluator.availableImages=m||null,this._evaluator.formattedSection=y||null,this._evaluator.featureTileCoord=x||null,this._evaluator.featureDistanceData=E||null;try{const S=this.expression.evaluate(this._evaluator);if(S==null||typeof S=="number"&&S!=S)return this._defaultValue;if(this._enumValues&&!(S in this._enumValues))throw new Jn(`Expected value to be one of ${Object.keys(this._enumValues).map(k=>JSON.stringify(k)).join(", ")}, but found ${JSON.stringify(S)} instead.`);return S}catch(S){return this._warningHistory[S.message]||(this._warningHistory[S.message]=!0,typeof console<"u"&&console.warn(S.message)),this._defaultValue}}}function Cl(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in Wc}function kl(i,r){const o=new hp(Wc,[],r?function(p){const m={color:qi,string:ir,number:bt,enum:ir,boolean:tr,formatted:kc,resolvedImage:zs};return p.type==="array"?ro(m[p.value]||rr,p.length):m[p.type]}(r):void 0),c=o.parse(i,void 0,void 0,void 0,r&&r.type==="string"?{typeAnnotation:"coerce"}:void 0);return c?w0(new ch(c,r)):Bs(o.errors)}class Ap{constructor(r,o){this.kind=r,this._styleExpression=o,this.isStateDependent=r!=="constant"&&!Ta(o.expression)}evaluateWithoutErrorHandling(r,o,c,p,m,y){return this._styleExpression.evaluateWithoutErrorHandling(r,o,c,p,m,y)}evaluate(r,o,c,p,m,y){return this._styleExpression.evaluate(r,o,c,p,m,y)}}class Hc{constructor(r,o,c,p){this.kind=r,this.zoomStops=c,this._styleExpression=o,this.isStateDependent=r!=="camera"&&!Ta(o.expression),this.interpolationType=p}evaluateWithoutErrorHandling(r,o,c,p,m,y){return this._styleExpression.evaluateWithoutErrorHandling(r,o,c,p,m,y)}evaluate(r,o,c,p,m,y){return this._styleExpression.evaluate(r,o,c,p,m,y)}interpolationFactor(r,o,c){return this.interpolationType?Yo.interpolationFactor(this.interpolationType,r,o,c):0}}function qc(i,r){if((i=kl(i,r)).result==="error")return i;const o=i.value.expression,c=wl(o);if(!c&&!Al(r))return Bs([new Ko("","data expressions not supported")]);const p=Fs(o,["zoom","pitch","distance-from-center"]);if(!p&&!oh(r))return Bs([new Ko("","zoom expressions not supported")]);const m=hh(o);return m||p?m instanceof Ko?Bs([m]):m instanceof Yo&&!ah(r)?Bs([new Ko("",'"interpolate" expressions cannot be used with this property')]):w0(m?new Hc(c?"camera":"composite",i.value,m.labels,m instanceof Yo?m.interpolation:void 0):new Ap(c?"constant":"source",i.value)):Bs([new Ko("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class uh{constructor(r,o){this._parameters=r,this._specification=o,xa(this,sh(this._parameters,this._specification))}static deserialize(r){return new uh(r._parameters,r._specification)}static serialize(r){return{_parameters:r._parameters,_specification:r._specification}}}function hh(i){let r=null;if(i instanceof f0)r=hh(i.result);else if(i instanceof bp){for(const o of i.args)if(r=hh(o),r)break}else(i instanceof pp||i instanceof Yo)&&i.input instanceof Ea&&i.input.name==="zoom"&&(r=i);return r instanceof Ko||i.eachChild(o=>{const c=hh(o);c instanceof Ko?r=c:!r&&c?r=new Ko("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):r&&c&&r!==c&&(r=new Ko("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),r}class Et{constructor(r,o,c,p){this.message=(r?`${r}: `:"")+c,p&&(this.identifier=p),o!=null&&o.__line__&&(this.line=o.__line__)}}function Io(i){const r=i.key,o=i.value,c=i.valueSpec||{},p=i.objectElementValidators||{},m=i.style,y=i.styleSpec;let x=[];const E=pr(o);if(E!=="object")return[new Et(r,o,`object expected, ${E} found`)];for(const S in o){const k=S.split(".")[0];let M;p[k]?M=p[k]:c[k]?M=ci:p["*"]?M=p["*"]:c["*"]&&(M=ci),M?x=x.concat(M({key:(r&&`${r}.`)+S,value:o[S],valueSpec:c[k]||c["*"],style:m,styleSpec:y,object:o,objectKey:S},o)):x.push(new Et(r,o[S],`unknown property "${S}"`))}for(const S in c)p[S]||c[S].required&&c[S].default===void 0&&o[S]===void 0&&x.push(new Et(r,o,`missing required property "${S}"`));return x}function A0(i){const r=i.value,o=i.valueSpec,c=i.style,p=i.styleSpec,m=i.key,y=i.arrayElementValidator||ci;if(pr(r)!=="array")return[new Et(m,r,`array expected, ${pr(r)} found`)];if(o.length&&r.length!==o.length)return[new Et(m,r,`array length ${o.length} expected, length ${r.length} found`)];if(o["min-length"]&&r.lengthm)return[new Et(r,o,`${o} is greater than the maximum value ${m}`)]}return[]}function Kc(i){const r=i.valueSpec,o=_n(i.value.type);let c,p,m,y={};const x=o!=="categorical"&&i.value.property===void 0,E=!x,S=pr(i.value.stops)==="array"&&pr(i.value.stops[0])==="array"&&pr(i.value.stops[0][0])==="object",k=Io({key:i.key,value:i.value,valueSpec:i.styleSpec.function,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{stops:function($){if(o==="identity")return[new Et($.key,$.value,'identity function may not have a "stops" property')];let G=[];const K=$.value;return G=G.concat(A0({key:$.key,value:K,valueSpec:$.valueSpec,style:$.style,styleSpec:$.styleSpec,arrayElementValidator:M})),pr(K)==="array"&&K.length===0&&G.push(new Et($.key,K,"array must have at least one stop")),G},default:function($){return ci({key:$.key,value:$.value,valueSpec:r,style:$.style,styleSpec:$.styleSpec})}}});return o==="identity"&&x&&k.push(new Et(i.key,i.value,'missing required property "property"')),o==="identity"||i.value.stops||k.push(new Et(i.key,i.value,'missing required property "stops"')),o==="exponential"&&i.valueSpec.expression&&!ah(i.valueSpec)&&k.push(new Et(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(E&&!Al(i.valueSpec)?k.push(new Et(i.key,i.value,"property functions not supported")):x&&!oh(i.valueSpec)&&k.push(new Et(i.key,i.value,"zoom functions not supported"))),o!=="categorical"&&!S||i.value.property!==void 0||k.push(new Et(i.key,i.value,'"property" property is required')),k;function M($){let G=[];const K=$.value,ee=$.key;if(pr(K)!=="array")return[new Et(ee,K,`array expected, ${pr(K)} found`)];if(K.length!==2)return[new Et(ee,K,`array length 2 expected, length ${K.length} found`)];if(S){if(pr(K[0])!=="object")return[new Et(ee,K,`object expected, ${pr(K[0])} found`)];if(K[0].zoom===void 0)return[new Et(ee,K,"object stop key must have zoom")];if(K[0].value===void 0)return[new Et(ee,K,"object stop key must have value")];const le=_n(K[0].zoom);if(typeof le!="number")return[new Et(ee,K[0].zoom,"stop zoom values must be numbers")];if(m&&m>le)return[new Et(ee,K[0].zoom,"stop zoom values must appear in ascending order")];le!==m&&(m=le,p=void 0,y={}),G=G.concat(Io({key:`${ee}[0]`,value:K[0],valueSpec:{zoom:{}},style:$.style,styleSpec:$.styleSpec,objectElementValidators:{zoom:Zc,value:O}}))}else G=G.concat(O({key:`${ee}[0]`,value:K[0],valueSpec:{},style:$.style,styleSpec:$.styleSpec},K));return Cl($n(K[1]))?G.concat([new Et(`${ee}[1]`,K[1],"expressions are not allowed in function stops.")]):G.concat(ci({key:`${ee}[1]`,value:K[1],valueSpec:r,style:$.style,styleSpec:$.styleSpec}))}function O($,G){const K=pr($.value),ee=_n($.value),le=$.value!==null?$.value:G;if(c){if(K!==c)return[new Et($.key,le,`${K} stop domain type must match previous stop domain type ${c}`)]}else c=K;if(K!=="number"&&K!=="string"&&K!=="boolean"&&typeof ee!="number"&&typeof ee!="string"&&typeof ee!="boolean")return[new Et($.key,le,"stop domain value must be a number, string, or boolean")];if(K!=="number"&&o!=="categorical"){let me=`number expected, ${K} found`;return Al(r)&&o===void 0&&(me+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Et($.key,le,me)]}return o!=="categorical"||K!=="number"||typeof ee=="number"&&isFinite(ee)&&Math.floor(ee)===ee?o!=="categorical"&&K==="number"&&typeof ee=="number"&&typeof p=="number"&&p!==void 0&&eenew Et(`${i.key}${c.key}`,i.value,c.message));const o=r.value.expression||r.value._styleExpression.expression;if(i.expressionContext==="property"&&i.propertyKey==="text-font"&&!o.outputDefined())return[new Et(i.key,i.value,`Invalid data expression for "${i.propertyKey}". Output values must be contained as literals within the expression.`)];if(i.expressionContext==="property"&&i.propertyType==="layout"&&!Ta(o))return[new Et(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if(i.expressionContext==="filter")return Xc(o,i);if(i.expressionContext&&i.expressionContext.indexOf("cluster")===0){if(!Fs(o,["zoom","feature-state"]))return[new Et(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(i.expressionContext==="cluster-initial"&&!wl(o))return[new Et(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Xc(i,r){const o=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(r.valueSpec&&r.valueSpec.expression)for(const p of r.valueSpec.expression.parameters)o.delete(p);if(o.size===0)return[];const c=[];return i instanceof Ea&&o.has(i.name)?[new Et(r.key,r.value,`["${i.name}"] expression is not supported in a filter for a ${r.object.type} layer with id: ${r.object.id}`)]:(i.eachChild(p=>{c.push(...Xc(p,r))}),c)}function dh(i){const r=i.key,o=i.value,c=i.valueSpec,p=[];return Array.isArray(c.values)?c.values.indexOf(_n(o))===-1&&p.push(new Et(r,o,`expected one of [${c.values.join(", ")}], ${JSON.stringify(o)} found`)):Object.keys(c.values).indexOf(_n(o))===-1&&p.push(new Et(r,o,`expected one of [${Object.keys(c.values).join(", ")}], ${JSON.stringify(o)} found`)),p}function Ip(i){if(i===!0||i===!1)return!0;if(!Array.isArray(i)||i.length===0)return!1;switch(i[0]){case"has":return i.length>=2&&i[1]!=="$id"&&i[1]!=="$type";case"in":return i.length>=3&&(typeof i[1]!="string"||Array.isArray(i[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return i.length!==3||Array.isArray(i[1])||Array.isArray(i[2]);case"any":case"all":for(const r of i.slice(1))if(!Ip(r)&&typeof r!="boolean")return!1;return!0;default:return!0}}function ph(i,r="fill"){if(i==null)return{filter:()=>!0,needGeometry:!1,needFeature:!1};Ip(i)||(i=Dl(i));const o=i;let c=!0;try{c=function(S){if(!Pl(S))return S;let k=$n(S);return fh(k),k=I0(k),k}(o)}catch{console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate. +This is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md +and paste the contents of this message in the report. +Thank you! +Filter Expression: +${JSON.stringify(o,null,2)} + `)}const p=Ge[`filter_${r}`],m=kl(c,p);let y=null;if(m.result==="error")throw new Error(m.value.map(S=>`${S.key}: ${S.message}`).join(", "));y=(S,k,M)=>m.value.evaluate(S,k,{},M);let x=null,E=null;if(c!==o){const S=kl(o,p);if(S.result==="error")throw new Error(S.value.map(k=>`${k.key}: ${k.message}`).join(", "));x=(k,M,O,$,G)=>S.value.evaluate(k,M,{},O,void 0,void 0,$,G),E=!wl(S.value.expression)}return{filter:y,dynamicFilter:x||void 0,needGeometry:C0(c),needFeature:!!E}}function I0(i){if(!Array.isArray(i))return i;const r=function(o){if(Cp.has(o[0])){for(let c=1;cI0(o))}function fh(i){let r=!1;const o=[];if(i[0]==="case"){for(let c=1;c",">=","<","<=","to-boolean"]);function lx(i,r){return ir?1:0}function C0(i){if(!Array.isArray(i))return!1;if(i[0]==="within")return!0;for(let r=1;r"||r==="<="||r===">="?kp(i[1],i[2],r):r==="any"?(o=i.slice(1),["any"].concat(o.map(Dl))):r==="all"?["all"].concat(i.slice(1).map(Dl)):r==="none"?["all"].concat(i.slice(1).map(Dl).map(mh)):r==="in"?Pp(i[1],i.slice(2)):r==="!in"?mh(Pp(i[1],i.slice(2))):r==="has"?Dp(i[1]):r==="!has"?mh(Dp(i[1])):r!=="within"||i;var o}function kp(i,r,o){switch(i){case"$type":return[`filter-type-${o}`,r];case"$id":return[`filter-id-${o}`,r];default:return[`filter-${o}`,i,r]}}function Pp(i,r){if(r.length===0)return!1;switch(i){case"$type":return["filter-type-in",["literal",r]];case"$id":return["filter-id-in",["literal",r]];default:return r.length>200&&!r.some(o=>typeof o!=typeof r[0])?["filter-in-large",i,["literal",r.sort(lx)]]:["filter-in-small",i,["literal",r]]}}function Dp(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function mh(i){return["!",i]}function Yc(i){return Ip($n(i.value))?Wn(xa({},i,{expressionContext:"filter",valueSpec:i.styleSpec[`filter_${i.layerType||"fill"}`]})):Qc(i)}function Qc(i){const r=i.value,o=i.key;if(pr(r)!=="array")return[new Et(o,r,`array expected, ${pr(r)} found`)];const c=i.styleSpec;let p,m=[];if(r.length<1)return[new Et(o,r,"filter array must have at least 1 element")];switch(m=m.concat(dh({key:`${o}[0]`,value:r[0],valueSpec:c.filter_operator,style:i.style,styleSpec:i.styleSpec})),_n(r[0])){case"<":case"<=":case">":case">=":r.length>=2&&_n(r[1])==="$type"&&m.push(new Et(o,r,`"$type" cannot be use with operator "${r[0]}"`));case"==":case"!=":r.length!==3&&m.push(new Et(o,r,`filter array for operator "${r[0]}" must have 3 elements`));case"in":case"!in":r.length>=2&&(p=pr(r[1]),p!=="string"&&m.push(new Et(`${o}[1]`,r[1],`string expected, ${p} found`)));for(let y=2;y{S in o&&r.push(new Et(c,o[S],`"${S}" is prohibited for ref layers`))}),p.layers.forEach(S=>{_n(S.id)===x&&(E=S)}),E?E.ref?r.push(new Et(c,o.ref,"ref cannot reference another ref layer")):y=_n(E.type):typeof x=="string"&&r.push(new Et(c,o.ref,`ref layer "${x}" not found`))}else if(y!=="background"&&y!=="sky")if(o.source){const E=p.sources&&p.sources[o.source],S=E&&_n(E.type);E?S==="vector"&&y==="raster"?r.push(new Et(c,o.source,`layer "${o.id}" requires a raster source`)):S==="raster"&&y!=="raster"?r.push(new Et(c,o.source,`layer "${o.id}" requires a vector source`)):S!=="vector"||o["source-layer"]?S==="raster-dem"&&y!=="hillshade"?r.push(new Et(c,o.source,"raster-dem source can only be used with layer type 'hillshade'.")):y!=="line"||!o.paint||!o.paint["line-gradient"]&&!o.paint["line-trim-offset"]||S==="geojson"&&E.lineMetrics||r.push(new Et(c,o,`layer "${o.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):r.push(new Et(c,o,`layer "${o.id}" must specify a "source-layer"`)):r.push(new Et(c,o.source,`source "${o.source}" not found`))}else r.push(new Et(c,o,'missing required property "source"'));return r=r.concat(Io({key:c,value:o,valueSpec:m.layer,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":()=>[],type:()=>ci({key:`${c}.type`,value:o.type,valueSpec:m.layer.type,style:i.style,styleSpec:i.styleSpec,object:o,objectKey:"type"}),filter:E=>Yc(xa({layerType:y},E)),layout:E=>Io({layer:o,key:E.key,value:E.value,valueSpec:{},style:E.style,styleSpec:E.styleSpec,objectElementValidators:{"*":S=>zp(xa({layerType:y},S))}}),paint:E=>Io({layer:o,key:E.key,value:E.value,valueSpec:{},style:E.style,styleSpec:E.styleSpec,objectElementValidators:{"*":S=>k0(xa({layerType:y},S))}})}})),r}function ts(i){const r=i.value,o=i.key,c=pr(r);return c!=="string"?[new Et(o,r,`string expected, ${c} found`)]:[]}const D0={promoteId:function({key:i,value:r}){if(pr(r)==="string")return ts({key:i,value:r});{const o=[];for(const c in r)o.push(...ts({key:`${i}.${c}`,value:r[c]}));return o}}};function M0(i){const r=i.value,o=i.key,c=i.styleSpec,p=i.style;if(!r.type)return[new Et(o,r,'"type" is required')];const m=_n(r.type);let y;switch(m){case"vector":case"raster":case"raster-dem":return y=Io({key:o,value:r,valueSpec:c[`source_${m.replace("-","_")}`],style:i.style,styleSpec:c,objectElementValidators:D0}),y;case"geojson":if(y=Io({key:o,value:r,valueSpec:c.source_geojson,style:p,styleSpec:c,objectElementValidators:D0}),r.cluster)for(const x in r.clusterProperties){const[E,S]=r.clusterProperties[x],k=typeof E=="string"?[E,["accumulated"],["get",x]]:E;y.push(...Wn({key:`${o}.${x}.map`,value:S,expressionContext:"cluster-map"})),y.push(...Wn({key:`${o}.${x}.reduce`,value:k,expressionContext:"cluster-reduce"}))}return y;case"video":return Io({key:o,value:r,valueSpec:c.source_video,style:p,styleSpec:c});case"image":return Io({key:o,value:r,valueSpec:c.source_image,style:p,styleSpec:c});case"canvas":return[new Et(o,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return dh({key:`${o}.type`,value:r.type,valueSpec:{values:cx(c)},style:p,styleSpec:c})}}function cx(i){return i.source.reduce((r,o)=>{const c=i[o];return c.type.type==="enum"&&(r=r.concat(Object.keys(c.type.values))),r},[])}function z0(i){const r=i.value,o=i.styleSpec,c=o.light,p=i.style;let m=[];const y=pr(r);if(r===void 0)return m;if(y!=="object")return m=m.concat([new Et("light",r,`object expected, ${y} found`)]),m;for(const x in r){const E=x.match(/^(.*)-transition$/);m=m.concat(E&&c[E[1]]&&c[E[1]].transition?ci({key:x,value:r[x],valueSpec:o.transition,style:p,styleSpec:o}):c[x]?ci({key:x,value:r[x],valueSpec:c[x],style:p,styleSpec:o}):[new Et(x,r[x],`unknown property "${x}"`)])}return m}function Rp(i){const r=i.value,o=i.key,c=i.style,p=i.styleSpec,m=p.terrain;let y=[];const x=pr(r);if(r===void 0)return y;if(x!=="object")return y=y.concat([new Et("terrain",r,`object expected, ${x} found`)]),y;for(const E in r){const S=E.match(/^(.*)-transition$/);y=y.concat(S&&m[S[1]]&&m[S[1]].transition?ci({key:E,value:r[E],valueSpec:p.transition,style:c,styleSpec:p}):m[E]?ci({key:E,value:r[E],valueSpec:m[E],style:c,styleSpec:p}):[new Et(E,r[E],`unknown property "${E}"`)])}if(r.source){const E=c.sources&&c.sources[r.source],S=E&&_n(E.type);E?S!=="raster-dem"&&y.push(new Et(o,r.source,`terrain cannot be used with a source of type ${String(S)}, it only be used with a "raster-dem" source type`)):y.push(new Et(o,r.source,`source "${r.source}" not found`))}else y.push(new Et(o,r,'terrain is missing required property "source"'));return y}function R0(i){const r=i.value,o=i.style,c=i.styleSpec,p=c.fog;let m=[];const y=pr(r);if(r===void 0)return m;if(y!=="object")return m=m.concat([new Et("fog",r,`object expected, ${y} found`)]),m;for(const x in r){const E=x.match(/^(.*)-transition$/);m=m.concat(E&&p[E[1]]&&p[E[1]].transition?ci({key:x,value:r[x],valueSpec:c.transition,style:o,styleSpec:c}):p[x]?ci({key:x,value:r[x],valueSpec:p[x],style:o,styleSpec:c}):[new Et(x,r[x],`unknown property "${x}"`)])}return m}const O0={"*":()=>[],array:A0,boolean:function(i){const r=i.value,o=i.key,c=pr(r);return c!=="boolean"?[new Et(o,r,`boolean expected, ${c} found`)]:[]},number:Zc,color:function(i){const r=i.key,o=i.value,c=pr(o);return c!=="string"?[new Et(r,o,`color expected, ${c} found`)]:Qd(o)===null?[new Et(r,o,`color expected, "${o}" found`)]:[]},enum:dh,filter:Yc,function:Kc,layer:P0,object:Io,source:M0,light:z0,terrain:Rp,fog:R0,string:ts,formatted:function(i){return ts(i).length===0?[]:Wn(i)},resolvedImage:function(i){return ts(i).length===0?[]:Wn(i)},projection:function(i){const r=i.value,o=i.styleSpec,c=o.projection,p=i.style;let m=[];const y=pr(r);if(y==="object")for(const x in r)m=m.concat(ci({key:x,value:r[x],valueSpec:c[x],style:p,styleSpec:o}));else y!=="string"&&(m=m.concat([new Et("projection",r,`object or string expected, ${y} found`)]));return m}};function ci(i){const r=i.value,o=i.valueSpec,c=i.styleSpec;return o.expression&&Gc(_n(r))?Kc(i):o.expression&&Cl($n(r))?Wn(i):o.type&&O0[o.type]?O0[o.type](i):Io(xa({},i,{valueSpec:o.type?c[o.type]:o}))}function ux(i){const r=i.value,o=i.key,c=ts(i);return c.length||(r.indexOf("{fontstack}")===-1&&c.push(new Et(o,r,'"glyphs" url must include a "{fontstack}" token')),r.indexOf("{range}")===-1&&c.push(new Et(o,r,'"glyphs" url must include a "{range}" token'))),c}function F0(i,r=Ge){return oo(ci({key:"",value:i,valueSpec:r.$root,styleSpec:r,style:i,objectElementValidators:{glyphs:ux,"*":()=>[]}}))}const hx=i=>oo(k0(i)),dx=i=>oo(zp(i));function oo(i){return i.slice().sort((r,o)=>r.line&&o.line?r.line-o.line:0)}function L0(i,r){let o=!1;if(r&&r.length)for(const c of r)i.fire(new va(new Error(c.message))),o=!0;return o}var px=Qo,Co=3;function Qo(i,r,o){var c=this.cells=[];if(i instanceof ArrayBuffer){this.arrayBuffer=i;var p=new Int32Array(this.arrayBuffer);i=p[0],this.d=(r=p[1])+2*(o=p[2]);for(var m=0;m=k[$+0]&&c>=k[$+1])?(y[O]=!0,m.push(S[O])):y[O]=!1}}},Qo.prototype._forEachCell=function(i,r,o,c,p,m,y,x){for(var E=this._convertToCellCoord(i),S=this._convertToCellCoord(r),k=this._convertToCellCoord(o),M=this._convertToCellCoord(c),O=E;O<=k;O++)for(var $=S;$<=M;$++){var G=this.d*$+O;if((!x||x(this._convertFromCellCoord(O),this._convertFromCellCoord($),this._convertFromCellCoord(O+1),this._convertFromCellCoord($+1)))&&p.call(this,i,r,o,c,G,m,y,x))return}},Qo.prototype._convertFromCellCoord=function(i){return(i-this.padding)/this.scale},Qo.prototype._convertToCellCoord=function(i){return Math.max(0,Math.min(this.d-1,Math.floor(i*this.scale)+this.padding))},Qo.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var i=this.cells,r=Co+this.cells.length+1+1,o=0,c=0;c=0||(p[m]=Ml(i[m],r)));i instanceof Error&&(p.message=i.message)}if(p.$name)throw new Error("$name property is reserved for worker serialization logic.");return c!=="Object"&&(p.$name=c),p}throw new Error("can't serialize object of type "+typeof i)}function Us(i){if(i==null||typeof i=="boolean"||typeof i=="number"||typeof i=="string"||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp||Op(i)||Fp(i)||ArrayBuffer.isView(i)||i instanceof w.ImageData)return i;if(Array.isArray(i))return i.map(Us);if(typeof i=="object"){const r=i.$name||"Object",{klass:o}=gh[r];if(!o)throw new Error(`can't deserialize unregistered class ${r}`);if(o.deserialize)return o.deserialize(i);const c=Object.create(o.prototype);for(const p of Object.keys(i))p!=="$name"&&(c[p]=Us(i[p]));return c}throw new Error("can't deserialize object of type "+typeof i)}const xt={"Latin-1 Supplement":i=>i>=128&&i<=255,Arabic:i=>i>=1536&&i<=1791,"Arabic Supplement":i=>i>=1872&&i<=1919,"Arabic Extended-A":i=>i>=2208&&i<=2303,"Hangul Jamo":i=>i>=4352&&i<=4607,"Unified Canadian Aboriginal Syllabics":i=>i>=5120&&i<=5759,Khmer:i=>i>=6016&&i<=6143,"Unified Canadian Aboriginal Syllabics Extended":i=>i>=6320&&i<=6399,"General Punctuation":i=>i>=8192&&i<=8303,"Letterlike Symbols":i=>i>=8448&&i<=8527,"Number Forms":i=>i>=8528&&i<=8591,"Miscellaneous Technical":i=>i>=8960&&i<=9215,"Control Pictures":i=>i>=9216&&i<=9279,"Optical Character Recognition":i=>i>=9280&&i<=9311,"Enclosed Alphanumerics":i=>i>=9312&&i<=9471,"Geometric Shapes":i=>i>=9632&&i<=9727,"Miscellaneous Symbols":i=>i>=9728&&i<=9983,"Miscellaneous Symbols and Arrows":i=>i>=11008&&i<=11263,"CJK Radicals Supplement":i=>i>=11904&&i<=12031,"Kangxi Radicals":i=>i>=12032&&i<=12255,"Ideographic Description Characters":i=>i>=12272&&i<=12287,"CJK Symbols and Punctuation":i=>i>=12288&&i<=12351,Hiragana:i=>i>=12352&&i<=12447,Katakana:i=>i>=12448&&i<=12543,Bopomofo:i=>i>=12544&&i<=12591,"Hangul Compatibility Jamo":i=>i>=12592&&i<=12687,Kanbun:i=>i>=12688&&i<=12703,"Bopomofo Extended":i=>i>=12704&&i<=12735,"CJK Strokes":i=>i>=12736&&i<=12783,"Katakana Phonetic Extensions":i=>i>=12784&&i<=12799,"Enclosed CJK Letters and Months":i=>i>=12800&&i<=13055,"CJK Compatibility":i=>i>=13056&&i<=13311,"CJK Unified Ideographs Extension A":i=>i>=13312&&i<=19903,"Yijing Hexagram Symbols":i=>i>=19904&&i<=19967,"CJK Unified Ideographs":i=>i>=19968&&i<=40959,"Yi Syllables":i=>i>=40960&&i<=42127,"Yi Radicals":i=>i>=42128&&i<=42191,"Hangul Jamo Extended-A":i=>i>=43360&&i<=43391,"Hangul Syllables":i=>i>=44032&&i<=55215,"Hangul Jamo Extended-B":i=>i>=55216&&i<=55295,"Private Use Area":i=>i>=57344&&i<=63743,"CJK Compatibility Ideographs":i=>i>=63744&&i<=64255,"Arabic Presentation Forms-A":i=>i>=64336&&i<=65023,"Vertical Forms":i=>i>=65040&&i<=65055,"CJK Compatibility Forms":i=>i>=65072&&i<=65103,"Small Form Variants":i=>i>=65104&&i<=65135,"Arabic Presentation Forms-B":i=>i>=65136&&i<=65279,"Halfwidth and Fullwidth Forms":i=>i>=65280&&i<=65519};function Lp(i){for(const r of i)if(Bp(r.charCodeAt(0)))return!0;return!1}function fx(i){for(const r of i)if(!B0(r.charCodeAt(0)))return!1;return!0}function B0(i){return!(xt.Arabic(i)||xt["Arabic Supplement"](i)||xt["Arabic Extended-A"](i)||xt["Arabic Presentation Forms-A"](i)||xt["Arabic Presentation Forms-B"](i))}function Bp(i){return!(i!==746&&i!==747&&(i<4352||!(xt["Bopomofo Extended"](i)||xt.Bopomofo(i)||xt["CJK Compatibility Forms"](i)&&!(i>=65097&&i<=65103)||xt["CJK Compatibility Ideographs"](i)||xt["CJK Compatibility"](i)||xt["CJK Radicals Supplement"](i)||xt["CJK Strokes"](i)||!(!xt["CJK Symbols and Punctuation"](i)||i>=12296&&i<=12305||i>=12308&&i<=12319||i===12336)||xt["CJK Unified Ideographs Extension A"](i)||xt["CJK Unified Ideographs"](i)||xt["Enclosed CJK Letters and Months"](i)||xt["Hangul Compatibility Jamo"](i)||xt["Hangul Jamo Extended-A"](i)||xt["Hangul Jamo Extended-B"](i)||xt["Hangul Jamo"](i)||xt["Hangul Syllables"](i)||xt.Hiragana(i)||xt["Ideographic Description Characters"](i)||xt.Kanbun(i)||xt["Kangxi Radicals"](i)||xt["Katakana Phonetic Extensions"](i)||xt.Katakana(i)&&i!==12540||!(!xt["Halfwidth and Fullwidth Forms"](i)||i===65288||i===65289||i===65293||i>=65306&&i<=65310||i===65339||i===65341||i===65343||i>=65371&&i<=65503||i===65507||i>=65512&&i<=65519)||!(!xt["Small Form Variants"](i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||xt["Unified Canadian Aboriginal Syllabics"](i)||xt["Unified Canadian Aboriginal Syllabics Extended"](i)||xt["Vertical Forms"](i)||xt["Yijing Hexagram Symbols"](i)||xt["Yi Syllables"](i)||xt["Yi Radicals"](i))))}function N0(i){return!(Bp(i)||function(r){return!!(xt["Latin-1 Supplement"](r)&&(r===167||r===169||r===174||r===177||r===188||r===189||r===190||r===215||r===247)||xt["General Punctuation"](r)&&(r===8214||r===8224||r===8225||r===8240||r===8241||r===8251||r===8252||r===8258||r===8263||r===8264||r===8265||r===8273)||xt["Letterlike Symbols"](r)||xt["Number Forms"](r)||xt["Miscellaneous Technical"](r)&&(r>=8960&&r<=8967||r>=8972&&r<=8991||r>=8996&&r<=9e3||r===9003||r>=9085&&r<=9114||r>=9150&&r<=9165||r===9167||r>=9169&&r<=9179||r>=9186&&r<=9215)||xt["Control Pictures"](r)&&r!==9251||xt["Optical Character Recognition"](r)||xt["Enclosed Alphanumerics"](r)||xt["Geometric Shapes"](r)||xt["Miscellaneous Symbols"](r)&&!(r>=9754&&r<=9759)||xt["Miscellaneous Symbols and Arrows"](r)&&(r>=11026&&r<=11055||r>=11088&&r<=11097||r>=11192&&r<=11243)||xt["CJK Symbols and Punctuation"](r)||xt.Katakana(r)||xt["Private Use Area"](r)||xt["CJK Compatibility Forms"](r)||xt["Small Form Variants"](r)||xt["Halfwidth and Fullwidth Forms"](r)||r===8734||r===8756||r===8757||r>=9984&&r<=10087||r>=10102&&r<=10131||r===65532||r===65533)}(i))}function U0(i){return i>=1424&&i<=2303||xt["Arabic Presentation Forms-A"](i)||xt["Arabic Presentation Forms-B"](i)}function mx(i,r){return!(!r&&U0(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||xt.Khmer(i))}function gx(i){for(const r of i)if(U0(r.charCodeAt(0)))return!0;return!1}const Np="deferred",Up="loading",jp="loaded";let zl=null,f="unavailable",s=null;const h=function(i){i&&typeof i=="string"&&i.indexOf("NetworkError")>-1&&(f="error"),zl&&zl(i)};function g(){v.fire(new Ms("pluginStateChange",{pluginStatus:f,pluginURL:s}))}const v=new Cc,b=function(){return f},A=function(){if(f!==Np||!s)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");f=Up,g(),s&&Ja({url:s},i=>{i?h(i):(f=jp,g())})},I={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>f===jp||I.applyArabicShaping!=null,isLoading:()=>f===Up,setState(i){f=i.pluginStatus,s=i.pluginURL},isParsed:()=>I.applyArabicShaping!=null&&I.processBidirectionalText!=null&&I.processStyledBidirectionalText!=null,getPluginURL:()=>s};class D{constructor(r,o){this.zoom=r,o?(this.now=o.now,this.fadeDuration=o.fadeDuration,this.transition=o.transition,this.pitch=o.pitch):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0)}isSupportedScript(r){return function(o,c){for(const p of o)if(!mx(p.charCodeAt(0),c))return!1;return!0}(r,I.isLoaded())}}class N{constructor(r,o){this.property=r,this.value=o,this.expression=function(c,p){if(Gc(c))return new uh(c,p);if(Cl(c)){const m=qc(c,p);if(m.result==="error")throw new Error(m.value.map(y=>`${y.key}: ${y.message}`).join(", "));return m.value}{let m=c;return typeof c=="string"&&p.type==="color"&&(m=fn.parse(c)),{kind:"constant",evaluate:()=>m}}}(o===void 0?r.specification.default:o,r.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(r,o,c){return this.property.possiblyEvaluate(this,r,o,c)}}class B{constructor(r){this.property=r,this.value=new N(r,void 0)}transitioned(r,o){return new J(this.property,this.value,o,nt({},r.transition,this.transition),r.now)}untransitioned(){return new J(this.property,this.value,null,{},0)}}class q{constructor(r){this._properties=r,this._values=Object.create(r.defaultTransitionablePropertyValues)}getValue(r){return qr(this._values[r].value.value)}setValue(r,o){this._values.hasOwnProperty(r)||(this._values[r]=new B(this._values[r].property)),this._values[r].value=new N(this._values[r].property,o===null?void 0:qr(o))}getTransition(r){return qr(this._values[r].transition)}setTransition(r,o){this._values.hasOwnProperty(r)||(this._values[r]=new B(this._values[r].property)),this._values[r].transition=qr(o)||void 0}serialize(){const r={};for(const o of Object.keys(this._values)){const c=this.getValue(o);c!==void 0&&(r[o]=c);const p=this.getTransition(o);p!==void 0&&(r[`${o}-transition`]=p)}return r}transitioned(r,o){const c=new ne(this._properties);for(const p of Object.keys(this._values))c._values[p]=this._values[p].transitioned(r,o._values[p]);return c}untransitioned(){const r=new ne(this._properties);for(const o of Object.keys(this._values))r._values[o]=this._values[o].untransitioned();return r}}class J{constructor(r,o,c,p,m){const y=p.delay||0,x=p.duration||0;m=m||0,this.property=r,this.value=o,this.begin=m+y,this.end=this.begin+x,r.specification.transition&&(p.delay||p.duration)&&(this.prior=c)}possiblyEvaluate(r,o,c){const p=r.now||0,m=this.value.possiblyEvaluate(r,o,c),y=this.prior;if(y){if(p>this.end)return this.prior=null,m;if(this.value.isDataDriven())return this.prior=null,m;if(pthis.capacity){this.capacity=Math.max(r,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const o=this.uint8;this._refreshViews(),o&&this.uint8.set(o)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}destroy(){this.int8=this.uint8=this.int16=this.uint16=this.int32=this.uint32=this.float32=null,this.arrayBuffer=null}}function Ie(i,r=1){let o=0,c=0;return{members:i.map(p=>{const m=Se[p.type].BYTES_PER_ELEMENT,y=o=Re(o,Math.max(r,m)),x=p.components||1;return c=Math.max(c,m),o+=m*x,{name:p.name,type:p.type,components:x,offset:y}}),size:Re(o,Math.max(c,r)),alignment:r}}function Re(i,r){return Math.ceil(i/r)*r}class st extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,o){const c=this.length;return this.resize(c+1),this.emplace(c,r,o)}emplace(r,o,c){const p=2*r;return this.int16[p+0]=o,this.int16[p+1]=c,r}}st.prototype.bytesPerElement=4,At(st,"StructArrayLayout2i4");class De extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,o,c){const p=this.length;return this.resize(p+1),this.emplace(p,r,o,c)}emplace(r,o,c,p){const m=3*r;return this.int16[m+0]=o,this.int16[m+1]=c,this.int16[m+2]=p,r}}De.prototype.bytesPerElement=6,At(De,"StructArrayLayout3i6");class Ke extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,o,c,p){const m=this.length;return this.resize(m+1),this.emplace(m,r,o,c,p)}emplace(r,o,c,p,m){const y=4*r;return this.int16[y+0]=o,this.int16[y+1]=c,this.int16[y+2]=p,this.int16[y+3]=m,r}}Ke.prototype.bytesPerElement=8,At(Ke,"StructArrayLayout4i8");class Ne extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,o,c,p,m,y,x){const E=this.length;return this.resize(E+1),this.emplace(E,r,o,c,p,m,y,x)}emplace(r,o,c,p,m,y,x,E){const S=6*r,k=12*r,M=3*r;return this.int16[S+0]=o,this.int16[S+1]=c,this.uint8[k+4]=p,this.uint8[k+5]=m,this.uint8[k+6]=y,this.uint8[k+7]=x,this.float32[M+2]=E,r}}Ne.prototype.bytesPerElement=12,At(Ne,"StructArrayLayout2i4ub1f12");class at extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,o,c,p){const m=this.length;return this.resize(m+1),this.emplace(m,r,o,c,p)}emplace(r,o,c,p,m){const y=4*r;return this.float32[y+0]=o,this.float32[y+1]=c,this.float32[y+2]=p,this.float32[y+3]=m,r}}at.prototype.bytesPerElement=16,At(at,"StructArrayLayout4f16");class ze extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,o,c,p,m){const y=this.length;return this.resize(y+1),this.emplace(y,r,o,c,p,m)}emplace(r,o,c,p,m,y){const x=6*r,E=3*r;return this.uint16[x+0]=o,this.uint16[x+1]=c,this.uint16[x+2]=p,this.uint16[x+3]=m,this.float32[E+2]=y,r}}ze.prototype.bytesPerElement=12,At(ze,"StructArrayLayout4ui1f12");class Ze extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r,o,c,p){const m=this.length;return this.resize(m+1),this.emplace(m,r,o,c,p)}emplace(r,o,c,p,m){const y=4*r;return this.uint16[y+0]=o,this.uint16[y+1]=c,this.uint16[y+2]=p,this.uint16[y+3]=m,r}}Ze.prototype.bytesPerElement=8,At(Ze,"StructArrayLayout4ui8");class ut extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,o,c,p,m,y){const x=this.length;return this.resize(x+1),this.emplace(x,r,o,c,p,m,y)}emplace(r,o,c,p,m,y,x){const E=6*r;return this.int16[E+0]=o,this.int16[E+1]=c,this.int16[E+2]=p,this.int16[E+3]=m,this.int16[E+4]=y,this.int16[E+5]=x,r}}ut.prototype.bytesPerElement=12,At(ut,"StructArrayLayout6i12");class tt extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r,o,c,p,m,y,x,E,S,k,M,O){const $=this.length;return this.resize($+1),this.emplace($,r,o,c,p,m,y,x,E,S,k,M,O)}emplace(r,o,c,p,m,y,x,E,S,k,M,O,$){const G=12*r;return this.int16[G+0]=o,this.int16[G+1]=c,this.int16[G+2]=p,this.int16[G+3]=m,this.uint16[G+4]=y,this.uint16[G+5]=x,this.uint16[G+6]=E,this.uint16[G+7]=S,this.int16[G+8]=k,this.int16[G+9]=M,this.int16[G+10]=O,this.int16[G+11]=$,r}}tt.prototype.bytesPerElement=24,At(tt,"StructArrayLayout4i4ui4i24");class ht extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,o,c,p,m,y){const x=this.length;return this.resize(x+1),this.emplace(x,r,o,c,p,m,y)}emplace(r,o,c,p,m,y,x){const E=10*r,S=5*r;return this.int16[E+0]=o,this.int16[E+1]=c,this.int16[E+2]=p,this.float32[S+2]=m,this.float32[S+3]=y,this.float32[S+4]=x,r}}ht.prototype.bytesPerElement=20,At(ht,"StructArrayLayout3i3f20");class Mt extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(r){const o=this.length;return this.resize(o+1),this.emplace(o,r)}emplace(r,o){return this.uint32[1*r+0]=o,r}}Mt.prototype.bytesPerElement=4,At(Mt,"StructArrayLayout1ul4");class $t extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r,o,c,p,m,y,x,E,S,k,M,O,$){const G=this.length;return this.resize(G+1),this.emplace(G,r,o,c,p,m,y,x,E,S,k,M,O,$)}emplace(r,o,c,p,m,y,x,E,S,k,M,O,$,G){const K=20*r,ee=10*r;return this.int16[K+0]=o,this.int16[K+1]=c,this.int16[K+2]=p,this.int16[K+3]=m,this.int16[K+4]=y,this.float32[ee+3]=x,this.float32[ee+4]=E,this.float32[ee+5]=S,this.float32[ee+6]=k,this.int16[K+14]=M,this.uint32[ee+8]=O,this.uint16[K+18]=$,this.uint16[K+19]=G,r}}$t.prototype.bytesPerElement=40,At($t,"StructArrayLayout5i4f1i1ul2ui40");class It extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,o,c,p,m,y,x){const E=this.length;return this.resize(E+1),this.emplace(E,r,o,c,p,m,y,x)}emplace(r,o,c,p,m,y,x,E){const S=8*r;return this.int16[S+0]=o,this.int16[S+1]=c,this.int16[S+2]=p,this.int16[S+4]=m,this.int16[S+5]=y,this.int16[S+6]=x,this.int16[S+7]=E,r}}It.prototype.bytesPerElement=16,At(It,"StructArrayLayout3i2i2i16");class Lt extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,o,c,p,m){const y=this.length;return this.resize(y+1),this.emplace(y,r,o,c,p,m)}emplace(r,o,c,p,m,y){const x=4*r,E=8*r;return this.float32[x+0]=o,this.float32[x+1]=c,this.float32[x+2]=p,this.int16[E+6]=m,this.int16[E+7]=y,r}}Lt.prototype.bytesPerElement=16,At(Lt,"StructArrayLayout2f1f2i16");class nr extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,o,c,p){const m=this.length;return this.resize(m+1),this.emplace(m,r,o,c,p)}emplace(r,o,c,p,m){const y=12*r,x=3*r;return this.uint8[y+0]=o,this.uint8[y+1]=c,this.float32[x+1]=p,this.float32[x+2]=m,r}}nr.prototype.bytesPerElement=12,At(nr,"StructArrayLayout2ub2f12");class er extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,o,c){const p=this.length;return this.resize(p+1),this.emplace(p,r,o,c)}emplace(r,o,c,p){const m=3*r;return this.float32[m+0]=o,this.float32[m+1]=c,this.float32[m+2]=p,r}}er.prototype.bytesPerElement=12,At(er,"StructArrayLayout3f12");class Pt extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r,o,c){const p=this.length;return this.resize(p+1),this.emplace(p,r,o,c)}emplace(r,o,c,p){const m=3*r;return this.uint16[m+0]=o,this.uint16[m+1]=c,this.uint16[m+2]=p,r}}Pt.prototype.bytesPerElement=6,At(Pt,"StructArrayLayout3ui6");class Ar extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(r,o,c,p,m,y,x,E,S,k,M,O,$,G,K,ee,le,me,ce,pe,_e){const ye=this.length;return this.resize(ye+1),this.emplace(ye,r,o,c,p,m,y,x,E,S,k,M,O,$,G,K,ee,le,me,ce,pe,_e)}emplace(r,o,c,p,m,y,x,E,S,k,M,O,$,G,K,ee,le,me,ce,pe,_e,ye){const Oe=30*r,Me=15*r,He=60*r;return this.int16[Oe+0]=o,this.int16[Oe+1]=c,this.int16[Oe+2]=p,this.float32[Me+2]=m,this.float32[Me+3]=y,this.uint16[Oe+8]=x,this.uint16[Oe+9]=E,this.uint32[Me+5]=S,this.uint32[Me+6]=k,this.uint32[Me+7]=M,this.uint16[Oe+16]=O,this.uint16[Oe+17]=$,this.uint16[Oe+18]=G,this.float32[Me+10]=K,this.float32[Me+11]=ee,this.uint8[He+48]=le,this.uint8[He+49]=me,this.uint8[He+50]=ce,this.uint32[Me+13]=pe,this.int16[Oe+28]=_e,this.uint8[He+58]=ye,r}}Ar.prototype.bytesPerElement=60,At(Ar,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class Mr extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(r,o,c,p,m,y,x,E,S,k,M,O,$,G,K,ee,le,me,ce,pe,_e,ye,Oe,Me,He,lt,Ue,Qe,Je,ot){const pt=this.length;return this.resize(pt+1),this.emplace(pt,r,o,c,p,m,y,x,E,S,k,M,O,$,G,K,ee,le,me,ce,pe,_e,ye,Oe,Me,He,lt,Ue,Qe,Je,ot)}emplace(r,o,c,p,m,y,x,E,S,k,M,O,$,G,K,ee,le,me,ce,pe,_e,ye,Oe,Me,He,lt,Ue,Qe,Je,ot,pt){const We=38*r,_t=19*r;return this.int16[We+0]=o,this.int16[We+1]=c,this.int16[We+2]=p,this.float32[_t+2]=m,this.float32[_t+3]=y,this.int16[We+8]=x,this.int16[We+9]=E,this.int16[We+10]=S,this.int16[We+11]=k,this.int16[We+12]=M,this.int16[We+13]=O,this.uint16[We+14]=$,this.uint16[We+15]=G,this.uint16[We+16]=K,this.uint16[We+17]=ee,this.uint16[We+18]=le,this.uint16[We+19]=me,this.uint16[We+20]=ce,this.uint16[We+21]=pe,this.uint16[We+22]=_e,this.uint16[We+23]=ye,this.uint16[We+24]=Oe,this.uint16[We+25]=Me,this.uint16[We+26]=He,this.uint16[We+27]=lt,this.uint16[We+28]=Ue,this.uint32[_t+15]=Qe,this.float32[_t+16]=Je,this.float32[_t+17]=ot,this.float32[_t+18]=pt,r}}Mr.prototype.bytesPerElement=76,At(Mr,"StructArrayLayout3i2f6i15ui1ul3f76");class zr extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r){const o=this.length;return this.resize(o+1),this.emplace(o,r)}emplace(r,o){return this.float32[1*r+0]=o,r}}zr.prototype.bytesPerElement=4,At(zr,"StructArrayLayout1f4");class Rr extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,o,c,p,m){const y=this.length;return this.resize(y+1),this.emplace(y,r,o,c,p,m)}emplace(r,o,c,p,m,y){const x=5*r;return this.float32[x+0]=o,this.float32[x+1]=c,this.float32[x+2]=p,this.float32[x+3]=m,this.float32[x+4]=y,r}}Rr.prototype.bytesPerElement=20,At(Rr,"StructArrayLayout5f20");class ui extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r,o,c,p){const m=this.length;return this.resize(m+1),this.emplace(m,r,o,c,p)}emplace(r,o,c,p,m){const y=6*r;return this.uint32[3*r+0]=o,this.uint16[y+2]=c,this.uint16[y+3]=p,this.uint16[y+4]=m,r}}ui.prototype.bytesPerElement=12,At(ui,"StructArrayLayout1ul3ui12");class Gn extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r,o){const c=this.length;return this.resize(c+1),this.emplace(c,r,o)}emplace(r,o,c){const p=2*r;return this.uint16[p+0]=o,this.uint16[p+1]=c,r}}Gn.prototype.bytesPerElement=4,At(Gn,"StructArrayLayout2ui4");class ao extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r){const o=this.length;return this.resize(o+1),this.emplace(o,r)}emplace(r,o){return this.uint16[1*r+0]=o,r}}ao.prototype.bytesPerElement=2,At(ao,"StructArrayLayout1ui2");class Jo extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,o){const c=this.length;return this.resize(c+1),this.emplace(c,r,o)}emplace(r,o,c){const p=2*r;return this.float32[p+0]=o,this.float32[p+1]=c,r}}Jo.prototype.bytesPerElement=8,At(Jo,"StructArrayLayout2f8");class Yr extends we{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.int16[this._pos2+3]}get tileAnchorY(){return this._structArray.int16[this._pos2+4]}get x1(){return this._structArray.float32[this._pos4+3]}get y1(){return this._structArray.float32[this._pos4+4]}get x2(){return this._structArray.float32[this._pos4+5]}get y2(){return this._structArray.float32[this._pos4+6]}get padding(){return this._structArray.int16[this._pos2+14]}get featureIndex(){return this._structArray.uint32[this._pos4+8]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+18]}get bucketIndex(){return this._structArray.uint16[this._pos2+19]}}Yr.prototype.size=40;class Or extends $t{get(r){return new Yr(this,r)}}At(Or,"CollisionBoxArray");class gr extends we{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+8]}get numGlyphs(){return this._structArray.uint16[this._pos2+9]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+5]}get lineStartIndex(){return this._structArray.uint32[this._pos4+6]}get lineLength(){return this._structArray.uint32[this._pos4+7]}get segment(){return this._structArray.uint16[this._pos2+16]}get lowerSize(){return this._structArray.uint16[this._pos2+17]}get upperSize(){return this._structArray.uint16[this._pos2+18]}get lineOffsetX(){return this._structArray.float32[this._pos4+10]}get lineOffsetY(){return this._structArray.float32[this._pos4+11]}get writingMode(){return this._structArray.uint8[this._pos1+48]}get placedOrientation(){return this._structArray.uint8[this._pos1+49]}set placedOrientation(r){this._structArray.uint8[this._pos1+49]=r}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(r){this._structArray.uint8[this._pos1+50]=r}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(r){this._structArray.uint32[this._pos4+13]=r}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(r){this._structArray.uint8[this._pos1+58]=r}}gr.prototype.size=60;class vn extends Ar{get(r){return new gr(this,r)}}At(vn,"PlacedSymbolArray");class vi extends we{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+8]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+9]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+10]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+11]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+12]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+13]}get key(){return this._structArray.uint16[this._pos2+14]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+17]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+18]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+19]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+20]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+21]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+22]}get featureIndex(){return this._structArray.uint16[this._pos2+23]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+24]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+25]}get numIconVertices(){return this._structArray.uint16[this._pos2+26]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+27]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+28]}get crossTileID(){return this._structArray.uint32[this._pos4+15]}set crossTileID(r){this._structArray.uint32[this._pos4+15]=r}get textOffset0(){return this._structArray.float32[this._pos4+16]}get textOffset1(){return this._structArray.float32[this._pos4+17]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+18]}}vi.prototype.size=76;class Zr extends Mr{get(r){return new vi(this,r)}}At(Zr,"SymbolInstanceArray");class Pi extends zr{getoffsetX(r){return this.float32[1*r+0]}}At(Pi,"GlyphOffsetArray");class yh extends st{getx(r){return this.int16[2*r+0]}gety(r){return this.int16[2*r+1]}}At(yh,"SymbolLineVertexArray");class js extends we{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]}get layoutVertexArrayOffset(){return this._structArray.uint16[this._pos2+4]}}js.prototype.size=12;class Jc extends ui{get(r){return new js(this,r)}}At(Jc,"FeatureIndexArray");class Ca extends Gn{geta_centroid_pos0(r){return this.uint16[2*r+0]}geta_centroid_pos1(r){return this.uint16[2*r+1]}}At(Ca,"FillExtrusionCentroidArray");const rs=Ie([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),Vs=Ie([{name:"a_dash",components:4,type:"Uint16"}]);var _h={exports:{}},eu={exports:{}};eu.exports=function(i,r){var o,c,p,m,y,x,E,S;for(c=i.length-(o=3&i.length),p=r,y=3432918353,x=461845907,S=0;S>>16)*y&65535)<<16)&4294967295)<<15|E>>>17))*x+(((E>>>16)*x&65535)<<16)&4294967295)<<13|p>>>19))+((5*(p>>>16)&65535)<<16)&4294967295))+((58964+(m>>>16)&65535)<<16);switch(E=0,o){case 3:E^=(255&i.charCodeAt(S+2))<<16;case 2:E^=(255&i.charCodeAt(S+1))<<8;case 1:p^=E=(65535&(E=(E=(65535&(E^=255&i.charCodeAt(S)))*y+(((E>>>16)*y&65535)<<16)&4294967295)<<15|E>>>17))*x+(((E>>>16)*x&65535)<<16)&4294967295}return p^=i.length,p=2246822507*(65535&(p^=p>>>16))+((2246822507*(p>>>16)&65535)<<16)&4294967295,p=3266489909*(65535&(p^=p>>>13))+((3266489909*(p>>>16)&65535)<<16)&4294967295,(p^=p>>>16)>>>0};var Vp=eu.exports,MA={exports:{}};MA.exports=function(i,r){for(var o,c=i.length,p=r^c,m=0;c>=4;)o=1540483477*(65535&(o=255&i.charCodeAt(m)|(255&i.charCodeAt(++m))<<8|(255&i.charCodeAt(++m))<<16|(255&i.charCodeAt(++m))<<24))+((1540483477*(o>>>16)&65535)<<16),p=1540483477*(65535&p)+((1540483477*(p>>>16)&65535)<<16)^(o=1540483477*(65535&(o^=o>>>24))+((1540483477*(o>>>16)&65535)<<16)),c-=4,++m;switch(c){case 3:p^=(255&i.charCodeAt(m+2))<<16;case 2:p^=(255&i.charCodeAt(m+1))<<8;case 1:p=1540483477*(65535&(p^=255&i.charCodeAt(m)))+((1540483477*(p>>>16)&65535)<<16)}return p=1540483477*(65535&(p^=p>>>13))+((1540483477*(p>>>16)&65535)<<16),(p^=p>>>15)>>>0};var zA=Vp,qO=MA.exports;_h.exports=zA,_h.exports.murmur3=zA,_h.exports.murmur2=qO;var yx=F(_h.exports);class j0{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(r,o,c,p){this.ids.push(RA(r)),this.positions.push(o,c,p)}getPositions(r){const o=RA(r);let c=0,p=this.ids.length-1;for(;c>1;this.ids[y]>=o?p=y:c=y+1}const m=[];for(;this.ids[c]===o;)m.push({index:this.positions[3*c],start:this.positions[3*c+1],end:this.positions[3*c+2]}),c++;return m}static serialize(r,o){const c=new Float64Array(r.ids),p=new Uint32Array(r.positions);return _x(c,p,0,c.length-1),o&&o.push(c.buffer,p.buffer),{ids:c,positions:p}}static deserialize(r){const o=new j0;return o.ids=r.ids,o.positions=r.positions,o.indexed=!0,o}}function RA(i){const r=+i;return!isNaN(r)&&Number.MIN_SAFE_INTEGER<=r&&r<=Number.MAX_SAFE_INTEGER?r:yx(String(i))}function _x(i,r,o,c){for(;o>1];let m=o-1,y=c+1;for(;;){do m++;while(i[m]p);if(m>=y)break;V0(i,m,y),V0(r,3*m,3*y),V0(r,3*m+1,3*y+1),V0(r,3*m+2,3*y+2)}y-o`u_${p}`),this.type=c}setUniform(r,o,c,p,m){o.set(r,m,p.constantOr(this.value))}getBinding(r,o){return this.type==="color"?new FA(r):new $0(r)}}class vh{constructor(r,o){this.uniformNames=o.map(c=>`u_${c}`),this.pattern=null,this.pixelRatio=1}setConstantPatternPositions(r){this.pixelRatio=r.pixelRatio||1,this.pattern=r.tl.concat(r.br)}setUniform(r,o,c,p,m){const y=m==="u_pattern"||m==="u_dash"?this.pattern:m==="u_pixel_ratio"?this.pixelRatio:null;y&&o.set(r,m,y)}getBinding(r,o){return o==="u_pattern"||o==="u_dash"?new OA(r):new $0(r)}}class Ws{constructor(r,o,c,p){this.expression=r,this.type=c,this.maxValue=0,this.paintVertexAttributes=o.map(m=>({name:`a_${m}`,type:"Float32",components:c==="color"?2:1,offset:0})),this.paintVertexArray=new p}populatePaintArray(r,o,c,p,m,y){const x=this.paintVertexArray.length,E=this.expression.evaluate(new D(0),o,{},m,p,y);this.paintVertexArray.resize(r),this._setPaintValue(x,r,E)}updatePaintArray(r,o,c,p,m){const y=this.expression.evaluate({zoom:0},c,p,void 0,m);this._setPaintValue(r,o,y)}_setPaintValue(r,o,c){if(this.type==="color"){const p=vx(c);for(let m=r;m`u_${x}_t`),this.type=c,this.useIntegerZoom=p,this.zoom=m,this.maxValue=0,this.paintVertexAttributes=o.map(x=>({name:`a_${x}`,type:"Float32",components:c==="color"?4:2,offset:0})),this.paintVertexArray=new y}populatePaintArray(r,o,c,p,m,y){const x=this.expression.evaluate(new D(this.zoom),o,{},m,p,y),E=this.expression.evaluate(new D(this.zoom+1),o,{},m,p,y),S=this.paintVertexArray.length;this.paintVertexArray.resize(r),this._setPaintValue(S,r,x,E)}updatePaintArray(r,o,c,p,m){const y=this.expression.evaluate({zoom:this.zoom},c,p,void 0,m),x=this.expression.evaluate({zoom:this.zoom+1},c,p,void 0,m);this._setPaintValue(r,o,y,x)}_setPaintValue(r,o,c,p){if(this.type==="color"){const m=vx(c),y=vx(p);for(let x=r;x!0){this.binders={},this._buffers=[];const p=[];for(const m in r.paint._values){if(!c(m))continue;const y=r.paint.get(m);if(!(y instanceof ie&&Al(y.property.specification)))continue;const x=QO(m,r.type),E=y.value,S=y.property.specification.type,k=!!y.property.useIntegerZoom,M=m==="line-dasharray"||m.endsWith("pattern"),O=m==="line-dasharray"&&r.layout.get("line-cap").value.kind!=="constant";if(E.kind!=="constant"||O)if(E.kind==="source"||O||M){const $=LA(m,S,"source");this.binders[m]=M?new Rl(E,x,S,$,r.id):new Ws(E,x,S,$),p.push(`/a_${m}`)}else{const $=LA(m,S,"composite");this.binders[m]=new ka(E,x,S,k,o,$),p.push(`/z_${m}`)}else this.binders[m]=M?new vh(E.value,x):new $p(E.value,x,S),p.push(`/u_${m}`)}this.cacheKey=p.sort().join("")}getMaxValue(r){const o=this.binders[r];return o instanceof Ws||o instanceof ka?o.maxValue:0}populatePaintArrays(r,o,c,p,m,y){for(const x in this.binders){const E=this.binders[x];(E instanceof Ws||E instanceof ka||E instanceof Rl)&&E.populatePaintArray(r,o,c,p,m,y)}}setConstantPatternPositions(r){for(const o in this.binders){const c=this.binders[o];c instanceof vh&&c.setConstantPatternPositions(r)}}updatePaintArrays(r,o,c,p,m,y){let x=!1;for(const E in r){const S=o.getPositions(E);for(const k of S){const M=c.feature(k.index);for(const O in this.binders){const $=this.binders[O];if(($ instanceof Ws||$ instanceof ka||$ instanceof Rl)&&$.expression.isStateDependent===!0){const G=p.paint.get(O);$.expression=G.value,$.updatePaintArray(k.start,k.end,M,r[E],m,y),x=!0}}}}return x}defines(){const r=[];for(const o in this.binders){const c=this.binders[o];(c instanceof $p||c instanceof vh)&&r.push(...c.uniformNames.map(p=>`#define HAS_UNIFORM_${p}`))}return r}getBinderAttributes(){const r=[];for(const o in this.binders){const c=this.binders[o];if(c instanceof Ws||c instanceof ka||c instanceof Rl)for(let p=0;p!0){this.programConfigurations={};for(const p of r)this.programConfigurations[p.id]=new Ol(p,o,c);this.needsUpload=!1,this._featureMap=new j0,this._bufferOffset=0}populatePaintArrays(r,o,c,p,m,y,x){for(const E in this.programConfigurations)this.programConfigurations[E].populatePaintArrays(r,o,p,m,y,x);o.id!==void 0&&this._featureMap.add(o.id,c,this._bufferOffset,r),this._bufferOffset=r,this.needsUpload=!0}updatePaintArrays(r,o,c,p,m){for(const y of c)this.needsUpload=this.programConfigurations[y.id].updatePaintArrays(r,this._featureMap,o,y,p,m)||this.needsUpload}get(r){return this.programConfigurations[r]}upload(r){if(this.needsUpload){for(const o in this.programConfigurations)this.programConfigurations[o].upload(r);this.needsUpload=!1}}destroy(){for(const r in this.programConfigurations)this.programConfigurations[r].destroy()}}const YO={"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","pixel_ratio"],"fill-pattern":["pattern","pixel_ratio"],"fill-extrusion-pattern":["pattern","pixel_ratio"],"line-dasharray":["dash"]};function QO(i,r){return YO[i]||[i.replace(`${r}-`,"").replace(/-/g,"_")]}const JO={"line-pattern":{source:ze,composite:ze},"fill-pattern":{source:ze,composite:ze},"fill-extrusion-pattern":{source:ze,composite:ze},"line-dasharray":{source:Ze,composite:Ze}},e5={color:{source:Jo,composite:at},number:{source:zr,composite:Jo}};function LA(i,r,o){const c=JO[i];return c&&c[o]||e5[r][o]}At($p,"ConstantBinder"),At(vh,"PatternConstantBinder"),At(Ws,"SourceExpressionBinder"),At(Rl,"PatternCompositeBinder"),At(ka,"CompositeExpressionBinder"),At(Ol,"ProgramConfiguration",{omit:["_buffers"]}),At(tu,"ProgramConfigurationSet");const BA="-transition";class Pa extends Cc{constructor(r,o){if(super(),this.id=r.id,this.type=r.type,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,r.type!=="custom"&&(this.metadata=r.metadata,this.minzoom=r.minzoom,this.maxzoom=r.maxzoom,r.type!=="background"&&r.type!=="sky"&&(this.source=r.source,this.sourceLayer=r["source-layer"],this.filter=r.filter),o.layout&&(this._unevaluatedLayout=new oe(o.layout)),o.paint)){this._transitionablePaint=new q(o.paint);for(const c in r.paint)this.setPaintProperty(c,r.paint[c],{validate:!1});for(const c in r.layout)this.setLayoutProperty(c,r.layout[c],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new ae(o.paint)}}getLayoutProperty(r){return r==="visibility"?this.visibility:this._unevaluatedLayout.getValue(r)}setLayoutProperty(r,o,c={}){o!=null&&this._validate(dx,`layers.${this.id}.layout.${r}`,r,o,c)||(r!=="visibility"?this._unevaluatedLayout.setValue(r,o):this.visibility=o)}getPaintProperty(r){return mr(r,BA)?this._transitionablePaint.getTransition(r.slice(0,-11)):this._transitionablePaint.getValue(r)}setPaintProperty(r,o,c={}){if(o!=null&&this._validate(hx,`layers.${this.id}.paint.${r}`,r,o,c))return!1;if(mr(r,BA))return this._transitionablePaint.setTransition(r.slice(0,-11),o||void 0),!1;{const p=this._transitionablePaint._values[r],m=p.value.isDataDriven(),y=p.value;this._transitionablePaint.setValue(r,o),this._handleSpecialPaintPropertyUpdate(r);const x=this._transitionablePaint._values[r].value,E=x.isDataDriven(),S=mr(r,"pattern")||r==="line-dasharray";return E||m||S||this._handleOverridablePaintPropertyUpdate(r,y,x)}}_handleSpecialPaintPropertyUpdate(r){}getProgramIds(){return null}getProgramConfiguration(r){return null}_handleOverridablePaintPropertyUpdate(r,o,c){return!1}isHidden(r){return!!(this.minzoom&&r=this.maxzoom)||this.visibility==="none"}updateTransitions(r){this._transitioningPaint=this._transitionablePaint.transitioned(r,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(r,o){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(r,void 0,o)),this.paint=this._transitioningPaint.possiblyEvaluate(r,void 0,o)}serialize(){const r={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&&(r.layout=r.layout||{},r.layout.visibility=this.visibility),Ii(r,(o,c)=>!(o===void 0||c==="layout"&&!Object.keys(o).length||c==="paint"&&!Object.keys(o).length))}_validate(r,o,c,p,m={}){return(!m||m.validate!==!1)&&L0(this,r.call(F0,{key:o,layerType:this.type,objectKey:c,value:p,styleSpec:Ge,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const r in this.paint._values){const o=this.paint.get(r);if(o instanceof ie&&Al(o.property.specification)&&(o.value.kind==="source"||o.value.kind==="composite")&&o.value.isStateDependent)return!0}return!1}compileFilter(){this._filterCompiled||(this._featureFilter=ph(this.filter),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}}const t5=Ie([{name:"a_pos",components:2,type:"Int16"}],4),r5=Ie([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class xn{constructor(r=[]){this.segments=r}prepareSegment(r,o,c,p){let m=this.segments[this.segments.length-1];return r>xn.MAX_VERTEX_ARRAY_LENGTH&&Tr(`Max vertices per segment is ${xn.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${r}`),(!m||m.vertexLength+r>xn.MAX_VERTEX_ARRAY_LENGTH||m.sortKey!==p)&&(m={vertexOffset:o.length,primitiveOffset:c.length,vertexLength:0,primitiveLength:0},p!==void 0&&(m.sortKey=p),this.segments.push(m)),m}get(){return this.segments}destroy(){for(const r of this.segments)for(const o in r.vaos)r.vaos[o].destroy()}static simpleSegment(r,o,c,p){return new xn([{vertexOffset:r,primitiveOffset:o,vertexLength:c,primitiveLength:p,vaos:{},sortKey:0}])}}xn.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,At(xn,"SegmentVector");var Ot=8192;class Fl{constructor(r,o){r&&(o?this.setSouthWest(r).setNorthEast(o):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 Fr?new Fr(r.lng,r.lat):Fr.convert(r),this}setSouthWest(r){return this._sw=r instanceof Fr?new Fr(r.lng,r.lat):Fr.convert(r),this}extend(r){const o=this._sw,c=this._ne;let p,m;if(r instanceof Fr)p=r,m=r;else{if(!(r instanceof Fl))return Array.isArray(r)?r.length===4||r.every(Array.isArray)?this.extend(Fl.convert(r)):this.extend(Fr.convert(r)):typeof r=="object"&&r!==null&&r.hasOwnProperty("lat")&&(r.hasOwnProperty("lon")||r.hasOwnProperty("lng"))?this.extend(Fr.convert(r)):this;if(p=r._sw,m=r._ne,!p||!m)return this}return o||c?(o.lng=Math.min(p.lng,o.lng),o.lat=Math.min(p.lat,o.lat),c.lng=Math.max(m.lng,c.lng),c.lat=Math.max(m.lat,c.lat)):(this._sw=new Fr(p.lng,p.lat),this._ne=new Fr(m.lng,m.lat)),this}getCenter(){return new Fr((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 Fr(this.getWest(),this.getNorth())}getSouthEast(){return new Fr(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:o,lat:c}=Fr.convert(r);let p=this._sw.lng<=o&&o<=this._ne.lng;return this._sw.lng>this._ne.lng&&(p=this._sw.lng>=o&&o>=this._ne.lng),this._sw.lat<=c&&c<=this._ne.lat&&p}static convert(r){return!r||r instanceof Fl?r:new Fl(r)}}var W0=1e-6,so=typeof Float32Array<"u"?Float32Array:Array;function NA(){var i=new so(9);return so!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[5]=0,i[6]=0,i[7]=0),i[0]=1,i[4]=1,i[8]=1,i}function UA(i,r,o){var c=r[0],p=r[1],m=r[2],y=r[3],x=r[4],E=r[5],S=r[6],k=r[7],M=r[8],O=o[0],$=o[1],G=o[2],K=o[3],ee=o[4],le=o[5],me=o[6],ce=o[7],pe=o[8];return i[0]=O*c+$*y+G*S,i[1]=O*p+$*x+G*k,i[2]=O*m+$*E+G*M,i[3]=K*c+ee*y+le*S,i[4]=K*p+ee*x+le*k,i[5]=K*m+ee*E+le*M,i[6]=me*c+ce*y+pe*S,i[7]=me*p+ce*x+pe*k,i[8]=me*m+ce*E+pe*M,i}function Da(i){return i[0]=1,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=1,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=1,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i}function xx(i,r){var o=r[0],c=r[1],p=r[2],m=r[3],y=r[4],x=r[5],E=r[6],S=r[7],k=r[8],M=r[9],O=r[10],$=r[11],G=r[12],K=r[13],ee=r[14],le=r[15],me=o*x-c*y,ce=o*E-p*y,pe=o*S-m*y,_e=c*E-p*x,ye=c*S-m*x,Oe=p*S-m*E,Me=k*K-M*G,He=k*ee-O*G,lt=k*le-$*G,Ue=M*ee-O*K,Qe=M*le-$*K,Je=O*le-$*ee,ot=me*Je-ce*Qe+pe*Ue+_e*lt-ye*He+Oe*Me;return ot?(i[0]=(x*Je-E*Qe+S*Ue)*(ot=1/ot),i[1]=(p*Qe-c*Je-m*Ue)*ot,i[2]=(K*Oe-ee*ye+le*_e)*ot,i[3]=(O*ye-M*Oe-$*_e)*ot,i[4]=(E*lt-y*Je-S*He)*ot,i[5]=(o*Je-p*lt+m*He)*ot,i[6]=(ee*pe-G*Oe-le*ce)*ot,i[7]=(k*Oe-O*pe+$*ce)*ot,i[8]=(y*Qe-x*lt+S*Me)*ot,i[9]=(c*lt-o*Qe-m*Me)*ot,i[10]=(G*ye-K*pe+le*me)*ot,i[11]=(M*pe-k*ye-$*me)*ot,i[12]=(x*He-y*Ue-E*Me)*ot,i[13]=(o*Ue-c*He+p*Me)*ot,i[14]=(K*ce-G*_e-ee*me)*ot,i[15]=(k*_e-M*ce+O*me)*ot,i):null}function ru(i,r,o){var c=r[0],p=r[1],m=r[2],y=r[3],x=r[4],E=r[5],S=r[6],k=r[7],M=r[8],O=r[9],$=r[10],G=r[11],K=r[12],ee=r[13],le=r[14],me=r[15],ce=o[0],pe=o[1],_e=o[2],ye=o[3];return i[0]=ce*c+pe*x+_e*M+ye*K,i[1]=ce*p+pe*E+_e*O+ye*ee,i[2]=ce*m+pe*S+_e*$+ye*le,i[3]=ce*y+pe*k+_e*G+ye*me,i[4]=(ce=o[4])*c+(pe=o[5])*x+(_e=o[6])*M+(ye=o[7])*K,i[5]=ce*p+pe*E+_e*O+ye*ee,i[6]=ce*m+pe*S+_e*$+ye*le,i[7]=ce*y+pe*k+_e*G+ye*me,i[8]=(ce=o[8])*c+(pe=o[9])*x+(_e=o[10])*M+(ye=o[11])*K,i[9]=ce*p+pe*E+_e*O+ye*ee,i[10]=ce*m+pe*S+_e*$+ye*le,i[11]=ce*y+pe*k+_e*G+ye*me,i[12]=(ce=o[12])*c+(pe=o[13])*x+(_e=o[14])*M+(ye=o[15])*K,i[13]=ce*p+pe*E+_e*O+ye*ee,i[14]=ce*m+pe*S+_e*$+ye*le,i[15]=ce*y+pe*k+_e*G+ye*me,i}function Wp(i,r,o){var c,p,m,y,x,E,S,k,M,O,$,G,K=o[0],ee=o[1],le=o[2];return r===i?(i[12]=r[0]*K+r[4]*ee+r[8]*le+r[12],i[13]=r[1]*K+r[5]*ee+r[9]*le+r[13],i[14]=r[2]*K+r[6]*ee+r[10]*le+r[14],i[15]=r[3]*K+r[7]*ee+r[11]*le+r[15]):(p=r[1],m=r[2],y=r[3],x=r[4],E=r[5],S=r[6],k=r[7],M=r[8],O=r[9],$=r[10],G=r[11],i[0]=c=r[0],i[1]=p,i[2]=m,i[3]=y,i[4]=x,i[5]=E,i[6]=S,i[7]=k,i[8]=M,i[9]=O,i[10]=$,i[11]=G,i[12]=c*K+x*ee+M*le+r[12],i[13]=p*K+E*ee+O*le+r[13],i[14]=m*K+S*ee+$*le+r[14],i[15]=y*K+k*ee+G*le+r[15]),i}function nu(i,r,o){var c=o[0],p=o[1],m=o[2];return i[0]=r[0]*c,i[1]=r[1]*c,i[2]=r[2]*c,i[3]=r[3]*c,i[4]=r[4]*p,i[5]=r[5]*p,i[6]=r[6]*p,i[7]=r[7]*p,i[8]=r[8]*m,i[9]=r[9]*m,i[10]=r[10]*m,i[11]=r[11]*m,i[12]=r[12],i[13]=r[13],i[14]=r[14],i[15]=r[15],i}function bx(i,r,o){var c=Math.sin(o),p=Math.cos(o),m=r[4],y=r[5],x=r[6],E=r[7],S=r[8],k=r[9],M=r[10],O=r[11];return r!==i&&(i[0]=r[0],i[1]=r[1],i[2]=r[2],i[3]=r[3],i[12]=r[12],i[13]=r[13],i[14]=r[14],i[15]=r[15]),i[4]=m*p+S*c,i[5]=y*p+k*c,i[6]=x*p+M*c,i[7]=E*p+O*c,i[8]=S*p-m*c,i[9]=k*p-y*c,i[10]=M*p-x*c,i[11]=O*p-E*c,i}function G0(i,r,o){var c=Math.sin(o),p=Math.cos(o),m=r[0],y=r[1],x=r[2],E=r[3],S=r[8],k=r[9],M=r[10],O=r[11];return r!==i&&(i[4]=r[4],i[5]=r[5],i[6]=r[6],i[7]=r[7],i[12]=r[12],i[13]=r[13],i[14]=r[14],i[15]=r[15]),i[0]=m*p-S*c,i[1]=y*p-k*c,i[2]=x*p-M*c,i[3]=E*p-O*c,i[8]=m*c+S*p,i[9]=y*c+k*p,i[10]=x*c+M*p,i[11]=E*c+O*p,i}function jA(i,r){return i[0]=r[0],i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=r[1],i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=r[2],i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i}function VA(i,r,o){var c,p,m,y=o[0],x=o[1],E=o[2],S=Math.hypot(y,x,E);return S0&&(m=1/Math.sqrt(m)),i[0]=r[0]*m,i[1]=r[1]*m,i[2]=r[2]*m,i}function ea(i,r){return i[0]*r[0]+i[1]*r[1]+i[2]*r[2]}function Sx(i,r,o){var c=r[0],p=r[1],m=r[2],y=o[0],x=o[1],E=o[2];return i[0]=p*E-m*x,i[1]=m*y-c*E,i[2]=c*x-p*y,i}function mn(i,r,o){var c=r[0],p=r[1],m=r[2],y=o[3]*c+o[7]*p+o[11]*m+o[15];return i[0]=(o[0]*c+o[4]*p+o[8]*m+o[12])/(y=y||1),i[1]=(o[1]*c+o[5]*p+o[9]*m+o[13])/y,i[2]=(o[2]*c+o[6]*p+o[10]*m+o[14])/y,i}function GA(i,r,o){var c=o[0],p=o[1],m=o[2],y=r[0],x=r[1],E=r[2],S=p*E-m*x,k=m*y-c*E,M=c*x-p*y,O=p*M-m*k,$=m*S-c*M,G=c*k-p*S,K=2*o[3];return k*=K,M*=K,$*=2,G*=2,i[0]=y+(S*=K)+(O*=2),i[1]=x+k+$,i[2]=E+M+G,i}var Kp,Ma=Ex,i5=WA,o5=Gp;function HA(i,r,o){return i[0]=r[0]*o,i[1]=r[1]*o,i[2]=r[2]*o,i[3]=r[3]*o,i}function qA(i,r){var o=r[0],c=r[1],p=r[2],m=r[3],y=o*o+c*c+p*p+m*m;return y>0&&(y=1/Math.sqrt(y)),i[0]=o*y,i[1]=c*y,i[2]=p*y,i[3]=m*y,i}function iu(i,r,o){var c=r[0],p=r[1],m=r[2],y=r[3];return i[0]=o[0]*c+o[4]*p+o[8]*m+o[12]*y,i[1]=o[1]*c+o[5]*p+o[9]*m+o[13]*y,i[2]=o[2]*c+o[6]*p+o[10]*m+o[14]*y,i[3]=o[3]*c+o[7]*p+o[11]*m+o[15]*y,i}function ZA(){var i=new so(4);return so!=Float32Array&&(i[0]=0,i[1]=0,i[2]=0),i[3]=1,i}function KA(i){return i[0]=0,i[1]=0,i[2]=0,i[3]=1,i}function XA(i,r,o){o*=.5;var c=r[0],p=r[1],m=r[2],y=r[3],x=Math.sin(o),E=Math.cos(o);return i[0]=c*E+y*x,i[1]=p*E+m*x,i[2]=m*E-p*x,i[3]=y*E-c*x,i}function YA(i,r,o){o*=.5;var c=r[0],p=r[1],m=r[2],y=r[3],x=Math.sin(o),E=Math.cos(o);return i[0]=c*E-m*x,i[1]=p*E+y*x,i[2]=m*E+c*x,i[3]=y*E-p*x,i}wx(),Kp=new so(4),so!=Float32Array&&(Kp[0]=0,Kp[1]=0,Kp[2]=0,Kp[3]=0);var a5=qA;wx(),xh(1,0,0),xh(0,1,0),ZA(),ZA(),NA();const s5=Ie([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]),{members:QA}=s5,JA=Ie([{name:"a_pos_3",components:3,type:"Int16"}]);var Xp=Ie([{name:"a_pos",type:"Int16",components:2}]);class Tx{constructor(r,o){this.pos=r,this.dir=o}intersectsPlane(r,o,c){const p=ea(o,this.dir);if(Math.abs(p)<1e-6)return!1;const m=((r[0]-this.pos[0])*o[0]+(r[1]-this.pos[1])*o[1]+(r[2]-this.pos[2])*o[2])/p;return c[0]=this.pos[0]+this.dir[0]*m,c[1]=this.pos[1]+this.dir[1]*m,c[2]=this.pos[2]+this.dir[2]*m,!0}closestPointOnSphere(r,o,c){if(function($,G){var K=$[0],ee=$[1],le=$[2],me=G[0],ce=G[1],pe=G[2];return Math.abs(K-me)<=W0*Math.max(1,Math.abs(K),Math.abs(me))&&Math.abs(ee-ce)<=W0*Math.max(1,Math.abs(ee),Math.abs(ce))&&Math.abs(le-pe)<=W0*Math.max(1,Math.abs(le),Math.abs(pe))}(this.pos,r)||o===0)return c[0]=c[1]=c[2]=0,!1;const[p,m,y]=this.dir,x=this.pos[0]-r[0],E=this.pos[1]-r[1],S=this.pos[2]-r[2],k=p*p+m*m+y*y,M=2*(x*p+E*m+S*y),O=M*M-4*k*(x*x+E*E+S*S-o*o);if(O<0){const $=Math.max(-M/2,0),G=x+p*$,K=E+m*$,ee=S+y*$,le=Math.hypot(G,K,ee);return c[0]=G*o/le,c[1]=K*o/le,c[2]=ee*o/le,!1}{const $=(-M-Math.sqrt(O))/(2*k);if($<0){const G=Math.hypot(x,E,S);return c[0]=x*o/G,c[1]=E*o/G,c[2]=S*o/G,!1}return c[0]=x+p*$,c[1]=E+m*$,c[2]=S+y*$,!0}}}class Ax{constructor(r,o,c,p,m){this.TL=r,this.TR=o,this.BR=c,this.BL=p,this.horizon=m}static fromInvProjectionMatrix(r,o,c){const p=[-1,1,1],m=[1,1,1],y=[1,-1,1],x=[-1,-1,1],E=mn(p,p,r),S=mn(m,m,r),k=mn(y,y,r),M=mn(x,x,r);return new Ax(E,S,k,M,o/c)}}class Ix{constructor(r,o){this.points=r,this.planes=o}static fromInvProjectionMatrix(r,o,c,p){const m=Math.pow(2,c),y=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(E=>{const S=iu([],E,r),k=1/S[3]/o*m;return function(M,O,$){return M[0]=O[0]*$[0],M[1]=O[1]*$[1],M[2]=O[2]*$[2],M[3]=O[3]*$[3],M}(S,S,[k,k,p?1/S[3]:k,k])}),x=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(E=>{const S=Di([],Sx([],Ma([],y[E[0]],y[E[1]]),Ma([],y[E[2]],y[E[1]]))),k=-ea(S,y[E[1]]);return S.concat(k)});return new Ix(y,x)}}class Mi{static fromPoints(r){const o=[1/0,1/0,1/0],c=[-1/0,-1/0,-1/0];for(const p of r)Hp(o,o,p),qp(c,c,p);return new Mi(o,c)}static applyTransform(r,o){const c=r.getCorners();for(let p=0;p=0;if(y===0)return 0;y!==o.length&&(c=!1)}if(c)return 2;for(let p=0;p<3;p++){let m=Number.MAX_VALUE,y=-Number.MAX_VALUE;for(let x=0;xthis.max[p]-this.min[p])return 0}return 1}}const Cx=5,e2=6,ns=Ot/Math.PI/2,l5=16383,ou=64,Yp=[ou,32,16],ta=-ns,ra=ns,c5=[new Mi([ta,ta,ta],[ra,ra,ra]),new Mi([ta,ta,ta],[0,0,ra]),new Mi([0,ta,ta],[ra,0,ra]),new Mi([ta,0,ta],[0,ra,ra]),new Mi([0,0,ta],[ra,ra,ra])];function H0(i){return i*ns/ef}function t2(i,r,o,c=!0){const p=ko([],i._camera.position,i.worldSize),m=[r,o,1,1];iu(m,m,i.pixelMatrixInverse),HA(m,m,1/m[3]);const y=Di([],Ma([],m,p)),x=i.globeMatrix,E=[x[12],x[13],x[14]],S=Ma([],E,p),k=Gp(S),M=Di([],S),O=i.worldSize/(2*Math.PI),$=ea(M,y),G=Math.asin(O/k);if(G1?null:function(c,p,m,y){const x=Math.sin(m);return c*(Math.sin((1-y)*m)/x)+p*(Math.sin(y*m)/x)}(i.a[r],i.b[r],i.angle,qe(o,0,1))+i.center[r]}function is(i){if(i.z<=1)return c5[i.z+2*i.y+i.x];const r=Px(q0(i));return Mi.fromPoints(r)}function au(i,r,o){return ko(i,i,1-o),Zp(i,i,r,o)}function r2(i,r){const o=Eh(r.zoom);if(o===0)return is(i);const c=q0(i),p=Px(c),m=os(c.getWest())*r.worldSize,y=os(c.getEast())*r.worldSize,x=as(c.getNorth())*r.worldSize,E=as(c.getSouth())*r.worldSize,S=[m,x,0],k=[y,x,0],M=[m,E,0],O=[y,E,0],$=xx([],r.globeMatrix);return mn(S,S,$),mn(k,k,$),mn(M,M,$),mn(O,O,$),p[0]=au(p[0],M,o),p[1]=au(p[1],O,o),p[2]=au(p[2],k,o),p[3]=au(p[3],S,o),Mi.fromPoints(p)}function n2(i,r,o){for(const c of i)mn(c,c,r),ko(c,c,o)}function h5(i,r,o){const c=r/i.worldSize,p=i.globeMatrix;if(o.z<=1){const Me=is(o).getCorners();return n2(Me,p,c),Mi.fromPoints(Me)}const m=q0(o),y=Px(m);n2(y,p,c);const x=Number.MAX_VALUE,E=[-x,-x,-x],S=[x,x,x];if(m.contains(i.center)){for(const lt of y)Hp(S,S,lt),qp(E,E,lt);E[2]=0;const Me=i.point,He=[Me.x*c,Me.y*c,0];return Hp(S,S,He),qp(E,E,He),new Mi(S,E)}const k=[p[12]*c,p[13]*c,p[14]*c],M=m.getCenter(),O=qe(i.center.lat,-di,di),$=qe(M.lat,-di,di),G=os(i.center.lng),K=as(O);let ee=G-os(M.lng);const le=K-as($);ee>.5?ee-=1:ee<-.5&&(ee+=1);let me=0;Math.abs(ee)>Math.abs(le)?me=ee>=0?1:3:(me=le>=0?0:2,Zp(k,k,[p[4]*c,p[5]*c,p[6]*c],-Math.sin(Fe(le>=0?m.getSouth():m.getNorth()))*ns));const ce=y[me],pe=y[(me+1)%4],_e=new u5(ce,pe,k),ye=[kx(_e,0)||ce[0],kx(_e,1)||ce[1],kx(_e,2)||ce[2]],Oe=Eh(i.zoom);if(Oe>0){const Me=function({x:lt,y:Ue,z:Qe},Je,ot,pt,We){const _t=1/(1<.5?zt=-1:Ht<-.5&&(zt=1),Ct=((Ct+zt)*Je-(pt*=Je))*ot+pt,vt=((vt+zt)*Je-pt)*ot+pt,Gt=(Gt*Je-(We*=Je))*ot+We,ft=(ft*Je-We)*ot+We,[[Ct,ft,0],[vt,ft,0],[vt,Gt,0],[Ct,Gt,0]]}(o,r,i._pixelsPerMercatorPixel,G,K);for(let lt=0;ltMath.PI/2*1.01}const s2=Fe(85),d5=Math.cos(s2),p5=Math.sin(s2),ef=63710088e-1,l2=2*Math.PI*ef;class Ll{constructor(r,o){if(isNaN(r)||isNaN(o))throw new Error(`Invalid LngLat object: (${r}, ${o})`);if(this.lng=+r,this.lat=+o,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Ll(gt(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(r){const o=Math.PI/180,c=this.lat*o,p=r.lat*o,m=Math.sin(c)*Math.sin(p)+Math.cos(c)*Math.cos(p)*Math.cos((r.lng-this.lng)*o);return ef*Math.acos(Math.min(m,1))}toBounds(r=0){const o=360*r/40075017,c=o/Math.cos(Math.PI/180*this.lat);return new Fl(new Ll(this.lng-c,this.lat-o),new Ll(this.lng+c,this.lat+o))}toEcef(r){const o=H0(r);return wh(this.lat,this.lng,ns+o)}static convert(r){if(r instanceof Ll)return r;if(Array.isArray(r)&&(r.length===2||r.length===3))return new Ll(Number(r[0]),Number(r[1]));if(!Array.isArray(r)&&typeof r=="object"&&r!==null)return new Ll(Number("lng"in r?r.lng:r.lon),Number(r.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 [, ]")}}var Fr=Ll;function zx(i){return l2*Math.cos(i*Math.PI/180)}function os(i){return(180+i)/360}function as(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function za(i,r){return i/zx(r)}function Po(i){return 360*i-180}function hi(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}function c2(i,r){return i*zx(hi(r))}const di=85.051129;function u2(i){return 1/Math.cos(i*Math.PI/180)}class Sh{constructor(r,o,c=0){this.x=+r,this.y=+o,this.z=+c}static fromLngLat(r,o=0){const c=Fr.convert(r);return new Sh(os(c.lng),as(c.lat),za(o,c.lat))}toLngLat(){return new Fr(Po(this.x),hi(this.y))}toAltitude(){return c2(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/l2*u2(hi(this.y))}}function Rx(i,r,o,c,p,m,y,x,E){const S=(r+c)/2,k=(o+p)/2,M=new xe(S,k);x(M),function(O,$,G,K,ee,le){const me=G-ee,ce=K-le;return Math.abs((K-$)*me-(G-O)*ce)/Math.hypot(me,ce)}(M.x,M.y,m.x,m.y,y.x,y.y)>=E?(Rx(i,r,o,S,k,m,M,x,E),Rx(i,S,k,c,p,M,y,x,E)):i.push(y)}function h2(i,r,o){let c=i[0],p=c.x,m=c.y;r(c);const y=[c];for(let x=1;xi.x+1||ci.y+1)&&Tr("Geometry exceeds allowed extent, reduce your vector tile buffer size"),i}function Hs(i,r,o){const c=i.loadGeometry(),p=i.extent,m=Ot/p;if(r&&o&&o.projection.isReprojectedInTileSpace){const y=1<{const $=Po((r.x+O.x/p)/y),G=hi((r.y+O.y/p)/y),K=k.project($,G);O.x=(K.x*x-E)*p,O.y=(K.y*x-S)*p};for(let O=0;O=p||G.y<0||G.y>=p||(M(G),$.push(G));c[O]=$}}for(const y of c)for(const x of y)m5(x,m);return c}function su(i,r){return{type:i.type,id:i.id,properties:i.properties,geometry:r?Hs(i):[]}}function K0(i,r,o,c,p){i.emplaceBack(2*r+(c+1)/2,2*o+(p+1)/2)}function X0(i,r,o){i.emplaceBack(r.x,r.y,r.z,o[0]*16384,o[1]*16384,o[2]*16384)}class Lx{constructor(r){this.zoom=r.zoom,this.overscaling=r.overscaling,this.layers=r.layers,this.layerIds=this.layers.map(o=>o.id),this.index=r.index,this.hasPattern=!1,this.projection=r.projection,this.layoutVertexArray=new st,this.indexArray=new Pt,this.segments=new xn,this.programConfigurations=new tu(r.layers,r.zoom),this.stateDependentLayerIds=this.layers.filter(o=>o.isStateDependent()).map(o=>o.id)}populate(r,o,c,p){const m=this.layers[0],y=[];let x=null;m.type==="circle"&&(x=m.layout.get("circle-sort-key"));for(const{feature:S,id:k,index:M,sourceLayerIndex:O}of r){const $=this.layers[0]._featureFilter.needGeometry,G=su(S,$);if(!this.layers[0]._featureFilter.filter(new D(this.zoom),G,c))continue;const K=x?x.evaluate(G,{},c):void 0,ee={id:k,properties:S.properties,type:S.type,sourceLayerIndex:O,index:M,geometry:$?G.geometry:Hs(S,c,p),patterns:{},sortKey:K};y.push(ee)}x&&y.sort((S,k)=>S.sortKey-k.sortKey);let E=null;p.projection.name==="globe"&&(this.globeExtVertexArray=new ut,E=p.projection);for(const S of y){const{geometry:k,index:M,sourceLayerIndex:O}=S,$=r[M].feature;this.addFeature(S,k,M,o.availableImages,c,E),o.featureIndex.insert($,k,M,O,this.index)}}update(r,o,c,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(r,o,this.stateDependentLayers,c,p)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(r){this.uploaded||(this.layoutVertexBuffer=r.createVertexBuffer(this.layoutVertexArray,t5.members),this.indexBuffer=r.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=r.createVertexBuffer(this.globeExtVertexArray,r5.members))),this.programConfigurations.upload(r),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy())}addFeature(r,o,c,p,m,y){for(const x of o)for(const E of x){const S=E.x,k=E.y;if(S<0||S>=Ot||k<0||k>=Ot)continue;if(y){const $=y.projectTilePoint(S,k,m),G=y.upVector(m,S,k),K=this.globeExtVertexArray;X0(K,$,G),X0(K,$,G),X0(K,$,G),X0(K,$,G)}const M=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,r.sortKey),O=M.vertexLength;K0(this.layoutVertexArray,S,k,-1,-1),K0(this.layoutVertexArray,S,k,1,-1),K0(this.layoutVertexArray,S,k,1,1),K0(this.layoutVertexArray,S,k,-1,1),this.indexArray.emplaceBack(O,O+1,O+2),this.indexArray.emplaceBack(O,O+2,O+3),M.vertexLength+=4,M.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,r,c,{},p,m)}}function p2(i,r){for(let o=0;o1){if(Bx(i,r))return!0;for(let c=0;c1?o:o.sub(r)._mult(p)._add(r))}function g2(i,r){let o,c,p,m=!1;for(let y=0;yr.y!=p.y>r.y&&r.x<(p.x-c.x)*(r.y-c.y)/(p.y-c.y)+c.x&&(m=!m)}return m}function lu(i,r){let o=!1;for(let c=0,p=i.length-1;cr.y!=y.y>r.y&&r.x<(y.x-m.x)*(r.y-m.y)/(y.y-m.y)+m.x&&(o=!o)}return o}function y2(i,r,o,c,p){for(const y of i)if(r<=y.x&&o<=y.y&&c>=y.x&&p>=y.y)return!0;const m=[new xe(r,o),new xe(r,p),new xe(c,p),new xe(c,o)];if(i.length>2){for(const y of m)if(lu(i,y))return!0}for(let y=0;yp.x&&r.x>p.x||i.yp.y&&r.y>p.y)return!1;const m=Bn(i,r,o[0]);return m!==Bn(i,r,o[1])||m!==Bn(i,r,o[2])||m!==Bn(i,r,o[3])}function Th(i,r,o){const c=r.paint.get(i).value;return c.kind==="constant"?c.value:o.programConfigurations.get(r.id).getMaxValue(i)}function Y0(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function _2(i,r,o,c,p){if(!r[0]&&!r[1])return i;const m=xe.convert(r)._mult(p);o==="viewport"&&m._rotate(-c);const y=[];for(let x=0;x0){const ce=o.projection.upVector(S,$.x,$.y);K.x+=ce[0]*k*G,K.y+=ce[1]*k*G,K.z+=ce[2]*k*G}const ee=m?$:w5(K.x,K.y,K.z,c),le=m?i.tilespaceRays.map(ce=>S5(ce,G)):i.queryGeometry.screenGeometry,me=iu([],[K.x,K.y,K.z,1],c);if(!y&&m?E*=me[3]/o.cameraToCenterDistance:y&&!m&&(E*=o.cameraToCenterDistance/me[3]),m){const ce=hi((O.y/Ot+S.y)/(1<i.width||p.height>i.height||o.x>i.width-p.width||o.y>i.height-p.height)throw new RangeError("out of range source coordinates for image copy");if(p.width>r.width||p.height>r.height||c.x>r.width-p.width||c.y>r.height-p.height)throw new RangeError("out of range destination coordinates for image copy");const y=i.data,x=r.data;for(let E=0;E{r[i.evaluationKey]=E;const S=i.expression.evaluate(r);p.data[y+x+0]=Math.floor(255*S.r/S.a),p.data[y+x+1]=Math.floor(255*S.g/S.a),p.data[y+x+2]=Math.floor(255*S.b/S.a),p.data[y+x+3]=Math.floor(255*S.a)};if(i.clips)for(let y=0,x=0;y80*o){c=m=i[0],p=y=i[1];for(var G=o;Gm&&(m=x),E>y&&(y=E);S=(S=Math.max(m-c,y-p))!==0?32767/S:0}return tf(O,$,o,c,p,S,0),$}function T2(i,r,o,c,p){var m,y;if(p===Gx(i,r,o,c)>0)for(m=r;m=r;m-=c)y=C2(m,i[m],i[m+1],y);return y&&J0(y,y.next)&&(nf(y),y=y.next),y}function cu(i,r){if(!i)return i;r||(r=i);var o,c=i;do if(o=!1,c.steiner||!J0(c,c.next)&&bn(c.prev,c,c.next)!==0)c=c.next;else{if(nf(c),(c=r=c.prev)===c.next)break;o=!0}while(o||c!==r);return r}function tf(i,r,o,c,p,m,y){if(i){!y&&m&&function(k,M,O,$){var G=k;do G.z===0&&(G.z=$x(G.x,G.y,M,O,$)),G.prevZ=G.prev,G.nextZ=G.next,G=G.next;while(G!==k);G.prevZ.nextZ=null,G.prevZ=null,function(K){var ee,le,me,ce,pe,_e,ye,Oe,Me=1;do{for(le=K,K=null,pe=null,_e=0;le;){for(_e++,me=le,ye=0,ee=0;ee0||Oe>0&&me;)ye!==0&&(Oe===0||!me||le.z<=me.z)?(ce=le,le=le.nextZ,ye--):(ce=me,me=me.nextZ,Oe--),pe?pe.nextZ=ce:K=ce,ce.prevZ=pe,pe=ce;le=me}pe.nextZ=null,Me*=2}while(_e>1)}(G)}(i,c,p,m);for(var x,E,S=i;i.prev!==i.next;)if(x=i.prev,E=i.next,m?P5(i,c,p,m):k5(i))r.push(x.i/o|0),r.push(i.i/o|0),r.push(E.i/o|0),nf(i),i=E.next,S=E.next;else if((i=E)===S){y?y===1?tf(i=D5(cu(i),r,o),r,o,c,p,m,2):y===2&&M5(i,r,o,c,p,m):tf(cu(i),r,o,c,p,m,1);break}}}function k5(i){var r=i.prev,o=i,c=i.next;if(bn(r,o,c)>=0)return!1;for(var p=r.x,m=o.x,y=c.x,x=r.y,E=o.y,S=c.y,k=pm?p>y?p:y:m>y?m:y,$=x>E?x>S?x:S:E>S?E:S,G=c.next;G!==r;){if(G.x>=k&&G.x<=O&&G.y>=M&&G.y<=$&&Ah(p,x,m,E,y,S,G.x,G.y)&&bn(G.prev,G,G.next)>=0)return!1;G=G.next}return!0}function P5(i,r,o,c){var p=i.prev,m=i,y=i.next;if(bn(p,m,y)>=0)return!1;for(var x=p.x,E=m.x,S=y.x,k=p.y,M=m.y,O=y.y,$=xE?x>S?x:S:E>S?E:S,ee=k>M?k>O?k:O:M>O?M:O,le=$x($,G,r,o,c),me=$x(K,ee,r,o,c),ce=i.prevZ,pe=i.nextZ;ce&&ce.z>=le&&pe&&pe.z<=me;){if(ce.x>=$&&ce.x<=K&&ce.y>=G&&ce.y<=ee&&ce!==p&&ce!==y&&Ah(x,k,E,M,S,O,ce.x,ce.y)&&bn(ce.prev,ce,ce.next)>=0||(ce=ce.prevZ,pe.x>=$&&pe.x<=K&&pe.y>=G&&pe.y<=ee&&pe!==p&&pe!==y&&Ah(x,k,E,M,S,O,pe.x,pe.y)&&bn(pe.prev,pe,pe.next)>=0))return!1;pe=pe.nextZ}for(;ce&&ce.z>=le;){if(ce.x>=$&&ce.x<=K&&ce.y>=G&&ce.y<=ee&&ce!==p&&ce!==y&&Ah(x,k,E,M,S,O,ce.x,ce.y)&&bn(ce.prev,ce,ce.next)>=0)return!1;ce=ce.prevZ}for(;pe&&pe.z<=me;){if(pe.x>=$&&pe.x<=K&&pe.y>=G&&pe.y<=ee&&pe!==p&&pe!==y&&Ah(x,k,E,M,S,O,pe.x,pe.y)&&bn(pe.prev,pe,pe.next)>=0)return!1;pe=pe.nextZ}return!0}function D5(i,r,o){var c=i;do{var p=c.prev,m=c.next.next;!J0(p,m)&&A2(p,c,c.next,m)&&rf(p,m)&&rf(m,p)&&(r.push(p.i/o|0),r.push(c.i/o|0),r.push(m.i/o|0),nf(c),nf(c.next),c=i=m),c=c.next}while(c!==i);return cu(c)}function M5(i,r,o,c,p,m){var y=i;do{for(var x=y.next.next;x!==y.prev;){if(y.i!==x.i&&L5(y,x)){var E=I2(y,x);return y=cu(y,y.next),E=cu(E,E.next),tf(y,r,o,c,p,m,0),void tf(E,r,o,c,p,m,0)}x=x.next}y=y.next}while(y!==i)}function z5(i,r){return i.x-r.x}function R5(i,r){var o=function(p,m){var y,x=m,E=p.x,S=p.y,k=-1/0;do{if(S<=x.y&&S>=x.next.y&&x.next.y!==x.y){var M=x.x+(S-x.y)*(x.next.x-x.x)/(x.next.y-x.y);if(M<=E&&M>k&&(k=M,y=x.x=x.x&&x.x>=G&&E!==x.x&&Ah(Sy.x||x.x===y.x&&O5(y,x)))&&(y=x,ee=O)),x=x.next;while(x!==$);return y}(i,r);if(!o)return r;var c=I2(o,i);return cu(c,c.next),cu(o,o.next)}function O5(i,r){return bn(i.prev,i,r.prev)<0&&bn(r.next,i,i.next)<0}function $x(i,r,o,c,p){return(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=(i-o)*p|0)|i<<8))|i<<4))|i<<2))|i<<1))|(r=1431655765&((r=858993459&((r=252645135&((r=16711935&((r=(r-c)*p|0)|r<<8))|r<<4))|r<<2))|r<<1))<<1}function F5(i){var r=i,o=i;do(r.x=(i-y)*(m-x)&&(i-y)*(c-x)>=(o-y)*(r-x)&&(o-y)*(m-x)>=(p-y)*(c-x)}function L5(i,r){return i.next.i!==r.i&&i.prev.i!==r.i&&!function(o,c){var p=o;do{if(p.i!==o.i&&p.next.i!==o.i&&p.i!==c.i&&p.next.i!==c.i&&A2(p,p.next,o,c))return!0;p=p.next}while(p!==o);return!1}(i,r)&&(rf(i,r)&&rf(r,i)&&function(o,c){var p=o,m=!1,y=(o.x+c.x)/2,x=(o.y+c.y)/2;do p.y>x!=p.next.y>x&&p.next.y!==p.y&&y<(p.next.x-p.x)*(x-p.y)/(p.next.y-p.y)+p.x&&(m=!m),p=p.next;while(p!==o);return m}(i,r)&&(bn(i.prev,i,r.prev)||bn(i,r.prev,r))||J0(i,r)&&bn(i.prev,i,i.next)>0&&bn(r.prev,r,r.next)>0)}function bn(i,r,o){return(r.y-i.y)*(o.x-r.x)-(r.x-i.x)*(o.y-r.y)}function J0(i,r){return i.x===r.x&&i.y===r.y}function A2(i,r,o,c){var p=tg(bn(i,r,o)),m=tg(bn(i,r,c)),y=tg(bn(o,c,i)),x=tg(bn(o,c,r));return p!==m&&y!==x||!(p!==0||!eg(i,o,r))||!(m!==0||!eg(i,c,r))||!(y!==0||!eg(o,i,c))||!(x!==0||!eg(o,r,c))}function eg(i,r,o){return r.x<=Math.max(i.x,o.x)&&r.x>=Math.min(i.x,o.x)&&r.y<=Math.max(i.y,o.y)&&r.y>=Math.min(i.y,o.y)}function tg(i){return i>0?1:i<0?-1:0}function rf(i,r){return bn(i.prev,i,i.next)<0?bn(i,r,i.next)>=0&&bn(i,i.prev,r)>=0:bn(i,r,i.prev)<0||bn(i,i.next,r)<0}function I2(i,r){var o=new Wx(i.i,i.x,i.y),c=new Wx(r.i,r.x,r.y),p=i.next,m=r.prev;return i.next=r,r.prev=i,o.next=p,p.prev=o,c.next=o,o.prev=c,m.next=c,c.prev=m,c}function C2(i,r,o,c){var p=new Wx(i,r,o);return c?(p.next=c.next,p.prev=c,c.next.prev=p,c.next=p):(p.prev=p,p.next=p),p}function nf(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function Wx(i,r,o){this.i=i,this.x=r,this.y=o,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Gx(i,r,o,c){for(var p=0,m=r,y=o-c;m0&&o.holes.push(c+=i[p-1].length)}return o};var Hx=F(Vx.exports);function B5(i,r,o,c,p){k2(i,r,o||0,c||i.length-1,p||N5)}function k2(i,r,o,c,p){for(;c>o;){if(c-o>600){var m=c-o+1,y=r-o+1,x=Math.log(m),E=.5*Math.exp(2*x/3),S=.5*Math.sqrt(x*E*(m-E)/m)*(y-m/2<0?-1:1);k2(i,r,Math.max(o,Math.floor(r-y*E/m+S)),Math.min(c,Math.floor(r+(m-y)*E/m+S)),p)}var k=i[r],M=o,O=c;for(of(i,o,r),p(i[c],k)>0&&of(i,o,c);M0;)O--}p(i[o],k)===0?of(i,o,O):of(i,++O,c),O<=r&&(o=O+1),r<=O&&(c=O-1)}}function of(i,r,o){var c=i[r];i[r]=i[o],i[o]=c}function N5(i,r){return ir?1:0}function qx(i,r){const o=i.length;if(o<=1)return[i];const c=[];let p,m;for(let y=0;y1)for(let y=0;yo.id),this.index=r.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new st,this.indexArray=new Pt,this.indexArray2=new Gn,this.programConfigurations=new tu(r.layers,r.zoom),this.segments=new xn,this.segments2=new xn,this.stateDependentLayerIds=this.layers.filter(o=>o.isStateDependent()).map(o=>o.id),this.projection=r.projection}populate(r,o,c,p){this.hasPattern=Zx("fill",this.layers,o);const m=this.layers[0].layout.get("fill-sort-key"),y=[];for(const{feature:x,id:E,index:S,sourceLayerIndex:k}of r){const M=this.layers[0]._featureFilter.needGeometry,O=su(x,M);if(!this.layers[0]._featureFilter.filter(new D(this.zoom),O,c))continue;const $=m?m.evaluate(O,{},c,o.availableImages):void 0,G={id:E,properties:x.properties,type:x.type,sourceLayerIndex:k,index:S,geometry:M?O.geometry:Hs(x,c,p),patterns:{},sortKey:$};y.push(G)}m&&y.sort((x,E)=>x.sortKey-E.sortKey);for(const x of y){const{geometry:E,index:S,sourceLayerIndex:k}=x;if(this.hasPattern){const M=Kx("fill",this.layers,x,this.zoom,o);this.patternFeatures.push(M)}else this.addFeature(x,E,S,c,{},o.availableImages);o.featureIndex.insert(r[S].feature,E,S,k,this.index)}}update(r,o,c,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(r,o,this.stateDependentLayers,c,p)}addFeatures(r,o,c,p,m){for(const y of this.patternFeatures)this.addFeature(y,y.geometry,y.index,o,c,p)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(r){this.uploaded||(this.layoutVertexBuffer=r.createVertexBuffer(this.layoutVertexArray,C5),this.indexBuffer=r.createIndexBuffer(this.indexArray),this.indexBuffer2=r.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(r),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(r,o,c,p,m,y=[]){for(const x of qx(o,500)){let E=0;for(const G of x)E+=G.length;const S=this.segments.prepareSegment(E,this.layoutVertexArray,this.indexArray),k=S.vertexLength,M=[],O=[];for(const G of x){if(G.length===0)continue;G!==x[0]&&O.push(M.length/2);const K=this.segments2.prepareSegment(G.length,this.layoutVertexArray,this.indexArray2),ee=K.vertexLength;this.layoutVertexArray.emplaceBack(G[0].x,G[0].y),this.indexArray2.emplaceBack(ee+G.length-1,ee),M.push(G[0].x),M.push(G[0].y);for(let le=1;le>3}if(p--,c===1||c===2)m+=i.readSVarint(),y+=i.readSVarint(),c===1&&(r&&x.push(r),r=[]),r.push(new q5(m,y));else{if(c!==7)throw new Error("unknown command "+c);r&&r.push(r[0].clone())}}return r&&x.push(r),x},Ih.prototype.bbox=function(){var i=this._pbf;i.pos=this._geometry;for(var r=i.readVarint()+i.pos,o=1,c=0,p=0,m=0,y=1/0,x=-1/0,E=1/0,S=-1/0;i.pos>3}if(c--,o===1||o===2)(p+=i.readSVarint())x&&(x=p),(m+=i.readSVarint())S&&(S=m);else if(o!==7)throw new Error("unknown command "+o)}return[y,E,x,S]},Ih.prototype.toGeoJSON=function(i,r,o){var c,p,m=this.extent*Math.pow(2,o),y=this.extent*i,x=this.extent*r,E=this.loadGeometry(),S=Ih.types[this.type];function k($){for(var G=0;G<$.length;G++){var K=$[G];$[G]=[360*(K.x+y)/m-180,360/Math.PI*Math.atan(Math.exp((180-360*(K.y+x)/m)*Math.PI/180))-90]}}switch(this.type){case 1:var M=[];for(c=0;c>3;p=y===1?c.readString():y===2?c.readFloat():y===3?c.readDouble():y===4?c.readVarint64():y===5?c.readVarint():y===6?c.readSVarint():y===7?c.readBoolean():null}return p}(o))}M2.prototype.feature=function(i){if(i<0||i>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[i];var r=this._pbf.readVarint()+this._pbf.pos;return new X5(this._pbf,r,this.extent,this._keys,this._values)};var Q5=D2;function J5(i,r,o){if(i===3){var c=new Q5(o,o.readVarint()+o.pos);c.length&&(r[c.name]=c)}}var Xx=ng.VectorTile=function(i,r){this.layers=i.readFields(J5,{},r)},ig=ng.VectorTileFeature=P2;function og(i,r,o,c){const p=[],m=c===0?(y,x,E,S,k,M)=>{y.push(new xe(M,E+(M-x)/(S-x)*(k-E)))}:(y,x,E,S,k,M)=>{y.push(new xe(x+(M-E)/(k-E)*(S-x),M))};for(const y of i){const x=[];for(const E of y){if(E.length<=2)continue;const S=[];for(let O=0;Or&&m(S,$,G,K,ee,r):le>o?me=r&&m(S,$,G,K,ee,r),me>o&&le<=o&&m(S,$,G,K,ee,o)}let k=E[E.length-1];const M=c===0?k.x:k.y;M>=r&&M<=o&&S.push(k),S.length&&(k=S[S.length-1],S[0].x===k.x&&S[0].y===k.y||S.push(S[0]),x.push(S))}x.length&&p.push(x)}return p}ng.VectorTileLayer=D2;const eF=ig.types,tF=Math.pow(2,13);function af(i,r,o,c,p,m,y,x){i.emplaceBack((r<<1)+y,(o<<1)+m,(Math.floor(c*tF)<<1)+p,Math.round(x))}function sf(i,r,o){i.emplaceBack(r.x,r.y,r.z,o[0]*16384,o[1]*16384,o[2]*16384)}class z2{constructor(){this.acc=new xe(0,0),this.polyCount=[]}startRing(r){this.currentPolyCount={edges:0,top:0},this.polyCount.push(this.currentPolyCount),this.min||(this.min=new xe(r.x,r.y),this.max=new xe(r.x,r.y))}append(r,o){this.currentPolyCount.edges++,this.acc._add(r);const c=this.min,p=this.max;r.xp.x&&(p.x=r.x),r.yp.y&&(p.y=r.y),((r.x===0||r.x===Ot)&&r.x===o.x)!=((r.y===0||r.y===Ot)&&r.y===o.y)&&this.processBorderOverlap(r,o),o.x<0!=r.x<0&&this.addBorderIntersection(0,dr(o.y,r.y,(0-o.x)/(r.x-o.x))),o.x>Ot!=r.x>Ot&&this.addBorderIntersection(1,dr(o.y,r.y,(Ot-o.x)/(r.x-o.x))),o.y<0!=r.y<0&&this.addBorderIntersection(2,dr(o.x,r.x,(0-o.y)/(r.y-o.y))),o.y>Ot!=r.y>Ot&&this.addBorderIntersection(3,dr(o.x,r.x,(Ot-o.y)/(r.y-o.y)))}addBorderIntersection(r,o){this.borders||(this.borders=[[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE]]);const c=this.borders[r];oc[1]&&(c[1]=o)}processBorderOverlap(r,o){if(r.x===o.x){if(r.y===o.y)return;const c=r.x===0?0:1;this.addBorderIntersection(c,o.y),this.addBorderIntersection(c,r.y)}else{const c=r.y===0?2:3;this.addBorderIntersection(c,o.x),this.addBorderIntersection(c,r.x)}}centroid(){const r=this.polyCount.reduce((o,c)=>o+c.edges,0);return r!==0?this.acc.div(r)._round():new xe(0,0)}span(){return new xe(this.max.x-this.min.x,this.max.y-this.min.y)}intersectsCount(){return this.borders.reduce((r,o)=>r+ +(o[0]!==Number.MAX_VALUE),0)}}class lf{constructor(r){this.zoom=r.zoom,this.canonical=r.canonical,this.overscaling=r.overscaling,this.layers=r.layers,this.layerIds=this.layers.map(o=>o.id),this.index=r.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=r.projection,this.layoutVertexArray=new Ke,this.centroidVertexArray=new Ca,this.indexArray=new Pt,this.programConfigurations=new tu(r.layers,r.zoom),this.segments=new xn,this.stateDependentLayerIds=this.layers.filter(o=>o.isStateDependent()).map(o=>o.id),this.enableTerrain=r.enableTerrain}populate(r,o,c,p){this.features=[],this.hasPattern=Zx("fill-extrusion",this.layers,o),this.featuresOnBorder=[],this.borders=[[],[],[],[]],this.borderDoneWithNeighborZ=[-1,-1,-1,-1],this.tileToMeter=function(m){const y=Math.exp(Math.PI*(1-m.y/(1<=0;le--){const me=$[le];(me.length===0||(G=me[0]).every(ce=>ce.x<=0)||G.every(ce=>ce.x>=Ot)||G.every(ce=>ce.y<=0)||G.every(ce=>ce.y>=Ot))&&$.splice(le,1)}var G;let K;if(k)K=U2($,E,p);else{K=[];for(const le of $)K.push({polygon:le,bounds:E})}const ee=O?this.edgeRadius:0;for(const{polygon:le,bounds:me}of K){let ce=0,pe=0;for(const ye of le)O&&!ye[0].equals(ye[ye.length-1])&&ye.push(ye[0]),pe+=O?ye.length-1:ye.length;const _e=this.segments.prepareSegment((O?5:4)*pe,this.layoutVertexArray,this.indexArray);if(O){const ye=[],Oe=[];ce=_e.vertexLength;for(const He of le){let lt,Ue;He.length&&He!==le[0]&&Oe.push(ye.length/2),lt=He[1].sub(He[0])._perp()._unit();for(let Qe=1;Qe4&&L2(ye[ye.length-2],ye[0],ye[1]),Ue=ee?rF(ye[ye.length-2],ye[0],ye[1],ee):0;Me=ye[1].sub(ye[0])._perp()._unit();let Qe=!0;for(let Je=1,ot=0;Je0?1:0,ft=pt.dist(We);if(ot+ft>32768&&(ot=0),ee){He=_t.sub(We)._perp()._unit();let qt=O2(pt,We,_t,R2(Me,He),ee);isNaN(qt)&&(qt=0);const Bt=We.sub(pt)._unit();pt=pt.add(Bt.mult(Ue))._round(),We=We.add(Bt.mult(-qt))._round(),Ue=qt,Me=He}const zt=_e.vertexLength,Ht=ye.length>4&&L2(pt,We,_t);let fr=B2(ot,lt,Qe);if(af(this.layoutVertexArray,pt.x,pt.y,vt,Gt,0,0,fr),af(this.layoutVertexArray,pt.x,pt.y,vt,Gt,0,1,fr),ot+=ft,fr=B2(ot,Ht,!Qe),lt=Ht,af(this.layoutVertexArray,We.x,We.y,vt,Gt,0,0,fr),af(this.layoutVertexArray,We.x,We.y,vt,Gt,0,1,fr),_e.vertexLength+=4,this.indexArray.emplaceBack(zt+0,zt+1,zt+2),this.indexArray.emplaceBack(zt+1,zt+3,zt+2),_e.primitiveLength+=2,ee){const qt=ce+(Je===1?ye.length-2:Je-2),Bt=Je===1?ce:qt+1;if(this.indexArray.emplaceBack(zt+1,qt,zt+3),this.indexArray.emplaceBack(qt,Bt,zt+3),_e.primitiveLength+=2,Oe===void 0&&(Oe=zt),!F2(_t,ye[Je],me)){const Hr=Je===ye.length-1?Oe:_e.vertexLength;this.indexArray.emplaceBack(zt+2,zt+3,Hr),this.indexArray.emplaceBack(zt+3,Hr+1,Hr),this.indexArray.emplaceBack(zt+3,Bt,Hr+1),_e.primitiveLength+=3}Qe=!Qe}if(k){const qt=this.layoutVertexExtArray,Bt=S.projectTilePoint(pt.x,pt.y,p),Hr=S.projectTilePoint(We.x,We.y,p),Zt=S.upVector(p,pt.x,pt.y),Kt=S.upVector(p,We.x,We.y);sf(qt,Bt,Zt),sf(qt,Bt,Zt),sf(qt,Hr,Kt),sf(qt,Hr,Kt)}}O&&(ce+=ye.length-1)}}if(M&&M.polyCount.length>0){if(M.borders){M.vertexArrayOffset=this.centroidVertexArray.length;const le=M.borders,me=this.featuresOnBorder.push(M)-1;for(let ce=0;ce<4;ce++)le[ce][0]!==Number.MAX_VALUE&&this.borders[ce].push(me)}this.encodeCentroid(M.borders?void 0:M.centroid(),M)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,r,c,m,y,p)}sortBorders(){for(let r=0;r<4;r++)this.borders[r].sort((o,c)=>this.featuresOnBorder[o].borders[r][0]-this.featuresOnBorder[c].borders[r][0])}encodeCentroid(r,o,c=!0){let p,m;if(r)if(r.y!==0){const x=o.span()._mult(this.tileToMeter);p=(Math.max(r.x,1)<<3)+Math.min(7,Math.round(x.x/10)),m=(Math.max(r.y,1)<<3)+Math.min(7,Math.round(x.y/10))}else p=Math.ceil(7*(r.x+450)),m=0;else p=0,m=+c;let y=c?this.centroidVertexArray.length:o.vertexArrayOffset;for(const x of o.polyCount){c&&this.centroidVertexArray.resize(this.centroidVertexArray.length+4*x.edges+x.top);for(let E=0;Eo[1].x&&r.x>o[1].x||i.yo[1].y&&r.y>o[1].y}function L2(i,r,o){if(i.x<0||i.x>=Ot||r.x<0||r.x>=Ot||o.x<0||o.x>=Ot)return!1;const c=o.sub(r),p=c.perp(),m=i.sub(r);return(c.x*m.x+c.y*m.y)/Math.sqrt((c.x*c.x+c.y*c.y)*(m.x*m.x+m.y*m.y))>-.866&&p.x*m.x+p.y*m.y<0}function B2(i,r,o){const c=r?2|i:-3&i;return o?1|c:-2&c}function N2(){const i=Math.PI/32,r=Math.tan(i),o=ef;return o*Math.sqrt(1+2*r*r)-o}function U2(i,r,o){const c=1<{for(const Me of ye)G.push({polygon:Me,bounds:Oe})},ee=Math.ceil(Math.log2(k)),le=Math.ceil(Math.log2(M)),me=ee-le,ce=[];for(let ye=0;ye0?0:1);for(let ye=0;yeOe+1?_e.push({polygons:ot,bounds:We,depth:Oe+1}):K(ot,We)}if(pt.length){const We=[new xe(Me===0?Je:He.x,Me===1?Je:He.y),lt];ce.length>Oe+1?_e.push({polygons:pt,bounds:We,depth:Oe+1}):K(pt,We)}}return G}(i,r,Math.ceil((m-p)/11.25),Math.ceil((y-x)/11.25),1,(E,S,k)=>{if(E===0)return .5*(S+k);{const M=hi((o.y+S/Ot)/c);return(as(.5*(hi((o.y+k/Ot)/c)+M))*c-o.y)*Ot}})}At(lf,"FillExtrusionBucket",{omit:["layers","features"]}),At(z2,"PartMetadata");const nF=new he({"fill-extrusion-edge-radius":new Z(Ge["layout_fill-extrusion"]["fill-extrusion-edge-radius"])});var iF={paint:new he({"fill-extrusion-opacity":new Z(Ge["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new re(Ge["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Z(Ge["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Z(Ge["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new re(Ge["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new re(Ge["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new re(Ge["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Z(Ge["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-ambient-occlusion-intensity":new Z(Ge["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),"fill-extrusion-ambient-occlusion-radius":new Z(Ge["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"]),"fill-extrusion-rounded-roof":new Z(Ge["paint_fill-extrusion"]["fill-extrusion-rounded-roof"])}),layout:nF};function j2(i,r,o){var c=2*Math.PI*6378137/256/Math.pow(2,o);return[i*c-2*Math.PI*6378137/2,r*c-2*Math.PI*6378137/2]}class ag{constructor(r,o,c){this.z=r,this.x=o,this.y=c,this.key=cf(0,r,r,o,c)}equals(r){return this.z===r.z&&this.x===r.x&&this.y===r.y}url(r,o){const c=function(m,y,x){var E=j2(256*m,256*(y=Math.pow(2,x)-y-1),x),S=j2(256*(m+1),256*(y+1),x);return E[0]+","+E[1]+","+S[0]+","+S[1]}(this.x,this.y,this.z),p=function(m,y,x){let E,S="";for(let k=m;k>0;k--)E=1<this.canonical.z?new zi(r,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new zi(r,this.wrap,r,this.canonical.x>>o,this.canonical.y>>o)}calculateScaledKey(r,o=!0){if(this.overscaledZ===r&&o)return this.key;if(r>this.canonical.z)return cf(this.wrap*+o,r,this.canonical.z,this.canonical.x,this.canonical.y);{const c=this.canonical.z-r;return cf(this.wrap*+o,r,r,this.canonical.x>>c,this.canonical.y>>c)}}isChildOf(r){if(r.wrap!==this.wrap)return!1;const o=this.canonical.z-r.canonical.z;return r.overscaledZ===0||r.overscaledZ>o&&r.canonical.y===this.canonical.y>>o}children(r){if(this.overscaledZ>=r)return[new zi(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const o=this.canonical.z+1,c=2*this.canonical.x,p=2*this.canonical.y;return[new zi(o,this.wrap,o,c,p),new zi(o,this.wrap,o,c+1,p),new zi(o,this.wrap,o,c,p+1),new zi(o,this.wrap,o,c+1,p+1)]}isLessThan(r){return this.wrapr.wrap)&&(this.overscaledZr.overscaledZ)&&(this.canonical.xr.canonical.x)&&this.canonical.yo.id),this.index=r.index,this.projection=r.projection,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(o=>{this.gradients[o.id]={}}),this.layoutVertexArray=new Ne,this.layoutVertexArray2=new at,this.indexArray=new Pt,this.programConfigurations=new tu(r.layers,r.zoom),this.segments=new xn,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(o=>o.isStateDependent()).map(o=>o.id)}populate(r,o,c,p){this.hasPattern=Zx("line",this.layers,o);const m=this.layers[0].layout.get("line-sort-key"),y=[];for(const{feature:k,id:M,index:O,sourceLayerIndex:$}of r){const G=this.layers[0]._featureFilter.needGeometry,K=su(k,G);if(!this.layers[0]._featureFilter.filter(new D(this.zoom),K,c))continue;const ee=m?m.evaluate(K,{},c):void 0,le={id:M,properties:k.properties,type:k.type,sourceLayerIndex:$,index:O,geometry:G?K.geometry:Hs(k,c,p),patterns:{},sortKey:ee};y.push(le)}m&&y.sort((k,M)=>k.sortKey-M.sortKey);const{lineAtlas:x,featureIndex:E}=o,S=this.addConstantDashes(x);for(const k of y){const{geometry:M,index:O,sourceLayerIndex:$}=k;if(S&&this.addFeatureDashes(k,x),this.hasPattern){const G=Kx("line",this.layers,k,this.zoom,o);this.patternFeatures.push(G)}else this.addFeature(k,M,O,c,x.positions,o.availableImages);E.insert(r[O].feature,M,O,$,this.index)}}addConstantDashes(r){let o=!1;for(const c of this.layers){const p=c.paint.get("line-dasharray").value,m=c.layout.get("line-cap").value;if(p.kind!=="constant"||m.kind!=="constant")o=!0;else{const y=m.value,x=p.value;if(!x)continue;r.addDash(x,y)}}return o}addFeatureDashes(r,o){const c=this.zoom;for(const p of this.layers){const m=p.paint.get("line-dasharray").value,y=p.layout.get("line-cap").value;if(m.kind==="constant"&&y.kind==="constant")continue;let x,E;if(m.kind==="constant"){if(x=m.value,!x)continue}else x=m.evaluate({zoom:c},r);E=y.kind==="constant"?y.value:y.evaluate({zoom:c},r),o.addDash(x,E),r.patterns[p.id]=o.getKey(x,E)}}update(r,o,c,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(r,o,this.stateDependentLayers,c,p)}addFeatures(r,o,c,p,m){for(const y of this.patternFeatures)this.addFeature(y,y.geometry,y.index,o,c,p)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(r){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=r.createVertexBuffer(this.layoutVertexArray2,lF)),this.layoutVertexBuffer=r.createVertexBuffer(this.layoutVertexArray,aF),this.indexBuffer=r.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(r),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(r){if(r.properties&&r.properties.hasOwnProperty("mapbox_clip_start")&&r.properties.hasOwnProperty("mapbox_clip_end"))return{start:+r.properties.mapbox_clip_start,end:+r.properties.mapbox_clip_end}}addFeature(r,o,c,p,m,y){const x=this.layers[0].layout,E=x.get("line-join").evaluate(r,{}),S=x.get("line-cap").evaluate(r,{}),k=x.get("line-miter-limit"),M=x.get("line-round-limit");this.lineClips=this.lineFeatureClips(r);for(const O of o)this.addLine(O,r,E,S,k,M);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,r,c,m,y,p)}addLine(r,o,c,p,m,y){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineSoFar=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let le=0;le=2&&r[E-1].equals(r[E-2]);)E--;let S=0;for(;S0;if(Oe&&le>S){const Ue=O.dist($);if(Ue>2*k){const Qe=O.sub(O.sub($)._mult(k/Ue)._round());this.updateDistance($,Qe),this.addCurrentVertex(Qe,K,0,0,M),$=Qe}}const He=$&&G;let lt=He?c:x?"butt":p;if(He&<==="round"&&(_em&&(lt="bevel"),lt==="bevel"&&(_e>2&&(lt="flipbevel"),_e100)me=ee.mult(-1);else{const Ue=_e*K.add(ee).mag()/K.sub(ee).mag();me._perp()._mult(Ue*(Me?-1:1))}this.addCurrentVertex(O,me,0,0,M),this.addCurrentVertex(O,me.mult(-1),0,0,M)}else if(lt==="bevel"||lt==="fakeround"){const Ue=-Math.sqrt(_e*_e-1),Qe=Me?Ue:0,Je=Me?0:Ue;if($&&this.addCurrentVertex(O,K,Qe,Je,M),lt==="fakeround"){const ot=Math.round(180*ye/Math.PI/20);for(let pt=1;pt2*k){const Qe=O.add(G.sub(O)._mult(k/Ue)._round());this.updateDistance(O,Qe),this.addCurrentVertex(Qe,ee,0,0,M),O=Qe}}}}addCurrentVertex(r,o,c,p,m,y=!1){const x=o.y*p-o.x,E=-o.y-o.x*p;this.addHalfVertex(r,o.x+o.y*c,o.y-o.x*c,y,!1,c,m),this.addHalfVertex(r,x,E,y,!0,-p,m)}addHalfVertex({x:r,y:o},c,p,m,y,x,E){this.layoutVertexArray.emplaceBack((r<<1)+(m?1:0),(o<<1)+(y?1:0),Math.round(63*c)+128,Math.round(63*p)+128,1+(x===0?0:x<0?-1:1),0,this.lineSoFar),this.lineClips&&this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,this.lineClips.start,this.lineClips.end);const S=E.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,S),E.primitiveLength++),y?this.e2=S:this.e1=S}updateScaledDistance(){if(this.lineClips){const r=this.totalDistance/(this.lineClips.end-this.lineClips.start);this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=r*this.lineClips.start+this.distance}else this.lineSoFar=this.distance}updateDistance(r,o){this.distance+=r.dist(o),this.updateScaledDistance()}}At(sg,"LineBucket",{omit:["layers","patternFeatures"]});const hF=new he({"line-cap":new re(Ge.layout_line["line-cap"]),"line-join":new re(Ge.layout_line["line-join"]),"line-miter-limit":new Z(Ge.layout_line["line-miter-limit"]),"line-round-limit":new Z(Ge.layout_line["line-round-limit"]),"line-sort-key":new re(Ge.layout_line["line-sort-key"])});var G2={paint:new he({"line-opacity":new re(Ge.paint_line["line-opacity"]),"line-color":new re(Ge.paint_line["line-color"]),"line-translate":new Z(Ge.paint_line["line-translate"]),"line-translate-anchor":new Z(Ge.paint_line["line-translate-anchor"]),"line-width":new re(Ge.paint_line["line-width"]),"line-gap-width":new re(Ge.paint_line["line-gap-width"]),"line-offset":new re(Ge.paint_line["line-offset"]),"line-blur":new re(Ge.paint_line["line-blur"]),"line-dasharray":new re(Ge.paint_line["line-dasharray"]),"line-pattern":new re(Ge.paint_line["line-pattern"]),"line-gradient":new ue(Ge.paint_line["line-gradient"]),"line-trim-offset":new Z(Ge.paint_line["line-trim-offset"])}),layout:hF};const H2=new class extends re{possiblyEvaluate(i,r){return r=new D(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,transition:r.transition}),super.possiblyEvaluate(i,r)}evaluate(i,r,o,c){return r=nt({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(i,r,o,c)}}(G2.paint.properties["line-width"].specification);function q2(i,r){return r>0?r+2*i:i}H2.useIntegerZoom=!0;const dF=Ie([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),pF=Ie([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),fF=Ie([{name:"a_projected_pos",components:4,type:"Float32"}],4);Ie([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const mF=Ie([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]),gF=Ie([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"}]);Ie([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"tileAnchorX"},{type:"Int16",name:"tileAnchorY"},{type:"Float32",name:"x1"},{type:"Float32",name:"y1"},{type:"Float32",name:"x2"},{type:"Float32",name:"y2"},{type:"Int16",name:"padding"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const Z2=Ie([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),yF=Ie([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);Ie([{name:"triangle",components:3,type:"Uint16"}]),Ie([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"},{type:"Uint8",name:"flipState"}]),Ie([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{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",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),Ie([{type:"Float32",name:"offsetX"}]),Ie([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);var ei=24;const Ra=128;function Yx(i,r){const{expression:o}=r;if(o.kind==="constant")return{kind:"constant",layoutSize:o.evaluate(new D(i+1))};if(o.kind==="source")return{kind:"source"};{const{zoomStops:c,interpolationType:p}=o;let m=0;for(;m{c.text=function(p,m,y){const x=m.layout.get("text-transform").evaluate(y,{});return x==="uppercase"?p=p.toLocaleUpperCase():x==="lowercase"&&(p=p.toLocaleLowerCase()),I.applyArabicShaping&&(p=I.applyArabicShaping(p)),p}(c.text,r,o)}),i}const hf={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂","←":"↑","→":"↓"};function xF(i){return i==="︶"||i==="﹈"||i==="︸"||i==="﹄"||i==="﹂"||i==="︾"||i==="︼"||i==="︺"||i==="︘"||i==="﹀"||i==="︐"||i==="︓"||i==="︔"||i==="`"||i===" ̄"||i==="︑"||i==="︒"}function bF(i){return i==="︵"||i==="﹇"||i==="︷"||i==="﹃"||i==="﹁"||i==="︽"||i==="︻"||i==="︹"||i==="︗"||i==="︿"}var K2=jr,X2=function(i,r,o,c,p){var m,y,x=8*p-c-1,E=(1<>1,k=-7,M=o?p-1:0,O=o?-1:1,$=i[r+M];for(M+=O,m=$&(1<<-k)-1,$>>=-k,k+=x;k>0;m=256*m+i[r+M],M+=O,k-=8);for(y=m&(1<<-k)-1,m>>=-k,k+=c;k>0;y=256*y+i[r+M],M+=O,k-=8);if(m===0)m=1-S;else{if(m===E)return y?NaN:1/0*($?-1:1);y+=Math.pow(2,c),m-=S}return($?-1:1)*y*Math.pow(2,m-c)},Y2=function(i,r,o,c,p,m){var y,x,E,S=8*m-p-1,k=(1<>1,O=p===23?Math.pow(2,-24)-Math.pow(2,-77):0,$=c?0:m-1,G=c?1:-1,K=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(x=isNaN(r)?1:0,y=k):(y=Math.floor(Math.log(r)/Math.LN2),r*(E=Math.pow(2,-y))<1&&(y--,E*=2),(r+=y+M>=1?O/E:O*Math.pow(2,1-M))*E>=2&&(y++,E/=2),y+M>=k?(x=0,y=k):y+M>=1?(x=(r*E-1)*Math.pow(2,p),y+=M):(x=r*Math.pow(2,M-1)*Math.pow(2,p),y=0));p>=8;i[o+$]=255&x,$+=G,x/=256,p-=8);for(y=y<0;i[o+$]=255&y,$+=G,y/=256,S-=8);i[o+$-G]|=128*K};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */function jr(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}jr.Varint=0,jr.Fixed64=1,jr.Bytes=2,jr.Fixed32=5;var Qx=4294967296,Q2=1/Qx,J2=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function Zs(i){return i.type===jr.Bytes?i.readVarint()+i.pos:i.pos+1}function Ph(i,r,o){return o?4294967296*r+(i>>>0):4294967296*(r>>>0)+(i>>>0)}function eI(i,r,o){var c=r<=16383?1:r<=2097151?2:r<=268435455?3:Math.floor(Math.log(r)/(7*Math.LN2));o.realloc(c);for(var p=o.pos-1;p>=i;p--)o.buf[p+c]=o.buf[p]}function wF(i,r){for(var o=0;o>>8,i[o+2]=r>>>16,i[o+3]=r>>>24}function tI(i,r){return(i[r]|i[r+1]<<8|i[r+2]<<16)+(i[r+3]<<24)}jr.prototype={destroy:function(){this.buf=null},readFields:function(i,r,o){for(o=o||this.length;this.pos>3,m=this.pos;this.type=7&c,i(p,r,this),this.pos===m&&this.skip(c)}return r},readMessage:function(i,r){return this.readFields(i,r,this.readVarint()+this.pos)},readFixed32:function(){var i=cg(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=tI(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=cg(this.buf,this.pos)+cg(this.buf,this.pos+4)*Qx;return this.pos+=8,i},readSFixed64:function(){var i=cg(this.buf,this.pos)+tI(this.buf,this.pos+4)*Qx;return this.pos+=8,i},readFloat:function(){var i=X2(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=X2(this.buf,this.pos,!0,52,8);return this.pos+=8,i},readVarint:function(i){var r,o,c=this.buf;return r=127&(o=c[this.pos++]),o<128?r:(r|=(127&(o=c[this.pos++]))<<7,o<128?r:(r|=(127&(o=c[this.pos++]))<<14,o<128?r:(r|=(127&(o=c[this.pos++]))<<21,o<128?r:function(p,m,y){var x,E,S=y.buf;if(x=(112&(E=S[y.pos++]))>>4,E<128||(x|=(127&(E=S[y.pos++]))<<3,E<128)||(x|=(127&(E=S[y.pos++]))<<10,E<128)||(x|=(127&(E=S[y.pos++]))<<17,E<128)||(x|=(127&(E=S[y.pos++]))<<24,E<128)||(x|=(1&(E=S[y.pos++]))<<31,E<128))return Ph(p,x,m);throw new Error("Expected varint not more than 10 bytes")}(r|=(15&(o=c[this.pos]))<<28,i,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var i=this.readVarint();return i%2==1?(i+1)/-2:i/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var i=this.readVarint()+this.pos,r=this.pos;return this.pos=i,i-r>=12&&J2?function(o,c,p){return J2.decode(o.subarray(c,p))}(this.buf,r,i):function(o,c,p){for(var m="",y=c;y239?4:k>223?3:k>191?2:1;if(y+O>p)break;O===1?k<128&&(M=k):O===2?(192&(x=o[y+1]))==128&&(M=(31&k)<<6|63&x)<=127&&(M=null):O===3?(E=o[y+2],(192&(x=o[y+1]))==128&&(192&E)==128&&((M=(15&k)<<12|(63&x)<<6|63&E)<=2047||M>=55296&&M<=57343)&&(M=null)):O===4&&(E=o[y+2],S=o[y+3],(192&(x=o[y+1]))==128&&(192&E)==128&&(192&S)==128&&((M=(15&k)<<18|(63&x)<<12|(63&E)<<6|63&S)<=65535||M>=1114112)&&(M=null)),M===null?(M=65533,O=1):M>65535&&(M-=65536,m+=String.fromCharCode(M>>>10&1023|55296),M=56320|1023&M),m+=String.fromCharCode(M),y+=O}return m}(this.buf,r,i)},readBytes:function(){var i=this.readVarint()+this.pos,r=this.buf.subarray(this.pos,i);return this.pos=i,r},readPackedVarint:function(i,r){if(this.type!==jr.Bytes)return i.push(this.readVarint(r));var o=Zs(this);for(i=i||[];this.pos127;);else if(r===jr.Bytes)this.pos=this.readVarint()+this.pos;else if(r===jr.Fixed32)this.pos+=4;else{if(r!==jr.Fixed64)throw new Error("Unimplemented type: "+r);this.pos+=8}},writeTag:function(i,r){this.writeVarint(i<<3|r)},realloc:function(i){for(var r=this.length||16;r268435455||i<0?function(r,o){var c,p;if(r>=0?(c=r%4294967296|0,p=r/4294967296|0):(p=~(-r/4294967296),4294967295^(c=~(-r%4294967296))?c=c+1|0:(c=0,p=p+1|0)),r>=18446744073709552e3||r<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");o.realloc(10),function(m,y,x){x.buf[x.pos++]=127&m|128,m>>>=7,x.buf[x.pos++]=127&m|128,m>>>=7,x.buf[x.pos++]=127&m|128,m>>>=7,x.buf[x.pos++]=127&m|128,x.buf[x.pos]=127&(m>>>=7)}(c,0,o),function(m,y){var x=(7&m)<<4;y.buf[y.pos++]|=x|((m>>>=3)?128:0),m&&(y.buf[y.pos++]=127&m|((m>>>=7)?128:0),m&&(y.buf[y.pos++]=127&m|((m>>>=7)?128:0),m&&(y.buf[y.pos++]=127&m|((m>>>=7)?128:0),m&&(y.buf[y.pos++]=127&m|((m>>>=7)?128:0),m&&(y.buf[y.pos++]=127&m)))))}(p,o)}(i,this):(this.realloc(4),this.buf[this.pos++]=127&i|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=i>>>7&127))))},writeSVarint:function(i){this.writeVarint(i<0?2*-i-1:2*i)},writeBoolean:function(i){this.writeVarint(!!i)},writeString:function(i){i=String(i),this.realloc(4*i.length),this.pos++;var r=this.pos;this.pos=function(c,p,m){for(var y,x,E=0;E55295&&y<57344){if(!x){y>56319||E+1===p.length?(c[m++]=239,c[m++]=191,c[m++]=189):x=y;continue}if(y<56320){c[m++]=239,c[m++]=191,c[m++]=189,x=y;continue}y=x-55296<<10|y-56320|65536,x=null}else x&&(c[m++]=239,c[m++]=191,c[m++]=189,x=null);y<128?c[m++]=y:(y<2048?c[m++]=y>>6|192:(y<65536?c[m++]=y>>12|224:(c[m++]=y>>18|240,c[m++]=y>>12&63|128),c[m++]=y>>6&63|128),c[m++]=63&y|128)}return m}(this.buf,i,this.pos);var o=this.pos-r;o>=128&&eI(r,o,this),this.pos=r-1,this.writeVarint(o),this.pos+=o},writeFloat:function(i){this.realloc(4),Y2(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),Y2(this.buf,i,this.pos,!0,52,8),this.pos+=8},writeBytes:function(i){var r=i.length;this.writeVarint(r),this.realloc(r);for(var o=0;o=128&&eI(o,c,this),this.pos=o-1,this.writeVarint(c),this.pos+=c},writeMessage:function(i,r,o){this.writeTag(i,jr.Bytes),this.writeRawMessage(r,o)},writePackedVarint:function(i,r){r.length&&this.writeMessage(i,wF,r)},writePackedSVarint:function(i,r){r.length&&this.writeMessage(i,EF,r)},writePackedBoolean:function(i,r){r.length&&this.writeMessage(i,AF,r)},writePackedFloat:function(i,r){r.length&&this.writeMessage(i,SF,r)},writePackedDouble:function(i,r){r.length&&this.writeMessage(i,TF,r)},writePackedFixed32:function(i,r){r.length&&this.writeMessage(i,IF,r)},writePackedSFixed32:function(i,r){r.length&&this.writeMessage(i,CF,r)},writePackedFixed64:function(i,r){r.length&&this.writeMessage(i,kF,r)},writePackedSFixed64:function(i,r){r.length&&this.writeMessage(i,PF,r)},writeBytesField:function(i,r){this.writeTag(i,jr.Bytes),this.writeBytes(r)},writeFixed32Field:function(i,r){this.writeTag(i,jr.Fixed32),this.writeFixed32(r)},writeSFixed32Field:function(i,r){this.writeTag(i,jr.Fixed32),this.writeSFixed32(r)},writeFixed64Field:function(i,r){this.writeTag(i,jr.Fixed64),this.writeFixed64(r)},writeSFixed64Field:function(i,r){this.writeTag(i,jr.Fixed64),this.writeSFixed64(r)},writeVarintField:function(i,r){this.writeTag(i,jr.Varint),this.writeVarint(r)},writeSVarintField:function(i,r){this.writeTag(i,jr.Varint),this.writeSVarint(r)},writeStringField:function(i,r){this.writeTag(i,jr.Bytes),this.writeString(r)},writeFloatField:function(i,r){this.writeTag(i,jr.Fixed32),this.writeFloat(r)},writeDoubleField:function(i,r){this.writeTag(i,jr.Fixed64),this.writeDouble(r)},writeBooleanField:function(i,r){this.writeVarintField(i,!!r)}};var ug=F(K2);const Jx=3;function DF(i,r,o){r.glyphs=[],i===1&&o.readMessage(MF,r)}function MF(i,r,o){if(i===3){const{id:c,bitmap:p,width:m,height:y,left:x,top:E,advance:S}=o.readMessage(zF,{});r.glyphs.push({id:c,bitmap:new qs({width:m+2*Jx,height:y+2*Jx},p),metrics:{width:m,height:y,left:x,top:E,advance:S}})}else i===4?r.ascender=o.readSVarint():i===5&&(r.descender=o.readSVarint())}function zF(i,r,o){i===1?r.id=o.readVarint():i===2?r.bitmap=o.readBytes():i===3?r.width=o.readVarint():i===4?r.height=o.readVarint():i===5?r.left=o.readSVarint():i===6?r.top=o.readSVarint():i===7&&(r.advance=o.readVarint())}const rI=Jx;function e1(i){let r=0,o=0;for(const y of i)r+=y.w*y.h,o=Math.max(o,y.w);i.sort((y,x)=>x.h-y.h);const c=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(r/.95)),o),h:1/0}];let p=0,m=0;for(const y of i)for(let x=c.length-1;x>=0;x--){const E=c[x];if(!(y.w>E.w||y.h>E.h)){if(y.x=E.x,y.y=E.y,m=Math.max(m,y.y+y.h),p=Math.max(p,y.x+y.w),y.w===E.w&&y.h===E.h){const S=c.pop();xr.hasImage(c)),r.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const c in r.updatedImages)this.patchUpdatedImage(this.iconPositions[c],r.getImage(c),o),this.patchUpdatedImage(this.patternPositions[c],r.getImage(c),o)}patchUpdatedImage(r,o,c){if(!r||!o||r.version===o.version)return;r.version=o.version;const[p,m]=r.tl;c.update(o.data,void 0,{x:p,y:m})}}At(t1,"ImagePosition"),At(nI,"ImageAtlas");const Do={horizontal:1,vertical:2,horizontalOnly:3},iI=-17;class df{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(r,o){const c=new df;return c.scale=r||1,c.fontStack=o,c}static forImage(r){const o=new df;return o.imageName=r,o}}class Mh{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(r,o){const c=new Mh;for(let p=0;p=0&&c>=r&&hg[this.text.charCodeAt(c)];c--)o--;this.text=this.text.substring(r,o),this.sectionIndex=this.sectionIndex.slice(r,o)}substring(r,o){const c=new Mh;return c.text=this.text.substring(r,o),c.sectionIndex=this.sectionIndex.slice(r,o),c.sections=this.sections,c}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((r,o)=>Math.max(r,this.sections[o].scale),0)}addTextSection(r,o){this.text+=r.text,this.sections.push(df.forText(r.scale,r.fontStack||o));const c=this.sections.length-1;for(let p=0;p=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function r1(i,r,o,c,p,m,y,x,E,S,k,M,O,$,G){const K=Mh.fromFeature(i,p);M===Do.vertical&&K.verticalizePunctuation(O);let ee=[];const le=function(ye,Oe,Me,He,lt,Ue){if(!ye)return[];const Qe=[],Je=function(_t,Ct,vt,Gt,ft,zt){let Ht=0;for(let fr=0;fr<_t.length();fr++){const qt=_t.getSection(fr);Ht+=oI(_t.getCharCode(fr),qt,Gt,ft,Ct,zt)}return Ht/Math.max(1,Math.ceil(Ht/vt))}(ye,Oe,Me,He,lt,Ue),ot=ye.text.indexOf("​")>=0;let pt=0;for(let _t=0;_t0&&La>Br&&(Br=La)}else{const Oi=Me[Rn.fontStack];if(!Oi)continue;Oi[nn]&&(Wr=Oi[nn]);const qn=Oe[Rn.fontStack];if(!qn)continue;const La=qn.glyphs[nn];if(!La)continue;if(Sn=La.metrics,Tn=nn!==8203?ei:0,zt){const Nh=qn.ascender!==void 0?Math.abs(qn.ascender):0,wf=qn.descender!==void 0?Math.abs(qn.descender):0,Ef=(Nh+wf)*yr;tn-o/2;){if(y--,y<0)return!1;x-=i[y].dist(m),m=i[y]}x+=i[y].dist(i[y+1]),y++;const E=[];let S=0;for(;xc;)S-=E.shift().angleDelta;if(S>p)return!1;y++,x+=k.dist(M)}return!0}function dI(i){let r=0;for(let o=0;oS){const G=(S-E)/$,K=dr(M.x,O.x,G),ee=dr(M.y,O.y,G),le=new Ks(K,ee,0,O.angleTo(M),k);return!y||hI(i,le,x,y,r)?le:void 0}E+=$}}function BF(i,r,o,c,p,m,y,x,E){const S=pI(c,m,y),k=fI(c,p),M=k*y,O=i[0].x===0||i[0].x===E||i[0].y===0||i[0].y===E;return r-M=0&&pe=0&&_e=0&&O+S<=k){const ye=new Ks(pe,_e,0,me,G);ye._round(),c&&!hI(i,ye,m,c,p)||$.push(ye)}}M+=le}return x||$.length||y||($=mI(i,M/2,o,c,p,m,y,!0,E)),$}function gI(i,r,o,c,p){const m=[];for(let y=0;y=c&&M.x>=c||(k.x>=c?k=new xe(c,k.y+(c-k.x)/(M.x-k.x)*(M.y-k.y))._round():M.x>=c&&(M=new xe(c,k.y+(c-k.x)/(M.x-k.x)*(M.y-k.y))._round()),k.y>=p&&M.y>=p||(k.y>=p?k=new xe(k.x+(p-k.y)/(M.y-k.y)*(M.x-k.x),p)._round():M.y>=p&&(M=new xe(k.x+(p-k.y)/(M.y-k.y)*(M.x-k.x),p)._round()),E&&k.equals(E[E.length-1])||(E=[k],m.push(E)),E.push(M)))))}}return m}At(Ks,"Anchor");const pf=1e20;function yI(i,r,o,c,p,m,y,x,E){for(let S=r;S-1);E++,m[E]=x,y[E]=S,y[E+1]=pf}for(let x=0,E=0;x{let x=this.entries[p];x||(x=this.entries[p]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let E=x.glyphs[m];if(E!==void 0)return void y(null,{stack:p,id:m,glyph:E});if(E=this._tinySDF(x,p,m),E)return x.glyphs[m]=E,void y(null,{stack:p,id:m,glyph:E});const S=Math.floor(m/256);if(256*S>65535)return void y(new Error("glyphs > 65535 not supported"));if(x.ranges[S])return void y(null,{stack:p,id:m,glyph:E});let k=x.requests[S];k||(k=x.requests[S]=[],zh.loadGlyphRange(p,S,this.url,this.requestManager,(M,O)=>{if(O){x.ascender=O.ascender,x.descender=O.descender;for(const $ in O.glyphs)this._doesCharSupportLocalGlyph(+$)||(x.glyphs[+$]=O.glyphs[+$]);x.ranges[S]=!0}for(const $ of k)$(M,O);delete x.requests[S]})),k.push((M,O)=>{M?y(M):O&&y(null,{stack:p,id:m,glyph:O.glyphs[m]||null})})},(p,m)=>{if(p)o(p);else if(m){const y={};for(const{stack:x,id:E,glyph:S}of m)y[x]===void 0&&(y[x]={}),y[x].glyphs===void 0&&(y[x].glyphs={}),y[x].glyphs[E]=S&&{id:S.id,bitmap:S.bitmap.clone(),metrics:S.metrics},y[x].ascender=this.entries[x].ascender,y[x].descender=this.entries[x].descender;o(null,y)}})}_doesCharSupportLocalGlyph(r){return this.localGlyphMode!==i1.none&&(this.localGlyphMode===i1.all?!!this.localFontFamily:!!this.localFontFamily&&(xt["CJK Unified Ideographs"](r)||xt["Hangul Syllables"](r)||xt.Hiragana(r)||xt.Katakana(r)||xt["CJK Symbols and Punctuation"](r)))}_tinySDF(r,o,c){const p=this.localFontFamily;if(!p||!this._doesCharSupportLocalGlyph(c))return;let m=r.tinySDF;if(!m){let K="400";/bold/i.test(o)?K="900":/medium/i.test(o)?K="500":/light/i.test(o)&&(K="200"),m=r.tinySDF=new zh.TinySDF({fontFamily:p,fontWeight:K,fontSize:24*Oa,buffer:3*Oa,radius:8*Oa}),m.fontWeight=K}if(this.localGlyphs[m.fontWeight][c])return this.localGlyphs[m.fontWeight][c];const y=String.fromCharCode(c),{data:x,width:E,height:S,glyphWidth:k,glyphHeight:M,glyphLeft:O,glyphTop:$,glyphAdvance:G}=m.draw(y);return this.localGlyphs[m.fontWeight][c]={id:c,bitmap:new qs({width:E,height:S},x),metrics:{width:k/Oa,height:M/Oa,left:O/Oa,top:$/Oa-27,advance:G/Oa,localGlyph:!0}}}}zh.loadGlyphRange=function(i,r,o,c,p){const m=256*r,y=m+255,x=c.transformRequest(c.normalizeGlyphsURL(o).replace("{fontstack}",i).replace("{range}",`${m}-${y}`),ga.Glyphs);Ja(x,(E,S)=>{if(E)p(E);else if(S){const k={},M=function(O){return new ug(O).readFields(DF,{})}(S);for(const O of M.glyphs)k[O.id]=O;p(null,{glyphs:k,ascender:M.ascender,descender:M.descender})}})},zh.TinySDF=class{constructor({fontSize:i=24,buffer:r=3,radius:o=8,cutoff:c=.25,fontFamily:p="sans-serif",fontWeight:m="normal",fontStyle:y="normal"}={}){this.buffer=r,this.cutoff=c,this.radius=o;const x=this.size=i+4*r,E=this._createCanvas(x),S=this.ctx=E.getContext("2d",{willReadFrequently:!0});S.font=`${y} ${m} ${i}px ${p}`,S.textBaseline="alphabetic",S.textAlign="left",S.fillStyle="black",this.gridOuter=new Float64Array(x*x),this.gridInner=new Float64Array(x*x),this.f=new Float64Array(x),this.z=new Float64Array(x+1),this.v=new Uint16Array(x)}_createCanvas(i){const r=document.createElement("canvas");return r.width=r.height=i,r}draw(i){const{width:r,actualBoundingBoxAscent:o,actualBoundingBoxDescent:c,actualBoundingBoxLeft:p,actualBoundingBoxRight:m}=this.ctx.measureText(i),y=Math.ceil(o),x=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(m-p))),E=Math.min(this.size-this.buffer,y+Math.ceil(c)),S=x+2*this.buffer,k=E+2*this.buffer,M=Math.max(S*k,0),O=new Uint8ClampedArray(M),$={data:O,width:S,height:k,glyphWidth:x,glyphHeight:E,glyphTop:y,glyphLeft:0,glyphAdvance:r};if(x===0||E===0)return $;const{ctx:G,buffer:K,gridInner:ee,gridOuter:le}=this;G.clearRect(K,K,x,E),G.fillText(i,K,K+y);const me=G.getImageData(K,K,x,E);le.fill(pf,0,M),ee.fill(0,0,M);for(let ce=0;ce0?Oe*Oe:0,ee[ye]=Oe<0?Oe*Oe:0}}yI(le,0,0,S,k,S,this.f,this.v,this.z),yI(ee,K,K,x,E,S,this.f,this.v,this.z);for(let ce=0;ceUe+Qe[1]-Qe[0],G=M.reduce($,0),K=O.reduce($,0),ee=x-G,le=E-K;let me=0,ce=G,pe=0,_e=K,ye=0,Oe=ee,Me=0,He=le;if(m.content&&c){const Ue=m.content;me=dg(M,0,Ue[0]),pe=dg(O,0,Ue[1]),ce=dg(M,Ue[0],Ue[2]),_e=dg(O,Ue[1],Ue[3]),ye=Ue[0]-me,Me=Ue[1]-pe,Oe=Ue[2]-Ue[0]-ce,He=Ue[3]-Ue[1]-_e}const lt=(Ue,Qe,Je,ot)=>{const pt=pg(Ue.stretch-me,ce,S,i.left),We=fg(Ue.fixed-ye,Oe,Ue.stretch,G),_t=pg(Qe.stretch-pe,_e,k,i.top),Ct=fg(Qe.fixed-Me,He,Qe.stretch,K),vt=pg(Je.stretch-me,ce,S,i.left),Gt=fg(Je.fixed-ye,Oe,Je.stretch,G),ft=pg(ot.stretch-pe,_e,k,i.top),zt=fg(ot.fixed-Me,He,ot.stretch,K),Ht=new xe(pt,_t),fr=new xe(vt,_t),qt=new xe(vt,ft),Bt=new xe(pt,ft),Hr=new xe(We/y,Ct/y),Zt=new xe(Gt/y,zt/y),Kt=r*Math.PI/180;if(Kt){const $r=Math.sin(Kt),Br=Math.cos(Kt),tn=[Br,-$r,$r,Br];Ht._matMult(tn),fr._matMult(tn),Bt._matMult(tn),qt._matMult(tn)}const Lr=Ue.stretch+Ue.fixed,Vr=Qe.stretch+Qe.fixed;return{tl:Ht,tr:fr,bl:Bt,br:qt,tex:{x:m.paddedRect.x+Rh+Lr,y:m.paddedRect.y+Rh+Vr,w:Je.stretch+Je.fixed-Lr,h:ot.stretch+ot.fixed-Vr},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Hr,pixelOffsetBR:Zt,minFontScaleX:Oe/y/S,minFontScaleY:He/y/k,isSDF:o}};if(c&&(m.stretchX||m.stretchY)){const Ue=xI(M,ee,G),Qe=xI(O,le,K);for(let Je=0;Je0)for(let c=(this.length>>1)-1;c>=0;c--)this._down(c)}push(r){this.data.push(r),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const r=this.data[0],o=this.data.pop();return this.length--,this.length>0&&(this.data[0]=o,this._down(0)),r}peek(){return this.data[0]}_up(r){const{data:o,compare:c}=this,p=o[r];for(;r>0;){const m=r-1>>1,y=o[m];if(c(p,y)>=0)break;o[r]=y,r=m}o[r]=p}_down(r){const{data:o,compare:c}=this,p=this.length>>1,m=o[r];for(;r=0)break;o[r]=x,r=y}o[r]=m}}function jF(i,r){return ir?1:0}function VF(i,r=1,o=!1){let c=1/0,p=1/0,m=-1/0,y=-1/0;const x=i[0];for(let $=0;$m)&&(m=G.x),(!$||G.y>y)&&(y=G.y)}const E=Math.min(m-c,y-p);let S=E/2;const k=new UF([],$F);if(E===0)return new xe(c,p);for(let $=c;$M.d||!M.d)&&(M=$,o&&console.log("found best %d after %d probes",Math.round(1e4*$.d)/1e4,O)),$.max-M.d<=r||(S=$.h/2,k.push(new Oh($.p.x-S,$.p.y-S,S,i)),k.push(new Oh($.p.x+S,$.p.y-S,S,i)),k.push(new Oh($.p.x-S,$.p.y+S,S,i)),k.push(new Oh($.p.x+S,$.p.y+S,S,i)),O+=4)}return o&&(console.log(`num probes: ${O}`),console.log(`best distance: ${M.d}`)),M.p}function $F(i,r){return r.max-i.max}class Oh{constructor(r,o,c,p){this.p=new xe(r,o),this.h=c,this.d=function(m,y){let x=!1,E=1/0;for(let S=0;Sm.y!=K.y>m.y&&m.x<(K.x-G.x)*(m.y-G.y)/(K.y-G.y)+G.x&&(x=!x),E=Math.min(E,m2(m,G,K))}}return(x?1:-1)*Math.sqrt(E)}(this.p,p),this.max=this.d+this.h*Math.SQRT2}}const Fh=7,o1=Number.POSITIVE_INFINITY,WF=Math.sqrt(2);function bI(i,[r,o]){let c=0,p=0;if(o===o1){r<0&&(r=0);const m=r/WF;switch(i){case"top-right":case"top-left":p=m-Fh;break;case"bottom-right":case"bottom-left":p=-m+Fh;break;case"bottom":p=-r+Fh;break;case"top":p=r-Fh}switch(i){case"top-right":case"bottom-right":c=-m;break;case"top-left":case"bottom-left":c=m;break;case"left":c=r;break;case"right":c=-r}}else{switch(r=Math.abs(r),o=Math.abs(o),i){case"top-right":case"top-left":case"top":p=o-Fh;break;case"bottom-right":case"bottom-left":case"bottom":p=-o+Fh}switch(i){case"top-right":case"bottom-right":case"right":c=-r;break;case"top-left":case"bottom-left":case"left":c=r}}return[c,p]}function GF(i,r,o,c,p,m,y,x,E,S){i.createArrays(),i.tilePixelRatio=Ot/(512*i.overscaling),i.compareText={},i.iconsNeedLinear=!1;const k=i.layers[0].layout,M=i.layers[0]._unevaluatedLayout._values,O={};if(i.textSizeData.kind==="composite"){const{minZoom:K,maxZoom:ee}=i.textSizeData;O.compositeTextSizes=[M["text-size"].possiblyEvaluate(new D(K),x),M["text-size"].possiblyEvaluate(new D(ee),x)]}if(i.iconSizeData.kind==="composite"){const{minZoom:K,maxZoom:ee}=i.iconSizeData;O.compositeIconSizes=[M["icon-size"].possiblyEvaluate(new D(K),x),M["icon-size"].possiblyEvaluate(new D(ee),x)]}O.layoutTextSize=M["text-size"].possiblyEvaluate(new D(E+1),x),O.layoutIconSize=M["icon-size"].possiblyEvaluate(new D(E+1),x),O.textMaxSize=M["text-size"].possiblyEvaluate(new D(18),x);const $=k.get("text-rotation-alignment")==="map"&&k.get("symbol-placement")!=="point",G=k.get("text-size");for(const K of i.features){const ee=k.get("text-font").evaluate(K,{},x).join(","),le=G.evaluate(K,{},x),me=O.layoutTextSize.evaluate(K,{},x),ce=(O.layoutIconSize.evaluate(K,{},x),{horizontal:{},vertical:void 0}),pe=K.text;let _e,ye=[0,0];if(pe){const He=pe.toString(),lt=k.get("text-letter-spacing").evaluate(K,{},x)*ei,Ue=k.get("text-line-height").evaluate(K,{},x)*ei,Qe=fx(He)?lt:0,Je=k.get("text-anchor").evaluate(K,{},x),ot=k.get("text-variable-anchor");if(!ot){const vt=k.get("text-radial-offset").evaluate(K,{},x);ye=vt?bI(Je,[vt*ei,o1]):k.get("text-offset").evaluate(K,{},x).map(Gt=>Gt*ei)}let pt=$?"center":k.get("text-justify").evaluate(K,{},x);const We=k.get("symbol-placement")==="point",_t=We?k.get("text-max-width").evaluate(K,{},x)*ei:1/0,Ct=vt=>{i.allowVerticalPlacement&&Lp(He)&&(ce.vertical=r1(pe,r,o,p,ee,_t,Ue,Je,vt,Qe,ye,Do.vertical,!0,me,le))};if(!$&&ot){const vt=pt==="auto"?ot.map(ft=>a1(ft)):[pt];let Gt=!1;for(let ft=0;ft=0||!Lp(He)){const vt=r1(pe,r,o,p,ee,_t,Ue,Je,pt,Qe,ye,Do.horizontal,!1,me,le);vt&&(ce.horizontal[pt]=vt)}Ct(We?"left":pt)}}let Oe=!1;if(K.icon&&K.icon.name){const He=c[K.icon.name];He&&(_e=FF(p[K.icon.name],k.get("icon-offset").evaluate(K,{},x),k.get("icon-anchor").evaluate(K,{},x)),Oe=He.sdf,i.sdfIcons===void 0?i.sdfIcons=He.sdf:i.sdfIcons!==He.sdf&&Tr("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(He.pixelRatio!==i.pixelRatio||k.get("icon-rotate").constantOr(1)!==0)&&(i.iconsNeedLinear=!0))}const Me=EI(ce.horizontal)||ce.vertical;i.iconsInText||(i.iconsInText=!!Me&&Me.iconsInText),(Me||_e)&&HF(i,K,ce,_e,c,O,me,0,ye,Oe,y,x,S)}m&&i.generateCollisionDebugBuffers(E,i.collisionBoxArray)}function a1(i){switch(i){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function HF(i,r,o,c,p,m,y,x,E,S,k,M,O){let $=m.textMaxSize.evaluate(r,{},M);$===void 0&&($=y);const G=i.layers[0].layout,K=G.get("icon-offset").evaluate(r,{},M),ee=EI(o.horizontal)||o.vertical,le=O.name==="globe",me=ei,ce=y/me,pe=i.tilePixelRatio*$/me,_e=(Je=i.overscaling,i.zoom>18&&Je>2&&(Je>>=1),Math.max(Ot/(512*Je),1)*G.get("symbol-spacing")),ye=G.get("text-padding")*i.tilePixelRatio,Oe=G.get("icon-padding")*i.tilePixelRatio,Me=Fe(G.get("text-max-angle")),He=G.get("text-rotation-alignment")==="map"&&G.get("symbol-placement")!=="point",lt=G.get("icon-rotation-alignment")==="map"&&G.get("symbol-placement")!=="point",Ue=G.get("symbol-placement"),Qe=_e/2;var Je;const ot=G.get("icon-text-fit");let pt;c&&ot!=="none"&&(i.allowVerticalPlacement&&o.vertical&&(pt=uI(c,o.vertical,ot,G.get("icon-text-fit-padding"),K,ce)),ee&&(c=uI(c,ee,ot,G.get("icon-text-fit-padding"),K,ce)));const We=(_t,Ct,vt)=>{if(Ct.x<0||Ct.x>=Ot||Ct.y<0||Ct.y>=Ot)return;let Gt=null;if(le){const{x:ft,y:zt,z:Ht}=O.projectTilePoint(Ct.x,Ct.y,vt);Gt={anchor:new Ks(ft,zt,Ht,0,void 0),up:O.upVector(vt,Ct.x,Ct.y)}}(function(ft,zt,Ht,fr,qt,Bt,Hr,Zt,Kt,Lr,Vr,$r,Br,tn,cn,wn,Nr,Rn,En,nn,yr,Sn,Wr,Ri,Tn){const ti=ft.addToLineVertexArray(zt,fr);let Hn,Oi,qn,La,Nh,wf,Ef,rC=0,nC=0,iC=0,oC=0,b1=-1,w1=-1;const us={};let aC=yx("");const du=Ht?Ht.anchor:zt;let E1=0,S1=0;if(Kt._unevaluatedLayout.getValue("text-radial-offset")===void 0?[E1,S1]=Kt.layout.get("text-offset").evaluate(yr,{},Tn).map(co=>co*ei):(E1=Kt.layout.get("text-radial-offset").evaluate(yr,{},Tn)*ei,S1=o1),ft.allowVerticalPlacement&&qt.vertical){const co=qt.vertical;if(cn)wf=s1(co),Zt&&(Ef=s1(Zt));else{const uo=Kt.layout.get("text-rotate").evaluate(yr,{},Tn)+90;qn=mg(Lr,du,zt,Vr,$r,Br,co,tn,uo,wn),Zt&&(La=mg(Lr,du,zt,Vr,$r,Br,Zt,Rn,uo))}}if(Bt){const co=Kt.layout.get("icon-rotate").evaluate(yr,{},Tn),uo=Kt.layout.get("icon-text-fit")!=="none",Sf=vI(Bt,co,Wr,uo),A1=Zt?vI(Zt,co,Wr,uo):void 0;Oi=mg(Lr,du,zt,Vr,$r,Br,Bt,Rn,co),rC=4*Sf.length;const sC=ft.iconSizeData;let pu=null;sC.kind==="source"?(pu=[Ra*Kt.layout.get("icon-size").evaluate(yr,{},Tn)],pu[0]>Bl&&Tr(`${ft.layerIds[0]}: Value for "icon-size" is >= ${ff}. Reduce your "icon-size".`)):sC.kind==="composite"&&(pu=[Ra*Sn.compositeIconSizes[0].evaluate(yr,{},Tn),Ra*Sn.compositeIconSizes[1].evaluate(yr,{},Tn)],(pu[0]>Bl||pu[1]>Bl)&&Tr(`${ft.layerIds[0]}: Value for "icon-size" is >= ${ff}. Reduce your "icon-size".`)),ft.addSymbols(ft.icon,Sf,pu,nn,En,yr,!1,Ht,zt,ti.lineStartIndex,ti.lineLength,-1,Ri,Tn),b1=ft.icon.placedSymbolArray.length-1,A1&&(nC=4*A1.length,ft.addSymbols(ft.icon,A1,pu,nn,En,yr,Do.vertical,Ht,zt,ti.lineStartIndex,ti.lineLength,-1,Ri,Tn),w1=ft.icon.placedSymbolArray.length-1)}for(const co in qt.horizontal){const uo=qt.horizontal[co];Hn||(aC=yx(uo.text),cn?Nh=s1(uo):Hn=mg(Lr,du,zt,Vr,$r,Br,uo,tn,Kt.layout.get("text-rotate").evaluate(yr,{},Tn),wn));const Sf=uo.positionedLines.length===1;if(iC+=wI(ft,Ht,zt,uo,Hr,Kt,cn,yr,wn,ti,qt.vertical?Do.horizontal:Do.horizontalOnly,Sf?Object.keys(qt.horizontal):[co],us,b1,Sn,Ri,Tn),Sf)break}qt.vertical&&(oC+=wI(ft,Ht,zt,qt.vertical,Hr,Kt,cn,yr,wn,ti,Do.vertical,["vertical"],us,w1,Sn,Ri,Tn));let Wl=-1;const T1=(co,uo)=>co?Math.max(co,uo):uo;Wl=T1(Nh,Wl),Wl=T1(wf,Wl),Wl=T1(Ef,Wl);const xL=Wl>-1?1:0;ft.glyphOffsetArray.length>=Ul.MAX_GLYPHS&&Tr("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),yr.sortKey!==void 0&&ft.addToSortKeyRanges(ft.symbolInstances.length,yr.sortKey),ft.symbolInstances.emplaceBack(du.x,du.y,du.z,zt.x,zt.y,us.right>=0?us.right:-1,us.center>=0?us.center:-1,us.left>=0?us.left:-1,us.vertical>=0?us.vertical:-1,b1,w1,aC,Hn!==void 0?Hn:ft.collisionBoxArray.length,Hn!==void 0?Hn+1:ft.collisionBoxArray.length,qn!==void 0?qn:ft.collisionBoxArray.length,qn!==void 0?qn+1:ft.collisionBoxArray.length,Oi!==void 0?Oi:ft.collisionBoxArray.length,Oi!==void 0?Oi+1:ft.collisionBoxArray.length,La||ft.collisionBoxArray.length,La?La+1:ft.collisionBoxArray.length,Vr,iC,oC,rC,nC,xL,0,E1,S1,Wl)})(i,Ct,Gt,_t,o,c,p,pt,i.layers[0],i.collisionBoxArray,r.index,r.sourceLayerIndex,i.index,ye,He,E,0,Oe,lt,K,r,m,S,k,M)};if(Ue==="line")for(const _t of gI(r.geometry,0,0,Ot,Ot)){const Ct=BF(_t,_e,Me,o.vertical||ee,c,me,pe,i.overscaling,Ot);for(const vt of Ct)ee&&qF(i,ee.text,Qe,vt)||We(_t,vt,M)}else if(Ue==="line-center"){for(const _t of r.geometry)if(_t.length>1){const Ct=LF(_t,Me,o.vertical||ee,c,me,pe);Ct&&We(_t,Ct,M)}}else if(r.type==="Polygon")for(const _t of qx(r.geometry,0)){const Ct=VF(_t,16);We(_t[0],new Ks(Ct.x,Ct.y,0,0,void 0),M)}else if(r.type==="LineString")for(const _t of r.geometry)We(_t,new Ks(_t[0].x,_t[0].y,0,0,void 0),M);else if(r.type==="Point")for(const _t of r.geometry)for(const Ct of _t)We([Ct],new Ks(Ct.x,Ct.y,0,0,void 0),M)}const ff=255,Bl=ff*Ra;function wI(i,r,o,c,p,m,y,x,E,S,k,M,O,$,G,K,ee){const le=function(pe,_e,ye,Oe,Me,He,lt,Ue){const Qe=[];if(_e.positionedLines.length===0)return Qe;const Je=Oe.layout.get("text-rotate").evaluate(He,{})*Math.PI/180,ot=function(vt){const Gt=vt[0],ft=vt[1],zt=Gt*ft;return zt>0?[Gt,-ft]:zt<0?[-Gt,ft]:Gt===0?[ft,Gt]:[ft,-Gt]}(ye);let pt=Math.abs(_e.top-_e.bottom);for(const vt of _e.positionedLines)pt-=vt.lineOffset;const We=_e.positionedLines.length,_t=pt/We;let Ct=_e.top-ye[1];for(let vt=0;vtBl&&Tr(`${i.layerIds[0]}: Value for "text-size" is >= ${ff}. Reduce your "text-size".`)):me.kind==="composite"&&(ce=[Ra*G.compositeTextSizes[0].evaluate(x,{},ee),Ra*G.compositeTextSizes[1].evaluate(x,{},ee)],(ce[0]>Bl||ce[1]>Bl)&&Tr(`${i.layerIds[0]}: Value for "text-size" is >= ${ff}. Reduce your "text-size".`)),i.addSymbols(i.text,le,ce,E,y,x,k,r,o,S.lineStartIndex,S.lineLength,$,K,ee);for(const pe of M)O[pe]=i.text.placedSymbolArray.length-1;return 4*le.length}function EI(i){for(const r in i)return i[r];return null}function mg(i,r,o,c,p,m,y,x,E,S){let k=y.top,M=y.bottom,O=y.left,$=y.right;const G=y.collisionPadding;if(G&&(O-=G[0],k-=G[1],$+=G[2],M+=G[3]),E){const K=new xe(O,k),ee=new xe($,k),le=new xe(O,M),me=new xe($,M),ce=Fe(E);let pe=new xe(0,0);S&&(pe=new xe(S[0],S[1])),K._rotateAround(ce,pe),ee._rotateAround(ce,pe),le._rotateAround(ce,pe),me._rotateAround(ce,pe),O=Math.min(K.x,ee.x,le.x,me.x),$=Math.max(K.x,ee.x,le.x,me.x),k=Math.min(K.y,ee.y,le.y,me.y),M=Math.max(K.y,ee.y,le.y,me.y)}return i.emplaceBack(r.x,r.y,r.z,o.x,o.y,O,k,$,M,x,c,p,m),i.length-1}function s1(i){i.collisionPadding&&(i.top-=i.collisionPadding[1],i.bottom+=i.collisionPadding[3]);const r=i.bottom-i.top;return r>0?Math.max(10,r):null}function qF(i,r,o,c){const p=i.compareText;if(r in p){const m=p[r];for(let y=m.length-1;y>=0;y--)if(c.dist(m[y])ce&&(pe(ye,ot,Me,He,Qe,Je),pe(ot,Oe,Qe,Je,lt,Ue))}pe(M,O,c,m,p,m),pe(O,$,p,m,p,y),pe($,G,p,y,c,y),pe(G,M,c,y,c,m),K-=ce,ee-=ce,le+=ce,me+=ce;const _e=1/Math.max(le-K,me-ee);return{scale:_e,x:K*_e,y:ee*_e,x2:le*_e,y2:me*_e,projection:r}}const ZF=Da(new Float32Array(16));class Nl{constructor(r){this.spec=r,this.name=r.name,this.wrap=!1,this.requiresDraping=!1,this.supportsWorldCopies=!1,this.supportsTerrain=!1,this.supportsFog=!1,this.supportsFreeCamera=!1,this.zAxisUnit="meters",this.isReprojectedInTileSpace=!0,this.unsupportedLayers=["custom"],this.center=[0,0],this.range=[3.5,7]}project(r,o){return{x:0,y:0,z:0}}unproject(r,o){return new Fr(0,0)}projectTilePoint(r,o,c){return{x:r,y:o,z:0}}locationPoint(r,o,c=!0){return r._coordinatePoint(r.locationCoordinate(o),c)}pixelsPerMeter(r,o){return za(1,r)*o}pixelSpaceConversion(r,o,c){return 1}farthestPixelDistance(r){return SI(r,r.pixelsPerMeter)}pointCoordinate(r,o,c,p){const m=r.horizonLineFromTop(!1),y=new xe(o,Math.max(m,c));return r.rayIntersectionCoordinate(r.pointRayIntersection(y,p))}pointCoordinate3D(r,o,c){const p=new xe(o,c);if(r.elevation)return r.elevation.pointCoordinate(p);{const m=this.pointCoordinate(r,p.x,p.y,0);return[m.x,m.y,m.z]}}isPointAboveHorizon(r,o){if(r.elevation)return!this.pointCoordinate3D(r,o.x,o.y);const c=r.horizonLineFromTop();return o.y0?o<-Lh+c&&(o=-Lh+c):o>Lh-c&&(o=Lh-c);const y=m/Math.pow(yg(o),p);let x=y*Math.sin(p*r),E=m-y*Math.cos(p*r);return x=.5*(x/Math.PI+.5),E=.5*(E/Math.PI+.5),{x,y:this.southernCenter?E:1-E,z:0}}unproject(r,o){r=(2*r-.5)*Math.PI,this.southernCenter&&(o=1-o),o=(2*(1-o)-.5)*Math.PI;const{n:c,f:p}=this,m=p-o,y=Math.sign(m),x=Math.sign(c)*Math.sqrt(r*r+m*m);let E=Math.atan2(r,Math.abs(m))*y;m*c<0&&(E-=Math.PI*Math.sign(r)*y);const S=qe(Ve(E/c)+this.center[0],-180,180),k=qe(Ve(2*Math.atan(Math.pow(p/x,1/c))-Lh),-di,di);return new Fr(S,this.southernCenter?-k:k)}}class TI extends Nl{constructor(r){super(r),this.wrap=!0,this.supportsWorldCopies=!0,this.supportsTerrain=!0,this.supportsFog=!0,this.supportsFreeCamera=!0,this.isReprojectedInTileSpace=!1,this.unsupportedLayers=[],this.range=null}project(r,o){return{x:os(r),y:as(o),z:0}}unproject(r,o){const c=Po(r),p=hi(o);return new Fr(c,p)}}const AI=Fe(di);class JF extends Nl{project(r,o){const c=(o=Fe(o))*o,p=c*c;return{x:.5*((r=Fe(r))*(.8707-.131979*c+p*(p*(.003971*c-.001529*p)-.013791))/Math.PI+.5),y:1-.5*(o*(1.007226+c*(.015085+p*(.028874*c-.044475-.005916*p)))/Math.PI+1),z:0}}unproject(r,o){r=(2*r-.5)*Math.PI;let c=o=(2*(1-o)-1)*Math.PI,p=25,m=0,y=c*c;do{y=c*c;const S=y*y;m=(c*(1.007226+y*(.015085+S*(.028874*y-.044475-.005916*S)))-o)/(1.007226+y*(.045255+S*(.259866*y-.311325-.005916*11*S))),c=qe(c-m,-AI,AI)}while(Math.abs(m)>1e-6&&--p>0);y=c*c;const x=qe(Ve(r/(.8707+y*(y*(y*y*y*(.003971-.001529*y)-.013791)-.131979))),-180,180),E=Ve(c);return new Fr(x,E)}}const II=Fe(di);class eL extends Nl{project(r,o){o=Fe(o),r=Fe(r);const c=Math.cos(o),p=2/Math.PI,m=Math.acos(c*Math.cos(r/2)),y=Math.sin(m)/m,x=.5*(r*p+2*c*Math.sin(r/2)/y)||0,E=.5*(o+Math.sin(o)/y)||0;return{x:.5*(x/Math.PI+.5),y:1-.5*(E/Math.PI+1),z:0}}unproject(r,o){let c=r=(2*r-.5)*Math.PI,p=o=(2*(1-o)-1)*Math.PI,m=25;const y=1e-6;let x=0,E=0;do{const S=Math.cos(p),k=Math.sin(p),M=2*k*S,O=k*k,$=S*S,G=Math.cos(c/2),K=Math.sin(c/2),ee=2*G*K,le=K*K,me=1-$*G*G,ce=me?1/me:0,pe=me?Math.acos(S*G)*Math.sqrt(1/me):0,_e=.5*(2*pe*S*K+2*c/Math.PI)-r,ye=.5*(pe*k+p)-o,Oe=.5*ce*($*le+pe*S*G*O)+1/Math.PI,Me=ce*(ee*M/4-pe*k*K),He=.125*ce*(M*K-pe*k*$*ee),lt=.5*ce*(O*G+pe*le*S)+.5,Ue=Me*He-lt*Oe;x=(ye*Me-_e*lt)/Ue,E=(_e*He-ye*Oe)/Ue,c=qe(c-x,-Math.PI,Math.PI),p=qe(p-E,-II,II)}while((Math.abs(x)>y||Math.abs(E)>y)&&--m>0);return new Fr(Ve(c),Ve(p))}}class CI extends Nl{constructor(r){super(r),this.center=r.center||[0,0],this.parallels=r.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(Fe(this.parallels[0]))),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(r,o){const{scale:c,cosPhi:p}=this;return{x:Fe(r)*p*c+.5,y:-Math.sin(Fe(o))/p*c+.5,z:0}}unproject(r,o){const{scale:c,cosPhi:p}=this,m=-(o-.5)/c,y=qe(Ve((r-.5)/c)/p,-180,180),x=Math.asin(qe(m*p,-1,1)),E=qe(Ve(x),-di,di);return new Fr(y,E)}}class tL extends TI{constructor(r){super(r),this.requiresDraping=!0,this.supportsWorldCopies=!1,this.supportsFog=!0,this.zAxisUnit="pixels",this.unsupportedLayers=["debug"],this.range=[3,5]}projectTilePoint(r,o,c){const p=Qp(r,o,c);return mn(p,p,Jp(is(c))),{x:p[0],y:p[1],z:p[2]}}locationPoint(r,o){const c=wh(o.lat,o.lng),p=Di([],c),m=r.elevation?r.elevation.getAtPointOrZero(r.locationCoordinate(o),r._centerAltitude):r._centerAltitude;Zp(c,c,p,za(1,0)*Ot*m);const y=Da(new Float64Array(16));return ru(y,r.pixelMatrix,r.globeMatrix),mn(c,c,y),new xe(c[0],c[1])}pixelsPerMeter(r,o){return za(1,0)*o}pixelSpaceConversion(r,o,c){const p=za(1,r)*o,m=dr(za(1,45)*o,p,c);return this.pixelsPerMeter(r,o)/m}createTileMatrix(r,o,c){const p=Dx(is(c.canonical));return ru(new Float64Array(16),r.globeMatrix,p)}createInversionMatrix(r,o){const{center:c}=r,p=Jp(is(o));return G0(p,p,Fe(c.lng)),bx(p,p,Fe(c.lat)),nu(p,p,[r._pixelsPerMercatorPixel,r._pixelsPerMercatorPixel,1]),Float32Array.from(p)}pointCoordinate(r,o,c,p){return t2(r,o,c,!0)||new Sh(0,0)}pointCoordinate3D(r,o,c){const p=this.pointCoordinate(r,o,c,0);return[p.x,p.y,p.z]}isPointAboveHorizon(r,o){return!t2(r,o.x,o.y,!1)}farthestPixelDistance(r){const o=function(p,m){const y=p.cameraToCenterDistance,x=p._centerAltitude*m,E=p._camera,S=p._camera.forward(),k=Gs([],ko([],S,-y),[0,0,x]),M=p.worldSize/(2*Math.PI),O=[0,0,-M],$=p.width/p.height,G=Math.tan(p.fovAboveCenter),K=ko([],E.up(),G),ee=ko([],E.right(),G*$),le=Di([],Gs([],Gs([],S,K),ee)),me=[];let ce;if(new Tx(k,le).closestPointOnSphere(O,M,me)){const pe=Gs([],me,O),_e=Ma([],pe,k);ce=Math.cos(p.fovAboveCenter)*Gp(_e)}else{const pe=Ma([],k,O),_e=Ma([],O,k);Di(_e,_e);const ye=Gp(pe)-M;ce=Math.sqrt(ye*(ye+2*M));const Oe=Math.acos(ce/(M+ye))-Math.acos(ea(S,_e));ce*=Math.cos(Oe)}return 1.01*ce}(r,this.pixelsPerMeter(r.center.lat,r.worldSize)),c=Eh(r.zoom);if(c>0){const p=SI(r,za(1,r.center.lat)*r.worldSize),m=r.worldSize/(2*Math.PI),y=Math.max(r.width,r.height)/r.worldSize*Math.PI;return dr(o,p+m*(1-Math.cos(y)),Math.pow(c,10))}return o}upVector(r,o,c){return Qp(o,c,r,1)}upVectorScale(r){return{metersToTile:H0(Z0(is(r)))}}}function kI(i){const r=i.parallels,o=!!r&&Math.abs(r[0]+r[1])<.01;switch(i.name){case"mercator":return new TI(i);case"equirectangular":return new YF(i);case"naturalEarth":return new JF(i);case"equalEarth":return new XF(i);case"winkelTripel":return new eL(i);case"albers":return o?new CI(i):new KF(i);case"lambertConformalConic":return o?new CI(i):new QF(i);case"globe":return new tL(i)}throw new Error(`Invalid projection name: ${i.name}`)}const rL=ig.types,nL=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function _g(i,r,o,c,p,m,y,x,E,S,k,M,O){const $=x?Math.min(Bl,Math.round(x[0])):0,G=x?Math.min(Bl,Math.round(x[1])):0;i.emplaceBack(r,o,Math.round(32*c),Math.round(32*p),m,y,($<<1)+(E?1:0),G,16*S,16*k,256*M,256*O)}function vg(i,r,o,c,p,m,y){i.emplaceBack(r,o,c,p,m,y)}function xg(i,r,o,c,p){i.emplaceBack(r,o,c,p),i.emplaceBack(r,o,c,p),i.emplaceBack(r,o,c,p),i.emplaceBack(r,o,c,p)}function iL(i){for(const r of i.sections)if(gx(r.text))return!0;return!1}class l1{constructor(r){this.layoutVertexArray=new tt,this.indexArray=new Pt,this.programConfigurations=r,this.segments=new xn,this.dynamicLayoutVertexArray=new at,this.opacityVertexArray=new Mt,this.placedSymbolArray=new vn,this.globeExtVertexArray=new ht}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(r,o,c,p){this.isEmpty()||(c&&(this.layoutVertexBuffer=r.createVertexBuffer(this.layoutVertexArray,dF.members),this.indexBuffer=r.createIndexBuffer(this.indexArray,o),this.dynamicLayoutVertexBuffer=r.createVertexBuffer(this.dynamicLayoutVertexArray,fF.members,!0),this.opacityVertexBuffer=r.createVertexBuffer(this.opacityVertexArray,nL,!0),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=r.createVertexBuffer(this.globeExtVertexArray,pF.members,!0)),this.opacityVertexBuffer.itemSize=1),(c||p)&&this.programConfigurations.upload(r))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy())}}At(l1,"SymbolBuffers");class c1{constructor(r,o,c){this.layoutVertexArray=new r,this.layoutAttributes=o,this.indexArray=new c,this.segments=new xn,this.collisionVertexArray=new nr,this.collisionVertexArrayExt=new er}upload(r){this.layoutVertexBuffer=r.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=r.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=r.createVertexBuffer(this.collisionVertexArray,mF.members,!0),this.collisionVertexBufferExt=r.createVertexBuffer(this.collisionVertexArrayExt,gF.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.destroy())}}At(c1,"CollisionBuffers");class Ul{constructor(r){this.collisionBoxArray=r.collisionBoxArray,this.zoom=r.zoom,this.overscaling=r.overscaling,this.layers=r.layers,this.layerIds=this.layers.map(y=>y.id),this.index=r.index,this.pixelRatio=r.pixelRatio,this.sourceLayerIndex=r.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=Da([]),this.placementViewportMatrix=Da([]);const o=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Yx(this.zoom,o["text-size"]),this.iconSizeData=Yx(this.zoom,o["icon-size"]);const c=this.layers[0].layout,p=c.get("symbol-sort-key"),m=c.get("symbol-z-order");this.canOverlap=c.get("text-allow-overlap")||c.get("icon-allow-overlap")||c.get("text-ignore-placement")||c.get("icon-ignore-placement"),this.sortFeaturesByKey=m!=="viewport-y"&&p.constantOr(1)!==void 0,this.sortFeaturesByY=(m==="viewport-y"||m==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=c.get("text-writing-mode").map(y=>Do[y]),this.stateDependentLayerIds=this.layers.filter(y=>y.isStateDependent()).map(y=>y.id),this.sourceID=r.sourceID,this.projection=r.projection}createArrays(){this.text=new l1(new tu(this.layers,this.zoom,r=>/^text/.test(r))),this.icon=new l1(new tu(this.layers,this.zoom,r=>/^icon/.test(r))),this.glyphOffsetArray=new Pi,this.lineVertexArray=new yh,this.symbolInstances=new Zr}calculateGlyphDependencies(r,o,c,p,m){for(let y=0;y0)&&(E.value.kind!=="constant"||E.value.value.length>0),O=k.value.kind!=="constant"||!!k.value.value||Object.keys(k.parameters).length>0,$=y.get("symbol-sort-key");if(this.features=[],!M&&!O)return;const G=o.iconDependencies,K=o.glyphDependencies,ee=o.availableImages,le=new D(this.zoom);for(const{feature:me,id:ce,index:pe,sourceLayerIndex:_e}of r){const ye=m._featureFilter.needGeometry,Oe=su(me,ye);if(!m._featureFilter.filter(le,Oe,c))continue;if(ye||(Oe.geometry=Hs(me,c,p)),x&&me.type!==1&&c.z<=5){const Ue=Oe.geometry,Qe=.98078528056,Je=(ot,pt)=>ea(Qp(ot.x,ot.y,c,1),Qp(pt.x,pt.y,c,1))=0;for(const Je of Me.sections)if(Je.image)G[Je.image.name]=!0;else{const ot=Lp(Me.toString()),pt=Je.fontStack||Ue,We=K[pt]=K[pt]||{};this.calculateGlyphDependencies(Je.text,We,Qe,this.allowVerticalPlacement,ot)}}}y.get("symbol-placement")==="line"&&(this.features=function(me){const ce={},pe={},_e=[];let ye=0;function Oe(Ue){_e.push(me[Ue]),ye++}function Me(Ue,Qe,Je){const ot=pe[Ue];return delete pe[Ue],pe[Qe]=ot,_e[ot].geometry[0].pop(),_e[ot].geometry[0]=_e[ot].geometry[0].concat(Je[0]),ot}function He(Ue,Qe,Je){const ot=ce[Qe];return delete ce[Qe],ce[Ue]=ot,_e[ot].geometry[0].shift(),_e[ot].geometry[0]=Je[0].concat(_e[ot].geometry[0]),ot}function lt(Ue,Qe,Je){const ot=Je?Qe[0][Qe[0].length-1]:Qe[0][0];return`${Ue}:${ot.x}:${ot.y}`}for(let Ue=0;UeUe.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((me,ce)=>me.sortKey-ce.sortKey)}update(r,o,c,p){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(r,o,this.layers,c,p),this.icon.programConfigurations.updatePaintArrays(r,o,this.layers,c,p))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(r){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(r),this.iconCollisionBox.upload(r)),this.text.upload(r,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(r,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=kI(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(r,o){const c=this.lineVertexArray.length;if(r.segment!==void 0)for(const{x:p,y:m}of o)this.lineVertexArray.emplaceBack(p,m);return{lineStartIndex:c,lineLength:this.lineVertexArray.length-c}}addSymbols(r,o,c,p,m,y,x,E,S,k,M,O,$,G){const K=r.indexArray,ee=r.layoutVertexArray,le=r.globeExtVertexArray,me=r.segments.prepareSegment(4*o.length,ee,K,this.canOverlap?y.sortKey:void 0),ce=this.glyphOffsetArray.length,pe=me.vertexLength,_e=this.allowVerticalPlacement&&x===Do.vertical?Math.PI/2:0,ye=y.text&&y.text.sections;for(let Me=0;Me=0?o.rightJustifiedTextSymbolIndex:o.centerJustifiedTextSymbolIndex>=0?o.centerJustifiedTextSymbolIndex:o.leftJustifiedTextSymbolIndex>=0?o.leftJustifiedTextSymbolIndex:o.verticalPlacedTextSymbolIndex>=0?o.verticalPlacedTextSymbolIndex:p),y=lg(this.textSizeData,r,m)/ei;return this.tilePixelRatio*y}getSymbolInstanceIconSize(r,o,c){const p=this.icon.placedSymbolArray.get(c),m=lg(this.iconSizeData,r,p);return this.tilePixelRatio*m}_commitDebugCollisionVertexUpdate(r,o,c){r.emplaceBack(o,-c,-c),r.emplaceBack(o,c,-c),r.emplaceBack(o,c,c),r.emplaceBack(o,-c,c)}_updateTextDebugCollisionBoxes(r,o,c,p,m,y){for(let x=p;x0}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(r,o){const c=r.placedSymbolArray.get(o),p=c.vertexStartIndex+4*c.numGlyphs;for(let m=c.vertexStartIndex;mp[x]-p[E]||m[E]-m[x]),y}addToSortKeyRanges(r,o){const c=this.sortKeyRanges[this.sortKeyRanges.length-1];c&&c.sortKey===o?c.symbolInstanceEnd=r+1:this.sortKeyRanges.push({sortKey:o,symbolInstanceStart:r,symbolInstanceEnd:r+1})}sortFeatures(r){if(this.sortFeaturesByY&&this.sortedAngle!==r&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(r),this.sortedAngle=r,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const o of this.symbolInstanceIndexes){const c=this.symbolInstances.get(o);this.featureSortOrder.push(c.featureIndex);const{rightJustifiedTextSymbolIndex:p,centerJustifiedTextSymbolIndex:m,leftJustifiedTextSymbolIndex:y,verticalPlacedTextSymbolIndex:x,placedIconSymbolIndex:E,verticalPlacedIconSymbolIndex:S}=c;p>=0&&this.addIndicesForPlacedSymbol(this.text,p),m>=0&&m!==p&&this.addIndicesForPlacedSymbol(this.text,m),y>=0&&y!==m&&y!==p&&this.addIndicesForPlacedSymbol(this.text,y),x>=0&&this.addIndicesForPlacedSymbol(this.text,x),E>=0&&this.addIndicesForPlacedSymbol(this.icon,E),S>=0&&this.addIndicesForPlacedSymbol(this.icon,S)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}At(Ul,"SymbolBucket",{omit:["layers","collisionBoxArray","features","compareText"]}),Ul.MAX_GLYPHS=65535,Ul.addDynamicAttributes=xg;const oL=new he({"symbol-placement":new Z(Ge.layout_symbol["symbol-placement"]),"symbol-spacing":new Z(Ge.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Z(Ge.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new re(Ge.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Z(Ge.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Z(Ge.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new Z(Ge.layout_symbol["icon-ignore-placement"]),"icon-optional":new Z(Ge.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Z(Ge.layout_symbol["icon-rotation-alignment"]),"icon-size":new re(Ge.layout_symbol["icon-size"]),"icon-text-fit":new Z(Ge.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Z(Ge.layout_symbol["icon-text-fit-padding"]),"icon-image":new re(Ge.layout_symbol["icon-image"]),"icon-rotate":new re(Ge.layout_symbol["icon-rotate"]),"icon-padding":new Z(Ge.layout_symbol["icon-padding"]),"icon-keep-upright":new Z(Ge.layout_symbol["icon-keep-upright"]),"icon-offset":new re(Ge.layout_symbol["icon-offset"]),"icon-anchor":new re(Ge.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Z(Ge.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Z(Ge.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Z(Ge.layout_symbol["text-rotation-alignment"]),"text-field":new re(Ge.layout_symbol["text-field"]),"text-font":new re(Ge.layout_symbol["text-font"]),"text-size":new re(Ge.layout_symbol["text-size"]),"text-max-width":new re(Ge.layout_symbol["text-max-width"]),"text-line-height":new re(Ge.layout_symbol["text-line-height"]),"text-letter-spacing":new re(Ge.layout_symbol["text-letter-spacing"]),"text-justify":new re(Ge.layout_symbol["text-justify"]),"text-radial-offset":new re(Ge.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Z(Ge.layout_symbol["text-variable-anchor"]),"text-anchor":new re(Ge.layout_symbol["text-anchor"]),"text-max-angle":new Z(Ge.layout_symbol["text-max-angle"]),"text-writing-mode":new Z(Ge.layout_symbol["text-writing-mode"]),"text-rotate":new re(Ge.layout_symbol["text-rotate"]),"text-padding":new Z(Ge.layout_symbol["text-padding"]),"text-keep-upright":new Z(Ge.layout_symbol["text-keep-upright"]),"text-transform":new re(Ge.layout_symbol["text-transform"]),"text-offset":new re(Ge.layout_symbol["text-offset"]),"text-allow-overlap":new Z(Ge.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new Z(Ge.layout_symbol["text-ignore-placement"]),"text-optional":new Z(Ge.layout_symbol["text-optional"])});var u1={paint:new he({"icon-opacity":new re(Ge.paint_symbol["icon-opacity"]),"icon-color":new re(Ge.paint_symbol["icon-color"]),"icon-halo-color":new re(Ge.paint_symbol["icon-halo-color"]),"icon-halo-width":new re(Ge.paint_symbol["icon-halo-width"]),"icon-halo-blur":new re(Ge.paint_symbol["icon-halo-blur"]),"icon-translate":new Z(Ge.paint_symbol["icon-translate"]),"icon-translate-anchor":new Z(Ge.paint_symbol["icon-translate-anchor"]),"text-opacity":new re(Ge.paint_symbol["text-opacity"]),"text-color":new re(Ge.paint_symbol["text-color"],{runtimeType:qi,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new re(Ge.paint_symbol["text-halo-color"]),"text-halo-width":new re(Ge.paint_symbol["text-halo-width"]),"text-halo-blur":new re(Ge.paint_symbol["text-halo-blur"]),"text-translate":new Z(Ge.paint_symbol["text-translate"]),"text-translate-anchor":new Z(Ge.paint_symbol["text-translate-anchor"])}),layout:oL};class PI{constructor(r){this.type=r.property.overrides?r.property.overrides.runtimeType:gl,this.defaultValue=r}evaluate(r){if(r.formattedSection){const o=this.defaultValue.property.overrides;if(o&&o.hasOverride(r.formattedSection))return o.getOverride(r.formattedSection)}return r.feature&&r.featureState?this.defaultValue.evaluate(r.feature,r.featureState):this.defaultValue.property.specification.default}eachChild(r){this.defaultValue.isConstant()||r(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}At(PI,"FormatSectionOverride",{omit:["defaultValue"]});class bg extends Pa{constructor(r){super(r,u1)}recalculate(r,o){super.recalculate(r,o),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")),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment"));const c=this.layout.get("text-writing-mode");if(c){const p=[];for(const m of c)p.indexOf(m)<0&&p.push(m);this.layout._values["text-writing-mode"]=p}else this.layout._values["text-writing-mode"]=this.layout.get("symbol-placement")==="point"?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getValueAndResolveTokens(r,o,c,p){const m=this.layout.get(r).evaluate(o,{},c,p),y=this._unevaluatedLayout._values[r];return y.isDataDriven()||Cl(y.value)||!m?m:function(x,E){return E.replace(/{([^{}]+)}/g,(S,k)=>k in x?String(x[k]):"")}(o.properties,m)}createBucket(r){return new Ul(r)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const r of u1.paint.overridableProperties){if(!bg.hasPaintOverride(this.layout,r))continue;const o=this.paint.get(r),c=new PI(o),p=new ch(c,o.property.specification);let m=null;m=o.value.kind==="constant"||o.value.kind==="source"?new Ap("source",p):new Hc("composite",p,o.value.zoomStops,o.value._interpolationType),this.paint._values[r]=new ie(o.property,m,o.parameters)}}_handleOverridablePaintPropertyUpdate(r,o,c){return!(!this.layout||o.isDataDriven()||c.isDataDriven())&&bg.hasPaintOverride(this.layout,r)}static hasPaintOverride(r,o){const c=r.get("text-field"),p=u1.paint.properties[o];let m=!1;const y=x=>{for(const E of x)if(p.overrides&&p.overrides.hasOverride(E))return void(m=!0)};if(c.value.kind==="constant"&&c.value.value instanceof ki)y(c.value.value.sections);else if(c.value.kind==="source"){const x=S=>{m||(S instanceof Rs&&ln(S.value)===kc?y(S.value.sections):S instanceof es?y(S.sections):S.eachChild(x))},E=c.value;E._styleExpression&&x(E._styleExpression.expression)}return m}getProgramConfiguration(r){return new Ol(this,r)}}var aL={paint:new he({"background-color":new Z(Ge.paint_background["background-color"]),"background-pattern":new Z(Ge.paint_background["background-pattern"]),"background-opacity":new Z(Ge.paint_background["background-opacity"])})},sL={paint:new he({"raster-opacity":new Z(Ge.paint_raster["raster-opacity"]),"raster-hue-rotate":new Z(Ge.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Z(Ge.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Z(Ge.paint_raster["raster-brightness-max"]),"raster-saturation":new Z(Ge.paint_raster["raster-saturation"]),"raster-contrast":new Z(Ge.paint_raster["raster-contrast"]),"raster-resampling":new Z(Ge.paint_raster["raster-resampling"]),"raster-fade-duration":new Z(Ge.paint_raster["raster-fade-duration"])})};class lL extends Pa{constructor(r){super(r,{}),this.implementation=r}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}isLayerDraped(){return this.implementation.renderToTile!==void 0}shouldRedrape(){return!!this.implementation.shouldRerenderTiles&&this.implementation.shouldRerenderTiles()}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){}onAdd(r){this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)}onRemove(r){this.implementation.onRemove&&this.implementation.onRemove(r,r.painter.context.gl)}}var cL={paint:new he({"sky-type":new Z(Ge.paint_sky["sky-type"]),"sky-atmosphere-sun":new Z(Ge.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new Z(Ge.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new Z(Ge.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new Z(Ge.paint_sky["sky-gradient-radius"]),"sky-gradient":new ue(Ge.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new Z(Ge.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new Z(Ge.paint_sky["sky-atmosphere-color"]),"sky-opacity":new Z(Ge.paint_sky["sky-opacity"])})};function h1(i,r,o){const c=[0,0,1],p=KA([]);return YA(p,p,o?-Fe(i)+Math.PI:Fe(i)),XA(p,p,-Fe(r)),GA(c,c,p),Di(c,c)}const uL={circle:class extends Pa{constructor(i){super(i,b5)}createBucket(i){return new Lx(i)}queryRadius(i){const r=i;return Th("circle-radius",this,r)+Th("circle-stroke-width",this,r)+Y0(this.paint.get("circle-translate"))}queryIntersectsFeature(i,r,o,c,p,m,y,x){const E=v2(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),m.angle,i.pixelToTileUnitsFactor),S=this.paint.get("circle-radius").evaluate(r,o)+this.paint.get("circle-stroke-width").evaluate(r,o);return x2(i,c,m,y,x,this.paint.get("circle-pitch-alignment")==="map",this.paint.get("circle-pitch-scale")==="map",E,S)}getProgramIds(){return["circle"]}getProgramConfiguration(i){return new Ol(this,i)}},heatmap:class extends Pa{createBucket(i){return new w2(i)}constructor(i){super(i,T5),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(i){i==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=jx({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(i){return Th("heatmap-radius",this,i)}queryIntersectsFeature(i,r,o,c,p,m,y,x){const E=this.paint.get("heatmap-radius").evaluate(r,o);return x2(i,c,m,y,x,!0,!0,new xe(0,0),E)}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}getProgramIds(){return["heatmap","heatmapTexture"]}getProgramConfiguration(i){return new Ol(this,i)}},hillshade:class extends Pa{constructor(i){super(i,A5)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}getProgramIds(){return["hillshade","hillshadePrepare"]}},fill:class extends Pa{constructor(i){super(i,V5)}getProgramIds(){const i=this.paint.get("fill-pattern"),r=i&&i.constantOr(1),o=[r?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&o.push(r&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),o}getProgramConfiguration(i){return new Ol(this,i)}recalculate(i,r){super.recalculate(i,r);const o=this.paint._values["fill-outline-color"];o.value.kind==="constant"&&o.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(i){return new rg(i)}queryRadius(){return Y0(this.paint.get("fill-translate"))}queryIntersectsFeature(i,r,o,c,p,m){return!i.queryGeometry.isAboveHorizon&&f2(_2(i.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),m.angle,i.pixelToTileUnitsFactor),c)}isTileClipped(){return!0}},"fill-extrusion":class extends Pa{constructor(i){super(i,iF)}createBucket(i){return new lf(i)}queryRadius(){return Y0(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}getProgramIds(){return[this.paint.get("fill-extrusion-pattern").constantOr(1)?"fillExtrusionPattern":"fillExtrusion"]}getProgramConfiguration(i){return new Ol(this,i)}queryIntersectsFeature(i,r,o,c,p,m,y,x,E){const S=v2(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),m.angle,i.pixelToTileUnitsFactor),k=this.paint.get("fill-extrusion-height").evaluate(r,o),M=this.paint.get("fill-extrusion-base").evaluate(r,o),O=[0,0],$=x&&m.elevation,G=m.elevation?m.elevation.exaggeration():1,K=i.tile.getBucket(this);if($&&K instanceof lf){const pe=K.centroidVertexArray,_e=E+1;_epe.polygon).flat());const ee=$?x:null,[le,me]=function(pe,_e,ye,Oe,Me,He,lt,Ue,Qe,Je,ot){return pe.projection.name==="globe"?function(pt,We,_t,Ct,vt,Gt,ft,zt,Ht,fr,qt){const Bt=[],Hr=[],Zt=pt.projection.upVectorScale(qt,pt.center.lat,pt.worldSize).metersToTile,Kt=[0,0,0,1],Lr=[0,0,0,1],Vr=(Br,tn,cn,wn)=>{Br[0]=tn,Br[1]=cn,Br[2]=wn,Br[3]=1},$r=N2();_t>0&&(_t+=$r),Ct+=$r;for(const Br of We){const tn=[],cn=[];for(const wn of Br){const Nr=wn.x+vt.x,Rn=wn.y+vt.y,En=pt.projection.projectTilePoint(Nr,Rn,qt),nn=pt.projection.upVector(qt,wn.x,wn.y);let yr=_t,Sn=Ct;if(ft){const Wr=W2(Nr,Rn,_t,Ct,ft,zt,Ht,fr);yr+=Wr.base,Sn+=Wr.top}_t!==0?Vr(Kt,En.x+nn[0]*Zt*yr,En.y+nn[1]*Zt*yr,En.z+nn[2]*Zt*yr):Vr(Kt,En.x,En.y,En.z),Vr(Lr,En.x+nn[0]*Zt*Sn,En.y+nn[1]*Zt*Sn,En.z+nn[2]*Zt*Sn),mn(Kt,Kt,Gt),mn(Lr,Lr,Gt),tn.push(new Ch(Kt[0],Kt[1],Kt[2])),cn.push(new Ch(Lr[0],Lr[1],Lr[2]))}Bt.push(tn),Hr.push(cn)}return[Bt,Hr]}(pe,_e,ye,Oe,Me,He,lt,Ue,Qe,Je,ot):lt?function(pt,We,_t,Ct,vt,Gt,ft,zt,Ht){const fr=[],qt=[],Bt=[0,0,0,1];for(const Hr of pt){const Zt=[],Kt=[];for(const Lr of Hr){const Vr=Lr.x+Ct.x,$r=Lr.y+Ct.y,Br=W2(Vr,$r,We,_t,Gt,ft,zt,Ht);Bt[0]=Vr,Bt[1]=$r,Bt[2]=Br.base,Bt[3]=1,iu(Bt,Bt,vt),Bt[3]=Math.max(Bt[3],1e-5);const tn=new Ch(Bt[0]/Bt[3],Bt[1]/Bt[3],Bt[2]/Bt[3]);Bt[0]=Vr,Bt[1]=$r,Bt[2]=Br.top,Bt[3]=1,iu(Bt,Bt,vt),Bt[3]=Math.max(Bt[3],1e-5);const cn=new Ch(Bt[0]/Bt[3],Bt[1]/Bt[3],Bt[2]/Bt[3]);Zt.push(tn),Kt.push(cn)}fr.push(Zt),qt.push(Kt)}return[fr,qt]}(_e,ye,Oe,Me,He,lt,Ue,Qe,Je):function(pt,We,_t,Ct,vt){const Gt=[],ft=[],zt=vt[8]*We,Ht=vt[9]*We,fr=vt[10]*We,qt=vt[11]*We,Bt=vt[8]*_t,Hr=vt[9]*_t,Zt=vt[10]*_t,Kt=vt[11]*_t;for(const Lr of pt){const Vr=[],$r=[];for(const Br of Lr){const tn=Br.x+Ct.x,cn=Br.y+Ct.y,wn=vt[0]*tn+vt[4]*cn+vt[12],Nr=vt[1]*tn+vt[5]*cn+vt[13],Rn=vt[2]*tn+vt[6]*cn+vt[14],En=vt[3]*tn+vt[7]*cn+vt[15],nn=wn+zt,yr=Nr+Ht,Sn=Rn+fr,Wr=Math.max(En+qt,1e-5),Ri=wn+Bt,Tn=Nr+Hr,ti=Rn+Zt,Hn=Math.max(En+Kt,1e-5);Vr.push(new Ch(nn/Wr,yr/Wr,Sn/Wr)),$r.push(new Ch(Ri/Hn,Tn/Hn,ti/Hn))}Gt.push(Vr),ft.push($r)}return[Gt,ft]}(_e,ye,Oe,Me,He)}(m,c,M,k,S,y,ee,O,G,m.center.lat,i.tileID.canonical),ce=i.queryGeometry;return function(pe,_e,ye){let Oe=1/0;f2(ye,_e)&&(Oe=$2(ye,_e[0]));for(let Me=0;Me<_e.length;Me++){const He=_e[Me],lt=pe[Me];for(let Ue=0;Ue=3){for(let G=0;G<$.length;G++)if(lu(S,$[G]))return!0}if(y5(S,$,M))return!0}return!1}(y,c,x)}isTileClipped(){return!0}},symbol:bg,background:class extends Pa{constructor(i){super(i,aL)}getProgramIds(){return[this.paint.get("background-pattern")?"backgroundPattern":"background"]}},raster:class extends Pa{constructor(i){super(i,sL)}getProgramIds(){return["raster"]}},sky:class extends Pa{constructor(i){super(i,cL),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(i){i==="sky-gradient"?this._updateColorRamp():i!=="sky-atmosphere-sun"&&i!=="sky-atmosphere-halo-color"&&i!=="sky-atmosphere-color"&&i!=="sky-atmosphere-sun-intensity"||(this._skyboxInvalidated=!0)}_updateColorRamp(){this.colorRamp=jx({expression:this._transitionablePaint._values["sky-gradient"].value.expression,evaluationKey:"skyRadialProgress"}),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}needsSkyboxCapture(i){if(this._skyboxInvalidated||!this.skyboxTexture||!this.skyboxGeometry)return!0;if(!this.paint.get("sky-atmosphere-sun")){const r=i.style.light.properties.get("position");return this._lightPosition.azimuthal!==r.azimuthal||this._lightPosition.polar!==r.polar}return!1}getCenter(i,r){if(this.paint.get("sky-type")==="atmosphere"){const c=this.paint.get("sky-atmosphere-sun"),p=!c,m=i.style.light,y=m.properties.get("position");return p&&m.properties.get("anchor")==="viewport"&&Tr("The sun direction is attached to a light with viewport anchor, lighting may behave unexpectedly."),p?h1(y.azimuthal,90-y.polar,r):h1(c[0],90-c[1],r)}const o=this.paint.get("sky-gradient-center");return h1(o[0],90-o[1],r)}is3D(){return!1}isSky(){return!0}markSkyboxValid(i){this._skyboxInvalidated=!1,this._lightPosition=i.style.light.properties.get("position")}hasOffscreenPass(){return!0}getProgramIds(){const i=this.paint.get("sky-type");return i==="atmosphere"?["skyboxCapture","skybox"]:i==="gradient"?["skyboxGradient"]:null}}};class vf{constructor(r,o,c,p){this.context=r,this.format=c,this.texture=r.gl.createTexture(),this.update(o,p)}update(r,o,c){const{width:p,height:m}=r,{context:y}=this,{gl:x}=y,{HTMLImageElement:E,HTMLCanvasElement:S,HTMLVideoElement:k,ImageData:M,ImageBitmap:O}=w;if(x.bindTexture(x.TEXTURE_2D,this.texture),y.pixelStoreUnpackFlipY.set(!1),y.pixelStoreUnpack.set(1),y.pixelStoreUnpackPremultiplyAlpha.set(this.format===x.RGBA&&(!o||o.premultiply!==!1)),c||this.size&&this.size[0]===p&&this.size[1]===m){const{x:$,y:G}=c||{x:0,y:0};r instanceof E||r instanceof S||r instanceof k||r instanceof M||O&&r instanceof O?x.texSubImage2D(x.TEXTURE_2D,0,$,G,x.RGBA,x.UNSIGNED_BYTE,r):x.texSubImage2D(x.TEXTURE_2D,0,$,G,p,m,x.RGBA,x.UNSIGNED_BYTE,r.data)}else this.size=[p,m],r instanceof E||r instanceof S||r instanceof k||r instanceof M||O&&r instanceof O?x.texImage2D(x.TEXTURE_2D,0,this.format,this.format,x.UNSIGNED_BYTE,r):x.texImage2D(x.TEXTURE_2D,0,this.format,p,m,0,this.format,x.UNSIGNED_BYTE,r.data);this.useMipmap=!!(o&&o.useMipmap&&this.isSizePowerOfTwo()),this.useMipmap&&x.generateMipmap(x.TEXTURE_2D)}bind(r,o){const{context:c}=this,{gl:p}=c;p.bindTexture(p.TEXTURE_2D,this.texture),r!==this.filter&&(p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MAG_FILTER,r),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MIN_FILTER,this.useMipmap?r===p.NEAREST?p.NEAREST_MIPMAP_NEAREST:p.LINEAR_MIPMAP_NEAREST:r),this.filter=r),o!==this.wrap&&(p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_S,o),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_T,o),this.wrap=o)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:r}=this.context;r.deleteTexture(this.texture),this.texture=null}}class hL{constructor(r){this._callback=r,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){this._channel=void 0,this._callback=()=>{}}}class dL{constructor(){this.tasks={},this.taskQueue=[],si(["process"],this),this.invoker=new hL(this.process),this.nextId=0}add(r,o){const c=this.nextId++,p=function({type:m,isSymbolTile:y,zoom:x}){return x=x||0,m==="message"?0:m!=="maybePrepare"||y?m!=="parseTile"||y?m==="parseTile"&&y?300-x:m==="maybePrepare"&&y?400-x:500:200-x:100-x}(o);if(p===0){yi();try{r()}finally{}return{cancel:()=>{}}}return this.tasks[c]={fn:r,metadata:o,priority:p,id:c},this.taskQueue.push(c),this.invoker.trigger(),{cancel:()=>{delete this.tasks[c]}}}process(){yi();try{if(this.taskQueue=this.taskQueue.filter(c=>!!this.tasks[c]),!this.taskQueue.length)return;const r=this.pick();if(r===null)return;const o=this.tasks[r];if(delete this.tasks[r],this.taskQueue.length&&this.invoker.trigger(),!o)return;o.fn()}finally{}}pick(){let r=null,o=1/0;for(let p=0;p>=1)>1;){const S=o+p>>1,k=c+m>>1;1&r?(p=o,m=c,o=y,c=x):(o=p,c=m,p=y,m=x),y=S,x=k}const E=4*i;jl[E+0]=o,jl[E+1]=c,jl[E+2]=p,jl[E+3]=m}const ls=new Uint16Array(2178),Vl=new Uint8Array(1089),wg=new Uint16Array(1089);function zI(i){return i===0?-.03125:i===32?.03125:0}var RI=Ie([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);const OI={type:2,extent:Ot,loadGeometry:()=>[[new xe(0,0),new xe(Ot+1,0),new xe(Ot+1,Ot+1),new xe(0,Ot+1),new xe(0,0)]]};class d1{constructor(r,o,c,p,m){this.tileID=r,this.uid=ur(),this.uses=0,this.tileSize=o,this.tileZoom=c,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=m,this.expiredRequestCount=0,this.state="loading",p&&p.transform&&(this.projection=p.transform.projection)}registerFadeDuration(r){const o=r+this.timeAdded;o<_a.now()||this.fadeEndTime&&om.getLayer(S)).filter(Boolean);if(E.length!==0){x.layers=E,x.stateDependentLayerIds&&(x.stateDependentLayers=x.stateDependentLayerIds.map(S=>E.filter(k=>k.id===S)[0]));for(const S of E)y[S.id]=x}}return y}(r.buckets,o.style),this.hasSymbolBuckets=!1;for(const p in this.buckets){const m=this.buckets[p];if(m instanceof Ul){if(this.hasSymbolBuckets=!0,!c)break;m.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const p in this.buckets){const m=this.buckets[p];if(m instanceof Ul&&m.hasRTLText){this.hasRTLText=!0,I.isLoading()||I.isLoaded()||b()!=="deferred"||A();break}}this.queryPadding=0;for(const p in this.buckets){const m=this.buckets[p];this.queryPadding=Math.max(this.queryPadding,o.style.getLayer(p).queryRadius(m))}r.imageAtlas&&(this.imageAtlas=r.imageAtlas),r.glyphAtlasImage&&(this.glyphAtlasImage=r.glyphAtlasImage),r.lineAtlas&&(this.lineAtlas=r.lineAtlas)}else this.collisionBoxArray=new Or}unloadVectorData(){if(this.hasData()){for(const r in this.buckets)this.buckets[r].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.lineAtlasTexture&&this.lineAtlasTexture.destroy(),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),this.latestFeatureIndex=null,this.state="unloaded"}}getBucket(r){return this.buckets[r.id]}upload(r){for(const c in this.buckets){const p=this.buckets[c];p.uploadPending()&&p.upload(r)}const o=r.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new vf(r,this.imageAtlas.image,o.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new vf(r,this.glyphAtlasImage,o.ALPHA),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new vf(r,this.lineAtlas.image,o.ALPHA),this.lineAtlas.uploaded=!0)}prepare(r){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(r,this.imageAtlasTexture)}queryRenderedFeatures(r,o,c,p,m,y,x,E){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({tileResult:p,pixelPosMatrix:x,transform:y,params:m,tileTransform:this.tileTransform},r,o,c):{}}querySourceFeatures(r,o){const c=this.latestFeatureIndex;if(!c||!c.rawTileData)return;const p=c.loadVTLayers(),m=o?o.sourceLayer:"",y=p._geojsonTileLayer||p[m];if(!y)return;const x=ph(o&&o.filter),{z:E,x:S,y:k}=this.tileID.canonical,M={z:E,x:S,y:k};for(let O=0;Oc)p=!1;else if(o)if(this.expirationTime=0;ee--){const le=4*ee,me=jl[le+0],ce=jl[le+1],pe=jl[le+2],_e=jl[le+3],ye=me+pe>>1,Oe=ce+_e>>1,Me=ye+Oe-ce,He=Oe+me-ye,lt=ce*ss+me,Ue=_e*ss+pe,Qe=Oe*ss+ye,Je=Math.hypot((ls[2*lt+0]+ls[2*Ue+0])/2-ls[2*Qe+0],(ls[2*lt+1]+ls[2*Ue+1])/2-ls[2*Qe+1])>=16;Vl[Qe]=Vl[Qe]||(Je?1:0),ee<1022&&(Vl[Qe]=Vl[Qe]||Vl[(ce+He>>1)*ss+(me+Me>>1)]||Vl[(_e+He>>1)*ss+(pe+Me>>1)])}const M=new Ke,O=new Pt;let $=0;function G(ee,le){const me=le*ss+ee;return wg[me]===0&&(M.emplaceBack(ls[2*me+0],ls[2*me+1],ee*Ot/na,le*Ot/na),wg[me]=++$),wg[me]-1}function K(ee,le,me,ce,pe,_e){const ye=ee+me>>1,Oe=le+ce>>1;if(Math.abs(ee-pe)+Math.abs(le-_e)>1&&Vl[Oe*ss+ye])K(pe,_e,ee,le,ye,Oe),K(me,ce,pe,_e,ye,Oe);else{const Me=G(ee,le),He=G(me,ce),lt=G(pe,_e);O.emplaceBack(Me,He,lt)}}return K(0,0,na,na,na,0),K(na,na,0,0,0,na),{vertices:M,indices:O}}(this.tileID.canonical,o);p=y.vertices,m=y.indices}else{p=new Ke,m=new Pt;for(const{x,y:E}of c)p.emplaceBack(x,E,0,0);const y=Hx(p.int16,void 0,4);for(let x=0;x0&&(x=xx(new Float64Array(16),o.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(r,p,o,m,x,y),this._makeGlobeTileDebugTextBuffer(r,p,o,m,x,y)}_globePoint(r,o,c,p,m,y,x){let E=Qp(r,o,c);if(y){const S=1<.5?$=-1:O<-.5&&($=1);let G=(r/Ot+c.x)/S+$,K=(o/Ot+c.y)/S;G=(G-k)*p._pixelsPerMercatorPixel+k,K=(K-M)*p._pixelsPerMercatorPixel+M;const ee=[G*p.worldSize,K*p.worldSize,0];mn(ee,ee,y),E=au(E,ee,x)}return mn(E,E,m)}_makeGlobeTileDebugBorderBuffer(r,o,c,p,m,y){const x=new st,E=new ao,S=new De,k=(O,$,G,K,ee)=>{const le=(G-O)/(ee-1),me=(K-$)/(ee-1),ce=x.length;for(let pe=0;peM*$+G;for(let $=0;$r[y])return null}else{const x=1/c[y];let E=(i[y]-o[y])*x,S=(r[y]-o[y])*x;if(E>S){const k=E;E=S,S=k}if(E>p&&(p=E),Sm)return null}return p}function BI(i,r,o,c,p,m,y,x,E,S,k){const M=c-i,O=p-r,$=m-o,G=y-i,K=x-r,ee=E-o,le=k[1]*ee-k[2]*K,me=k[2]*G-k[0]*ee,ce=k[0]*K-k[1]*G,pe=M*le+O*me+$*ce;if(Math.abs(pe)<1e-15)return null;const _e=1/pe,ye=S[0]-i,Oe=S[1]-r,Me=S[2]-o,He=(ye*le+Oe*me+Me*ce)*_e;if(He<0||He>1)return null;const lt=Oe*$-Me*O,Ue=Me*M-ye*$,Qe=ye*O-Oe*M,Je=(k[0]*lt+k[1]*Ue+k[2]*Qe)*_e;return Je<0||He+Je>1?null:(G*lt+K*Ue+ee*Qe)*_e}function NI(i,r,o){return(i-r)/(o-r)}function UI(i,r,o,c,p,m,y,x,E){const S=1<{const me=ee?1:0,ce=($+1)*K-me,pe=G*K,_e=(G+1)*K-me;le[0]=$*K,le[1]=pe,le[2]=ce,le[3]=_e};let M=new FI(E);const O=[];for(let $=0;$=1;E/=2){const $=x[x.length-1];M=new FI(E);for(let G=0;G0;){const{idx:G,t:K,nodex:ee,nodey:le,depth:me}=$.pop();if(this.leaves[G]){UI(ee,le,me,r,o,c,p,M,O);const pe=1<=We[2])return K}continue}let ce=0;for(let pe=0;pe=S[k[Me]]&&(k.splice(Me,0,pe),Oe=!0);Oe||(k[ce]=pe),ce++}}for(let pe=0;pe=this.dim+1||o<-1||o>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(o+1)*this.stride+(r+1)}static pack(r,o){const c=[0,0,0,0],p=Eg.getUnpackVector(o);let m=Math.floor((r+p[3])/p[2]);return c[2]=m%256,m=Math.floor(m/256),c[1]=m%256,m=Math.floor(m/256),c[0]=m,c}getPixels(){return new lo({width:this.stride,height:this.stride},this.pixels)}backfillBorder(r,o,c){if(this.dim!==r.dim)throw new Error("dem dimension mismatch");let p=o*this.dim,m=o*this.dim+this.dim,y=c*this.dim,x=c*this.dim+this.dim;switch(o){case-1:p=m-1;break;case 1:m=p+1}switch(c){case-1:y=x-1;break;case 1:x=y+1}const E=-o*this.dim,S=-c*this.dim;for(let k=y;k{this.remove(r,m)},c)),this.data[p].push(m),this.order.push(p),this.order.length>this.max){const y=this._getAndRemoveByKey(this.order[0]);y&&this.onRemove(y)}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 o=this.data[r].shift();return o.timeout&&clearTimeout(o.timeout),this.data[r].length===0&&delete this.data[r],this.order.splice(this.order.indexOf(r),1),o.value}getByKey(r){const o=this.data[r];return o?o[0].value:null}get(r){return this.has(r)?this.data[r.wrapped().key][0].value:null}remove(r,o){if(!this.has(r))return this;const c=r.wrapped().key,p=o===void 0?0:this.data[c].indexOf(o),m=this.data[c][p];return this.data[c].splice(p,1),m.timeout&&clearTimeout(m.timeout),this.data[c].length===0&&delete this.data[c],this.onRemove(m.value),this.order.splice(this.order.indexOf(c),1),this}setMaxSize(r){for(this.max=r;this.order.length>this.max;){const o=this._getAndRemoveByKey(this.order[0]);o&&this.onRemove(o)}return this}filter(r){const o=[];for(const c in this.data)for(const p of this.data[c])r(p.value)||o.push(p);for(const c of o)this.remove(c.value.tileID,c)}}class Bh{constructor(r,o,c){this.func=r,this.mask=o,this.range=c}}Bh.ReadOnly=!1,Bh.ReadWrite=!0,Bh.disabled=new Bh(519,Bh.ReadOnly,[0,1]);const p1=7680;class f1{constructor(r,o,c,p,m,y){this.test=r,this.ref=o,this.mask=c,this.fail=p,this.depthFail=m,this.pass=y}}f1.disabled=new f1({func:519,mask:0},0,0,p1,p1,p1);class cs{constructor(r,o,c){this.blendFunction=r,this.blendColor=o,this.mask=c}}cs.Replace=[1,0],cs.disabled=new cs(cs.Replace,fn.transparent,[!1,!1,!1,!1]),cs.unblended=new cs(cs.Replace,fn.transparent,[!0,!0,!0,!0]),cs.alphaBlended=new cs([1,771],fn.transparent,[!0,!0,!0,!0]);const m1=1029,g1=2305;class Fa{constructor(r,o,c){this.enable=r,this.mode=o,this.frontFace=c}}Fa.disabled=new Fa(!1,m1,g1),Fa.backCCW=new Fa(!0,m1,g1),Fa.backCW=new Fa(!0,m1,2304),Fa.frontCW=new Fa(!0,1028,2304),Fa.frontCCW=new Fa(!0,1028,g1);class hu extends Cc{constructor(r,o,c){super(),this.id=r,this._onlySymbols=c,o.on("data",p=>{p.dataType==="source"&&p.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&p.dataType==="source"&&p.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform))}),o.on("error",()=>{this._sourceErrored=!0}),this._source=o,this._tiles={},this._cache=new yL(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._minTileCacheSize=o.minTileCacheSize,this._maxTileCacheSize=o.maxTileCacheSize,this._loadedParentTiles={},this._coveredTiles={},this._state=new fL,this._isRaster=this._source.type==="raster"||this._source.type==="raster-dem"||this._source.type==="custom"&&this._source._dataType==="raster"}onAdd(r){this.map=r,this._minTileCacheSize=this._minTileCacheSize===void 0&&r?r._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=this._maxTileCacheSize===void 0&&r?r._maxTileCacheSize:this._maxTileCacheSize}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(const r in this._tiles){const o=this._tiles[r];if(o.state!=="loaded"&&o.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const r=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,r&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(r,o){return r.isSymbolTile=this._onlySymbols,this._source.loadTile(r,o)}_unloadTile(r){if(this._source.unloadTile)return this._source.unloadTile(r,()=>{})}_abortTile(r){if(this._source.abortTile)return this._source.abortTile(r,()=>{})}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 o in this._tiles){const c=this._tiles[o];c.upload(r),c.prepare(this.map.style.imageManager)}}getIds(){return et(this._tiles).map(r=>r.tileID).sort(WI).map(r=>r.key)}getRenderableIds(r){const o=[];for(const c in this._tiles)this._isIdRenderable(+c,r)&&o.push(this._tiles[c]);return r?o.sort((c,p)=>{const m=c.tileID,y=p.tileID,x=new xe(m.canonical.x,m.canonical.y)._rotate(this.transform.angle),E=new xe(y.canonical.x,y.canonical.y)._rotate(this.transform.angle);return m.overscaledZ-y.overscaledZ||E.y-x.y||E.x-x.x}).map(c=>c.tileID.key):o.map(c=>c.tileID).sort(WI).map(c=>c.key)}hasRenderableParent(r){const o=this.findLoadedParent(r,0);return!!o&&this._isIdRenderable(o.tileID.key)}_isIdRenderable(r,o){return this._tiles[r]&&this._tiles[r].hasData()&&!this._coveredTiles[r]&&(o||!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,o){const c=this._tiles[r];c&&(c.state!=="loading"&&(c.state=o),this._loadTile(c,this._tileLoaded.bind(this,c,r,o)))}_tileLoaded(r,o,c,p){if(p)if(r.state="errored",p.status!==404)this._source.fire(new va(p,{tile:r}));else if(this._source.type==="raster-dem"&&this.usedForTerrain&&this.map.painter.terrain){const m=this.map.painter.terrain;this.update(this.transform,m.getScaledDemTileSize(),!0),m.resetTileLookupCache(this.id)}else this.update(this.transform);else r.timeAdded=_a.now(),c==="expired"&&(r.refreshedUponExpiration=!0),this._setTileReloadTimer(o,r),this._source.type==="raster-dem"&&r.dem&&this._backfillDEM(r),this._state.initializeTileState(r,this.map?this.map.painter:null),this._source.fire(new Ms("data",{dataType:"source",tile:r,coord:r.tileID,sourceCacheId:this.id}))}_backfillDEM(r){const o=this.getRenderableIds();for(let p=0;p1||(Math.abs(y)>1&&(Math.abs(y+E)===1?y+=E:Math.abs(y-E)===1&&(y-=E)),m.dem&&p.dem&&(p.dem.backfillBorder(m.dem,y,x),p.neighboringTiles&&p.neighboringTiles[S]&&(p.neighboringTiles[S].backfilled=!0)))}}getTile(r){return this.getTileByID(r.key)}getTileByID(r){return this._tiles[r]}_retainLoadedChildren(r,o,c,p){for(const m in this._tiles){let y=this._tiles[m];if(p[m]||!y.hasData()||y.tileID.overscaledZ<=o||y.tileID.overscaledZ>c)continue;let x=y.tileID;for(;y&&y.tileID.overscaledZ>o+1;){const S=y.tileID.scaledTo(y.tileID.overscaledZ-1);y=this._tiles[S.key],y&&y.hasData()&&(x=S)}let E=x;for(;E.overscaledZ>o;)if(E=E.scaledTo(E.overscaledZ-1),r[E.key]){p[x.key]=x;break}}}findLoadedParent(r,o){if(r.key in this._loadedParentTiles){const c=this._loadedParentTiles[r.key];return c&&c.tileID.overscaledZ>=o?c:null}for(let c=r.overscaledZ-1;c>=o;c--){const p=r.scaledTo(c),m=this._getLoadedTile(p);if(m)return m}}_getLoadedTile(r){const o=this._tiles[r.key];return o&&o.hasData()?o:this._cache.getByKey(this._source.reparseOverscaled?r.wrapped().key:r.canonical.key)}updateCacheSize(r,o){o=o||this._source.tileSize;const c=Math.ceil(r.width/o)+1,p=Math.ceil(r.height/o)+1,m=Math.floor(c*p*5),y=typeof this._minTileCacheSize=="number"?Math.max(this._minTileCacheSize,m):m,x=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,y):y;this._cache.setMaxSize(x)}handleWrapJump(r){const o=Math.round((r-(this._prevLng===void 0?r:this._prevLng))/360);if(this._prevLng=r,o){const c={};for(const p in this._tiles){const m=this._tiles[p];m.tileID=m.tileID.unwrapTo(m.tileID.wrap+o),c[m.tileID.key]=m}this._tiles=c;for(const p in this._timers)clearTimeout(this._timers[p]),delete this._timers[p];for(const p in this._tiles)this._setTileReloadTimer(+p,this._tiles[p])}}update(r,o,c){if(this.transform=r,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage||this.usedForTerrain&&!c)return;let p;this.updateCacheSize(r,o),this.transform.projection.name!=="globe"&&this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?p=r.getVisibleUnwrappedCoordinates(this._source.tileID).map(x=>new zi(x.canonical.z,x.wrap,x.canonical.z,x.canonical.x,x.canonical.y)):(p=r.coveringTiles({tileSize:o||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!c,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain}),this._source.hasTile&&(p=p.filter(x=>this._source.hasTile(x)))):p=[];const m=this._updateRetainedTiles(p);if(GI(this._source.type)&&p.length!==0){const x={},E={},S=Object.keys(m);for(const M of S){const O=m[M],$=this._tiles[M];if(!$||$.fadeEndTime&&$.fadeEndTime<=_a.now())continue;const G=this.findLoadedParent(O,Math.max(O.overscaledZ-hu.maxOverzooming,this._source.minzoom));G&&(this._addTile(G.tileID),x[G.tileID.key]=G.tileID),E[M]=O}const k=p[p.length-1].overscaledZ;for(const M in this._tiles){const O=this._tiles[M];if(m[M]||!O.hasData())continue;let $=O.tileID;for(;$.overscaledZ>k;){$=$.scaledTo($.overscaledZ-1);const G=this._tiles[$.key];if(G&&G.hasData()&&E[$.key]){m[M]=O.tileID;break}}}for(const M in x)m[M]||(this._coveredTiles[M]=!0,m[M]=x[M])}for(const x in m)this._tiles[x].clearFadeHold();const y=function(x,E){const S=[];for(const k in x)k in E||S.push(k);return S}(this._tiles,m);for(const x of y){const E=this._tiles[x];E.hasSymbolBuckets&&!E.holdingForFade()?E.setHoldDuration(this.map._fadeDuration):E.hasSymbolBuckets&&!E.symbolFadeFinished()||this._removeTile(+x)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const r in this._tiles)this._tiles[r].holdingForFade()&&this._removeTile(+r)}_updateRetainedTiles(r){const o={};if(r.length===0)return o;const c={},p=r.reduce((S,k)=>Math.min(S,k.overscaledZ),1/0),m=r[0].overscaledZ,y=Math.max(m-hu.maxOverzooming,this._source.minzoom),x=Math.max(m+hu.maxUnderzooming,this._source.minzoom),E={};for(const S of r){const k=this._addTile(S);o[S.key]=S,k.hasData()||p=this._source.maxzoom){const O=S.children(this._source.maxzoom)[0],$=this.getTile(O);if($&&$.hasData()){o[O.key]=O;continue}}else{const O=S.children(this._source.maxzoom);if(o[O[0].key]&&o[O[1].key]&&o[O[2].key]&&o[O[3].key])continue}let M=k.wasRequested();for(let O=S.overscaledZ-1;O>=y;--O){const $=S.scaledTo(O);if(c[$.key]||(c[$.key]=!0,k=this.getTile($),!k&&M&&(k=this._addTile($)),k&&(o[$.key]=$,M=k.wasRequested(),k.hasData())))break}}return o}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const r in this._tiles){const o=[];let c,p=this._tiles[r].tileID;for(;p.overscaledZ>0;){if(p.key in this._loadedParentTiles){c=this._loadedParentTiles[p.key];break}o.push(p.key);const m=p.scaledTo(p.overscaledZ-1);if(c=this._getLoadedTile(m),c)break;p=m}for(const m of o)this._loadedParentTiles[m]=c}}_addTile(r){let o=this._tiles[r.key];if(o)return o;o=this._cache.getAndRemove(r),o&&(this._setTileReloadTimer(r.key,o),o.tileID=r,this._state.initializeTileState(o,this.map?this.map.painter:null),this._cacheTimers[r.key]&&(clearTimeout(this._cacheTimers[r.key]),delete this._cacheTimers[r.key],this._setTileReloadTimer(r.key,o)));const c=!!o;if(!c){const p=this.map?this.map.painter:null;o=new d1(r,this._source.tileSize*r.overscaleFactor(),this.transform.tileZoom,p,this._isRaster),this._loadTile(o,this._tileLoaded.bind(this,o,r.key,o.state))}return o?(o.uses++,this._tiles[r.key]=o,c||this._source.fire(new Ms("dataloading",{tile:o,coord:o.tileID,dataType:"source"})),o):null}_setTileReloadTimer(r,o){r in this._timers&&(clearTimeout(this._timers[r]),delete this._timers[r]);const c=o.getExpiryTimeout();c&&(this._timers[r]=setTimeout(()=>{this._reloadTile(r,"expired"),delete this._timers[r]},c))}_removeTile(r){const o=this._tiles[r];o&&(o.uses--,delete this._tiles[r],this._timers[r]&&(clearTimeout(this._timers[r]),delete this._timers[r]),o.uses>0||(o.hasData()&&o.state!=="reloading"?this._cache.add(o.tileID,o,o.getExpiryTimeout()):(o.aborted=!0,this._abortTile(o),this._unloadTile(o))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const r in this._tiles)this._removeTile(+r);this._source._clear&&this._source._clear(),this._cache.reset(),this.map&&this.usedForTerrain&&this.map.painter.terrain&&this.map.painter.terrain.resetTileLookupCache(this.id)}tilesIn(r,o,c){const p=[],m=this.transform;if(!m)return p;const y=m.projection.name==="globe",x=os(m.center.lng);for(const E in this._tiles){const S=this._tiles[E];if(c&&S.clearQueryDebugViz(),S.holdingForFade())continue;let k;if(y){const M=S.tileID.canonical;if(M.z===0){const O=[Math.abs(qe(x,...xf(M,-1))-x),Math.abs(qe(x,...xf(M,1))-x)];k=[0,2*O.indexOf(Math.min(...O))-1]}else{const O=[Math.abs(qe(x,...xf(M,-1))-x),Math.abs(qe(x,...xf(M,0))-x),Math.abs(qe(x,...xf(M,1))-x)];k=[O.indexOf(Math.min(...O))-1]}}else k=[0];for(const M of k){const O=r.containsTile(S,m,o,M);O&&p.push(O)}}return p}getVisibleCoordinates(r){const o=this.getRenderableIds(r).map(c=>this._tiles[c].tileID);for(const c of o)c.projMatrix=this.transform.calculateProjMatrix(c.toUnwrapped());return o}hasTransition(){if(this._source.hasTransition())return!0;if(GI(this._source.type))for(const r in this._tiles){const o=this._tiles[r];if(o.fadeEndTime!==void 0&&o.fadeEndTime>=_a.now())return!0}return!1}setFeatureState(r,o,c){this._state.updateState(r=r||"_geojsonTileLayer",o,c)}removeFeatureState(r,o,c){this._state.removeFeatureState(r=r||"_geojsonTileLayer",o,c)}getFeatureState(r,o){return this._state.getState(r=r||"_geojsonTileLayer",o)}setDependencies(r,o,c){const p=this._tiles[r];p&&p.setDependencies(o,c)}reloadTilesForDependencies(r,o){for(const c in this._tiles)this._tiles[c].hasDependency(r,o)&&this._reloadTile(+c,"reloading");this._cache.filter(c=>!c.hasDependency(r,o))}_preloadTiles(r,o){if(!this._sourceLoaded){const x=()=>{this._sourceLoaded&&(this._source.off("data",x),this._preloadTiles(r,o))};return void this._source.on("data",x)}const c=new Map,p=Array.isArray(r)?r:[r],m=this.map.painter.terrain,y=this.usedForTerrain&&m?m.getScaledDemTileSize():this._source.tileSize;for(const x of p){const E=x.coveringTiles({tileSize:y,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(const S of E)c.set(S.key,S);this.usedForTerrain&&x.updateElevation(!1)}je(Array.from(c.values()),(x,E)=>{const S=new d1(x,this._source.tileSize*x.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster);this._loadTile(S,k=>{this._source.type==="raster-dem"&&S.dem&&this._backfillDEM(S),E(k,S)})},o)}}function WI(i,r){const o=Math.abs(2*i.wrap)-+(i.wrap<0),c=Math.abs(2*r.wrap)-+(r.wrap<0);return i.overscaledZ-r.overscaledZ||c-o||r.canonical.y-i.canonical.y||r.canonical.x-i.canonical.x}function GI(i){return i==="raster"||i==="image"||i==="video"||i==="custom"}function xf(i,r){const o=1<=0&&M[3]>=0&&E.insert(x,M[0],M[1],M[2],M[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new Xx(new ug(this.rawTileData)).layers,this.sourceLayerCoder=new DI(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={};for(const r in this.vtLayers)this.vtFeatures[r]=[]}return this.vtLayers}query(r,o,c,p){this.loadVTLayers();const m=r.params||{},y=ph(m.filter),x=r.tileResult,E=r.transform,S=x.bufferedTilespaceBounds,k=this.grid.query(S.min.x,S.min.y,S.max.x,S.max.y,(G,K,ee,le)=>y2(x.bufferedTilespaceGeometry,G,K,ee,le));k.sort(_L);let M=null;E.elevation&&k.length>0&&(M=Sg.create(E.elevation,this.tileID));const O={};let $;for(let G=0;G(le||(le=Hs(me,this.tileID.canonical,r.tileTransform)),ce.queryIntersectsFeature(x,me,pe,le,this.z,r.transform,r.pixelPosMatrix,M,_e)))}return O}loadMatchingFeature(r,o,c,p,m,y,x,E,S){const{featureIndex:k,bucketIndex:M,sourceLayerIndex:O,layoutVertexArrayOffset:$}=o,G=this.bucketLayerIDs[M];if(p&&!function(me,ce){for(let pe=0;pe=0)return!0;return!1}(p,G))return;const K=this.sourceLayerCoder.decode(O),ee=this.vtLayers[K].feature(k);if(c.needGeometry){const me=su(ee,!0);if(!c.filter(new D(this.tileID.overscaledZ),me,this.tileID.canonical))return}else if(!c.filter(new D(this.tileID.overscaledZ),ee))return;const le=this.getId(ee,K);for(let me=0;me{const x=r instanceof ae?r.get(y):null;return x&&x.evaluate?x.evaluate(o,c,p):x})}function _L(i,r){return r-i}At(HI,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});class ZI{constructor(r,o){this.width=r,this.height=o,this.nextRow=0,this.image=new qs({width:r,height:o}),this.positions={},this.uploaded=!1}getDash(r,o){const c=this.getKey(r,o);return this.positions[c]}trim(){const r=this.width,o=this.height=Pr(this.nextRow);this.image.resize({width:r,height:o})}getKey(r,o){return r.join(",")+o}getDashRanges(r,o,c){const p=[];let m=r.length%2==1?-r[r.length-1]*c:0,y=r[0]*c,x=!0;p.push({left:m,right:y,isDash:x,zeroLength:r[0]===0});let E=r[0];for(let S=1;S1&&(E=r[++x]);const k=Math.abs(S-E.left),M=Math.abs(S-E.right),O=Math.min(k,M);let $;const G=m/c*(p+1);if(E.isDash){const K=p-Math.abs(G);$=Math.sqrt(O*O+K*K)}else $=p-Math.sqrt(O*O+G*G);this.image.data[y+S]=Math.max(0,Math.min(255,$+128))}}}addRegularDash(r,o){for(let E=r.length-1;E>=0;--E){const S=r[E],k=r[E+1];S.zeroLength?r.splice(E,1):k&&k.isDash===S.isDash&&(k.left=S.left,r.splice(E,1))}const c=r[0],p=r[r.length-1];c.isDash===p.isDash&&(c.left=p.left-this.width,p.right=c.right+this.width);const m=this.width*this.nextRow;let y=0,x=r[y];for(let E=0;E1&&(x=r[++y]);const S=Math.abs(E-x.left),k=Math.abs(E-x.right),M=Math.min(S,k);this.image.data[m+E]=Math.max(0,Math.min(255,(x.isDash?M:-M)+o+128))}}addDash(r,o){const c=this.getKey(r,o);if(this.positions[c])return this.positions[c];const p=o==="round",m=p?7:0,y=2*m+1;if(this.nextRow+y>this.height)return Tr("LineAtlas out of space"),null;r.length===0&&r.push(1);let x=0;for(let k=0;k=Qe.maxzoom||Qe.visibility!=="none"&&(y1(Ue,this.zoom,c),(E[Qe.id]=Qe.createBucket({index:x.bucketLayerIDs.length,layers:Ue,zoom:this.zoom,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:He,sourceID:this.source,enableTerrain:this.enableTerrain,projection:this.projection.spec,availableImages:c})).populate(lt,k,this.tileID.canonical,this.tileTransform),x.bucketLayerIDs.push(Ue.map(Je=>Je.id)))}}let O,$,G,K;S.trim();const ee={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},le=()=>{if(O)return m(O);if($&&G&&K){const _e=new XI($),ye=new nI(G,K);for(const Oe in E){const Me=E[Oe];Me instanceof Ul?(y1(Me.layers,this.zoom,c),GF(Me,$,_e.positions,G,ye.iconPositions,this.showCollisionBoxes,c,this.tileID.canonical,this.tileZoom,this.projection)):Me.hasPattern&&(Me instanceof sg||Me instanceof rg||Me instanceof lf)&&(y1(Me.layers,this.zoom,c),Me.addFeatures(k,this.tileID.canonical,ye.patternPositions,c,this.tileTransform))}this.status="done",m(null,{buckets:et(E).filter(Oe=>!Oe.isEmpty()),featureIndex:x,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:_e.image,lineAtlas:S,imageAtlas:ye,glyphMap:this.returnDependencies?$:null,iconMap:this.returnDependencies?G:null,glyphPositions:this.returnDependencies?_e.positions:null})}},me=Vt(k.glyphDependencies,_e=>Object.keys(_e).map(Number));Object.keys(me).length?p.send("getGlyphs",{uid:this.uid,stacks:me},(_e,ye)=>{O||(O=_e,$=ye,le())},void 0,!1,ee):$={};const ce=Object.keys(k.iconDependencies);ce.length?p.send("getImages",{icons:ce,source:this.source,tileID:this.tileID,type:"icons"},(_e,ye)=>{O||(O=_e,G=ye,le())},void 0,!1,ee):G={};const pe=Object.keys(k.patternDependencies);pe.length?p.send("getImages",{icons:pe,source:this.source,tileID:this.tileID,type:"patterns"},(_e,ye)=>{O||(O=_e,K=ye,le())},void 0,!1,ee):K={},le()}}function y1(i,r,o){const c=new D(r);for(const p of i)p.recalculate(c,o)}class YI{constructor(r){this.entries={},this.scheduler=r}request(r,o,c,p){const m=this.entries[r]=this.entries[r]||{callbacks:[]};if(m.result){const[y,x]=m.result;return this.scheduler?this.scheduler.add(()=>{p(y,x)},o):p(y,x),()=>{}}return m.callbacks.push(p),m.cancel||(m.cancel=c((y,x)=>{m.result=[y,x];for(const E of m.callbacks)this.scheduler?this.scheduler.add(()=>{E(y,x)},o):E(y,x);setTimeout(()=>delete this.entries[r],3e3)})),()=>{m.result||(m.callbacks=m.callbacks.filter(y=>y!==p),m.callbacks.length||(m.cancel(),delete this.entries[r]))}}}function QI(i,r,o){const c=JSON.stringify(i.request);return i.data&&(this.deduped.entries[c]={result:[null,i.data]}),this.deduped.request(c,{type:"parseTile",isSymbolTile:i.isSymbolTile,zoom:i.tileZoom},p=>{const m=Ja(i.request,(y,x,E,S)=>{y?p(y):x&&p(null,{vectorTile:o?void 0:new Xx(new ug(x)),rawData:x,cacheControl:E,expires:S})});return()=>{m.cancel(),p()}},r)}const JI=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class _1{static from(r){if(!(r instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[o,c]=new Uint8Array(r,0,2);if(o!==219)throw new Error("Data does not appear to be in a KDBush format.");const p=c>>4;if(p!==1)throw new Error(`Got v${p} data when expected v1.`);const m=JI[15&c];if(!m)throw new Error("Unrecognized array type.");const[y]=new Uint16Array(r,2,1),[x]=new Uint32Array(r,4,1);return new _1(x,y,m,r)}constructor(r,o=64,c=Float64Array,p){if(isNaN(r)||r<0)throw new Error(`Unpexpected numItems value: ${r}.`);this.numItems=+r,this.nodeSize=Math.min(Math.max(+o,2),65535),this.ArrayType=c,this.IndexArrayType=r<65536?Uint16Array:Uint32Array;const m=JI.indexOf(this.ArrayType),y=2*r*this.ArrayType.BYTES_PER_ELEMENT,x=r*this.IndexArrayType.BYTES_PER_ELEMENT,E=(8-x%8)%8;if(m<0)throw new Error(`Unexpected typed array class: ${c}.`);p&&p instanceof ArrayBuffer?(this.data=p,this.ids=new this.IndexArrayType(this.data,8,r),this.coords=new this.ArrayType(this.data,8+x+E,2*r),this._pos=2*r,this._finished=!0):(this.data=new ArrayBuffer(8+y+x+E),this.ids=new this.IndexArrayType(this.data,8,r),this.coords=new this.ArrayType(this.data,8+x+E,2*r),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+m]),new Uint16Array(this.data,2,1)[0]=o,new Uint32Array(this.data,4,1)[0]=r)}add(r,o){const c=this._pos>>1;return this.ids[c]=c,this.coords[this._pos++]=r,this.coords[this._pos++]=o,c}finish(){const r=this._pos>>1;if(r!==this.numItems)throw new Error(`Added ${r} items when expected ${this.numItems}.`);return v1(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(r,o,c,p){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:m,coords:y,nodeSize:x}=this,E=[0,m.length-1,0],S=[];for(;E.length;){const k=E.pop()||0,M=E.pop()||0,O=E.pop()||0;if(M-O<=x){for(let ee=O;ee<=M;ee++){const le=y[2*ee],me=y[2*ee+1];le>=r&&le<=c&&me>=o&&me<=p&&S.push(m[ee])}continue}const $=O+M>>1,G=y[2*$],K=y[2*$+1];G>=r&&G<=c&&K>=o&&K<=p&&S.push(m[$]),(k===0?r<=G:o<=K)&&(E.push(O),E.push($-1),E.push(1-k)),(k===0?c>=G:p>=K)&&(E.push($+1),E.push(M),E.push(1-k))}return S}within(r,o,c){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:p,coords:m,nodeSize:y}=this,x=[0,p.length-1,0],E=[],S=c*c;for(;x.length;){const k=x.pop()||0,M=x.pop()||0,O=x.pop()||0;if(M-O<=y){for(let ee=O;ee<=M;ee++)tC(m[2*ee],m[2*ee+1],r,o)<=S&&E.push(p[ee]);continue}const $=O+M>>1,G=m[2*$],K=m[2*$+1];tC(G,K,r,o)<=S&&E.push(p[$]),(k===0?r-c<=G:o-c<=K)&&(x.push(O),x.push($-1),x.push(1-k)),(k===0?r+c>=G:o+c>=K)&&(x.push($+1),x.push(M),x.push(1-k))}return E}}function v1(i,r,o,c,p,m){if(p-c<=o)return;const y=c+p>>1;eC(i,r,y,c,p,m),v1(i,r,o,c,y-1,1-m),v1(i,r,o,y+1,p,1-m)}function eC(i,r,o,c,p,m){for(;p>c;){if(p-c>600){const S=p-c+1,k=o-c+1,M=Math.log(S),O=.5*Math.exp(2*M/3),$=.5*Math.sqrt(M*O*(S-O)/S)*(k-S/2<0?-1:1);eC(i,r,o,Math.max(c,Math.floor(o-k*O/S+$)),Math.min(p,Math.floor(o+(S-k)*O/S+$)),m)}const y=r[2*o+m];let x=c,E=p;for(bf(i,r,c,o),r[2*p+m]>y&&bf(i,r,c,p);xy;)E--}r[2*c+m]===y?bf(i,r,c,E):(E++,bf(i,r,E,p)),E<=o&&(c=E+1),o<=E&&(p=E-1)}}function bf(i,r,o,c){x1(i,o,c),x1(r,2*o,2*c),x1(r,2*o+1,2*c+1)}function x1(i,r,o){const c=i[r];i[r]=i[o],i[o]=c}function tC(i,r,o,c){const p=i-o,m=r-c;return p*p+m*m}l.ARRAY_TYPE=so,l.AUTH_ERR_MSG=ve,l.Aabb=Mi,l.Actor=class{constructor(i,r,o){this.target=i,this.parent=r,this.mapId=o,this.callbacks={},this.cancelCallbacks={},si(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.globalScope=yi()?i:w,this.scheduler=new dL}send(i,r,o,c,p=!1,m){const y=Math.round(1e18*Math.random()).toString(36).substring(0,10);o&&(o.metadata=m,this.callbacks[y]=o);const x=Nn(this.globalScope)?void 0:[];return this.target.postMessage({id:y,type:i,hasCallback:!!o,targetMapId:c,mustQueue:p,sourceMapId:this.mapId,data:Ml(r,x)},x),{cancel:()=>{o&&delete this.callbacks[y],this.target.postMessage({id:y,type:"",targetMapId:c,sourceMapId:this.mapId})}}}receive(i){const r=i.data,o=r.id;if(o&&(!r.targetMapId||this.mapId===r.targetMapId))if(r.type===""){const c=this.cancelCallbacks[o];delete this.cancelCallbacks[o],c&&c.cancel()}else if(r.mustQueue||yi()){const c=this.callbacks[o];this.cancelCallbacks[o]=this.scheduler.add(()=>this.processTask(o,r),c&&c.metadata||{type:"message"})}else this.processTask(o,r)}processTask(i,r){if(r.type===""){const o=this.callbacks[i];delete this.callbacks[i],o&&(r.error?o(Us(r.error)):o(null,Us(r.data)))}else{const o=Nn(this.globalScope)?void 0:[],c=r.hasCallback?(m,y)=>{delete this.cancelCallbacks[i],this.target.postMessage({id:i,type:"",sourceMapId:this.mapId,error:m?Ml(m):null,data:Ml(y,o)},o)}:m=>{},p=Us(r.data);if(this.parent[r.type])this.parent[r.type](r.sourceMapId,p,c);else if(this.parent.getWorkerSource){const m=r.type.split(".");this.parent.getWorkerSource(r.sourceMapId,m[0],p.source)[m[1]](p,c)}else c(new Error(`Could not find function ${r.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}},l.CanonicalTileID=ag,l.Color=fn,l.ColorMode=cs,l.CullFaceMode=Fa,l.DEMData=Eg,l.DataConstantProperty=Z,l.DedupedRequest=YI,l.DepthMode=Bh,l.EXTENT=Ot,l.Elevation=class{isDataAvailableAtPoint(i){const r=this._source();if(this.isUsingMockSource()||!r||i.y<0||i.y>1)return!1;const o=r.getSource().maxzoom,c=1<1)return r;const p=c.getSource().maxzoom,m=1<{const m=this.getAtTileOffset(i,p.x,p.y),y=c.upVector(i.canonical,p.x,p.y);return ko(y,y,m*c.upVectorScale(i.canonical,r,o).metersToTile),y}}getForTilePoints(i,r,o,c){if(this.isUsingMockSource())return!1;const p=Sg.create(this,i,c);return!!p&&(r.forEach(m=>{m[2]=this.exaggeration()*p.getElevationAt(m[0],m[1],o)}),!0)}getMinMaxForTile(i){if(this.isUsingMockSource())return null;const r=this.findDEMTileFor(i);if(!r||!r.dem)return null;const o=r.dem.tree,c=r.tileID,p=1<{let O=S===m-1?S-2:S===0?S:S-1;return O+=M?24575:0,[O,k]};for(let S=0;Sthis._skuTokenExpiresAt}transformRequest(i,r){return this._transformRequestFn&&this._transformRequestFn(i,r)||{url:i}}normalizeStyleURL(i,r){if(!Ae(i))return i;const o=mt(i);return o.path=`/styles/v1${o.path}`,this._makeAPIURL(o,this._customAccessToken||r)}normalizeGlyphsURL(i,r){if(!Ae(i))return i;const o=mt(i);return o.path=`/fonts/v1${o.path}`,this._makeAPIURL(o,this._customAccessToken||r)}normalizeSourceURL(i,r,o,c){if(!Ae(i))return i;const p=mt(i);return p.path=`/v4/${p.authority}.json`,p.params.push("secure"),o&&p.params.push(`language=${o}`),c&&p.params.push(`worldview=${c}`),this._makeAPIURL(p,this._customAccessToken||r)}normalizeSpriteURL(i,r,o,c){const p=mt(i);return Ae(i)?(p.path=`/styles/v1${p.path}/sprite${r}${o}`,this._makeAPIURL(p,this._customAccessToken||c)):(p.path+=`${r}${o}`,ct(p))}normalizeTileURL(i,r,o){if(this._isSkuTokenExpired()&&this._createSkuToken(),i&&!Ae(i))return i;const c=mt(i);c.path=c.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${r||o&&c.authority!=="raster"&&o===512?"@2x":""}${z.supported?".webp":"$1"}`),c.authority==="raster"?c.path=`/${P.RASTER_URL_PREFIX}${c.path}`:(c.path=c.path.replace(/^.+\/v4\//,"/"),c.path=`/${P.TILE_URL_VERSION}${c.path}`);const p=this._customAccessToken||function(m){for(const y of m){const x=y.match(/^access_token=(.*)$/);if(x)return x[1]}return null}(c.params)||P.ACCESS_TOKEN;return P.REQUIRE_ACCESS_TOKEN&&p&&this._skuToken&&c.params.push(`sku=${this._skuToken}`),this._makeAPIURL(c,p)}canonicalizeTileURL(i,r){const o=mt(i);if(!o.path.match(/^(\/v4\/|\/raster\/v1\/)/)||!o.path.match(/\.[\w]+$/))return i;let c="mapbox://";o.path.match(/^\/raster\/v1\//)?c+=`raster/${o.path.replace(`/${P.RASTER_URL_PREFIX}/`,"")}`:c+=`tiles/${o.path.replace(`/${P.TILE_URL_VERSION}/`,"")}`;let p=o.params;return r&&(p=p.filter(m=>!m.match(/^access_token=/))),p.length&&(c+=`?${p.join("&")}`),c}canonicalizeTileset(i,r){const o=!!r&&Ae(r),c=[];for(const p of i.tiles||[])Pe(p)?c.push(this.canonicalizeTileURL(p,o)):c.push(p);return c}_makeAPIURL(i,r){const o="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",c=mt(P.API_URL);if(i.protocol=c.protocol,i.authority=c.authority,i.protocol==="http"){const p=i.params.indexOf("secure");p>=0&&i.params.splice(p,1)}if(c.path!=="/"&&(i.path=`${c.path}${i.path}`),!P.REQUIRE_ACCESS_TOKEN)return ct(i);if(r=r||P.ACCESS_TOKEN,!this._silenceAuthErrors){if(!r)throw new Error(`An API access token is required to use Mapbox GL. ${o}`);if(r[0]==="s")throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${o}`)}return i.params=i.params.filter(p=>p.indexOf("access_token")===-1),i.params.push(`access_token=${r||""}`),ct(i)}},l.ResourceType=ga,l.SegmentVector=xn,l.SourceCache=hu,l.StencilMode=f1,l.StructArrayLayout1ui2=ao,l.StructArrayLayout2f1f2i16=Lt,l.StructArrayLayout2i4=st,l.StructArrayLayout2ui4=Gn,l.StructArrayLayout3f12=er,l.StructArrayLayout3ui6=Pt,l.StructArrayLayout4i8=Ke,l.StructArrayLayout5f20=Rr,l.Texture=vf,l.Tile=d1,l.Transitionable=q,l.Uniform1f=$0,l.Uniform1i=class extends $s{constructor(i){super(i),this.current=0}set(i,r,o){this.fetchUniformLocation(i,r)&&this.current!==o&&(this.current=o,this.gl.uniform1i(this.location,o))}},l.Uniform2f=class extends $s{constructor(i){super(i),this.current=[0,0]}set(i,r,o){this.fetchUniformLocation(i,r)&&(o[0]===this.current[0]&&o[1]===this.current[1]||(this.current=o,this.gl.uniform2f(this.location,o[0],o[1])))}},l.Uniform3f=class extends $s{constructor(i){super(i),this.current=[0,0,0]}set(i,r,o){this.fetchUniformLocation(i,r)&&(o[0]===this.current[0]&&o[1]===this.current[1]&&o[2]===this.current[2]||(this.current=o,this.gl.uniform3f(this.location,o[0],o[1],o[2])))}},l.Uniform4f=OA,l.UniformColor=FA,l.UniformMatrix2f=class extends $s{constructor(i){super(i),this.current=XO}set(i,r,o){if(this.fetchUniformLocation(i,r)){for(let c=0;c<4;c++)if(o[c]!==this.current[c]){this.current=o,this.gl.uniformMatrix2fv(this.location,!1,o);break}}}},l.UniformMatrix3f=class extends $s{constructor(i){super(i),this.current=KO}set(i,r,o){if(this.fetchUniformLocation(i,r)){for(let c=0;c<9;c++)if(o[c]!==this.current[c]){this.current=o,this.gl.uniformMatrix3fv(this.location,!1,o);break}}}},l.UniformMatrix4f=class extends $s{constructor(i){super(i),this.current=ZO}set(i,r,o){if(this.fetchUniformLocation(i,r)){if(o[12]!==this.current[12]||o[0]!==this.current[0])return this.current=o,void this.gl.uniformMatrix4fv(this.location,!1,o);for(let c=1;c<16;c++)if(o[c]!==this.current[c]){this.current=o,this.gl.uniformMatrix4fv(this.location,!1,o);break}}}},l.UnwrappedTileID=V2,l.ValidationError=Et,l.VectorTileFeature=ig,l.VectorTileWorkerSource=class extends Cc{constructor(i,r,o,c,p){super(),this.actor=i,this.layerIndex=r,this.availableImages=o,this.loadVectorData=p||QI,this.loading={},this.loaded={},this.deduped=new YI(i.scheduler),this.isSpriteLoaded=c,this.scheduler=i.scheduler}loadTile(i,r){const o=i.uid,c=i&&i.request,p=c&&c.collectResourceTiming,m=this.loading[o]=new vL(i);m.abort=this.loadVectorData(i,(y,x)=>{const E=!this.loading[o];if(delete this.loading[o],E||y||!x)return m.status="done",E||(this.loaded[o]=m),r(y);const S=x.rawData,k={};x.expires&&(k.expires=x.expires),x.cacheControl&&(k.cacheControl=x.cacheControl),m.vectorTile=x.vectorTile||new Xx(new ug(S));const M=()=>{m.parse(m.vectorTile,this.layerIndex,this.availableImages,this.actor,(O,$)=>{if(O||!$)return r(O);const G={};if(p){const K=qd(c);K.length>0&&(G.resourceTiming=JSON.parse(JSON.stringify(K)))}r(null,nt({rawTileData:S.slice(0)},$,k,G))})};this.isSpriteLoaded?M():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(M,{type:"parseTile",isSymbolTile:i.isSymbolTile,zoom:i.tileZoom}):M()}),this.loaded=this.loaded||{},this.loaded[o]=m})}reloadTile(i,r){const o=this.loaded,c=i.uid,p=this;if(o&&o[c]){const m=o[c];m.showCollisionBoxes=i.showCollisionBoxes,m.enableTerrain=!!i.enableTerrain,m.projection=i.projection,m.tileTransform=uu(i.tileID.canonical,i.projection);const y=(x,E)=>{const S=m.reloadCallback;S&&(delete m.reloadCallback,m.parse(m.vectorTile,p.layerIndex,this.availableImages,p.actor,S)),r(x,E)};m.status==="parsing"?m.reloadCallback=y:m.status==="done"&&(m.vectorTile?m.parse(m.vectorTile,this.layerIndex,this.availableImages,this.actor,y):y())}}abortTile(i,r){const o=i.uid,c=this.loading[o];c&&(c.abort&&c.abort(),delete this.loading[o]),r()}removeTile(i,r){const o=this.loaded,c=i.uid;o&&o[c]&&delete o[c],r()}},l.WritingMode=Do,l.ZoomDependentExpression=Hc,l.add=Gs,l.addDynamicAttributes=xg,l.adjoint=function(i,r){var o=r[0],c=r[1],p=r[2],m=r[3],y=r[4],x=r[5],E=r[6],S=r[7],k=r[8];return i[0]=y*k-x*S,i[1]=p*S-c*k,i[2]=c*x-p*y,i[3]=x*E-m*k,i[4]=o*k-p*E,i[5]=p*m-o*x,i[6]=m*S-y*E,i[7]=c*E-o*S,i[8]=o*y-c*m,i},l.asyncAll=je,l.bezier=Ut,l.bindAll=si,l.boundsAttributes=RI,l.bufferConvexPolygon=function(i,r){const o=[];for(let c=0;cEo&&(i.getActor().send("enforceCacheSizeLimit",Ps),So=0)},l.calculateGlobeLabelMatrix=function(i,r){const{x:o,y:c}=i.point,p=o2(o,c,i.worldSize/i._pixelsPerMercatorPixel,0,0);return ru(p,p,Dx(is(r)))},l.calculateGlobeMatrix=function(i){const{x:r,y:o}=i.point,{lng:c,lat:p}=i._center;return o2(r,o,i.worldSize,c,p)},l.calculateGlobeMercatorMatrix=function(i){const r=i.pixelsPerMeter,o=r/za(1,i.center.lat),c=Da(new Float64Array(16));return Wp(c,c,[i.point.x,i.point.y,0]),nu(c,c,[o,o,r]),Float32Array.from(c)},l.circumferenceAtLatitude=zx,l.clamp=qe,l.clearTileCache=function(i){if(!Qa())return;const r=w.caches.delete(wo);i&&r.catch(i).then(()=>i())},l.clipLine=gI,l.clone=function(i){var r=new so(16);return r[0]=i[0],r[1]=i[1],r[2]=i[2],r[3]=i[3],r[4]=i[4],r[5]=i[5],r[6]=i[6],r[7]=i[7],r[8]=i[8],r[9]=i[9],r[10]=i[10],r[11]=i[11],r[12]=i[12],r[13]=i[13],r[14]=i[14],r[15]=i[15],r},l.clone$1=qr,l.collisionCircleLayout=yF,l.config=P,l.conjugate=function(i,r){return i[0]=-r[0],i[1]=-r[1],i[2]=-r[2],i[3]=r[3],i},l.create=function(){var i=new so(16);return so!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=0,i[12]=0,i[13]=0,i[14]=0),i[0]=1,i[5]=1,i[10]=1,i[15]=1,i},l.create$1=NA,l.createExpression=kl,l.createLayout=Ie,l.createStyleLayer=function(i){return i.type==="custom"?new lL(i):new uL[i.type](i)},l.cross=Sx,l.degToRad=Fe,l.distance=function(i,r){return Math.hypot(r[0]-i[0],r[1]-i[1],r[2]-i[2])},l.div=function(i,r,o){return i[0]=r[0]/o[0],i[1]=r[1]/o[1],i[2]=r[2]/o[2],i},l.dot=ea,l.earthRadius=ef,l.ease=cr,l.easeCubicInOut=Dt,l.ecefToLatLng=function([i,r,o]){const c=Math.hypot(i,r,o),p=Math.atan2(i,o),m=.5*Math.PI-Math.acos(-r/c);return new Fr(Ve(p),Ve(m))},l.emitValidationErrors=L0,l.endsWith=mr,l.enforceCacheSizeLimit=function(i){Go(),jn&&jn.then(r=>{r.keys().then(o=>{for(let c=0;cm&&(c+=(i[p]-m)*(i[p]-m)),r[p]0){const G=180/c;UA($,$,[G/S+1,0,0,0,G/k+1,0,-.5*G/M,.5*G/O,1])}return $[2]=E,$[5]=i.x,$[8]=i.y,$},l.getImage=de,l.getJSON=function(i,r){return ya(nt(i,{type:"json"}),r)},l.getLatitudinalLod=function(i){const r=di-5;i=qe(i,-r,r)/r*90;const o=Math.pow(Math.abs(Math.sin(Fe(i))),3);return Math.round(o*(Yp.length-1))},l.getMapSessionAPI=Vn,l.getPerformanceMeasurement=qd,l.getProjection=kI,l.getRTLTextPluginStatus=b,l.getReferrer=Ho,l.getTilePoint=function(i,{x:r,y:o},c=0){return new xe(((r-c)*i.scale-i.x)*Ot,(o*i.scale-i.y)*Ot)},l.getTileVec3=function(i,r,o=0){return xh(((r.x-o)*i.scale-i.x)*Ot,(r.y*i.scale-i.y)*Ot,c2(r.z,r.y))},l.getVideo=function(i,r){const o=w.document.createElement("video");o.muted=!0,o.onloadstart=function(){r(null,o)};for(let c=0;c{}}},l.globeCenterToScreenPoint=function(i){const r=[0,0,0],o=Da(new Float64Array(16));return ru(o,i.pixelMatrix,i.globeMatrix),mn(r,r,o),new xe(r[0],r[1])},l.globeDenormalizeECEF=Dx,l.globeECEFOrigin=function(i,r){const o=[0,0,0];return mn(o,o,Jp(is(r.canonical))),mn(o,o,i),o},l.globeMetersToEcef=H0,l.globeNormalizeECEF=Jp,l.globePixelsToTileUnits=function(i,r){return Ot/(512*Math.pow(2,i))*Z0(is(r))},l.globePoleMatrixForTile=function(i,r,o){const c=Da(new Float64Array(16)),p=(r/(1<0;return c===0&&!p&&!y&&m},l.identity=Da,l.identity$1=KA,l.invert=xx,l.isFullscreen=function(){return!!w.document.fullscreenElement||!!w.document.webkitFullscreenElement},l.isLngLatBehindGlobe=Mx,l.isMapAuthenticated=function(i){return _i.has(i)},l.isMapboxURL=Ae,l.isSafariWithAntialiasingBug=function(i){const r=i.navigator?i.navigator.userAgent:null;return!!Nn(i)&&r&&(r.match("Version/15.4")||r.match("Version/15.5")||r.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/))},l.latFromMercatorY=hi,l.latLngToECEF=wh,l.len=o5,l.length=Gp,l.length$1=function(i){return Math.hypot(i[0],i[1],i[2],i[3])},l.lngFromMercatorX=Po,l.loadVectorTile=QI,l.makeRequest=ya,l.mapValue=function(i,r,o,c,p){return qe((i-r)/(o-r)*(p-c)+c,c,p)},l.mercatorScale=u2,l.mercatorXfromLng=os,l.mercatorYfromLat=as,l.mercatorZfromAltitude=za,l.mul=n5,l.mul$1=i5,l.multiply=ru,l.multiply$1=UA,l.multiply$2=WA,l.nextPowerOfTwo=Pr,l.normalize=Di,l.normalize$1=a5,l.normalize$2=qA,l.number=dr,l.ortho=function(i,r,o,c,p,m,y){var x=1/(r-o),E=1/(c-p),S=1/(m-y);return i[0]=-2*x,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=-2*E,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=2*S,i[11]=0,i[12]=(r+o)*x,i[13]=(p+c)*E,i[14]=(y+m)*S,i[15]=1,i},l.pbf=K2,l.perspective=function(i,r,o,c,p){var m,y=1/Math.tan(r/2);return i[0]=y/o,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=y,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=-1,i[12]=0,i[13]=0,i[15]=0,p!=null&&p!==1/0?(i[10]=(p+c)*(m=1/(c-p)),i[14]=2*p*c*m):(i[10]=-1,i[14]=-2*c),i},l.pick=function(i,r){const o={};for(let c=0;c0&&o[0]<=i.width&&o[1]>0&&o[1]<=i.height&&!Mx(i,new Fr(i.center.lat,90)),c[0]>0&&c[0]<=i.width&&c[1]>0&&c[1]<=i.height&&!Mx(i,new Fr(i.center.lat,-90))]},l.polygonContainsPoint=lu,l.polygonIntersectsBox=y2,l.polygonIntersectsPolygon=p2,l.polygonizeBounds=function(i,r,o=0,c=!0){const p=new xe(o,o),m=i.sub(p),y=r.add(p),x=[m,new xe(y.x,m.y),y,new xe(m.x,y.y)];return c&&x.push(m.clone()),x},l.posAttributes=Xp,l.postMapLoadEvent=yn,l.postPerformanceEvent=zn,l.postTurnstileEvent=or,l.potpack=e1,l.prevPowerOfTwo=function(i){return i<=1?1:Math.pow(2,Math.floor(Math.log(i)/Math.LN2))},l.radToDeg=Ve,l.refProperties=["type","source","source-layer","minzoom","maxzoom","filter","layout"],l.registerForPluginStateChange=function(i){return i({pluginStatus:f,pluginURL:s}),v.on("pluginStateChange",i),i},l.removeAuthState=function(i){_i.delete(i)},l.renderColorRamp=jx,l.resample=h2,l.rotateX=bx,l.rotateX$1=XA,l.rotateY=G0,l.rotateY$1=YA,l.rotateZ=function(i,r,o){var c=Math.sin(o),p=Math.cos(o),m=r[0],y=r[1],x=r[2],E=r[3],S=r[4],k=r[5],M=r[6],O=r[7];return r!==i&&(i[8]=r[8],i[9]=r[9],i[10]=r[10],i[11]=r[11],i[12]=r[12],i[13]=r[13],i[14]=r[14],i[15]=r[15]),i[0]=m*p+S*c,i[1]=y*p+k*c,i[2]=x*p+M*c,i[3]=E*p+O*c,i[4]=S*p-m*c,i[5]=k*p-y*c,i[6]=M*p-x*c,i[7]=O*p-E*c,i},l.rotateZ$1=function(i,r,o){o*=.5;var c=r[0],p=r[1],m=r[2],y=r[3],x=Math.sin(o),E=Math.cos(o);return i[0]=c*E+p*x,i[1]=p*E-c*x,i[2]=m*E+y*x,i[3]=y*E-m*x,i},l.scale=nu,l.scale$1=HA,l.scale$2=ko,l.scaleAndAdd=Zp,l.set=function(i,r,o,c){return i[0]=r,i[1]=o,i[2]=c,i},l.setCacheLimits=function(i,r){Ps=i,Eo=r},l.setColumn=function(i,r,o){i[4*r+0]=o[0],i[4*r+1]=o[1],i[4*r+2]=o[2],i[4*r+3]=o[3]},l.setRTLTextPlugin=function(i,r,o=!1){if(f===Np||f===Up||f===jp)throw new Error("setRTLTextPlugin cannot be called multiple times.");s=_a.resolveURL(i),f=Np,zl=r,g(),o||A()},l.smoothstep=Tt,l.spec=Ge,l.squaredLength=function(i){var r=i[0],o=i[1],c=i[2];return r*r+o*o+c*c},l.storeAuthState=function(i,r){r?_i.add(i):_i.delete(i)},l.sub=Ma,l.subtract=Ex,l.symbolSize=_F,l.tileAABB=function(i,r,o,c,p,m,y,x,E){if(E.name==="globe")return h5(i,r,new ag(o,c,p));const S=uu({z:o,x:c,y:p},E);return new Mi([(m+S.x/S.scale)*r,r*(S.y/S.scale),y],[(m+S.x2/S.scale)*r,r*(S.y2/S.scale),x])},l.tileCornersToBounds=q0,l.tileTransform=uu,l.transformMat3=function(i,r,o){var c=r[0],p=r[1],m=r[2];return i[0]=c*o[0]+p*o[3]+m*o[6],i[1]=c*o[1]+p*o[4]+m*o[7],i[2]=c*o[2]+p*o[5]+m*o[8],i},l.transformMat4=mn,l.transformMat4$1=iu,l.transformQuat=GA,l.transitionTileAABBinECEF=r2,l.translate=Wp,l.transpose=function(i,r){if(i===r){var o=r[1],c=r[2],p=r[5];i[1]=r[3],i[2]=r[6],i[3]=o,i[5]=r[7],i[6]=c,i[7]=p}else i[0]=r[0],i[1]=r[3],i[2]=r[6],i[3]=r[1],i[4]=r[4],i[5]=r[7],i[6]=r[2],i[7]=r[5],i[8]=r[8];return i},l.triggerPluginCompletionEvent=h,l.uniqueId=ur,l.updateGlobeVertexNormal=function(i,r,o,c,p){const m=5*r+2;i.float32[m+0]=o,i.float32[m+1]=c,i.float32[m+2]=p},l.validateCustomStyleLayer=function(i){const r=[],o=i.id;return o===void 0&&r.push({message:`layers.${o}: missing required property "id"`}),i.render===void 0&&r.push({message:`layers.${o}: missing required method "render"`}),i.renderingMode&&i.renderingMode!=="2d"&&i.renderingMode!=="3d"&&r.push({message:`layers.${o}: property "renderingMode" must be either "2d" or "3d"`}),r},l.validateFilter=i=>oo(Yc(i)),l.validateFog=i=>oo(R0(i)),l.validateLayer=i=>oo(P0(i)),l.validateLight=i=>oo(z0(i)),l.validateSource=i=>oo(M0(i)),l.validateStyle=F0,l.validateTerrain=i=>oo(Rp(i)),l.values=et,l.vectorTile=ng,l.version=T,l.warnOnce=Tr,l.window=w,l.wrap=gt}),d(["./shared"],function(l){function w(fe){if(typeof fe=="number"||typeof fe=="boolean"||typeof fe=="string"||fe==null)return JSON.stringify(fe);if(Array.isArray(fe)){let Y="[";for(const de of fe)Y+=`${w(de)},`;return`${Y}]`}let X="{";for(const Y of Object.keys(fe).sort())X+=`${Y}:${w(fe[Y])},`;return`${X}}`}function T(fe){let X="";for(const Y of l.refProperties)X+=`/${w(fe[Y])}`;return X}class C{constructor(X){this.keyCache={},X&&this.replace(X)}replace(X){this._layerConfigs={},this._layers={},this.update(X,[])}update(X,Y){for(const ve of X)this._layerConfigs[ve.id]=ve,(this._layers[ve.id]=l.createStyleLayer(ve)).compileFilter(),this.keyCache[ve.id]&&delete this.keyCache[ve.id];for(const ve of Y)delete this.keyCache[ve],delete this._layerConfigs[ve],delete this._layers[ve];this.familiesBySource={};const de=function(ve,Ae){const Pe={};for(let Te=0;Tethis._layers[mt.id]),Pe=Ae[0];if(Pe.visibility==="none")continue;const ke=Pe.source||"";let Te=this.familiesBySource[ke];Te||(Te=this.familiesBySource[ke]={});const Le=Pe.sourceLayer||"_geojsonTileLayer";let dt=Te[Le];dt||(dt=Te[Le]=[]),dt.push(Ae)}}}class P{loadTile(X,Y){const{uid:de,encoding:ve,rawImageData:Ae,padding:Pe,buildQuadTree:ke}=X,Te=l.window.ImageBitmap&&Ae instanceof l.window.ImageBitmap?this.getImageData(Ae,Pe):Ae;Y(null,new l.DEMData(de,Te,ve,Pe<1,ke))}getImageData(X,Y){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(X.width,X.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=X.width,this.offscreenCanvas.height=X.height,this.offscreenCanvasContext.drawImage(X,0,0,X.width,X.height);const de=this.offscreenCanvasContext.getImageData(-Y,-Y,X.width+2*Y,X.height+2*Y);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),de}}function z(fe,X){if(fe.length!==0){W(fe[0],X);for(var Y=1;Y=Math.abs(ke)?Y-Te+ke:ke-Te+Y,Y=Te}Y+de>=0!=!!X&&fe.reverse()}var U=l.getDefaultExportFromCjs(function fe(X,Y){var de,ve=X&&X.type;if(ve==="FeatureCollection")for(de=0;de>31}function kt(fe,X){for(var Y=fe.loadGeometry(),de=fe.type,ve=0,Ae=0,Pe=Y.length,ke=0;kefe},qe=Math.fround||(Tt=new Float32Array(1),fe=>(Tt[0]=+fe,Tt[0]));var Tt;const gt=3,je=5,et=6;class nt{constructor(X){this.options=Object.assign(Object.create(cr),X),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(X){const{log:Y,minZoom:de,maxZoom:ve}=this.options;Y&&console.time("total time");const Ae=`prepare ${X.length} points`;Y&&console.time(Ae),this.points=X;const Pe=[];for(let Te=0;Te=de;Te--){const Le=+Date.now();ke=this.trees[Te]=this._createTree(this._cluster(ke,Te)),Y&&console.log("z%d: %d clusters in %dms",Te,ke.numItems,+Date.now()-Le)}return Y&&console.timeEnd("total time"),this}getClusters(X,Y){let de=((X[0]+180)%360+360)%360-180;const ve=Math.max(-90,Math.min(90,X[1]));let Ae=X[2]===180?180:((X[2]+180)%360+360)%360-180;const Pe=Math.max(-90,Math.min(90,X[3]));if(X[2]-X[0]>=360)de=-180,Ae=180;else if(de>Ae){const mt=this.getClusters([de,ve,180,Pe],Y),ct=this.getClusters([-180,ve,Ae,Pe],Y);return mt.concat(ct)}const ke=this.trees[this._limitZoom(Y)],Te=ke.range(Xt(de),Pr(Pe),Xt(Ae),Pr(ve)),Le=ke.data,dt=[];for(const mt of Te){const ct=this.stride*mt;dt.push(Le[ct+je]>1?it(Le,ct,this.clusterProps):this.points[Le[ct+gt]])}return dt}getChildren(X){const Y=this._getOriginId(X),de=this._getOriginZoom(X),ve="No cluster with the specified id.",Ae=this.trees[de];if(!Ae)throw new Error(ve);const Pe=Ae.data;if(Y*this.stride>=Pe.length)throw new Error(ve);const ke=this.options.radius/(this.options.extent*Math.pow(2,de-1)),Te=Ae.within(Pe[Y*this.stride],Pe[Y*this.stride+1],ke),Le=[];for(const dt of Te){const mt=dt*this.stride;Pe[mt+4]===X&&Le.push(Pe[mt+je]>1?it(Pe,mt,this.clusterProps):this.points[Pe[mt+gt]])}if(Le.length===0)throw new Error(ve);return Le}getLeaves(X,Y,de){const ve=[];return this._appendLeaves(ve,X,Y=Y||10,de=de||0,0),ve}getTile(X,Y,de){const ve=this.trees[this._limitZoom(X)],Ae=Math.pow(2,X),{extent:Pe,radius:ke}=this.options,Te=ke/Pe,Le=(de-Te)/Ae,dt=(de+1+Te)/Ae,mt={features:[]};return this._addTileFeatures(ve.range((Y-Te)/Ae,Le,(Y+1+Te)/Ae,dt),ve.data,Y,de,Ae,mt),Y===0&&this._addTileFeatures(ve.range(1-Te/Ae,Le,1,dt),ve.data,Ae,de,Ae,mt),Y===Ae-1&&this._addTileFeatures(ve.range(0,Le,Te/Ae,dt),ve.data,-1,de,Ae,mt),mt.features.length?mt:null}getClusterExpansionZoom(X){let Y=this._getOriginZoom(X)-1;for(;Y<=this.options.maxZoom;){const de=this.getChildren(X);if(Y++,de.length!==1)break;X=de[0].properties.cluster_id}return Y}_appendLeaves(X,Y,de,ve,Ae){const Pe=this.getChildren(Y);for(const ke of Pe){const Te=ke.properties;if(Te&&Te.cluster?Ae+Te.point_count<=ve?Ae+=Te.point_count:Ae=this._appendLeaves(X,Te.cluster_id,de,ve,Ae):Ae1;let dt,mt,ct;if(Le)dt=ur(Y,Te,this.clusterProps),mt=Y[Te],ct=Y[Te+1];else{const Wt=this.points[Y[Te+gt]];dt=Wt.properties;const[Qt,or]=Wt.geometry.coordinates;mt=Xt(Qt),ct=Pr(or)}const Ft={type:1,geometry:[[Math.round(this.options.extent*(mt*Ae-de)),Math.round(this.options.extent*(ct*Ae-ve))]],tags:dt};let jt;jt=Le||this.options.generateId?Y[Te+gt]:this.points[Y[Te+gt]].id,jt!==void 0&&(Ft.id=jt),Pe.features.push(Ft)}}_limitZoom(X){return Math.max(this.options.minZoom,Math.min(Math.floor(+X),this.options.maxZoom+1))}_cluster(X,Y){const{radius:de,extent:ve,reduce:Ae,minPoints:Pe}=this.options,ke=de/(ve*Math.pow(2,Y)),Te=X.data,Le=[],dt=this.stride;for(let mt=0;mtY&&(Qt+=Te[en+je])}if(Qt>Wt&&Qt>=Pe){let or,en=ct*Wt,yn=Ft*Wt,li=-1;const zn=((mt/dt|0)<<5)+(Y+1)+this.points.length;for(const qo of jt){const Vn=qo*dt;if(Te[Vn+2]<=Y)continue;Te[Vn+2]=Y;const _i=Te[Vn+je];en+=Te[Vn]*_i,yn+=Te[Vn+1]*_i,Te[Vn+4]=zn,Ae&&(or||(or=this._map(Te,mt,!0),li=this.clusterProps.length,this.clusterProps.push(or)),Ae(or,this._map(Te,Vn)))}Te[mt+4]=zn,Le.push(en/Qt,yn/Qt,1/0,zn,-1,Qt),Ae&&Le.push(li)}else{for(let or=0;or1)for(const or of jt){const en=or*dt;if(!(Te[en+2]<=Y)){Te[en+2]=Y;for(let yn=0;yn>5}_getOriginZoom(X){return(X-this.points.length)%32}_map(X,Y,de){if(X[Y+je]>1){const Pe=this.clusterProps[X[Y+et]];return de?Object.assign({},Pe):Pe}const ve=this.points[X[Y+gt]].properties,Ae=this.options.map(ve);return de&&Ae===ve?Object.assign({},Ae):Ae}}function it(fe,X,Y){return{type:"Feature",id:fe[X+gt],properties:ur(fe,X,Y),geometry:{type:"Point",coordinates:[(de=fe[X],360*(de-.5)),Yt(fe[X+1])]}};var de}function ur(fe,X,Y){const de=fe[X+je],ve=de>=1e4?`${Math.round(de/1e3)}k`:de>=1e3?Math.round(de/100)/10+"k":de,Ae=fe[X+et],Pe=Ae===-1?{}:Object.assign({},Y[Ae]);return Object.assign(Pe,{cluster:!0,cluster_id:fe[X+gt],point_count:de,point_count_abbreviated:ve})}function Xt(fe){return fe/360+.5}function Pr(fe){const X=Math.sin(fe*Math.PI/180),Y=.5-.25*Math.log((1+X)/(1-X))/Math.PI;return Y<0?0:Y>1?1:Y}function Yt(fe){const X=(180-360*fe)*Math.PI/180;return 360*Math.atan(Math.exp(X))/Math.PI-90}function si(fe,X,Y,de){for(var ve,Ae=de,Pe=Y-X>>1,ke=Y-X,Te=fe[X],Le=fe[X+1],dt=fe[Y],mt=fe[Y+1],ct=X+3;ctAe)ve=ct,Ae=Ft;else if(Ft===Ae){var jt=Math.abs(ct-Pe);jtde&&(ve-X>3&&si(fe,X,ve,de),fe[ve+2]=Ae,Y-ve>3&&si(fe,ve,Y,de))}function mr(fe,X,Y,de,ve,Ae){var Pe=ve-Y,ke=Ae-de;if(Pe!==0||ke!==0){var Te=((fe-Y)*Pe+(X-de)*ke)/(Pe*Pe+ke*ke);Te>1?(Y=ve,de=Ae):Te>0&&(Y+=Pe*Te,de+=ke*Te)}return(Pe=fe-Y)*Pe+(ke=X-de)*ke}function Vt(fe,X,Y,de){var ve={id:fe===void 0?null:fe,type:X,geometry:Y,tags:de,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(Ae){var Pe=Ae.geometry,ke=Ae.type;if(ke==="Point"||ke==="MultiPoint"||ke==="LineString")Ii(Ae,Pe);else if(ke==="Polygon"||ke==="MultiLineString")for(var Te=0;Te0&&(Pe+=de?(ve*Le-Te*Ae)/2:Math.sqrt(Math.pow(Te-ve,2)+Math.pow(Le-Ae,2))),ve=Te,Ae=Le}var dt=X.length-3;X[2]=1,si(X,0,dt,Y),X[dt+2]=1,X.size=Math.abs(Pe),X.start=0,X.end=X.size}function Bn(fe,X,Y,de){for(var ve=0;ve1?1:Y}function Yn(fe,X,Y,de,ve,Ae,Pe,ke){if(de/=X,Ae>=(Y/=X)&&Pe=de)return null;for(var Te=[],Le=0;Le=Y&&jt=de)){var Wt=[];if(ct==="Point"||ct==="MultiPoint")bo(mt,Wt,Y,de,ve);else if(ct==="LineString")Nn(mt,Wt,Y,de,ve,!1,ke.lineMetrics);else if(ct==="MultiLineString")Qn(mt,Wt,Y,de,ve,!1);else if(ct==="Polygon")Qn(mt,Wt,Y,de,ve,!0);else if(ct==="MultiPolygon")for(var Qt=0;Qt=Y&&Pe<=de&&(X.push(fe[Ae]),X.push(fe[Ae+1]),X.push(fe[Ae+2]))}}function Nn(fe,X,Y,de,ve,Ae,Pe){for(var ke,Te,Le=Un(fe),dt=ve===0?Ps:Eo,mt=fe.start,ct=0;ctY&&(Te=dt(Le,Ft,jt,Qt,or,Y),Pe&&(Le.start=mt+ke*Te)):en>de?yn=Y&&(Te=dt(Le,Ft,jt,Qt,or,Y),li=!0),yn>de&&en<=de&&(Te=dt(Le,Ft,jt,Qt,or,de),li=!0),!Ae&&li&&(Pe&&(Le.end=mt+ke*Te),X.push(Le),Le=Un(fe)),Pe&&(mt+=ke)}var zn=fe.length-3;Ft=fe[zn],jt=fe[zn+1],Wt=fe[zn+2],(en=ve===0?Ft:jt)>=Y&&en<=de&&wo(Le,Ft,jt,Wt),zn=Le.length-3,Ae&&zn>=3&&(Le[zn]!==Le[0]||Le[zn+1]!==Le[1])&&wo(Le,Le[0],Le[1],Le[2]),Le.length&&X.push(Le)}function Un(fe){var X=[];return X.size=fe.size,X.start=fe.start,X.end=fe.end,X}function Qn(fe,X,Y,de,ve,Ae){for(var Pe=0;PePe.maxX&&(Pe.maxX=dt),mt>Pe.maxY&&(Pe.maxY=mt)}return Pe}function So(fe,X,Y,de){var ve=X.geometry,Ae=X.type,Pe=[];if(Ae==="Point"||Ae==="MultiPoint")for(var ke=0;ke0&&X.size<(ve?Pe:de))Y.numPoints+=X.length/3;else{for(var ke=[],Te=0;TePe)&&(Y.numSimplified++,ke.push(X[Te]),ke.push(X[Te+1])),Y.numPoints++;ve&&function(Le,dt){for(var mt=0,ct=0,Ft=Le.length,jt=Ft-2;ct0===dt)for(ct=0,Ft=Le.length;ct24)throw new Error("maxZoom should be in the 0-24 range");if(X.promoteId&&X.generateId)throw new Error("promoteId and generateId cannot be used together.");var de=function(ve,Ae){var Pe=[];if(ve.type==="FeatureCollection")for(var ke=0;ke1&&console.time("creation"),ct=this.tiles[mt]=Hi(fe,X,Y,de,Te),this.tileCoords.push({z:X,x:Y,y:de}),Le)){Le>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",X,Y,de,ct.numFeatures,ct.numPoints,ct.numSimplified),console.timeEnd("creation"));var Ft="z"+X;this.stats[Ft]=(this.stats[Ft]||0)+1,this.total++}if(ct.source=fe,ve){if(X===Te.maxZoom||X===ve)continue;var jt=1<1&&console.time("clipping");var Wt,Qt,or,en,yn,li,zn=.5*Te.buffer/Te.extent,qo=.5-zn,Vn=.5+zn,_i=1+zn;Wt=Qt=or=en=null,yn=Yn(fe,dt,Y-zn,Y+Vn,0,ct.minX,ct.maxX,Te),li=Yn(fe,dt,Y+qo,Y+_i,0,ct.minX,ct.maxX,Te),fe=null,yn&&(Wt=Yn(yn,dt,de-zn,de+Vn,1,ct.minY,ct.maxY,Te),Qt=Yn(yn,dt,de+qo,de+_i,1,ct.minY,ct.maxY,Te),yn=null),li&&(or=Yn(li,dt,de-zn,de+Vn,1,ct.minY,ct.maxY,Te),en=Yn(li,dt,de+qo,de+_i,1,ct.minY,ct.maxY,Te),li=null),Le>1&&console.timeEnd("clipping"),ke.push(Wt||[],X+1,2*Y,2*de),ke.push(Qt||[],X+1,2*Y,2*de+1),ke.push(or||[],X+1,2*Y+1,2*de),ke.push(en||[],X+1,2*Y+1,2*de+1)}}},To.prototype.getTile=function(fe,X,Y){var de=this.options,ve=de.extent,Ae=de.debug;if(fe<0||fe>24)return null;var Pe=1<1&&console.log("drilling down to z%d-%d-%d",fe,X,Y);for(var Te,Le=fe,dt=X,mt=Y;!Te&&Le>0;)Le--,dt=Math.floor(dt/2),mt=Math.floor(mt/2),Te=this.tiles[Ho(Le,dt,mt)];return Te&&Te.source?(Ae>1&&console.log("found parent tile z%d-%d-%d",Le,dt,mt),Ae>1&&console.time("drilling down"),this.splitTile(Te.source,Le,dt,mt,fe,X,Y),Ae>1&&console.timeEnd("drilling down"),this.tiles[ke]?Qa(this.tiles[ke],ve):null):null};class Ja extends l.VectorTileWorkerSource{constructor(X,Y,de,ve,Ae){super(X,Y,de,ve,ya),Ae&&(this.loadGeoJSON=Ae)}loadData(X,Y){const de=X&&X.request,ve=de&&de.collectResourceTiming;this.loadGeoJSON(X,(Ae,Pe)=>{if(Ae||!Pe)return Y(Ae);if(typeof Pe!="object")return Y(new Error(`Input data given to '${X.source}' is not a valid GeoJSON object.`));{U(Pe,!0);try{if(X.filter){const Te=l.createExpression(X.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(Te.result==="error")throw new Error(Te.value.map(dt=>`${dt.key}: ${dt.message}`).join(", "));Pe={type:"FeatureCollection",features:Pe.features.filter(dt=>Te.value.evaluate({zoom:0},dt))}}this._geoJSONIndex=X.cluster?new nt(function({superclusterOptions:Te,clusterProperties:Le}){if(!Le||!Te)return Te;const dt={},mt={},ct={accumulated:null,zoom:0},Ft={properties:null},jt=Object.keys(Le);for(const Wt of jt){const[Qt,or]=Le[Wt],en=l.createExpression(or),yn=l.createExpression(typeof Qt=="string"?[Qt,["accumulated"],["get",Wt]]:Qt);dt[Wt]=en.value,mt[Wt]=yn.value}return Te.map=Wt=>{Ft.properties=Wt;const Qt={};for(const or of jt)Qt[or]=dt[or].evaluate(ct,Ft);return Qt},Te.reduce=(Wt,Qt)=>{Ft.properties=Qt;for(const or of jt)ct.accumulated=Wt[or],Wt[or]=mt[or].evaluate(ct,Ft)},Te}(X)).load(Pe.features):function(Te,Le){return new To(Te,Le)}(Pe,X.geojsonVtOptions)}catch(Te){return Y(Te)}this.loaded={};const ke={};if(ve){const Te=l.getPerformanceMeasurement(de);Te&&(ke.resourceTiming={},ke.resourceTiming[X.source]=JSON.parse(JSON.stringify(Te)))}Y(null,ke)}})}reloadTile(X,Y){const de=this.loaded;return de&&de[X.uid]?super.reloadTile(X,Y):this.loadTile(X,Y)}loadGeoJSON(X,Y){if(X.request)l.getJSON(X.request,Y);else{if(typeof X.data!="string")return Y(new Error(`Input data given to '${X.source}' is not a valid GeoJSON object.`));try{return Y(null,JSON.parse(X.data))}catch{return Y(new Error(`Input data given to '${X.source}' is not a valid GeoJSON object.`))}}}getClusterExpansionZoom(X,Y){try{Y(null,this._geoJSONIndex.getClusterExpansionZoom(X.clusterId))}catch(de){Y(de)}}getClusterChildren(X,Y){try{Y(null,this._geoJSONIndex.getChildren(X.clusterId))}catch(de){Y(de)}}getClusterLeaves(X,Y){try{Y(null,this._geoJSONIndex.getLeaves(X.clusterId,X.limit,X.offset))}catch(de){Y(de)}}}class Ds{constructor(X){this.self=X,this.actor=new l.Actor(X,this),this.layerIndexes={},this.availableImages={},this.isSpriteLoaded={},this.projections={},this.defaultProjection=l.getProjection({name:"mercator"}),this.workerSourceTypes={vector:l.VectorTileWorkerSource,geojson:Ja},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(Y,de)=>{if(this.workerSourceTypes[Y])throw new Error(`Worker source with name "${Y}" already registered.`);this.workerSourceTypes[Y]=de},this.self.registerRTLTextPlugin=Y=>{if(l.plugin.isParsed())throw new Error("RTL text plugin already registered.");l.plugin.applyArabicShaping=Y.applyArabicShaping,l.plugin.processBidirectionalText=Y.processBidirectionalText,l.plugin.processStyledBidirectionalText=Y.processStyledBidirectionalText}}clearCaches(X,Y,de){delete this.layerIndexes[X],delete this.availableImages[X],delete this.workerSources[X],delete this.demWorkerSources[X],de()}checkIfReady(X,Y,de){de()}setReferrer(X,Y){this.referrer=Y}spriteLoaded(X,Y){this.isSpriteLoaded[X]=Y;for(const de in this.workerSources[X]){const ve=this.workerSources[X][de];for(const Ae in ve)ve[Ae]instanceof l.VectorTileWorkerSource&&(ve[Ae].isSpriteLoaded=Y,ve[Ae].fire(new l.Event("isSpriteLoaded")))}}setImages(X,Y,de){this.availableImages[X]=Y;for(const ve in this.workerSources[X]){const Ae=this.workerSources[X][ve];for(const Pe in Ae)Ae[Pe].availableImages=Y}de()}enableTerrain(X,Y,de){this.terrain=Y,de()}setProjection(X,Y){this.projections[X]=l.getProjection(Y)}setLayers(X,Y,de){this.getLayerIndex(X).replace(Y),de()}updateLayers(X,Y,de){this.getLayerIndex(X).update(Y.layers,Y.removedIds),de()}loadTile(X,Y,de){const ve=this.enableTerrain?l.extend({enableTerrain:this.terrain},Y):Y;ve.projection=this.projections[X]||this.defaultProjection,this.getWorkerSource(X,Y.type,Y.source).loadTile(ve,de)}loadDEMTile(X,Y,de){const ve=this.enableTerrain?l.extend({buildQuadTree:this.terrain},Y):Y;this.getDEMWorkerSource(X,Y.source).loadTile(ve,de)}reloadTile(X,Y,de){const ve=this.enableTerrain?l.extend({enableTerrain:this.terrain},Y):Y;ve.projection=this.projections[X]||this.defaultProjection,this.getWorkerSource(X,Y.type,Y.source).reloadTile(ve,de)}abortTile(X,Y,de){this.getWorkerSource(X,Y.type,Y.source).abortTile(Y,de)}removeTile(X,Y,de){this.getWorkerSource(X,Y.type,Y.source).removeTile(Y,de)}removeSource(X,Y,de){if(!this.workerSources[X]||!this.workerSources[X][Y.type]||!this.workerSources[X][Y.type][Y.source])return;const ve=this.workerSources[X][Y.type][Y.source];delete this.workerSources[X][Y.type][Y.source],ve.removeSource!==void 0?ve.removeSource(Y,de):de()}loadWorkerSource(X,Y,de){try{this.self.importScripts(Y.url),de()}catch(ve){de(ve.toString())}}syncRTLPluginState(X,Y,de){try{l.plugin.setState(Y);const ve=l.plugin.getPluginURL();if(l.plugin.isLoaded()&&!l.plugin.isParsed()&&ve!=null){this.self.importScripts(ve);const Ae=l.plugin.isParsed();de(Ae?void 0:new Error(`RTL Text Plugin failed to import scripts from ${ve}`),Ae)}}catch(ve){de(ve.toString())}}getAvailableImages(X){let Y=this.availableImages[X];return Y||(Y=[]),Y}getLayerIndex(X){let Y=this.layerIndexes[X];return Y||(Y=this.layerIndexes[X]=new C),Y}getWorkerSource(X,Y,de){if(this.workerSources[X]||(this.workerSources[X]={}),this.workerSources[X][Y]||(this.workerSources[X][Y]={}),!this.workerSources[X][Y][de]){const ve={send:(Ae,Pe,ke,Te,Le,dt)=>{this.actor.send(Ae,Pe,ke,X,Le,dt)},scheduler:this.actor.scheduler};this.workerSources[X][Y][de]=new this.workerSourceTypes[Y](ve,this.getLayerIndex(X),this.getAvailableImages(X),this.isSpriteLoaded[X])}return this.workerSources[X][Y][de]}getDEMWorkerSource(X,Y){return this.demWorkerSources[X]||(this.demWorkerSources[X]={}),this.demWorkerSources[X][Y]||(this.demWorkerSources[X][Y]=new P),this.demWorkerSources[X][Y]}enforceCacheSizeLimit(X,Y){l.enforceCacheSizeLimit(Y)}getWorkerPerformanceMetrics(X,Y,de){de(void 0,void 0)}}return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope&&(self.worker=new Ds(self)),Ds}),d(["./shared"],function(l){function w(f,s){if(Array.isArray(f)){if(!Array.isArray(s)||f.length!==s.length)return!1;for(let h=0;h"u"||typeof document>"u"?"not a browser":Array.prototype&&Array.prototype.every&&Array.prototype.filter&&Array.prototype.forEach&&Array.prototype.indexOf&&Array.prototype.lastIndexOf&&Array.prototype.map&&Array.prototype.some&&Array.prototype.reduce&&Array.prototype.reduceRight&&Array.isArray?Function.prototype&&Function.prototype.bind?Object.keys&&Object.create&&Object.getPrototypeOf&&Object.getOwnPropertyNames&&Object.isSealed&&Object.isFrozen&&Object.isExtensible&&Object.getOwnPropertyDescriptor&&Object.defineProperty&&Object.defineProperties&&Object.seal&&Object.freeze&&Object.preventExtensions?"JSON"in window&&"parse"in JSON&&"stringify"in JSON?function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var g,v,b=new Blob([""],{type:"text/javascript"}),A=URL.createObjectURL(b);try{v=new Worker(A),g=!0}catch{g=!1}return v&&v.terminate(),URL.revokeObjectURL(A),g}()?"Uint8ClampedArray"in window?ArrayBuffer.isView?function(){var g=document.createElement("canvas");g.width=g.height=1;var v=g.getContext("2d");if(!v)return!1;var b=v.getImageData(0,0,1,1);return b&&b.width===g.width}()?(P[h=s&&s.failIfMajorPerformanceCaveat]===void 0&&(P[h]=function(g){var v,b=function(A){var I=document.createElement("canvas"),D=Object.create(C.webGLContextAttributes);return D.failIfMajorPerformanceCaveat=A,I.getContext("webgl",D)||I.getContext("experimental-webgl",D)}(g);if(!b)return!1;try{v=b.createShader(b.VERTEX_SHADER)}catch{return!1}return!(!v||b.isContextLost())&&(b.shaderSource(v,"void main() {}"),b.compileShader(v),b.getShaderParameter(v,b.COMPILE_STATUS)===!0)}(h)),P[h]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL support"):"insufficient Canvas/getImageData support":"insufficient ArrayBuffer support":"insufficient Uint8ClampedArray support":"insufficient worker support":"insufficient JSON support":"insufficient Object support":"insufficient Function support":"insufficent Array support";var h}(f)}var P={};function z(f,s,h){const g=l.window.document.createElement(f);return s!==void 0&&(g.className=s),h&&h.appendChild(g),g}function W(f,s,h){const g=l.window.document.createElementNS("http://www.w3.org/2000/svg",f);for(const v of Object.keys(s))g.setAttributeNS(null,v,s[v]);return h&&h.appendChild(g),g}C.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0};const U=l.window.document&&l.window.document.documentElement.style,j=U&&U.userSelect!==void 0?"userSelect":"WebkitUserSelect";let L;function V(){U&&j&&(L=U[j],U[j]="none")}function R(){U&&j&&(U[j]=L)}function F(f){f.preventDefault(),f.stopPropagation(),l.window.removeEventListener("click",F,!0)}function H(){l.window.addEventListener("click",F,!0),l.window.setTimeout(()=>{l.window.removeEventListener("click",F,!0)},0)}function Q(f,s){const h=f.getBoundingClientRect();return ge(f,h,s)}function te(f,s){const h=f.getBoundingClientRect(),g=[];for(let v=0;v=0?0:f.button}function ge(f,s,h){const g=f.offsetWidth===s.width?1:f.offsetWidth/s.width;return new l.Point((h.clientX-s.left)*g,(h.clientY-s.top)*g)}function xe(f,s){var h=s[0],g=s[1],v=s[2],b=s[3],A=h*b-v*g;return A?(f[0]=b*(A=1/A),f[1]=-g*A,f[2]=-v*A,f[3]=h*A,f):null}function Ee(f){const{userImage:s}=f;return!!(s&&s.render&&s.render())&&(f.data.replace(new Uint8Array(s.data.buffer)),!0)}class Be extends l.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new l.RGBAImage({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(s){if(this.loaded!==s&&(this.loaded=s,s)){for(const{ids:h,callback:g}of this.requestors)this._notify(h,g);this.requestors=[]}}hasImage(s){return!!this.getImage(s)}getImage(s){return this.images[s]}addImage(s,h){this._validate(s,h)&&(this.images[s]=h)}_validate(s,h){let g=!0;return this._validateStretch(h.stretchX,h.data&&h.data.width)||(this.fire(new l.ErrorEvent(new Error(`Image "${s}" has invalid "stretchX" value`))),g=!1),this._validateStretch(h.stretchY,h.data&&h.data.height)||(this.fire(new l.ErrorEvent(new Error(`Image "${s}" has invalid "stretchY" value`))),g=!1),this._validateContent(h.content,h)||(this.fire(new l.ErrorEvent(new Error(`Image "${s}" has invalid "content" value`))),g=!1),g}_validateStretch(s,h){if(!s)return!0;let g=0;for(const v of s){if(v[0]{this.ready=!0})}broadcast(s,h,g){l.asyncAll(this.actors,(v,b)=>{v.send(s,h,b)},g=g||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(s=>{s.remove()}),this.actors=[],this.workerPool.release(this.id)}}function je(f,s,h){return s*(l.EXTENT/(f.tileSize*Math.pow(2,h-f.tileID.overscaledZ)))}gt.Actor=l.Actor;class et{constructor(s,h,g,v){this.screenBounds=s,this.cameraPoint=h,this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=g,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,v)}static createFromScreenPoints(s,h){let g,v;if(s instanceof l.Point||typeof s[0]=="number"){const b=l.Point.convert(s);g=[b],v=h.isPointAboveHorizon(b)}else{const b=l.Point.convert(s[0]),A=l.Point.convert(s[1]);g=[b,A],v=l.polygonizeBounds(b,A).every(I=>h.isPointAboveHorizon(I))}return new et(g,h.getCameraPoint(),v,h)}isPointQuery(){return this.screenBounds.length===1}bufferedScreenGeometry(s){return l.polygonizeBounds(this.screenBounds[0],this.screenBounds.length===1?this.screenBounds[0]:this.screenBounds[1],s)}bufferedCameraGeometry(s){const h=this.screenBounds[0],g=this.screenBounds.length===1?this.screenBounds[0].add(new l.Point(1,1)):this.screenBounds[1],v=l.polygonizeBounds(h,g,0,!1);return this.cameraPoint.y>g.y&&(this.cameraPoint.x>h.x&&this.cameraPoint.x=g.x?v[2]=this.cameraPoint:this.cameraPoint.x<=h.x&&(v[3]=this.cameraPoint)),l.bufferConvexPolygon(v,s)}bufferedCameraGeometryGlobe(s){const h=this.screenBounds[0],g=this.screenBounds.length===1?this.screenBounds[0].add(new l.Point(1,1)):this.screenBounds[1],v=l.polygonizeBounds(h,g,s),b=this.cameraPoint.clone();switch(3*((b.y>h.y)+(b.y>g.y))+((b.x>h.x)+(b.x>g.x))){case 0:v[0]=b,v[4]=b.clone();break;case 1:v.splice(1,0,b);break;case 2:v[1]=b;break;case 3:v.splice(4,0,b);break;case 5:v.splice(2,0,b);break;case 6:v[3]=b;break;case 7:v.splice(3,0,b);break;case 8:v[2]=b}return v}containsTile(s,h,g,v=0){const b=s.queryPadding/h._pixelsPerMercatorPixel+1,A=g?this._bufferedCameraMercator(b,h):this._bufferedScreenMercator(b,h);let I=s.tileID.wrap+(A.unwrapped?v:0);const D=A.polygon.map(ae=>l.getTilePoint(s.tileTransform,ae,I));if(!l.polygonIntersectsBox(D,0,0,l.EXTENT,l.EXTENT))return;I=s.tileID.wrap+(this.screenGeometryMercator.unwrapped?v:0);const N=this.screenGeometryMercator.polygon.map(ae=>l.getTileVec3(s.tileTransform,ae,I)),B=N.map(ae=>new l.Point(ae[0],ae[1])),q=h.getFreeCameraOptions().position||new l.MercatorCoordinate(0,0,0),J=l.getTileVec3(s.tileTransform,q,I),ne=N.map(ae=>{const Z=l.sub(ae,ae,J);return l.normalize(Z,Z),new l.Ray(J,Z)}),oe=je(s,1,h.zoom)*h._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:B,tilespaceRays:ne,bufferedTilespaceGeometry:D,bufferedTilespaceBounds:(ie=l.getBounds(D),ie.min.x=l.clamp(ie.min.x,0,l.EXTENT),ie.min.y=l.clamp(ie.min.y,0,l.EXTENT),ie.max.x=l.clamp(ie.max.x,0,l.EXTENT),ie.max.y=l.clamp(ie.max.y,0,l.EXTENT),ie),tile:s,tileID:s.tileID,pixelToTileUnitsFactor:oe};var ie}_bufferedScreenMercator(s,h){const g=ur(s);if(this._screenRaycastCache[g])return this._screenRaycastCache[g];{let v;return v=h.projection.name==="globe"?this._projectAndResample(this.bufferedScreenGeometry(s),h):{polygon:this.bufferedScreenGeometry(s).map(b=>h.pointCoordinate3D(b)),unwrapped:!0},this._screenRaycastCache[g]=v,v}}_bufferedCameraMercator(s,h){const g=ur(s);if(this._cameraRaycastCache[g])return this._cameraRaycastCache[g];{let v;return v=h.projection.name==="globe"?this._projectAndResample(this.bufferedCameraGeometryGlobe(s),h):{polygon:this.bufferedCameraGeometry(s).map(b=>h.pointCoordinate3D(b)),unwrapped:!0},this._cameraRaycastCache[g]=v,v}}_projectAndResample(s,h){const g=function(b,A){const I=l.multiply([],A.pixelMatrix,A.globeMatrix),D=[0,-l.GLOBE_RADIUS,0,1],N=[0,l.GLOBE_RADIUS,0,1],B=[0,0,0,1];l.transformMat4$1(D,D,I),l.transformMat4$1(N,N,I),l.transformMat4$1(B,B,I);const q=new l.Point(D[0]/D[3],D[1]/D[3]),J=new l.Point(N[0]/N[3],N[1]/N[3]),ne=l.polygonContainsPoint(b,q)&&D[3]1?nt(b.slice(0,ae),A):[],ue=aenew l.Point(it(we.x),we.y)),ue=ue.map(we=>new l.Point(it(we.x),we.y));const he=[...re];he.length===0&&he.push(ue[ue.length-1]);const be=l.number(he[he.length-1].y,(ue.length===0?re[0]:ue[0]).y,Z);let Se;return Se=ne?[new l.Point(0,be),new l.Point(0,0),new l.Point(1,0),new l.Point(1,be)]:[new l.Point(1,be),new l.Point(1,1),new l.Point(0,1),new l.Point(0,be)],he.push(...Se),ue.length===0?he.push(re[0]):he.push(...ue),{polygon:he.map(we=>new l.MercatorCoordinate(we.x,we.y)),unwrapped:!1}}(s,h);if(g)return g;const v=function(b,A){let I=!1,D=-1/0,N=0;for(let q=0;qD&&(D=b[q].x,N=q);for(let q=0;q.5&&(ne.x{q.x-=1}),{polygon:b,unwrapped:I}}(nt(s,h).map(b=>new l.Point(it(b.x),b.y)),h);return{polygon:v.polygon.map(b=>new l.MercatorCoordinate(b.x,b.y)),unwrapped:v.unwrapped}}}function nt(f,s){return l.resample(f,h=>{const g=s.pointCoordinate3D(h);h.x=g.x,h.y=g.y},1/256)}function it(f){return f<0?1+f%1:f%1}function ur(f){return 100*f|0}function Xt(f,s,h,g,v){const b=function(A,I){if(A)return v(A);if(I){f.url&&I.tiles&&f.tiles&&delete f.tiles;const D=l.pick(l.extend(I,f),["tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","scheme","tileSize","encoding"]);I.vector_layers&&(D.vectorLayers=I.vector_layers,D.vectorLayerIds=D.vectorLayers.map(N=>N.id)),D.tiles=s.canonicalizeTileset(D,f.url),v(null,D)}};return f.url?l.getJSON(s.transformRequest(s.normalizeSourceURL(f.url,null,h,g),l.ResourceType.Source),b):l.exported.frame(()=>b(null,f))}class Pr{constructor(s,h,g){this.bounds=l.LngLatBounds.convert(this.validateBounds(s)),this.minzoom=h||0,this.maxzoom=g||24}validateBounds(s){return Array.isArray(s)&&s.length===4?[Math.max(-180,s[0]),Math.max(-90,s[1]),Math.min(180,s[2]),Math.min(90,s[3])]:[-180,-90,180,90]}contains(s){const h=Math.pow(2,s.z),g=Math.floor(l.mercatorXfromLng(this.bounds.getWest())*h),v=Math.floor(l.mercatorYfromLat(this.bounds.getNorth())*h),b=Math.ceil(l.mercatorXfromLng(this.bounds.getEast())*h),A=Math.ceil(l.mercatorYfromLat(this.bounds.getSouth())*h);return s.x>=g&&s.x=v&&s.y{this._tileJSONRequest=null,this._loaded=!0,v?(h&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${h}`),g&&g.length!==2&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${g}`),this.fire(new l.ErrorEvent(v))):b&&(l.extend(this,b),b.bounds&&(this.tileBounds=new Pr(b.bounds,this.minzoom,this.maxzoom)),l.postTurnstileEvent(b.tiles,this.map._requestManager._customAccessToken),this.fire(new l.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new l.Event("data",{dataType:"source",sourceDataType:"content"}))),s&&s(v)})}loaded(){return this._loaded}hasTile(s){return!this.tileBounds||this.tileBounds.contains(s.canonical)}onAdd(s){this.map=s,this.load()}reload(){this.cancelTileJSONRequest(),this.load(()=>this.map.style._clearSource(this.id))}setTiles(s){return this._options.tiles=s,this.reload(),this}setUrl(s){return this.url=s,this._options.url=s,this.reload(),this}onRemove(){this.cancelTileJSONRequest()}serialize(){return l.extend({},this._options)}loadTile(s,h){const g=this.map._requestManager.normalizeTileURL(s.tileID.canonical.url(this.tiles,this.scheme)),v={request:this.map._requestManager.transformRequest(g,l.ResourceType.Tile),data:void 0,uid:s.uid,tileID:s.tileID,tileZoom:s.tileZoom,zoom:s.tileID.overscaledZ,tileSize:this.tileSize*s.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:l.exported.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:s.isSymbolTile};if(v.request.collectResourceTiming=this._collectResourceTiming,s.actor&&s.state!=="expired")s.state==="loading"?s.reloadCallback=h:s.request=s.actor.send("reloadTile",v,b.bind(this));else if(s.actor=this._tileWorkers[g]=this._tileWorkers[g]||this.dispatcher.getActor(),this.dispatcher.ready)s.request=s.actor.send("loadTile",v,b.bind(this),void 0,!0);else{const A=l.loadVectorTile.call({deduped:this._deduped},v,(I,D)=>{I||!D?b.call(this,I):(v.data={cacheControl:D.cacheControl,expires:D.expires,rawData:D.rawData.slice(0)},s.actor&&s.actor.send("loadTile",v,b.bind(this),void 0,!0))},!0);s.request={cancel:A}}function b(A,I){return delete s.request,s.aborted?h(null):A&&A.status!==404?h(A):(I&&I.resourceTiming&&(s.resourceTiming=I.resourceTiming),this.map._refreshExpiredTiles&&I&&s.setExpiryData(I),s.loadVectorData(I,this.map.painter),l.cacheEntryPossiblyAdded(this.dispatcher),h(null),void(s.reloadCallback&&(this.loadTile(s,s.reloadCallback),s.reloadCallback=null)))}}abortTile(s){s.request&&(s.request.cancel(),delete s.request),s.actor&&s.actor.send("abortTile",{uid:s.uid,type:this.type,source:this.id})}unloadTile(s){s.unloadVectorData(),s.actor&&s.actor.send("removeTile",{uid:s.uid,type:this.type,source:this.id})}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class ct extends l.Evented{constructor(s,h,g,v){super(),this.id=s,this.dispatcher=g,this.setEventedParent(v),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=l.extend({type:"raster"},h),l.extend(this,l.pick(h,["url","scheme","tileSize"]))}load(s){this._loaded=!1,this.fire(new l.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=Xt(this._options,this.map._requestManager,null,null,(h,g)=>{this._tileJSONRequest=null,this._loaded=!0,h?this.fire(new l.ErrorEvent(h)):g&&(l.extend(this,g),g.bounds&&(this.tileBounds=new Pr(g.bounds,this.minzoom,this.maxzoom)),l.postTurnstileEvent(g.tiles),this.fire(new l.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new l.Event("data",{dataType:"source",sourceDataType:"content"}))),s&&s(h)})}loaded(){return this._loaded}onAdd(s){this.map=s,this.load()}reload(){this.cancelTileJSONRequest(),this.load(()=>this.map.style._clearSource(this.id))}setTiles(s){return this._options.tiles=s,this.reload(),this}setUrl(s){return this.url=s,this._options.url=s,this.reload(),this}onRemove(){this.cancelTileJSONRequest()}serialize(){return l.extend({},this._options)}hasTile(s){return!this.tileBounds||this.tileBounds.contains(s.canonical)}loadTile(s,h){const g=l.exported.devicePixelRatio>=2,v=this.map._requestManager.normalizeTileURL(s.tileID.canonical.url(this.tiles,this.scheme),g,this.tileSize);s.request=l.getImage(this.map._requestManager.transformRequest(v,l.ResourceType.Tile),(b,A,I,D)=>(delete s.request,s.aborted?(s.state="unloaded",h(null)):b?(s.state="errored",h(b)):A?(this.map._refreshExpiredTiles&&s.setExpiryData({cacheControl:I,expires:D}),s.setTexture(A,this.map.painter),s.state="loaded",l.cacheEntryPossiblyAdded(this.dispatcher),void h(null)):h(null)))}static loadTileData(s,h,g){s.setTexture(h,g)}static unloadTileData(s,h){s.texture&&h.saveTileTexture(s.texture)}abortTile(s,h){s.request&&(s.request.cancel(),delete s.request),h()}unloadTile(s,h){s.texture&&this.map.painter.saveTileTexture(s.texture),h()}hasTransition(){return!1}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}function Ft(f,s,h,g,v,b,A,I){const D=[f,h,v,s,g,b,1,1,1],N=[A,I,1],B=l.adjoint([],D),[q,J,ne]=l.transformMat3(N,N,l.transpose(B,B));return l.multiply$1(D,[q,0,0,0,J,0,0,0,ne],D)}class jt extends l.Evented{constructor(s,h,g,v){super(),this.id=s,this.dispatcher=g,this.coordinates=h.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(v),this.options=h,this._dirty=!1}load(s,h){this._loaded=h||!1,this.fire(new l.Event("dataloading",{dataType:"source"})),this.url=this.options.url,this._imageRequest=l.getImage(this.map._requestManager.transformRequest(this.url,l.ResourceType.Image),(g,v)=>{if(this._imageRequest=null,this._loaded=!0,g)this.fire(new l.ErrorEvent(g));else if(v){const{HTMLImageElement:b}=l.window;this.image=v instanceof b?l.exported.getImageData(v):v,this._dirty=!0,this.width=this.image.width,this.height=this.image.height,s&&(this.coordinates=s),this._finishLoading()}})}loaded(){return this._loaded}updateImage(s){return this.image&&s.url?(this._imageRequest&&s.url!==this.options.url&&(this._imageRequest.cancel(),this._imageRequest=null),this.options.url=s.url,this.load(s.coordinates,this._loaded),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new l.Event("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(s){this.map=s,this.load()}onRemove(){this._imageRequest&&(this._imageRequest.cancel(),this._imageRequest=null),this.texture&&this.texture.destroy()}setCoordinates(s){this.coordinates=s,this._boundsArray=void 0;const h=s.map(l.MercatorCoordinate.fromLngLat);return this.tileID=function(g){let v=1/0,b=1/0,A=-1/0,I=-1/0;for(const q of g)v=Math.min(v,q.x),b=Math.min(b,q.y),A=Math.max(A,q.x),I=Math.max(I,q.y);const D=Math.max(A-v,I-b),N=Math.max(0,Math.floor(-Math.log(D)/Math.LN2)),B=Math.pow(2,N);return new l.CanonicalTileID(N,Math.floor((v+A)/2*B),Math.floor((b+I)/2*B))}(h),this.minzoom=this.maxzoom=this.tileID.z,this.fire(new l.Event("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){this._boundsArray=void 0}_prepareData(s){for(const D in this.tiles){const N=this.tiles[D];N.state!=="loaded"&&(N.state="loaded",N.texture=this.texture)}if(this._boundsArray)return;const h=l.tileTransform(this.tileID,this.map.transform.projection),[g,v,b,A]=this.coordinates.map(D=>{const N=h.projection.project(D[0],D[1]);return l.getTilePoint(h,N)._round()});this.perspectiveTransform=function(D,N,B,q,J,ne,oe,ie,ae,Z){const re=Ft(0,0,D,0,0,N,D,N),ue=Ft(B,q,J,ne,oe,ie,ae,Z);return l.multiply$1(ue,l.adjoint(re,re),ue),[ue[6]/ue[8]*D/l.EXTENT,ue[7]/ue[8]*N/l.EXTENT]}(this.width,this.height,g.x,g.y,v.x,v.y,A.x,A.y,b.x,b.y);const I=this._boundsArray=new l.StructArrayLayout4i8;I.emplaceBack(g.x,g.y,0,0),I.emplaceBack(v.x,v.y,l.EXTENT,0),I.emplaceBack(A.x,A.y,0,l.EXTENT),I.emplaceBack(b.x,b.y,l.EXTENT,l.EXTENT),this.boundsBuffer&&this.boundsBuffer.destroy(),this.boundsBuffer=s.createVertexBuffer(I,l.boundsAttributes.members),this.boundsSegments=l.SegmentVector.simpleSegment(0,0,4,2)}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const s=this.map.painter.context,h=s.gl;this._dirty&&(this.texture?this.texture.update(this.image):(this.texture=new l.Texture(s,this.image,h.RGBA),this.texture.bind(h.LINEAR,h.CLAMP_TO_EDGE)),this._dirty=!1),this._prepareData(s)}loadTile(s,h){this.tileID&&this.tileID.equals(s.tileID.canonical)?(this.tiles[String(s.tileID.wrap)]=s,s.buckets={},h(null)):(s.state="errored",h(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}const Wt={vector:mt,raster:ct,"raster-dem":class extends ct{constructor(f,s,h,g){super(f,s,h,g),this.type="raster-dem",this.maxzoom=22,this._options=l.extend({type:"raster-dem"},s),this.encoding=s.encoding||"mapbox"}loadTile(f,s){const h=this.map._requestManager.normalizeTileURL(f.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function g(v,b){v&&(f.state="errored",s(v)),b&&(f.dem=b,f.dem.onDeserialize(),f.needsHillshadePrepare=!0,f.needsDEMTextureUpload=!0,f.state="loaded",s(null))}f.request=l.getImage(this.map._requestManager.transformRequest(h,l.ResourceType.Tile),(function(v,b,A,I){if(delete f.request,f.aborted)f.state="unloaded",s(null);else if(v)f.state="errored",s(v);else if(b){this.map._refreshExpiredTiles&&f.setExpiryData({cacheControl:A,expires:I});const D=l.window.ImageBitmap&&b instanceof l.window.ImageBitmap&&(Hi==null&&(Hi=l.window.OffscreenCanvas&&new l.window.OffscreenCanvas(1,1).getContext("2d")&&typeof l.window.createImageBitmap=="function"),Hi),N=1-(b.width-l.prevPowerOfTwo(b.width))/2;N<1||f.neighboringTiles||(f.neighboringTiles=this._getNeighboringTiles(f.tileID));const B=D?b:l.exported.getImageData(b,N),q={uid:f.uid,coord:f.tileID,source:this.id,rawImageData:B,encoding:this.encoding,padding:N};f.actor&&f.state!=="expired"||(f.actor=this.dispatcher.getActor(),f.actor.send("loadDEMTile",q,g.bind(this),void 0,!0))}}).bind(this))}_getNeighboringTiles(f){const s=f.canonical,h=Math.pow(2,s.z),g=(s.x-1+h)%h,v=s.x===0?f.wrap-1:f.wrap,b=(s.x+1+h)%h,A=s.x+1===h?f.wrap+1:f.wrap,I={};return I[new l.OverscaledTileID(f.overscaledZ,v,s.z,g,s.y).key]={backfilled:!1},I[new l.OverscaledTileID(f.overscaledZ,A,s.z,b,s.y).key]={backfilled:!1},s.y>0&&(I[new l.OverscaledTileID(f.overscaledZ,v,s.z,g,s.y-1).key]={backfilled:!1},I[new l.OverscaledTileID(f.overscaledZ,f.wrap,s.z,s.x,s.y-1).key]={backfilled:!1},I[new l.OverscaledTileID(f.overscaledZ,A,s.z,b,s.y-1).key]={backfilled:!1}),s.y+1{if(this._loaded=!0,this._pendingLoad=null,h)this.fire(new l.ErrorEvent(h));else{const v={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&g&&g.resourceTiming&&g.resourceTiming[this.id]&&(v.resourceTiming=g.resourceTiming[this.id]),this.fire(new l.Event("data",v)),this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(),this._coalesce=!1)})}loaded(){return this._loaded}loadTile(f,s){const h=f.actor?"reloadTile":"loadTile";f.actor=this.actor,f.request=this.actor.send(h,{type:this.type,uid:f.uid,tileID:f.tileID,tileZoom:f.tileZoom,zoom:f.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:l.exported.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId},(g,v)=>(delete f.request,f.unloadVectorData(),f.aborted?s(null):g?s(g):(f.loadVectorData(v,this.map.painter,h==="reloadTile"),s(null))),void 0,h==="loadTile")}abortTile(f){f.request&&(f.request.cancel(),delete f.request),f.aborted=!0}unloadTile(f){f.unloadVectorData(),this.actor.send("removeTile",{uid:f.uid,type:this.type,source:this.id})}onRemove(){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return l.extend({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends jt{constructor(f,s,h,g){super(f,s,h,g),this.roundZoom=!0,this.type="video",this.options=s}load(){this._loaded=!1;const f=this.options;this.urls=[];for(const s of f.urls)this.urls.push(this.map._requestManager.transformRequest(s,l.ResourceType.Source).url);l.getVideo(this.urls,(s,h)=>{this._loaded=!0,s?this.fire(new l.ErrorEvent(s)):h&&(this.video=h,this.video.loop=!0,this.video.setAttribute("playsinline",""),this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(f){if(this.video){const s=this.video.seekable;fs.end(0)?this.fire(new l.ErrorEvent(new l.ValidationError(`sources.${this.id}`,null,`Playback for this video can be set only between the ${s.start(0)} and ${s.end(0)}-second mark.`))):this.video.currentTime=f}}getVideo(){return this.video}onAdd(f){this.map||(this.map=f,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 f=this.map.painter.context,s=f.gl;this.texture?this.video.paused||(this.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE),s.texSubImage2D(s.TEXTURE_2D,0,0,0,s.RGBA,s.UNSIGNED_BYTE,this.video)):(this.texture=new l.Texture(f,this.video,s.RGBA),this.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(f)}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:jt,canvas:class extends jt{constructor(f,s,h,g){super(f,s,h,g),s.coordinates?Array.isArray(s.coordinates)&&s.coordinates.length===4&&!s.coordinates.some(v=>!Array.isArray(v)||v.length!==2||v.some(b=>typeof b!="number"))||this.fire(new l.ErrorEvent(new l.ValidationError(`sources.${f}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new l.ErrorEvent(new l.ValidationError(`sources.${f}`,null,'missing required property "coordinates"'))),s.animate&&typeof s.animate!="boolean"&&this.fire(new l.ErrorEvent(new l.ValidationError(`sources.${f}`,null,'optional "animate" property must be a boolean value'))),s.canvas?typeof s.canvas=="string"||s.canvas instanceof l.window.HTMLCanvasElement||this.fire(new l.ErrorEvent(new l.ValidationError(`sources.${f}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new l.ErrorEvent(new l.ValidationError(`sources.${f}`,null,'missing required property "canvas"'))),this.options=s,this.animate=s.animate===void 0||s.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof l.window.HTMLCanvasElement?this.options.canvas:l.window.document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new l.ErrorEvent(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(f){this.map=f,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let f=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,f=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,f=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const s=this.map.painter.context;this.texture?(f||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new l.Texture(s,this.canvas,s.gl.RGBA,{premultiply:!0}),this._prepareData(s)}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const f of[this.canvas.width,this.canvas.height])if(isNaN(f)||f<=0)return!0;return!1}},custom:class extends l.Evented{constructor(f,s,h,g){super(),this.id=f,this.type="custom",this._dataType="raster",this._dispatcher=h,this._implementation=s,this.setEventedParent(g),this.scheme="xyz",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this._loaded=!1,this.roundZoom=!0,this._implementation||this.fire(new l.ErrorEvent(new Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new l.ErrorEvent(new Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new Pr(this._implementation.bounds,this.minzoom,this.maxzoom)),s.update=this._update.bind(this),s.clearTiles=this._clearTiles.bind(this),s.coveringTiles=this._coveringTiles.bind(this),l.extend(this,l.pick(s,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"]))}serialize(){return l.pick(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new l.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new l.Event("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(f){this._map=f,this._loaded=!1,this.fire(new l.Event("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(f),this.load()}onRemove(f){this._implementation.onRemove&&this._implementation.onRemove(f)}hasTile(f){if(this._implementation.hasTile){const{x:s,y:h,z:g}=f.canonical;return this._implementation.hasTile({x:s,y:h,z:g})}return!this.tileBounds||this.tileBounds.contains(f.canonical)}loadTile(f,s){const{x:h,y:g,z:v}=f.tileID.canonical,b=new l.window.AbortController;f.request=Promise.resolve(this._implementation.loadTile({x:h,y:g,z:v},{signal:b.signal})).then((function(A){return delete f.request,f.aborted?(f.state="unloaded",s(null)):A===void 0?(f.state="errored",s(null)):A===null?(this.loadTileData(f,{width:this.tileSize,height:this.tileSize,data:null}),f.state="loaded",s(null)):function(I){return I instanceof l.window.ImageData||I instanceof l.window.HTMLCanvasElement||I instanceof l.window.ImageBitmap||I instanceof l.window.HTMLImageElement}(A)?(this.loadTileData(f,A),f.state="loaded",void s(null)):(f.state="errored",s(new Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`)))}).bind(this)).catch(A=>{A.code!==20&&(f.state="errored",s(A))}),f.request.cancel=()=>b.abort()}loadTileData(f,s){ct.loadTileData(f,s,this._map.painter)}unloadTileData(f){ct.unloadTileData(f,this._map.painter)}unloadTile(f,s){if(this.unloadTileData(f),this._implementation.unloadTile){const{x:h,y:g,z:v}=f.tileID.canonical;this._implementation.unloadTile({x:h,y:g,z:v})}s()}abortTile(f,s){f.request&&f.request.cancel&&(f.request.cancel(),delete f.request),s()}hasTransition(){return!1}_coveringTiles(){return this._map.transform.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,roundZoom:this.roundZoom}).map(f=>({x:f.canonical.x,y:f.canonical.y,z:f.canonical.z}))}_clearTiles(){this._map.style._clearSource(this.id)}_update(){this.fire(new l.Event("data",{dataType:"source",sourceDataType:"content"}))}}},Qt=function(f,s,h,g){const v=new Wt[s.type](f,s,h,g);if(v.id!==f)throw new Error(`Expected Source id to be ${f} instead of ${v.id}`);return l.bindAll(["load","abort","unload","serialize","prepare"],v),v};function or(f,s){const h=l.identity([]);return l.scale(h,h,[.5*f.width,.5*-f.height,1]),l.translate(h,h,[1,-1,0]),l.multiply(h,h,f.calculateProjMatrix(s.toUnwrapped())),Float32Array.from(h)}function en(f,s,h,g,v,b,A,I=!1){const D=f.tilesIn(g,A,I);D.sort(li);const N=[];for(const q of D)N.push({wrappedTileID:q.tile.tileID.wrapped().key,queryResults:q.tile.queryRenderedFeatures(s,h,f._state,q,v,b,or(f.transform,q.tile.tileID),I)});const B=function(q){const J={},ne={};for(const oe of q){const ie=oe.queryResults,ae=oe.wrappedTileID,Z=ne[ae]=ne[ae]||{};for(const re in ie){const ue=ie[re],he=Z[re]=Z[re]||{},be=J[re]=J[re]||[];for(const Se of ue)he[Se.featureIndex]||(he[Se.featureIndex]=!0,be.push(Se))}}return J}(N);for(const q in B)B[q].forEach(J=>{const ne=J.feature,oe=ne.layer;oe&&oe.type!=="background"&&oe.type!=="sky"&&(ne.source=oe.source,oe["source-layer"]&&(ne.sourceLayer=oe["source-layer"]),ne.state=ne.id!==void 0?f.getFeatureState(oe["source-layer"],ne.id):{})});return B}function yn(f,s){const h=f.getRenderableIds().map(b=>f.getTileByID(b)),g=[],v={};for(let b=0;b{h.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[qo]}numActive(){return Object.keys(this.active).length}}let _i;function ml(){return _i||(_i=new Vn),_i}function Zv(f,s){const h={};for(const g in f)g!=="ref"&&(h[g]=f[g]);return l.refProperties.forEach(g=>{g in s&&(h[g]=s[g])}),h}function e0(f){f=f.slice();const s=Object.create(null);for(let h=0;h0?(v-A)/I:0;return this.points[b].mult(1-D).add(this.points[h].mult(D))}}class Ms{constructor(s,h,g){const v=this.boxCells=[],b=this.circleCells=[];this.xCellCount=Math.ceil(s/g),this.yCellCount=Math.ceil(h/g);for(let A=0;Athis.width||v<0||h>this.height)return!b&&[];const I=[];if(s<=0&&h<=0&&this.width<=g&&this.height<=v){if(b)return!0;for(let D=0;D0:I}_queryCircle(s,h,g,v,b){const A=s-g,I=s+g,D=h-g,N=h+g;if(I<0||A>this.width||N<0||D>this.height)return!v&&[];const B=[];return this._forEachCell(A,D,I,N,this._queryCellCircle,B,{hitTest:v,circle:{x:s,y:h,radius:g},seenUids:{box:{},circle:{}}},b),v?B.length>0:B}query(s,h,g,v,b){return this._query(s,h,g,v,!1,b)}hitTest(s,h,g,v,b){return this._query(s,h,g,v,!0,b)}hitTestCircle(s,h,g,v){return this._queryCircle(s,h,g,!0,v)}_queryCell(s,h,g,v,b,A,I,D){const N=I.seenUids,B=this.boxCells[b];if(B!==null){const J=this.bboxes;for(const ne of B)if(!N.box[ne]){N.box[ne]=!0;const oe=4*ne;if(s<=J[oe+2]&&h<=J[oe+3]&&g>=J[oe+0]&&v>=J[oe+1]&&(!D||D(this.boxKeys[ne]))){if(I.hitTest)return A.push(!0),!0;A.push({key:this.boxKeys[ne],x1:J[oe],y1:J[oe+1],x2:J[oe+2],y2:J[oe+3]})}}}const q=this.circleCells[b];if(q!==null){const J=this.circles;for(const ne of q)if(!N.circle[ne]){N.circle[ne]=!0;const oe=3*ne;if(this._circleAndRectCollide(J[oe],J[oe+1],J[oe+2],s,h,g,v)&&(!D||D(this.circleKeys[ne]))){if(I.hitTest)return A.push(!0),!0;{const ie=J[oe],ae=J[oe+1],Z=J[oe+2];A.push({key:this.circleKeys[ne],x1:ie-Z,y1:ae-Z,x2:ie+Z,y2:ae+Z})}}}}}_queryCellCircle(s,h,g,v,b,A,I,D){const N=I.circle,B=I.seenUids,q=this.boxCells[b];if(q!==null){const ne=this.bboxes;for(const oe of q)if(!B.box[oe]){B.box[oe]=!0;const ie=4*oe;if(this._circleAndRectCollide(N.x,N.y,N.radius,ne[ie+0],ne[ie+1],ne[ie+2],ne[ie+3])&&(!D||D(this.boxKeys[oe])))return A.push(!0),!0}}const J=this.circleCells[b];if(J!==null){const ne=this.circles;for(const oe of J)if(!B.circle[oe]){B.circle[oe]=!0;const ie=3*oe;if(this._circlesCollide(ne[ie],ne[ie+1],ne[ie+2],N.x,N.y,N.radius)&&(!D||D(this.circleKeys[oe])))return A.push(!0),!0}}}_forEachCell(s,h,g,v,b,A,I,D){const N=this._convertToXCellCoord(s),B=this._convertToYCellCoord(h),q=this._convertToXCellCoord(g),J=this._convertToYCellCoord(v);for(let ne=N;ne<=q;ne++)for(let oe=B;oe<=J;oe++)if(b.call(this,s,h,g,v,this.xCellCount*oe+ne,A,I,D))return}_convertToXCellCoord(s){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(s*this.xScale)))}_convertToYCellCoord(s){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(s*this.yScale)))}_circlesCollide(s,h,g,v,b,A){const I=v-s,D=b-h,N=g+A;return N*N>I*I+D*D}_circleAndRectCollide(s,h,g,v,b,A,I){const D=(A-v)/2,N=Math.abs(s-(v+D));if(N>D+g)return!1;const B=(I-b)/2,q=Math.abs(h-(b+B));if(q>B+g)return!1;if(N<=D||q<=B)return!0;const J=N-D,ne=q-B;return J*J+ne*ne<=g*g}}const va={unknown:0,flipRequired:1,flipNotRequired:2},Cc=Math.tan(85*Math.PI/180);function Ge(f,s,h,g,v,b,A){const I=l.create();if(h)if(b.name==="globe"){const D=l.calculateGlobeLabelMatrix(v,s);l.multiply(I,I,D)}else{const D=xe([],A);I[0]=D[0],I[1]=D[1],I[4]=D[2],I[5]=D[3],g||l.rotateZ(I,I,v.angle)}else l.multiply(I,v.labelPlaneMatrix,f);return I}function xa(f,s,h,g,v,b,A){const I=Ge(f,s,h,g,v,b,A);return b.name==="globe"&&h||(I[2]=I[6]=I[10]=I[14]=0),I}function _n(f,s,h,g,v,b,A){if(h){if(b.name==="globe"){const I=Ge(f,s,h,g,v,b,A);return l.invert(I,I),l.multiply(I,f,I),I}{const I=l.clone(f),D=l.identity([]);return D[0]=A[0],D[1]=A[1],D[4]=A[2],D[5]=A[3],l.multiply(I,I,D),g||l.rotateZ(I,I,-v.angle),I}}return v.glCoordMatrix}function $n(f,s,h,g){const v=[f,s,h,1];h?l.transformMat4$1(v,v,g):rr(v,v,g);const b=v[3];return v[0]/=b,v[1]/=b,v[2]/=b,v}function t0(f,s){return Math.min(.5+f/s*.5,1.5)}function Ko(f,s){const h=f[0]/f[3],g=f[1]/f[3];return h>=-s[0]&&h<=s[0]&&g>=-s[1]&&g<=s[1]}function Yd(f,s,h,g,v,b,A,I,D,N){const B=h.transform,q=g?f.textSizeData:f.iconSizeData,J=l.evaluateSizeForZoom(q,h.transform.zoom),ne=B.projection.name==="globe",oe=[256/h.width*2+1,256/h.height*2+1],ie=g?f.text.dynamicLayoutVertexArray:f.icon.dynamicLayoutVertexArray;ie.clear();let ae=null;ne&&(ae=g?f.text.globeExtVertexArray:f.icon.globeExtVertexArray);const Z=f.lineVertexArray,re=g?f.text.placedSymbolArray:f.icon.placedSymbolArray,ue=h.transform.width/h.transform.height;let he,be=!1;for(let Se=0;SeMath.abs(h)?{useVertical:!0}:f===l.WritingMode.vertical?g>0?{needsFlipping:!0}:null:s!==va.unknown&&function(v,b){return v===0||Math.abs(b/v)>Cc}(h,g)?s===va.flipRequired?{needsFlipping:!0}:null:h<0?{needsFlipping:!0}:null}function bt(f,s,h,g,v,b,A,I,D,N,B,q,J,ne,oe,ie,ae,Z,re){const ue=s/24,he=f.lineOffsetX*ue,be=f.lineOffsetY*ue,{lineStartIndex:Se,glyphStartIndex:we,numGlyphs:Ce,segment:Ie,writingMode:Re,flipState:st}=f,De=Se+f.lineLength,Ke=Ne=>{if(B){const[ut,tt,ht]=Ne.up,Mt=N.length;l.updateGlobeVertexNormal(B,Mt+0,ut,tt,ht),l.updateGlobeVertexNormal(B,Mt+1,ut,tt,ht),l.updateGlobeVertexNormal(B,Mt+2,ut,tt,ht),l.updateGlobeVertexNormal(B,Mt+3,ut,tt,ht)}const[at,ze,Ze]=Ne.point;l.addDynamicAttributes(N,at,ze,Ze,Ne.angle)};if(Ce>1){const Ne=r0(ue,I,he,be,h,q,J,f,D,b,ne,ie,!1,ae,Z,re);if(!Ne)return{notEnoughRoom:!0};if(g&&!h){let[at,ze,Ze]=Ne.first.point,[ut,tt,ht]=Ne.last.point;[at,ze]=$n(at,ze,Ze,A),[ut,tt]=$n(ut,tt,ht,A);const Mt=gl(Re,st,(ut-at)*oe,tt-ze);if(f.flipState=Mt&&Mt.needsFlipping?va.flipRequired:va.flipNotRequired,Mt)return Mt}Ke(Ne.first);for(let at=we+1;at0?ut:tr(J,Ze,at,1,v,void 0,ae,Z.canonical),ht=gl(Re,st,(tt[0]-at[0])*oe,tt[1]-at[1]);if(f.flipState=ht&&ht.needsFlipping?va.flipRequired:va.flipNotRequired,ht)return ht}const Ne=qi(ue*I.getoffsetX(we),he,be,h,q,J,Ie,Se,De,D,b,ne,ie,!1,!1,ae,Z,re);if(!Ne)return{notEnoughRoom:!0};Ke(Ne)}return{}}function ir(f,s,h,g,v){const{x:b,y:A,z:I}=g.projectTilePoint(f.x,f.y,s);if(!v)return $n(b,A,I,h);const[D,N,B]=v(f);return $n(b+D,A+N,I+B,h)}function tr(f,s,h,g,v,b,A,I){const D=ir(f.sub(s)._unit()._add(f),I,v,A,b);return l.sub(D,h,D),l.normalize(D,D),l.scaleAndAdd(D,h,D,g)}function qi(f,s,h,g,v,b,A,I,D,N,B,q,J,ne,oe,ie,ae,Z){const re=g?f-s:f+s;let ue=re>0?1:-1,he=0;g&&(ue*=-1,he=Math.PI),ue<0&&(he+=Math.PI);let be=I+A+(ue>0?0:1)|0,Se=v,we=v,Ce=0,Ie=0;const Re=Math.abs(re),st=[],De=[];let Ke=b,Ne=Ke;const at=()=>tr(Ne,Ke,we,Re-Ce+1,B,J,ie,ae.canonical);for(;Ce+Ie<=Re;){if(be+=ue,be=D)return null;if(we=Se,Ne=Ke,st.push(we),ne&&De.push(Ne),Ke=new l.Point(N.getx(be),N.gety(be)),Se=q[be],!Se){const Lt=ir(Ke,ae.canonical,B,ie,J);Se=Lt[3]>0?q[be]=Lt:at()}Ce+=Ie,Ie=l.distance(we,Se)}oe&&J&&(q[be]&&(Se=at(),Ie=l.distance(we,Se)),q[be]=Se);const ze=(Re-Ce)/Ie,Ze=Ke.sub(Ne)._mult(ze)._add(Ne),ut=l.sub([],Se,we),tt=l.scaleAndAdd([],we,ut,ze);let ht=[0,0,1],Mt=ut[0],$t=ut[1];if(Z&&(ht=ie.upVector(ae.canonical,Ze.x,Ze.y),ht[0]!==0||ht[1]!==0||ht[2]!==1)){const Lt=[ht[2],0,-ht[0]],nr=l.cross([],ht,Lt);l.normalize(Lt,Lt),l.normalize(nr,nr),Mt=l.dot(ut,Lt),$t=l.dot(ut,nr)}if(h){const Lt=l.cross([],ht,ut);l.normalize(Lt,Lt),l.scaleAndAdd(tt,tt,Lt,h*ue)}const It=he+Math.atan2($t,Mt);return st.push(tt),ne&&De.push(Ze),{point:tt,angle:It,path:st,tilePath:De,up:ht}}function Ao(f,s){const h=s.length,g=h+4*f;s.resize(g),s.float32.fill(-1/0,4*h,4*g)}function rr(f,s,h){const g=s[0],v=s[1];return f[0]=h[0]*g+h[4]*v+h[12],f[1]=h[1]*g+h[5]*v+h[13],f[3]=h[3]*g+h[7]*v+h[15],f}const Zi=100;class kc{constructor(s,h,g=new Ms(s.width+200,s.height+200,25),v=new Ms(s.width+200,s.height+200,25)){this.transform=s,this.grid=g,this.ignoredGrid=v,this.pitchfactor=Math.cos(s._pitch)*s.cameraToCenterDistance,this.screenRightBoundary=s.width+Zi,this.screenBottomBoundary=s.height+Zi,this.gridRightBoundary=s.width+200,this.gridBottomBoundary=s.height+200,this.fogState=h}placeCollisionBox(s,h,g,v,b,A,I,D){let N=g.projectedAnchorX,B=g.projectedAnchorY,q=g.projectedAnchorZ;const J=g.elevation,ne=g.tileID,oe=s.getProjection();if(J&&ne){const[Se,we,Ce]=oe.upVector(ne.canonical,g.tileAnchorX,g.tileAnchorY),Ie=oe.upVectorScale(ne.canonical,this.transform.center.lat,this.transform.worldSize).metersToTile;N+=Se*J*Ie,B+=we*J*Ie,q+=Ce*J*Ie}const ie=this.projectAndGetPerspectiveRatio(I,N,B,q,g.tileID,oe.name==="globe"||!!J||this.transform.pitch>0,oe),ae=A*ie.perspectiveRatio,Z=(g.x1*h+v.x-g.padding)*ae+ie.point.x,re=(g.y1*h+v.y-g.padding)*ae+ie.point.y,ue=(g.x2*h+v.x+g.padding)*ae+ie.point.x,he=(g.y2*h+v.y+g.padding)*ae+ie.point.y,be=ie.perspectiveRatio<=.55||ie.occluded;return!this.isInsideGrid(Z,re,ue,he)||!b&&this.grid.hitTest(Z,re,ue,he,D)||be?{box:[],offscreen:!1,occluded:ie.occluded}:{box:[Z,re,ue,he],offscreen:this.isOffscreen(Z,re,ue,he),occluded:!1}}placeCollisionCircles(s,h,g,v,b,A,I,D,N,B,q,J,ne,oe,ie){const ae=[],Z=this.transform.elevation,re=s.getProjection(),ue=Z?Z.getAtTileOffsetFunc(ie,this.transform.center.lat,this.transform.worldSize,re):null,he=new l.Point(g.tileAnchorX,g.tileAnchorY);let{x:be,y:Se,z:we}=re.projectTilePoint(he.x,he.y,ie.canonical);if(ue){const[Ze,ut,tt]=ue(he);be+=Ze,Se+=ut,we+=tt}const Ce=re.name==="globe",Ie=this.projectAndGetPerspectiveRatio(I,be,Se,we,ie,Ce||!!Z||this.transform.pitch>0,re),{perspectiveRatio:Re}=Ie,st=(q?A/Re:A*Re)/l.ONE_EM,De=$n(be,Se,we,D),Ke=Ie.signedDistanceFromCamera>0?r0(st,b,g.lineOffsetX*st,g.lineOffsetY*st,!1,De,he,g,v,D,{},Z&&!q?ue:null,q&&!!Z,re,ie,q):null;let Ne=!1,at=!1,ze=!0;if(Ke&&!Ie.occluded){const Ze=.5*ne*Re+oe,ut=new l.Point(-100,-100),tt=new l.Point(this.screenRightBoundary,this.screenBottomBoundary),ht=new Xd,{first:Mt,last:$t}=Ke,It=Mt.path.length;let Lt=[];for(let Pt=It-1;Pt>=1;Pt--)Lt.push(Mt.path[Pt]);for(let Pt=1;Pt<$t.path.length;Pt++)Lt.push($t.path[Pt]);const nr=2.5*Ze;N&&(Lt=Lt.map(([Pt,Ar,Mr],zr)=>(ue&&!Ce&&(Mr=ue(zrPt[3]<=0)&&(Lt=[]));let er=[];if(Lt.length>0){let Pt=1/0,Ar=-1/0,Mr=1/0,zr=-1/0;for(const Rr of Lt)Pt=Math.min(Pt,Rr[0]),Mr=Math.min(Mr,Rr[1]),Ar=Math.max(Ar,Rr[0]),zr=Math.max(zr,Rr[1]);Ar>=ut.x&&Pt<=tt.x&&zr>=ut.y&&Mr<=tt.y&&(er=[Lt.map(Rr=>new l.Point(Rr[0],Rr[1]))],(Pttt.x||Mrtt.y)&&(er=l.clipLine(er,ut.x,ut.y,tt.x,tt.y)))}for(const Pt of er){ht.reset(Pt,.25*Ze);let Ar=0;Ar=ht.length<=.5*Ze?1:Math.ceil(ht.paddedLength/nr)+1;for(let Mr=0;Mr0?(l.transformMat4$1(D,D,s),this.fogState&&b&&I.name!=="globe"&&(N=function(J,ne,oe,ie,ae,Z){const re=Z.calculateFogTileMatrix(ae),ue=[ne,oe,ie];return l.transformMat4(ue,ue,re),Ut(J,ue,Z.pitch,Z._fov)}(this.fogState,h,g,v,b.toUnwrapped(),this.transform)>.9)):rr(D,D,s);const B=D[3];return{point:new l.Point((D[0]/B+1)/2*this.transform.width+Zi,(-D[1]/B+1)/2*this.transform.height+Zi),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(I)/B*.5,1.5),signedDistanceFromCamera:B,occluded:A&&D[2]>B||N}}isOffscreen(s,h,g,v){return g=this.screenRightBoundary||vthis.screenBottomBoundary}isInsideGrid(s,h,g,v){return g>=0&&s=0&&hg.collisionGroupID===h}}return this.collisionGroups[s]}}function Mc(f,s,h,g,v){const{horizontalAlign:b,verticalAlign:A}=l.getAnchorAlignment(f),I=-(b-.5)*s,D=-(A-.5)*h,N=l.evaluateVariableOffset(f,g);return new l.Point(I+N[0]*v,D+N[1]*v)}function zc(f,s,h,g,v){const b=new l.Point(f,s);return h&&b._rotate(g?v:-v),b}class Wu{constructor(s,h,g,v,b){this.transform=s.clone(),this.projection=s.projection.name,this.collisionIndex=new kc(this.transform,b),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=h,this.retainedQueryData={},this.collisionGroups=new i0(g),this.collisionCircleArrays={},this.prevPlacement=v,v&&(v.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(s,h,g,v){const b=g.getBucket(h),A=g.latestFeatureIndex;if(!b||!A||h.id!==b.layerIds[0])return;const I=b.layers[0].layout,D=g.collisionBoxArray,N=Math.pow(2,this.transform.zoom-g.tileID.overscaledZ),B=g.tileSize/l.EXTENT,q=g.tileID.toUnwrapped();this.transform.setProjection(b.projection);const J=(ne=g.tileID,oe=b.getProjection(),ie=this.transform,oe.name===this.projection?ie.calculateProjMatrix(ne.toUnwrapped()):zs(ie,oe,ne));var ne,oe,ie;const ae=I.get("text-pitch-alignment")==="map",Z=I.get("text-rotation-alignment")==="map";h.compileFilter();const re=h.dynamicFilter(),ue=h.dynamicFilterNeedsFeature(),he=this.transform.calculatePixelsToTileUnitsMatrix(g),be=xa(J,g.tileID.canonical,ae,Z,this.transform,b.getProjection(),he);let Se=null;if(ae){const Ie=_n(J,g.tileID.canonical,ae,Z,this.transform,b.getProjection(),he);Se=l.multiply([],this.transform.labelPlaneMatrix,Ie)}let we=null;re&&g.latestFeatureIndex&&(we={unwrappedTileID:q,dynamicFilter:re,dynamicFilterNeedsFeature:ue,featureIndex:g.latestFeatureIndex}),this.retainedQueryData[b.bucketInstanceId]=new Qd(b.bucketInstanceId,A,b.sourceLayerIndex,b.index,g.tileID);const Ce={bucket:b,layout:I,posMatrix:J,textLabelPlaneMatrix:be,labelToScreenMatrix:Se,clippingData:we,scale:N,textPixelRatio:B,holdingForFade:g.holdingForFade(),collisionBoxArray:D,partiallyEvaluatedTextSize:l.evaluateSizeForZoom(b.textSizeData,this.transform.zoom),partiallyEvaluatedIconSize:l.evaluateSizeForZoom(b.iconSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(b.sourceID)};if(v)for(const Ie of b.sortKeyRanges){const{sortKey:Re,symbolInstanceStart:st,symbolInstanceEnd:De}=Ie;s.push({sortKey:Re,symbolInstanceStart:st,symbolInstanceEnd:De,parameters:Ce})}else s.push({symbolInstanceStart:0,symbolInstanceEnd:b.symbolInstances.length,parameters:Ce})}attemptAnchorPlacement(s,h,g,v,b,A,I,D,N,B,q,J,ne,oe,ie,ae,Z,re){const{textOffset0:ue,textOffset1:he,crossTileID:be}=J,Se=[ue,he],we=Mc(s,g,v,Se,b),Ce=this.collisionIndex.placeCollisionBox(oe,b,h,zc(we.x,we.y,A,I,this.transform.angle),q,D,N,B.predicate);if(ae){const Ie=oe.getSymbolInstanceIconSize(re,this.transform.zoom,J.placedIconSymbolIndex);if(this.collisionIndex.placeCollisionBox(oe,Ie,ae,zc(we.x,we.y,A,I,this.transform.angle),q,D,N,B.predicate).box.length===0)return}if(Ce.box.length>0){let Ie;return this.prevPlacement&&this.prevPlacement.variableOffsets[be]&&this.prevPlacement.placements[be]&&this.prevPlacement.placements[be].text&&(Ie=this.prevPlacement.variableOffsets[be].anchor),this.variableOffsets[be]={textOffset:Se,width:g,height:v,anchor:s,textScale:b,prevAnchor:Ie},this.markUsedJustification(oe,s,J,ie),oe.allowVerticalPlacement&&(this.markUsedOrientation(oe,ie,J),this.placedOrientations[be]=ie),{shift:we,placedGlyphBoxes:Ce}}}placeLayerBucketPart(s,h,g,v){const{bucket:b,layout:A,posMatrix:I,textLabelPlaneMatrix:D,labelToScreenMatrix:N,clippingData:B,textPixelRatio:q,holdingForFade:J,collisionBoxArray:ne,partiallyEvaluatedTextSize:oe,partiallyEvaluatedIconSize:ie,collisionGroup:ae}=s.parameters,Z=A.get("text-optional"),re=A.get("icon-optional"),ue=A.get("text-allow-overlap"),he=A.get("icon-allow-overlap"),be=A.get("text-rotation-alignment")==="map",Se=A.get("text-pitch-alignment")==="map",we=A.get("icon-text-fit")!=="none",Ce=A.get("symbol-z-order")==="viewport-y";this.transform.setProjection(b.projection);let Ie=ue&&(he||!b.hasIconData()||re),Re=he&&(ue||!b.hasTextData()||Z);!b.collisionArrays&&ne&&b.deserializeCollisionBoxes(ne),g&&v&&b.updateCollisionDebugBuffers(this.transform.zoom,ne);const st=(De,Ke,Ne)=>{const{crossTileID:at,numVerticalGlyphVertices:ze}=De;if(B){const Yr={zoom:this.transform.zoom,pitch:this.transform.pitch};let Or=null;if(B.dynamicFilterNeedsFeature){const gr=this.retainedQueryData[b.bucketInstanceId];Or=B.featureIndex.loadFeature({featureIndex:De.featureIndex,bucketIndex:gr.bucketIndex,sourceLayerIndex:gr.sourceLayerIndex,layoutVertexArrayOffset:0})}if(!(0,B.dynamicFilter)(Yr,Or,this.retainedQueryData[b.bucketInstanceId].tileID.canonical,new l.Point(De.tileAnchorX,De.tileAnchorY),this.transform.calculateDistanceTileData(B.unwrappedTileID)))return this.placements[at]=new Pc(!1,!1,!1,!0),void h.add(at)}if(h.has(at))return;if(J)return void(this.placements[at]=new Pc(!1,!1,!1));let Ze=!1,ut=!1,tt=!0,ht=!1,Mt=!1,$t=null,It={box:null,offscreen:null,occluded:null},Lt={box:null,offscreen:null,occluded:null},nr=null,er=null,Pt=null,Ar=0,Mr=0,zr=0;Ne.textFeatureIndex?Ar=Ne.textFeatureIndex:De.useRuntimeCollisionCircles&&(Ar=De.featureIndex),Ne.verticalTextFeatureIndex&&(Mr=Ne.verticalTextFeatureIndex);const Rr=Yr=>{Yr.tileID=this.retainedQueryData[b.bucketInstanceId].tileID;const Or=this.transform.elevation;(Or||Yr.elevation)&&(Yr.elevation=Or?Or.getAtTileOffset(Yr.tileID,Yr.tileAnchorX,Yr.tileAnchorY):0)},ui=Ne.textBox;if(ui){Rr(ui);const Yr=gr=>{let vn=l.WritingMode.horizontal;if(b.allowVerticalPlacement&&!gr&&this.prevPlacement){const vi=this.prevPlacement.placedOrientations[at];vi&&(this.placedOrientations[at]=vi,vn=vi,this.markUsedOrientation(b,vn,De))}return vn},Or=(gr,vn)=>{if(b.allowVerticalPlacement&&ze>0&&Ne.verticalTextBox){for(const vi of b.writingModes)if(vi===l.WritingMode.vertical?(It=vn(),Lt=It):It=gr(),It&&It.box&&It.box.length)break}else It=gr()};if(A.get("text-variable-anchor")){let gr=A.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[at]){const Zr=this.prevPlacement.variableOffsets[at];gr.indexOf(Zr.anchor)>0&&(gr=gr.filter(Pi=>Pi!==Zr.anchor),gr.unshift(Zr.anchor))}const vn=(Zr,Pi,yh)=>{const js=b.getSymbolInstanceTextSize(oe,De,this.transform.zoom,Ke),Jc=(Zr.x2-Zr.x1)*js+2*Zr.padding,Ca=(Zr.y2-Zr.y1)*js+2*Zr.padding,rs=we&&!he?Pi:null;rs&&Rr(rs);let Vs={box:[],offscreen:!1,occluded:!1};const _h=ue?2*gr.length:gr.length;for(let eu=0;eu<_h;++eu){const Vp=this.attemptAnchorPlacement(gr[eu%gr.length],Zr,Jc,Ca,js,be,Se,q,I,ae,eu>=gr.length,De,Ke,b,yh,rs,oe,ie);if(Vp&&(Vs=Vp.placedGlyphBoxes,Vs&&Vs.box&&Vs.box.length)){Ze=!0,$t=Vp.shift;break}}return Vs};Or(()=>vn(ui,Ne.iconBox,l.WritingMode.horizontal),()=>{const Zr=Ne.verticalTextBox;return Zr&&Rr(Zr),b.allowVerticalPlacement&&!(It&&It.box&&It.box.length)&&ze>0&&Zr?vn(Zr,Ne.verticalIconBox,l.WritingMode.vertical):{box:null,offscreen:null,occluded:null}}),It&&(Ze=It.box,tt=It.offscreen,ht=It.occluded);const vi=Yr(!(!It||!It.box));if(!Ze&&this.prevPlacement){const Zr=this.prevPlacement.variableOffsets[at];Zr&&(this.variableOffsets[at]=Zr,this.markUsedJustification(b,Zr.anchor,De,vi))}}else{const gr=(vn,vi)=>{const Zr=b.getSymbolInstanceTextSize(oe,De,this.transform.zoom,Ke),Pi=this.collisionIndex.placeCollisionBox(b,Zr,vn,new l.Point(0,0),ue,q,I,ae.predicate);return Pi&&Pi.box&&Pi.box.length&&(this.markUsedOrientation(b,vi,De),this.placedOrientations[at]=vi),Pi};Or(()=>gr(ui,l.WritingMode.horizontal),()=>{const vn=Ne.verticalTextBox;return b.allowVerticalPlacement&&ze>0&&vn?(Rr(vn),gr(vn,l.WritingMode.vertical)):{box:null,offscreen:null,occluded:null}}),Yr(!!(It&&It.box&&It.box.length))}}if(nr=It,Ze=nr&&nr.box&&nr.box.length>0,tt=nr&&nr.offscreen,ht=nr&&nr.occluded,De.useRuntimeCollisionCircles){const Yr=b.text.placedSymbolArray.get(De.centerJustifiedTextSymbolIndex>=0?De.centerJustifiedTextSymbolIndex:De.verticalPlacedTextSymbolIndex),Or=l.evaluateSizeForFeature(b.textSizeData,oe,Yr),gr=A.get("text-padding");er=this.collisionIndex.placeCollisionCircles(b,ue,Yr,b.lineVertexArray,b.glyphOffsetArray,Or,I,D,N,g,Se,ae.predicate,De.collisionCircleDiameter*Or/l.ONE_EM,gr,this.retainedQueryData[b.bucketInstanceId].tileID),Ze=ue||er.circles.length>0&&!er.collisionDetected,tt=tt&&er.offscreen,ht=er.occluded}if(Ne.iconFeatureIndex&&(zr=Ne.iconFeatureIndex),Ne.iconBox){const Yr=Or=>{Rr(Or);const gr=we&&$t?zc($t.x,$t.y,be,Se,this.transform.angle):new l.Point(0,0),vn=b.getSymbolInstanceIconSize(ie,this.transform.zoom,De.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(b,vn,Or,gr,he,q,I,ae.predicate)};Lt&&Lt.box&&Lt.box.length&&Ne.verticalIconBox?(Pt=Yr(Ne.verticalIconBox),ut=Pt.box.length>0):(Pt=Yr(Ne.iconBox),ut=Pt.box.length>0),tt=tt&&Pt.offscreen,Mt=Pt.occluded}const Gn=Z||De.numHorizontalGlyphVertices===0&&ze===0,ao=re||De.numIconVertices===0;if(Gn||ao?ao?Gn||(ut=ut&&Ze):Ze=ut&&Ze:ut=Ze=ut&&Ze,Ze&&nr&&nr.box&&this.collisionIndex.insertCollisionBox(nr.box,A.get("text-ignore-placement"),b.bucketInstanceId,Lt&&Lt.box&&Mr?Mr:Ar,ae.ID),ut&&Pt&&this.collisionIndex.insertCollisionBox(Pt.box,A.get("icon-ignore-placement"),b.bucketInstanceId,zr,ae.ID),er&&(Ze&&this.collisionIndex.insertCollisionCircles(er.circles,A.get("text-ignore-placement"),b.bucketInstanceId,Ar,ae.ID),g)){const Yr=b.bucketInstanceId;let Or=this.collisionCircleArrays[Yr];Or===void 0&&(Or=this.collisionCircleArrays[Yr]=new Dc);for(let gr=0;gr=0;--Ke){const Ne=De[Ke];st(b.symbolInstances.get(Ne),Ne,b.collisionArrays[Ne])}}else for(let De=s.symbolInstanceStart;De=0&&(s.text.placedSymbolArray.get(b).crossTileID=q>=0&&b!==q?0:N),A>=0&&(s.text.placedSymbolArray.get(A).crossTileID=q>=0&&A!==q?0:N),I>=0&&(s.text.placedSymbolArray.get(I).crossTileID=q>=0&&I!==q?0:N),D>=0&&(s.text.placedSymbolArray.get(D).crossTileID=q>=0&&D!==q?0:N)}markUsedOrientation(s,h,g){const v=h===l.WritingMode.horizontal||h===l.WritingMode.horizontalOnly?h:0,b=h===l.WritingMode.vertical?h:0,{leftJustifiedTextSymbolIndex:A,centerJustifiedTextSymbolIndex:I,rightJustifiedTextSymbolIndex:D,verticalPlacedTextSymbolIndex:N}=g,B=s.text.placedSymbolArray;A>=0&&(B.get(A).placedOrientation=v),I>=0&&(B.get(I).placedOrientation=v),D>=0&&(B.get(D).placedOrientation=v),N>=0&&(B.get(N).placedOrientation=b)}commit(s){this.commitTime=s,this.zoomAtLastRecencyCheck=this.transform.zoom;const h=this.prevPlacement;let g=!1;this.prevZoomAdjustment=h?h.zoomAdjustment(this.transform.zoom):0;const v=h?h.symbolFadeChange(s):1,b=h?h.opacities:{},A=h?h.variableOffsets:{},I=h?h.placedOrientations:{};for(const D in this.placements){const N=this.placements[D],B=b[D];B?(this.opacities[D]=new ba(B,v,N.text,N.icon,null,N.clipped),g=g||N.text!==B.text.placed||N.icon!==B.icon.placed):(this.opacities[D]=new ba(null,v,N.text,N.icon,N.skipFade,N.clipped),g=g||N.text||N.icon)}for(const D in b){const N=b[D];if(!this.opacities[D]){const B=new ba(N,v,!1,!1);B.isHidden()||(this.opacities[D]=B,g=g||N.text.placed||N.icon.placed)}}for(const D in A)this.variableOffsets[D]||!this.opacities[D]||this.opacities[D].isHidden()||(this.variableOffsets[D]=A[D]);for(const D in I)this.placedOrientations[D]||!this.opacities[D]||this.opacities[D].isHidden()||(this.placedOrientations[D]=I[D]);g?this.lastPlacementChangeTime=s:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=h?h.lastPlacementChangeTime:s)}updateLayerOpacities(s,h){const g=new Set;for(const v of h){const b=v.getBucket(s);b&&v.latestFeatureIndex&&s.id===b.layerIds[0]&&this.updateBucketOpacities(b,g,v.collisionBoxArray)}}updateBucketOpacities(s,h,g){s.hasTextData()&&s.text.opacityVertexArray.clear(),s.hasIconData()&&s.icon.opacityVertexArray.clear(),s.hasIconCollisionBoxData()&&s.iconCollisionBox.collisionVertexArray.clear(),s.hasTextCollisionBoxData()&&s.textCollisionBox.collisionVertexArray.clear();const v=s.layers[0].layout,b=!!s.layers[0].dynamicFilter(),A=new ba(null,0,!1,!1,!0),I=v.get("text-allow-overlap"),D=v.get("icon-allow-overlap"),N=v.get("text-variable-anchor"),B=v.get("text-rotation-alignment")==="map",q=v.get("text-pitch-alignment")==="map",J=v.get("icon-text-fit")!=="none",ne=new ba(null,0,I&&(D||!s.hasIconData()||v.get("icon-optional")),D&&(I||!s.hasTextData()||v.get("text-optional")),!0);!s.collisionArrays&&g&&(s.hasIconCollisionBoxData()||s.hasTextCollisionBoxData())&&s.deserializeCollisionBoxes(g);const oe=(ae,Z,re)=>{for(let ue=0;ue0||ue>0,Ie=be>0,Re=this.placedOrientations[he],st=Re===l.WritingMode.vertical,De=Re===l.WritingMode.horizontal||Re===l.WritingMode.horizontalOnly;if(!Ce&&!Ie||we.isHidden()||ie++,Ce){const Ke=Rc(we.text);oe(s.text,re,st?ln:Ke),oe(s.text,ue,De?ln:Ke);const Ne=we.text.isHidden(),{leftJustifiedTextSymbolIndex:at,centerJustifiedTextSymbolIndex:ze,rightJustifiedTextSymbolIndex:Ze,verticalPlacedTextSymbolIndex:ut}=Z,tt=s.text.placedSymbolArray,ht=Ne||st?1:0;at>=0&&(tt.get(at).hidden=ht),ze>=0&&(tt.get(ze).hidden=ht),Ze>=0&&(tt.get(Ze).hidden=ht),ut>=0&&(tt.get(ut).hidden=Ne||De?1:0);const Mt=this.variableOffsets[he];Mt&&this.markUsedJustification(s,Mt.anchor,Z,Re);const $t=this.placedOrientations[he];$t&&(this.markUsedJustification(s,"left",Z,$t),this.markUsedOrientation(s,$t,Z))}if(Ie){const Ke=Rc(we.icon),{placedIconSymbolIndex:Ne,verticalPlacedIconSymbolIndex:at}=Z,ze=s.icon.placedSymbolArray,Ze=we.icon.isHidden()?1:0;Ne>=0&&(oe(s.icon,be,st?ln:Ke),ze.get(Ne).hidden=Ze),at>=0&&(oe(s.icon,Z.numVerticalIconVertices,De?ln:Ke),ze.get(at).hidden=Ze)}if(s.hasIconCollisionBoxData()||s.hasTextCollisionBoxData()){const Ke=s.collisionArrays[ae];if(Ke){let Ne=new l.Point(0,0),at=!0;if(Ke.textBox||Ke.verticalTextBox){if(N){const Ze=this.variableOffsets[he];Ze?(Ne=Mc(Ze.anchor,Ze.width,Ze.height,Ze.textOffset,Ze.textScale),B&&Ne._rotate(q?this.transform.angle:-this.transform.angle)):at=!1}b&&(at=!we.clipped),Ke.textBox&&yl(s.textCollisionBox.collisionVertexArray,we.text.placed,!at||st,Ne.x,Ne.y),Ke.verticalTextBox&&yl(s.textCollisionBox.collisionVertexArray,we.text.placed,!at||De,Ne.x,Ne.y)}const ze=at&&!!(!De&&Ke.verticalIconBox);Ke.iconBox&&yl(s.iconCollisionBox.collisionVertexArray,we.icon.placed,ze,J?Ne.x:0,J?Ne.y:0),Ke.verticalIconBox&&yl(s.iconCollisionBox.collisionVertexArray,we.icon.placed,!ze,J?Ne.x:0,J?Ne.y:0)}}}if(s.fullyClipped=ie===0,s.sortFeatures(this.transform.angle),this.retainedQueryData[s.bucketInstanceId]&&(this.retainedQueryData[s.bucketInstanceId].featureSortOrder=s.featureSortOrder),s.hasTextData()&&s.text.opacityVertexBuffer&&s.text.opacityVertexBuffer.updateData(s.text.opacityVertexArray),s.hasIconData()&&s.icon.opacityVertexBuffer&&s.icon.opacityVertexBuffer.updateData(s.icon.opacityVertexArray),s.hasIconCollisionBoxData()&&s.iconCollisionBox.collisionVertexBuffer&&s.iconCollisionBox.collisionVertexBuffer.updateData(s.iconCollisionBox.collisionVertexArray),s.hasTextCollisionBoxData()&&s.textCollisionBox.collisionVertexBuffer&&s.textCollisionBox.collisionVertexBuffer.updateData(s.textCollisionBox.collisionVertexArray),s.bucketInstanceId in this.collisionCircleArrays){const ae=this.collisionCircleArrays[s.bucketInstanceId];s.placementInvProjMatrix=ae.invProjMatrix,s.placementViewportMatrix=ae.viewportMatrix,s.collisionCircleArray=ae.circles,delete this.collisionCircleArrays[s.bucketInstanceId]}}symbolFadeChange(s){return this.fadeDuration===0?1:(s-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(s){return Math.max(0,(this.transform.zoom-s)/1.5)}hasTransitions(s){return this.stale||s-this.lastPlacementChangeTimes}setStale(){this.stale=!0}}function yl(f,s,h,g,v){f.emplaceBack(s?1:0,h?1:0,g||0,v||0),f.emplaceBack(s?1:0,h?1:0,g||0,v||0),f.emplaceBack(s?1:0,h?1:0,g||0,v||0),f.emplaceBack(s?1:0,h?1:0,g||0,v||0)}const Ci=Math.pow(2,25),fn=Math.pow(2,24),Jd=Math.pow(2,17),ep=Math.pow(2,16),ki=Math.pow(2,9),no=Math.pow(2,8),o0=Math.pow(2,1);function Rc(f){if(f.opacity===0&&!f.placed)return 0;if(f.opacity===1&&f.placed)return 4294967295;const s=f.placed?1:0,h=Math.floor(127*f.opacity);return h*Ci+s*fn+h*Jd+s*ep+h*ki+s*no+h*o0+s}const ln=0;class Oc{constructor(s){this._sortAcrossTiles=s.layout.get("symbol-z-order")!=="viewport-y"&&s.layout.get("symbol-sort-key").constantOr(1)!==void 0,this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs=new Set,this._bucketParts=[]}continuePlacement(s,h,g,v,b){const A=this._bucketParts;for(;this._currentTileIndexI.sortKey-D.sortKey));this._currentPartIndex{const A=l.exported.now()-v;return!this._forceFullPlacement&&A>2};for(;this._currentPlacementIndex>=0;){const A=h[s[this._currentPlacementIndex]],I=this.placement.collisionIndex.transform.zoom;if(A.type==="symbol"&&(!A.minzoom||A.minzoom<=I)&&(!A.maxzoom||A.maxzoom>I)){if(this._inProgressLayer||(this._inProgressLayer=new Oc(A)),this._inProgressLayer.continuePlacement(g[A.source],this.placement,this._showCollisionBoxes,A,b))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(s){return this.placement.commit(s),this.placement}}const Rs=512/l.EXTENT/2;class Jn{constructor(s,h,g){this.tileID=s,this.bucketInstanceId=g,this.index=new l.KDBush(h.length,16,Int32Array),this.keys=[],this.crossTileIDs=[];const v=s.canonical.x*l.EXTENT,b=s.canonical.y*l.EXTENT;for(let A=0;As.overscaledZ)for(const I in A){const D=A[I];D.tileID.isChildOf(s)&&D.findMatches(h.symbolInstances,s,v)}else{const I=A[s.scaledTo(Number(b)).key];I&&I.findMatches(h.symbolInstances,s,v)}}for(let b=0;b{h[g]=!0});for(const g in this.layerIndexes)h[g]||delete this.layerIndexes[g]}}const es=(f,s)=>l.emitValidationErrors(f,s&&s.filter(h=>h.identifier!=="source.canvas")),Gu=l.pick(br,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setProjection"]),Kv=l.pick(br,["setCenter","setZoom","setBearing","setPitch"]),ip={version:8,layers:[],sources:{}},_l={fill:!0,line:!0,background:!0,hillshade:!0,raster:!0};class Xo extends l.Evented{constructor(s,h={}){super(),this.map=s,this.dispatcher=new gt(ml(),this),this.imageManager=new Be,this.imageManager.setEventedParent(this),this.glyphManager=new l.GlyphManager(s._requestManager,h.localFontFamily?l.LocalGlyphMode.all:h.localIdeographFontFamily?l.LocalGlyphMode.ideographs:l.LocalGlyphMode.none,h.localFontFamily||h.localIdeographFontFamily),this.crossTileSymbolIndex=new wa,this._layers={},this._num3DLayers=0,this._numSymbolLayers=0,this._numCircleLayers=0,this._serializedLayers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this._loaded=!1,this._availableImages=[],this._order=[],this._drapedFirstOrder=[],this._markersNeedUpdate=!1,this._resetUpdates(),this.dispatcher.broadcast("setReferrer",l.getReferrer());const g=this;this._rtlTextPluginCallback=Xo.registerForPluginStateChange(v=>{g.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:v.pluginStatus,pluginURL:v.pluginURL},(b,A)=>{if(l.triggerPluginCompletionEvent(b),A&&A.every(I=>I))for(const I in g._sourceCaches){const D=g._sourceCaches[I],N=D.getSource().type;N!=="vector"&&N!=="geojson"||D.reload()}})}),this.on("data",v=>{if(v.dataType!=="source"||v.sourceDataType!=="metadata")return;const b=this.getSource(v.sourceId);if(b&&b.vectorLayerIds)for(const A in this._layers){const I=this._layers[A];I.source===b.id&&this._validateLayer(I)}})}loadURL(s,h={}){this.fire(new l.Event("dataloading",{dataType:"style"}));const g=typeof h.validate=="boolean"?h.validate:!l.isMapboxURL(s);s=this.map._requestManager.normalizeStyleURL(s,h.accessToken);const v=this.map._requestManager.transformRequest(s,l.ResourceType.Style);this._request=l.getJSON(v,(b,A)=>{this._request=null,b?this.fire(new l.ErrorEvent(b)):A&&this._load(A,g)})}loadJSON(s,h={}){this.fire(new l.Event("dataloading",{dataType:"style"})),this._request=l.exported.frame(()=>{this._request=null,this._load(s,h.validate!==!1)})}loadEmpty(){this.fire(new l.Event("dataloading",{dataType:"style"})),this._load(ip,!1)}_updateLayerCount(s,h){const g=h?1:-1;s.is3D()&&(this._num3DLayers+=g),s.type==="circle"&&(this._numCircleLayers+=g),s.type==="symbol"&&(this._numSymbolLayers+=g)}_load(s,h){if(h&&es(this,l.validateStyle(s)))return;this._loaded=!0,this.stylesheet=l.clone$1(s),this._updateMapProjection();for(const v in s.sources)this.addSource(v,s.sources[v],{validate:!1});this._changed=!1,s.sprite?this._loadSprite(s.sprite):(this.imageManager.setLoaded(!0),this.dispatcher.broadcast("spriteLoaded",!0)),this.glyphManager.setURL(s.glyphs);const g=e0(this.stylesheet.layers);this._order=g.map(v=>v.id),this._layers={},this._serializedLayers={};for(const v of g){const b=l.createStyleLayer(v);b.setEventedParent(this,{layer:{id:b.id}}),this._layers[b.id]=b,this._serializedLayers[b.id]=b.serialize(),this._updateLayerCount(b,!0)}this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new Ve(this.stylesheet.light),this.stylesheet.terrain&&!this.terrainSetForDrapingOnly()&&this._createTerrain(this.stylesheet.terrain,1),this.stylesheet.fog&&this._createFog(this.stylesheet.fog),this._updateDrapeFirstLayers(),this.fire(new l.Event("data",{dataType:"style"})),this.fire(new l.Event("style.load"))}terrainSetForDrapingOnly(){return!!this.terrain&&this.terrain.drapeRenderMode===0}setProjection(s){s?this.stylesheet.projection=s:delete this.stylesheet.projection,this._updateMapProjection()}applyProjectionUpdate(){this._loaded&&(this.dispatcher.broadcast("setProjection",this.map.transform.projectionOptions),this.map.transform.projection.requiresDraping?this.getTerrain()||this.stylesheet.terrain||this.setTerrainForDraping():this.terrainSetForDrapingOnly()&&this.setTerrain(null))}_updateMapProjection(){this.map._useExplicitProjection?this.applyProjectionUpdate():this.map._prioritizeAndUpdateProjection(null,this.stylesheet.projection)}_loadSprite(s){this._spriteRequest=function(h,g,v){let b,A,I;const D=l.exported.devicePixelRatio>1?"@2x":"";let N=l.getJSON(g.transformRequest(g.normalizeSpriteURL(h,D,".json"),l.ResourceType.SpriteJSON),(J,ne)=>{N=null,I||(I=J,b=ne,q())}),B=l.getImage(g.transformRequest(g.normalizeSpriteURL(h,D,".png"),l.ResourceType.SpriteImage),(J,ne)=>{B=null,I||(I=J,A=ne,q())});function q(){if(I)v(I);else if(b&&A){const J=l.exported.getImageData(A),ne={};for(const oe in b){const{width:ie,height:ae,x:Z,y:re,sdf:ue,pixelRatio:he,stretchX:be,stretchY:Se,content:we}=b[oe],Ce=new l.RGBAImage({width:ie,height:ae});l.RGBAImage.copy(J,Ce,{x:Z,y:re},{x:0,y:0},{width:ie,height:ae}),ne[oe]={data:Ce,pixelRatio:he,sdf:ue,stretchX:be,stretchY:Se,content:we}}v(null,ne)}}return{cancel(){N&&(N.cancel(),N=null),B&&(B.cancel(),B=null)}}}(s,this.map._requestManager,(h,g)=>{if(this._spriteRequest=null,h)this.fire(new l.ErrorEvent(h));else if(g)for(const v in g)this.imageManager.addImage(v,g[v]);this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),this.dispatcher.broadcast("setImages",this._availableImages),this.dispatcher.broadcast("spriteLoaded",!0),this.fire(new l.Event("data",{dataType:"style"}))})}_validateLayer(s){const h=this.getSource(s.source);if(!h)return;const g=s.sourceLayer;g&&(h.type==="geojson"||h.vectorLayerIds&&h.vectorLayerIds.indexOf(g)===-1)&&this.fire(new l.ErrorEvent(new Error(`Source layer "${g}" does not exist on source "${h.id}" as specified by style layer "${s.id}"`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const s in this._sourceCaches)if(!this._sourceCaches[s].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeLayers(s){const h=[];for(const g of s){const v=this._layers[g];v.type!=="custom"&&h.push(v.serialize())}return h}hasTransitions(){if(this.light&&this.light.hasTransition()||this.fog&&this.fog.hasTransition())return!0;for(const s in this._sourceCaches)if(this._sourceCaches[s].hasTransition())return!0;for(const s in this._layers)if(this._layers[s].hasTransition())return!0;return!1}get order(){return this.map._optimizeForTerrain&&this.terrain?this._drapedFirstOrder:this._order}isLayerDraped(s){return!!this.terrain&&(typeof s.isLayerDraped=="function"?s.isLayerDraped():_l[s.type])}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading")}update(s){if(!this._loaded)return;const h=this._changed;if(this._changed){const v=Object.keys(this._updatedLayers),b=Object.keys(this._removedLayers);(v.length||b.length)&&this._updateWorkerLayers(v,b);for(const A in this._updatedSources){const I=this._updatedSources[A];I==="reload"?this._reloadSource(A):I==="clear"&&this._clearSource(A)}this._updateTilesForChangedImages();for(const A in this._updatedPaintProps)this._layers[A].updateTransitions(s);this.light.updateTransitions(s),this.fog&&this.fog.updateTransitions(s),this._resetUpdates()}const g={};for(const v in this._sourceCaches){const b=this._sourceCaches[v];g[v]=b.used,b.used=!1}for(const v of this._order){const b=this._layers[v];if(b.recalculate(s,this._availableImages),!b.isHidden(s.zoom)){const I=this._getLayerSourceCache(b);I&&(I.used=!0)}const A=this.map.painter;if(A){const I=b.getProgramIds();if(!I)continue;const D=b.getProgramConfiguration(s.zoom);for(const N of I)A.useProgram(N,D)}}for(const v in g){const b=this._sourceCaches[v];g[v]!==b.used&&b.getSource().fire(new l.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:b.getSource().id}))}this.light.recalculate(s),this.terrain&&this.terrain.recalculate(s),this.fog&&this.fog.recalculate(s),this.z=s.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),h&&this.fire(new l.Event("data",{dataType:"style"}))}_updateTilesForChangedImages(){const s=Object.keys(this._changedImages);if(s.length){for(const h in this._sourceCaches)this._sourceCaches[h].reloadTilesForDependencies(["icons","patterns"],s);this._changedImages={}}}_updateWorkerLayers(s,h){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(s),removedIds:h})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={}}setState(s){if(this._checkLoaded(),es(this,l.validateStyle(s)))return!1;(s=l.clone$1(s)).layers=e0(s.layers);const h=function(v,b){if(!v)return[{command:br.setStyle,args:[b]}];let A=[];try{if(!w(v.version,b.version))return[{command:br.setStyle,args:[b]}];w(v.center,b.center)||A.push({command:br.setCenter,args:[b.center]}),w(v.zoom,b.zoom)||A.push({command:br.setZoom,args:[b.zoom]}),w(v.bearing,b.bearing)||A.push({command:br.setBearing,args:[b.bearing]}),w(v.pitch,b.pitch)||A.push({command:br.setPitch,args:[b.pitch]}),w(v.sprite,b.sprite)||A.push({command:br.setSprite,args:[b.sprite]}),w(v.glyphs,b.glyphs)||A.push({command:br.setGlyphs,args:[b.glyphs]}),w(v.transition,b.transition)||A.push({command:br.setTransition,args:[b.transition]}),w(v.light,b.light)||A.push({command:br.setLight,args:[b.light]}),w(v.fog,b.fog)||A.push({command:br.setFog,args:[b.fog]}),w(v.projection,b.projection)||A.push({command:br.setProjection,args:[b.projection]});const I={},D=[];(function(q,J,ne,oe){let ie;for(ie in J=J||{},q=q||{})q.hasOwnProperty(ie)&&(J.hasOwnProperty(ie)||Ic(ie,ne,oe));for(ie in J){if(!J.hasOwnProperty(ie))continue;const ae=J[ie];q.hasOwnProperty(ie)?w(q[ie],ae)||(q[ie].type==="geojson"&&ae.type==="geojson"&&$u(q,J,ie)?ne.push({command:br.setGeoJSONSourceData,args:[ie,ae.data]}):Zd(ie,J,ne,oe)):qd(ie,J,ne)}})(v.sources,b.sources,D,I);const N=[];v.layers&&v.layers.forEach(q=>{q.source&&I[q.source]?A.push({command:br.removeLayer,args:[q.id]}):N.push(q)});let B=v.terrain;B&&I[B.source]&&(A.push({command:br.setTerrain,args:[void 0]}),B=void 0),A=A.concat(D),w(B,b.terrain)||A.push({command:br.setTerrain,args:[b.terrain]}),function(q,J,ne){J=J||[];const oe=(q=q||[]).map(_a),ie=J.map(_a),ae=q.reduce(Kd,{}),Z=J.reduce(Kd,{}),re=oe.slice(),ue=Object.create(null);let he,be,Se,we,Ce,Ie,Re;for(he=0,be=0;he!(v.command in Kv));if(h.length===0)return!1;const g=h.filter(v=>!(v.command in Gu));if(g.length>0)throw new Error(`Unimplemented: ${g.map(v=>v.command).join(", ")}.`);return h.forEach(v=>{v.command!=="setTransition"&&v.command!=="setProjection"&&this[v.command].apply(this,v.args)}),this.stylesheet=s,this._updateMapProjection(),!0}addImage(s,h){return this.getImage(s)?this.fire(new l.ErrorEvent(new Error("An image with this name already exists."))):(this.imageManager.addImage(s,h),this._afterImageUpdated(s),this)}updateImage(s,h){this.imageManager.updateImage(s,h)}getImage(s){return this.imageManager.getImage(s)}removeImage(s){return this.getImage(s)?(this.imageManager.removeImage(s),this._afterImageUpdated(s),this):this.fire(new l.ErrorEvent(new Error("No image with this name exists.")))}_afterImageUpdated(s){this._availableImages=this.imageManager.listImages(),this._changedImages[s]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new l.Event("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this._availableImages.slice()}addSource(s,h,g={}){if(this._checkLoaded(),this.getSource(s)!==void 0)throw new Error("There is already a source with this ID");if(!h.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(h).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(h.type)>=0&&this._validate(l.validateSource,`sources.${s}`,h,null,g))return;this.map&&this.map._collectResourceTiming&&(h.collectResourceTiming=!0);const v=Qt(s,h,this.dispatcher,this);v.setEventedParent(this,()=>({isSourceLoaded:this._isSourceCacheLoaded(s),source:v.serialize(),sourceId:s}));const b=A=>{const I=(A?"symbol:":"other:")+s,D=this._sourceCaches[I]=new l.SourceCache(I,v,A);(A?this._symbolSourceCaches:this._otherSourceCaches)[s]=D,D.style=this,D.onAdd(this.map)};b(!1),h.type!=="vector"&&h.type!=="geojson"||b(!0),v.onAdd&&v.onAdd(this.map),this._changed=!0}removeSource(s){this._checkLoaded();const h=this.getSource(s);if(!h)throw new Error("There is no source with this ID");for(const v in this._layers)if(this._layers[v].source===s)return this.fire(new l.ErrorEvent(new Error(`Source "${s}" cannot be removed while layer "${v}" is using it.`)));if(this.terrain&&this.terrain.get().source===s)return this.fire(new l.ErrorEvent(new Error(`Source "${s}" cannot be removed while terrain is using it.`)));const g=this._getSourceCaches(s);for(const v of g)delete this._sourceCaches[v.id],delete this._updatedSources[v.id],v.fire(new l.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:v.getSource().id})),v.setEventedParent(null),v.clearTiles();return delete this._otherSourceCaches[s],delete this._symbolSourceCaches[s],h.setEventedParent(null),h.onRemove&&h.onRemove(this.map),this._changed=!0,this}setGeoJSONSourceData(s,h){this._checkLoaded(),this.getSource(s).setData(h),this._changed=!0}getSource(s){const h=this._getSourceCache(s);return h&&h.getSource()}_getSources(){const s=[];for(const h in this._otherSourceCaches){const g=this._getSourceCache(h);g&&s.push(g.getSource())}return s}addLayer(s,h,g={}){this._checkLoaded();const v=s.id;if(this.getLayer(v))return void this.fire(new l.ErrorEvent(new Error(`Layer with id "${v}" already exists on this map`)));let b;if(s.type==="custom"){if(es(this,l.validateCustomStyleLayer(s)))return;b=l.createStyleLayer(s)}else{if(typeof s.source=="object"&&(this.addSource(v,s.source),s=l.clone$1(s),s=l.extend(s,{source:v})),this._validate(l.validateLayer,`layers.${v}`,s,{arrayIndex:-1},g))return;b=l.createStyleLayer(s),this._validateLayer(b),b.setEventedParent(this,{layer:{id:v}}),this._serializedLayers[b.id]=b.serialize(),this._updateLayerCount(b,!0)}const A=h?this._order.indexOf(h):this._order.length;if(h&&A===-1)return void this.fire(new l.ErrorEvent(new Error(`Layer with id "${h}" does not exist on this map.`)));this._order.splice(A,0,v),this._layerOrderChanged=!0,this._layers[v]=b;const I=this._getLayerSourceCache(b);if(this._removedLayers[v]&&b.source&&I&&b.type!=="custom"){const D=this._removedLayers[v];delete this._removedLayers[v],D.type!==b.type?this._updatedSources[b.source]="clear":(this._updatedSources[b.source]="reload",I.pause())}this._updateLayer(b),b.onAdd&&b.onAdd(this.map),this._updateDrapeFirstLayers()}moveLayer(s,h){if(this._checkLoaded(),this._changed=!0,!this._layers[s])return void this.fire(new l.ErrorEvent(new Error(`The layer '${s}' does not exist in the map's style and cannot be moved.`)));if(s===h)return;const g=this._order.indexOf(s);this._order.splice(g,1);const v=h?this._order.indexOf(h):this._order.length;h&&v===-1?this.fire(new l.ErrorEvent(new Error(`Layer with id "${h}" does not exist on this map.`))):(this._order.splice(v,0,s),this._layerOrderChanged=!0,this._updateDrapeFirstLayers())}removeLayer(s){this._checkLoaded();const h=this._layers[s];if(!h)return void this.fire(new l.ErrorEvent(new Error(`The layer '${s}' does not exist in the map's style and cannot be removed.`)));h.setEventedParent(null),this._updateLayerCount(h,!1);const g=this._order.indexOf(s);this._order.splice(g,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[s]=h,delete this._layers[s],delete this._serializedLayers[s],delete this._updatedLayers[s],delete this._updatedPaintProps[s],h.onRemove&&h.onRemove(this.map),this._updateDrapeFirstLayers()}getLayer(s){return this._layers[s]}hasLayer(s){return s in this._layers}hasLayerType(s){for(const h in this._layers)if(this._layers[h].type===s)return!0;return!1}setLayerZoomRange(s,h,g){this._checkLoaded();const v=this.getLayer(s);v?v.minzoom===h&&v.maxzoom===g||(h!=null&&(v.minzoom=h),g!=null&&(v.maxzoom=g),this._updateLayer(v)):this.fire(new l.ErrorEvent(new Error(`The layer '${s}' does not exist in the map's style and cannot have zoom extent.`)))}setFilter(s,h,g={}){this._checkLoaded();const v=this.getLayer(s);if(v){if(!w(v.filter,h))return h==null?(v.filter=void 0,void this._updateLayer(v)):void(this._validate(l.validateFilter,`layers.${v.id}.filter`,h,{layerType:v.type},g)||(v.filter=l.clone$1(h),this._updateLayer(v)))}else this.fire(new l.ErrorEvent(new Error(`The layer '${s}' does not exist in the map's style and cannot be filtered.`)))}getFilter(s){const h=this.getLayer(s);return h&&l.clone$1(h.filter)}setLayoutProperty(s,h,g,v={}){this._checkLoaded();const b=this.getLayer(s);b?w(b.getLayoutProperty(h),g)||(b.setLayoutProperty(h,g,v),this._updateLayer(b)):this.fire(new l.ErrorEvent(new Error(`The layer '${s}' does not exist in the map's style and cannot be styled.`)))}getLayoutProperty(s,h){const g=this.getLayer(s);if(g)return g.getLayoutProperty(h);this.fire(new l.ErrorEvent(new Error(`The layer '${s}' does not exist in the map's style.`)))}setPaintProperty(s,h,g,v={}){this._checkLoaded();const b=this.getLayer(s);b?w(b.getPaintProperty(h),g)||(b.setPaintProperty(h,g,v)&&this._updateLayer(b),this._changed=!0,this._updatedPaintProps[s]=!0):this.fire(new l.ErrorEvent(new Error(`The layer '${s}' does not exist in the map's style and cannot be styled.`)))}getPaintProperty(s,h){const g=this.getLayer(s);return g&&g.getPaintProperty(h)}setFeatureState(s,h){this._checkLoaded();const g=s.source,v=s.sourceLayer,b=this.getSource(g);if(!b)return void this.fire(new l.ErrorEvent(new Error(`The source '${g}' does not exist in the map's style.`)));const A=b.type;if(A==="geojson"&&v)return void this.fire(new l.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));if(A==="vector"&&!v)return void this.fire(new l.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));s.id===void 0&&this.fire(new l.ErrorEvent(new Error("The feature id parameter must be provided.")));const I=this._getSourceCaches(g);for(const D of I)D.setFeatureState(v,s.id,h)}removeFeatureState(s,h){this._checkLoaded();const g=s.source,v=this.getSource(g);if(!v)return void this.fire(new l.ErrorEvent(new Error(`The source '${g}' does not exist in the map's style.`)));const b=v.type,A=b==="vector"?s.sourceLayer:void 0;if(b==="vector"&&!A)return void this.fire(new l.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));if(h&&typeof s.id!="string"&&typeof s.id!="number")return void this.fire(new l.ErrorEvent(new Error("A feature id is required to remove its specific state property.")));const I=this._getSourceCaches(g);for(const D of I)D.removeFeatureState(A,s.id,h)}getFeatureState(s){this._checkLoaded();const h=s.source,g=s.sourceLayer,v=this.getSource(h);if(v){if(v.type!=="vector"||g)return s.id===void 0&&this.fire(new l.ErrorEvent(new Error("The feature id parameter must be provided."))),this._getSourceCaches(h)[0].getFeatureState(g,s.id);this.fire(new l.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new l.ErrorEvent(new Error(`The source '${h}' does not exist in the map's style.`)))}getTransition(){return l.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){const s={};for(const h in this._sourceCaches){const g=this._sourceCaches[h].getSource();s[g.id]||(s[g.id]=g.serialize())}return l.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,terrain:this.getTerrain()||void 0,fog:this.stylesheet.fog,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,projection:this.stylesheet.projection,sources:s,layers:this._serializeLayers(this._order)},h=>h!==void 0)}_updateLayer(s){this._updatedLayers[s.id]=!0;const h=this._getLayerSourceCache(s);s.source&&!this._updatedSources[s.source]&&h&&h.getSource().type!=="raster"&&(this._updatedSources[s.source]="reload",h.pause()),this._changed=!0,s.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(s){const h=A=>this._layers[A].type==="fill-extrusion",g={},v=[];for(let A=this._order.length-1;A>=0;A--){const I=this._order[A];if(h(I)){g[I]=A;for(const D of s){const N=D[I];if(N)for(const B of N)v.push(B)}}}v.sort((A,I)=>I.intersectionZ-A.intersectionZ);const b=[];for(let A=this._order.length-1;A>=0;A--){const I=this._order[A];if(h(I))for(let D=v.length-1;D>=0;D--){const N=v[D].feature;if(g[N.layer.id]{const N=this.getLayer(D);return N&&N.is3D()}):this.has3DLayers(),I=et.createFromScreenPoints(s,g);for(const D in this._sourceCaches){const N=this._sourceCaches[D].getSource().id;h.layers&&!v[N]||b.push(en(this._sourceCaches[D],this._layers,this._serializedLayers,I,h,g,A,!!this.map._showQueryGeometry))}return this.placement&&b.push(function(D,N,B,q,J,ne,oe){const ie={},ae=ne.queryRenderedSymbols(q),Z=[];for(const re of Object.keys(ae).map(Number))Z.push(oe[re]);Z.sort(li);for(const re of Z){const ue=re.featureIndex.lookupSymbolFeatures(ae[re.bucketInstanceId],N,re.bucketIndex,re.sourceLayerIndex,J.filter,J.layers,J.availableImages,D);for(const he in ue){const be=ie[he]=ie[he]||[],Se=ue[he];Se.sort((we,Ce)=>{const Ie=re.featureSortOrder;if(Ie){const Re=Ie.indexOf(we.featureIndex);return Ie.indexOf(Ce.featureIndex)-Re}return Ce.featureIndex-we.featureIndex});for(const we of Se)be.push(we)}}for(const re in ie)ie[re].forEach(ue=>{const he=ue.feature,be=B(D[re]);if(!be)return;const Se=be.getFeatureState(he.layer["source-layer"],he.id);he.source=he.layer.source,he.layer["source-layer"]&&(he.sourceLayer=he.layer["source-layer"]),he.state=Se});return ie}(this._layers,this._serializedLayers,this._getLayerSourceCache.bind(this),I.screenGeometry,h,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(b)}querySourceFeatures(s,h){h&&h.filter&&this._validate(l.validateFilter,"querySourceFeatures.filter",h.filter,null,h);const g=this._getSourceCaches(s);let v=[];for(const b of g)v=v.concat(yn(b,h));return v}addSourceType(s,h,g){return Xo.getSourceType(s)?g(new Error(`A source type called "${s}" already exists.`)):(Xo.setSourceType(s,h),h.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:s,url:h.workerSourceURL},g):g(null,null))}getLight(){return this.light.getLight()}setLight(s,h={}){this._checkLoaded();const g=this.light.getLight();let v=!1;for(const A in s)if(!w(s[A],g[A])){v=!0;break}if(!v)return;const b=this._setTransitionParameters({duration:300,delay:0});this.light.setLight(s,h),this.light.updateTransitions(b)}getTerrain(){return this.terrain&&this.terrain.drapeRenderMode===1?this.terrain.get():null}setTerrainForDraping(){this.setTerrain({source:"",exaggeration:0},0)}setTerrain(s,h=1){if(this._checkLoaded(),!s)return delete this.terrain,delete this.stylesheet.terrain,this.dispatcher.broadcast("enableTerrain",!1),this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);let g=s;if(h===1){if(typeof g.source=="object"){const v="terrain-dem-src";this.addSource(v,g.source),g=l.clone$1(g),g=l.extend(g,{source:v})}if(this._validate(l.validateTerrain,"terrain",g))return}if(!this.terrain||this.terrain&&h!==this.terrain.drapeRenderMode){if(!g)return;this._createTerrain(g,h)}else{const v=this.terrain,b=v.get();for(const A of Object.keys(l.spec.terrain))!g.hasOwnProperty(A)&&l.spec.terrain[A].default&&(g[A]=l.spec.terrain[A].default);for(const A in g)if(!w(g[A],b[A])){v.set(g),this.stylesheet.terrain=g;const I=this._setTransitionParameters({duration:0});v.updateTransitions(I);break}}this._updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(s){const h=this.fog=new Tt(s,this.map.transform);this.stylesheet.fog=s;const g=this._setTransitionParameters({duration:0});h.updateTransitions(g)}_updateMarkersOpacity(){this.map._markers.length!==0&&this.map._requestDomTask(()=>{for(const s of this.map._markers)s._evaluateOpacity()})}getFog(){return this.fog?this.fog.get():null}setFog(s){if(this._checkLoaded(),!s)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){const h=this.fog,g=h.get();Object.keys(s).length===0&&h.set(s);for(const v in s)if(!w(s[v],g[v])){h.set(s),this.stylesheet.fog=s;const b=this._setTransitionParameters({duration:0});h.updateTransitions(b);break}}else this._createFog(s);this._markersNeedUpdate=!0}_setTransitionParameters(s){return{now:l.exported.now(),transition:l.extend(s,this.stylesheet.transition)}}_updateDrapeFirstLayers(){if(!this.map._optimizeForTerrain||!this.terrain)return;const s=this._order.filter(g=>this.isLayerDraped(this._layers[g])),h=this._order.filter(g=>!this.isLayerDraped(this._layers[g]));this._drapedFirstOrder=[],this._drapedFirstOrder.push(...s),this._drapedFirstOrder.push(...h)}_createTerrain(s,h){const g=this.terrain=new Dt(s,h);this.stylesheet.terrain=s,this.dispatcher.broadcast("enableTerrain",!this.terrainSetForDrapingOnly()),this._force3DLayerUpdate();const v=this._setTransitionParameters({duration:0});g.updateTransitions(v)}_force3DLayerUpdate(){for(const s in this._layers){const h=this._layers[s];h.type==="fill-extrusion"&&this._updateLayer(h)}}_forceSymbolLayerUpdate(){for(const s in this._layers){const h=this._layers[s];h.type==="symbol"&&this._updateLayer(h)}}_validate(s,h,g,v,b={}){return(!b||b.validate!==!1)&&es(this,s.call(l.validateStyle,l.extend({key:h,style:this.serialize(),value:g,styleSpec:l.spec},v)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),l.evented.off("pluginStateChange",this._rtlTextPluginCallback);for(const s in this._layers)this._layers[s].setEventedParent(null);for(const s in this._sourceCaches)this._sourceCaches[s].clearTiles(),this._sourceCaches[s].setEventedParent(null);this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove()}_clearSource(s){const h=this._getSourceCaches(s);for(const g of h)g.clearTiles()}_reloadSource(s){const h=this._getSourceCaches(s);for(const g of h)g.resume(),g.reload()}_reloadSources(){for(const s of this._getSources())s.reload&&s.reload()}_updateSources(s){for(const h in this._sourceCaches)this._sourceCaches[h].update(s)}_generateCollisionBoxes(){for(const s in this._sourceCaches){const h=this._sourceCaches[s];h.resume(),h.reload()}}_updatePlacement(s,h,g,v,b=!1){let A=!1,I=!1;const D={};for(const N of this._order){const B=this._layers[N];if(B.type!=="symbol")continue;if(!D[B.source]){const J=this._getLayerSourceCache(B);if(!J)continue;D[B.source]=J.getRenderableIds(!0).map(ne=>J.getTileByID(ne)).sort((ne,oe)=>oe.tileID.overscaledZ-ne.tileID.overscaledZ||(ne.tileID.isLessThan(oe.tileID)?-1:1))}const q=this.crossTileSymbolIndex.addLayer(B,D[B.source],s.center.lng,s.projection);A=A||q}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),b=b||this._layerOrderChanged||g===0,this._layerOrderChanged&&this.fire(new l.Event("neworder")),(b||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(l.exported.now(),s.zoom))&&(this.pauseablePlacement=new tp(s,this._order,b,h,g,v,this.placement,this.fog&&s.projection.supportsFog?this.fog.state:null),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,D),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(l.exported.now()),I=!0),A&&this.pauseablePlacement.placement.setStale()),I||A)for(const N of this._order){const B=this._layers[N];B.type==="symbol"&&this.placement.updateLayerOpacities(B,D[B.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(l.exported.now())}_releaseSymbolFadeTiles(){for(const s in this._sourceCaches)this._sourceCaches[s].releaseSymbolFadeTiles()}getImages(s,h,g){this.imageManager.getImages(h.icons,g),this._updateTilesForChangedImages();const v=b=>{b&&b.setDependencies(h.tileID.key,h.type,h.icons)};v(this._otherSourceCaches[h.source]),v(this._symbolSourceCaches[h.source])}getGlyphs(s,h,g){this.glyphManager.getGlyphs(h.stacks,g)}getResource(s,h,g){return l.makeRequest(h,g)}_getSourceCache(s){return this._otherSourceCaches[s]}_getLayerSourceCache(s){return s.type==="symbol"?this._symbolSourceCaches[s.source]:this._otherSourceCaches[s.source]}_getSourceCaches(s){const h=[];return this._otherSourceCaches[s]&&h.push(this._otherSourceCaches[s]),this._symbolSourceCaches[s]&&h.push(this._symbolSourceCaches[s]),h}_isSourceCacheLoaded(s){const h=this._getSourceCaches(s);return h.length===0?(this.fire(new l.ErrorEvent(new Error(`There is no source with ID '${s}'`))),!1):h.every(g=>g.loaded())}has3DLayers(){return this._num3DLayers>0}hasSymbolLayers(){return this._numSymbolLayers>0}hasCircleLayers(){return this._numCircleLayers>0}_clearWorkerCaches(){this.dispatcher.broadcast("clearCaches")}destroy(){this._clearWorkerCaches(),this.terrainSetForDrapingOnly()&&(delete this.terrain,delete this.stylesheet.terrain)}}Xo.getSourceType=function(f){return Wt[f]},Xo.setSourceType=function(f,s){Wt[f]=s},Xo.registerForPluginStateChange=l.registerForPluginStateChange;var op=` +#define EPSILON 0.0000001 +#define PI 3.141592653589793 +#define EXTENT 8192.0 +#define HALF_PI PI/2.0 +#define QUARTER_PI PI/4.0 +#define RAD_TO_DEG 180.0/PI +#define DEG_TO_RAD PI/180.0 +#define GLOBE_RADIUS EXTENT/PI/2.0`,Os="attribute highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;varying highp vec3 v_uv;void main() {const mat3 half_neg_pi_around_x=mat3(1.0,0.0, 0.0,0.0,0.0,-1.0,0.0,1.0, 0.0);v_uv=half_neg_pi_around_x*a_pos_3f;vec4 pos=u_matrix*vec4(a_pos_3f,1.0);gl_Position=pos.xyww;}",Ea=` +#define ELEVATION_SCALE 7.0 +#define ELEVATION_OFFSET 450.0 +#ifdef PROJECTION_GLOBE_VIEW +uniform vec3 u_tile_tl_up;uniform vec3 u_tile_tr_up;uniform vec3 u_tile_br_up;uniform vec3 u_tile_bl_up;uniform float u_tile_up_scale;vec3 elevationVector(vec2 pos) {vec2 uv=pos/EXTENT;vec3 up=normalize(mix( +mix(u_tile_tl_up,u_tile_tr_up,uv.xxx),mix(u_tile_bl_up,u_tile_br_up,uv.xxx),uv.yyy));return up*u_tile_up_scale;} +#else +vec3 elevationVector(vec2 pos) { return vec3(0,0,1); } +#endif +const float skirtOffset=24575.0;vec3 decomposeToPosAndSkirt(vec2 posWithComposedSkirt) +{float skirt=float(posWithComposedSkirt.x >=skirtOffset);vec2 pos=posWithComposedSkirt-vec2(skirt*skirtOffset,0.0);return vec3(pos,skirt);} +#ifdef TERRAIN +#ifdef TERRAIN_DEM_FLOAT_FORMAT +uniform highp sampler2D u_dem;uniform highp sampler2D u_dem_prev; +#else +uniform sampler2D u_dem;uniform sampler2D u_dem_prev; +#endif +uniform vec4 u_dem_unpack;uniform vec2 u_dem_tl;uniform vec2 u_dem_tl_prev;uniform float u_dem_scale;uniform float u_dem_scale_prev;uniform float u_dem_size;uniform float u_dem_lerp;uniform float u_exaggeration;uniform float u_meter_to_dem;uniform mat4 u_label_plane_matrix_inv;uniform sampler2D u_depth;uniform vec2 u_depth_size_inv;vec4 tileUvToDemSample(vec2 uv,float dem_size,float dem_scale,vec2 dem_tl) {vec2 pos=dem_size*(uv*dem_scale+dem_tl)+1.0;vec2 f=fract(pos);return vec4((pos-f+0.5)/(dem_size+2.0),f);}float decodeElevation(vec4 v) {return dot(vec4(v.xyz*255.0,-1.0),u_dem_unpack);}float currentElevation(vec2 apos) { +#ifdef TERRAIN_DEM_FLOAT_FORMAT +vec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale+u_dem_tl)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture2D(u_dem,pos).a; +#else +float dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale,u_dem_tl);vec2 pos=r.xy;vec2 f=r.zw;float tl=decodeElevation(texture2D(u_dem,pos)); +#ifdef TERRAIN_DEM_NEAREST_FILTER +return u_exaggeration*tl; +#endif +float tr=decodeElevation(texture2D(u_dem,pos+vec2(dd,0.0)));float bl=decodeElevation(texture2D(u_dem,pos+vec2(0.0,dd)));float br=decodeElevation(texture2D(u_dem,pos+vec2(dd,dd)));return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y); +#endif +}float prevElevation(vec2 apos) { +#ifdef TERRAIN_DEM_FLOAT_FORMAT +vec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale_prev+u_dem_tl_prev)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture2D(u_dem_prev,pos).a; +#else +float dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale_prev,u_dem_tl_prev);vec2 pos=r.xy;vec2 f=r.zw;float tl=decodeElevation(texture2D(u_dem_prev,pos));float tr=decodeElevation(texture2D(u_dem_prev,pos+vec2(dd,0.0)));float bl=decodeElevation(texture2D(u_dem_prev,pos+vec2(0.0,dd)));float br=decodeElevation(texture2D(u_dem_prev,pos+vec2(dd,dd)));return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y); +#endif +} +#ifdef TERRAIN_VERTEX_MORPHING +float elevation(vec2 apos) { +#ifdef ZERO_EXAGGERATION +return 0.0; +#endif +float nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);} +#else +float elevation(vec2 apos) { +#ifdef ZERO_EXAGGERATION +return 0.0; +#endif +return currentElevation(apos);} +#endif +highp float unpack_depth(highp vec4 rgba_depth) +{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}bool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w;float depth=unpack_depth(texture2D(u_depth,(coord.xy+1.0)*0.5));return coord.z > depth+0.0005;}float occlusionFade(vec4 frag) {vec3 coord=frag.xyz/frag.w;vec3 df=vec3(5.0*u_depth_size_inv,0.0);vec2 uv=0.5*coord.xy+0.5;vec4 depth=vec4( +unpack_depth(texture2D(u_depth,uv-df.xz)),unpack_depth(texture2D(u_depth,uv+df.xz)),unpack_depth(texture2D(u_depth,uv-df.zy)),unpack_depth(texture2D(u_depth,uv+df.zy)) +);return dot(vec4(0.25),vec4(1.0)-clamp(300.0*(vec4(coord.z-0.001)-depth),0.0,1.0));}vec4 fourSample(vec2 pos,vec2 off) { +#ifdef TERRAIN_DEM_FLOAT_FORMAT +float tl=texture2D(u_dem,pos).a;float tr=texture2D(u_dem,pos+vec2(off.x,0.0)).a;float bl=texture2D(u_dem,pos+vec2(0.0,off.y)).a;float br=texture2D(u_dem,pos+off).a; +#else +vec4 demtl=vec4(texture2D(u_dem,pos).xyz*255.0,-1.0);float tl=dot(demtl,u_dem_unpack);vec4 demtr=vec4(texture2D(u_dem,pos+vec2(off.x,0.0)).xyz*255.0,-1.0);float tr=dot(demtr,u_dem_unpack);vec4 dembl=vec4(texture2D(u_dem,pos+vec2(0.0,off.y)).xyz*255.0,-1.0);float bl=dot(dembl,u_dem_unpack);vec4 dembr=vec4(texture2D(u_dem,pos+off).xyz*255.0,-1.0);float br=dot(dembr,u_dem_unpack); +#endif +return vec4(tl,tr,bl,br);}float flatElevation(vec2 pack) {vec2 apos=floor(pack/8.0);vec2 span=10.0*(pack-apos*8.0);vec2 uvTex=(apos-vec2(1.0,1.0))/8190.0;float size=u_dem_size+2.0;float dd=1.0/size;vec2 pos=u_dem_size*(uvTex*u_dem_scale+u_dem_tl)+1.0;vec2 f=fract(pos);pos=(pos-f+0.5)*dd;vec4 h=fourSample(pos,vec2(dd));float z=mix(mix(h.x,h.y,f.x),mix(h.z,h.w,f.x),f.y);vec2 w=floor(0.5*(span*u_meter_to_dem-1.0));vec2 d=dd*w;h=fourSample(pos-d,2.0*d+vec2(dd));vec4 diff=abs(h.xzxy-h.ywzw);vec2 slope=min(vec2(0.25),u_meter_to_dem*0.5*(diff.xz+diff.yw)/(2.0*w+vec2(1.0)));vec2 fix=slope*span;float base=z+max(fix.x,fix.y);return u_exaggeration*base;}float elevationFromUint16(float word) {return u_exaggeration*(word/ELEVATION_SCALE-ELEVATION_OFFSET);} +#else +float elevation(vec2 pos) { return 0.0; }bool isOccluded(vec4 frag) { return false; }float occlusionFade(vec4 frag) { return 1.0; } +#endif`,Fc=`#ifdef FOG +uniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump mat4 u_fog_matrix;varying vec3 v_fog_pos;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}vec3 fog_position(vec3 pos) {return (u_fog_matrix*vec4(pos,1.0)).xyz;}vec3 fog_position(vec2 pos) {return fog_position(vec3(pos,0.0));}float fog(vec3 pos) {float depth=length(pos);float opacity=fog_opacity(fog_range(depth));return opacity*fog_horizon_blending(pos/depth);} +#endif`,Sa=`#ifdef FOG +uniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump float u_fog_temporal_offset;varying vec3 v_fog_pos;uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform highp vec2 u_viewport;uniform float u_globe_transition;uniform int u_is_globe;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}float globe_glow_progress() {highp vec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix( +mix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float sdf=length(closest_point-u_globe_pos)/u_globe_radius;return sdf+PI*0.5;}float fog_opacity(vec3 pos) {float depth=length(pos);return fog_opacity(fog_range(depth));}vec3 fog_apply(vec3 color,vec3 pos) {float depth=length(pos);float opacity;if (u_is_globe==1) {float glow_progress=globe_glow_progress();float t=mix(glow_progress,depth,u_globe_transition);opacity=fog_opacity(fog_range(t));} else {opacity=fog_opacity(fog_range(depth));opacity*=fog_horizon_blending(pos/depth);}return mix(color,u_fog_color.rgb,opacity);}vec4 fog_apply_from_vert(vec4 color,float fog_opac) {float alpha=EPSILON+color.a;color.rgb=mix(color.rgb/alpha,u_fog_color.rgb,fog_opac)*alpha;return color;}vec3 fog_apply_sky_gradient(vec3 camera_ray,vec3 sky_color) {float horizon_blend=fog_horizon_blending(normalize(camera_ray));return mix(sky_color,u_fog_color.rgb,horizon_blend);}vec4 fog_apply_premultiplied(vec4 color,vec3 pos) {float alpha=EPSILON+color.a;color.rgb=fog_apply(color.rgb/alpha,pos)*alpha;return color;}vec3 fog_dither(vec3 color) {vec2 dither_seed=gl_FragCoord.xy+u_fog_temporal_offset;return dither(color,dither_seed);}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);} +#endif`;let Hu={},vl={};const Lc=[];xl(op,Lc),xl(Ea,Lc),xl(Fc,Lc),xl(Sa,Lc),Hu=wr("",Ea),vl=wr(Sa,Fc);const a0=wr(` +#if __VERSION__ >=300 +#define varying in +#define gl_FragColor glFragColor +#define texture2D texture +#define textureCube texture +out vec4 glFragColor; +#endif +highp vec3 hash(highp vec2 p) {highp vec3 p3=fract(p.xyx*vec3(443.8975,397.2973,491.1871));p3+=dot(p3,p3.yxz+19.19);return fract((p3.xxy+p3.yzz)*p3.zyx);}vec3 dither(vec3 color,highp vec2 seed) {vec3 rnd=hash(seed)+hash(seed+0.59374)-0.5;return color+rnd/255.0;}highp float unpack_depth(highp vec4 rgba_depth) +{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}highp vec4 pack_depth(highp float ndc_z) {highp float depth=ndc_z*0.5+0.5;const highp vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);const highp vec4 bit_mask =vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);highp vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;}`,` +#if __VERSION__ >=300 +#define attribute in +#define varying out +#define texture2D texture +#endif +float wrap(float n,float min,float max) {float d=max-min;float w=mod(mod(n-min,d)+d,d)+min;return (w==min) ? max : w;} +#ifdef PROJECTION_GLOBE_VIEW +vec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) { +#ifndef PROJECTED_POS_ON_VIEWPORT +float tiles=tile_id.z;vec2 mercator=(tile_anchor/EXTENT+tile_id.xy)/tiles;mercator-=mercator_center;mercator.x=wrap(mercator.x,-0.5,0.5);vec4 mercator_tile=vec4(mercator.xy*EXTENT,EXTENT/(2.0*PI),1.0);mercator_tile=matrix*mercator_tile;return mercator_tile.xyz; +#else +return vec3(0.0); +#endif +}vec3 mix_globe_mercator(vec3 globe,vec3 mercator,float t) {return mix(globe,mercator,t);}mat3 globe_mercator_surface_vectors(vec3 pos_normal,vec3 up_dir,float zoom_transition) {vec3 normal=zoom_transition==0.0 ? pos_normal : normalize(mix(pos_normal,up_dir,zoom_transition));vec3 xAxis=normalize(vec3(normal.z,0.0,-normal.x));vec3 yAxis=normalize(cross(normal,xAxis));return mat3(xAxis,yAxis,normal);} +#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;}const vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);//Normalized device coordinate that is not rendered.`),qu=op,ap=` +#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`;var sp={background:wr(`uniform vec4 u_color;uniform float u_opacity; +#ifdef LIGHTING_3D_MODE +varying vec4 v_color; +#endif +void main() {vec4 out_color; +#ifdef LIGHTING_3D_MODE +out_color=v_color; +#else +out_color=u_color; +#endif +#ifdef FOG +out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); +#endif +gl_FragColor=out_color*u_opacity; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`attribute vec2 a_pos;uniform mat4 u_matrix; +#ifdef LIGHTING_3D_MODE +uniform vec4 u_color;varying vec4 v_color; +#endif +void main() {gl_Position=u_matrix*vec4(a_pos,0,1); +#ifdef LIGHTING_3D_MODE +v_color=apply_lighting(u_color); +#endif +#ifdef FOG +v_fog_pos=fog_position(a_pos); +#endif +}`),backgroundPattern:wr(`uniform vec2 u_pattern_tl;uniform vec2 u_pattern_br;uniform vec2 u_texsize;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos;void main() {vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(u_pattern_tl/u_texsize,u_pattern_br/u_texsize,imagecoord);vec4 out_color=texture2D(u_image,pos); +#ifdef LIGHTING_3D_MODE +out_color=apply_lighting(out_color); +#endif +#ifdef FOG +out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); +#endif +gl_FragColor=out_color*u_opacity; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`uniform mat4 u_matrix;uniform vec2 u_pattern_size;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_pattern_size,u_tile_units_to_pixels,a_pos); +#ifdef FOG +v_fog_pos=fog_position(a_pos); +#endif +}`),circle:wr(`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);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep( +antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width) +);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t); +#ifdef LIGHTING_3D_MODE +out_color=apply_lighting(out_color); +#endif +#ifdef FOG +out_color=fog_apply_premultiplied(out_color,v_fog_pos); +#endif +gl_FragColor=out_color*(v_visibility*opacity_t); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`#define NUM_VISIBILITY_RINGS 2 +#define INV_SQRT2 0.70710678 +#define ELEVATION_BIAS 0.0001 +#define NUM_SAMPLES_PER_RING 16 +uniform mat4 u_matrix;uniform mat2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos; +#ifdef PROJECTION_GLOBE_VIEW +attribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir; +#endif +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 +vec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*view_scale;}float cantilevered_elevation(vec2 pos,float radius,float stroke_width,float view_scale) {vec2 c1=pos+calc_offset(vec2(-1,-1),radius,stroke_width,view_scale);vec2 c2=pos+calc_offset(vec2(1,-1),radius,stroke_width,view_scale);vec2 c3=pos+calc_offset(vec2(1,1),radius,stroke_width,view_scale);vec2 c4=pos+calc_offset(vec2(-1,1),radius,stroke_width,view_scale);float h1=elevation(c1)+ELEVATION_BIAS;float h2=elevation(c2)+ELEVATION_BIAS;float h3=elevation(c3)+ELEVATION_BIAS;float h4=elevation(c4)+ELEVATION_BIAS;return max(h4,max(h3,max(h1,h2)));}float circle_elevation(vec2 pos) { +#if defined(TERRAIN) +return elevation(pos)+ELEVATION_BIAS; +#else +return 0.0; +#endif +}vec4 project_vertex(vec2 extrusion,vec4 world_center,vec4 projected_center,float radius,float stroke_width, float view_scale,mat3 surface_vectors) {vec2 sample_offset=calc_offset(extrusion,radius,stroke_width,view_scale); +#ifdef PITCH_WITH_MAP +#ifdef PROJECTION_GLOBE_VIEW +return u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) ); +#else +return u_matrix*( world_center+vec4(sample_offset,0,0) ); +#endif +#else +return projected_center+vec4(sample_offset,0,0); +#endif +}float get_sample_step() { +#ifdef PITCH_WITH_MAP +return 2.0*PI/float(NUM_SAMPLES_PER_RING); +#else +return PI/float(NUM_SAMPLES_PER_RING); +#endif +}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);vec4 world_center;mat3 surface_vectors; +#ifdef PROJECTION_GLOBE_VIEW +vec3 pos_normal_3=a_pos_normal_3/16384.0;surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(circle_center)*circle_elevation(circle_center);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*circle_elevation(circle_center);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,circle_center,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);world_center=vec4(pos,1); +#else +surface_vectors=mat3(1.0);float height=circle_elevation(circle_center);world_center=vec4(circle_center,height,1); +#endif +vec4 projected_center=u_matrix*world_center;float view_scale=0.0; +#ifdef PITCH_WITH_MAP +#ifdef SCALE_WITH_MAP +view_scale=1.0; +#else +view_scale=projected_center.w/u_camera_to_center_distance; +#endif +#else +#ifdef SCALE_WITH_MAP +view_scale=u_camera_to_center_distance; +#else +view_scale=projected_center.w; +#endif +#endif +gl_Position=project_vertex(extrude,world_center,projected_center,radius,stroke_width,view_scale,surface_vectors);float visibility=0.0; +#ifdef TERRAIN +float step=get_sample_step();vec4 occlusion_world_center;vec4 occlusion_projected_center; +#ifdef PITCH_WITH_MAP +float cantilevered_height=cantilevered_elevation(circle_center,radius,stroke_width,view_scale);occlusion_world_center=vec4(circle_center,cantilevered_height,1);occlusion_projected_center=u_matrix*occlusion_world_center; +#else +occlusion_world_center=world_center;occlusion_projected_center=projected_center; +#endif +for(int ring=0; ring < NUM_VISIBILITY_RINGS; ring++) {float scale=(float(ring)+1.0)/float(NUM_VISIBILITY_RINGS);for(int i=0; i < NUM_SAMPLES_PER_RING; i++) {vec2 extrusion=vec2(cos(step*float(i)),-sin(step*float(i)))*scale;vec4 frag_pos=project_vertex(extrusion,occlusion_world_center,occlusion_projected_center,radius,stroke_width,view_scale,surface_vectors);visibility+=float(!isOccluded(frag_pos));}}visibility/=float(NUM_VISIBILITY_RINGS)*float(NUM_SAMPLES_PER_RING); +#else +visibility=1.0; +#endif +#ifdef PROJECTION_GLOBE_VIEW +visibility=1.0; +#endif +v_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur); +#ifdef FOG +v_fog_pos=fog_position(world_center.xyz); +#endif +}`),clippingMask:wr("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:wr(`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 FOG +if (u_is_globe==0) {gl_FragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);} +#endif +#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; +#ifdef PROJECTION_GLOBE_VIEW +attribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir; +#endif +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;vec2 tilePos=floor(a_pos*0.5);vec3 pos; +#ifdef PROJECTION_GLOBE_VIEW +vec3 pos_normal_3=a_pos_normal_3/16384.0;mat3 surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(tilePos)*elevation(tilePos);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*elevation(tilePos);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,tilePos,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition); +#else +pos=vec3(tilePos+extrude,elevation(tilePos)); +#endif +gl_Position=u_matrix*vec4(pos,1); +#ifdef FOG +v_fog_pos=fog_position(pos); +#endif +}`),heatmapTexture:wr(`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 +}`,"attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=a_pos*0.5+0.5;}"),collisionBox:wr("varying float v_placed;varying float v_notUsed;void main() {vec4 red =vec4(1.0,0.0,0.0,1.0);vec4 blue=vec4(0.0,0.0,1.0,0.5);gl_FragColor =mix(red,blue,step(0.5,v_placed))*0.5;gl_FragColor*=mix(1.0,0.1,step(0.5,v_notUsed));}",`attribute vec3 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;attribute float a_size_scale;attribute vec2 a_padding;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_pos+elevationVector(a_anchor_pos)*elevation(a_anchor_pos),1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp( +0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,1.5);gl_Position=projectedPoint;gl_Position.xy+=(a_extrude*a_size_scale+a_shift+a_padding)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}`),collisionCircle:wr("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_2f;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_2f;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:wr("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; +#ifdef PROJECTION_GLOBE_VIEW +attribute vec3 a_pos_3; +#endif +varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {float h=elevation(a_pos);v_uv=a_pos/8192.0; +#ifdef PROJECTION_GLOBE_VIEW +gl_Position=u_matrix*vec4(a_pos_3+elevationVector(a_pos)*h,1); +#else +gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1); +#endif +}`),fill:wr(`#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 +vec4 out_color=color; +#ifdef LIGHTING_3D_MODE +out_color=apply_lighting(out_color); +#endif +#ifdef FOG +out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); +#endif +gl_FragColor=out_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); +#ifdef FOG +v_fog_pos=fog_position(a_pos); +#endif +}`),fillOutline:wr(`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);vec4 out_color=outline_color; +#ifdef LIGHTING_3D_MODE +out_color=apply_lighting(out_color); +#endif +#ifdef FOG +out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); +#endif +gl_FragColor=out_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; +#ifdef FOG +v_fog_pos=fog_position(a_pos); +#endif +}`),fillOutlinePattern:wr(`uniform vec2 u_texsize;uniform sampler2D u_image;varying vec2 v_pos;varying vec2 v_pos_world; +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp vec4 pattern +void main() { +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump vec4 pattern +vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);float dist=length(v_pos_world-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=texture2D(u_image,pos); +#ifdef LIGHTING_3D_MODE +out_color=apply_lighting(out_color); +#endif +#ifdef FOG +out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); +#endif +gl_FragColor=out_color*(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 float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos;varying vec2 v_pos_world; +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp vec4 pattern +#pragma mapbox: define lowp float pixel_ratio +void main() { +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump vec4 pattern +#pragma mapbox: initialize lowp float pixel_ratio +vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);v_pos_world=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world; +#ifdef FOG +v_fog_pos=fog_position(a_pos); +#endif +}`),fillPattern:wr(`uniform vec2 u_texsize;uniform sampler2D u_image;varying vec2 v_pos; +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp vec4 pattern +void main() { +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump vec4 pattern +vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);vec4 out_color=texture2D(u_image,pos); +#ifdef LIGHTING_3D_MODE +out_color=apply_lighting(out_color); +#endif +#ifdef FOG +out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); +#endif +gl_FragColor=out_color*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 float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos; +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp vec4 pattern +#pragma mapbox: define lowp float pixel_ratio +void main() { +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump vec4 pattern +#pragma mapbox: initialize lowp float pixel_ratio +vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos); +#ifdef FOG +v_fog_pos=fog_position(a_pos); +#endif +}`),fillExtrusion:wr(`varying vec4 v_color; +#ifdef RENDER_SHADOWS +varying highp vec4 v_pos_light_view_0;varying highp vec4 v_pos_light_view_1;varying float v_depth; +#endif +#ifdef FAUX_AO +uniform lowp vec2 u_ao;varying vec3 v_ao; +#endif +#ifdef ZERO_ROOF_RADIUS +varying vec4 v_roof_color; +#endif +#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) +varying highp vec3 v_normal; +#endif +void main() { +#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) +vec3 normal=v_normal; +#endif +float z;vec4 color; +#ifdef ZERO_ROOF_RADIUS +z=float(normal.z > 0.00001);color=mix(v_color,v_roof_color,z); +#else +color=v_color; +#endif +#ifdef FAUX_AO +float intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x; +#ifdef ZERO_ROOF_RADIUS +concave*=(1.0-z); +#endif +float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);color.rgb=color.rgb*shade; +#endif +#ifdef RENDER_SHADOWS +#ifdef ZERO_ROOF_RADIUS +normal=mix(normal,vec3(0.0,0.0,1.0),z); +#endif +color.xyz=shadowed_color_normal(color.xyz,normalize(normal),v_pos_light_view_0,v_pos_light_view_1,v_depth); +#endif +#ifdef FOG +color=fog_dither(fog_apply_premultiplied(color,v_fog_pos)); +#endif +gl_FragColor=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;uniform float u_edge_radius;attribute vec4 a_pos_normal_ed;attribute vec2 a_centroid_pos; +#ifdef PROJECTION_GLOBE_VIEW +attribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift; +#endif +varying vec4 v_color; +#ifdef RENDER_SHADOWS +uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;varying highp vec4 v_pos_light_view_0;varying highp vec4 v_pos_light_view_1;varying float v_depth; +#endif +#ifdef ZERO_ROOF_RADIUS +varying vec4 v_roof_color; +#endif +#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) +varying highp vec3 v_normal; +#endif +#ifdef FAUX_AO +uniform lowp vec2 u_ao;varying vec3 v_ao; +#endif +#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 +vec4 pos_nx=floor(a_pos_normal_ed*0.5);vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0)); +#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) +v_normal=normal; +#endif +base=max(0.0,base);height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0); +#if defined(HAS_CENTROID) || defined(TERRAIN) +centroid_pos=a_centroid_pos; +#endif +float ele=0.0;float h=0.0;float c_ele;vec3 pos; +#ifdef TERRAIN +bool flat_roof=centroid_pos.x !=0.0 && t > 0.0;ele=elevation(pos_nx.xy);c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);pos=vec3(pos_nx.xy,h); +#else +h=t > 0.0 ? height : base;pos=vec3(pos_nx.xy,h); +#endif +#ifdef PROJECTION_GLOBE_VIEW +float lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*h);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,pos.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*pos.z;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition); +#endif +float hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden); +#ifdef RENDER_SHADOWS +v_pos_light_view_0=u_light_matrix_0*vec4(pos,1);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1);v_depth=gl_Position.w; +#endif +float NdotL=0.0;float colorvalue=0.0; +#ifdef LIGHTING_3D_MODE +NdotL=calculate_NdotL(normal); +#else +colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),NdotL); +#endif +if (normal.y !=0.0) {float r=0.84; +#ifndef LIGHTING_3D_MODE +r=mix(0.7,0.98,1.0-u_lightintensity); +#endif +NdotL*=( +(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}v_color=vec4(0.0,0.0,0.0,1.0); +#ifdef FAUX_AO +float concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height; +#ifdef TERRAIN +top_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height); +#endif +v_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]); +#ifdef PROJECTION_GLOBE_VIEW +top_height+=u_height_lift; +#endif +gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w; +#endif +#ifdef LIGHTING_3D_MODE +v_color=apply_lighting(color,NdotL); +#else +v_color.rgb+=clamp(color.rgb*NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0)); +#endif +v_color*=u_opacity; +#ifdef ZERO_ROOF_RADIUS +v_roof_color=vec4(0.0,0.0,0.0,1.0); +#ifdef LIGHTING_3D_MODE +v_roof_color=apply_lighting(color,calculate_NdotL(vec3(0.0,0.0,1.0))); +#else +float roofNdotL=clamp(u_lightpos.z,0.0,1.0);roofNdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),roofNdotL);v_roof_color.rgb+=clamp(color.rgb*roofNdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0)); +#endif +v_roof_color*=u_opacity; +#endif +#ifdef FOG +v_fog_pos=fog_position(pos); +#endif +}`),fillExtrusionPattern:wr(`uniform vec2 u_texsize;uniform sampler2D u_image; +#ifdef FAUX_AO +uniform lowp vec2 u_ao;varying vec3 v_ao; +#endif +#ifdef LIGHTING_3D_MODE +varying float v_NdotL; +#endif +varying vec2 v_pos;varying vec4 v_lighting;uniform lowp float u_opacity; +#pragma mapbox: define lowp float base +#pragma mapbox: define lowp float height +#pragma mapbox: define lowp vec4 pattern +#pragma mapbox: define lowp float pixel_ratio +void main() { +#pragma mapbox: initialize lowp float base +#pragma mapbox: initialize lowp float height +#pragma mapbox: initialize mediump vec4 pattern +#pragma mapbox: initialize lowp float pixel_ratio +vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);vec4 out_color=texture2D(u_image,pos); +#ifdef LIGHTING_3D_MODE +out_color=apply_lighting(out_color,v_NdotL)*u_opacity; +#else +out_color=out_color*v_lighting; +#endif +#ifdef FAUX_AO +float intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);out_color.rgb=out_color.rgb*shade; +#endif +#ifdef FOG +out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); +#endif +gl_FragColor=out_color; +#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 float u_tile_units_to_pixels;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 vec4 a_pos_normal_ed;attribute vec2 a_centroid_pos; +#ifdef PROJECTION_GLOBE_VIEW +attribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift; +#endif +varying vec2 v_pos;varying vec4 v_lighting; +#ifdef FAUX_AO +uniform lowp vec2 u_ao;varying vec3 v_ao; +#endif +#ifdef LIGHTING_3D_MODE +varying float v_NdotL; +#endif +#pragma mapbox: define lowp float base +#pragma mapbox: define lowp float height +#pragma mapbox: define lowp vec4 pattern +#pragma mapbox: define lowp float pixel_ratio +void main() { +#pragma mapbox: initialize lowp float base +#pragma mapbox: initialize lowp float height +#pragma mapbox: initialize mediump vec4 pattern +#pragma mapbox: initialize lowp float pixel_ratio +vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec4 pos_nx=floor(a_pos_normal_ed*0.5);mediump vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;mediump vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));float edgedistance=a_pos_normal_ed.w;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;base=max(0.0,base);height=max(0.0,height);float t=top_up_ny.x;float z=t > 0.0 ? height : base;vec2 centroid_pos=vec2(0.0); +#if defined(HAS_CENTROID) || defined(TERRAIN) +centroid_pos=a_centroid_pos; +#endif +float ele=0.0;float h=z;vec3 p;float c_ele; +#ifdef TERRAIN +bool flat_roof=centroid_pos.x !=0.0 && t > 0.0;ele=elevation(pos_nx.xy);c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);p=vec3(pos_nx.xy,h); +#else +p=vec3(pos_nx.xy,z); +#endif +#ifdef PROJECTION_GLOBE_VIEW +float lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*(p.z+lift));vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,p.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*p.z;p=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition); +#endif +float hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);gl_Position=mix(u_matrix*vec4(p,1),AWAY,hidden);vec2 pos=normal.z==1.0 +? pos_nx.xy +: vec2(edgedistance,z*u_height_factor);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float NdotL=0.0; +#ifdef LIGHTING_3D_MODE +NdotL=calculate_NdotL(normal); +#else +NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),NdotL); +#endif +if (normal.y !=0.0) {float r=0.84; +#ifndef LIGHTING_3D_MODE +r=mix(0.7,0.98,1.0-u_lightintensity); +#endif +NdotL*=( +(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));} +#ifdef FAUX_AO +float concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height; +#ifdef TERRAIN +top_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height); +#endif +v_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]); +#ifdef PROJECTION_GLOBE_VIEW +top_height+=u_height_lift; +#endif +gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w; +#endif +#ifdef LIGHTING_3D_MODE +v_NdotL=NdotL; +#else +v_lighting.rgb+=clamp(NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity; +#endif +#ifdef FOG +v_fog_pos=fog_position(p); +#endif +}`),hillshadePrepare:wr(`#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) { +#ifdef TERRAIN_DEM_FLOAT_FORMAT +return texture2D(u_image,coord).a/4.0; +#else +vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0; +#endif +}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y));float b=getElevation(v_pos+vec2(0,-epsilon.y));float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y));float d=getElevation(v_pos+vec2(-epsilon.x,0));float e=getElevation(v_pos+vec2(epsilon.x,0));float f=getElevation(v_pos+vec2(-epsilon.x,epsilon.y));float g=getElevation(v_pos+vec2(0,epsilon.y));float h=getElevation(v_pos+vec2(epsilon.x,epsilon.y));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+e+e+h)-(a+d+d+f),(f+g+g+h)-(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:wr(`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;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 LIGHTING_3D_MODE +gl_FragColor=apply_lighting(gl_FragColor); +#endif +#ifdef FOG +gl_FragColor=fog_dither(fog_apply_premultiplied(gl_FragColor,v_fog_pos)); +#endif +#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; +#ifdef FOG +v_fog_pos=fog_position(a_pos); +#endif +}`),line:wr(`uniform lowp float u_device_pixel_ratio;uniform float u_alpha_discard_threshold;uniform highp vec2 u_trim_offset;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec4 v_uv; +#ifdef RENDER_LINE_DASH +uniform sampler2D u_dash_image;varying vec2 v_tex; +#endif +#ifdef RENDER_LINE_GRADIENT +uniform sampler2D u_gradient_image; +#endif +uniform float u_border_width;uniform vec4 u_border_color;float luminance(vec3 c) {return (c.r+c.r+c.b+c.g+c.g+c.g)*0.1667;} +#pragma mapbox: define highp vec4 color +#pragma mapbox: define lowp float floorwidth +#pragma mapbox: define lowp vec4 dash +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +float linearstep(float edge0,float edge1,float x) {return clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main() { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize lowp float floorwidth +#pragma mapbox: initialize lowp vec4 dash +#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); +#ifdef RENDER_LINE_DASH +float sdfdist=texture2D(u_dash_image,v_tex).a;float sdfgamma=1.0/(2.0*u_device_pixel_ratio)/dash.z;alpha*=linearstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist); +#endif +highp vec4 out_color; +#ifdef RENDER_LINE_GRADIENT +out_color=texture2D(u_gradient_image,v_uv.xy); +#else +out_color=color; +#endif +float trimmed=1.0; +#ifdef RENDER_LINE_TRIM_OFFSET +highp float start=v_uv[2];highp float end=v_uv[3];highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=(start+(v_uv.x)*(end-start));if (trim_end > trim_start) {if (line_progress <=trim_end && line_progress >=trim_start) {out_color=vec4(0,0,0,0);trimmed=0.0;}} +#endif +#ifdef LIGHTING_3D_MODE +out_color=apply_lighting(out_color); +#endif +#ifdef FOG +out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); +#endif +#ifdef RENDER_LINE_ALPHA_DISCARD +if (alpha < u_alpha_discard_threshold) {discard;} +#endif +#ifdef RENDER_LINE_BORDER +float edgeBlur=(u_border_width+1.0/u_device_pixel_ratio);float alpha2=clamp(min(dist-(v_width2.t-edgeBlur),v_width2.s-dist)/edgeBlur,0.0,1.0);if (alpha2 < 1.) {float smoothAlpha=smoothstep(0.6,1.0,alpha2); +#ifdef RENDER_LINE_BORDER_AUTO +float Y=(out_color.a > 0.01) ? luminance(out_color.rgb/out_color.a) : 1.;float adjustment=(Y > 0.) ? 0.5/Y : 0.45;if (out_color.a > 0.25 && Y < 0.25) {vec3 borderColor=(Y > 0.) ? out_color.rgb : vec3(1,1,1)*out_color.a;out_color.rgb=out_color.rgb+borderColor*(adjustment*(1.0-smoothAlpha));} else {out_color.rgb*=(0.6 +0.4*smoothAlpha);} +#else +out_color.rgb=mix(u_border_color.rgb*u_border_color.a*trimmed,out_color.rgb,smoothAlpha); +#endif +} +#endif +gl_FragColor=out_color*(alpha*opacity); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,` +#define EXTRUDE_SCALE 0.015873016 +attribute vec2 a_pos_normal;attribute vec4 a_data; +#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) +attribute highp vec4 a_packed; +#endif +#ifdef RENDER_LINE_DASH +attribute float a_linesofar; +#endif +uniform mat4 u_matrix;uniform mat2 u_pixels_to_tile_units;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 vec4 v_uv; +#ifdef RENDER_LINE_DASH +uniform vec2 u_texsize;uniform float u_tile_units_to_pixels;varying vec2 v_tex; +#endif +#ifdef RENDER_LINE_GRADIENT +uniform float u_image_height; +#endif +#pragma mapbox: define highp vec4 color +#pragma mapbox: define lowp float floorwidth +#pragma mapbox: define lowp vec4 dash +#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 floorwidth +#pragma mapbox: initialize lowp vec4 dash +#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;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*EXTRUDE_SCALE;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*EXTRUDE_SCALE*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist*u_pixels_to_tile_units,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude; +#ifndef RENDER_TO_TEXTURE +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; +#else +v_gamma_scale=1.0; +#endif +#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) +float a_uv_x=a_packed[0];float a_split_index=a_packed[1];highp float a_clip_start=a_packed[2];highp float a_clip_end=a_packed[3]; +#ifdef RENDER_LINE_GRADIENT +highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec4(a_uv_x,a_split_index*texel_height-half_texel_height,a_clip_start,a_clip_end); +#else +v_uv=vec4(a_uv_x,0.0,a_clip_start,a_clip_end); +#endif +#endif +#ifdef RENDER_LINE_DASH +float scale=dash.z==0.0 ? 0.0 : u_tile_units_to_pixels/dash.z;float height=dash.y;v_tex=vec2(a_linesofar*scale/floorwidth,(-normal.y*height+dash.x+0.5)/u_texsize.y); +#endif +v_width2=vec2(outset,inset); +#ifdef FOG +v_fog_pos=fog_position(pos); +#endif +}`),linePattern:wr(`uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_tile_units_to_pixels;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 +#pragma mapbox: define lowp float pixel_ratio +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize mediump vec4 pattern +#pragma mapbox: initialize lowp float pixel_ratio +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;vec2 pattern_size=vec2(display_size.x/u_tile_units_to_pixels,display_size.y);float aspect=display_size.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=mod(v_linesofar/pattern_size.x*aspect,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(x,y));vec4 color=texture2D(u_image,pos); +#ifdef LIGHTING_3D_MODE +color=apply_lighting(color); +#endif +#ifdef FOG +color=fog_dither(fog_apply_premultiplied(color,v_fog_pos)); +#endif +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_linesofar;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mat2 u_pixels_to_tile_units;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 +#pragma mapbox: define lowp float pixel_ratio +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 +#pragma mapbox: initialize lowp float pixel_ratio +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;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_pixels_to_tile_units,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude; +#ifndef RENDER_TO_TEXTURE +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; +#else +v_gamma_scale=1.0; +#endif +v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth; +#ifdef FOG +v_fog_pos=fog_position(pos); +#endif +}`),raster:wr(`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);vec3 out_color=mix(u_high_vec,u_low_vec,rgb); +#ifdef LIGHTING_3D_MODE +out_color=apply_lighting(out_color); +#endif +#ifdef FOG +out_color=fog_dither(fog_apply(out_color,v_fog_pos)); +#endif +gl_FragColor=vec4(out_color*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 vec2 u_perspective_transform;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {float w=1.0+dot(a_texture_pos,u_perspective_transform);gl_Position=u_matrix*vec4(a_pos*w,0,w);v_pos0=a_texture_pos/8192.0;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent; +#ifdef FOG +v_fog_pos=fog_position(a_pos); +#endif +}`),symbolIcon:wr(`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_tex_size;attribute vec4 a_pixeloffset;attribute vec4 a_projected_pos;attribute float a_fade_opacity; +#ifdef PROJECTION_GLOBE_VIEW +attribute vec3 a_globe_anchor;attribute vec3 a_globe_normal; +#endif +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 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 vec3 u_up_vector; +#ifdef PROJECTION_GLOBE_VIEW +uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix; +#endif +varying vec2 v_tex;varying float v_fade_opacity; +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize lowp float opacity +vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_min_font_scale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[3];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 tile_anchor=a_pos;vec3 h=elevationVector(tile_anchor)*elevation(tile_anchor);float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos; +#ifdef PROJECTION_GLOBE_VIEW +mercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos=mix_globe_mercator(a_globe_anchor+h,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0; +#else +world_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0; +#endif +vec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.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,1.5);size*=perspective_ratio;float font_scale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjected_point; +#ifdef PROJECTION_GLOBE_VIEW +vec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetProjected_point=u_matrix*vec4(a_globe_anchor+displacement,1); +#else +offsetProjected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1); +#endif +vec2 a=projected_point.xy/projected_point.w;vec2 b=offsetProjected_point.xy/offsetProjected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos; +#ifdef PROJECTION_GLOBE_VIEW +vec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0); +#else +projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0); +#endif +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);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*max(a_min_font_scale,font_scale)+a_pxoffset/16.0); +#ifdef TERRAIN +#ifdef PITCH_WITH_MAP_TERRAIN +vec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy); +#endif +#endif +float occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade; +#ifdef PROJECTION_GLOBE_VIEW +vec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0)); +#else +gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0)); +#endif +float projection_transition_fade=1.0; +#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW) +projection_transition_fade=1.0-step(EPSILON,u_zoom_transition); +#endif +v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;v_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change))*projection_transition_fade;}`),symbolSDF:wr(`#define SDF_PX 8.0 +uniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1; +#pragma mapbox: define highp vec4 fill_color +#pragma mapbox: define highp vec4 halo_color +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp float halo_width +#pragma mapbox: define lowp float halo_blur +void main() { +#pragma mapbox: initialize highp vec4 fill_color +#pragma mapbox: initialize highp vec4 halo_color +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize lowp float halo_width +#pragma mapbox: initialize lowp float halo_blur +float EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`attribute vec4 a_pos_offset;attribute vec4 a_tex_size;attribute vec4 a_pixeloffset;attribute vec4 a_projected_pos;attribute float a_fade_opacity; +#ifdef PROJECTION_GLOBE_VIEW +attribute vec3 a_globe_anchor;attribute vec3 a_globe_normal; +#endif +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_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 vec3 u_up_vector; +#ifdef PROJECTION_GLOBE_VIEW +uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix; +#endif +varying vec2 v_data0;varying vec3 v_data1; +#pragma mapbox: define highp vec4 fill_color +#pragma mapbox: define highp vec4 halo_color +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp float halo_width +#pragma mapbox: define lowp float halo_blur +void main() { +#pragma mapbox: initialize highp vec4 fill_color +#pragma mapbox: initialize highp vec4 halo_color +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize lowp float halo_width +#pragma mapbox: initialize lowp float halo_blur +vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;highp float segment_angle=-a_projected_pos[3];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 tile_anchor=a_pos;vec3 h=elevationVector(tile_anchor)*elevation(tile_anchor);float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos; +#ifdef PROJECTION_GLOBE_VIEW +mercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos=mix_globe_mercator(a_globe_anchor+h,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0; +#else +world_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0; +#endif +vec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.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,1.5);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetprojected_point; +#ifdef PROJECTION_GLOBE_VIEW +vec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetprojected_point=u_matrix*vec4(a_globe_anchor+displacement,1); +#else +offsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1); +#endif +vec2 a=projected_point.xy/projected_point.w;vec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos; +#ifdef PROJECTION_GLOBE_VIEW +vec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0); +#else +projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0); +#endif +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);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset); +#ifdef TERRAIN +#ifdef PITCH_WITH_MAP_TERRAIN +vec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy); +#endif +#endif +float occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade; +#ifdef PROJECTION_GLOBE_VIEW +vec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0)); +#else +gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0)); +#endif +float gamma_scale=gl_Position.w;float projection_transition_fade=1.0; +#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW) +projection_transition_fade=1.0-step(EPSILON,u_zoom_transition); +#endif +vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity*projection_transition_fade);}`),symbolTextAndIcon:wr(`#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_tex_size;attribute vec4 a_projected_pos;attribute float a_fade_opacity; +#ifdef PROJECTION_GLOBE_VIEW +attribute vec3 a_globe_anchor;attribute vec3 a_globe_normal; +#endif +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_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 vec3 u_up_vector;uniform vec2 u_texsize_icon; +#ifdef PROJECTION_GLOBE_VIEW +uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix; +#endif +varying vec4 v_data0;varying vec4 v_data1; +#pragma mapbox: define highp vec4 fill_color +#pragma mapbox: define highp vec4 halo_color +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp float halo_width +#pragma mapbox: define lowp float halo_blur +void main() { +#pragma mapbox: initialize highp vec4 fill_color +#pragma mapbox: initialize highp vec4 halo_color +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize lowp float halo_width +#pragma mapbox: initialize lowp float halo_blur +vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;highp float segment_angle=-a_projected_pos[3];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 tile_anchor=a_pos;vec3 h=elevationVector(tile_anchor)*elevation(tile_anchor);float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos; +#ifdef PROJECTION_GLOBE_VIEW +mercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos=mix_globe_mercator(a_globe_anchor+h,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0; +#else +world_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0; +#endif +vec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.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,1.5);size*=perspective_ratio;float font_scale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offset_projected_point=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projected_point.xy/projected_point.w;vec2 b=offset_projected_point.xy/offset_projected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos; +#ifdef PROJECTION_GLOBE_VIEW +vec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0); +#else +projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0); +#endif +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);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*font_scale); +#ifdef TERRAIN +#ifdef PITCH_WITH_MAP_TERRAIN +vec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy); +#endif +#endif +float occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade; +#ifdef PROJECTION_GLOBE_VIEW +vec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0)); +#else +gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0)); +#endif +float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));float projection_transition_fade=1.0; +#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW) +projection_transition_fade=1.0-step(EPSILON,u_zoom_transition); +#endif +v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity*projection_transition_fade,is_sdf);}`),terrainRaster:wr(`uniform sampler2D u_image0;varying vec2 v_pos0; +#ifdef FOG +varying float v_fog_opacity; +#endif +#ifdef RENDER_SHADOWS +varying vec4 v_pos_light_view_0;varying vec4 v_pos_light_view_1;varying float v_depth; +#endif +void main() {vec4 color=texture2D(u_image0,v_pos0); +#ifdef RENDER_SHADOWS +color.xyz=shadowed_color(color.xyz,v_pos_light_view_0,v_pos_light_view_1,v_depth); +#endif +#ifdef FOG +#ifdef ZERO_EXAGGERATION +color=fog_dither(fog_apply_premultiplied(color,v_fog_pos)); +#else +color=fog_dither(fog_apply_from_vert(color,v_fog_opacity)); +#endif +#endif +gl_FragColor=color; +#ifdef TERRAIN_WIREFRAME +gl_FragColor=vec4(1.0,0.0,0.0,0.8); +#endif +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`uniform mat4 u_matrix;uniform float u_skirt_height;attribute vec2 a_pos;varying vec2 v_pos0; +#ifdef FOG +varying float v_fog_opacity; +#endif +#ifdef RENDER_SHADOWS +uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;varying vec4 v_pos_light_view_0;varying vec4 v_pos_light_view_1;varying float v_depth; +#endif +const float wireframeOffset=0.00015;void main() {vec3 decomposedPosAndSkirt=decomposeToPosAndSkirt(a_pos);float skirt=decomposedPosAndSkirt.z;vec2 decodedPos=decomposedPosAndSkirt.xy;float elevation=elevation(decodedPos)-skirt*u_skirt_height; +#ifdef TERRAIN_WIREFRAME +elevation+=wireframeOffset; +#endif +v_pos0=decodedPos/8192.0;gl_Position=u_matrix*vec4(decodedPos,elevation,1.0); +#ifdef FOG +#ifdef ZERO_EXAGGERATION +v_fog_pos=fog_position(decodedPos); +#else +v_fog_opacity=fog(fog_position(vec3(decodedPos,elevation))); +#endif +#endif +#ifdef RENDER_SHADOWS +vec3 pos=vec3(decodedPos,elevation);v_pos_light_view_0=u_light_matrix_0*vec4(pos,1.);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1.);v_depth=gl_Position.w; +#endif +}`),terrainDepth:wr(`#ifdef GL_ES +precision highp float; +#endif +varying float v_depth;void main() {gl_FragColor=pack_depth(v_depth);}`,"uniform mat4 u_matrix;attribute vec2 a_pos;varying float v_depth;void main() {float elevation=elevation(a_pos);gl_Position=u_matrix*vec4(a_pos,elevation,1.0);v_depth=gl_Position.z/gl_Position.w;}"),skybox:wr(` +varying lowp vec3 v_uv;uniform lowp samplerCube u_cubemap;uniform lowp float u_opacity;uniform highp float u_temporal_offset;uniform highp vec3 u_sun_direction;float sun_disk(highp vec3 ray_direction,highp vec3 sun_direction) {highp float cos_angle=dot(normalize(ray_direction),sun_direction);const highp float cos_sun_angular_diameter=0.99996192306;const highp float smoothstep_delta=1e-5;return smoothstep( +cos_sun_angular_diameter-smoothstep_delta,cos_sun_angular_diameter+smoothstep_delta,cos_angle);}float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec3 uv=v_uv;const float y_bias=0.015;uv.y+=y_bias;uv.y=pow(abs(uv.y),1.0/5.0);uv.y=map(uv.y,0.0,1.0,-1.0,1.0);vec3 sky_color=textureCube(u_cubemap,uv).rgb; +#ifdef FOG +sky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color); +#endif +sky_color.rgb=dither(sky_color.rgb,gl_FragCoord.xy+u_temporal_offset);sky_color+=0.1*sun_disk(v_uv,u_sun_direction);gl_FragColor=vec4(sky_color*u_opacity,u_opacity); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,Os),skyboxGradient:wr(`varying highp vec3 v_uv;uniform lowp sampler2D u_color_ramp;uniform highp vec3 u_center_direction;uniform lowp float u_radius;uniform lowp float u_opacity;uniform highp float u_temporal_offset;void main() {float progress=acos(dot(normalize(v_uv),u_center_direction))/u_radius;vec4 color=texture2D(u_color_ramp,vec2(progress,0.5)); +#ifdef FOG +color.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a; +#endif +color*=u_opacity;color.rgb=dither(color.rgb,gl_FragCoord.xy+u_temporal_offset);gl_FragColor=color; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,Os),skyboxCapture:wr(` +varying highp vec3 v_position;uniform highp float u_sun_intensity;uniform highp float u_luminance;uniform lowp vec3 u_sun_direction;uniform highp vec4 u_color_tint_r;uniform highp vec4 u_color_tint_m; +#ifdef GL_ES +precision highp float; +#endif +#define BETA_R vec3(5.5e-6,13.0e-6,22.4e-6) +#define BETA_M vec3(21e-6,21e-6,21e-6) +#define MIE_G 0.76 +#define DENSITY_HEIGHT_SCALE_R 8000.0 +#define DENSITY_HEIGHT_SCALE_M 1200.0 +#define PLANET_RADIUS 6360e3 +#define ATMOSPHERE_RADIUS 6420e3 +#define SAMPLE_STEPS 10 +#define DENSITY_STEPS 4 +float ray_sphere_exit(vec3 orig,vec3 dir,float radius) {float a=dot(dir,dir);float b=2.0*dot(dir,orig);float c=dot(orig,orig)-radius*radius;float d=sqrt(b*b-4.0*a*c);return (-b+d)/(2.0*a);}vec3 extinction(vec2 density) {return exp(-vec3(BETA_R*u_color_tint_r.a*density.x+BETA_M*u_color_tint_m.a*density.y));}vec2 local_density(vec3 point) {float height=max(length(point)-PLANET_RADIUS,0.0);float exp_r=exp(-height/DENSITY_HEIGHT_SCALE_R);float exp_m=exp(-height/DENSITY_HEIGHT_SCALE_M);return vec2(exp_r,exp_m);}float phase_ray(float cos_angle) {return (3.0/(16.0*PI))*(1.0+cos_angle*cos_angle);}float phase_mie(float cos_angle) {return (3.0/(8.0*PI))*((1.0-MIE_G*MIE_G)*(1.0+cos_angle*cos_angle))/((2.0+MIE_G*MIE_G)*pow(1.0+MIE_G*MIE_G-2.0*MIE_G*cos_angle,1.5));}vec2 density_to_atmosphere(vec3 point,vec3 light_dir) {float ray_len=ray_sphere_exit(point,light_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(DENSITY_STEPS);vec2 density_point_to_atmosphere=vec2(0.0);for (int i=0; i < DENSITY_STEPS;++i) {vec3 point_on_ray=point+light_dir*((float(i)+0.5)*step_len);density_point_to_atmosphere+=local_density(point_on_ray)*step_len;;}return density_point_to_atmosphere;}vec3 atmosphere(vec3 ray_dir,vec3 sun_direction,float sun_intensity) {vec2 density_orig_to_point=vec2(0.0);vec3 scatter_r=vec3(0.0);vec3 scatter_m=vec3(0.0);vec3 origin=vec3(0.0,PLANET_RADIUS,0.0);float ray_len=ray_sphere_exit(origin,ray_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(SAMPLE_STEPS);for (int i=0; i < SAMPLE_STEPS;++i) {vec3 point_on_ray=origin+ray_dir*((float(i)+0.5)*step_len);vec2 density=local_density(point_on_ray)*step_len;density_orig_to_point+=density;vec2 density_point_to_atmosphere=density_to_atmosphere(point_on_ray,sun_direction);vec2 density_orig_to_atmosphere=density_orig_to_point+density_point_to_atmosphere;vec3 extinction=extinction(density_orig_to_atmosphere);scatter_r+=density.x*extinction;scatter_m+=density.y*extinction;}float cos_angle=dot(ray_dir,sun_direction);float phase_r=phase_ray(cos_angle);float phase_m=phase_mie(cos_angle);vec3 beta_r=BETA_R*u_color_tint_r.rgb*u_color_tint_r.a;vec3 beta_m=BETA_M*u_color_tint_m.rgb*u_color_tint_m.a;return (scatter_r*phase_r*beta_r+scatter_m*phase_m*beta_m)*sun_intensity;}const float A=0.15;const float B=0.50;const float C=0.10;const float D=0.20;const float E=0.02;const float F=0.30;vec3 uncharted2_tonemap(vec3 x) {return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;}void main() {vec3 ray_direction=v_position;ray_direction.y=pow(ray_direction.y,5.0);const float y_bias=0.015;ray_direction.y+=y_bias;vec3 color=atmosphere(normalize(ray_direction),u_sun_direction,u_sun_intensity);float white_scale=1.0748724675633854;color=uncharted2_tonemap((log2(2.0/pow(u_luminance,4.0)))*color)*white_scale;gl_FragColor=vec4(color,1.0);}`,"attribute highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;varying highp vec3 v_position;float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec4 pos=vec4(u_matrix_3f*a_pos_3f,1.0);v_position=pos.xyz;v_position.y*=-1.0;v_position.y=map(v_position.y,-1.0,1.0,0.0,1.0);gl_Position=vec4(a_pos_3f.xy,0.0,1.0);}"),globeRaster:wr(`uniform sampler2D u_image0;varying vec2 v_pos0; +#ifndef FOG +uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform vec2 u_viewport; +#endif +void main() {vec4 color; +#ifdef CUSTOM_ANTIALIASING +vec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix( +mix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);vec3 dir=normalize(ray_dir);vec3 closest_point=dot(u_globe_pos,dir)*dir;float norm_dist_from_center=1.0-length(closest_point-u_globe_pos)/u_globe_radius;const float antialias_pixel=2.0;float antialias_factor=antialias_pixel*fwidth(norm_dist_from_center);float antialias=smoothstep(0.0,antialias_factor,norm_dist_from_center);vec4 raster=texture2D(u_image0,v_pos0);color=vec4(raster.rgb*antialias,raster.a*antialias); +#else +color=texture2D(u_image0,v_pos0); +#endif +#ifdef FOG +color=fog_dither(fog_apply_premultiplied(color,v_fog_pos)); +#endif +gl_FragColor=color; +#ifdef TERRAIN_WIREFRAME +gl_FragColor=vec4(1.0,0.0,0.0,0.8); +#endif +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`uniform mat4 u_proj_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform float u_zoom_transition;uniform vec2 u_merc_center;uniform mat3 u_grid_matrix;uniform float u_skirt_height; +#ifdef GLOBE_POLES +attribute vec3 a_globe_pos;attribute vec2 a_uv; +#else +attribute vec2 a_pos; +#endif +varying vec2 v_pos0;const float wireframeOffset=1e3;float mercatorXfromLng(float lng) {return (180.0+lng)/360.0;}float mercatorYfromLat(float lat) {return (180.0-(RAD_TO_DEG*log(tan(QUARTER_PI+lat/2.0*DEG_TO_RAD))))/360.0;}vec3 latLngToECEF(vec2 latLng) {latLng=DEG_TO_RAD*latLng;float cosLat=cos(latLng[0]);float sinLat=sin(latLng[0]);float cosLng=cos(latLng[1]);float sinLng=sin(latLng[1]);float sx=cosLat*sinLng*GLOBE_RADIUS;float sy=-sinLat*GLOBE_RADIUS;float sz=cosLat*cosLng*GLOBE_RADIUS;return vec3(sx,sy,sz);}void main() { +#ifdef GLOBE_POLES +vec3 globe_pos=a_globe_pos;vec2 uv=a_uv; +#else +float tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float uvY=mercatorY*tiles-idy;float mercatorX=mercatorXfromLng(latLng[1]);float uvX=mercatorX*tiles-idx;vec3 globe_pos=latLngToECEF(latLng.xy);vec2 merc_pos=vec2(mercatorX,mercatorY);vec2 uv=vec2(uvX,uvY); +#endif +v_pos0=uv;vec2 tile_pos=uv*EXTENT;vec3 globe_derived_up_vector=normalize(globe_pos)*u_tile_up_scale; +#ifdef GLOBE_POLES +vec3 up_vector=globe_derived_up_vector; +#else +vec3 up_vector=elevationVector(tile_pos); +#endif +float height=elevation(tile_pos); +#ifdef TERRAIN_WIREFRAME +height+=wireframeOffset; +#endif +globe_pos+=up_vector*height; +#ifndef GLOBE_POLES +globe_pos-=globe_derived_up_vector*u_skirt_height*decomposed_pos_and_skirt.z; +#endif +#ifdef GLOBE_POLES +vec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0); +#else +vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {merc_world_pos=vec4(merc_pos,height-u_skirt_height*decomposed_pos_and_skirt.z,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition),1.0); +#endif +gl_Position=u_proj_matrix*interpolated_pos; +#ifdef FOG +v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz); +#endif +}`),globeAtmosphere:wr(`uniform float u_transition;uniform highp float u_fadeout_range;uniform highp float u_temporal_offset;uniform vec3 u_start_color;uniform vec4 u_color;uniform vec4 u_space_color;uniform vec4 u_high_color;uniform float u_star_intensity;uniform float u_star_size;uniform float u_star_density;uniform float u_horizon_angle;uniform mat4 u_rotation_matrix;varying highp vec3 v_ray_dir;varying highp vec3 v_horizon_dir;highp float random(highp vec3 p) {p=fract(p*vec3(23.2342,97.1231,91.2342));p+=dot(p.zxy,p.yxz+123.1234);return fract(p.x*p.y);}float stars(vec3 p,float scale,vec2 offset) {vec2 uv_scale=(u_viewport/u_star_size)*scale;vec3 position=vec3(p.xy*uv_scale+offset*u_viewport,p.z);vec3 q=fract(position)-0.5;vec3 id=floor(position);float random_visibility=step(random(id),u_star_density);float circle=smoothstep(0.5+u_star_intensity,0.5,length(q));return circle*random_visibility;}void main() {highp vec3 dir=normalize(v_ray_dir);float globe_pos_dot_dir; +#ifdef PROJECTION_GLOBE_VIEW +globe_pos_dot_dir=dot(u_globe_pos,dir);highp vec3 closest_point_forward=abs(globe_pos_dot_dir)*dir;float norm_dist_from_center=length(closest_point_forward-u_globe_pos)/u_globe_radius;if (norm_dist_from_center < 0.98) {discard;return;} +#endif +highp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ? +0.0 : max(acos(dot(dir,horizon_dir)),0.0);float horizon_angle; +#ifdef PROJECTION_GLOBE_VIEW +highp vec3 closest_point=globe_pos_dot_dir*dir;float closest_point_to_center=length(closest_point-u_globe_pos);float theta=asin(clamp(closest_point_to_center/length(u_globe_pos),-1.0,1.0));horizon_angle=globe_pos_dot_dir < 0.0 ? +PI-theta-u_horizon_angle : theta-u_horizon_angle;float angle_t=pow(u_transition,10.0);horizon_angle=mix(horizon_angle,horizon_angle_mercator,angle_t); +#else +horizon_angle=horizon_angle_mercator; +#endif +horizon_angle/=PI;float t=exp(-horizon_angle/u_fadeout_range);float alpha_0=u_color.a;float alpha_1=u_high_color.a;float alpha_2=u_space_color.a;vec3 color_stop_0=u_color.rgb;vec3 color_stop_1=u_high_color.rgb;vec3 color_stop_2=u_space_color.rgb;vec3 c0=mix(color_stop_2,color_stop_1,alpha_1);vec3 c1=mix(c0,color_stop_0,alpha_0);vec3 c2=mix(c0,c1,t);vec3 c =mix(color_stop_2,c2,t);float a0=mix(alpha_2,1.0,alpha_1);float a1=mix(a0,1.0,alpha_0);float a2=mix(a0,a1,t);float a =mix(alpha_2,a2,t);vec2 uv=gl_FragCoord.xy/u_viewport-0.5;float aspect_ratio=u_viewport.x/u_viewport.y;vec4 uv_dir=vec4(normalize(vec3(uv.x*aspect_ratio,uv.y,1.0)),1.0);uv_dir=u_rotation_matrix*uv_dir;vec3 n=abs(uv_dir.xyz);vec2 uv_remap=(n.x > n.y && n.x > n.z) ? uv_dir.yz/uv_dir.x: +(n.y > n.x && n.y > n.z) ? uv_dir.zx/uv_dir.y: +uv_dir.xy/uv_dir.z;uv_remap.x/=aspect_ratio;vec3 D=vec3(uv_remap,1.0);highp float star_field=0.0;if (u_star_intensity > 0.0) {star_field+=stars(D,1.2,vec2(0.0,0.0));star_field+=stars(D,1.0,vec2(1.0,0.0));star_field+=stars(D,0.8,vec2(0.0,1.0));star_field+=stars(D,0.6,vec2(1.0,1.0));star_field*=(1.0-pow(t,0.25+(1.0-u_high_color.a)*0.75));c+=star_field*alpha_2;}c=dither(c,gl_FragCoord.xy+u_temporal_offset);gl_FragColor=vec4(c,a);}`,`attribute vec3 a_pos;attribute vec2 a_uv;uniform vec3 u_frustum_tl;uniform vec3 u_frustum_tr;uniform vec3 u_frustum_br;uniform vec3 u_frustum_bl;uniform float u_horizon;varying highp vec3 v_ray_dir;varying highp vec3 v_horizon_dir;void main() {v_ray_dir=mix( +mix(u_frustum_tl,u_frustum_tr,a_uv.x),mix(u_frustum_bl,u_frustum_br,a_uv.x),a_uv.y);v_horizon_dir=mix( +mix(u_frustum_tl,u_frustum_bl,u_horizon),mix(u_frustum_tr,u_frustum_br,u_horizon),a_uv.x);gl_Position=vec4(a_pos,1.0);}`)};function xl(f,s){const h=f.replace(/\s*\/\/[^\n]*\n/g,` +`).split(` +`);for(let g of h)if(g=g.trim(),g[0]==="#"&&g.includes("if")&&!g.includes("endif")){g=g.replace("#","").replace(/ifdef|ifndef|elif|if/g,"").replace(/!|defined|\(|\)|\|\||&&/g,"").replace(/\s+/g," ").trim();const v=g.split(" ");for(const b of v)s.includes(b)||s.push(b)}}function wr(f,s){const h=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,g=s.match(/attribute (highp |mediump |lowp )?([\w]+) ([\w]+)/g),v={},b=[...Lc];return xl(f,b),xl(s,b),{fragmentSource:f=f.replace(h,(A,I,D,N,B)=>(v[B]=!0,I==="define"?` +#ifndef HAS_UNIFORM_u_${B} +varying ${D} ${N} ${B}; +#else +uniform ${D} ${N} u_${B}; +#endif +`:` +#ifdef HAS_UNIFORM_u_${B} + ${D} ${N} ${B} = u_${B}; +#endif +`)),vertexSource:s=s.replace(h,(A,I,D,N,B)=>{const q=N==="float"?"vec2":"vec4",J=B.match(/color/)?"color":q;return v[B]?I==="define"?` +#ifndef HAS_UNIFORM_u_${B} +uniform lowp float u_${B}_t; +attribute ${D} ${q} a_${B}; +varying ${D} ${N} ${B}; +#else +uniform ${D} ${N} u_${B}; +#endif +`:J==="vec4"?` +#ifndef HAS_UNIFORM_u_${B} + ${B} = a_${B}; +#else + ${D} ${N} ${B} = u_${B}; +#endif +`:` +#ifndef HAS_UNIFORM_u_${B} + ${B} = unpack_mix_${J}(a_${B}, u_${B}_t); +#else + ${D} ${N} ${B} = u_${B}; +#endif +`:I==="define"?` +#ifndef HAS_UNIFORM_u_${B} +uniform lowp float u_${B}_t; +attribute ${D} ${q} a_${B}; +#else +uniform ${D} ${N} u_${B}; +#endif +`:J==="vec4"?` +#ifndef HAS_UNIFORM_u_${B} + ${D} ${N} ${B} = a_${B}; +#else + ${D} ${N} ${B} = u_${B}; +#endif +`:` +#ifndef HAS_UNIFORM_u_${B} + ${D} ${N} ${B} = unpack_mix_${J}(a_${B}, u_${B}_t); +#else + ${D} ${N} ${B} = u_${B}; +#endif +`}),staticAttributes:g,usedDefines:b}}class Xv{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}bind(s,h,g,v,b,A,I){this.context=s;let D=this.boundPaintVertexBuffers.length!==v.length;for(let B=0;!D&&B{const ue=Z.paint.get("hillshade-shadow-color"),he=Z.paint.get("hillshade-highlight-color"),be=Z.paint.get("hillshade-accent-color");let Se=Z.paint.get("hillshade-illumination-direction")*(Math.PI/180);Z.paint.get("hillshade-illumination-anchor")==="viewport"&&(Se-=ie.transform.angle);const we=!ie.options.moving;return{u_matrix:re||ie.transform.calculateProjMatrix(ae.tileID.toUnwrapped(),we),u_image:0,u_latrange:lp(0,ae.tileID),u_light:[Z.paint.get("hillshade-exaggeration"),Se],u_shadow:ue,u_highlight:he,u_accent:be}})(f,h,g,f.terrain?s.projMatrix:null);f.prepareDrawProgram(I,B,s.toUnwrapped());const{tileBoundsBuffer:J,tileBoundsIndexBuffer:ne,tileBoundsSegments:oe}=f.getTileBoundsBuffers(h);B.draw(I,D.TRIANGLES,v,b,A,l.CullFaceMode.disabled,q,g.id,J,ne,oe)}function cp(f,s,h){if(!s.needsDEMTextureUpload)return;const g=f.context,v=g.gl;g.pixelStoreUnpackPremultiplyAlpha.set(!1),s.demTexture=s.demTexture||f.getTileTexture(h.stride);const b=h.getPixels();s.demTexture?s.demTexture.update(b,{premultiply:!1}):s.demTexture=new l.Texture(g,b,v.RGBA,{premultiply:!1}),s.needsDEMTextureUpload=!1}function l0(f,s,h,g,v,b){const A=f.context,I=A.gl;if(!s.dem)return;const D=s.dem;if(A.activeTexture.set(I.TEXTURE1),cp(f,s,D),!s.demTexture)return;s.demTexture.bind(I.NEAREST,I.CLAMP_TO_EDGE);const N=D.dim;A.activeTexture.set(I.TEXTURE0);let B=s.fbo;if(!B){const oe=new l.Texture(A,{width:N,height:N,data:null},I.RGBA);oe.bind(I.LINEAR,I.CLAMP_TO_EDGE),B=s.fbo=A.createFramebuffer(N,N,!0),B.colorAttachment.set(oe.texture)}A.bindFramebuffer.set(B.framebuffer),A.viewport.set([0,0,N,N]);const{tileBoundsBuffer:q,tileBoundsIndexBuffer:J,tileBoundsSegments:ne}=f.getMercatorTileBoundsBuffers();f.useProgram("hillshadePrepare").draw(A,I.TRIANGLES,g,v,b,l.CullFaceMode.disabled,((oe,ie)=>{const ae=ie.stride,Z=l.create();return l.ortho(Z,0,l.EXTENT,-l.EXTENT,0,0,1),l.translate(Z,Z,[0,-l.EXTENT,0]),{u_matrix:Z,u_image:1,u_dimension:[ae,ae],u_zoom:oe.overscaledZ,u_unpack:ie.unpackVector}})(s.tileID,D),h.id,q,J,ne),s.needsHillshadePrepare=!1}const up=f=>({u_matrix:new l.UniformMatrix4f(f),u_image0:new l.Uniform1i(f),u_skirt_height:new l.Uniform1f(f)}),bl=(f,s)=>({u_matrix:f,u_image0:0,u_skirt_height:s}),Zu=(f,s,h,g,v,b,A,I,D,N,B,q,J,ne,oe)=>({u_proj_matrix:Float32Array.from(f),u_globe_matrix:s,u_normalize_matrix:Float32Array.from(g),u_merc_matrix:h,u_zoom_transition:v,u_merc_center:b,u_image0:0,u_frustum_tl:A,u_frustum_tr:I,u_frustum_br:D,u_frustum_bl:N,u_globe_pos:B,u_globe_radius:q,u_viewport:J,u_grid_matrix:oe?Float32Array.from(oe):new Float32Array(9),u_skirt_height:ne});function wl(f,s){return f!=null&&s!=null&&!(!f.hasData()||!s.hasData())&&f.demTexture!=null&&s.demTexture!=null&&f.tileID.key!==s.tileID.key}const Ta=new class{constructor(){this.operations={}}newMorphing(f,s,h,g,v){if(f in this.operations){const b=this.operations[f];b.to.tileID.key!==h.tileID.key&&(b.queued=h)}else this.operations[f]={startTime:g,phase:0,duration:v,from:s,to:h,queued:null}}getMorphValuesForProxy(f){if(!(f in this.operations))return null;const s=this.operations[f];return{from:s.from,to:s.to,phase:s.phase}}update(f){for(const s in this.operations){const h=this.operations[s];for(h.phase=(f-h.startTime)/h.duration;h.phase>=1||!this._validOp(h);)if(!this._nextOp(h,f)){delete this.operations[s];break}}}_nextOp(f,s){return!!f.queued&&(f.from=f.to,f.to=f.queued,f.queued=null,f.phase=0,f.startTime=s,!0)}_validOp(f){return f.from.hasData()&&f.to.hasData()}},Fs={0:null,1:"TERRAIN_VERTEX_MORPHING",2:"TERRAIN_WIREFRAME"};function Ku(f){return 6*Math.pow(1.5,22-f)}function c0(f,s){const h=1<({u_matrix:f});function hp(f,s,h,g,v){if(v>0){const b=l.exported.now(),A=(b-f.timeAdded)/v,I=s?(b-s.timeAdded)/v:-1,D=h.getSource(),N=g.coveringZoomLevel({tileSize:D.tileSize,roundZoom:D.roundZoom}),B=!s||Math.abs(s.tileID.overscaledZ-N)>Math.abs(f.tileID.overscaledZ-N),q=B&&f.refreshedUponExpiration?1:l.clamp(B?A:1-I,0,1);return f.refreshedUponExpiration&&A>=1&&(f.refreshedUponExpiration=!1),s?{opacity:1,mix:1-q}:{opacity:q,mix:0}}return{opacity:1,mix:0}}class dp extends l.SourceCache{constructor(s){const h={type:"raster-dem",maxzoom:s.transform.maxZoom},g=new gt(ml(),null),v=Qt("mock-dem",h,g,s.style);super("mock-dem",v,!1),v.setEventedParent(this),this._sourceLoaded=!0}_loadTile(s,h){s.state="loaded",h(null)}}class Xu extends l.SourceCache{constructor(s){const h=Qt("proxy",{type:"geojson",maxzoom:s.transform.maxZoom},new gt(ml(),null),s.style);super("proxy",h,!1),h.setEventedParent(this),this.map=this.getSource().map=s,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(s,h,g){if(s.freezeTileCoverage)return;this.transform=s;const v=s.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce((b,A)=>{if(b[A.key]="",!this._tiles[A.key]){const I=new l.Tile(A,this._source.tileSize*A.overscaleFactor(),s.tileZoom);I.state="loaded",this._tiles[A.key]=I}return b},{});for(const b in this._tiles)b in v||(this.freeFBO(b),this._tiles[b].unloadVectorData(),delete this._tiles[b])}freeFBO(s){const h=this.proxyCachedFBO[s];if(h!==void 0){const g=Object.values(h);this.renderCachePool.push(...g),delete this.proxyCachedFBO[s]}}deallocRenderCache(){this.renderCache.forEach(s=>s.fb.destroy()),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class Yu extends l.OverscaledTileID{constructor(s,h,g){super(s.overscaledZ,s.wrap,s.canonical.z,s.canonical.x,s.canonical.y),this.proxyTileKey=h,this.projMatrix=g}}class pp extends l.Elevation{constructor(s,h){super(),this.painter=s,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[g,v,b]=function(D){const N=new l.StructArrayLayout2i4,B=new l.StructArrayLayout3ui6,q=131;N.reserve(17161),B.reserve(33800);const J=l.EXTENT/128,ne=l.EXTENT+J/2,oe=ne+J;for(let ae=-J;aene||ae<0||ae>ne?24575:0,ue=l.clamp(Math.round(Z),0,l.EXTENT),he=l.clamp(Math.round(ae),0,l.EXTENT);N.emplaceBack(ue+re,he)}const ie=(ae,Z)=>{const re=Z*q+ae;B.emplaceBack(re+1,re,re+q),B.emplaceBack(re+q,re+q+1,re+1)};for(let ae=1;ae<129;ae++)for(let Z=1;Z<129;Z++)ie(Z,ae);return[0,129].forEach(ae=>{for(let Z=0;Z<130;Z++)ie(Z,ae),ie(ae,Z)}),[N,B,32768]}(),A=s.context;this.gridBuffer=A.createVertexBuffer(g,l.posAttributes.members),this.gridIndexBuffer=A.createIndexBuffer(v),this.gridSegments=l.SegmentVector.simpleSegment(0,0,g.length,v.length),this.gridNoSkirtSegments=l.SegmentVector.simpleSegment(0,0,g.length,b),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new Xu(h.map),this.orthoMatrix=l.create(),l.ortho(this.orthoMatrix,this.painter.transform.projection.name==="globe"?.015:0,l.EXTENT,0,l.EXTENT,0,1);const I=A.gl;this._overlapStencilMode=new l.StencilMode({func:I.GEQUAL,mask:255},0,255,I.KEEP,I.KEEP,I.REPLACE),this._previousZoom=s.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=h,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new dp(h.map)}set style(s){s.on("data",this._onStyleDataEvent.bind(this)),s.on("neworder",this._checkRenderCacheEfficiency.bind(this)),this._style=s,this._checkRenderCacheEfficiency(),this._style.map.on("moveend",()=>{this._clearLineLayersFromRenderCache()})}update(s,h,g){if(s&&s.terrain){this._style!==s&&(this.style=s),this.enabled=!0;const v=s.terrain.properties;this.sourceCache=s.terrain.drapeRenderMode===0?this._mockSourceCache:s._getSourceCache(v.get("source")),this._exaggeration=v.get("exaggeration");const b=()=>{this.sourceCache.used&&l.warnOnce(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source. +This leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);const A=this.getScaledDemTileSize();this.sourceCache.update(h,A,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,b(),this._initializing=!0),b(),h.updateElevation(!0,g),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(h),this._emptyDEMTextureDirty=!0}else this._disable()}resetTileLookupCache(s){this._findCoveringTileCache[s]={}}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_checkRenderCacheEfficiency(){const s=this.renderCacheEfficiency(this._style);this._style.map._optimizeForTerrain||s.efficiency!==100&&l.warnOnce(`Terrain render cache efficiency is not optimal (${s.efficiency}%) and performance + may be affected negatively, consider placing all background, fill and line layers before layer + with id '${s.firstUndrapedLayer}' or create a map using optimizeForTerrain: true option.`)}_onStyleDataEvent(s){s.coord&&s.dataType==="source"?this._clearRenderCacheForTile(s.sourceCacheId,s.coord):s.dataType==="style"&&(this._invalidateRenderCache=!0)}_disable(){if(this.enabled&&(this.enabled=!1,this._sharedDepthStencil=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(const s in this._style._sourceCaches)this._style._sourceCaches[s].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this._emptyDepthBufferTexture&&this._emptyDepthBufferTexture.destroy(),this.pool.forEach(s=>s.fb.destroy()),this.pool=[],this._depthFBO&&(this._depthFBO.destroy(),this._depthFBO=void 0,this._depthTexture=void 0)}_source(){return this.enabled?this.sourceCache:null}isUsingMockSource(){return this.sourceCache===this._mockSourceCache}exaggeration(){return this._exaggeration}get visibleDemTiles(){return this._visibleDemTiles}get drapeBufferSize(){const s=2*this.proxySourceCache.getSource().tileSize;return[s,s]}set useVertexMorphing(s){this._useVertexMorphing=s}updateTileBinding(s){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const h=this.proxySourceCache,g=this.painter.transform;this._initializing&&(this._initializing=g._centerAltitude===0&&this.getAtPointOrZero(l.MercatorCoordinate.fromLngLat(g.center),-1)===-1,this._emptyDEMTextureDirty=!this._initializing);const v=this.proxyCoords=h.getIds().map(D=>{const N=h.getTileByID(D).tileID;return N.projMatrix=g.calculateProjMatrix(N.toUnwrapped()),N});(function(D,N){const B=N.transform.pointCoordinate(N.transform.getCameraPoint()),q=new l.Point(B.x,B.y);D.sort((J,ne)=>{if(ne.overscaledZ-J.overscaledZ)return ne.overscaledZ-J.overscaledZ;const oe=new l.Point(J.canonical.x+(1<{this.proxyToSource[D.key]={}}),this.terrainTileForTile={};const A=this._style._sourceCaches;for(const D in A){const N=A[D];if(!N.used||(N!==this.sourceCache&&this.resetTileLookupCache(N.id),this._setupProxiedCoordsForOrtho(N,s[D],b),N.usedForTerrain))continue;const B=s[D];N.getSource().reparseOverscaled&&this._assignTerrainTiles(B)}this.proxiedCoords[h.id]=v.map(D=>new Yu(D,D.key,this.orthoMatrix)),this._assignTerrainTiles(v),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(b),this.renderingToTexture=!1,this._updateTimestamp=l.exported.now();const I={};this._visibleDemTiles=[];for(const D of this.proxyCoords){const N=this.terrainTileForTile[D.key];if(!N)continue;const B=N.tileID.key;B in I||(this._visibleDemTiles.push(N),I[B]=B)}}_assignTerrainTiles(s){this._initializing||s.forEach(h=>{if(this.terrainTileForTile[h.key])return;const g=this._findTileCoveringTileID(h,this.sourceCache);g&&(this.terrainTileForTile[h.key]=g)})}_prepareDEMTextures(){const s=this.painter.context,h=s.gl;for(const g in this.terrainTileForTile){const v=this.terrainTileForTile[g],b=v.dem;!b||v.demTexture&&!v.needsDEMTextureUpload||(s.activeTexture.set(h.TEXTURE1),cp(this.painter,v,b))}}_prepareDemTileUniforms(s,h,g,v){if(!h||h.demTexture==null)return!1;const b=s.tileID.canonical,A=Math.pow(2,h.tileID.canonical.z-b.z),I=v||"";return g[`u_dem_tl${I}`]=[b.x*A%1,b.y*A%1],g[`u_dem_scale${I}`]=A,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}get emptyDepthBufferTexture(){const s=this.painter.context,h=s.gl;if(!this._emptyDepthBufferTexture){const g=new l.RGBAImage({width:1,height:1},Uint8Array.of(255,255,255,255));this._emptyDepthBufferTexture=new l.Texture(s,g,h.RGBA,{premultiply:!1})}return this._emptyDepthBufferTexture}_getLoadedAreaMinimum(){let s=0;const h=this._visibleDemTiles.reduce((g,v)=>{if(!v.dem)return g;const b=v.dem.tree.minimums[0];return b>0&&s++,g+b},0);return s?h/s:0}_updateEmptyDEMTexture(){const s=this.painter.context,h=s.gl;s.activeTexture.set(h.TEXTURE2);const g=this._getLoadedAreaMinimum(),v=new l.RGBAImage({width:1,height:1},new Uint8Array(l.DEMData.pack(g,this.sourceCache.getSource().encoding)));this._emptyDEMTextureDirty=!1;let b=this._emptyDEMTexture;return b?b.update(v,{premultiply:!1}):b=this._emptyDEMTexture=new l.Texture(s,v,h.RGBA,{premultiply:!1}),b}setupElevationDraw(s,h,g){const v=this.painter.context,b=v.gl,A=(I=this.sourceCache.getSource().encoding,{u_dem:2,u_dem_prev:4,u_dem_unpack:l.DEMData.getUnpackVector(I),u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_exaggeration:0});var I;A.u_dem_size=this.sourceCache.getSource().tileSize,A.u_exaggeration=this.exaggeration();let D=null,N=null,B=1;if(g&&g.morphing&&this._useVertexMorphing){const q=g.morphing.srcDemTile,J=g.morphing.dstDemTile;B=g.morphing.phase,q&&J&&(this._prepareDemTileUniforms(s,q,A,"_prev")&&(N=q),this._prepareDemTileUniforms(s,J,A)&&(D=J))}if(N&&D?(v.activeTexture.set(b.TEXTURE2),D.demTexture.bind(b.NEAREST,b.CLAMP_TO_EDGE,b.NEAREST),v.activeTexture.set(b.TEXTURE4),N.demTexture.bind(b.NEAREST,b.CLAMP_TO_EDGE,b.NEAREST),A.u_dem_lerp=B):(D=this.terrainTileForTile[s.tileID.key],v.activeTexture.set(b.TEXTURE2),(this._prepareDemTileUniforms(s,D,A)?D.demTexture:this.emptyDEMTexture).bind(b.NEAREST,b.CLAMP_TO_EDGE)),v.activeTexture.set(b.TEXTURE3),g&&g.useDepthForOcclusion?(this._depthTexture&&this._depthTexture.bind(b.NEAREST,b.CLAMP_TO_EDGE),this._depthFBO&&(A.u_depth_size_inv=[1/this._depthFBO.width,1/this._depthFBO.height])):(this.emptyDepthBufferTexture.bind(b.NEAREST,b.CLAMP_TO_EDGE),A.u_depth_size_inv=[1,1]),g&&g.useMeterToDem&&D){const q=(1<{if(Z===at)return;const Ze=[Fs[at],"PROJECTION_GLOBE_VIEW"];he&&Ze.push("CUSTOM_ANTIALIASING"),ze&&Ze.push(Fs[re]),ae=N.useProgram("globeRaster",null,Ze),Z=at},Se=N.colorModeForRenderPass(),we=new l.DepthMode(ie.LEQUAL,l.DepthMode.ReadWrite,N.depthRangeFor3D);Ta.update(ne);const Ce=l.calculateGlobeMercatorMatrix(ue),Ie=[l.mercatorXfromLng(ue.center.lng),l.mercatorYfromLat(ue.center.lat)],Re=re?[!1,!0]:[!1],st=N.globeSharedBuffers,De=[ue.width*l.exported.devicePixelRatio,ue.height*l.exported.devicePixelRatio],Ke=Float32Array.from(ue.globeMatrix),Ne={useDenormalizedUpVectorScale:!0};if(Re.forEach(at=>{const ze=N.transform,Ze=Ku(ze.zoom)*B.exaggeration();Z=-1;const ut=at?ie.LINES:ie.TRIANGLES;for(const tt of J){const ht=q.getTile(tt),Mt=l.StencilMode.disabled,$t=B.prevTerrainTileForTile[tt.key],It=B.terrainTileForTile[tt.key];wl($t,It)&&Ta.newMorphing(tt.key,$t,It,ne,250),oe.activeTexture.set(ie.TEXTURE0),ht.texture.bind(ie.LINEAR,ie.CLAMP_TO_EDGE);const Lt=Ta.getMorphValuesForProxy(tt.key),nr=Lt?1:0;Lt&&l.extend$1(Ne,{morphing:{srcDemTile:Lt.from,dstDemTile:Lt.to,phase:l.easeCubicInOut(Lt.phase)}});const er=l.tileCornersToBounds(tt.canonical),Pt=l.getLatitudinalLod(er.getCenter().lat),Ar=l.getGridMatrix(tt.canonical,er,Pt,ze.worldSize/ze._pixelsPerMercatorPixel),Mr=l.globeNormalizeECEF(l.globeTileBounds(tt.canonical)),zr=Zu(ze.projMatrix,Ke,Ce,Mr,l.globeToMercatorTransition(ze.zoom),Ie,ze.frustumCorners.TL,ze.frustumCorners.TR,ze.frustumCorners.BR,ze.frustumCorners.BL,ze.globeCenterInViewSpace,ze.globeRadius,De,Ze,Ar);if(be(nr,at),B.setupElevationDraw(ht,ae,Ne),N.prepareDrawProgram(oe,ae,tt.toUnwrapped()),st){const[Rr,ui,Gn]=at?st.getWirefameBuffers(N.context,Pt):st.getGridBuffers(Pt,Ze!==0);ae.draw(oe,ut,we,Mt,Se,l.CullFaceMode.backCCW,zr,"globe_raster",Rr,ui,Gn)}}}),st){const at=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];he&&at.push("CUSTOM_ANTIALIASING"),ae=N.useProgram("globeRaster",null,at);for(const ze of J){const{x:Ze,y:ut,z:tt}=ze.canonical,ht=ut===0,Mt=ut===(1<zr.draw(oe,ie.TRIANGLES,we,l.StencilMode.disabled,Se,l.CullFaceMode.disabled,Zu(ue.projMatrix,Pt,Pt,Ar,0,Ie,ue.frustumCorners.TL,ue.frustumCorners.TR,ue.frustumCorners.BR,ue.frustumCorners.BL,ue.globeCenterInViewSpace,ue.globeRadius,De,0),"globe_pole_raster",Rr,Lt,nr);B.setupElevationDraw(er,ae,Ne),N.prepareDrawProgram(oe,ae,ze.toUnwrapped()),ht&&Mr(ae,$t),Mt&&(Pt=l.scale(l.create(),Pt,[1,-1,1]),Mr(ae,It))}}}})(v,b,A,I,D);else{const N=v.context,B=N.gl;let q,J;const ne=v.options.showTerrainWireframe?2:0,oe=(ue,he)=>{if(J===ue)return;const be=[Fs[ue]];he&&be.push(Fs[ne]),q=v.useProgram("terrainRaster",null,be),J=ue},ie=v.colorModeForRenderPass(),ae=new l.DepthMode(B.LEQUAL,l.DepthMode.ReadWrite,v.depthRangeFor3D);Ta.update(D);const Z=v.transform,re=Ku(Z.zoom)*b.exaggeration();(ne?[!1,!0]:[!1]).forEach(ue=>{J=-1;const he=ue?B.LINES:B.TRIANGLES,[be,Se]=ue?b.getWirefameBuffer():[b.gridIndexBuffer,b.gridSegments];for(const we of I){const Ce=A.getTile(we),Ie=l.StencilMode.disabled,Re=b.prevTerrainTileForTile[we.key],st=b.terrainTileForTile[we.key];wl(Re,st)&&Ta.newMorphing(we.key,Re,st,D,250),N.activeTexture.set(B.TEXTURE0),Ce.texture.bind(B.LINEAR,B.CLAMP_TO_EDGE,B.LINEAR_MIPMAP_NEAREST);const De=Ta.getMorphValuesForProxy(we.key),Ke=De?1:0;let Ne;De&&(Ne={morphing:{srcDemTile:De.from,dstDemTile:De.to,phase:l.easeCubicInOut(De.phase)}});const at=bl(we.projMatrix,c0(we.canonical,Z.renderWorldCopies)?re/10:re);oe(Ke,ue),b.setupElevationDraw(Ce,q,Ne),v.prepareDrawProgram(N,q,we.toUnwrapped()),q.draw(N,he,ae,Ie,ie,l.CullFaceMode.backCCW,at,"terrain_raster",b.gridBuffer,be,Se)}})}}(h,this,this.proxySourceCache,s,this._updateTimestamp),this.renderingToTexture=!0,h.gpuTimingDeferredRenderEnd(),s.splice(0,s.length))}renderBatch(s){if(this._drapedRenderBatches.length===0)return s+1;this.renderingToTexture=!0;const h=this.painter,g=this.painter.context,v=this.proxySourceCache,b=this.proxiedCoords[v.id],A=this._drapedRenderBatches.shift(),I=[],D=h.style.order;let N=0;for(const B of b){const q=v.getTileByID(B.proxyTileKey),J=v.proxyCachedFBO[B.key]?v.proxyCachedFBO[B.key][s]:void 0,ne=J!==void 0?v.renderCache[J]:this.pool[N++],oe=J!==void 0;if(q.texture=ne.tex,oe&&!ne.dirty){I.push(q.tileID);continue}let ie;g.bindFramebuffer.set(ne.fb.framebuffer),this.renderedToTile=!1,ne.dirty&&(g.clear({color:l.Color.transparent,stencil:0}),ne.dirty=!1);for(let ae=A.start;ae<=A.end;++ae){const Z=h.style._layers[D[ae]];if(Z.isHidden(h.transform.zoom))continue;const re=h.style._getLayerSourceCache(Z),ue=re?this.proxyToSource[B.key][re.id]:[B];if(!ue)continue;const he=ue;g.viewport.set([0,0,ne.fb.width,ne.fb.height]),ie!==(re?re.id:null)&&(this._setupStencil(ne,ue,Z,re),ie=re?re.id:null),h.renderLayer(h,re,Z,he)}this.renderedToTile?(ne.dirty=!0,I.push(q.tileID)):oe||--N,N===5&&(N=0,this.renderToBackBuffer(I))}return this.renderToBackBuffer(I),this.renderingToTexture=!1,g.bindFramebuffer.set(null),g.viewport.set([0,0,h.width,h.height]),A.end+1}postRender(){}renderCacheEfficiency(s){const h=s.order.length;if(h===0)return{efficiency:100};let g,v=0,b=0,A=!1;for(let I=0;Ih.dem).forEach(h=>{s=Math.min(s,h.dem.tree.minimums[0])}),s===0?s:(s-30)*this._exaggeration}raycast(s,h,g){if(!this._visibleDemTiles)return null;const v=this._visibleDemTiles.filter(b=>b.dem).map(b=>{const A=b.tileID,I=1<(b.t!==null?b.t:Number.MAX_VALUE)-(A.t!==null?A.t:Number.MAX_VALUE));for(const b of v){if(b.t==null)return null;const A=b.tile.dem.tree.raycast(b.minx,b.miny,b.maxx,b.maxy,s,h,g);if(A!=null)return A}return null}_createFBO(){const s=this.painter.context,h=s.gl,g=this.drapeBufferSize;s.activeTexture.set(h.TEXTURE0);const v=new l.Texture(s,{width:g[0],height:g[1],data:null},h.RGBA);v.bind(h.LINEAR,h.CLAMP_TO_EDGE);const b=s.createFramebuffer(g[0],g[1],!1);return b.colorAttachment.set(v.texture),b.depthAttachment=new Te(s,b.framebuffer),this._sharedDepthStencil===void 0?(this._sharedDepthStencil=s.createRenderbuffer(s.gl.DEPTH_STENCIL,g[0],g[1]),this._stencilRef=0,b.depthAttachment.set(this._sharedDepthStencil),s.clear({stencil:0})):b.depthAttachment.set(this._sharedDepthStencil),s.extTextureFilterAnisotropic&&!s.extTextureFilterAnisotropicForceOff&&h.texParameterf(h.TEXTURE_2D,s.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,s.extTextureFilterAnisotropicMax),{fb:b,tex:v,dirty:!1}}_initFBOPool(){for(;this.pool.length{const h=this._style._layers[s],g=h.isHidden(this.painter.transform.zoom);return h.type==="custom"?!g&&h.shouldRedrape():!g&&h.hasTransition()})}_clearLineLayersFromRenderCache(){let s=!1;for(const g of this._style._getSources())if(g instanceof mt){s=!0;break}if(!s)return;const h={};for(let g=0;gh.renderCachePool.length){const A=Object.values(h.proxyCachedFBO);h.proxyCachedFBO={};for(let I=0;I=0;A--){const I=g[A];if(h.getTileByID(I.key),h.proxyCachedFBO[I.key]!==void 0){const D=s[I.key],N=this.proxyToSource[I.key];let B=0;for(const q in N){const J=N[q],ne=D[q];if(!ne||ne.length!==J.length||J.some((oe,ie)=>oe!==ne[ie]||v[q]&&v[q].hasOwnProperty(oe.key))){B=-1;break}++B}for(const q in h.proxyCachedFBO[I.key])h.renderCache[h.proxyCachedFBO[I.key][q]].dirty=B<0||B!==Object.values(D).length}}const b=[...this._drapedRenderBatches];b.sort((A,I)=>I.end-I.start-(A.end-A.start));for(const A of b)for(const I of g){if(h.proxyCachedFBO[I.key])continue;let D=h.renderCachePool.pop();D===void 0&&h.renderCache.length<50&&(D=h.renderCache.length,h.renderCache.push(this._createFBO())),D!==void 0&&(h.proxyCachedFBO[I.key]={},h.proxyCachedFBO[I.key][A.start]=D,h.renderCache[D].dirty=!0)}this._tilesDirty={}}_setupStencil(s,h,g,v){if(!v||!this._sourceTilesOverlap[v.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const b=this.painter.context,A=b.gl;if(h.length<=1)return void(this._overlapStencilType=!1);let I;if(g.isTileClipped())I=h.length,this._overlapStencilMode.test={func:A.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(h[0].overscaledZ>h[h.length-1].overscaledZ))return void(this._overlapStencilType=!1);I=1,this._overlapStencilMode.test={func:A.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+I>255&&(b.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=I,this._overlapStencilMode.ref=this._stencilRef,g.isTileClipped()&&this._renderTileClippingMasks(h,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return this._overlapStencilType==="Clip"||this._overlapStencilType==="Mask"}stencilModeForRTTOverlap(s){return this.renderingToTexture&&this._overlapStencilType?(this._overlapStencilType==="Clip"&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[s.key]),this._overlapStencilMode):l.StencilMode.disabled}_renderTileClippingMasks(s,h){const g=this.painter,v=this.painter.context,b=v.gl;g._tileClippingMaskIDs={},v.setColorMode(l.ColorMode.disabled),v.setDepthMode(l.DepthMode.disabled);const A=g.useProgram("clippingMask");for(const I of s){const D=g._tileClippingMaskIDs[I.key]=--h;A.draw(v,b.TRIANGLES,l.DepthMode.disabled,new l.StencilMode({func:b.ALWAYS,mask:0},D,255,b.KEEP,b.KEEP,b.REPLACE),l.ColorMode.disabled,l.CullFaceMode.disabled,Bc(I.projMatrix),"$clipping",g.tileExtentBuffer,g.quadTriangleIndexBuffer,g.tileExtentSegments)}}pointCoordinate(s){const h=this.painter.transform;if(s.x<0||s.x>h.width||s.y<0||s.y>h.height)return null;const g=[s.x,s.y,1,1];l.transformMat4$1(g,g,h.pixelMatrixInverse),l.scale$1(g,g,1/g[3]),g[0]/=h.worldSize,g[1]/=h.worldSize;const v=h._camera.position,b=l.mercatorZfromAltitude(1,h.center.lat),A=[v[0],v[1],v[2]/b,0],I=l.subtract([],g.slice(0,3),A);l.normalize(I,I);const D=this.raycast(A,I,this._exaggeration);return D!==null&&D?(l.scaleAndAdd(A,A,I,D),A[3]=A[2],A[2]*=b,A):null}drawDepth(){const s=this.painter,h=s.context,g=this.proxySourceCache,v=Math.ceil(s.width),b=Math.ceil(s.height);if(!this._depthFBO||this._depthFBO.width===v&&this._depthFBO.height===b||(this._depthFBO.destroy(),this._depthFBO=void 0,this._depthTexture=void 0),!this._depthFBO){const A=h.gl,I=h.createFramebuffer(v,b,!0);h.activeTexture.set(A.TEXTURE0);const D=new l.Texture(h,{width:v,height:b,data:null},A.RGBA);D.bind(A.NEAREST,A.CLAMP_TO_EDGE),I.colorAttachment.set(D.texture);const N=h.createRenderbuffer(h.gl.DEPTH_COMPONENT16,v,b);I.depthAttachment.set(N),this._depthFBO=I,this._depthTexture=D}h.bindFramebuffer.set(this._depthFBO.framebuffer),h.viewport.set([0,0,v,b]),function(A,I,D,N){if(A.transform.projection.name==="globe")return;const B=A.context,q=B.gl;B.clear({depth:1});const J=A.useProgram("terrainDepth"),ne=new l.DepthMode(q.LESS,l.DepthMode.ReadWrite,A.depthRangeFor3D);for(const oe of N){const ie=D.getTile(oe),ae=bl(oe.projMatrix,0);I.setupElevationDraw(ie,J),J.draw(B,q.TRIANGLES,ne,l.StencilMode.disabled,l.ColorMode.unblended,l.CullFaceMode.backCCW,ae,"terrain_depth",I.gridBuffer,I.gridIndexBuffer,I.gridNoSkirtSegments)}}(s,this,g,this.proxyCoords)}_setupProxiedCoordsForOrtho(s,h,g){if(s.getSource()instanceof jt)return this._setupProxiedCoordsForImageSource(s,h,g);this._findCoveringTileCache[s.id]=this._findCoveringTileCache[s.id]||{};const v=this.proxiedCoords[s.id]=[],b=this.proxyCoords;for(let I=0;I(B.min.x=Math.min(B.min.x,q.x-I.x),B.min.y=Math.min(B.min.y,q.y-I.y),B.max.x=Math.max(B.max.x,q.x-I.x),B.max.y=Math.max(B.max.y,q.y-I.y),B),{min:new l.Point(Number.MAX_VALUE,Number.MAX_VALUE),max:new l.Point(-Number.MAX_VALUE,-Number.MAX_VALUE)}),N=(B,q)=>{const J=B.wrap+B.canonical.x/(1<ie+D.max.x||ne+oeae+D.max.y};for(let B=0;BA.key===h.tileID.key);if(b)return b}if(h.tileID.key!==s.key){const b=s.canonical.z-h.tileID.canonical.z;let A,I,D;v=l.create();const N=h.tileID.wrap-s.wrap<0?(A=l.EXTENT>>b,I=A*((h.tileID.canonical.x<=q){const J=s.canonical.z-q;h.getSource().reparseOverscaled?(I=Math.max(s.canonical.z+2,h.transform.tileZoom),A=new l.OverscaledTileID(I,s.wrap,q,s.canonical.x>>J,s.canonical.y>>J)):J!==0&&(I=q,A=new l.OverscaledTileID(I,s.wrap,q,s.canonical.x>>J,s.canonical.y>>J))}A.key!==s.key&&(N.push(A.key),g=h.getTile(A))}const B=q=>{N.forEach(J=>{v[J]=q}),N.length=0};for(I-=1;I>=D&&(!g||!g.hasData());I--){g&&B(g.tileID.key);const q=A.calculateScaledKey(I);if(g=h.getTileByID(q),g&&g.hasData())break;const J=v[q];if(J===null)break;J===void 0?N.push(q):g=h.getTileByID(J)}return B(g?g.tileID.key:null),g&&g.hasData()?g:null}findDEMTileFor(s){return this.enabled?this._findTileCoveringTileID(s,this.sourceCache):null}prepareDrawTile(){this.renderedToTile=!0}_clearRenderCacheForTile(s,h){let g=this._tilesDirty[s];g||(g=this._tilesDirty[s]={}),g[h.key]=!0}getWirefameBuffer(){if(!this.wireframeSegments){const s=function(h){let g=0;const v=new l.StructArrayLayout2ui4,b=131;for(let A=1;A<129;A++){for(let I=1;I<129;I++)g=A*b+I,v.emplaceBack(g,g+1),v.emplaceBack(g,g+b),v.emplaceBack(g+1,g+b),A===128&&v.emplaceBack(g+b,g+b+1);v.emplaceBack(g+1,g+1+b)}return v}();this.wireframeIndexBuffer=this.painter.context.createIndexBuffer(s),this.wireframeSegments=l.SegmentVector.simpleSegment(0,0,this.gridBuffer.length,s.length)}return[this.wireframeIndexBuffer,this.wireframeSegments]}}class dr{static cacheKey(s,h,g,v){let b=`${h}${v?v.cacheKey:""}`;for(const A of g)s.usedDefines.includes(A)&&(b+=`/${A}`);return b}constructor(s,h,g,v,b,A){const I=s.gl;this.program=I.createProgram();const D=function(Z){const re=[];for(let ue=0;ue`#define ${Z}`));const J=s.isWebGL2?`#version 300 es +`:"",ne=J+q.concat(s.extStandardDerivatives&&J.length===0?`#extension GL_OES_standard_derivatives : enable +`.concat(ap):ap,ap,qu,a0.fragmentSource,vl.fragmentSource,g.fragmentSource).join(` +`),oe=J+q.concat(` +#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`,qu,a0.vertexSource,vl.vertexSource,Hu.vertexSource,g.vertexSource).join(` +`),ie=I.createShader(I.FRAGMENT_SHADER);if(I.isContextLost())return void(this.failedToCreate=!0);I.shaderSource(ie,ne),I.compileShader(ie),I.attachShader(this.program,ie);const ae=I.createShader(I.VERTEX_SHADER);if(I.isContextLost())this.failedToCreate=!0;else{I.shaderSource(ae,oe),I.compileShader(ae),I.attachShader(this.program,ae),this.attributes={},this.numAttributes=B.length;for(let Z=0;Z({u_dem:new l.Uniform1i(Z),u_dem_prev:new l.Uniform1i(Z),u_dem_unpack:new l.Uniform4f(Z),u_dem_tl:new l.Uniform2f(Z),u_dem_scale:new l.Uniform1f(Z),u_dem_tl_prev:new l.Uniform2f(Z),u_dem_scale_prev:new l.Uniform1f(Z),u_dem_size:new l.Uniform1f(Z),u_dem_lerp:new l.Uniform1f(Z),u_exaggeration:new l.Uniform1f(Z),u_depth:new l.Uniform1i(Z),u_depth_size_inv:new l.Uniform2f(Z),u_meter_to_dem:new l.Uniform1f(Z),u_label_plane_matrix_inv:new l.UniformMatrix4f(Z)}))(s)),A.includes("GLOBE")&&(this.globeUniforms=(Z=>({u_tile_tl_up:new l.Uniform3f(Z),u_tile_tr_up:new l.Uniform3f(Z),u_tile_br_up:new l.Uniform3f(Z),u_tile_bl_up:new l.Uniform3f(Z),u_tile_up_scale:new l.Uniform1f(Z)}))(s)),A.includes("FOG")&&(this.fogUniforms=(Z=>({u_fog_matrix:new l.UniformMatrix4f(Z),u_fog_range:new l.Uniform2f(Z),u_fog_color:new l.Uniform4f(Z),u_fog_horizon_blend:new l.Uniform1f(Z),u_fog_temporal_offset:new l.Uniform1f(Z),u_frustum_tl:new l.Uniform3f(Z),u_frustum_tr:new l.Uniform3f(Z),u_frustum_br:new l.Uniform3f(Z),u_frustum_bl:new l.Uniform3f(Z),u_globe_pos:new l.Uniform3f(Z),u_globe_radius:new l.Uniform1f(Z),u_globe_transition:new l.Uniform1f(Z),u_is_globe:new l.Uniform1i(Z),u_viewport:new l.Uniform2f(Z)}))(s))}}setTerrainUniformValues(s,h){if(!this.terrainUniforms)return;const g=this.terrainUniforms;if(!this.failedToCreate){s.program.set(this.program);for(const v in h)g[v]&&g[v].set(this.program,v,h[v])}}setGlobeUniformValues(s,h){if(!this.globeUniforms)return;const g=this.globeUniforms;if(!this.failedToCreate){s.program.set(this.program);for(const v in h)g[v]&&g[v].set(this.program,v,h[v])}}setFogUniformValues(s,h){if(!this.fogUniforms)return;const g=this.fogUniforms;if(!this.failedToCreate){s.program.set(this.program);for(const v in h)g[v].set(this.program,v,h[v])}}draw(s,h,g,v,b,A,I,D,N,B,q,J,ne,oe,ie){const ae=s.gl;if(this.failedToCreate)return;s.program.set(this.program),s.setDepthMode(g),s.setStencilMode(v),s.setColorMode(b),s.setCullFace(A);for(const re of Object.keys(this.fixedUniforms))this.fixedUniforms[re].set(this.program,re,I[re]);oe&&oe.setUniforms(this.program,s,this.binderUniforms,J,{zoom:ne});const Z={[ae.LINES]:2,[ae.TRIANGLES]:3,[ae.LINE_STRIP]:1}[h];for(const re of q.get()){const ue=re.vaos||(re.vaos={});(ue[D]||(ue[D]=new Xv)).bind(s,this,N,oe?oe.getPaintVertexBuffers():[],B,re.vertexOffset,ie||[]),ae.drawElements(h,re.primitiveLength*Z,ae.UNSIGNED_SHORT,re.primitiveOffset*Z*2)}}}function Nc(f,s){const h=Math.pow(2,s.tileID.overscaledZ),g=s.tileSize*Math.pow(2,f.transform.tileZoom)/h,v=g*(s.tileID.canonical.x+s.tileID.wrap*h),b=g*s.tileID.canonical.y;return{u_image:0,u_texsize:s.imageAtlasTexture.size,u_tile_units_to_pixels:1/je(s,1,f.transform.tileZoom),u_pixel_coord_upper:[v>>16,b>>16],u_pixel_coord_lower:[65535&v,65535&b]}}const u0=l.create(),fp=(f,s,h,g,v,b,A,I,D,N,B)=>{const q=s.style.light,J=q.properties.get("position"),ne=[J.x,J.y,J.z],oe=l.create$1();q.properties.get("anchor")==="viewport"&&(l.fromRotation(oe,-s.transform.angle),l.transformMat3(ne,ne,oe));const ie=q.properties.get("color"),ae=s.transform,Z={u_matrix:f,u_lightpos:ne,u_lightintensity:q.properties.get("intensity"),u_lightcolor:[ie.r,ie.g,ie.b],u_vertical_gradient:+h,u_opacity:g,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:u0,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_ao:v,u_edge_radius:b};return ae.projection.name==="globe"&&(Z.u_tile_id=[A.canonical.x,A.canonical.y,1<{const J=fp(f,s,h,g,v,b,A,D,N,B,q),ne={u_height_factor:-Math.pow(2,A.overscaledZ)/I.tileSize/8};return l.extend(J,Nc(s,I),ne)},Ls=f=>({u_matrix:f}),mp=(f,s,h)=>l.extend(Ls(f),Nc(s,h)),Yv=(f,s)=>({u_matrix:f,u_world:s}),Qv=(f,s,h,g)=>l.extend(mp(f,s,h),{u_world:g}),Jv=l.create(),gp=(f,s,h,g,v,b)=>{const A=f.transform,I=A.projection.name==="globe";let D;if(b.paint.get("circle-pitch-alignment")==="map")if(I){const B=l.globePixelsToTileUnits(A.zoom,s.canonical)*A._pixelsPerMercatorPixel;D=Float32Array.from([B,0,0,B])}else D=A.calculatePixelsToTileUnitsMatrix(h);else D=new Float32Array([A.pixelsToGLUnits[0],0,0,A.pixelsToGLUnits[1]]);const N={u_camera_to_center_distance:A.cameraToCenterDistance,u_matrix:f.translatePosMatrix(s.projMatrix,h,b.paint.get("circle-translate"),b.paint.get("circle-translate-anchor")),u_device_pixel_ratio:l.exported.devicePixelRatio,u_extrude_scale:D,u_inv_rot_matrix:Jv,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(I){N.u_inv_rot_matrix=g,N.u_merc_center=v,N.u_tile_id=[s.canonical.x,s.canonical.y,1<{const s=[];return f.paint.get("circle-pitch-alignment")==="map"&&s.push("PITCH_WITH_MAP"),f.paint.get("circle-pitch-scale")==="map"&&s.push("SCALE_WITH_MAP"),s},_p=(f,s,h,g)=>{const v=l.EXTENT/h.tileSize;return{u_matrix:f,u_camera_to_center_distance:s.getCameraToCenterDistance(g),u_extrude_scale:[s.pixelsToGLUnits[0]/v,s.pixelsToGLUnits[1]/v]}},Qu=(f,s,h=1)=>({u_matrix:f,u_color:s,u_overlay:0,u_overlay_scale:h}),d0=l.create(),p0=(f,s,h,g,v,b,A)=>{const I=f.transform,D=I.projection.name==="globe",N=D?l.globePixelsToTileUnits(I.zoom,s.canonical)*I._pixelsPerMercatorPixel:je(h,1,b),B={u_matrix:s.projMatrix,u_extrude_scale:N,u_intensity:A,u_inv_rot_matrix:d0,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(D){B.u_inv_rot_matrix=g,B.u_merc_center=v,B.u_tile_id=[s.canonical.x,s.canonical.y,1<{const I=f.transform,D=I.calculatePixelsToTileUnitsMatrix(s);return{u_matrix:vp(f,s,h,g),u_pixels_to_tile_units:D,u_device_pixel_ratio:b,u_units_to_pixels:[1/I.pixelsToGLUnits[0],1/I.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:v,u_texsize:jc(h)?s.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:El(s,f.transform),u_alpha_discard_threshold:0,u_trim_offset:A}},Uc=(f,s,h,g,v)=>{const b=f.transform;return{u_matrix:vp(f,s,h,g),u_texsize:s.imageAtlasTexture.size,u_pixels_to_tile_units:b.calculatePixelsToTileUnitsMatrix(s),u_device_pixel_ratio:v,u_image:0,u_tile_units_to_pixels:El(s,b),u_units_to_pixels:[1/b.pixelsToGLUnits[0],1/b.pixelsToGLUnits[1]],u_alpha_discard_threshold:0}};function El(f,s){return 1/je(f,1,s.tileZoom)}function vp(f,s,h,g){return f.translatePosMatrix(g||s.tileID.projMatrix,s,h.paint.get("line-translate"),h.paint.get("line-translate-anchor"))}function jc(f){const s=f.paint.get("line-dasharray").value;return s.value||s.kind!=="constant"}const xp=(f,s,h,g,v,b)=>{return{u_matrix:f,u_tl_parent:s,u_scale_parent:h,u_fade_t:g.mix,u_opacity:g.opacity*v.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:v.paint.get("raster-brightness-min"),u_brightness_high:v.paint.get("raster-brightness-max"),u_saturation_factor:(I=v.paint.get("raster-saturation"),I>0?1-1/(1.001-I):-I),u_contrast_factor:(A=v.paint.get("raster-contrast"),A>0?1/(1-A):1+A),u_spin_weights:Yo(v.paint.get("raster-hue-rotate")),u_perspective_transform:b};var A,I};function Yo(f){f*=Math.PI/180;const s=Math.sin(f),h=Math.cos(f);return[(2*h+1)/3,(-Math.sqrt(3)*s-h+1)/3,(Math.sqrt(3)*s-h+1)/3]}const Ju=l.create(),bp=(f,s,h,g,v,b,A,I,D,N,B,q,J,ne,oe,ie)=>{const ae=v.transform,Z={u_is_size_zoom_constant:+(f==="constant"||f==="source"),u_is_size_feature_constant:+(f==="constant"||f==="camera"),u_size_t:s?s.uSizeT:0,u_size:s?s.uSize:0,u_camera_to_center_distance:ae.cameraToCenterDistance,u_rotate_symbol:+h,u_aspect_ratio:ae.width/ae.height,u_fade_change:v.options.fadeDuration?v.symbolFadeChange:1,u_matrix:b,u_label_plane_matrix:A,u_coord_matrix:I,u_is_text:+D,u_pitch_with_map:+g,u_texsize:N,u_texture:0,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:Ju,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:Ju,u_up_vector:[0,-1,0]};return ie.name==="globe"&&(Z.u_tile_id=[B.canonical.x,B.canonical.y,1<l.extend(bp(f,s,h,g,v,b,A,I,D,N,q,J,ne,oe,ie,ae),{u_gamma_scale:g?v.transform.cameraToCenterDistance*Math.cos(v.terrain?0:v.transform._pitch):1,u_device_pixel_ratio:l.exported.devicePixelRatio,u_is_halo:+B}),f0=(f,s,h,g,v,b,A,I,D,N,B,q,J,ne,oe,ie)=>l.extend(eh(f,s,h,g,v,b,A,I,!0,D,!0,B,q,J,ne,oe,ie),{u_texsize_icon:N,u_texture_icon:1}),wp=(f,s,h)=>({u_matrix:f,u_opacity:s,u_color:h}),tx=(f,s,h,g,v)=>l.extend(function(b,A,I){const D=A.imageManager.getPattern(b.toString()),{width:N,height:B}=A.imageManager.getPixelSize(),q=Math.pow(2,I.tileID.overscaledZ),J=I.tileSize*Math.pow(2,A.transform.tileZoom)/q,ne=J*(I.tileID.canonical.x+I.tileID.wrap*q),oe=J*I.tileID.canonical.y;return{u_image:0,u_pattern_tl:D.tl,u_pattern_br:D.br,u_texsize:[N,B],u_pattern_size:D.displaySize,u_tile_units_to_pixels:1/je(I,1,A.transform.tileZoom),u_pixel_coord_upper:[ne>>16,oe>>16],u_pixel_coord_lower:[65535&ne,65535&oe]}}(g,h,v),{u_matrix:f,u_opacity:s}),Ep={fillExtrusion:f=>({u_matrix:new l.UniformMatrix4f(f),u_lightpos:new l.Uniform3f(f),u_lightintensity:new l.Uniform1f(f),u_lightcolor:new l.Uniform3f(f),u_vertical_gradient:new l.Uniform1f(f),u_opacity:new l.Uniform1f(f),u_edge_radius:new l.Uniform1f(f),u_ao:new l.Uniform2f(f),u_tile_id:new l.Uniform3f(f),u_zoom_transition:new l.Uniform1f(f),u_inv_rot_matrix:new l.UniformMatrix4f(f),u_merc_center:new l.Uniform2f(f),u_up_dir:new l.Uniform3f(f),u_height_lift:new l.Uniform1f(f)}),fillExtrusionPattern:f=>({u_matrix:new l.UniformMatrix4f(f),u_lightpos:new l.Uniform3f(f),u_lightintensity:new l.Uniform1f(f),u_lightcolor:new l.Uniform3f(f),u_vertical_gradient:new l.Uniform1f(f),u_height_factor:new l.Uniform1f(f),u_edge_radius:new l.Uniform1f(f),u_ao:new l.Uniform2f(f),u_tile_id:new l.Uniform3f(f),u_zoom_transition:new l.Uniform1f(f),u_inv_rot_matrix:new l.UniformMatrix4f(f),u_merc_center:new l.Uniform2f(f),u_up_dir:new l.Uniform3f(f),u_height_lift:new l.Uniform1f(f),u_image:new l.Uniform1i(f),u_texsize:new l.Uniform2f(f),u_pixel_coord_upper:new l.Uniform2f(f),u_pixel_coord_lower:new l.Uniform2f(f),u_tile_units_to_pixels:new l.Uniform1f(f),u_opacity:new l.Uniform1f(f)}),fill:f=>({u_matrix:new l.UniformMatrix4f(f)}),fillPattern:f=>({u_matrix:new l.UniformMatrix4f(f),u_image:new l.Uniform1i(f),u_texsize:new l.Uniform2f(f),u_pixel_coord_upper:new l.Uniform2f(f),u_pixel_coord_lower:new l.Uniform2f(f),u_tile_units_to_pixels:new l.Uniform1f(f)}),fillOutline:f=>({u_matrix:new l.UniformMatrix4f(f),u_world:new l.Uniform2f(f)}),fillOutlinePattern:f=>({u_matrix:new l.UniformMatrix4f(f),u_world:new l.Uniform2f(f),u_image:new l.Uniform1i(f),u_texsize:new l.Uniform2f(f),u_pixel_coord_upper:new l.Uniform2f(f),u_pixel_coord_lower:new l.Uniform2f(f),u_tile_units_to_pixels:new l.Uniform1f(f)}),circle:f=>({u_camera_to_center_distance:new l.Uniform1f(f),u_extrude_scale:new l.UniformMatrix2f(f),u_device_pixel_ratio:new l.Uniform1f(f),u_matrix:new l.UniformMatrix4f(f),u_inv_rot_matrix:new l.UniformMatrix4f(f),u_merc_center:new l.Uniform2f(f),u_tile_id:new l.Uniform3f(f),u_zoom_transition:new l.Uniform1f(f),u_up_dir:new l.Uniform3f(f)}),collisionBox:f=>({u_matrix:new l.UniformMatrix4f(f),u_camera_to_center_distance:new l.Uniform1f(f),u_extrude_scale:new l.Uniform2f(f)}),collisionCircle:f=>({u_matrix:new l.UniformMatrix4f(f),u_inv_matrix:new l.UniformMatrix4f(f),u_camera_to_center_distance:new l.Uniform1f(f),u_viewport_size:new l.Uniform2f(f)}),debug:f=>({u_color:new l.UniformColor(f),u_matrix:new l.UniformMatrix4f(f),u_overlay:new l.Uniform1i(f),u_overlay_scale:new l.Uniform1f(f)}),clippingMask:f=>({u_matrix:new l.UniformMatrix4f(f)}),heatmap:f=>({u_extrude_scale:new l.Uniform1f(f),u_intensity:new l.Uniform1f(f),u_matrix:new l.UniformMatrix4f(f),u_inv_rot_matrix:new l.UniformMatrix4f(f),u_merc_center:new l.Uniform2f(f),u_tile_id:new l.Uniform3f(f),u_zoom_transition:new l.Uniform1f(f),u_up_dir:new l.Uniform3f(f)}),heatmapTexture:f=>({u_image:new l.Uniform1i(f),u_color_ramp:new l.Uniform1i(f),u_opacity:new l.Uniform1f(f)}),hillshade:f=>({u_matrix:new l.UniformMatrix4f(f),u_image:new l.Uniform1i(f),u_latrange:new l.Uniform2f(f),u_light:new l.Uniform2f(f),u_shadow:new l.UniformColor(f),u_highlight:new l.UniformColor(f),u_accent:new l.UniformColor(f)}),hillshadePrepare:f=>({u_matrix:new l.UniformMatrix4f(f),u_image:new l.Uniform1i(f),u_dimension:new l.Uniform2f(f),u_zoom:new l.Uniform1f(f),u_unpack:new l.Uniform4f(f)}),line:f=>({u_matrix:new l.UniformMatrix4f(f),u_pixels_to_tile_units:new l.UniformMatrix2f(f),u_device_pixel_ratio:new l.Uniform1f(f),u_units_to_pixels:new l.Uniform2f(f),u_dash_image:new l.Uniform1i(f),u_gradient_image:new l.Uniform1i(f),u_image_height:new l.Uniform1f(f),u_texsize:new l.Uniform2f(f),u_tile_units_to_pixels:new l.Uniform1f(f),u_alpha_discard_threshold:new l.Uniform1f(f),u_trim_offset:new l.Uniform2f(f)}),linePattern:f=>({u_matrix:new l.UniformMatrix4f(f),u_texsize:new l.Uniform2f(f),u_pixels_to_tile_units:new l.UniformMatrix2f(f),u_device_pixel_ratio:new l.Uniform1f(f),u_image:new l.Uniform1i(f),u_units_to_pixels:new l.Uniform2f(f),u_tile_units_to_pixels:new l.Uniform1f(f),u_alpha_discard_threshold:new l.Uniform1f(f)}),raster:f=>({u_matrix:new l.UniformMatrix4f(f),u_tl_parent:new l.Uniform2f(f),u_scale_parent:new l.Uniform1f(f),u_fade_t:new l.Uniform1f(f),u_opacity:new l.Uniform1f(f),u_image0:new l.Uniform1i(f),u_image1:new l.Uniform1i(f),u_brightness_low:new l.Uniform1f(f),u_brightness_high:new l.Uniform1f(f),u_saturation_factor:new l.Uniform1f(f),u_contrast_factor:new l.Uniform1f(f),u_spin_weights:new l.Uniform3f(f),u_perspective_transform:new l.Uniform2f(f)}),symbolIcon:f=>({u_is_size_zoom_constant:new l.Uniform1i(f),u_is_size_feature_constant:new l.Uniform1i(f),u_size_t:new l.Uniform1f(f),u_size:new l.Uniform1f(f),u_camera_to_center_distance:new l.Uniform1f(f),u_rotate_symbol:new l.Uniform1i(f),u_aspect_ratio:new l.Uniform1f(f),u_fade_change:new l.Uniform1f(f),u_matrix:new l.UniformMatrix4f(f),u_label_plane_matrix:new l.UniformMatrix4f(f),u_coord_matrix:new l.UniformMatrix4f(f),u_is_text:new l.Uniform1i(f),u_pitch_with_map:new l.Uniform1i(f),u_texsize:new l.Uniform2f(f),u_tile_id:new l.Uniform3f(f),u_zoom_transition:new l.Uniform1f(f),u_inv_rot_matrix:new l.UniformMatrix4f(f),u_merc_center:new l.Uniform2f(f),u_camera_forward:new l.Uniform3f(f),u_tile_matrix:new l.UniformMatrix4f(f),u_up_vector:new l.Uniform3f(f),u_ecef_origin:new l.Uniform3f(f),u_texture:new l.Uniform1i(f)}),symbolSDF:f=>({u_is_size_zoom_constant:new l.Uniform1i(f),u_is_size_feature_constant:new l.Uniform1i(f),u_size_t:new l.Uniform1f(f),u_size:new l.Uniform1f(f),u_camera_to_center_distance:new l.Uniform1f(f),u_rotate_symbol:new l.Uniform1i(f),u_aspect_ratio:new l.Uniform1f(f),u_fade_change:new l.Uniform1f(f),u_matrix:new l.UniformMatrix4f(f),u_label_plane_matrix:new l.UniformMatrix4f(f),u_coord_matrix:new l.UniformMatrix4f(f),u_is_text:new l.Uniform1i(f),u_pitch_with_map:new l.Uniform1i(f),u_texsize:new l.Uniform2f(f),u_texture:new l.Uniform1i(f),u_gamma_scale:new l.Uniform1f(f),u_device_pixel_ratio:new l.Uniform1f(f),u_tile_id:new l.Uniform3f(f),u_zoom_transition:new l.Uniform1f(f),u_inv_rot_matrix:new l.UniformMatrix4f(f),u_merc_center:new l.Uniform2f(f),u_camera_forward:new l.Uniform3f(f),u_tile_matrix:new l.UniformMatrix4f(f),u_up_vector:new l.Uniform3f(f),u_ecef_origin:new l.Uniform3f(f),u_is_halo:new l.Uniform1i(f)}),symbolTextAndIcon:f=>({u_is_size_zoom_constant:new l.Uniform1i(f),u_is_size_feature_constant:new l.Uniform1i(f),u_size_t:new l.Uniform1f(f),u_size:new l.Uniform1f(f),u_camera_to_center_distance:new l.Uniform1f(f),u_rotate_symbol:new l.Uniform1i(f),u_aspect_ratio:new l.Uniform1f(f),u_fade_change:new l.Uniform1f(f),u_matrix:new l.UniformMatrix4f(f),u_label_plane_matrix:new l.UniformMatrix4f(f),u_coord_matrix:new l.UniformMatrix4f(f),u_is_text:new l.Uniform1i(f),u_pitch_with_map:new l.Uniform1i(f),u_texsize:new l.Uniform2f(f),u_texsize_icon:new l.Uniform2f(f),u_texture:new l.Uniform1i(f),u_texture_icon:new l.Uniform1i(f),u_gamma_scale:new l.Uniform1f(f),u_device_pixel_ratio:new l.Uniform1f(f),u_is_halo:new l.Uniform1i(f)}),background:f=>({u_matrix:new l.UniformMatrix4f(f),u_opacity:new l.Uniform1f(f),u_color:new l.UniformColor(f)}),backgroundPattern:f=>({u_matrix:new l.UniformMatrix4f(f),u_opacity:new l.Uniform1f(f),u_image:new l.Uniform1i(f),u_pattern_tl:new l.Uniform2f(f),u_pattern_br:new l.Uniform2f(f),u_texsize:new l.Uniform2f(f),u_pattern_size:new l.Uniform2f(f),u_pixel_coord_upper:new l.Uniform2f(f),u_pixel_coord_lower:new l.Uniform2f(f),u_tile_units_to_pixels:new l.Uniform1f(f)}),terrainRaster:up,terrainDepth:up,skybox:f=>({u_matrix:new l.UniformMatrix4f(f),u_sun_direction:new l.Uniform3f(f),u_cubemap:new l.Uniform1i(f),u_opacity:new l.Uniform1f(f),u_temporal_offset:new l.Uniform1f(f)}),skyboxGradient:f=>({u_matrix:new l.UniformMatrix4f(f),u_color_ramp:new l.Uniform1i(f),u_center_direction:new l.Uniform3f(f),u_radius:new l.Uniform1f(f),u_opacity:new l.Uniform1f(f),u_temporal_offset:new l.Uniform1f(f)}),skyboxCapture:f=>({u_matrix_3f:new l.UniformMatrix3f(f),u_sun_direction:new l.Uniform3f(f),u_sun_intensity:new l.Uniform1f(f),u_color_tint_r:new l.Uniform4f(f),u_color_tint_m:new l.Uniform4f(f),u_luminance:new l.Uniform1f(f)}),globeRaster:f=>({u_proj_matrix:new l.UniformMatrix4f(f),u_globe_matrix:new l.UniformMatrix4f(f),u_normalize_matrix:new l.UniformMatrix4f(f),u_merc_matrix:new l.UniformMatrix4f(f),u_zoom_transition:new l.Uniform1f(f),u_merc_center:new l.Uniform2f(f),u_image0:new l.Uniform1i(f),u_grid_matrix:new l.UniformMatrix3f(f),u_skirt_height:new l.Uniform1f(f),u_frustum_tl:new l.Uniform3f(f),u_frustum_tr:new l.Uniform3f(f),u_frustum_br:new l.Uniform3f(f),u_frustum_bl:new l.Uniform3f(f),u_globe_pos:new l.Uniform3f(f),u_globe_radius:new l.Uniform1f(f),u_viewport:new l.Uniform2f(f)}),globeAtmosphere:f=>({u_frustum_tl:new l.Uniform3f(f),u_frustum_tr:new l.Uniform3f(f),u_frustum_br:new l.Uniform3f(f),u_frustum_bl:new l.Uniform3f(f),u_horizon:new l.Uniform1f(f),u_transition:new l.Uniform1f(f),u_fadeout_range:new l.Uniform1f(f),u_color:new l.Uniform4f(f),u_high_color:new l.Uniform4f(f),u_space_color:new l.Uniform4f(f),u_star_intensity:new l.Uniform1f(f),u_star_density:new l.Uniform1f(f),u_star_size:new l.Uniform1f(f),u_temporal_offset:new l.Uniform1f(f),u_horizon_angle:new l.Uniform1f(f),u_rotation_matrix:new l.UniformMatrix4f(f)})};let th;function Vc(f,s,h,g,v,b,A){const I=f.context,D=I.gl,N=f.transform,B=f.useProgram("collisionBox"),q=[];let J=0,ne=0;for(let he=0;he0){const De=l.create(),Ke=Ie;l.mul(De,we.placementInvProjMatrix,N.glCoordMatrix),l.mul(De,De,we.placementViewportMatrix),q.push({circleArray:st,circleOffset:ne,transform:Ke,invTransform:De,projection:we.getProjection()}),J+=st.length/4,ne=J}Re&&(f.terrain&&f.terrain.setupElevationDraw(Se,B),B.draw(I,D.LINES,l.DepthMode.disabled,l.StencilMode.disabled,f.colorModeForRenderPass(),l.CullFaceMode.disabled,_p(Ie,N,Se,we.getProjection()),h.id,Re.layoutVertexBuffer,Re.indexBuffer,Re.segments,null,N.zoom,null,[Re.collisionVertexBuffer,Re.collisionVertexBufferExt]))}if(!A||!q.length)return;const oe=f.useProgram("collisionCircle"),ie=new l.StructArrayLayout2f1f2i16;ie.resize(4*J),ie._trim();let ae=0;for(const he of q)for(let be=0;be=0&&(oe[he.associatedIconIndex]={x:De,y:Ke,z:Ne,angle:tt})}else Ao(we,J)}if(B){ne.clear();const ue=f.icon.placedSymbolArray;for(let he=0;heDe.sortKey-Ke.sortKey);for(const De of Ie){const Ke=De.state;if(f.terrain&&f.terrain.setupElevationDraw(Ke.tile,Ke.program,{useDepthForOcclusion:!Ce,labelPlaneMatrixInv:Ke.labelPlaneMatrixInv}),J.activeTexture.set(ne.TEXTURE0),Ke.atlasTexture.bind(Ke.atlasInterpolation,ne.CLAMP_TO_EDGE),Ke.atlasTextureIcon&&(J.activeTexture.set(ne.TEXTURE1),Ke.atlasTextureIcon&&Ke.atlasTextureIcon.bind(Ke.atlasInterpolationIcon,ne.CLAMP_TO_EDGE)),Ke.isSDF){const Ne=Ke.uniformValues;Ke.hasHalo&&(Ne.u_is_halo=1,$c(Ke.buffers,De.segments,h,f,Ke.program,be,B,q,Ne)),Ne.u_is_halo=0}$c(Ke.buffers,De.segments,h,f,Ke.program,be,B,q,Ke.uniformValues)}}function $c(f,s,h,g,v,b,A,I,D){const N=g.context,B=[f.dynamicLayoutVertexBuffer,f.opacityVertexBuffer,f.globeExtVertexBuffer];v.draw(N,N.gl.TRIANGLES,b,A,I,l.CullFaceMode.disabled,D,h.id,f.layoutVertexBuffer,f.indexBuffer,s,h.paint,g.transform.zoom,f.programConfigurations.get(h.id),B)}function y0(f,s,h,g,v,b,A){const I=f.context.gl,D=h.paint.get("fill-pattern"),N=D&&D.constantOr(1);let B,q,J,ne,oe;A?(q=N&&!h.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",B=I.LINES):(q=N?"fillPattern":"fill",B=I.TRIANGLES);for(const ie of g){const ae=s.getTile(ie);if(N&&!ae.patternsLoaded())continue;const Z=ae.getBucket(h);if(!Z)continue;f.prepareDrawTile();const re=Z.programConfigurations.get(h.id),ue=f.useProgram(q,re);N&&(f.context.activeTexture.set(I.TEXTURE0),ae.imageAtlasTexture.bind(I.LINEAR,I.CLAMP_TO_EDGE),re.updatePaintBuffers());const he=D.constantOr(null);if(he&&ae.imageAtlas){const Se=ae.imageAtlas.patternPositions[he.toString()];Se&&re.setConstantPatternPositions(Se)}const be=f.translatePosMatrix(ie.projMatrix,ae,h.paint.get("fill-translate"),h.paint.get("fill-translate-anchor"));if(A){ne=Z.indexBuffer2,oe=Z.segments2;const Se=f.terrain&&f.terrain.renderingToTexture?f.terrain.drapeBufferSize:[I.drawingBufferWidth,I.drawingBufferHeight];J=q==="fillOutlinePattern"&&N?Qv(be,f,ae,Se):Yv(be,Se)}else ne=Z.indexBuffer,oe=Z.segments,J=N?mp(be,f,ae):Ls(be);f.prepareDrawProgram(f.context,ue,ie.toUnwrapped()),ue.draw(f.context,B,v,f.stencilModeForClipping(ie),b,l.CullFaceMode.disabled,J,h.id,Z.layoutVertexBuffer,ne,oe,h.paint,f.transform.zoom,re)}}function rh(f,s,h,g,v,b,A){const I=f.context,D=I.gl,N=f.transform,B=h.paint.get("fill-extrusion-pattern"),q=B.constantOr(1),J=h.paint.get("fill-extrusion-opacity"),ne=[h.paint.get("fill-extrusion-ambient-occlusion-intensity"),h.paint.get("fill-extrusion-ambient-occlusion-radius")],oe=h.layout.get("fill-extrusion-edge-radius"),ie=oe>0&&!h.paint.get("fill-extrusion-rounded-roof"),ae=ie?0:oe,Z=N.projection.name==="globe"?l.fillExtrusionHeightLift():0,re=N.projection.name==="globe",ue=re?l.globeToMercatorTransition(N.zoom):0,he=[l.mercatorXfromLng(N.center.lng),l.mercatorYfromLat(N.center.lat)],be=[];re&&be.push("PROJECTION_GLOBE_VIEW"),ne[0]>0&&be.push("FAUX_AO"),ie&&be.push("ZERO_ROOF_RADIUS");for(const Se of g){const we=s.getTile(Se),Ce=we.getBucket(h);if(!Ce||Ce.projection.name!==N.projection.name)continue;const Ie=Ce.programConfigurations.get(h.id),Re=f.useProgram(q?"fillExtrusionPattern":"fillExtrusion",Ie,be);if(f.terrain){const Ze=f.terrain;if(f.style.terrainSetForDrapingOnly())Ze.setupElevationDraw(we,Re,{useMeterToDem:!0});else{if(!Ce.enableTerrain)continue;if(Ze.setupElevationDraw(we,Re,{useMeterToDem:!0}),_0(I,s,Se,Ce,h,Ze),!Ce.centroidVertexBuffer){const ut=Re.attributes.a_centroid_pos;ut!==void 0&&D.vertexAttrib2f(ut,0,0)}}}q&&(f.context.activeTexture.set(D.TEXTURE0),we.imageAtlasTexture.bind(D.LINEAR,D.CLAMP_TO_EDGE),Ie.updatePaintBuffers());const st=B.constantOr(null);if(st&&we.imageAtlas){const Ze=we.imageAtlas.patternPositions[st.toString()];Ze&&Ie.setConstantPatternPositions(Ze)}const De=f.translatePosMatrix(Se.projMatrix,we,h.paint.get("fill-extrusion-translate"),h.paint.get("fill-extrusion-translate-anchor")),Ke=N.projection.createInversionMatrix(N,Se.canonical),Ne=h.paint.get("fill-extrusion-vertical-gradient"),at=q?h0(De,f,Ne,J,ne,ae,Se,we,Z,ue,he,Ke):fp(De,f,Ne,J,ne,ae,Se,Z,ue,he,Ke);f.prepareDrawProgram(I,Re,Se.toUnwrapped());const ze=[];f.terrain&&ze.push(Ce.centroidVertexBuffer),re&&ze.push(Ce.layoutVertexExtBuffer),Re.draw(I,I.gl.TRIANGLES,v,b,A,l.CullFaceMode.backCCW,at,h.id,Ce.layoutVertexBuffer,Ce.indexBuffer,Ce.segments,h.paint,f.transform.zoom,Ie,ze)}}function _0(f,s,h,g,v,b){const A=[Z=>{let re=Z.canonical.x-1,ue=Z.wrap;return re<0&&(re=(1<{let re=Z.canonical.x+1,ue=Z.wrap;return re===1<new l.OverscaledTileID(Z.overscaledZ,Z.wrap,Z.canonical.z,Z.canonical.x,(Z.canonical.y===0?1<new l.OverscaledTileID(Z.overscaledZ,Z.wrap,Z.canonical.z,Z.canonical.x,Z.canonical.y===(1<{const re=s.getSource().minzoom,ue=be=>{const Se=s.getTileByID(be);if(Se&&Se.hasData())return Se.getBucket(v)},he=[0,-1,1];for(const be of he){if(Z.overscaledZ+be(D[0]=Math.min(Z.min.y,re.min.y),D[1]=Math.max(Z.max.y,re.max.y),D[2]=l.EXTENT-re.min.x>Z.max.x?re.min.x-l.EXTENT:Z.max.x,D),B=(Z,re)=>(D[0]=Math.min(Z.min.x,re.min.x),D[1]=Math.max(Z.max.x,re.max.x),D[2]=l.EXTENT-re.min.y>Z.max.y?re.min.y-l.EXTENT:Z.max.y,D),q=[(Z,re)=>N(Z,re),(Z,re)=>N(re,Z),(Z,re)=>B(Z,re),(Z,re)=>B(re,Z)],J=new l.Point(0,0);let ne,oe,ie;const ae=(Z,re,ue,he,be)=>{const Se=[[he?ue:Z,he?Z:ue,0],[he?ue:re,he?re:ue,0]],we=be<0?l.EXTENT+be:be,Ce=[he?we:(Z+re)/2,he?(Z+re)/2:we,0];return ue===0&&be<0||ue!==0&&be>0?b.getForTilePoints(ie,[Ce],!0,oe):Se.push(Ce),b.getForTilePoints(h,Se,!0,ne),Math.max(Se[0][2],Se[1][2],Ce[2])/b.exaggeration()};for(let Z=0;Z<4;Z++){const re=(Z<2?1:5)-Z,ue=g.borders[Z];if(ue.length===0)continue;const he=ie=A[Z](h),be=I(he);if(!(be&&be instanceof l.FillExtrusionBucket&&be.enableTerrain)||g.borderDoneWithNeighborZ[Z]===be.canonical.z&&be.borderDoneWithNeighborZ[re]===g.canonical.z||(oe=b.findDEMTileFor(he),!oe||!oe.dem))continue;if(!ne){const Ie=b.findDEMTileFor(h);if(!Ie||!Ie.dem)return;ne=Ie}const Se=be.borders[re];let we=0;const Ce=be.borderDoneWithNeighborZ[re]!==g.canonical.z;if(g.canonical.z===be.canonical.z){for(let Ie=0;Iest[0]+3));)Ce&&be.encodeCentroid(void 0,De,!1),we++;if(De&&west[1]-3)&&(Ne++,++we!==Se.length);)De=be.featuresOnBorder[Se[we]];if(De=be.featuresOnBorder[Se[Ke]],Re.intersectsCount()>1||De.intersectsCount()>1||Ne!==1){Ne!==1&&(we=Ke),g.encodeCentroid(void 0,Re,!1),Ce&&be.encodeCentroid(void 0,De,!1);continue}const at=q[Z](Re,De),ze=Z%2?l.EXTENT-1:0;J.x=ae(at[0],Math.min(l.EXTENT-1,at[1]),ze,Z<2,at[2]),J.y=0,g.encodeCentroid(J,Re,!1),Ce&&be.encodeCentroid(J,De,!1)}else g.encodeCentroid(void 0,Re,!1)}g.borderDoneWithNeighborZ[Z]=be.canonical.z,g.needsCentroidUpdate=!0,Ce&&(be.borderDoneWithNeighborZ[re]=g.canonical.z,be.needsCentroidUpdate=!0)}else{for(const Ie of ue)g.encodeCentroid(void 0,g.featuresOnBorder[Ie],!1);if(Ce){for(const Ie of Se)be.encodeCentroid(void 0,be.featuresOnBorder[Ie],!1);be.borderDoneWithNeighborZ[re]=g.canonical.z,be.needsCentroidUpdate=!0}g.borderDoneWithNeighborZ[Z]=be.canonical.z,g.needsCentroidUpdate=!0}}(g.needsCentroidUpdate||!g.centroidVertexBuffer&&g.centroidVertexArray.length!==0)&&g.uploadCentroid(f)}const Sl=new l.Color(1,0,0,1),nx=new l.Color(0,1,0,1),ix=new l.Color(0,0,1,1),ox=new l.Color(1,0,1,1),ax=new l.Color(0,1,1,1);function sx(f,s,h){const g=f.context,v=f.transform,b=g.gl,A=v.projection.name==="globe",I=A?["PROJECTION_GLOBE_VIEW"]:null;let D=h.projMatrix;if(A&&l.globeToMercatorTransition(v.zoom)>0){const Re=l.transitionTileAABBinECEF(h.canonical,v),st=l.globeDenormalizeECEF(Re);D=l.multiply(new Float32Array(16),v.globeMatrix,st),l.multiply(D,v.projMatrix,D)}const N=f.useProgram("debug",null,I),B=s.getTileByID(h.key);f.terrain&&f.terrain.setupElevationDraw(B,N);const q=l.DepthMode.disabled,J=l.StencilMode.disabled,ne=f.colorModeForRenderPass(),oe="$debug";g.activeTexture.set(b.TEXTURE0),f.emptyTexture.bind(b.LINEAR,b.CLAMP_TO_EDGE),A?B._makeGlobeTileDebugBuffers(f.context,v):B._makeDebugTileBoundsBuffers(f.context,v.projection);const ie=B._tileDebugBuffer||f.debugBuffer,ae=B._tileDebugIndexBuffer||f.debugIndexBuffer,Z=B._tileDebugSegments||f.debugSegments;N.draw(g,b.LINE_STRIP,q,J,ne,l.CullFaceMode.disabled,Qu(D,l.Color.red),oe,ie,ae,Z,null,null,null,[B._globeTileDebugBorderBuffer]);const re=B.latestRawTileData,ue=Math.floor((re&&re.byteLength||0)/1024),he=s.getTile(h).tileSize,be=512/Math.min(he,512)*(h.overscaledZ/v.zoom)*.5;let Se=h.canonical.toString();h.overscaledZ!==h.canonical.z&&(Se+=` => ${h.overscaledZ}`),Se+=` ${ue}kb`,function(Re,st){Re.initDebugOverlayCanvas();const De=Re.debugOverlayCanvas,Ke=Re.context.gl,Ne=Re.debugOverlayCanvas.getContext("2d");Ne.clearRect(0,0,De.width,De.height),Ne.shadowColor="white",Ne.shadowBlur=2,Ne.lineWidth=1.5,Ne.strokeStyle="white",Ne.textBaseline="top",Ne.font="bold 36px Open Sans, sans-serif",Ne.fillText(st,5,5),Ne.strokeText(st,5,5),Re.debugOverlayTexture.update(De),Re.debugOverlayTexture.bind(Ke.LINEAR,Ke.CLAMP_TO_EDGE)}(f,Se);const we=B._tileDebugTextBuffer||f.debugBuffer,Ce=B._tileDebugTextIndexBuffer||f.quadTriangleIndexBuffer,Ie=B._tileDebugTextSegments||f.debugSegments;N.draw(g,b.TRIANGLES,q,J,l.ColorMode.alphaBlended,l.CullFaceMode.disabled,Qu(D,l.Color.transparent,be),oe,we,Ce,Ie,null,null,null,[B._globeTileDebugTextBuffer])}function v0(f,s,h,g){Tl(f,0,s+h/2,f.transform.width,h,g)}function nh(f,s,h,g){Tl(f,s-h/2,0,h,f.transform.height,g)}function Tl(f,s,h,g,v,b){const A=f.context,I=A.gl;I.enable(I.SCISSOR_TEST),I.scissor(s*l.exported.devicePixelRatio,h*l.exported.devicePixelRatio,g*l.exported.devicePixelRatio,v*l.exported.devicePixelRatio),A.clear({color:b}),I.disable(I.SCISSOR_TEST)}const x0=l.createLayout([{name:"a_pos_3f",components:3,type:"Float32"}]),{members:b0}=x0;function Aa(f,s,h,g){f.emplaceBack(s,h,g)}class ih{constructor(s){this.vertexArray=new l.StructArrayLayout3f12,this.indices=new l.StructArrayLayout3ui6,Aa(this.vertexArray,-1,-1,1),Aa(this.vertexArray,1,-1,1),Aa(this.vertexArray,-1,1,1),Aa(this.vertexArray,1,1,1),Aa(this.vertexArray,-1,-1,-1),Aa(this.vertexArray,1,-1,-1),Aa(this.vertexArray,-1,1,-1),Aa(this.vertexArray,1,1,-1),this.indices.emplaceBack(5,1,3),this.indices.emplaceBack(3,7,5),this.indices.emplaceBack(6,2,0),this.indices.emplaceBack(0,4,6),this.indices.emplaceBack(2,6,7),this.indices.emplaceBack(7,3,2),this.indices.emplaceBack(5,4,0),this.indices.emplaceBack(0,1,5),this.indices.emplaceBack(0,2,3),this.indices.emplaceBack(3,1,0),this.indices.emplaceBack(7,6,4),this.indices.emplaceBack(4,5,7),this.vertexBuffer=s.createVertexBuffer(this.vertexArray,b0),this.indexBuffer=s.createIndexBuffer(this.indices),this.segment=l.SegmentVector.simpleSegment(0,0,36,12)}}function io(f,s,h,g,v,b){const A=f.gl,I=s.paint.get("sky-atmosphere-color"),D=s.paint.get("sky-atmosphere-halo-color"),N=s.paint.get("sky-atmosphere-sun-intensity"),B=((q,J,ne,oe,ie)=>({u_matrix_3f:q,u_sun_direction:J,u_sun_intensity:ne,u_color_tint_r:[oe.r,oe.g,oe.b,oe.a],u_color_tint_m:[ie.r,ie.g,ie.b,ie.a],u_luminance:5e-5}))(l.fromMat4(l.create$1(),g),v,N,I,D);A.framebufferTexture2D(A.FRAMEBUFFER,A.COLOR_ATTACHMENT0,A.TEXTURE_CUBE_MAP_POSITIVE_X+b,s.skyboxTexture,0),h.draw(f,A.TRIANGLES,l.DepthMode.disabled,l.StencilMode.disabled,l.ColorMode.unblended,l.CullFaceMode.frontCW,B,"skyboxCapture",s.skyboxGeometry.vertexBuffer,s.skyboxGeometry.indexBuffer,s.skyboxGeometry.segment)}const Wc=l.createLayout([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class w0{constructor(s){const h=new l.StructArrayLayout5f20;h.emplaceBack(-1,1,1,0,0),h.emplaceBack(1,1,1,1,0),h.emplaceBack(1,-1,1,1,1),h.emplaceBack(-1,-1,1,0,1);const g=new l.StructArrayLayout3ui6;g.emplaceBack(0,1,2),g.emplaceBack(2,3,0),this.vertexBuffer=s.createVertexBuffer(h,Wc.members),this.indexBuffer=s.createIndexBuffer(g),this.segments=l.SegmentVector.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}const Bs={symbol:function(f,s,h,g,v){if(f.renderPass!=="translucent")return;const b=l.StencilMode.disabled,A=f.colorModeForRenderPass();h.layout.get("text-variable-anchor")&&function(I,D,N,B,q,J,ne){const oe=D.transform,ie=q==="map",ae=J==="map";for(const Z of I){const re=B.getTile(Z),ue=re.getBucket(N);if(!ue||!ue.text||!ue.text.segments.get().length)continue;const he=l.evaluateSizeForZoom(ue.textSizeData,oe.zoom),be=Xr(Z,ue.getProjection(),oe),Se=oe.calculatePixelsToTileUnitsMatrix(re),we=Ge(be,re.tileID.canonical,ae,ie,oe,ue.getProjection(),Se),Ce=N.layout.get("icon-text-fit")!=="none"&&ue.hasIconData();if(he){const Ie=Math.pow(2,oe.zoom-re.tileID.overscaledZ);rx(ue,ie,ae,ne,l.symbolSize,oe,we,Z,Ie,he,Ce)}}}(g,f,h,s,h.layout.get("text-rotation-alignment"),h.layout.get("text-pitch-alignment"),v),h.paint.get("icon-opacity").constantOr(1)!==0&&g0(f,s,h,g,!1,h.paint.get("icon-translate"),h.paint.get("icon-translate-anchor"),h.layout.get("icon-rotation-alignment"),h.layout.get("icon-pitch-alignment"),h.layout.get("icon-keep-upright"),b,A),h.paint.get("text-opacity").constantOr(1)!==0&&g0(f,s,h,g,!0,h.paint.get("text-translate"),h.paint.get("text-translate-anchor"),h.layout.get("text-rotation-alignment"),h.layout.get("text-pitch-alignment"),h.layout.get("text-keep-upright"),b,A),s.map.showCollisionBoxes&&(Vc(f,s,h,g,h.paint.get("text-translate"),h.paint.get("text-translate-anchor"),!0),Vc(f,s,h,g,h.paint.get("icon-translate"),h.paint.get("icon-translate-anchor"),!1))},circle:function(f,s,h,g){if(f.renderPass!=="translucent")return;const v=h.paint.get("circle-opacity"),b=h.paint.get("circle-stroke-width"),A=h.paint.get("circle-stroke-opacity"),I=h.layout.get("circle-sort-key").constantOr(1)!==void 0;if(v.constantOr(1)===0&&(b.constantOr(1)===0||A.constantOr(1)===0))return;const D=f.context,N=D.gl,B=f.transform,q=f.depthModeForSublayer(0,l.DepthMode.ReadOnly),J=l.StencilMode.disabled,ne=f.colorModeForRenderPass(),oe=B.projection.name==="globe",ie=[l.mercatorXfromLng(B.center.lng),l.mercatorYfromLat(B.center.lat)],ae=[];for(let re=0;rere.sortKey-ue.sortKey);const Z={useDepthForOcclusion:!oe};for(const re of ae){const{programConfiguration:ue,program:he,layoutVertexBuffer:be,globeExtVertexBuffer:Se,indexBuffer:we,uniformValues:Ce,tile:Ie}=re.state,Re=re.segments;f.terrain&&f.terrain.setupElevationDraw(Ie,he,Z),f.prepareDrawProgram(D,he,Ie.tileID.toUnwrapped()),he.draw(D,N.TRIANGLES,q,J,ne,l.CullFaceMode.disabled,Ce,h.id,be,we,Re,h.paint,B.zoom,ue,[Se])}},heatmap:function(f,s,h,g){if(h.paint.get("heatmap-opacity")!==0)if(f.renderPass==="offscreen"){const v=f.context,b=v.gl,A=l.StencilMode.disabled,I=new l.ColorMode([b.ONE,b.ONE],l.Color.transparent,[!0,!0,!0,!0]);(function(ne,oe,ie,ae){const Z=ne.gl,re=oe.width*ae,ue=oe.height*ae;ne.activeTexture.set(Z.TEXTURE1),ne.viewport.set([0,0,re,ue]);let he=ie.heatmapFbo;if(!he||he&&(he.width!==re||he.height!==ue)){he&&he.destroy();const be=Z.createTexture();Z.bindTexture(Z.TEXTURE_2D,be),Z.texParameteri(Z.TEXTURE_2D,Z.TEXTURE_WRAP_S,Z.CLAMP_TO_EDGE),Z.texParameteri(Z.TEXTURE_2D,Z.TEXTURE_WRAP_T,Z.CLAMP_TO_EDGE),Z.texParameteri(Z.TEXTURE_2D,Z.TEXTURE_MIN_FILTER,Z.LINEAR),Z.texParameteri(Z.TEXTURE_2D,Z.TEXTURE_MAG_FILTER,Z.LINEAR),he=ie.heatmapFbo=ne.createFramebuffer(re,ue,!1),function(Se,we,Ce,Ie,Re,st){const De=Se.gl;De.texImage2D(De.TEXTURE_2D,0,Se.isWebGL2&&Se.extRenderToTextureHalfFloat?De.RGBA16F:De.RGBA,Re,st,0,De.RGBA,Se.extRenderToTextureHalfFloat?Se.isWebGL2?De.HALF_FLOAT:Se.extTextureHalfFloat.HALF_FLOAT_OES:De.UNSIGNED_BYTE,null),Ie.colorAttachment.set(Ce)}(ne,0,be,he,re,ue)}else Z.bindTexture(Z.TEXTURE_2D,he.colorAttachment.get()),ne.bindFramebuffer.set(he.framebuffer)})(v,f,h,f.transform.projection.name==="globe"?.5:.25),v.clear({color:l.Color.transparent});const D=f.transform,N=D.projection.name==="globe",B=N?["PROJECTION_GLOBE_VIEW"]:null,q=N?l.CullFaceMode.frontCCW:l.CullFaceMode.disabled,J=[l.mercatorXfromLng(D.center.lng),l.mercatorYfromLat(D.center.lat)];for(let ne=0;ne({u_image:0,u_color_ramp:1,u_opacity:q.paint.get("heatmap-opacity")}))(0,b),b.id,v.viewportBuffer,v.quadTriangleIndexBuffer,v.viewportSegments,b.paint,v.transform.zoom)}(f,h))},line:function(f,s,h,g){if(f.renderPass!=="translucent")return;const v=h.paint.get("line-opacity"),b=h.paint.get("line-width");if(v.constantOr(1)===0||b.constantOr(1)===0)return;const A=f.depthModeForSublayer(0,l.DepthMode.ReadOnly),I=f.colorModeForRenderPass(),D=f.terrain&&f.terrain.renderingToTexture?1:l.exported.devicePixelRatio,N=h.paint.get("line-dasharray"),B=N.constantOr(1),q=h.layout.get("line-cap"),J=h.paint.get("line-pattern"),ne=J.constantOr(1),oe=h.paint.get("line-gradient"),ie=ne?"linePattern":"line",ae=f.context,Z=ae.gl,re=(he=>{const be=[];jc(he)&&be.push("RENDER_LINE_DASH"),he.paint.get("line-gradient")&&be.push("RENDER_LINE_GRADIENT");const Se=he.paint.get("line-trim-offset");Se[0]===0&&Se[1]===0||be.push("RENDER_LINE_TRIM_OFFSET");const we=he.paint.get("line-pattern").constantOr(1),Ce=he.paint.get("line-opacity").constantOr(1)!==1;return!we&&Ce&&be.push("RENDER_LINE_ALPHA_DISCARD"),be})(h);let ue=re.includes("RENDER_LINE_ALPHA_DISCARD");f.terrain&&f.terrain.clipOrMaskOverlapStencilType()&&(ue=!1);for(const he of g){const be=s.getTile(he);if(ne&&!be.patternsLoaded())continue;const Se=be.getBucket(h);if(!Se)continue;f.prepareDrawTile();const we=Se.programConfigurations.get(h.id),Ce=f.useProgram(ie,we,re),Ie=J.constantOr(null);if(Ie&&be.imageAtlas){const Ze=be.imageAtlas.patternPositions[Ie.toString()];Ze&&we.setConstantPatternPositions(Ze)}const Re=N.constantOr(null),st=q.constantOr(null);if(!ne&&Re&&st&&be.lineAtlas){const Ze=be.lineAtlas.getDash(Re,st);Ze&&we.setConstantPatternPositions(Ze)}let[De,Ke]=h.paint.get("line-trim-offset");(st==="round"||st==="square")&&De!==Ke&&(De===0&&(De-=1),Ke===1&&(Ke+=1));const Ne=f.terrain?he.projMatrix:null,at=ne?Uc(f,be,h,Ne,D):ex(f,be,h,Ne,Se.lineClipsArray.length,D,[De,Ke]);if(oe){const Ze=Se.gradients[h.id];let ut=Ze.texture;if(h.gradientVersion!==Ze.version){let tt=256;if(h.stepInterpolant){const ht=s.getSource().maxzoom,Mt=he.canonical.z===ht?Math.ceil(1<{Ce.draw(ae,Z.TRIANGLES,A,Ze,I,l.CullFaceMode.disabled,at,h.id,Se.layoutVertexBuffer,Se.indexBuffer,Se.segments,h.paint,f.transform.zoom,we,[Se.layoutVertexBuffer2])};if(ue){const Ze=f.stencilModeForClipping(he).ref;Ze===0&&f.terrain&&ae.clear({stencil:0});const ut={func:Z.EQUAL,mask:255};at.u_alpha_discard_threshold=.8,ze(new l.StencilMode(ut,Ze,255,Z.KEEP,Z.KEEP,Z.INVERT)),at.u_alpha_discard_threshold=0,ze(new l.StencilMode(ut,Ze,255,Z.KEEP,Z.KEEP,Z.KEEP))}else ze(f.stencilModeForClipping(he))}ue&&(f.resetStencilClippingMasks(),f.terrain&&ae.clear({stencil:0}))},fill:function(f,s,h,g){const v=h.paint.get("fill-color"),b=h.paint.get("fill-opacity");if(b.constantOr(1)===0)return;const A=f.colorModeForRenderPass(),I=h.paint.get("fill-pattern"),D=f.opaquePassEnabledForLayer()&&!I.constantOr(1)&&v.constantOr(l.Color.transparent).a===1&&b.constantOr(0)===1?"opaque":"translucent";if(f.renderPass===D){const N=f.depthModeForSublayer(1,f.renderPass==="opaque"?l.DepthMode.ReadWrite:l.DepthMode.ReadOnly);y0(f,s,h,g,N,A,!1)}if(f.renderPass==="translucent"&&h.paint.get("fill-antialias")){const N=f.depthModeForSublayer(h.getPaintProperty("fill-outline-color")?2:0,l.DepthMode.ReadOnly);y0(f,s,h,g,N,A,!0)}},"fill-extrusion":function(f,s,h,g){const v=h.paint.get("fill-extrusion-opacity");if(v!==0&&f.renderPass==="translucent"){const b=new l.DepthMode(f.context.gl.LEQUAL,l.DepthMode.ReadWrite,f.depthRangeFor3D);if(v!==1||h.paint.get("fill-extrusion-pattern").constantOr(1))rh(f,s,h,g,b,l.StencilMode.disabled,l.ColorMode.disabled),rh(f,s,h,g,b,f.stencilModeFor3D(),f.colorModeForRenderPass()),f.resetStencilClippingMasks();else{const A=f.colorModeForRenderPass();rh(f,s,h,g,b,l.StencilMode.disabled,A)}}},hillshade:function(f,s,h,g){if(f.renderPass!=="offscreen"&&f.renderPass!=="translucent")return;const v=f.context,b=f.depthModeForSublayer(0,l.DepthMode.ReadOnly),A=f.colorModeForRenderPass(),I=f.terrain&&f.terrain.renderingToTexture,[D,N]=f.renderPass!=="translucent"||I?[{},g]:f.stencilConfigForOverlap(g);for(const B of N){const q=s.getTile(B);if(q.needsHillshadePrepare&&f.renderPass==="offscreen")l0(f,q,h,b,l.StencilMode.disabled,A);else if(f.renderPass==="translucent"){const J=I&&f.terrain?f.terrain.stencilModeForRTTOverlap(B):D[B.overscaledZ];s0(f,B,q,h,b,J,A)}}v.viewport.set([0,0,f.width,f.height]),f.resetStencilClippingMasks()},raster:function(f,s,h,g,v,b){if(f.renderPass!=="translucent"||h.paint.get("raster-opacity")===0||!g.length)return;const A=f.context,I=A.gl,D=s.getSource(),N=f.useProgram("raster"),B=f.colorModeForRenderPass(),q=f.terrain&&f.terrain.renderingToTexture,[J,ne]=D instanceof jt||q?[{},g]:f.stencilConfigForOverlap(g),oe=ne[ne.length-1].overscaledZ,ie=!f.options.moving;for(const ae of ne){const Z=q?l.DepthMode.disabled:f.depthModeForSublayer(ae.overscaledZ-oe,h.paint.get("raster-opacity")===1?l.DepthMode.ReadWrite:l.DepthMode.ReadOnly,I.LESS),re=ae.toUnwrapped(),ue=s.getTile(ae);if(q&&(!ue||!ue.hasData()))continue;const he=q?ae.projMatrix:f.transform.calculateProjMatrix(re,ie),be=f.terrain&&q?f.terrain.stencilModeForRTTOverlap(ae):J[ae.overscaledZ],Se=b?0:h.paint.get("raster-fade-duration");ue.registerFadeDuration(Se);const we=s.findLoadedParent(ae,0),Ce=hp(ue,we,s,f.transform,Se);let Ie,Re;f.terrain&&f.terrain.prepareDrawTile();const st=h.paint.get("raster-resampling")==="nearest"?I.NEAREST:I.LINEAR;A.activeTexture.set(I.TEXTURE0),ue.texture.bind(st,I.CLAMP_TO_EDGE),A.activeTexture.set(I.TEXTURE1),we?(we.texture.bind(st,I.CLAMP_TO_EDGE),Ie=Math.pow(2,we.tileID.overscaledZ-ue.tileID.overscaledZ),Re=[ue.tileID.canonical.x*Ie%1,ue.tileID.canonical.y*Ie%1]):ue.texture.bind(st,I.CLAMP_TO_EDGE),ue.texture.useMipmap&&A.extTextureFilterAnisotropic&&f.transform.pitch>20&&I.texParameterf(I.TEXTURE_2D,A.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,A.extTextureFilterAnisotropicMax);const De=xp(he,Re||[0,0],Ie||1,Ce,h,D instanceof jt?D.perspectiveTransform:[0,0]);if(f.prepareDrawProgram(A,N,re),D instanceof jt)D.boundsBuffer&&D.boundsSegments&&N.draw(A,I.TRIANGLES,Z,l.StencilMode.disabled,B,l.CullFaceMode.disabled,De,h.id,D.boundsBuffer,f.quadTriangleIndexBuffer,D.boundsSegments);else{const{tileBoundsBuffer:Ke,tileBoundsIndexBuffer:Ne,tileBoundsSegments:at}=f.getTileBoundsBuffers(ue);N.draw(A,I.TRIANGLES,Z,be,B,l.CullFaceMode.disabled,De,h.id,Ke,Ne,at)}}f.resetStencilClippingMasks()},background:function(f,s,h,g){const v=h.paint.get("background-color"),b=h.paint.get("background-opacity");if(b===0)return;const A=f.context,I=A.gl,D=f.transform,N=D.tileSize,B=h.paint.get("background-pattern");if(f.isPatternMissing(B))return;const q=!B&&v.a===1&&b===1&&f.opaquePassEnabledForLayer()?"opaque":"translucent";if(f.renderPass!==q)return;const J=l.StencilMode.disabled,ne=f.depthModeForSublayer(0,q==="opaque"?l.DepthMode.ReadWrite:l.DepthMode.ReadOnly),oe=f.colorModeForRenderPass(),ie=f.useProgram(B?"backgroundPattern":"background");let ae,Z=g;Z||(ae=f.getBackgroundTiles(),Z=Object.values(ae).map(re=>re.tileID)),B&&(A.activeTexture.set(I.TEXTURE0),f.imageManager.bind(f.context));for(const re of Z){const ue=re.toUnwrapped(),he=g?re.projMatrix:f.transform.calculateProjMatrix(ue);f.prepareDrawTile();const be=s?s.getTile(re):ae?ae[re.key]:new l.Tile(re,N,D.zoom,f),Se=B?tx(he,b,f,B,{tileID:re,tileSize:N}):wp(he,b,v);f.prepareDrawProgram(A,ie,ue);const{tileBoundsBuffer:we,tileBoundsIndexBuffer:Ce,tileBoundsSegments:Ie}=f.getTileBoundsBuffers(be);ie.draw(A,I.TRIANGLES,ne,J,oe,l.CullFaceMode.disabled,Se,h.id,we,Ce,Ie)}},sky:function(f,s,h){const g=f.transform,v=g.projection.name==="mercator"||g.projection.name==="globe"?1:l.smoothstep(7,8,g.zoom),b=h.paint.get("sky-opacity")*v;if(b===0)return;const A=f.context,I=h.paint.get("sky-type"),D=new l.DepthMode(A.gl.LEQUAL,l.DepthMode.ReadOnly,[0,1]),N=f.frameCounter/1e3%1;I==="atmosphere"?f.renderPass==="offscreen"?h.needsSkyboxCapture(f)&&(function(B,q,J,ne){const oe=B.context,ie=oe.gl;let ae=q.skyboxFbo;if(!ae){ae=q.skyboxFbo=oe.createFramebuffer(32,32,!1),q.skyboxGeometry=new ih(oe),q.skyboxTexture=oe.gl.createTexture(),ie.bindTexture(ie.TEXTURE_CUBE_MAP,q.skyboxTexture),ie.texParameteri(ie.TEXTURE_CUBE_MAP,ie.TEXTURE_WRAP_S,ie.CLAMP_TO_EDGE),ie.texParameteri(ie.TEXTURE_CUBE_MAP,ie.TEXTURE_WRAP_T,ie.CLAMP_TO_EDGE),ie.texParameteri(ie.TEXTURE_CUBE_MAP,ie.TEXTURE_MIN_FILTER,ie.LINEAR),ie.texParameteri(ie.TEXTURE_CUBE_MAP,ie.TEXTURE_MAG_FILTER,ie.LINEAR);for(let he=0;he<6;++he)ie.texImage2D(ie.TEXTURE_CUBE_MAP_POSITIVE_X+he,0,ie.RGBA,32,32,0,ie.RGBA,ie.UNSIGNED_BYTE,null)}oe.bindFramebuffer.set(ae.framebuffer),oe.viewport.set([0,0,32,32]);const Z=q.getCenter(B,!0),re=B.useProgram("skyboxCapture"),ue=new Float64Array(16);l.identity(ue),l.rotateY(ue,ue,.5*-Math.PI),io(oe,q,re,ue,Z,0),l.identity(ue),l.rotateY(ue,ue,.5*Math.PI),io(oe,q,re,ue,Z,1),l.identity(ue),l.rotateX(ue,ue,.5*-Math.PI),io(oe,q,re,ue,Z,2),l.identity(ue),l.rotateX(ue,ue,.5*Math.PI),io(oe,q,re,ue,Z,3),l.identity(ue),io(oe,q,re,ue,Z,4),l.identity(ue),l.rotateY(ue,ue,Math.PI),io(oe,q,re,ue,Z,5),oe.viewport.set([0,0,B.width,B.height])}(f,h),h.markSkyboxValid(f)):f.renderPass==="sky"&&function(B,q,J,ne,oe){const ie=B.context,ae=ie.gl,Z=B.transform,re=B.useProgram("skybox");ie.activeTexture.set(ae.TEXTURE0),ae.bindTexture(ae.TEXTURE_CUBE_MAP,q.skyboxTexture);const ue=((he,be,Se,we,Ce)=>({u_matrix:he,u_sun_direction:be,u_cubemap:0,u_opacity:we,u_temporal_offset:Ce}))(Z.skyboxMatrix,q.getCenter(B,!1),0,ne,oe);B.prepareDrawProgram(ie,re),re.draw(ie,ae.TRIANGLES,J,l.StencilMode.disabled,B.colorModeForRenderPass(),l.CullFaceMode.backCW,ue,"skybox",q.skyboxGeometry.vertexBuffer,q.skyboxGeometry.indexBuffer,q.skyboxGeometry.segment)}(f,h,D,b,N):I==="gradient"&&f.renderPass==="sky"&&function(B,q,J,ne,oe){const ie=B.context,ae=ie.gl,Z=B.transform,re=B.useProgram("skyboxGradient");q.skyboxGeometry||(q.skyboxGeometry=new ih(ie)),ie.activeTexture.set(ae.TEXTURE0);let ue=q.colorRampTexture;ue||(ue=q.colorRampTexture=new l.Texture(ie,q.colorRamp,ae.RGBA)),ue.bind(ae.LINEAR,ae.CLAMP_TO_EDGE);const he=((be,Se,we,Ce,Ie)=>({u_matrix:be,u_color_ramp:0,u_center_direction:Se,u_radius:l.degToRad(we),u_opacity:Ce,u_temporal_offset:Ie}))(Z.skyboxMatrix,q.getCenter(B,!1),q.paint.get("sky-gradient-radius"),ne,oe);B.prepareDrawProgram(ie,re),re.draw(ie,ae.TRIANGLES,J,l.StencilMode.disabled,B.colorModeForRenderPass(),l.CullFaceMode.backCW,he,"skyboxGradient",q.skyboxGeometry.vertexBuffer,q.skyboxGeometry.indexBuffer,q.skyboxGeometry.segment)}(f,h,D,b,N)},debug:function(f,s,h){for(let g=0;gv)return void(this.transform.fogCullDistSq=null);const b=g+.78*(v-g);this.transform.fogCullDistSq=b*b}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled?this._terrain:null}resize(s,h){if(this.width=s*l.exported.devicePixelRatio,this.height=h*l.exported.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const g of this.style.order)this.style._layers[g].resize()}setup(){const s=this.context,h=new l.StructArrayLayout2i4;h.emplaceBack(0,0),h.emplaceBack(l.EXTENT,0),h.emplaceBack(0,l.EXTENT),h.emplaceBack(l.EXTENT,l.EXTENT),this.tileExtentBuffer=s.createVertexBuffer(h,l.posAttributes.members),this.tileExtentSegments=l.SegmentVector.simpleSegment(0,0,4,2);const g=new l.StructArrayLayout2i4;g.emplaceBack(0,0),g.emplaceBack(l.EXTENT,0),g.emplaceBack(0,l.EXTENT),g.emplaceBack(l.EXTENT,l.EXTENT),this.debugBuffer=s.createVertexBuffer(g,l.posAttributes.members),this.debugSegments=l.SegmentVector.simpleSegment(0,0,4,5);const v=new l.StructArrayLayout2i4;v.emplaceBack(-1,-1),v.emplaceBack(1,-1),v.emplaceBack(-1,1),v.emplaceBack(1,1),this.viewportBuffer=s.createVertexBuffer(v,l.posAttributes.members),this.viewportSegments=l.SegmentVector.simpleSegment(0,0,4,2);const b=new l.StructArrayLayout4i8;b.emplaceBack(0,0,0,0),b.emplaceBack(l.EXTENT,0,l.EXTENT,0),b.emplaceBack(0,l.EXTENT,0,l.EXTENT),b.emplaceBack(l.EXTENT,l.EXTENT,l.EXTENT,l.EXTENT),this.mercatorBoundsBuffer=s.createVertexBuffer(b,l.boundsAttributes.members),this.mercatorBoundsSegments=l.SegmentVector.simpleSegment(0,0,4,2);const A=new l.StructArrayLayout3ui6;A.emplaceBack(0,1,2),A.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=s.createIndexBuffer(A);const I=new l.StructArrayLayout1ui2;for(const N of[0,1,3,2,0])I.emplaceBack(N);this.debugIndexBuffer=s.createIndexBuffer(I),this.emptyTexture=new l.Texture(s,new l.RGBAImage({width:1,height:1},Uint8Array.of(0,0,0,0)),s.gl.RGBA),this.identityMat=l.create();const D=this.context.gl;this.stencilClearMode=new l.StencilMode({func:D.ALWAYS,mask:0},0,255,D.ZERO,D.ZERO,D.ZERO),this.loadTimeStamps.push(l.window.performance.now()),this.atmosphereBuffer=new w0(this.context)}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(s){return s._makeTileBoundsBuffers(this.context,this.transform.projection),s._tileBoundsBuffer?{tileBoundsBuffer:s._tileBoundsBuffer,tileBoundsIndexBuffer:s._tileBoundsIndexBuffer,tileBoundsSegments:s._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){const s=this.context,h=s.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.useProgram("clippingMask").draw(s,h.TRIANGLES,l.DepthMode.disabled,this.stencilClearMode,l.ColorMode.disabled,l.CullFaceMode.disabled,Bc(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(s,h,g){if(!h||this.currentStencilSource===h.id||!s.isTileClipped()||!g||g.length===0)return;if(this._tileClippingMaskIDs&&!this.terrain){let I=!1;for(const D of g)if(this._tileClippingMaskIDs[D.key]===void 0){I=!0;break}if(!I)return}this.currentStencilSource=h.id;const v=this.context,b=v.gl;this.nextStencilID+g.length>256&&this.clearStencil(),v.setColorMode(l.ColorMode.disabled),v.setDepthMode(l.DepthMode.disabled);const A=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const I of g){const D=h.getTile(I),N=this._tileClippingMaskIDs[I.key]=this.nextStencilID++,{tileBoundsBuffer:B,tileBoundsIndexBuffer:q,tileBoundsSegments:J}=this.getTileBoundsBuffers(D);A.draw(v,b.TRIANGLES,l.DepthMode.disabled,new l.StencilMode({func:b.ALWAYS,mask:0},N,255,b.KEEP,b.KEEP,b.REPLACE),l.ColorMode.disabled,l.CullFaceMode.disabled,Bc(I.projMatrix),"$clipping",B,q,J)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const s=this.nextStencilID++,h=this.context.gl;return new l.StencilMode({func:h.NOTEQUAL,mask:255},s,255,h.KEEP,h.KEEP,h.REPLACE)}stencilModeForClipping(s){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(s);const h=this.context.gl;return new l.StencilMode({func:h.EQUAL,mask:255},this._tileClippingMaskIDs[s.key],0,h.KEEP,h.KEEP,h.REPLACE)}stencilConfigForOverlap(s){const h=this.context.gl,g=s.sort((A,I)=>I.overscaledZ-A.overscaledZ),v=g[g.length-1].overscaledZ,b=g[0].overscaledZ-v+1;if(b>1){this.currentStencilSource=void 0,this.nextStencilID+b>256&&this.clearStencil();const A={};for(let I=0;I=0;this.currentLayer--){const N=this.style._layers[g[this.currentLayer]],B=s._getLayerSourceCache(N);if(N.isSky())continue;const q=B?A[B.id]:void 0;this._renderTileClippingMasks(N,B,q),this.renderLayer(this,B,N,q)}if(this.style.fog&&this.transform.projection.supportsFog&&function(N,B){const q=N.context,J=q.gl,ne=N.transform,oe=new l.DepthMode(J.LEQUAL,l.DepthMode.ReadOnly,[0,1]),ie=N.useProgram("globeAtmosphere",null,ne.projection.name==="globe"?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"]),ae=l.globeToMercatorTransition(ne.zoom),Z=B.properties.get("color").toArray01(),re=B.properties.get("high-color").toArray01(),ue=B.properties.get("space-color").toArray01PremultipliedAlpha(),he=l.identity$1([]);l.rotateY$1(he,he,-l.degToRad(ne._center.lng)),l.rotateX$1(he,he,l.degToRad(ne._center.lat)),l.rotateZ$1(he,he,ne.angle),l.rotateX$1(he,he,-ne._pitch);const be=l.fromQuat(new Float32Array(16),he),Se=l.mapValue(B.properties.get("star-intensity"),0,1,0,.25),we=5e-4,Ce=l.mapValue(B.properties.get("horizon-blend"),0,1,we,.25),Ie=l.globeUseCustomAntiAliasing(N,q,ne)&&Ce===we?ne.worldSize/(2*Math.PI*1.025)-1:ne.globeRadius,Re=N.frameCounter/1e3%1,st=l.length(ne.globeCenterInViewSpace),De=Math.sqrt(Math.pow(st,2)-Math.pow(Ie,2)),Ke=Math.acos(De/st),Ne=((ze,Ze,ut,tt,ht,Mt,$t,It,Lt,nr,er,Pt,Ar,Mr)=>({u_frustum_tl:ze,u_frustum_tr:Ze,u_frustum_br:ut,u_frustum_bl:tt,u_horizon:ht,u_transition:Mt,u_fadeout_range:$t,u_color:It,u_high_color:Lt,u_space_color:nr,u_star_intensity:er,u_star_size:5*l.exported.devicePixelRatio,u_star_density:0,u_temporal_offset:Pt,u_horizon_angle:Ar,u_rotation_matrix:Mr}))(ne.frustumCorners.TL,ne.frustumCorners.TR,ne.frustumCorners.BR,ne.frustumCorners.BL,ne.frustumCorners.horizon,ae,Ce,Z,re,ue,Se,Re,Ke,be);N.prepareDrawProgram(q,ie);const at=N.atmosphereBuffer;at&&ie.draw(q,J.TRIANGLES,oe,l.StencilMode.disabled,l.ColorMode.alphaBlended,l.CullFaceMode.backCW,Ne,"skybox",at.vertexBuffer,at.indexBuffer,at.segments)}(this,this.style.fog),this.renderPass="sky",(l.globeToMercatorTransition(this.transform.zoom)>0||this.transform.projection.name!=="globe")&&this.transform.isHorizonVisible())for(this.currentLayer=0;this.currentLayer{const q=s._getLayerSourceCache(B);q&&!B.isHidden(this.transform.zoom)&&(!N||N.getSource().maxzoom0?h.pop():null}isPatternMissing(s){return s===null||s!==void 0&&!this.imageManager.getPattern(s.toString())}terrainRenderModeElevated(){return this.style&&!!this.style.getTerrain()&&!!this.terrain&&!this.terrain.renderingToTexture}currentGlobalDefines(){const s=this.terrain&&this.terrain.renderingToTexture,h=this.terrain&&this.terrain.exaggeration()===0,g=this.style&&this.style.fog,v=[];return this.terrainRenderModeElevated()&&v.push("TERRAIN"),this.transform.projection.name==="globe"&&v.push("GLOBE"),h&&v.push("ZERO_EXAGGERATION"),g&&!s&&g.getOpacity(this.transform.pitch)!==0&&v.push("FOG"),s&&v.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&v.push("OVERDRAW_INSPECTOR"),v}useProgram(s,h,g){this.cache=this.cache||{};const v=g||[],b=this.currentGlobalDefines().concat(v),A=dr.cacheKey(sp[s],s,b,h);return this.cache[A]||(this.cache[A]=new dr(this.context,s,sp[s],h,Ep[s],b)),this.cache[A]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.frontFace.setDefault(),this.context.cullFaceSide.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const s=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(s.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=l.window.document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new l.Texture(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this._terrain&&this._terrain.destroy(),this.globeSharedBuffers&&this.globeSharedBuffers.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this.atmosphereBuffer&&this.atmosphereBuffer.destroy()}prepareDrawTile(){this.terrain&&this.terrain.prepareDrawTile()}prepareDrawProgram(s,h,g){if(this.terrain&&this.terrain.renderingToTexture)return;const v=this.style.fog;if(v){const b=v.getOpacity(this.transform.pitch),A=((I,D,N,B,q,J,ne,oe,ie,ae,Z)=>{const re=I.transform,ue=D.properties.get("color").toArray01();ue[3]=B;const he=I.frameCounter/1e3%1;return{u_fog_matrix:N?re.calculateFogTileMatrix(N):I.identityMat,u_fog_range:D.getFovAdjustedRange(re._fov),u_fog_color:ue,u_fog_horizon_blend:D.properties.get("horizon-blend"),u_fog_temporal_offset:he,u_frustum_tl:q,u_frustum_tr:J,u_frustum_br:ne,u_frustum_bl:oe,u_globe_pos:ie,u_globe_radius:ae,u_viewport:Z,u_globe_transition:l.globeToMercatorTransition(re.zoom),u_is_globe:+(re.projection.name==="globe")}})(this,v,g,b,this.transform.frustumCorners.TL,this.transform.frustumCorners.TR,this.transform.frustumCorners.BR,this.transform.frustumCorners.BL,this.transform.globeCenterInViewSpace,this.transform.globeRadius,[this.transform.width*l.exported.devicePixelRatio,this.transform.height*l.exported.devicePixelRatio]);h.setFogUniformValues(s,A)}}setTileLoadedFlag(s){this.tileLoaded=s}saveCanvasCopy(){const s=this.canvasCopy();s&&(this.frameCopies.push(s),this.tileLoaded=!1)}canvasCopy(){const s=this.context.gl,h=s.createTexture();return s.bindTexture(s.TEXTURE_2D,h),s.copyTexImage2D(s.TEXTURE_2D,0,s.RGBA,0,0,s.drawingBufferWidth,s.drawingBufferHeight,0),h}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;const s=this.style&&this.style.fog;return!!s&&s.getOpacity(this.transform.pitch)!==0}getBackgroundTiles(){const s=this._backgroundTiles,h=this._backgroundTiles={},g=this.transform.coveringTiles({tileSize:512});for(const v of g)h[v.key]=s[v.key]||new l.Tile(v,512,this.transform.tileZoom,this);return h}clearBackgroundTiles(){this._backgroundTiles={}}}class oh{constructor(s=0,h=0,g=0,v=0){if(isNaN(s)||s<0||isNaN(h)||h<0||isNaN(g)||g<0||isNaN(v)||v<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=s,this.bottom=h,this.left=g,this.right=v}interpolate(s,h,g){return h.top!=null&&s.top!=null&&(this.top=l.number(s.top,h.top,g)),h.bottom!=null&&s.bottom!=null&&(this.bottom=l.number(s.bottom,h.bottom,g)),h.left!=null&&s.left!=null&&(this.left=l.number(s.left,h.left,g)),h.right!=null&&s.right!=null&&(this.right=l.number(s.right,h.right,g)),this}getCenter(s,h){const g=l.clamp((this.left+s-this.right)/2,0,s),v=l.clamp((this.top+h-this.bottom)/2,0,h);return new l.Point(g,v)}equals(s){return this.top===s.top&&this.bottom===s.bottom&&this.left===s.left&&this.right===s.right}clone(){return new oh(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function ah(f,s){const h=l.getColumn(f,3);l.fromQuat(f,s),l.setColumn(f,3,h)}function pr(f,s){const h=l.identity$1([]);return l.rotateZ$1(h,h,-s),l.rotateX$1(h,h,-f),h}function Gc(f,s){const h=[f[0],f[1],0],g=[s[0],s[1],0];if(l.length(h)>=1e-15){const A=l.normalize([],h);l.scale$2(g,A,l.dot(g,A)),s[0]=g[0],s[1]=g[1]}const v=l.cross([],s,f);if(l.len(v)<1e-15)return null;const b=Math.atan2(-v[1],v[0]);return pr(Math.atan2(Math.sqrt(f[0]*f[0]+f[1]*f[1]),-f[2]),b)}class E0{constructor(s,h){this.position=s,this.orientation=h}get position(){return this._position}set position(s){if(s){const h=s instanceof l.MercatorCoordinate?s:new l.MercatorCoordinate(s[0],s[1],s[2]);this._renderWorldCopies&&(h.x=l.wrap(h.x,0,1)),this._position=h}else this._position=null}lookAtPoint(s,h){if(this.orientation=null,!this.position)return;const g=this.position,v=this._elevation?this._elevation.getAtPointOrZero(l.MercatorCoordinate.fromLngLat(s)):0,b=l.MercatorCoordinate.fromLngLat(s,v),A=[b.x-g.x,b.y-g.y,b.z-g.z];h||(h=[0,0,1]),h[2]=Math.abs(h[2]),this.orientation=Gc(A,h)}setPitchBearing(s,h){this.orientation=pr(l.degToRad(s),l.degToRad(-h))}}class sh{constructor(s,h){this._transform=l.identity([]),this.orientation=h,this.position=s}get mercatorPosition(){const s=this.position;return new l.MercatorCoordinate(s[0],s[1],s[2])}get position(){const s=l.getColumn(this._transform,3);return[s[0],s[1],s[2]]}set position(s){var h;s&&l.setColumn(this._transform,3,[(h=s)[0],h[1],h[2],1])}get orientation(){return this._orientation}set orientation(s){this._orientation=s||l.identity$1([]),s&&ah(this._transform,this._orientation)}getPitchBearing(){const s=this.forward(),h=this.right();return{bearing:Math.atan2(-h[1],h[0]),pitch:Math.atan2(Math.sqrt(s[0]*s[0]+s[1]*s[1]),-s[2])}}setPitchBearing(s,h){this._orientation=pr(s,h),ah(this._transform,this._orientation)}forward(){const s=l.getColumn(this._transform,2);return[-s[0],-s[1],-s[2]]}up(){const s=l.getColumn(this._transform,1);return[-s[0],-s[1],-s[2]]}right(){const s=l.getColumn(this._transform,0);return[s[0],s[1],s[2]]}getCameraToWorld(s,h){const g=new Float64Array(16);return l.invert(g,this.getWorldToCamera(s,h)),g}getWorldToCameraPosition(s,h,g){const v=this.position;l.scale$2(v,v,-s);const b=new Float64Array(16);return l.fromScaling(b,[g,g,g]),l.translate(b,b,v),b[10]*=h,b}getWorldToCamera(s,h){const g=new Float64Array(16),v=new Float64Array(4),b=this.position;return l.conjugate(v,this._orientation),l.scale$2(b,b,-s),l.fromQuat(g,v),l.translate(g,g,b),g[1]*=-1,g[5]*=-1,g[9]*=-1,g[13]*=-1,g[8]*=h,g[9]*=h,g[10]*=h,g[11]*=h,g}getCameraToClipPerspective(s,h,g,v){const b=new Float64Array(16);return l.perspective(b,s,h,g,v),b}getDistanceToElevation(s,h=!1){const g=s===0?0:l.mercatorZfromAltitude(s,h?l.latFromMercatorY(this.position[1]):this.position[1]),v=this.forward();return(g-this.position[2])/v[2]}clone(){return new sh([...this.position],[...this.orientation])}}function Il(f,s){const h=lh(f.projection,f.zoom,f.width,f.height),g=function(b,A,I,D,N){const B=new l.LngLat(I.lng-180*Ia,I.lat),q=new l.LngLat(I.lng+180*Ia,I.lat),J=b.project(B.lng,B.lat),ne=b.project(q.lng,q.lat),oe=-Math.atan2(ne.y-J.y,ne.x-J.x),ie=l.MercatorCoordinate.fromLngLat(I);ie.y=l.clamp(ie.y,-1+Ia,1-Ia);const ae=ie.toLngLat(),Z=b.project(ae.lng,ae.lat),re=l.MercatorCoordinate.fromLngLat(ae);re.x+=Ia;const ue=re.toLngLat(),he=b.project(ue.lng,ue.lat),be=ch(he.x-Z.x,he.y-Z.y,oe),Se=l.MercatorCoordinate.fromLngLat(ae);Se.y+=Ia;const we=Se.toLngLat(),Ce=b.project(we.lng,we.lat),Ie=ch(Ce.x-Z.x,Ce.y-Z.y,oe),Re=Math.abs(be.x)/Math.abs(Ie.y),st=l.identity([]);l.rotateZ(st,st,-oe*(1-(N?0:D)));const De=l.identity([]);return l.scale(De,De,[1,1-(1-Re)*D,1]),De[4]=-Ie.x/Ie.y*D,l.rotateZ(De,De,oe),l.multiply(De,st,De),De}(f.projection,0,f.center,h,s),v=S0(f);return l.scale(g,g,[v,v,1]),g}function S0(f){const s=f.projection,h=lh(f.projection,f.zoom,f.width,f.height),g=T0(s,f.center),v=T0(s,l.LngLat.convert(s.center));return Math.pow(2,g*h+(1-h)*v)}function lh(f,s,h,g,v=1/0){const b=f.range;if(!b)return 0;const A=Math.min(v,Math.max(h,g)),I=Math.log(A/1024)/Math.LN2;return l.smoothstep(b[0]+I,b[1]+I,s)}const Ia=1/4e4;function T0(f,s){const h=l.clamp(s.lat,-l.MAX_MERCATOR_LATITUDE,l.MAX_MERCATOR_LATITUDE),g=new l.LngLat(s.lng-180*Ia,h),v=new l.LngLat(s.lng+180*Ia,h),b=f.project(g.lng,h),A=f.project(v.lng,h),I=l.MercatorCoordinate.fromLngLat(g),D=l.MercatorCoordinate.fromLngLat(v),N=A.x-b.x,B=A.y-b.y,q=D.x-I.x,J=D.y-I.y,ne=Math.sqrt((q*q+J*J)/(N*N+B*B));return Math.log(ne)/Math.LN2}function ch(f,s,h){const g=Math.cos(h),v=Math.sin(h);return{x:f*g-s*v,y:f*v+s*g}}class Cl{constructor(s,h,g,v,b,A,I){this.tileSize=512,this._renderWorldCopies=b===void 0||b,this._minZoom=s||0,this._maxZoom=h||22,this._minPitch=g??0,this._maxPitch=v??60,this.setProjection(A),this.setMaxBounds(I),this.width=0,this.height=0,this._center=new l.LngLat(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._nearZ=0,this._farZ=0,this._unmodified=!0,this._edgeInsets=new oh,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._distanceTileDataCache={},this._camera=new sh,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._pixelsPerMercatorPixel=1,this.globeRadius=0,this.globeCenterInViewSpace=[0,0,0],this._horizonShift=.1}clone(){const s=new Cl(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection());return s._elevation=this._elevation,s._centerAltitude=this._centerAltitude,s._centerAltitudeValidForExaggeration=this._centerAltitudeValidForExaggeration,s.tileSize=this.tileSize,s.mercatorFromTransition=this.mercatorFromTransition,s.width=this.width,s.height=this.height,s.cameraElevationReference=this.cameraElevationReference,s._center=this._center,s._setZoom(this.zoom),s._seaLevelZoom=this._seaLevelZoom,s.angle=this.angle,s._fov=this._fov,s._pitch=this._pitch,s._nearZ=this._nearZ,s._farZ=this._farZ,s._averageElevation=this._averageElevation,s._unmodified=this._unmodified,s._edgeInsets=this._edgeInsets.clone(),s._camera=this._camera.clone(),s._calcMatrices(),s.freezeTileCoverage=this.freezeTileCoverage,s.frustumCorners=this.frustumCorners,s}get elevation(){return this._elevation}set elevation(s){this._elevation!==s&&(this._elevation=s,this._updateCameraOnTerrain(),this._calcMatrices())}updateElevation(s,h=!1){const g=this._elevation&&this._elevation.exaggeration()!==this._centerAltitudeValidForExaggeration;(this._seaLevelZoom==null||g)&&this._updateCameraOnTerrain(),(s||g)&&this._constrainCamera(h),this._calcMatrices()}getProjection(){return l.pick(this.projection,["name","center","parallels"])}setProjection(s){this.projectionOptions=s||{name:"mercator"};const h=this.projection?this.getProjection():void 0;this.projection=l.getProjection(this.projectionOptions);const g=!w(h,this.getProjection());return g&&this._calcMatrices(),this.mercatorFromTransition=!1,g}setMercatorFromTransition(){const s=this.projection.name;this.mercatorFromTransition=!0,this.projectionOptions={name:"mercator"},this.projection=l.getProjection({name:"mercator"});const h=s!==this.projection.name;return h&&this._calcMatrices(),h}get minZoom(){return this._minZoom}set minZoom(s){this._minZoom!==s&&(this._minZoom=s,this.zoom=Math.max(this.zoom,s))}get maxZoom(){return this._maxZoom}set maxZoom(s){this._maxZoom!==s&&(this._maxZoom=s,this.zoom=Math.min(this.zoom,s))}get minPitch(){return this._minPitch}set minPitch(s){this._minPitch!==s&&(this._minPitch=s,this.pitch=Math.max(this.pitch,s))}get maxPitch(){return this._maxPitch}set maxPitch(s){this._maxPitch!==s&&(this._maxPitch=s,this.pitch=Math.min(this.pitch,s))}get renderWorldCopies(){return this._renderWorldCopies&&this.projection.supportsWorldCopies===!0}set renderWorldCopies(s){s===void 0?s=!0:s===null&&(s=!1),this._renderWorldCopies=s}get worldSize(){return this.tileSize*this.scale}get cameraWorldSizeForFog(){const s=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(s))}get cameraWorldSize(){const s=Math.max(this._camera.getDistanceToElevation(this._averageElevation,!0),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(s))}get pixelsPerMeter(){return this.projection.pixelsPerMeter(this.center.lat,this.worldSize)}get cameraPixelsPerMeter(){return l.mercatorZfromAltitude(this.center.lat,this.cameraWorldSizeForFog)}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new l.Point(this.width,this.height)}get bearing(){return l.wrap(this.rotation,-180,180)}set bearing(s){this.rotation=s}get rotation(){return-this.angle/Math.PI*180}set rotation(s){const h=-s*Math.PI/180;var g;this.angle!==h&&(this._unmodified=!1,this.angle=h,this._calcMatrices(),this.rotationMatrix=(g=new l.ARRAY_TYPE(4),l.ARRAY_TYPE!=Float32Array&&(g[1]=0,g[2]=0),g[0]=1,g[3]=1,g),function(v,b,A){var I=b[0],D=b[1],N=b[2],B=b[3],q=Math.sin(A),J=Math.cos(A);v[0]=I*J+N*q,v[1]=D*J+B*q,v[2]=I*-q+N*J,v[3]=D*-q+B*J}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(s){const h=l.clamp(s,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==h&&(this._unmodified=!1,this._pitch=h,this._calcMatrices())}get aspect(){return this.width/this.height}get fov(){return this._fov/Math.PI*180}get fovX(){return this._fov}get fovY(){const s=1/Math.tan(.5*this.fovX);return 2*Math.atan(1/this.aspect/s)}set fov(s){s=Math.max(.01,Math.min(60,s)),this._fov!==s&&(this._unmodified=!1,this._fov=l.degToRad(s),this._calcMatrices())}get averageElevation(){return this._averageElevation}set averageElevation(s){this._averageElevation=s,this._calcFogMatrices(),this._distanceTileDataCache={}}get zoom(){return this._zoom}set zoom(s){const h=Math.min(Math.max(s,this.minZoom),this.maxZoom);this._zoom!==h&&(this._unmodified=!1,this._setZoom(h),this._updateSeaLevelZoom(),this._constrain(),this._calcMatrices())}_setZoom(s){this._zoom=s,this.scale=this.zoomScale(s),this.tileZoom=Math.floor(s),this.zoomFraction=s-this.tileZoom}_updateCameraOnTerrain(){if(!this._elevation||!this._elevation.isDataAvailableAtPoint(this.locationCoordinate(this.center)))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForExaggeration=void 0);const s=this._elevation;this._centerAltitude=s.getAtPointOrZero(this.locationCoordinate(this.center)),this._centerAltitudeValidForExaggeration=s.exaggeration(),this._updateSeaLevelZoom()}_updateSeaLevelZoom(){this._centerAltitudeValidForExaggeration!==void 0&&(this._seaLevelZoom=this._zoomFromMercatorZ((this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize))}sampleAverageElevation(){if(!this._elevation)return 0;const s=this._elevation,h=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],g=this.horizonLineFromTop();let v=0,b=0;for(let A=0;As.maxzoom&&(h=s.maxzoom);const A=this.locationCoordinate(this.center),I=this.center.lat,D=1<{const ut=new l.MercatorCoordinate(ze.x+25e-6,ze.y,ze.z),tt=new l.MercatorCoordinate(ze.x,ze.y+25e-6,ze.z),ht=ze.toLngLat(),Mt=ut.toLngLat(),$t=tt.toLngLat(),It=this.locationCoordinate(ht),Lt=this.locationCoordinate(Mt),nr=this.locationCoordinate($t),er=Math.hypot(Lt.x-It.x,Lt.y-It.y),Pt=Math.hypot(nr.x-It.x,nr.y-It.y);return Math.sqrt(er*Pt)*be/25e-6},we=ze=>{const Ze=ue,ut=he;return{aabb:l.tileAABB(this,D,0,0,0,ze,ut,Ze,this.projection),zoom:0,x:0,y:0,minZ:ut,maxZ:Ze,wrap:ze,fullyVisible:!1}},Ce=[];let Ie=[];const Re=h,st=s.reparseOverscaled?g:h,De=ze=>ze*ze,Ke=De((ie-this._centerAltitude)*oe),Ne=ze=>{if(!this._elevation||!ze.tileID||!b)return;const Ze=this._elevation.getMinMaxForTile(ze.tileID),ut=ze.aabb;Ze?(ut.min[2]=Ze.min,ut.max[2]=Ze.max,ut.center[2]=(ut.min[2]+ut.max[2])/2):(ze.shouldSplit=at(ze),ze.shouldSplit||(ut.min[2]=ut.max[2]=ut.center[2]=this._centerAltitude))},at=ze=>{if(ze.zoom=.9)return!0}else if(v&&(tt=De(ze.aabb.distanceZ(ae)*oe)),this.projection.isReprojectedInTileSpace&&g<=5){const It=Math.pow(2,ze.zoom),Lt=Se(new l.MercatorCoordinate((ze.x+.5)/It,(ze.y+.5)/It));ht=Lt>.85?1:Lt}const Mt=Ze*Ze+ut*ut+tt,$t=De((1<{if(Lt*De(.707)0;){const ze=Ce.pop(),Ze=ze.x,ut=ze.y;let tt=ze.fullyVisible;if(!tt){const ht=ze.aabb.intersects(J);if(ht===0)continue;tt=ht===2}if(ze.zoom!==Re&&at(ze))for(let ht=0;ht<4;ht++){const Mt=(Ze<<1)+ht%2,$t=(ut<<1)+(ht>>1),It={aabb:b?ze.aabb.quadrant(ht):l.tileAABB(this,D,ze.zoom+1,Mt,$t,ze.wrap,ze.minZ,ze.maxZ,this.projection),zoom:ze.zoom+1,x:Mt,y:$t,wrap:ze.wrap,fullyVisible:tt,tileID:void 0,shouldSplit:void 0,minZ:ze.minZ,maxZ:ze.maxZ};v&&!B&&(It.tileID=new l.OverscaledTileID(ze.zoom+1===Re?st:ze.zoom+1,ze.wrap,ze.zoom+1,Mt,$t),Ne(It)),Ce.push(It)}else{const ht=ze.zoom===Re?st:ze.zoom;if(s.minzoom&&s.minzoom>ht)continue;const Mt=N[0]-(.5+Ze+(ze.wrap<{const tt=[0,0,0,1],ht=[l.EXTENT,l.EXTENT,0,1],Mt=this.calculateFogTileMatrix(ut.tileID.toUnwrapped());l.transformMat4$1(tt,tt,Mt),l.transformMat4$1(ht,ht,Mt);const $t=l.getAABBPointSquareDist(tt,ht);if($t===0)return!0;let It=!1;const Lt=this._elevation;if(Lt&&$t>ze&&Ze!==0){const nr=this.calculateProjMatrix(ut.tileID.toUnwrapped());let er;s.isTerrainDEM||(er=Lt.getMinMaxForTile(ut.tileID)),er||(er={min:he,max:ue});const Pt=l.furthestTileCorner(this.rotation),Ar=[Pt[0]*l.EXTENT,Pt[1]*l.EXTENT,er.max];l.transformMat4(Ar,Ar,nr),It=(1-Ar[1])*this.height*.5ze.distanceSq-Ze.distanceSq).map(ze=>ze.tileID)}resize(s,h){this.width=s,this.height=h,this.pixelsToGLUnits=[2/s,-2/h],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(s){return Math.pow(2,s)}scaleZoom(s){return Math.log(s)/Math.LN2}project(s){const h=l.clamp(s.lat,-l.MAX_MERCATOR_LATITUDE,l.MAX_MERCATOR_LATITUDE),g=this.projection.project(s.lng,h);return new l.Point(g.x*this.worldSize,g.y*this.worldSize)}unproject(s){return this.projection.unproject(s.x/this.worldSize,s.y/this.worldSize)}get point(){return this.project(this.center)}get pointMerc(){return this.point._div(this.worldSize)}get pixelsPerMeterRatio(){return this.pixelsPerMeter/l.mercatorZfromAltitude(1,this.center.lat)/this.worldSize}setLocationAtPoint(s,h){let g,v;const b=this.centerPoint;if(this.projection.name==="globe"){const I=this.worldSize;g=(h.x-b.x)/I,v=(h.y-b.y)/I}else{const I=this.pointCoordinate(h),D=this.pointCoordinate(b);g=I.x-D.x,v=I.y-D.y}const A=this.locationCoordinate(s);this.setLocation(new l.MercatorCoordinate(A.x-g,A.y-v))}setLocation(s){this.center=this.coordinateLocation(s),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(s){return this.projection.locationPoint(this,s)}locationPoint3D(s){return this.projection.locationPoint(this,s,!0)}pointLocation(s){return this.coordinateLocation(this.pointCoordinate(s))}pointLocation3D(s){return this.coordinateLocation(this.pointCoordinate3D(s))}locationCoordinate(s,h){const g=h?l.mercatorZfromAltitude(h,s.lat):void 0,v=this.projection.project(s.lng,s.lat);return new l.MercatorCoordinate(v.x,v.y,g)}coordinateLocation(s){return this.projection.unproject(s.x,s.y)}pointRayIntersection(s,h){const g=h??this._centerAltitude,v=[s.x,s.y,0,1],b=[s.x,s.y,1,1];l.transformMat4$1(v,v,this.pixelMatrixInverse),l.transformMat4$1(b,b,this.pixelMatrixInverse);const A=b[3];l.scale$1(v,v,1/v[3]),l.scale$1(b,b,1/A);const I=v[2],D=b[2];return{p0:v,p1:b,t:I===D?0:(g-I)/(D-I)}}screenPointToMercatorRay(s){const h=[s.x,s.y,0,1],g=[s.x,s.y,1,1];return l.transformMat4$1(h,h,this.pixelMatrixInverse),l.transformMat4$1(g,g,this.pixelMatrixInverse),l.scale$1(h,h,1/h[3]),l.scale$1(g,g,1/g[3]),h[2]=l.mercatorZfromAltitude(h[2],this._center.lat)*this.worldSize,g[2]=l.mercatorZfromAltitude(g[2],this._center.lat)*this.worldSize,l.scale$1(h,h,1/this.worldSize),l.scale$1(g,g,1/this.worldSize),new l.Ray([h[0],h[1],h[2]],l.normalize([],l.sub([],g,h)))}rayIntersectionCoordinate(s){const{p0:h,p1:g,t:v}=s,b=l.mercatorZfromAltitude(h[2],this._center.lat),A=l.mercatorZfromAltitude(g[2],this._center.lat);return new l.MercatorCoordinate(l.number(h[0],g[0],v)/this.worldSize,l.number(h[1],g[1],v)/this.worldSize,l.number(b,A,v))}pointCoordinate(s,h=this._centerAltitude){return this.projection.pointCoordinate(this,s.x,s.y,h)}pointCoordinate3D(s){if(!this.elevation)return this.pointCoordinate(s);let h=this.projection.pointCoordinate3D(this,s.x,s.y);if(h)return new l.MercatorCoordinate(h[0],h[1],h[2]);let g=0,v=this.horizonLineFromTop();if(s.y>v)return this.pointCoordinate(s);const b=.02*v,A=s.clone();for(let I=0;I<10&&v-g>b;I++){A.y=l.number(g,v,.66);const D=this.projection.pointCoordinate3D(this,A.x,A.y);D?(v=A.y,h=D):g=A.y}return h?new l.MercatorCoordinate(h[0],h[1],h[2]):this.pointCoordinate(s)}isPointAboveHorizon(s){return this.projection.isPointAboveHorizon(this,s)}isPointOnSurface(s){if(s.y<0||s.y>this.height||s.x<0||s.x>this.width)return!1;if(this.elevation||this.zoom>=l.GLOBE_ZOOM_THRESHOLD_MAX)return!this.isPointAboveHorizon(s);const h=this.pointCoordinate(s);return h.y>=0&&h.y<=1}_coordinatePoint(s,h){const g=h&&this.elevation?this.elevation.getAtPointOrZero(s,this._centerAltitude):this._centerAltitude,v=[s.x*this.worldSize,s.y*this.worldSize,g+s.toAltitude(),1];return l.transformMat4$1(v,v,this.pixelMatrix),v[3]>0?new l.Point(v[0]/v[3],v[1]/v[3]):new l.Point(Number.MAX_VALUE,Number.MAX_VALUE)}_getBoundsNonRectangular(){const{top:s,left:h}=this._edgeInsets,g=this.height-this._edgeInsets.bottom,v=this.width-this._edgeInsets.right,b=this.pointLocation3D(new l.Point(h,s)),A=this.pointLocation3D(new l.Point(v,s)),I=this.pointLocation3D(new l.Point(v,g)),D=this.pointLocation3D(new l.Point(h,g));let N=Math.min(b.lng,A.lng,I.lng,D.lng),B=Math.max(b.lng,A.lng,I.lng,D.lng),q=Math.min(b.lat,A.lat,I.lat,D.lat),J=Math.max(b.lat,A.lat,I.lat,D.lat);const ne=Math.pow(2,-this.zoom)/16*270,oe=this.projection.name==="globe"?1:4,ie=(ae,Z,re,ue,he)=>{const be=(ae+re)/2,Se=(Z+ue)/2,we=new l.Point(be,Se),{lng:Ce,lat:Ie}=this.pointLocation3D(we),Re=Math.max(0,N-Ce,q-Ie,Ce-B,Ie-J);N=Math.min(N,Ce),B=Math.max(B,Ce),q=Math.min(q,Ie),J=Math.max(J,Ie),(hene)&&(ie(ae,Z,be,Se,he+1),ie(be,Se,re,ue,he+1))};if(ie(h,s,v,s,1),ie(v,s,v,g,1),ie(v,g,h,g,1),ie(h,g,h,s,1),this.projection.name==="globe"){const[ae,Z]=l.polesInViewport(this);ae?(J=90,B=180,N=-180):Z&&(q=-90,B=180,N=-180)}return new l.LngLatBounds(new l.LngLat(N,q),new l.LngLat(B,J))}_getBoundsRectangular(s,h){const{top:g,left:v}=this._edgeInsets,b=this.height-this._edgeInsets.bottom,A=this.width-this._edgeInsets.right,I=new l.Point(v,g),D=new l.Point(A,g),N=new l.Point(A,b),B=new l.Point(v,b);let q=this.pointCoordinate(I,s),J=this.pointCoordinate(D,s);const ne=this.pointCoordinate(N,h),oe=this.pointCoordinate(B,h),ie=(ae,Z)=>(Z.y-ae.y)/(Z.x-ae.x);return q.y>1&&J.y>=0?q=new l.MercatorCoordinate((1-oe.y)/ie(oe,q)+oe.x,1):q.y<0&&J.y<=1&&(q=new l.MercatorCoordinate(-oe.y/ie(oe,q)+oe.x,0)),J.y>1&&q.y>=0?J=new l.MercatorCoordinate((1-ne.y)/ie(ne,J)+ne.x,1):J.y<0&&q.y<=1&&(J=new l.MercatorCoordinate(-ne.y/ie(ne,J)+ne.x,0)),new l.LngLatBounds().extend(this.coordinateLocation(q)).extend(this.coordinateLocation(J)).extend(this.coordinateLocation(oe)).extend(this.coordinateLocation(ne))}_getBoundsRectangularTerrain(){const s=this.elevation;if(!s.visibleDemTiles.length||s.isUsingMockSource())return this._getBoundsRectangular(0,0);const h=s.visibleDemTiles.reduce((g,v)=>{if(v.dem){const b=v.dem.tree;g.min=Math.min(g.min,b.minimums[0]),g.max=Math.max(g.max,b.maximums[0])}return g},{min:Number.MAX_VALUE,max:0});return this._getBoundsRectangular(h.min*s.exaggeration(),h.max*s.exaggeration())}getBounds(){return this.projection.name==="mercator"||this.projection.name==="equirectangular"?this._terrainEnabled()?this._getBoundsRectangularTerrain():this._getBoundsRectangular(0,0):this._getBoundsNonRectangular()}horizonLineFromTop(s=!0){const h=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))+this.centerOffset.y,g=this.height/2-h*(1-this._horizonShift);return s?Math.max(0,g):g}getMaxBounds(){return this.maxBounds}setMaxBounds(s){this.maxBounds=s,this.minLat=-l.MAX_MERCATOR_LATITUDE,this.maxLat=l.MAX_MERCATOR_LATITUDE,this.minLng=-180,this.maxLng=180,s&&(this.minLat=s.getSouth(),this.maxLat=s.getNorth(),this.minLng=s.getWest(),this.maxLng=s.getEast(),this.maxLngq&&(I=q-N),q-Bne&&(A=ne-D),ne-J.5?ue-1:ue,he>.5?he-1:he,0]),this.alignedProjMatrix=be,I=l.create(),l.scale(I,I,[this.width/2,-this.height/2,1]),l.translate(I,I,[1,-1,0]),this.labelPlaneMatrix=I,I=l.create(),l.scale(I,I,[1,-1,1]),l.translate(I,I,[-1,-1,0]),l.scale(I,I,[2/this.width,2/this.height,1]),this.glCoordMatrix=I,this.pixelMatrix=l.multiply(new Float64Array(16),this.labelPlaneMatrix,this.projMatrix),this._calcFogMatrices(),this._distanceTileDataCache={},I=l.invert(new Float64Array(16),this.pixelMatrix),!I)throw new Error("failed to invert matrix");if(this.pixelMatrixInverse=I,this.projection.name==="globe"||this.mercatorFromTransition){this.globeMatrix=l.calculateGlobeMatrix(this);const Se=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=l.transformMat4(Se,Se,b),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=I;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};const s=this.cameraWorldSizeForFog,h=this.cameraPixelsPerMeter,g=this._camera.position,v=1/this.height/this._pixelsPerMercatorPixel,b=[s,s,h];l.scale$2(b,b,v),l.scale$2(g,g,-1),l.multiply$2(g,g,b);const A=l.create();l.translate(A,A,g),l.scale(A,A,b),this.mercatorFogMatrix=A,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(s,h,v)}_computeCameraPosition(s){const h=(s=s||this.pixelsPerMeter)/this.pixelsPerMeter,g=this._camera.forward(),v=this.point,b=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*h-s/this.worldSize*this._centerAltitude;return[v.x/this.worldSize-g[0]*b,v.y/this.worldSize-g[1]*b,s/this.worldSize*this._centerAltitude-g[2]*b]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(s){const h=this._maxCameraBoundsDistance()*Math.cos(this._pitch),g=this._camera.position[2],v=s[2];let b=1;this.projection.wrap&&(this.center=this.center.wrap()),v>0&&(b=Math.min((h-g)/v,1)),this._camera.position=l.scaleAndAdd([],this._camera.position,s,b),this._updateStateFromCamera()}_updateStateFromCamera(){const s=this._camera.position,h=this._camera.forward(),{pitch:g,bearing:v}=this._camera.getPitchBearing(),b=l.mercatorZfromAltitude(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,A=this._mercatorZfromZoom(this._maxZoom)*Math.cos(l.degToRad(this._maxPitch)),I=Math.max((s[2]-b)/Math.cos(g),A),D=this._zoomFromMercatorZ(I);l.scaleAndAdd(s,s,h,I),this._pitch=l.clamp(g,l.degToRad(this.minPitch),l.degToRad(this.maxPitch)),this.angle=l.wrap(v,-Math.PI,Math.PI),this._setZoom(l.clamp(D,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new l.MercatorCoordinate(s[0],s[1],s[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(s){return Math.pow(2,s)*this.tileSize}_mercatorZfromZoom(s){return this.cameraToCenterDistance/this._worldSizeFromZoom(s)}_minimumHeightOverTerrain(){const s=Math.min((this._seaLevelZoom!=null?this._seaLevelZoom:this._zoom)+4,this._maxZoom);return this._mercatorZfromZoom(s)}_zoomFromMercatorZ(s){return this.scaleZoom(this.cameraToCenterDistance/(s*this.tileSize))}zoomFromMercatorZAdjusted(s){let h=0,g=l.GLOBE_ZOOM_THRESHOLD_MAX,v=0,b=1/0;for(;g-h>1e-6&&g>h;){const A=h+.5*(g-h),I=this.tileSize*Math.pow(2,A),D=this.getCameraToCenterDistance(this.projection,A,I),N=this.scaleZoom(D/(s*this.tileSize)),B=Math.abs(A-N);BN||J.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+l.radToDeg(this.fovAboveCenter)>88||this.anyCornerOffEdge(new l.Point(0,0),new l.Point(this.width,this.height))}zoomDeltaToMovement(s,h){const g=l.length(l.sub([],this._camera.position,s)),v=this._zoomFromMercatorZ(g)+h;return g-this._mercatorZfromZoom(v)}getCameraPoint(){if(this.projection.name==="globe"){const s=function([h,g,v],b){const A=[h,g,v,1];l.transformMat4$1(A,A,b);const I=A[3]=Math.max(A[3],1e-6);return A[0]/=I,A[1]/=I,A[2]/=I,A}([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new l.Point(s[0],s[1])}{const s=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new l.Point(0,s))}}getCameraToCenterDistance(s,h=this.zoom,g=this.worldSize){const v=lh(s,h,this.width,this.height,1024),b=s.pixelSpaceConversion(this.center.lat,g,v);return .5/Math.tan(.5*this._fov)*this.height*b}getWorldToCameraMatrix(){const s=this._camera.getWorldToCamera(this.worldSize,this.projection.zAxisUnit==="meters"?this.pixelsPerMeter:1);return this.projection.name==="globe"&&l.multiply(s,s,this.globeMatrix),s}}function kl(f,s){let h=!1,g=null;const v=()=>{g=null,h&&(f(),g=setTimeout(v,s),h=!1)};return()=>(h=!0,g||v(),g)}class Ap{constructor(s){this._hashName=s&&encodeURIComponent(s),l.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=kl(this._updateHashUnthrottled.bind(this),300)}addTo(s){return this._map=s,l.window.addEventListener("hashchange",this._onHashChange,!1),s.on("moveend",this._updateHash),this}remove(){return this._map?(this._map.off("moveend",this._updateHash),l.window.removeEventListener("hashchange",this._onHashChange,!1),clearTimeout(this._updateHash()),this._map=void 0,this):this}getHashString(){const s=this._map;if(!s)return"";const h=Hc(s);if(this._hashName){const g=this._hashName;let v=!1;const b=l.window.location.hash.slice(1).split("&").map(A=>{const I=A.split("=")[0];return I===g?(v=!0,`${I}=${h}`):A}).filter(A=>A);return v||b.push(`${g}=${h}`),`#${b.join("&")}`}return`#${h}`}_getCurrentHash(){const s=l.window.location.hash.replace("#","");if(this._hashName){let h;return s.split("&").map(g=>g.split("=")).forEach(g=>{g[0]===this._hashName&&(h=g)}),(h&&h[1]||"").split("/")}return s.split("/")}_onHashChange(){const s=this._map;if(!s)return!1;const h=this._getCurrentHash();if(h.length>=3&&!h.some(g=>isNaN(g))){const g=s.dragRotate.isEnabled()&&s.touchZoomRotate.isEnabled()?+(h[3]||0):s.getBearing();return s.jumpTo({center:[+h[2],+h[1]],zoom:+h[0],bearing:g,pitch:+(h[4]||0)}),!0}return!1}_updateHashUnthrottled(){const s=l.window.location.href.replace(/(#.+)?$/,this.getHashString());l.window.history.replaceState(l.window.history.state,null,s)}}function Hc(f,s){const h=f.getCenter(),g=Math.round(100*f.getZoom())/100,v=Math.ceil((g*Math.LN2+Math.log(512/360/.5))/Math.LN10),b=Math.pow(10,v),A=Math.round(h.lng*b)/b,I=Math.round(h.lat*b)/b,D=f.getBearing(),N=f.getPitch();let B=s?`/${A}/${I}/${g}`:`${g}/${I}/${A}`;return(D||N)&&(B+="/"+Math.round(10*D)/10),N&&(B+=`/${Math.round(N)}`),B}const qc={linearity:.3,easing:l.bezier(0,0,.3,1)},uh=l.extend({deceleration:2500,maxSpeed:1400},qc),hh=l.extend({deceleration:20,maxSpeed:1400},qc),Et=l.extend({deceleration:1e3,maxSpeed:360},qc),Io=l.extend({deceleration:1e3,maxSpeed:90},qc);class A0{constructor(s){this._map=s,this.clear()}clear(){this._inertiaBuffer=[]}record(s){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:l.exported.now(),settings:s})}_drainInertiaBuffer(){const s=this._inertiaBuffer,h=l.exported.now();for(;s.length>0&&h-s[0].time>160;)s.shift()}_onMoveEnd(s){if(this._map._prefersReducedMotion()||(this._drainInertiaBuffer(),this._inertiaBuffer.length<2))return;const h={zoom:0,bearing:0,pitch:0,pan:new l.Point(0,0),pinchAround:void 0,around:void 0};for(const{settings:b}of this._inertiaBuffer)h.zoom+=b.zoomDelta||0,h.bearing+=b.bearingDelta||0,h.pitch+=b.pitchDelta||0,b.panDelta&&h.pan._add(b.panDelta),b.around&&(h.around=b.around),b.pinchAround&&(h.pinchAround=b.pinchAround);const g=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,v={};if(h.pan.mag()){const b=Kc(h.pan.mag(),g,l.extend({},uh,s||{}));v.offset=h.pan.mult(b.amount/h.pan.mag()),v.center=this._map.transform.center,Zc(v,b)}if(h.zoom){const b=Kc(h.zoom,g,hh);v.zoom=this._map.transform.zoom+b.amount,Zc(v,b)}if(h.bearing){const b=Kc(h.bearing,g,Et);v.bearing=this._map.transform.bearing+l.clamp(b.amount,-179,179),Zc(v,b)}if(h.pitch){const b=Kc(h.pitch,g,Io);v.pitch=this._map.transform.pitch+b.amount,Zc(v,b)}if(v.zoom||v.bearing){const b=h.pinchAround===void 0?h.around:h.pinchAround;v.around=b?this._map.unproject(b):this._map.getCenter()}return this.clear(),v.noMoveStart=!0,v}}function Zc(f,s){(!f.duration||f.durationh.unproject(D)),I=b.reduce((D,N,B,q)=>D.add(N.div(q.length)),new l.Point(0,0));super(s,{points:b,point:I,lngLats:A,lngLat:h.unproject(I),originalEvent:g}),this._defaultPrevented=!1}}class dh extends l.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(s,h,g){super(s,{originalEvent:g}),this._defaultPrevented=!1}}class Ip{constructor(s,h){this._map=s,this._clickTolerance=h.clickTolerance}reset(){this._mousedownPos=void 0}wheel(s){return this._firePreventable(new dh(s.type,this._map,s))}mousedown(s,h){return this._mousedownPos=h,this._firePreventable(new Wn(s.type,this._map,s))}mouseup(s){this._map.fire(new Wn(s.type,this._map,s))}preclick(s){const h=l.extend({},s);h.type="preclick",this._map.fire(new Wn(h.type,this._map,h))}click(s,h){this._mousedownPos&&this._mousedownPos.dist(h)>=this._clickTolerance||(this.preclick(s),this._map.fire(new Wn(s.type,this._map,s)))}dblclick(s){return this._firePreventable(new Wn(s.type,this._map,s))}mouseover(s){this._map.fire(new Wn(s.type,this._map,s))}mouseout(s){this._map.fire(new Wn(s.type,this._map,s))}touchstart(s){return this._firePreventable(new Xc(s.type,this._map,s))}touchmove(s){this._map.fire(new Xc(s.type,this._map,s))}touchend(s){this._map.fire(new Xc(s.type,this._map,s))}touchcancel(s){this._map.fire(new Xc(s.type,this._map,s))}_firePreventable(s){if(this._map.fire(s),s.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class ph{constructor(s){this._map=s}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(s){this._map.fire(new Wn(s.type,this._map,s))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Wn("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(s){this._delayContextMenu?this._contextMenuEvent=s:this._map.fire(new Wn(s.type,this._map,s)),this._map.listens("contextmenu")&&s.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class I0{constructor(s,h){this._map=s,this._el=s.getCanvasContainer(),this._container=s.getContainer(),this._clickTolerance=h.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(s,h){this.isEnabled()&&s.shiftKey&&s.button===0&&(V(),this._startPos=this._lastPos=h,this._active=!0)}mousemoveWindow(s,h){if(!this._active)return;const g=h,v=this._startPos,b=this._lastPos;if(!v||!b||b.equals(g)||!this._box&&g.dist(v){this._box&&(this._box.style.transform=`translate(${A}px,${D}px)`,this._box.style.width=I-A+"px",this._box.style.height=N-D+"px")})}mouseupWindow(s,h){if(!this._active)return;const g=this._startPos,v=h;if(g&&s.button===0){if(this.reset(),H(),g.x!==v.x||g.y!==v.y)return this._map.fire(new l.Event("boxzoomend",{originalEvent:s})),{cameraAnimation:b=>b.fitScreenCoordinates(g,v,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",s)}}keydown(s){this._active&&s.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",s))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),R(),delete this._startPos,delete this._lastPos}_fireEvent(s,h){return this._map.fire(new l.Event(s,{originalEvent:h}))}}function fh(f,s){const h={};for(let g=0;gthis.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===0&&(this.startTime=s.timeStamp),g.length===this.numTouches&&(this.centroid=function(v){const b=new l.Point(0,0);for(const A of v)b._add(A);return b.div(v.length)}(h),this.touches=fh(g,h)))}touchmove(s,h,g){if(this.aborted||!this.centroid)return;const v=fh(g,h);for(const b in this.touches){const A=v[b];(!A||A.dist(this.touches[b])>30)&&(this.aborted=!0)}}touchend(s,h,g){if((!this.centroid||s.timeStamp-this.startTime>500)&&(this.aborted=!0),g.length===0){const v=!this.aborted&&this.centroid;if(this.reset(),v)return v}}}class Cp{constructor(s){this.singleTap=new Pl(s),this.numTaps=s.numTaps,this.reset()}reset(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}touchstart(s,h,g){this.singleTap.touchstart(s,h,g)}touchmove(s,h,g){this.singleTap.touchmove(s,h,g)}touchend(s,h,g){const v=this.singleTap.touchend(s,h,g);if(v){const b=s.timeStamp-this.lastTime<500,A=!this.lastTap||this.lastTap.dist(v)<30;if(b&&A||this.reset(),this.count++,this.lastTime=s.timeStamp,this.lastTap=v,this.count===this.numTaps)return this.reset(),v}}}class lx{constructor(){this._zoomIn=new Cp({numTouches:1,numTaps:2}),this._zoomOut=new Cp({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(s,h,g){this._zoomIn.touchstart(s,h,g),this._zoomOut.touchstart(s,h,g)}touchmove(s,h,g){this._zoomIn.touchmove(s,h,g),this._zoomOut.touchmove(s,h,g)}touchend(s,h,g){const v=this._zoomIn.touchend(s,h,g),b=this._zoomOut.touchend(s,h,g);return v?(this._active=!0,s.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:A=>A.easeTo({duration:300,zoom:A.getZoom()+1,around:A.unproject(v)},{originalEvent:s})}):b?(this._active=!0,s.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:A=>A.easeTo({duration:300,zoom:A.getZoom()-1,around:A.unproject(b)},{originalEvent:s})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const C0={0:1,2:2};class Dl{constructor(s){this.reset(),this._clickTolerance=s.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,this._lastPoint=void 0,this._eventButton=void 0}_correctButton(s,h){return!1}_move(s,h){return{}}mousedown(s,h){if(this._lastPoint)return;const g=se(s);this._correctButton(s,g)&&(this._lastPoint=h,this._eventButton=g)}mousemoveWindow(s,h){const g=this._lastPoint;if(g){if(s.preventDefault(),this._eventButton!=null&&function(v,b){const A=C0[b];return v.buttons===void 0||(v.buttons&A)!==A}(s,this._eventButton))this.reset();else if(this._moved||!(h.dist(g)0&&(this._active=!0);const v=fh(g,h),b=new l.Point(0,0),A=new l.Point(0,0);let I=0;for(const N in v){const B=v[N],q=this._touches[N];q&&(b._add(B),A._add(B.sub(q)),I++,v[N]=B)}if(this._touches=v,I{this._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show"),this._alertContainer.setAttribute("role","null")},500)}}class Yc{constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(s){}_move(s,h,g){return{}}touchstart(s,h,g){this._firstTwoTouches||g.length<2||(this._firstTwoTouches=[g[0].identifier,g[1].identifier],this._start([h[0],h[1]]))}touchmove(s,h,g){const v=this._firstTwoTouches;if(!v)return;s.preventDefault();const[b,A]=v,I=Qc(g,h,b),D=Qc(g,h,A);if(!I||!D)return;const N=this._aroundCenter?null:I.add(D).div(2);return this._move([I,D],N,s)}touchend(s,h,g){if(!this._firstTwoTouches)return;const[v,b]=this._firstTwoTouches,A=Qc(g,h,v),I=Qc(g,h,b);A&&I||(this._active&&H(),this.reset())}touchcancel(){this.reset()}enable(s){this._enabled=!0,this._aroundCenter=!!s&&s.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function Qc(f,s,h){for(let g=0;gMath.abs(f.x)}class D0 extends Yc{constructor(s){super(),this._map=s}reset(){super.reset(),this._valid=void 0,this._firstMove=void 0,this._lastPoints=void 0}_start(s){this._lastPoints=s,ts(s[0].sub(s[1]))&&(this._valid=!1)}_move(s,h,g){const v=this._lastPoints;if(!v)return;const b=s[0].sub(v[0]),A=s[1].sub(v[1]);return this._map._cooperativeGestures&&!l.isFullscreen()&&g.touches.length<3||(this._valid=this.gestureBeginsVertically(b,A,g.timeStamp),!this._valid)?void 0:(this._lastPoints=s,this._active=!0,{pitchDelta:(b.y+A.y)/2*-.5})}gestureBeginsVertically(s,h,g){if(this._valid!==void 0)return this._valid;const v=s.mag()>=2,b=h.mag()>=2;if(!v&&!b)return;if(!v||!b)return this._firstMove==null&&(this._firstMove=g),g-this._firstMove<100&&void 0;const A=s.y>0==h.y>0;return ts(s)&&ts(h)&&A}}const M0={panStep:100,bearingStep:15,pitchStep:10};class cx{constructor(){const s=M0;this._panStep=s.panStep,this._bearingStep=s.bearingStep,this._pitchStep=s.pitchStep,this._rotationDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(s){if(s.altKey||s.ctrlKey||s.metaKey)return;let h=0,g=0,v=0,b=0,A=0;switch(s.keyCode){case 61:case 107:case 171:case 187:h=1;break;case 189:case 109:case 173:h=-1;break;case 37:s.shiftKey?g=-1:(s.preventDefault(),b=-1);break;case 39:s.shiftKey?g=1:(s.preventDefault(),b=1);break;case 38:s.shiftKey?v=1:(s.preventDefault(),A=-1);break;case 40:s.shiftKey?v=-1:(s.preventDefault(),A=1);break;default:return}return this._rotationDisabled&&(g=0,v=0),{cameraAnimation:I=>{const D=I.getZoom();I.easeTo({duration:300,easeId:"keyboardHandler",easing:z0,zoom:h?Math.round(D)+h*(s.shiftKey?2:1):D,bearing:I.getBearing()+g*this._bearingStep,pitch:I.getPitch()+v*this._pitchStep,offset:[-b*this._panStep,-A*this._panStep],center:I.getCenter()},{originalEvent:s})}}}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 z0(f){return f*(2-f)}const Rp=4.000244140625;class R0{constructor(s,h){this._map=s,this._el=s.getCanvasContainer(),this._handler=h,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,l.bindAll(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert"],this)}setZoomRate(s){this._defaultZoomRate=s}setWheelZoomRate(s){this._wheelZoomRate=s}isEnabled(){return!!this._enabled}isActive(){return this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(s){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!s&&s.around==="center",this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(s){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(s.ctrlKey||s.metaKey||this.isZooming()||l.isFullscreen()))return void this._showBlockerAlert();this._alertContainer.style.visibility!=="hidden"&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let h=s.deltaMode===l.window.WheelEvent.DOM_DELTA_LINE?40*s.deltaY:s.deltaY;const g=l.exported.now(),v=g-(this._lastWheelEventTime||0);this._lastWheelEventTime=g,h!==0&&h%Rp==0?this._type="wheel":h!==0&&Math.abs(h)<4?this._type="trackpad":v>400?(this._type=null,this._lastValue=h,this._timeout=setTimeout(this._onTimeout,40,s)):this._type||(this._type=Math.abs(v*h)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,h+=this._lastValue)),s.shiftKey&&h&&(h/=4),this._type&&(this._lastWheelEvent=s,this._delta-=h,this._active||this._start(s)),s.preventDefault()}_onTimeout(s){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(s)}_start(s){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 h=Q(this._el,s);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:h,this._aroundCoord=this._map.transform.pointCoordinate3D(this._aroundPoint),this._targetZoom=void 0,this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const s=this._map.transform;this._type==="wheel"&&s.projection.wrap&&(s._center.lng>=180||s._center.lng<=-180)&&(this._prevEase=null,this._easing=null,this._lastWheelEvent=null,this._lastWheelEventTime=0);const h=()=>s._terrainEnabled()&&this._aroundCoord?s.computeZoomRelativeTo(this._aroundCoord):s.zoom;if(this._delta!==0){const D=this._type==="wheel"&&Math.abs(this._delta)>Rp?this._wheelZoomRate:this._defaultZoomRate;let N=2/(1+Math.exp(-Math.abs(this._delta*D)));this._delta<0&&N!==0&&(N=1/N);const B=h(),q=Math.pow(2,B),J=typeof this._targetZoom=="number"?s.zoomScale(this._targetZoom):q;this._targetZoom=Math.min(s.maxZoom,Math.max(s.minZoom,s.scaleZoom(J*N))),this._type==="wheel"&&(this._startZoom=B,this._easing=this._smoothOutEasing(200)),this._delta=0}const g=typeof this._targetZoom=="number"?this._targetZoom:h(),v=this._startZoom,b=this._easing;let A,I=!1;if(this._type==="wheel"&&v&&b){const D=Math.min((l.exported.now()-this._lastWheelEventTime)/200,1),N=b(D);A=l.number(v,g,N),D<1?this._frameId||(this._frameId=!0):I=!0}else A=g,I=!0;return this._active=!0,I&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!I,zoomDelta:A-h(),around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(s){let h=l.ease;if(this._prevEase){const g=this._prevEase,v=(l.exported.now()-g.start)/g.duration,b=g.easing(v+.01)-g.easing(v),A=.27/Math.sqrt(b*b+1e-4)*.01,I=Math.sqrt(.0729-A*A);h=l.bezier(A,I,.25,1)}return this._prevEase={start:l.exported.now(),duration:s,easing:h},h}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=z("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=/(Mac|iPad)/i.test(l.window.navigator.userAgent)?this._map._getUIString("ScrollZoomBlocker.CmdMessage"):this._map._getUIString("ScrollZoomBlocker.CtrlMessage"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=setTimeout(()=>{this._alertContainer.classList.remove("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.setAttribute("role","null")},200)}}class O0{constructor(s,h){this._clickZoom=s,this._tapZoom=h}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 ci{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(s,h){return s.preventDefault(),{cameraAnimation:g=>{g.easeTo({duration:300,zoom:g.getZoom()+(s.shiftKey?-1:1),around:g.unproject(h)},{originalEvent:s})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ux{constructor(){this._tap=new Cp({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,this._swipePoint=void 0,this._swipeTouch=0,this._tapTime=0,this._tap.reset()}touchstart(s,h,g){this._swipePoint||(this._tapTime&&s.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?g.length>0&&(this._swipePoint=h[0],this._swipeTouch=g[0].identifier):this._tap.touchstart(s,h,g))}touchmove(s,h,g){if(this._tapTime){if(this._swipePoint){if(g[0].identifier!==this._swipeTouch)return;const v=h[0],b=v.y-this._swipePoint.y;return this._swipePoint=v,s.preventDefault(),this._active=!0,{zoomDelta:b/128}}}else this._tap.touchmove(s,h,g)}touchend(s,h,g){this._tapTime?this._swipePoint&&g.length===0&&this.reset():this._tap.touchend(s,h,g)&&(this._tapTime=s.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class F0{constructor(s,h,g){this._el=s,this._mousePan=h,this._touchPan=g}enable(s){this._inertiaOptions=s||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class hx{constructor(s,h,g){this._pitchWithRotate=s.pitchWithRotate,this._mouseRotate=h,this._mousePitch=g}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 dx{constructor(s,h,g,v){this._el=s,this._touchZoom=h,this._touchRotate=g,this._tapDragZoom=v,this._rotationDisabled=!1,this._enabled=!0}enable(s){this._touchZoom.enable(s),this._rotationDisabled||this._touchRotate.enable(s),this._tapDragZoom.enable(),this._el.classList.add("mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const oo=f=>f.zoom||f.drag||f.pitch||f.rotate;class L0 extends l.Event{}class px{constructor(){this.constants=[1,1,.01],this.radius=0}setup(s,h){const g=l.sub([],h,s);this.radius=l.length(g[2]<0?l.div([],g,this.constants):[g[0],g[1],0])}projectRay(s){l.div(s,s,this.constants),l.normalize(s,s),l.mul$1(s,s,this.constants);const h=l.scale$2([],s,this.radius);if(h[2]>0){const g=l.scale$2([],[0,0,1],l.dot(h,[0,0,1])),v=l.scale$2([],l.normalize([],[h[0],h[1],0]),this.radius),b=l.add([],h,l.scale$2([],l.sub([],l.add([],v,g),h),2));h[0]=b[0],h[1]=b[1]}return h}}function Co(f){return f.panDelta&&f.panDelta.mag()||f.zoomDelta||f.bearingDelta||f.pitchDelta}class Qo{constructor(s,h){this._map=s,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new A0(s),this._bearingSnap=h.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new px,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(h),l.bindAll(["handleEvent","handleWindowEvent"],this);const g=this._el;this._listeners=[[g,"touchstart",{passive:!0}],[g,"touchmove",{passive:!1}],[g,"touchend",void 0],[g,"touchcancel",void 0],[g,"mousedown",void 0],[g,"mousemove",void 0],[g,"mouseup",void 0],[l.window.document,"mousemove",{capture:!0}],[l.window.document,"mouseup",void 0],[g,"mouseover",void 0],[g,"mouseout",void 0],[g,"dblclick",void 0],[g,"click",void 0],[g,"keydown",{capture:!1}],[g,"keyup",void 0],[g,"wheel",{passive:!1}],[g,"contextmenu",void 0],[l.window,"blur",void 0]];for(const[v,b,A]of this._listeners)v.addEventListener(b,v===l.window.document?this.handleWindowEvent:this.handleEvent,A)}destroy(){for(const[s,h,g]of this._listeners)s.removeEventListener(h,s===l.window.document?this.handleWindowEvent:this.handleEvent,g)}_addDefaultHandlers(s){const h=this._map,g=h.getCanvasContainer();this._add("mapEvent",new Ip(h,s));const v=h.boxZoom=new I0(h,s);this._add("boxZoom",v);const b=new lx,A=new ci;h.doubleClickZoom=new O0(A,b),this._add("tapZoom",b),this._add("clickZoom",A);const I=new ux;this._add("tapDragZoom",I);const D=h.touchPitch=new D0(h);this._add("touchPitch",D);const N=new Pp(s),B=new Dp(s);h.dragRotate=new hx(s,N,B),this._add("mouseRotate",N,["mousePitch"]),this._add("mousePitch",B,["mouseRotate"]);const q=new kp(s),J=new mh(h,s);h.dragPan=new F0(g,q,J),this._add("mousePan",q),this._add("touchPan",J,["touchZoom","touchRotate"]);const ne=new P0,oe=new k0;h.touchZoomRotate=new dx(g,oe,ne,I),this._add("touchRotate",ne,["touchPan","touchZoom"]),this._add("touchZoom",oe,["touchPan","touchRotate"]),this._add("blockableMapEvent",new ph(h));const ie=h.scrollZoom=new R0(h,this);this._add("scrollZoom",ie,["mousePan"]);const ae=h.keyboard=new cx;this._add("keyboard",ae);for(const Z of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])s.interactive&&s[Z]&&h[Z].enable(s[Z])}_add(s,h,g){this._handlers.push({handlerName:s,handler:h,allowed:g}),this._handlersById[s]=h}stop(s){if(!this._updatingCamera){for(const{handler:h}of this._handlers)h.reset();this._inertia.clear(),this._fireEvents({},{},s),this._changes=[]}}isActive(){for(const{handler:s}of this._handlers)if(s.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!oo(this._eventsInProgress)||this.isZooming()}_isDragging(){return!!this._eventsInProgress.drag}_blockedByActive(s,h,g){for(const v in s)if(v!==g&&(!h||h.indexOf(v)<0))return!0;return!1}handleWindowEvent(s){this.handleEvent(s,`${s.type}Window`)}_getMapTouches(s){const h=[];for(const g of s)this._el.contains(g.target)&&h.push(g);return h}handleEvent(s,h){this._updatingCamera=!0;const g=s.type==="renderFrame",v=g?void 0:s,b={needsRenderFrame:!1},A={},I={},D=s.touches?this._getMapTouches(s.touches):void 0,N=D?te(this._el,D):g?void 0:Q(this._el,s);for(const{handlerName:J,handler:ne,allowed:oe}of this._handlers){if(!ne.isEnabled())continue;let ie;this._blockedByActive(I,oe,J)?ne.reset():ne[h||s.type]&&(ie=ne[h||s.type](s,N,D),this.mergeHandlerResult(b,A,ie,J,v),ie&&ie.needsRenderFrame&&this._triggerRenderFrame()),(ie||ne.isActive())&&(I[J]=ne)}const B={};for(const J in this._previousActiveHandlers)I[J]||(B[J]=v);this._previousActiveHandlers=I,(Object.keys(B).length||Co(b))&&(this._changes.push([b,A,B]),this._triggerRenderFrame()),(Object.keys(I).length||Co(b))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:q}=b;q&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],q(this._map))}mergeHandlerResult(s,h,g,v,b){if(!g)return;l.extend(s,g);const A={handlerName:v,originalEvent:g.originalEvent||b};g.zoomDelta!==void 0&&(h.zoom=A),g.panDelta!==void 0&&(h.drag=A),g.pitchDelta!==void 0&&(h.pitch=A),g.bearingDelta!==void 0&&(h.rotate=A)}_applyChanges(){const s={},h={},g={};for(const[v,b,A]of this._changes)v.panDelta&&(s.panDelta=(s.panDelta||new l.Point(0,0))._add(v.panDelta)),v.zoomDelta&&(s.zoomDelta=(s.zoomDelta||0)+v.zoomDelta),v.bearingDelta&&(s.bearingDelta=(s.bearingDelta||0)+v.bearingDelta),v.pitchDelta&&(s.pitchDelta=(s.pitchDelta||0)+v.pitchDelta),v.around!==void 0&&(s.around=v.around),v.aroundCoord!==void 0&&(s.aroundCoord=v.aroundCoord),v.pinchAround!==void 0&&(s.pinchAround=v.pinchAround),v.noInertia&&(s.noInertia=v.noInertia),l.extend(h,b),l.extend(g,A);this._updateMapTransform(s,h,g),this._changes=[]}_updateMapTransform(s,h,g){const v=this._map,b=v.transform,A=re=>[re.x,re.y,re.z];if((re=>{const ue=this._eventsInProgress.drag;return ue&&!this._handlersById[ue.handlerName].isActive()})()&&!Co(s)){const re=b.zoom;b.cameraElevationReference="sea",b.recenterOnTerrain(),b.cameraElevationReference="ground",re!==b.zoom&&this._map._update(!0)}if(b._isCameraConstrained&&v._stop(!0),!Co(s))return void this._fireEvents(h,g,!0);let{panDelta:I,zoomDelta:D,bearingDelta:N,pitchDelta:B,around:q,aroundCoord:J,pinchAround:ne}=s;b._isCameraConstrained&&(D>0&&(D=0),b._isCameraConstrained=!1),ne!==void 0&&(q=ne),(D||(re=>h[re]&&!this._eventsInProgress[re])("drag"))&&q&&(this._dragOrigin=A(b.pointCoordinate3D(q)),this._trackingEllipsoid.setup(b._camera.position,this._dragOrigin)),b.cameraElevationReference="sea",v._stop(!0),q=q||v.transform.centerPoint,N&&(b.bearing+=N),B&&(b.pitch+=B),b._updateCameraState();const oe=[0,0,0];if(I)if(b.projection.name==="mercator"){const re=this._trackingEllipsoid.projectRay(b.screenPointToMercatorRay(q).dir),ue=this._trackingEllipsoid.projectRay(b.screenPointToMercatorRay(q.sub(I)).dir);oe[0]=ue[0]-re[0],oe[1]=ue[1]-re[1]}else{const re=b.pointCoordinate(q);if(b.projection.name==="globe"){I=I.rotate(-b.angle);const ue=b._pixelsPerMercatorPixel/b.worldSize;oe[0]=-I.x*l.mercatorScale(l.latFromMercatorY(re.y))*ue,oe[1]=-I.y*l.mercatorScale(b.center.lat)*ue}else{const ue=b.pointCoordinate(q.sub(I));re&&ue&&(oe[0]=ue.x-re.x,oe[1]=ue.y-re.y)}}const ie=b.zoom,ae=[0,0,0];if(D){const re=A(J||b.pointCoordinate3D(q)),ue={dir:l.normalize([],l.sub([],re,b._camera.position))};if(ue.dir[2]<0){const he=b.zoomDeltaToMovement(re,D);l.scale$2(ae,ue.dir,he)}}const Z=l.add(oe,oe,ae);b._translateCameraConstrained(Z),D&&Math.abs(b.zoom-ie)>1e-4&&b.recenterOnTerrain(),b.cameraElevationReference="ground",this._map._update(),s.noInertia||this._inertia.record(s),this._fireEvents(h,g,!0)}_fireEvents(s,h,g){const v=oo(this._eventsInProgress),b=oo(s),A={};for(const B in s){const{originalEvent:q}=s[B];this._eventsInProgress[B]||(A[`${B}start`]=q),this._eventsInProgress[B]=s[B]}!v&&b&&this._fireEvent("movestart",b.originalEvent);for(const B in A)this._fireEvent(B,A[B]);b&&this._fireEvent("move",b.originalEvent);for(const B in s){const{originalEvent:q}=s[B];this._fireEvent(B,q)}const I={};let D;for(const B in this._eventsInProgress){const{handlerName:q,originalEvent:J}=this._eventsInProgress[B];this._handlersById[q].isActive()||(delete this._eventsInProgress[B],D=h[q]||J,I[`${B}end`]=D)}for(const B in I)this._fireEvent(B,I[B]);const N=oo(this._eventsInProgress);if(g&&(v||b)&&!N){this._updatingCamera=!0;const B=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),q=J=>J!==0&&-this._bearingSnap{this._frameId=void 0,this.handleEvent(new L0("renderFrame",{timeStamp:s})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const Ns="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class gh extends l.Evented{constructor(s,h){super(),this._moving=!1,this._zooming=!1,this.transform=s,this._bearingSnap=h.bearingSnap,this._respectPrefersReducedMotion=h.respectPrefersReducedMotion!==!1,l.bindAll(["_renderFrameCallback"],this)}getCenter(){return new l.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(s,h){return this.jumpTo({center:s},h)}panBy(s,h,g){return s=l.Point.convert(s).mult(-1),this.panTo(this.transform.center,l.extend({offset:s},h),g)}panTo(s,h,g){return this.easeTo(l.extend({center:s},h),g)}getZoom(){return this.transform.zoom}setZoom(s,h){return this.jumpTo({zoom:s},h),this}zoomTo(s,h,g){return this.easeTo(l.extend({zoom:s},h),g)}zoomIn(s,h){return this.zoomTo(this.getZoom()+1,s,h),this}zoomOut(s,h){return this.zoomTo(this.getZoom()-1,s,h),this}getBearing(){return this.transform.bearing}setBearing(s,h){return this.jumpTo({bearing:s},h),this}getPadding(){return this.transform.padding}setPadding(s,h){return this.jumpTo({padding:s},h),this}rotateTo(s,h,g){return this.easeTo(l.extend({bearing:s},h),g)}resetNorth(s,h){return this.rotateTo(0,l.extend({duration:1e3},s),h),this}resetNorthPitch(s,h){return this.easeTo(l.extend({bearing:0,pitch:0,duration:1e3},s),h),this}snapToNorth(s,h){return Math.abs(this.getBearing())s.aspect?g/(2*Math.tan(.5*s.fovX)*s.aspect):v/(2*Math.tan(.5*s.fovY)*s.aspect)}_cameraForBoundsOnGlobe(s,h,g,v,b,A){const I=s.clone(),D=this._extendCameraOptions(A);I.bearing=v,I.pitch=b;const N=l.LngLat.convert(h),B=l.LngLat.convert(g),q=.5*(N.lat+B.lat),J=.5*(N.lng+B.lng),ne=l.latLngToECEF(q,J),oe=l.normalize([],ne),ie=l.normalize([],l.cross([],oe,[0,1,0])),ae=l.cross([],ie,oe),Z=[ie[0],ie[1],ie[2],0,ae[0],ae[1],ae[2],0,oe[0],oe[1],oe[2],0,0,0,0,1],re=[ne,l.latLngToECEF(N.lat,N.lng),l.latLngToECEF(B.lat,N.lng),l.latLngToECEF(B.lat,B.lng),l.latLngToECEF(N.lat,B.lng),l.latLngToECEF(q,N.lng),l.latLngToECEF(q,B.lng),l.latLngToECEF(N.lat,J),l.latLngToECEF(B.lat,J)];let ue=l.Aabb.fromPoints(re.map(tt=>[l.dot(ie,tt),l.dot(ae,tt),l.dot(oe,tt)]));const he=l.transformMat4([],ue.center,Z);l.squaredLength(he)===0&&l.set(he,0,0,1),l.normalize(he,he),l.scale$2(he,he,l.GLOBE_RADIUS),I.center=l.ecefToLatLng(he);const be=I.getWorldToCameraMatrix(),Se=l.invert(new Float64Array(16),be);ue=l.Aabb.applyTransform(ue,l.multiply([],be,Z)),l.transformMat4(he,he,be);const we=.5*(ue.max[2]-ue.min[2]),Ce=this._minimumAABBFrustumDistance(I,ue),Ie=l.scale$2([],[0,0,1],we),Re=l.add(Ie,he,Ie),st=Ce+(I.pitch===0?0:l.distance(he,Re)),De=I.globeCenterInViewSpace,Ke=l.sub([],he,[De[0],De[1],De[2]]);l.normalize(Ke,Ke),l.scale$2(Ke,Ke,st);const Ne=l.add([],he,Ke);l.transformMat4(Ne,Ne,Se);const at=l.earthRadius/l.GLOBE_RADIUS,ze=l.length(Ne),Ze=l.mercatorZfromAltitude(Math.max(ze*at-l.earthRadius,Number.EPSILON),0),ut=Math.min(I.zoomFromMercatorZAdjusted(Ze),D.maxZoom);return ut>.5*(l.GLOBE_ZOOM_THRESHOLD_MIN+l.GLOBE_ZOOM_THRESHOLD_MAX)?(I.setProjection({name:"mercator"}),I.zoom=ut,this._cameraForBounds(I,h,g,v,b,A)):{center:I.center,zoom:ut,bearing:v,pitch:b}}queryTerrainElevation(s,h){const g=this.transform.elevation;return g?(h=l.extend({},{exaggerated:!0},h),g.getAtPoint(l.MercatorCoordinate.fromLngLat(s),null,h.exaggerated)):null}_cameraForBounds(s,h,g,v,b,A){if(s.projection.name==="globe")return this._cameraForBoundsOnGlobe(s,h,g,v,b,A);const I=s.clone(),D=this._extendCameraOptions(A),N=I.padding;I.bearing=v,I.pitch=b;const B=l.LngLat.convert(h),q=l.LngLat.convert(g),J=new l.LngLat(B.lng,q.lat),ne=new l.LngLat(q.lng,B.lat),oe=I.project(B),ie=I.project(q),ae=this.queryTerrainElevation(B),Z=this.queryTerrainElevation(q),re=this.queryTerrainElevation(J),ue=this.queryTerrainElevation(ne),he=[[oe.x,oe.y,Math.min(ae||0,Z||0,re||0,ue||0)],[ie.x,ie.y,Math.max(ae||0,Z||0,re||0,ue||0)]];let be=l.Aabb.fromPoints(he);const Se=I.getWorldToCameraMatrix(),we=l.invert(new Float64Array(16),Se);be=l.Aabb.applyTransform(be,Se);const Ce=l.sub([],be.max,be.min),Ie=N.left||0,Re=N.right||0,st=N.bottom||0,De=N.top||0,{left:Ke,right:Ne,top:at,bottom:ze}=D.padding,Ze=.5*(Ie+Re),ut=.5*(De+st),tt=Math.min(I.scaleZoom(I.scale*Math.min((I.width-(Ie+Re+Ke+Ne))/Ce[0],(I.height-(st+De+ze+at))/Ce[1])),D.maxZoom),ht=I.scale/I.zoomScale(tt);be=new l.Aabb([be.min[0]-(Ke+Ze)*ht,be.min[1]-(ze+ut)*ht,be.min[2]],[be.max[0]+(Ne+Ze)*ht,be.max[1]+(at+ut)*ht,be.max[2]]);const Mt=.5*Ce[2],$t=this._minimumAABBFrustumDistance(I,be),It=[0,0,1,0];l.transformMat4$1(It,It,Se),l.normalize$2(It,It);const Lt=l.scale$2([],It,$t+Mt),nr=l.add([],be.center,Lt),er=(typeof D.offset.x=="number"&&typeof D.offset.y=="number"?new l.Point(D.offset.x,D.offset.y):l.Point.convert(D.offset)).rotate(-l.degToRad(v));be.center[0]-=er.x*ht,be.center[1]+=er.y*ht,l.transformMat4(be.center,be.center,we),l.transformMat4(nr,nr,we);const Pt=[be.center[0],be.center[1],nr[2]*I.pixelsPerMeter];l.scale$2(Pt,Pt,1/I.worldSize);const Ar=l.lngFromMercatorX(Pt[0]),Mr=l.latFromMercatorY(Pt[1]),zr=Math.min(I._zoomFromMercatorZ(Pt[2]),D.maxZoom),Rr=new l.LngLat(Ar,Mr);return I.mercatorFromTransition&&zr<.5*(l.GLOBE_ZOOM_THRESHOLD_MIN+l.GLOBE_ZOOM_THRESHOLD_MAX)?(I.setProjection({name:"globe"}),I.zoom=zr,this._cameraForBounds(I,h,g,v,b,A)):{center:Rr,zoom:zr,bearing:v,pitch:b}}fitBounds(s,h,g){const v=this.cameraForBounds(s,h);return this._fitInternal(v,h,g)}fitScreenCoordinates(s,h,g,v,b){const A=l.Point.convert(s),I=l.Point.convert(h),D=new l.Point(Math.min(A.x,I.x),Math.min(A.y,I.y)),N=new l.Point(Math.max(A.x,I.x),Math.max(A.y,I.y));if(this.transform.projection.name==="mercator"&&this.transform.anyCornerOffEdge(A,I))return this;const B=this.transform.pointLocation3D(D),q=this.transform.pointLocation3D(N),J=this.transform.pointLocation3D(new l.Point(D.x,N.y)),ne=this.transform.pointLocation3D(new l.Point(N.x,D.y)),oe=[Math.min(B.lng,q.lng,J.lng,ne.lng),Math.min(B.lat,q.lat,J.lat,ne.lat)],ie=[Math.max(B.lng,q.lng,J.lng,ne.lng),Math.max(B.lat,q.lat,J.lat,ne.lat)],ae=v&&v.pitch?v.pitch:this.getPitch(),Z=this._cameraForBounds(this.transform,oe,ie,g,ae,v);return this._fitInternal(Z,v,b)}_fitInternal(s,h,g){return s?(delete(h=l.extend(s,h)).padding,h.linear?this.easeTo(h,g):this.flyTo(h,g)):this}jumpTo(s,h){this.stop();const g=s.preloadOnly?this.transform.clone():this.transform;let v=!1,b=!1,A=!1;return"zoom"in s&&g.zoom!==+s.zoom&&(v=!0,g.zoom=+s.zoom),s.center!==void 0&&(g.center=l.LngLat.convert(s.center)),"bearing"in s&&g.bearing!==+s.bearing&&(b=!0,g.bearing=+s.bearing),"pitch"in s&&g.pitch!==+s.pitch&&(A=!0,g.pitch=+s.pitch),s.padding==null||g.isPaddingEqual(s.padding)||(g.padding=s.padding),s.preloadOnly?(this._preloadTiles(g),this):(this.fire(new l.Event("movestart",h)).fire(new l.Event("move",h)),v&&this.fire(new l.Event("zoomstart",h)).fire(new l.Event("zoom",h)).fire(new l.Event("zoomend",h)),b&&this.fire(new l.Event("rotatestart",h)).fire(new l.Event("rotate",h)).fire(new l.Event("rotateend",h)),A&&this.fire(new l.Event("pitchstart",h)).fire(new l.Event("pitch",h)).fire(new l.Event("pitchend",h)),this.fire(new l.Event("moveend",h)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||l.warnOnce(Ns),this.transform.getFreeCameraOptions()}setFreeCameraOptions(s,h){const g=this.transform;if(!g.projection.supportsFreeCamera)return l.warnOnce(Ns),this;this.stop();const v=g.zoom,b=g.pitch,A=g.bearing;g.setFreeCameraOptions(s);const I=v!==g.zoom,D=b!==g.pitch,N=A!==g.bearing;return this.fire(new l.Event("movestart",h)).fire(new l.Event("move",h)),I&&this.fire(new l.Event("zoomstart",h)).fire(new l.Event("zoom",h)).fire(new l.Event("zoomend",h)),N&&this.fire(new l.Event("rotatestart",h)).fire(new l.Event("rotate",h)).fire(new l.Event("rotateend",h)),D&&this.fire(new l.Event("pitchstart",h)).fire(new l.Event("pitch",h)).fire(new l.Event("pitchend",h)),this.fire(new l.Event("moveend",h)),this}easeTo(s,h){this._stop(!1,s.easeId),((s=l.extend({offset:[0,0],duration:500,easing:l.ease},s)).animate===!1||this._prefersReducedMotion(s))&&(s.duration=0);const g=this.transform,v=this.getZoom(),b=this.getBearing(),A=this.getPitch(),I=this.getPadding(),D="zoom"in s?+s.zoom:v,N="bearing"in s?this._normalizeBearing(s.bearing,b):b,B="pitch"in s?+s.pitch:A,q="padding"in s?s.padding:g.padding,J=l.Point.convert(s.offset);let ne,oe,ie;if(g.projection.name==="globe"){const Ie=l.MercatorCoordinate.fromLngLat(g.center),Re=J.rotate(-g.angle);Ie.x+=Re.x/g.worldSize,Ie.y+=Re.y/g.worldSize;const st=Ie.toLngLat(),De=l.LngLat.convert(s.center||st);this._normalizeCenter(De),ne=g.centerPoint.add(Re),oe=new l.Point(Ie.x,Ie.y).mult(g.worldSize),ie=new l.Point(l.mercatorXfromLng(De.lng),l.mercatorYfromLat(De.lat)).mult(g.worldSize).sub(oe)}else{ne=g.centerPoint.add(J);const Ie=g.pointLocation(ne),Re=l.LngLat.convert(s.center||Ie);this._normalizeCenter(Re),oe=g.project(Ie),ie=g.project(Re).sub(oe)}const ae=g.zoomScale(D-v);let Z,re;s.around&&(Z=l.LngLat.convert(s.around),re=g.locationPoint(Z));const ue=this._zooming||D!==v,he=this._rotating||b!==N,be=this._pitching||B!==A,Se=!g.isPaddingEqual(q),we=Ie=>Re=>{if(ue&&(Ie.zoom=l.number(v,D,Re)),he&&(Ie.bearing=l.number(b,N,Re)),be&&(Ie.pitch=l.number(A,B,Re)),Se&&(Ie.interpolatePadding(I,q,Re),ne=Ie.centerPoint.add(J)),Z)Ie.setLocationAtPoint(Z,re);else{const st=Ie.zoomScale(Ie.zoom-v),De=D>v?Math.min(2,ae):Math.max(.5,ae),Ke=Math.pow(De,1-Re),Ne=Ie.unproject(oe.add(ie.mult(Re*Ke)).mult(st));Ie.setLocationAtPoint(Ie.renderWorldCopies?Ne.wrap():Ne,ne)}return s.preloadOnly||this._fireMoveEvents(h),Ie};if(s.preloadOnly){const Ie=this._emulate(we,s.duration,g);return this._preloadTiles(Ie),this}const Ce={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=ue,this._rotating=he,this._pitching=be,this._padding=Se,this._easeId=s.easeId,this._prepareEase(h,s.noMoveStart,Ce),this._ease(we(g),Ie=>{g.recenterOnTerrain(),this._afterEase(h,Ie)},s),this}_prepareEase(s,h,g={}){this._moving=!0,this.transform.cameraElevationReference="sea",h||g.moving||this.fire(new l.Event("movestart",s)),this._zooming&&!g.zooming&&this.fire(new l.Event("zoomstart",s)),this._rotating&&!g.rotating&&this.fire(new l.Event("rotatestart",s)),this._pitching&&!g.pitching&&this.fire(new l.Event("pitchstart",s))}_fireMoveEvents(s){this.fire(new l.Event("move",s)),this._zooming&&this.fire(new l.Event("zoom",s)),this._rotating&&this.fire(new l.Event("rotate",s)),this._pitching&&this.fire(new l.Event("pitch",s))}_afterEase(s,h){if(this._easeId&&h&&this._easeId===h)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";const g=this._zooming,v=this._rotating,b=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,g&&this.fire(new l.Event("zoomend",s)),v&&this.fire(new l.Event("rotateend",s)),b&&this.fire(new l.Event("pitchend",s)),this.fire(new l.Event("moveend",s))}flyTo(s,h){if(this._prefersReducedMotion(s)){const tt=l.pick(s,["center","zoom","bearing","pitch","around"]);return this.jumpTo(tt,h)}this.stop(),s=l.extend({offset:[0,0],speed:1.2,curve:1.42,easing:l.ease},s);const g=this.transform,v=this.getZoom(),b=this.getBearing(),A=this.getPitch(),I=this.getPadding(),D="zoom"in s?l.clamp(+s.zoom,g.minZoom,g.maxZoom):v,N="bearing"in s?this._normalizeBearing(s.bearing,b):b,B="pitch"in s?+s.pitch:A,q="padding"in s?s.padding:g.padding,J=g.zoomScale(D-v),ne=l.Point.convert(s.offset);let oe=g.centerPoint.add(ne);const ie=g.pointLocation(oe),ae=l.LngLat.convert(s.center||ie);this._normalizeCenter(ae);const Z=g.project(ie),re=g.project(ae).sub(Z);let ue=s.curve;const he=Math.max(g.width,g.height),be=he/J,Se=re.mag();if("minZoom"in s){const tt=l.clamp(Math.min(s.minZoom,v,D),g.minZoom,g.maxZoom),ht=he/g.zoomScale(tt-v);ue=Math.sqrt(ht/Se*2)}const we=ue*ue;function Ce(tt){const ht=(be*be-he*he+(tt?-1:1)*we*we*Se*Se)/(2*(tt?be:he)*we*Se);return Math.log(Math.sqrt(ht*ht+1)-ht)}function Ie(tt){return(Math.exp(tt)-Math.exp(-tt))/2}function Re(tt){return(Math.exp(tt)+Math.exp(-tt))/2}const st=Ce(0);let De=function(tt){return Re(st)/Re(st+ue*tt)},Ke=function(tt){return he*((Re(st)*(Ie(ht=st+ue*tt)/Re(ht))-Ie(st))/we)/Se;var ht},Ne=(Ce(1)-st)/ue;if(Math.abs(Se)<1e-6||!isFinite(Ne)){if(Math.abs(he-be)<1e-6)return this.easeTo(s,h);const tt=bes.maxDuration&&(s.duration=0);const at=b!==N,ze=B!==A,Ze=!g.isPaddingEqual(q),ut=tt=>ht=>{const Mt=ht*Ne,$t=1/De(Mt);tt.zoom=ht===1?D:v+tt.scaleZoom($t),at&&(tt.bearing=l.number(b,N,ht)),ze&&(tt.pitch=l.number(A,B,ht)),Ze&&(tt.interpolatePadding(I,q,ht),oe=tt.centerPoint.add(ne));const It=ht===1?ae:tt.unproject(Z.add(re.mult(Ke(Mt))).mult($t));return tt.setLocationAtPoint(tt.renderWorldCopies?It.wrap():It,oe),tt._updateCameraOnTerrain(),s.preloadOnly||this._fireMoveEvents(h),tt};if(s.preloadOnly){const tt=this._emulate(ut,s.duration,g);return this._preloadTiles(tt),this}return this._zooming=!0,this._rotating=at,this._pitching=ze,this._padding=Ze,this._prepareEase(h,!1),this._ease(ut(g),()=>this._afterEase(h),s),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(s,h){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){const g=this._onEaseEnd;this._onEaseEnd=void 0,g.call(this,h)}if(!s){const g=this.handlers;g&&g.stop(!1)}return this}_ease(s,h,g){g.animate===!1||g.duration===0?(s(1),h()):(this._easeStart=l.exported.now(),this._easeOptions=g,this._onEaseFrame=s,this._onEaseEnd=h,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const s=Math.min((l.exported.now()-this._easeStart)/this._easeOptions.duration,1),h=this._onEaseFrame;h&&h(this._easeOptions.easing(s)),s<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(s,h){s=l.wrap(s,-180,180);const g=Math.abs(s-h);return Math.abs(s-360-h)180?-360:g<-180?360:0}_prefersReducedMotion(s){return this._respectPrefersReducedMotion&&l.exported.prefersReducedMotion&&!(s&&s.essential)}_emulate(s,h,g){const v=Math.ceil(15*h/1e3),b=[],A=s(g.clone());for(let I=0;I<=v;I++){const D=A(I/v);b.push(D.clone())}return b}}class At{constructor(s={}){this.options=s,l.bindAll(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(s){const h=this.options&&this.options.compact;return this._map=s,this._container=z("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=z("button","mapboxgl-ctrl-attrib-button",this._container),z("span","mapboxgl-ctrl-icon",this._compactButton).setAttribute("aria-hidden","true"),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=z("div","mapboxgl-ctrl-attrib-inner",this._container),this._innerContainer.setAttribute("role","list"),h&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),h===void 0&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0}_setElementTitle(s,h){const g=this._map._getUIString(`AttributionControl.${h}`);s.setAttribute("aria-label",g),s.removeAttribute("title"),s.firstElementChild&&s.firstElementChild.setAttribute("title",g)}_toggleAttribution(){this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","false")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","true"))}_updateEditLink(){let s=this._editLink;s||(s=this._editLink=this._container.querySelector(".mapbox-improve-map"));const h=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||l.config.ACCESS_TOKEN}];if(s){const g=h.reduce((v,b,A)=>(b.value&&(v+=`${b.key}=${b.value}${Av.length-b.length),s=s.filter((v,b)=>{for(let A=b+1;A=0)return!1;return!0}),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?s=[...this.options.customAttribution,...s]:s.unshift(this.options.customAttribution));const g=s.join(" | ");g!==this._attribHTML&&(this._attribHTML=g,s.length?(this._innerContainer.innerHTML=g,this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact","mapboxgl-compact-show")}}class Op{constructor(){l.bindAll(["_updateLogo","_updateCompact"],this)}onAdd(s){this._map=s,this._container=z("div","mapboxgl-ctrl");const h=z("a","mapboxgl-ctrl-logo");return h.target="_blank",h.rel="noopener nofollow",h.href="https://www.mapbox.com/",h.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),h.setAttribute("rel","noopener nofollow"),this._container.appendChild(h),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)}getDefaultPosition(){return"bottom-left"}_updateLogo(s){s&&s.sourceDataType!=="metadata"||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;const s=this._map.style._sourceCaches;if(Object.entries(s).length===0)return!0;for(const h in s){const g=s[h].getSource();if(g.hasOwnProperty("mapbox_logo")&&!g.mapbox_logo)return!1}return!0}_updateCompact(){const s=this._container.children;if(s.length){const h=s[0];this._map.getCanvasContainer().offsetWidth<250?h.classList.add("mapboxgl-compact"):h.classList.remove("mapboxgl-compact")}}}class Fp{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(s){const h=++this._id;return this._queue.push({callback:s,id:h,cancelled:!1}),h}remove(s){const h=this._currentlyRunning,g=h?this._queue.concat(h):this._queue;for(const v of g)if(v.id===s)return void(v.cancelled=!0)}run(s=0){const h=this._currentlyRunning=this._queue;this._queue=[];for(const g of h)if(!g.cancelled&&(g.callback(s),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}function Ml(f,s,h){if(f=new l.LngLat(f.lng,f.lat),s){const g=new l.LngLat(f.lng-360,f.lat),v=new l.LngLat(f.lng+360,f.lat),b=360*Math.ceil(Math.abs(f.lng-h.center.lng)/360),A=h.locationPoint(f).distSqr(s),I=s.x<0||s.y<0||s.x>h.width||s.y>h.height;h.locationPoint(g).distSqr(s)180;){const g=h.locationPoint(f);if(g.x>=0&&g.y>=0&&g.x<=h.width&&g.y<=h.height)break;f.lng>h.center.lng?f.lng-=360:f.lng+=360}return f}const Us={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%)"};class xt extends l.Evented{constructor(s,h){if(super(),(s instanceof l.window.HTMLElement||h)&&(s=l.extend({element:s},h)),l.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this),this._anchor=s&&s.anchor||"center",this._color=s&&s.color||"#3FB1CE",this._scale=s&&s.scale||1,this._draggable=s&&s.draggable||!1,this._clickTolerance=s&&s.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=s&&s.rotation||0,this._rotationAlignment=s&&s.rotationAlignment||"auto",this._pitchAlignment=s&&s.pitchAlignment&&s.pitchAlignment||"auto",this._updateMoving=()=>this._update(!0),this._occludedOpacity=s&&s.occludedOpacity||.2,s&&s.element)this._element=s.element,this._offset=l.Point.convert(s&&s.offset||[0,0]);else{this._defaultMarker=!0,this._element=z("div");const v=41,b=27,A=W("svg",{display:"block",height:v*this._scale+"px",width:b*this._scale+"px",viewBox:`0 0 ${b} ${v}`},this._element),I=W("radialGradient",{id:"shadowGradient"},W("defs",{},A));W("stop",{offset:"10%","stop-opacity":.4},I),W("stop",{offset:"100%","stop-opacity":.05},I),W("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},A),W("path",{fill:this._color,d:"M27,13.5C27,19.07 20.25,27 14.75,34.5C14.02,35.5 12.98,35.5 12.25,34.5C6.75,27 0,19.22 0,13.5C0,6.04 6.04,0 13.5,0C20.96,0 27,6.04 27,13.5Z"},A),W("path",{opacity:.25,d:"M13.5,0C6.04,0 0,6.04 0,13.5C0,19.22 6.75,27 12.25,34.5C13,35.52 14.02,35.5 14.75,34.5C20.25,27 27,19.07 27,13.5C27,6.04 20.96,0 13.5,0ZM13.5,1C20.42,1 26,6.58 26,13.5C26,15.9 24.5,19.18 22.22,22.74C19.95,26.3 16.71,30.14 13.94,33.91C13.74,34.18 13.61,34.32 13.5,34.44C13.39,34.32 13.26,34.18 13.06,33.91C10.28,30.13 7.41,26.31 5.02,22.77C2.62,19.23 1,15.95 1,13.5C1,6.58 6.58,1 13.5,1Z"},A),W("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},A),this._offset=l.Point.convert(s&&s.offset||[0,-14])}this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label","Map marker"),this._element.classList.add("mapboxgl-marker"),this._element.addEventListener("dragstart",v=>{v.preventDefault()}),this._element.addEventListener("mousedown",v=>{v.preventDefault()});const g=this._element.classList;for(const v in Us)g.remove(`mapboxgl-marker-anchor-${v}`);g.add(`mapboxgl-marker-anchor-${this._anchor}`),this._popup=null}addTo(s){return s===this._map||(this.remove(),this._map=s,s.getCanvasContainer().appendChild(this._element),s.on("move",this._updateMoving),s.on("moveend",this._update),s.on("remove",this._clearFadeTimer),s._addMarker(this),this.setDraggable(this._draggable),this._update(),s.on("click",this._onMapClick)),this}remove(){const s=this._map;return s&&(s.off("click",this._onMapClick),s.off("move",this._updateMoving),s.off("moveend",this._update),s.off("mousedown",this._addDragHandler),s.off("touchstart",this._addDragHandler),s.off("mouseup",this._onUp),s.off("touchend",this._onUp),s.off("mousemove",this._onMove),s.off("touchmove",this._onMove),s.off("remove",this._clearFadeTimer),s._removeMarker(this),this._map=void 0),this._clearFadeTimer(),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(s){return this._lngLat=l.LngLat.convert(s),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}getElement(){return this._element}setPopup(s){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeAttribute("role"),this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),s){if(!("offset"in s.options)){const v=Math.sqrt(Math.pow(13.5,2)/2);s.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[v,-1*(38.1-13.5+v)],"bottom-right":[-v,-1*(38.1-13.5+v)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=s,s._marker=this,this._lngLat&&this._popup.setLngLat(this._lngLat),this._element.setAttribute("role","button"),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress),this._element.setAttribute("aria-expanded","false")}return this}_onKeyPress(s){const h=s.code,g=s.charCode||s.keyCode;h!=="Space"&&h!=="Enter"&&g!==32&&g!==13||this.togglePopup()}_onMapClick(s){const h=s.originalEvent.target,g=this._element;this._popup&&(h===g||g.contains(h))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const s=this._popup;return s?(s.isOpen()?(s.remove(),this._element.setAttribute("aria-expanded","false")):this._map&&(s.addTo(this._map),this._element.setAttribute("aria-expanded","true")),this):this}_behindTerrain(){const s=this._map,h=this._pos;if(!s||!h)return!1;const g=s.unproject(h),v=s.getFreeCameraOptions();if(!v.position)return!1;const b=v.position.toLngLat();return b.distanceTo(g)<.9*b.distanceTo(this._lngLat)}_evaluateOpacity(){const s=this._map;if(!s)return;const h=this._pos;if(!h||h.x<0||h.x>s.transform.width||h.y<0||h.y>s.transform.height)return void this._clearFadeTimer();const g=s.unproject(h);let v;s._showingGlobe()&&l.isLngLatBehindGlobe(s.transform,this._lngLat)?v=0:(v=1-s._queryFogOpacity(g),s.transform._terrainEnabled()&&s.getTerrain()&&this._behindTerrain()&&(v*=this._occludedOpacity)),this._element.style.opacity=`${v}`,this._element.style.pointerEvents=v>0?"auto":"none",this._popup&&this._popup._setOpacity(v),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_updateDOM(){const s=this._pos;if(!s||!this._map)return;const h=this._offset.mult(this._scale);this._element.style.transform=` + translate(${s.x}px,${s.y}px) + ${Us[this._anchor]} + ${this._calculateXYTransform()} ${this._calculateZTransform()} + translate(${h.x}px,${h.y}px) + `}_calculateXYTransform(){const s=this._pos,h=this._map,g=this.getPitchAlignment();if(!h||!s||g!=="map")return"";if(!h._showingGlobe()){const D=h.getPitch();return D?`rotateX(${D}deg)`:""}const v=l.radToDeg(l.globeTiltAtLngLat(h.transform,this._lngLat)),b=s.sub(l.globeCenterToScreenPoint(h.transform)),A=Math.abs(b.x)+Math.abs(b.y);if(A===0)return"";const I=v/A;return`rotateX(${-b.y*I}deg) rotateY(${b.x*I}deg)`}_calculateZTransform(){const s=this._pos,h=this._map;if(!h||!s)return"";let g=0;const v=this.getRotationAlignment();if(v==="map")if(h._showingGlobe()){const b=h.project(new l.LngLat(this._lngLat.lng,this._lngLat.lat+.001)),A=h.project(new l.LngLat(this._lngLat.lng,this._lngLat.lat-.001)).sub(b);g=l.radToDeg(Math.atan2(A.y,A.x))-90}else g=-h.getBearing();else if(v==="horizon"){const b=l.smoothstep(4,6,h.getZoom()),A=l.globeCenterToScreenPoint(h.transform);A.y+=b*h.transform.height;const I=s.sub(A),D=l.radToDeg(Math.atan2(I.y,I.x));g=(D>90?D-270:D+90)*(1-b)}return g+=this._rotation,g?`rotateZ(${g}deg)`:""}_update(s){l.window.cancelAnimationFrame(this._updateFrameId);const h=this._map;h&&(h.transform.renderWorldCopies&&(this._lngLat=Ml(this._lngLat,this._pos,h.transform)),this._pos=h.project(this._lngLat),s===!0?this._updateFrameId=l.window.requestAnimationFrame(()=>{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())}):this._pos=this._pos.round(),h._requestDomTask(()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(h._showingGlobe()||h.getTerrain()||h.getFog())&&!this._fadeTimer&&(this._fadeTimer=setTimeout(this._evaluateOpacity.bind(this),60)))}))}getOffset(){return this._offset}setOffset(s){return this._offset=l.Point.convert(s),this._update(),this}_onMove(s){const h=this._map;if(!h)return;const g=this._pointerdownPos,v=this._positionDelta;if(g&&v){if(!this._isDragging){const b=this._clickTolerance||h._clickTolerance;if(s.point.dist(g)=this._endTime)return this._end;const h=l.easeCubicInOut((s-this._startTime)/(this._endTime-this._startTime));return this._start*(1-h)+this._end*h}isEasing(s){return s>=this._startTime&&s<=this._endTime}jumpTo(s){this._startTime=-1/0,this._endTime=-1/0,this._start=s,this._end=s}easeTo(s,h,g){this._start=this.getValue(h),this._end=s,this._startTime=h,this._endTime=h+g}}const N0={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","Map.Title":"Map","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScrollZoomBlocker.CtrlMessage":"Use ctrl + scroll to zoom the map","ScrollZoomBlocker.CmdMessage":"Use ⌘ + scroll to zoom the map","TouchPanBlocker.Message":"Use two fingers to move the map"},U0={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:85,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,performanceMetricsCollection:!0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,optimizeForTerrain:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,minTileCacheSize:null,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",localFontFamily:null,transformRequest:null,accessToken:null,fadeDuration:300,respectPrefersReducedMotion:!0,crossSourceCollisions:!0},mx={showCompass:!0,showZoom:!0,visualizePitch:!1};class gx{constructor(s,h,g=!1){this._clickTolerance=10,this.element=h,this.mouseRotate=new Pp({clickTolerance:s.dragRotate._mouseRotate._clickTolerance}),this.map=s,g&&(this.mousePitch=new Dp({clickTolerance:s.dragRotate._mousePitch._clickTolerance})),l.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),h.addEventListener("mousedown",this.mousedown),h.addEventListener("touchstart",this.touchstart,{passive:!1}),h.addEventListener("touchmove",this.touchmove),h.addEventListener("touchend",this.touchend),h.addEventListener("touchcancel",this.reset)}down(s,h){this.mouseRotate.mousedown(s,h),this.mousePitch&&this.mousePitch.mousedown(s,h),V()}move(s,h){const g=this.map,v=this.mouseRotate.mousemoveWindow(s,h),b=v&&v.bearingDelta;if(b&&g.setBearing(g.getBearing()+b),this.mousePitch){const A=this.mousePitch.mousemoveWindow(s,h),I=A&&A.pitchDelta;I&&g.setPitch(g.getPitch()+I)}}off(){const s=this.element;s.removeEventListener("mousedown",this.mousedown),s.removeEventListener("touchstart",this.touchstart,{passive:!1}),s.removeEventListener("touchmove",this.touchmove),s.removeEventListener("touchend",this.touchend),s.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){R(),l.window.removeEventListener("mousemove",this.mousemove),l.window.removeEventListener("mouseup",this.mouseup)}mousedown(s){this.down(l.extend({},s,{ctrlKey:!0,preventDefault:()=>s.preventDefault()}),Q(this.element,s)),l.window.addEventListener("mousemove",this.mousemove),l.window.addEventListener("mouseup",this.mouseup)}mousemove(s){this.move(s,Q(this.element,s))}mouseup(s){this.mouseRotate.mouseupWindow(s),this.mousePitch&&this.mousePitch.mouseupWindow(s),this.offTemp()}touchstart(s){s.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=te(this.element,s.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>s.preventDefault()},this._startPos))}touchmove(s){s.targetTouches.length!==1?this.reset():(this._lastPos=te(this.element,s.targetTouches)[0],this.move({preventDefault:()=>s.preventDefault()},this._lastPos))}touchend(s){s.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)f.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(f.minPitch!=null&&f.maxPitch!=null&&f.minPitch>f.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(f.minPitch!=null&&f.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(f.maxPitch!=null&&f.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(f.antialias&&l.isSafariWithAntialiasingBug(l.window)&&(f.antialias=!1,l.warnOnce("Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609")),super(new Cl(f.minZoom,f.maxZoom,f.minPitch,f.maxPitch,f.renderWorldCopies),f),this._interactive=f.interactive,this._minTileCacheSize=f.minTileCacheSize,this._maxTileCacheSize=f.maxTileCacheSize,this._failIfMajorPerformanceCaveat=f.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=f.preserveDrawingBuffer,this._antialias=f.antialias,this._useWebGL2=f.useWebGL2,this._trackResize=f.trackResize,this._bearingSnap=f.bearingSnap,this._refreshExpiredTiles=f.refreshExpiredTiles,this._fadeDuration=f.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=f.crossSourceCollisions,this._collectResourceTiming=f.collectResourceTiming,this._optimizeForTerrain=f.optimizeForTerrain,this._language=this._parseLanguage(f.language),this._worldview=f.worldview,this._renderTaskQueue=new Fp,this._domRenderTaskQueue=new Fp,this._controls=[],this._markers=[],this._popups=[],this._mapId=l.uniqueId(),this._locale=l.extend({},N0,f.locale),this._clickTolerance=f.clickTolerance,this._cooperativeGestures=f.cooperativeGestures,this._performanceMetricsCollection=f.performanceMetricsCollection,this._containerWidth=0,this._containerHeight=0,this._averageElevationLastSampledAt=-1/0,this._averageElevationExaggeration=0,this._averageElevation=new Bp(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._requestManager=new l.RequestManager(f.transformRequest,f.accessToken,f.testMode),this._silenceAuthErrors=!!f.testMode,typeof f.container=="string"){if(this._container=l.window.document.getElementById(f.container),!this._container)throw new Error(`Container '${f.container}' not found.`)}else{if(!(f.container instanceof l.window.HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=f.container}if(this._container.childNodes.length>0&&l.warnOnce("The map container element should be empty, otherwise the map's interactivity will be negatively impacted. If you want to display a message when WebGL is not supported, use the Mapbox GL Supported plugin instead."),f.maxBounds&&this.setMaxBounds(f.maxBounds),l.bindAll(["_onWindowOnline","_onWindowResize","_onVisibilityChange","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),this.painter===void 0)throw new Error("Failed to initialize WebGL.");this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),l.window!==void 0&&(l.window.addEventListener("online",this._onWindowOnline,!1),l.window.addEventListener("resize",this._onWindowResize,!1),l.window.addEventListener("orientationchange",this._onWindowResize,!1),l.window.addEventListener("webkitfullscreenchange",this._onWindowResize,!1),l.window.addEventListener("visibilitychange",this._onVisibilityChange,!1)),this.handlers=new Qo(this,f),this._localFontFamily=f.localFontFamily,this._localIdeographFontFamily=f.localIdeographFontFamily,f.style&&this.setStyle(f.style,{localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),f.projection&&this.setProjection(f.projection),this._hash=f.hash&&new Ap(typeof f.hash=="string"&&f.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:f.center,zoom:f.zoom,bearing:f.bearing,pitch:f.pitch}),f.bounds&&(this.resize(),this.fitBounds(f.bounds,l.extend({},f.fitBoundsOptions,{duration:0})))),this.resize(),f.attributionControl&&this.addControl(new At({customAttribution:f.customAttribution})),this._logoControl=new Op,this.addControl(this._logoControl,f.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",s=>{this._update(s.dataType==="style"),this.fire(new l.Event(`${s.dataType}data`,s))}),this.on("dataloading",s=>{this.fire(new l.Event(`${s.dataType}dataloading`,s))})}_getMapId(){return this._mapId}addControl(f,s){if(s===void 0&&(s=f.getDefaultPosition?f.getDefaultPosition():"top-right"),!f||!f.onAdd)return this.fire(new l.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const h=f.onAdd(this);this._controls.push(f);const g=this._controlPositions[s];return s.indexOf("bottom")!==-1?g.insertBefore(h,g.firstChild):g.appendChild(h),this}removeControl(f){if(!f||!f.onRemove)return this.fire(new l.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const s=this._controls.indexOf(f);return s>-1&&this._controls.splice(s,1),f.onRemove(this),this}hasControl(f){return this._controls.indexOf(f)>-1}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(f){if(this._updateContainerDimensions(),this._containerWidth===this.transform.width&&this._containerHeight===this.transform.height)return this;this._resizeCanvas(this._containerWidth,this._containerHeight),this.transform.resize(this._containerWidth,this._containerHeight),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight));const s=!this._moving;return s&&this.fire(new l.Event("movestart",f)).fire(new l.Event("move",f)),this.fire(new l.Event("resize",f)),s&&this.fire(new l.Event("moveend",f)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(f){return this.transform.setMaxBounds(l.LngLatBounds.convert(f)),this._update()}setMinZoom(f){if((f=f??-2)>=-2&&f<=this.transform.maxZoom)return this.transform.minZoom=f,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=f,this._update(),this.getZoom()>f?this.setZoom(f):this.fire(new l.Event("zoomstart")).fire(new l.Event("zoom")).fire(new l.Event("zoomend")),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(f){if((f=f??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(f>=0&&f<=this.transform.maxPitch)return this.transform.minPitch=f,this._update(),this.getPitch()85)throw new Error("maxPitch must be less than or equal to 85");if(f>=this.transform.minPitch)return this.transform.maxPitch=f,this._update(),this.getPitch()>f?this.setPitch(f):this.fire(new l.Event("pitchstart")).fire(new l.Event("pitch")).fire(new l.Event("pitchend")),this;throw new Error("maxPitch must be greater than or equal to minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(f){return this.transform.renderWorldCopies=f,this.transform.renderWorldCopies||this._forceMarkerAndPopupUpdate(!0),this._update()}getLanguage(){return this._language}_parseLanguage(f){return f==="auto"?l.window.navigator.language:Array.isArray(f)?f.length===0?void 0:f.map(s=>s==="auto"?l.window.navigator.language:s):f}setLanguage(f){const s=this._parseLanguage(f);if(!this.style||s===this._language)return this;this._language=s,this.style._reloadSources();for(const h of this._controls)h._setLanguage&&h._setLanguage(this._language);return this}getWorldview(){return this._worldview}setWorldview(f){return this.style&&f!==this._worldview?(this._worldview=f,this.style._reloadSources(),this):this}getProjection(){return this.transform.mercatorFromTransition?{name:"globe",center:[0,0]}:this.transform.getProjection()}_showingGlobe(){return this.transform.projection.name==="globe"}setProjection(f){return this._lazyInitEmptyStyle(),f?typeof f=="string"&&(f={name:f}):f=null,this._useExplicitProjection=!!f,this._prioritizeAndUpdateProjection(f,this.style.stylesheet?this.style.stylesheet.projection:null)}_updateProjectionTransition(){if(this.getProjection().name!=="globe")return;const f=this.transform,s=f.projection.name;let h;s==="globe"&&f.zoom>=l.GLOBE_ZOOM_THRESHOLD_MAX?(f.setMercatorFromTransition(),h=!0):s==="mercator"&&f.zoom=l.GLOBE_ZOOM_THRESHOLD_MAX?this.transform.setMercatorFromTransition():this.transform.setProjection(f),this.style.applyProjectionUpdate(),s){this.painter.clearBackgroundTiles();for(const h in this.style._sourceCaches)this.style._sourceCaches[h].clearTiles();this._update(!0),this._forceMarkerAndPopupUpdate(!0)}return this}project(f){return this.transform.locationPoint3D(l.LngLat.convert(f))}unproject(f){return this.transform.pointLocation3D(l.Point.convert(f))}isMoving(){return this._moving||this.handlers&&this.handlers.isMoving()||!1}isZooming(){return this._zooming||this.handlers&&this.handlers.isZooming()||!1}isRotating(){return this._rotating||this.handlers&&this.handlers.isRotating()||!1}_isDragging(){return this.handlers&&this.handlers._isDragging()||!1}_createDelegatedListener(f,s,h){if(f==="mouseenter"||f==="mouseover"){let g=!1;const v=A=>{const I=s.filter(N=>this.getLayer(N)),D=I.length?this.queryRenderedFeatures(A.point,{layers:I}):[];D.length?g||(g=!0,h.call(this,new Wn(f,this,A.originalEvent,{features:D}))):g=!1},b=()=>{g=!1};return{layers:new Set(s),listener:h,delegates:{mousemove:v,mouseout:b}}}if(f==="mouseleave"||f==="mouseout"){let g=!1;const v=A=>{const I=s.filter(D=>this.getLayer(D));(I.length?this.queryRenderedFeatures(A.point,{layers:I}):[]).length?g=!0:g&&(g=!1,h.call(this,new Wn(f,this,A.originalEvent)))},b=A=>{g&&(g=!1,h.call(this,new Wn(f,this,A.originalEvent)))};return{layers:new Set(s),listener:h,delegates:{mousemove:v,mouseout:b}}}{const g=v=>{const b=s.filter(I=>this.getLayer(I)),A=b.length?this.queryRenderedFeatures(v.point,{layers:b}):[];A.length&&(v.features=A,h.call(this,v),delete v.features)};return{layers:new Set(s),listener:h,delegates:{[f]:g}}}}on(f,s,h){if(h===void 0)return super.on(f,s);Array.isArray(s)||(s=[s]);const g=this._createDelegatedListener(f,s,h);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[f]=this._delegatedListeners[f]||[],this._delegatedListeners[f].push(g);for(const v in g.delegates)this.on(v,g.delegates[v]);return this}once(f,s,h){if(h===void 0)return super.once(f,s);Array.isArray(s)||(s=[s]);const g=this._createDelegatedListener(f,s,h);for(const v in g.delegates)this.once(v,g.delegates[v]);return this}off(f,s,h){if(h===void 0)return super.off(f,s);s=new Set(Array.isArray(s)?s:[s]);const g=(b,A)=>{if(b.size!==A.size)return!1;for(const I of b)if(!A.has(I))return!1;return!0},v=this._delegatedListeners?this._delegatedListeners[f]:void 0;return v&&(b=>{for(let A=0;A{v?this.fire(new l.ErrorEvent(v)):b&&this._updateDiff(b,s)})}else typeof f=="object"&&this._updateDiff(f,s)}_updateDiff(f,s){try{this.style.setState(f)&&this._update(!0)}catch(h){l.warnOnce(`Unable to perform style diff: ${h.message||h.error||h}. Rebuilding the style from scratch.`),this._updateStyle(f,s)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():(l.warnOnce("There is no style added to the map."),!1)}addSource(f,s){return this._lazyInitEmptyStyle(),this.style.addSource(f,s),this._update(!0)}isSourceLoaded(f){return!!this.style&&this.style._isSourceCacheLoaded(f)}areTilesLoaded(){const f=this.style&&this.style._sourceCaches;for(const s in f){const h=f[s]._tiles;for(const g in h){const v=h[g];if(v.state!=="loaded"&&v.state!=="errored")return!1}}return!0}addSourceType(f,s,h){this._lazyInitEmptyStyle(),this.style.addSourceType(f,s,h)}removeSource(f){return this.style.removeSource(f),this._updateTerrain(),this._update(!0)}getSource(f){return this.style.getSource(f)}addImage(f,s,{pixelRatio:h=1,sdf:g=!1,stretchX:v,stretchY:b,content:A}={}){if(this._lazyInitEmptyStyle(),s instanceof l.window.HTMLImageElement||l.window.ImageBitmap&&s instanceof l.window.ImageBitmap){const{width:I,height:D,data:N}=l.exported.getImageData(s);this.style.addImage(f,{data:new l.RGBAImage({width:I,height:D},N),pixelRatio:h,stretchX:v,stretchY:b,content:A,sdf:g,version:0})}else if(s.width===void 0||s.height===void 0)this.fire(new l.ErrorEvent(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));else{const{width:I,height:D}=s,N=s;this.style.addImage(f,{data:new l.RGBAImage({width:I,height:D},new Uint8Array(N.data)),pixelRatio:h,stretchX:v,stretchY:b,content:A,sdf:g,version:0,userImage:N}),N.onAdd&&N.onAdd(this,f)}}updateImage(f,s){const h=this.style.getImage(f);if(!h)return void this.fire(new l.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const g=s instanceof l.window.HTMLImageElement||l.window.ImageBitmap&&s instanceof l.window.ImageBitmap?l.exported.getImageData(s):s,{width:v,height:b}=g;v!==void 0&&b!==void 0?v===h.data.width&&b===h.data.height?(h.data.replace(g.data,!(s instanceof l.window.HTMLImageElement||l.window.ImageBitmap&&s instanceof l.window.ImageBitmap)),this.style.updateImage(f,h)):this.fire(new l.ErrorEvent(new Error(`The width and height of the updated image (${v}, ${b}) + must be that same as the previous version of the image + (${h.data.width}, ${h.data.height})`))):this.fire(new l.ErrorEvent(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")))}hasImage(f){return f?!!this.style.getImage(f):(this.fire(new l.ErrorEvent(new Error("Missing required image id"))),!1)}removeImage(f){this.style.removeImage(f)}loadImage(f,s){l.getImage(this._requestManager.transformRequest(f,l.ResourceType.Image),(h,g)=>{s(h,g instanceof l.window.HTMLImageElement?l.exported.getImageData(g):g)})}listImages(){return this.style.listImages()}addLayer(f,s){return this._lazyInitEmptyStyle(),this.style.addLayer(f,s),this._update(!0)}moveLayer(f,s){return this.style.moveLayer(f,s),this._update(!0)}removeLayer(f){return this.style.removeLayer(f),this._update(!0)}getLayer(f){return this.style.getLayer(f)}setLayerZoomRange(f,s,h){return this.style.setLayerZoomRange(f,s,h),this._update(!0)}setFilter(f,s,h={}){return this.style.setFilter(f,s,h),this._update(!0)}getFilter(f){return this.style.getFilter(f)}setPaintProperty(f,s,h,g={}){return this.style.setPaintProperty(f,s,h,g),this._update(!0)}getPaintProperty(f,s){return this.style.getPaintProperty(f,s)}setLayoutProperty(f,s,h,g={}){return this.style.setLayoutProperty(f,s,h,g),this._update(!0)}getLayoutProperty(f,s){return this.style.getLayoutProperty(f,s)}setLight(f,s={}){return this._lazyInitEmptyStyle(),this.style.setLight(f,s),this._update(!0)}getLight(){return this.style.getLight()}setTerrain(f){return this._lazyInitEmptyStyle(),!f&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(f),this._averageElevationLastSampledAt=-1/0,this._update(!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(f){return this._lazyInitEmptyStyle(),this.style.setFog(f),this._update(!0)}getFog(){return this.style?this.style.getFog():null}_queryFogOpacity(f){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(l.LngLat.convert(f),this.transform):0}setFeatureState(f,s){return this.style.setFeatureState(f,s),this._update()}removeFeatureState(f,s){return this.style.removeFeatureState(f,s),this._update()}getFeatureState(f){return this.style.getFeatureState(f)}_updateContainerDimensions(){if(!this._container)return;const f=this._container.getBoundingClientRect().width||400,s=this._container.getBoundingClientRect().height||300;let h,g,v,b=this._container;for(;b&&(!g||!v);){const A=l.window.getComputedStyle(b).transform;A&&A!=="none"&&(h=A.match(/matrix.*\((.+)\)/)[1].split(", "),h[0]&&h[0]!=="0"&&h[0]!=="1"&&(g=h[0]),h[3]&&h[3]!=="0"&&h[3]!=="1"&&(v=h[3])),b=b.parentElement}this._containerWidth=g?Math.abs(f/g):f,this._containerHeight=v?Math.abs(s/v):s}_detectMissingCSS(){l.window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")!=="rgb(250, 128, 114)"&&l.warnOnce("This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described in https://www.mapbox.com/mapbox-gl-js/api/.")}_setupContainer(){const f=this._container;f.classList.add("mapboxgl-map"),(this._missingCSSCanary=z("div","mapboxgl-canary",f)).style.visibility="hidden",this._detectMissingCSS();const s=this._canvasContainer=z("div","mapboxgl-canvas-container",f);this._interactive&&s.classList.add("mapboxgl-interactive"),this._canvas=z("canvas","mapboxgl-canvas",s),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region"),this._updateContainerDimensions(),this._resizeCanvas(this._containerWidth,this._containerHeight);const h=this._controlContainer=z("div","mapboxgl-control-container",f),g=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(v=>{g[v]=z("div",`mapboxgl-ctrl-${v}`,h)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(f,s){const h=l.exported.devicePixelRatio||1;this._canvas.width=h*Math.ceil(f),this._canvas.height=h*Math.ceil(s),this._canvas.style.width=`${f}px`,this._canvas.style.height=`${s}px`}_addMarker(f){this._markers.push(f)}_removeMarker(f){const s=this._markers.indexOf(f);s!==-1&&this._markers.splice(s,1)}_addPopup(f){this._popups.push(f)}_removePopup(f){const s=this._popups.indexOf(f);s!==-1&&this._popups.splice(s,1)}_setupPainter(){const f=l.extend({},T.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),s=this._useWebGL2&&this._canvas.getContext("webgl2",f),h=s||this._canvas.getContext("webgl",f)||this._canvas.getContext("experimental-webgl",f);h?(this._useWebGL2&&!s&&l.warnOnce("Failed to create WebGL 2 context. Using WebGL 1."),l.storeAuthState(h,!0),this.painter=new Al(h,this.transform,!!s),this.on("data",g=>{g.dataType==="source"&&this.painter.setTileLoadedFlag(!0)}),l.exported$1.testSupport(h)):this.fire(new l.ErrorEvent(new Error("Failed to initialize WebGL")))}_contextLost(f){f.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new l.Event("webglcontextlost",{originalEvent:f}))}_contextRestored(f){this._setupPainter(),this.resize(),this._update(),this.fire(new l.Event("webglcontextrestored",{originalEvent:f}))}_onMapScroll(f){if(f.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(f){return this.style?(this._styleDirty=this._styleDirty||f,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(f){return this._update(),this._renderTaskQueue.add(f)}_cancelRenderFrame(f){this._renderTaskQueue.remove(f)}_requestDomTask(f){!this.loaded()||this.loaded()&&!this.isMoving()?f():this._domRenderTaskQueue.add(f)}_render(f){let s;const h=this.painter.context.extTimerQuery,g=l.exported.now();if(this.listens("gpu-timing-frame")&&(s=h.createQueryEXT(),h.beginQueryEXT(h.TIME_ELAPSED_EXT,s)),this.painter.context.setDirty(),this.painter.setBaseState(),(this.isMoving()||this.isRotating()||this.isZooming())&&(this._interactionRange[0]=Math.min(this._interactionRange[0],l.window.performance.now()),this._interactionRange[1]=Math.max(this._interactionRange[1],l.window.performance.now())),this._renderTaskQueue.run(f),this._domRenderTaskQueue.run(f),this._removed)return;this._updateProjectionTransition();const v=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const I=this.transform.zoom,D=this.transform.pitch,N=l.exported.now(),B=new l.EvaluationParameters(I,{now:N,fadeDuration:v,pitch:D,transition:this.style.getTransition()});this.style.update(B)}this.style&&this.style.fog&&this.style.fog.hasTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0);let b=!1;if(this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),b=this._updateAverageElevation(g),this.style._updateSources(this.transform),this._forceMarkerAndPopupUpdate()):b=this._updateAverageElevation(g),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,v,this._crossSourceCollisions),this.style&&this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showTerrainWireframe:this.showTerrainWireframe,showOverdrawInspector:this._showOverdrawInspector,showQueryGeometry:!!this._showQueryGeometry,showTileAABBs:this.showTileAABBs,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:v,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),gpuTimingDeferredRender:!!this.listens("gpu-timing-deferred-render"),speedIndexTiming:this.speedIndexTiming}),this.fire(new l.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new l.Event("load"))),this.style&&this.style.hasTransitions()&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),s){const I=l.exported.now()-g;h.endQueryEXT(h.TIME_ELAPSED_EXT,s),setTimeout(()=>{const D=h.getQueryObjectEXT(s,h.QUERY_RESULT_EXT)/1e6;h.deleteQueryEXT(s),this.fire(new l.Event("gpu-timing-frame",{cpuTime:I,gpuTime:D})),l.window.performance.mark("frame-gpu",{startTime:g,detail:{gpuTime:D}})},50)}if(this.listens("gpu-timing-layer")){const I=this.painter.collectGpuTimers();setTimeout(()=>{const D=this.painter.queryGpuTimers(I);this.fire(new l.Event("gpu-timing-layer",{layerTimes:D}))},50)}if(this.listens("gpu-timing-deferred-render")){const I=this.painter.collectDeferredRenderGpuQueries();setTimeout(()=>{const D=this.painter.queryGpuTimeDeferredRender(I);this.fire(new l.Event("gpu-timing-deferred-render",{gpuTime:D}))},50)}const A=this._sourcesDirty||this._styleDirty||this._placementDirty||b;if(A||this._repaint)this.triggerRepaint();else{const I=!this.isMoving()&&this.loaded();if(I&&(b=this._updateAverageElevation(g,!0)),b)this.triggerRepaint();else if(this._triggerFrame(!1),I&&(this.fire(new l.Event("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const D=this._calculateSpeedIndex();this.fire(new l.Event("speedindexcompleted",{speedIndex:D})),this.speedIndexTiming=!1}}!this._loaded||this._fullyLoaded||A||(this._fullyLoaded=!0,l.LivePerformanceUtils.mark(l.PerformanceMarkers.fullLoad),this._performanceMetricsCollection&&l.postPerformanceEvent(this._requestManager._customAccessToken,{width:this.painter.width,height:this.painter.height,interactionRange:this._interactionRange,visibilityHidden:this._visibilityHidden,terrainEnabled:!!this.painter.style.getTerrain(),fogEnabled:!!this.painter.style.getFog(),projection:this.getProjection().name,zoom:this.transform.zoom,renderer:this.painter.context.renderer,vendor:this.painter.context.vendor}),this._authenticate())}_forceMarkerAndPopupUpdate(f){for(const s of this._markers)f&&!this.getRenderWorldCopies()&&(s._lngLat=s._lngLat.wrap()),s._update();for(const s of this._popups)!f||this.getRenderWorldCopies()||s._trackPointer||(s._lngLat=s._lngLat.wrap()),s._update()}_updateAverageElevation(f,s=!1){const h=g=>(this.transform.averageElevation=g,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return this.transform.averageElevation!==0&&h(0);if((s||f-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(f)){const g=this.transform.averageElevation;let v=this.transform.sampleAverageElevation(),b=!1;this.transform.elevation&&(b=this.transform.elevation.exaggeration()!==this._averageElevationExaggeration,this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(v)?v=0:this._averageElevationLastSampledAt=f;const A=Math.abs(g-v);if(A>1){if(this._isInitialLoad||b)return this._averageElevation.jumpTo(v),h(v);this._averageElevation.easeTo(v,f,300)}else if(A>1e-4)return this._averageElevation.jumpTo(v),h(v)}return!!this._averageElevation.isEasing(f)&&h(this._averageElevation.getValue(f))}_authenticate(){l.getMapSessionAPI(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,f=>{if(f&&(f.message===l.AUTH_ERR_MSG||f.status===401)){const s=this.painter.context.gl;l.storeAuthState(s,!1),this._logoControl instanceof Op&&this._logoControl._updateLogo(),s&&s.clear(s.DEPTH_BUFFER_BIT|s.COLOR_BUFFER_BIT|s.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new l.ErrorEvent(new Error("A valid Mapbox access token is required to use Mapbox GL JS. To create an account or a new access token, visit https://account.mapbox.com/")))}}),l.postMapLoadEvent(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=>{})}_updateTerrain(){const f=this._isDragging();this.painter.updateTerrain(this.style,f)}_calculateSpeedIndex(){const f=this.painter.canvasCopy(),s=this.painter.getCanvasCopiesAndTimestamps();s.timeStamps.push(performance.now());const h=this.painter.context.gl,g=h.createFramebuffer();function v(b){h.framebufferTexture2D(h.FRAMEBUFFER,h.COLOR_ATTACHMENT0,h.TEXTURE_2D,b,0);const A=new Uint8Array(h.drawingBufferWidth*h.drawingBufferHeight*4);return h.readPixels(0,0,h.drawingBufferWidth,h.drawingBufferHeight,h.RGBA,h.UNSIGNED_BYTE,A),A}return h.bindFramebuffer(h.FRAMEBUFFER,g),this._canvasPixelComparison(v(f),s.canvasCopies.map(v),s.timeStamps)}_canvasPixelComparison(f,s,h){let g=h[1]-h[0];const v=f.length/4;for(let b=0;b{const h=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,h&&this._render(s)}))}_preloadTiles(f){const s=this.style?Object.values(this.style._sourceCaches):[];return l.asyncAll(s,(h,g)=>h._preloadTiles(f,g),()=>{this.triggerRepaint()}),this}_onWindowOnline(){this._update()}_onWindowResize(f){this._trackResize&&this.resize({originalEvent:f})._update()}_onVisibilityChange(){l.window.document.visibilityState==="hidden"&&this._visibilityHidden++}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(f){this._showTileBoundaries!==f&&(this._showTileBoundaries=f,this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(f){this._showTerrainWireframe!==f&&(this._showTerrainWireframe=f,this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(f){this._speedIndexTiming!==f&&(this._speedIndexTiming=f,this._update())}get showPadding(){return!!this._showPadding}set showPadding(f){this._showPadding!==f&&(this._showPadding=f,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(f){this._showCollisionBoxes!==f&&(this._showCollisionBoxes=f,f?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(f){this._showOverdrawInspector!==f&&(this._showOverdrawInspector=f,this._update())}get repaint(){return!!this._repaint}set repaint(f){this._repaint!==f&&(this._repaint=f,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(f){this._vertices=f,this._update()}get showTileAABBs(){return!!this._showTileAABBs}set showTileAABBs(f){this._showTileAABBs!==f&&(this._showTileAABBs=f,f&&this._update())}_setCacheLimits(f,s){l.setCacheLimits(f,s)}get version(){return l.version}},NavigationControl:class{constructor(f){this.options=l.extend({},mx,f),this._container=z("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",s=>s.preventDefault()),this.options.showZoom&&(l.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",s=>{this._map&&this._map.zoomIn({},{originalEvent:s})}),z("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",s=>{this._map&&this._map.zoomOut({},{originalEvent:s})}),z("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(l.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",s=>{const h=this._map;h&&(this.options.visualizePitch?h.resetNorthPitch({},{originalEvent:s}):h.resetNorth({},{originalEvent:s}))}),this._compassIcon=z("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const f=this._map;if(!f)return;const s=f.getZoom(),h=s===f.getMaxZoom(),g=s===f.getMinZoom();this._zoomInButton.disabled=h,this._zoomOutButton.disabled=g,this._zoomInButton.setAttribute("aria-disabled",h.toString()),this._zoomOutButton.setAttribute("aria-disabled",g.toString())}_rotateCompassArrow(){const f=this._map;if(!f)return;const s=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(f.transform.pitch*(Math.PI/180)),.5)}) rotateX(${f.transform.pitch}deg) rotateZ(${f.transform.angle*(180/Math.PI)}deg)`:`rotate(${f.transform.angle*(180/Math.PI)}deg)`;f._requestDomTask(()=>{this._compassIcon&&(this._compassIcon.style.transform=s)})}onAdd(f){return this._map=f,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),f.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&f.on("pitch",this._rotateCompassArrow),f.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new gx(f,this._compass,this.options.visualizePitch)),this._container}onRemove(){const f=this._map;f&&(this._container.remove(),this.options.showZoom&&f.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&f.off("pitch",this._rotateCompassArrow),f.off("rotate",this._rotateCompassArrow),this._handler&&this._handler.off(),this._handler=void 0),this._map=void 0)}_createButton(f,s){const h=z("button",f,this._container);return h.type="button",h.addEventListener("click",s),h}_setButtonTitle(f,s){if(!this._map)return;const h=this._map._getUIString(`NavigationControl.${s}`);f.setAttribute("aria-label",h),f.firstElementChild&&f.firstElementChild.setAttribute("title",h)}},GeolocateControl:class extends l.Evented{constructor(f){super(),this.options=l.extend({geolocation:l.window.navigator.geolocation},Np,f),l.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=kl(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(f){return this._map=f,this._container=z("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkGeolocationSupport(this._setupUI),this._container}onRemove(){this._geolocationWatchID!==void 0&&(this.options.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("zoom",this._onZoom),this._map=void 0,this._numberOfWatches=0,this._noTimeout=!1}_checkGeolocationSupport(f){const s=(h=!!this.options.geolocation)=>{this._supportsGeolocation=h,f(h)};this._supportsGeolocation!==void 0?f(this._supportsGeolocation):l.window.navigator.permissions!==void 0?l.window.navigator.permissions.query({name:"geolocation"}).then(h=>s(h.state!=="denied")).catch(()=>s()):s()}_isOutOfMapMaxBounds(f){const s=this._map.getMaxBounds(),h=f.coords;return!!s&&(h.longitudes.getEast()||h.latitudes.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting")}}_onSuccess(f){if(this._map){if(this._isOutOfMapMaxBounds(f))return this._setErrorState(),this.fire(new l.Event("outofmaxbounds",f)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=f,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(f),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(f),this.options.showUserLocation&&this._dotElement.classList.remove("mapboxgl-user-location-dot-stale"),this.fire(new l.Event("geolocate",f)),this._finish()}}_updateCamera(f){const s=new l.LngLat(f.coords.longitude,f.coords.latitude),h=f.coords.accuracy,g=this._map.getBearing(),v=l.extend({bearing:g},this.options.fitBoundsOptions);this._map.fitBounds(s.toBounds(h),v,{geolocateSource:!0})}_updateMarker(f){if(f){const s=new l.LngLat(f.coords.longitude,f.coords.latitude);this._accuracyCircleMarker.setLngLat(s).addTo(this._map),this._userLocationDotMarker.setLngLat(s).addTo(this._map),this._accuracy=f.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const f=this._map.transform,s=l.mercatorZfromAltitude(1,f._center.lat)*f.worldSize,h=Math.ceil(2*this._accuracy*s);this._circleElement.style.width=`${h}px`,this._circleElement.style.height=`${h}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_updateMarkerRotation(){this._userLocationDotMarker&&typeof this._heading=="number"?(this._userLocationDotMarker.setRotation(this._heading),this._dotElement.classList.add("mapboxgl-user-location-show-heading")):(this._dotElement.classList.remove("mapboxgl-user-location-show-heading"),this._userLocationDotMarker.setRotation(0))}_onError(f){if(this._map){if(this.options.trackUserLocation)if(f.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const s=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",s),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",s),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(f.code===3&&this._noTimeout)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("mapboxgl-user-location-dot-stale"),this.fire(new l.Event("error",f)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(f){if(this._map!==void 0){if(this._container.addEventListener("contextmenu",s=>s.preventDefault()),this._geolocateButton=z("button","mapboxgl-ctrl-geolocate",this._container),z("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",f===!1){l.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");const s=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",s),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",s)}else{const s=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",s),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",s)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=z("div","mapboxgl-user-location"),this._dotElement.appendChild(z("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(z("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new xt({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=z("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new xt({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",s=>{s.geolocateSource||this._watchState!=="ACTIVE_LOCK"||s.originalEvent&&s.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this.fire(new l.Event("trackuserlocationend")))})}}_onDeviceOrientation(f){this._userLocationDotMarker&&(f.webkitCompassHeading?this._heading=f.webkitCompassHeading:f.absolute===!0&&(this._heading=-1*f.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return l.warnOnce("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new l.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":this._numberOfWatches--,this._noTimeout=!1,this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire(new l.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new l.Event("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let f;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._numberOfWatches++,this._numberOfWatches>1?(f={maximumAge:6e5,timeout:0},this._noTimeout=!0):(f=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,f),this.options.showUserHeading&&this._addDeviceOrientationListener()}}else this.options.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_addDeviceOrientationListener(){const f=()=>{l.window.addEventListener("ondeviceorientationabsolute"in l.window?"deviceorientationabsolute":"deviceorientation",this._onDeviceOrientation)};l.window.DeviceMotionEvent!==void 0&&typeof l.window.DeviceMotionEvent.requestPermission=="function"?DeviceOrientationEvent.requestPermission().then(s=>{s==="granted"&&f()}).catch(console.error):f()}_clearWatch(){this.options.geolocation.clearWatch(this._geolocationWatchID),l.window.removeEventListener("deviceorientation",this._onDeviceOrientation),l.window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientation),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:At,ScaleControl:class{constructor(f){this.options=l.extend({},Up,f),this._isNumberFormatSupported=function(){try{return new Intl.NumberFormat("en",{style:"unit",unitDisplay:"short",unit:"meter"}),!0}catch{return!1}}(),l.bindAll(["_update","_setScale","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_update(){const f=this.options.maxWidth||100,s=this._map,h=s._containerHeight/2,g=s._containerWidth/2-f/2,v=s.unproject([g,h]),b=s.unproject([g+f,h]),A=v.distanceTo(b);if(this.options.unit==="imperial"){const I=3.2808*A;I>5280?this._setScale(f,I/5280,"mile"):this._setScale(f,I,"foot")}else this.options.unit==="nautical"?this._setScale(f,A/1852,"nautical-mile"):A>=1e3?this._setScale(f,A/1e3,"kilometer"):this._setScale(f,A,"meter")}_setScale(f,s,h){this._map._requestDomTask(()=>{const g=function(b){const A=Math.pow(10,`${Math.floor(b)}`.length-1);let I=b/A;return I=I>=10?10:I>=5?5:I>=3?3:I>=2?2:I>=1?1:function(D){const N=Math.pow(10,Math.ceil(-Math.log(D)/Math.LN10));return Math.round(D*N)/N}(I),A*I}(s),v=g/s;this._container.innerHTML=this._isNumberFormatSupported&&h!=="nautical-mile"?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"short",unit:h}).format(g):`${g} ${jp[h]}`,this._container.style.width=f*v+"px"})}onAdd(f){return this._map=f,this._language=f.getLanguage(),this._container=z("div","mapboxgl-ctrl mapboxgl-ctrl-scale",f.getContainer()),this._container.dir="auto",this._map.on("move",this._update),this._update(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._update),this._map=void 0}_setLanguage(f){this._language=f,this._update()}setUnit(f){this.options.unit=f,this._update()}},FullscreenControl:class{constructor(f){this._fullscreen=!1,f&&f.container&&(f.container instanceof l.window.HTMLElement?this._container=f.container:l.warnOnce("Full screen control 'container' must be a DOM element.")),l.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in l.window.document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in l.window.document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(f){return this._map=f,this._container||(this._container=this._map.getContainer()),this._controlContainer=z("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",l.warnOnce("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,l.window.document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!(!l.window.document.fullscreenEnabled&&!l.window.document.webkitFullscreenEnabled)}_setupUI(){const f=this._fullscreenButton=z("button","mapboxgl-ctrl-fullscreen",this._controlContainer);z("span","mapboxgl-ctrl-icon",f).setAttribute("aria-hidden","true"),f.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),l.window.document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const f=this._getTitle();this._fullscreenButton.setAttribute("aria-label",f),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",f)}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(l.window.document.fullscreenElement||l.window.document.webkitFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?l.window.document.exitFullscreen?l.window.document.exitFullscreen():l.window.document.webkitCancelFullScreen&&l.window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},Popup:class extends l.Evented{constructor(f){super(),this.options=l.extend(Object.create(Lp),f),l.bindAll(["_update","_onClose","remove","_onMouseEvent"],this),this._classList=new Set(f&&f.className?f.className.trim().split(/\s+/):[])}addTo(f){return this._map&&this.remove(),this._map=f,this.options.closeOnClick&&f.on("preclick",this._onClose),this.options.closeOnMove&&f.on("move",this._onClose),f.on("remove",this.remove),this._update(),f._addPopup(this),this._focusFirstElement(),this._trackPointer?(f.on("mousemove",this._onMouseEvent),f.on("mouseup",this._onMouseEvent),f._canvasContainer.classList.add("mapboxgl-track-pointer")):f.on("move",this._update),this.fire(new l.Event("open")),this}isOpen(){return!!this._map}remove(){this._content&&this._content.remove(),this._container&&(this._container.remove(),this._container=void 0);const f=this._map;return f&&(f.off("move",this._update),f.off("move",this._onClose),f.off("preclick",this._onClose),f.off("click",this._onClose),f.off("remove",this.remove),f.off("mousemove",this._onMouseEvent),f.off("mouseup",this._onMouseEvent),f.off("drag",this._onMouseEvent),f._canvasContainer&&f._canvasContainer.classList.remove("mapboxgl-track-pointer"),f._removePopup(this),this._map=void 0),this.fire(new l.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(f){this._lngLat=l.LngLat.convert(f),this._pos=null,this._trackPointer=!1,this._update();const s=this._map;return s&&(s.on("move",this._update),s.off("mousemove",this._onMouseEvent),s._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}trackPointer(){this._trackPointer=!0,this._pos=null,this._update();const f=this._map;return f&&(f.off("move",this._update),f.on("mousemove",this._onMouseEvent),f.on("drag",this._onMouseEvent),f._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(f){return this.setDOMContent(l.window.document.createTextNode(f))}setHTML(f){const s=l.window.document.createDocumentFragment(),h=l.window.document.createElement("body");let g;for(h.innerHTML=f;g=h.firstChild,g;)s.appendChild(g);return this.setDOMContent(s)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(f){return this.options.maxWidth=f,this._update(),this}setDOMContent(f){let s=this._content;if(s)for(;s.hasChildNodes();)s.firstChild&&s.removeChild(s.firstChild);else s=this._content=z("div","mapboxgl-popup-content",this._container||void 0);if(s.appendChild(f),this.options.closeButton){const h=this._closeButton=z("button","mapboxgl-popup-close-button",s);h.type="button",h.setAttribute("aria-label","Close popup"),h.setAttribute("aria-hidden","true"),h.innerHTML="×",h.addEventListener("click",this._onClose)}return this._update(),this._focusFirstElement(),this}addClassName(f){return this._classList.add(f),this._updateClassList(),this}removeClassName(f){return this._classList.delete(f),this._updateClassList(),this}setOffset(f){return this.options.offset=f,this._update(),this}toggleClassName(f){let s;return this._classList.delete(f)?s=!1:(this._classList.add(f),s=!0),this._updateClassList(),s}_onMouseEvent(f){this._update(f.point)}_getAnchor(f){if(this.options.anchor)return this.options.anchor;const s=this._map,h=this._container,g=this._pos;if(!s||!h||!g)return"bottom";const v=h.offsetWidth,b=h.offsetHeight,A=g.xs.transform.width-v/2;if(g.y+fs.transform.height-b){if(A)return"bottom-left";if(I)return"bottom-right"}return A?"left":I?"right":"bottom"}_updateClassList(){const f=this._container;if(!f)return;const s=[...this._classList];s.push("mapboxgl-popup"),this._anchor&&s.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&s.push("mapboxgl-popup-track-pointer"),f.className=s.join(" ")}_update(f){const s=this._map,h=this._content;if(!s||!this._lngLat&&!this._trackPointer||!h)return;let g=this._container;if(g||(g=this._container=z("div","mapboxgl-popup",s.getContainer()),this._tip=z("div","mapboxgl-popup-tip",g),g.appendChild(h)),this.options.maxWidth&&g.style.maxWidth!==this.options.maxWidth&&(g.style.maxWidth=this.options.maxWidth),s.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=Ml(this._lngLat,this._pos,s.transform)),!this._trackPointer||f){const v=this._pos=this._trackPointer&&f?f:s.project(this._lngLat),b=B0(this.options.offset),A=this._anchor=this._getAnchor(b.y),I=B0(this.options.offset,A),D=v.add(I).round();s._requestDomTask(()=>{this._container&&A&&(this._container.style.transform=`${Us[A]} translate(${D.x}px,${D.y}px)`)})}if(!this._marker&&s._showingGlobe()){const v=l.isLngLatBehindGlobe(s.transform,this._lngLat)?0:1;this._setOpacity(v)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const f=this._container.querySelector(fx);f&&f.focus()}_onClose(){this.remove()}_setOpacity(f){this._container&&(this._container.style.opacity=`${f}`),this._content&&(this._content.style.pointerEvents=f?"auto":"none")}},Marker:xt,Style:Xo,LngLat:l.LngLat,LngLatBounds:l.LngLatBounds,Point:l.Point,MercatorCoordinate:l.MercatorCoordinate,FreeCameraOptions:E0,Evented:l.Evented,config:l.config,prewarm:function(){ml().acquire(qo)},clearPrewarmedResources:function(){const f=_i;f&&(f.isPreloaded()&&f.numActive()===1?(f.release(qo),_i=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},get accessToken(){return l.config.ACCESS_TOKEN},set accessToken(f){l.config.ACCESS_TOKEN=f},get baseApiUrl(){return l.config.API_URL},set baseApiUrl(f){l.config.API_URL=f},get workerCount(){return Vn.workerCount},set workerCount(f){Vn.workerCount=f},get maxParallelImageRequests(){return l.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(f){l.config.MAX_PARALLEL_IMAGE_REQUESTS=f},clearStorage(f){l.clearTileCache(f)},workerUrl:"",workerClass:null,setNow:l.exported.setNow,restoreNow:l.exported.restoreNow};return zl});var _=u;return _})})(I3);var hT=I3.exports;const y$=XE(hT),_$=bL({__proto__:null,default:y$},[hT]);var Jt={},Nt={},k3={},P3={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.Origin="origin",e.ShowEmbed="show-embed",e.ShowPin="show-pin",e.ShowSave="show-save",e.ShowShare="show-share"}(t.AskDataAttributes||(t.AskDataAttributes={}))})(P3);var dT={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.CSV="csv",e.Excel="xlsx"}(t.CrosstabFileFormat||(t.CrosstabFileFormat={})),function(e){e.Default="default",e.Desktop="desktop",e.Tablet="tablet",e.Phone="phone"}(t.DeviceType||(t.DeviceType={})),function(e){e.AuthFailed="auth-failed",e.BrowserNotCapable="browser-not-capable",e.DownloadWorkbookNotAllowed="download-workbook-not-allowed",e.FilterCannotBePerformed="filter-cannot-be-performed",e.IndexOutOfRange="index-out-of-range",e.InternalError="internal-error",e.InvalidCustomViewName="invalid-custom-view-name",e.InvalidDateParameter="invalid-date-parameter",e.invalidFilterFieldNameOrValue="invalid-filter-field-name",e.InvalidParameter="invalid-parameter",e.InvalidSize="invalid-size",e.InvalidSheetType="invalid-sheet-type",e.InvalidSizeBehavior="invalid-size-behavior",e.InvalidSizeBehaviorOnWorksheet="invalid-size-behavior-on-worksheet",e.InvalidUrl="invalid-url",e.MissingMaxSize="missing-max-size",e.MissingMinSize="missing-min-size",e.MissingMinMaxSize="missing-min-max-size",e.MissingParameter="missing-parameter",e.MissingRangeNForRelativeDateFilters="missing-range-n-for-relative-date-filters",e.NoUrlForHiddenWorksheet="no-url-for-hidden-worksheet",e.NoUrlOrParentElementNotFound="no-url-or-parent-element-not-found",e.NotActiveSheet="not-active-sheet",e.NullOrEmptyParameter="null-or-empty-parameter",e.SheetNotInWorkbook="sheet-not-in-workbook",e.StaleDataReference="stale-data-reference",e.UnknownAuthError="unknown-auth-error",e.UnsupportedEventName="unsupported-event-name",e.VizAlreadyInManager="viz-already-in-manager",e.ImplementationError="wrong-implementation",e.NotImplemented="not-implemented",e.EventInitializationError="event-initialization-error",e.IncompatibleVersionError="incompatible-version-error",e.UnknownDialogType="unknown-dialog-type",e.FilterMissingOrNotImplemented="filter-missing-not-implemented",e.StoryPointIdMismatch="storypoint-id-mismatch"}(t.EmbeddingErrorCodes||(t.EmbeddingErrorCodes={})),function(e){e.PDF="pdf",e.PNG="png"}(t.FileFormats||(t.FileFormats={})),function(e){e.Portrait="portrait",e.Landscape="landscape"}(t.PrintOrientation||(t.PrintOrientation={})),function(e){e.Letter="letter",e.Legal="legal",e.Note="note",e.Folio="folio",e.Tabloid="tabloid",e.Ledger="ledger",e.Statement="statement",e.Executive="executive",e.A3="A3",e.A4="A4",e.A5="A5",e.B4="B4",e.B5="B5",e.Quarto="quarto",e.Unspecified="unspecified"}(t.PrintPageSize||(t.PrintPageSize={})),function(e){e.Automatic="automatic",e.Perc25="25%",e.Perc50="50%",e.Perc60="60%",e.Perc75="75%",e.Perc80="80%",e.Perc90="90%",e.Perc100="100%",e.Perc200="200%",e.Perc400="400%",e.AtMost1PageHigh="at-most-1-page-high",e.AtMost2PagesHigh="at-most-2-pages-high",e.AtMost1PageWide="at-most-1-page-wide",e.AtMost2PagesWide="at-most-2-pages-wide"}(t.PrintScaling||(t.PrintScaling={})),function(e){e.All="all",e.Axes="axes",e.Filters="filters",e.Sorts="sorts",e.Shelves="shelves"}(t.RevertVizSelection||(t.RevertVizSelection={})),function(e){e.Alerts="alerts",e.AskData="askData",e.CustomViews="customViews",e.DataDetails="dataDetails",e.Share="share",e.Subscribe="subscribe"}(t.ToolbarButtons||(t.ToolbarButtons={})),function(e){e.Top="top",e.Bottom="bottom",e.Hidden="hidden"}(t.Toolbar||(t.Toolbar={})),function(e){e.Automatic="automatic",e.Exactly="exactly",e.Range="range",e.AtLeast="atleast",e.AtMost="atmost"}(t.SheetSizeBehavior||(t.SheetSizeBehavior={})),function(e){e.Default="default",e.Card="card",e.Ban="ban"}(t.PulseLayout||(t.PulseLayout={})),function(e){e.CustomViewLoaded="customviewloaded",e.CustomViewRemoved="customviewremoved",e.CustomViewSaved="customviewsaved",e.CustomViewSetDefault="customviewsetdefault",e.EditButtonClicked="editbuttonclicked",e.EditInDesktopButtonClicked="editindesktopbuttonclicked",e.FilterChanged="filterchanged",e.FirstVizSizeKnown="firstvizsizeknown",e.FirstInteractive="firstinteractive",e.CustomMarkContextMenuEvent="custommarkcontextmenu",e.MarkSelectionChanged="markselectionchanged",e.ParameterChanged="parameterchanged",e.ToolbarStateChanged="toolbarstatechanged",e.WorkbookReadyToClose="workbookreadytoclose",e.WorkbookPublished="workbookpublished",e.WorkbookPublishedAs="workbookpublishedas",e.UrlAction="urlaction",e.TabSwitched="tabswitched",e.StoryPointSwitched="storypointswitched",e.VizLoadError="vizloaderror",e.IframeSrcUpdated="iframesrcupdated",e.SummaryDataChanged="summarydatachanged",e.ReadyToReceiveAuthToken="readytoreceiveauthtoken"}(t.TableauEventType||(t.TableauEventType={})),function(e){e.Ubertip="ubertip"}(t.ApiMenuType||(t.ApiMenuType={})),function(e){e.ExportPDF="export-pdf",e.ExportPowerPoint="export-powerpoint",e.ExportData="export-data",e.ExportCrossTab="export-cross-tab",e.ExportWorkbook="export-workbook",e.Share="share"}(t.TableauDialogType||(t.TableauDialogType={}))})(dT);var D3={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.DisableExploreFilter="disable-explore-filter",e.Layout="layout"}(t.PulseAttributes||(t.PulseAttributes={})),function(e){e.IframeStyle="iframe-style"}(t.PulseChildElements||(t.PulseChildElements={}))})(D3);var M3={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.TouchOptimize="touch-optimize",e.HideEditInDesktopButton="hide-edit-in-desktop-button",e.SuppressDefaultEditBehavior="suppress-default-edit-behavior",e.DisableVersionCheck="disable-version-check",e.OnEditInDesktopButtonClicked="onEditInDesktopButtonClicked",e.OnFirstVizSizeKnown="onFirstVizSizeKnown",e.OnFirstInteractive="onFirstInteractive"}(t.VizSharedAttributes||(t.VizSharedAttributes={})),function(e){e.DisableUrlActionsPopups="disable-url-actions",e.HideTabs="hide-tabs",e.Toolbar="toolbar",e.InstanceIdToClone="instance-id-to-clone",e.Device="device",e.HideEditButton="hide-edit-button",e.OnEditButtonClicked="onEditButtonClicked",e.OnFilterChanged="onFilterChanged",e.OnCustomMarkContextMenuEvent="onCustomMarkContextMenuEvent",e.OnMarkSelectionChanged="onMarkSelectionChanged",e.OnParameterChanged="onParameterChanged",e.OnToolbarStateChanged="onToolbarStateChanged",e.OnUrlAction="onUrlAction",e.OnTabSwitched="onTabSwitched",e.OnCustomViewLoaded="onCustomViewLoaded",e.OnCustomViewRemoved="onCustomViewRemoved",e.OnCustomViewSaved="onCustomViewSaved",e.OnCustomViewSetDefault="onCustomViewSetDefault",e.OnStoryPointSwitched="onStoryPointSwitched",e.OnSummaryDataChanged="onSummaryDataChanged",e.OnReadyToReceiveAuthToken="onReadyToReceiveAuthToken"}(t.VizAttributes||(t.VizAttributes={})),function(e){e.OnWorkbookPublished="onWorkbookPublished",e.OnWorkbookPublishedAs="onWorkbookPublishedAs",e.OnWorkbookReadyToClose="onWorkbookReadyToClose",e.HideCloseButton="hide-close-button"}(t.VizAuthoringAttributes||(t.VizAuthoringAttributes={})),function(e){e.VizFilter="viz-filter",e.VizParameter="viz-parameter",e.CustomParameter="custom-parameter",e.IframeStyle="iframe-style"}(t.VizChildElements||(t.VizChildElements={})),function(e){e.Field="field",e.Value="value",e.Name="name"}(t.VizChildElementAttributes||(t.VizChildElementAttributes={}))})(M3);var z3={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.Src="src",e.Width="width",e.Height="height",e.Token="token",e.Debug="debug",e.IframeAuth="iframe-auth",e.OnVizLoadError="onvizloaderror",e.ForceTokenSync="force-token-sync"}(t.WebComponentAttributes||(t.WebComponentAttributes={})),function(e){e.Loading="iframe-attr-loading",e.Style="iframe-attr-style",e.Class="iframe-attr-class"}(t.EmbeddedIframeAttributes||(t.EmbeddedIframeAttributes={})),function(e){e.CustomParameter="custom-parameter",e.IframeStyle="iframe-style"}(t.WebComponentChildElements||(t.WebComponentChildElements={})),function(e){e.Field="field",e.Value="value",e.Name="name"}(t.WebComponentChildElementAttributes||(t.WebComponentChildElementAttributes={}))})(z3);var pT={},R3={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.CrosstabCreationError="crosstab-creation-error",e.DataCreationError="data-creation-error",e.InvalidAggregationFieldName="invalid-aggregation-field-name",e.InvalidFilterFieldName="invalid-filter-name",e.InvalidFilterFieldValue="invalid-filter-fieldValue",e.InvalidSelectionDate="invalid-selection-date",e.InvalidSelectionFieldName="invalid-selection-fieldName",e.InvalidSelectionValue="invalid-selection-value",e.InvalidSelectionSheet="invalid-selection-sheet",e.InternalError="internal-error",e.InvalidParameter="invalid-parameter",e.PDFCreationError="pdf-creation-error",e.PowerPointCreationError="powerpoint-creation-error",e.NotActiveSheet="not-active-sheet",e.ImplementationError="wrong-implementation",e.ApiExecutionError="api-execution-error",e.ServerError="server-error",e.Timeout="timeout"}(t.SharedErrorCodes||(t.SharedErrorCodes={}))})(R3);var UE=$e&&$e.__assign||function(){return UE=Object.assign||function(t){for(var e,n=1,a=arguments.length;n"u"&&fb!==void 0?function(t){return typeof t=="function"||t===fb}:function(t){return typeof t=="function"},W$=ks,Ud=function(t){return typeof t=="object"?t!==null:W$(t)},mb=Xa,G$=ks,H$=function(t){return G$(t)?t:void 0},H3=function(t,e){return arguments.length<2?H$(mb[t]):mb[t]&&mb[t][e]},q$=Cs,Z$=q$({}.isPrototypeOf),K$=typeof navigator<"u"&&String(navigator.userAgent)||"",q3=Xa,gb=K$,EP=q3.process,SP=q3.Deno,TP=EP&&EP.versions||SP&&SP.version,AP=TP&&TP.v8,$a,M_;AP&&($a=AP.split("."),M_=$a[0]>0&&$a[0]<4?1:+($a[0]+$a[1]));!M_&&gb&&($a=gb.match(/Edge\/(\d+)/),(!$a||$a[1]>=74)&&($a=gb.match(/Chrome\/(\d+)/),$a&&(M_=+$a[1])));var X$=M_,IP=X$,Y$=dl,Q$=Xa,J$=Q$.String,Z3=!!Object.getOwnPropertySymbols&&!Y$(function(){var t=Symbol("symbol detection");return!J$(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&IP&&IP<41}),eW=Z3,K3=eW&&!Symbol.sham&&typeof Symbol.iterator=="symbol",tW=H3,rW=ks,nW=Z$,iW=K3,oW=Object,X3=iW?function(t){return typeof t=="symbol"}:function(t){var e=tW("Symbol");return rW(e)&&nW(e.prototype,oW(t))},aW=String,sW=function(t){try{return aW(t)}catch{return"Object"}},lW=ks,cW=sW,uW=TypeError,hW=function(t){if(lW(t))return t;throw new uW(cW(t)+" is not a function")},dW=hW,pW=W3,fW=function(t,e){var n=t[e];return pW(n)?void 0:dW(n)},yb=uv,_b=ks,vb=Ud,mW=TypeError,gW=function(t,e){var n,a;if(e==="string"&&_b(n=t.toString)&&!vb(a=yb(n,t))||_b(n=t.valueOf)&&!vb(a=yb(n,t))||e!=="string"&&_b(n=t.toString)&&!vb(a=yb(n,t)))return a;throw new mW("Can't convert object to primitive value")},Y3={exports:{}},CP=Xa,yW=Object.defineProperty,vT=function(t,e){try{yW(CP,t,{value:e,configurable:!0,writable:!0})}catch{CP[t]=e}return e},_W=Xa,vW=vT,kP="__core-js_shared__",PP=Y3.exports=_W[kP]||vW(kP,{});(PP.versions||(PP.versions=[])).push({version:"3.37.1",mode:"global",copyright:"© 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.37.1/LICENSE",source:"https://github.com/zloirock/core-js"});var xT=Y3.exports,DP=xT,Q3=function(t,e){return DP[t]||(DP[t]=e||{})},xW=G3,bW=Object,J3=function(t){return bW(xW(t))},wW=Cs,EW=J3,SW=wW({}.hasOwnProperty),Bu=Object.hasOwn||function(e,n){return SW(EW(e),n)},TW=Cs,AW=0,IW=Math.random(),CW=TW(1 .toString),eO=function(t){return"Symbol("+(t===void 0?"":t)+")_"+CW(++AW+IW,36)},kW=Xa,PW=Q3,MP=Bu,DW=eO,MW=Z3,zW=K3,pd=kW.Symbol,xb=PW("wks"),RW=zW?pd.for||pd:pd&&pd.withoutSetter||DW,OW=function(t){return MP(xb,t)||(xb[t]=MW&&MP(pd,t)?pd[t]:RW("Symbol."+t)),xb[t]},FW=uv,zP=Ud,RP=X3,LW=fW,BW=gW,NW=OW,UW=TypeError,jW=NW("toPrimitive"),VW=function(t,e){if(!zP(t)||RP(t))return t;var n=LW(t,jW),a;if(n){if(e===void 0&&(e="default"),a=FW(n,t,e),!zP(a)||RP(a))return a;throw new UW("Can't convert object to primitive value")}return e===void 0&&(e="number"),BW(t,e)},$W=VW,WW=X3,tO=function(t){var e=$W(t,"string");return WW(e)?e:e+""},GW=Xa,OP=Ud,WE=GW.document,HW=OP(WE)&&OP(WE.createElement),qW=function(t){return HW?WE.createElement(t):{}},ZW=Ec,KW=dl,XW=qW,rO=!ZW&&!KW(function(){return Object.defineProperty(XW("div"),"a",{get:function(){return 7}}).a!==7}),YW=Ec,QW=uv,JW=yT,eG=N3,tG=_T,rG=tO,nG=Bu,iG=rO,FP=Object.getOwnPropertyDescriptor;gT.f=YW?FP:function(e,n){if(e=tG(e),n=rG(n),iG)try{return FP(e,n)}catch{}if(nG(e,n))return eG(!QW(JW.f,e,n),e[n])};var hv={},oG=Ec,aG=dl,sG=oG&&aG(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42}),lG=Ud,cG=String,uG=TypeError,nO=function(t){if(lG(t))return t;throw new uG(cG(t)+" is not an object")},hG=Ec,dG=rO,pG=sG,Xg=nO,LP=tO,fG=TypeError,bb=Object.defineProperty,mG=Object.getOwnPropertyDescriptor,wb="enumerable",Eb="configurable",Sb="writable";hv.f=hG?pG?function(e,n,a){if(Xg(e),n=LP(n),Xg(a),typeof e=="function"&&n==="prototype"&&"value"in a&&Sb in a&&!a[Sb]){var u=mG(e,n);u&&u[Sb]&&(e[n]=a.value,a={configurable:Eb in a?a[Eb]:u[Eb],enumerable:wb in a?a[wb]:u[wb],writable:!1})}return bb(e,n,a)}:bb:function(e,n,a){if(Xg(e),n=LP(n),Xg(a),dG)try{return bb(e,n,a)}catch{}if("get"in a||"set"in a)throw new fG("Accessors not supported");return"value"in a&&(e[n]=a.value),e};var gG=Ec,yG=hv,_G=N3,iO=gG?function(t,e,n){return yG.f(t,e,_G(1,n))}:function(t,e,n){return t[e]=n,t},oO={exports:{}},GE=Ec,vG=Bu,aO=Function.prototype,xG=GE&&Object.getOwnPropertyDescriptor,bT=vG(aO,"name"),bG=bT&&(function(){}).name==="something",wG=bT&&(!GE||GE&&xG(aO,"name").configurable),EG={EXISTS:bT,PROPER:bG,CONFIGURABLE:wG},SG=Cs,TG=ks,HE=xT,AG=SG(Function.toString);TG(HE.inspectSource)||(HE.inspectSource=function(t){return AG(t)});var IG=HE.inspectSource,CG=Xa,kG=ks,BP=CG.WeakMap,PG=kG(BP)&&/native code/.test(String(BP)),DG=Q3,MG=eO,NP=DG("keys"),zG=function(t){return NP[t]||(NP[t]=MG(t))},sO={},RG=PG,lO=Xa,OG=Ud,FG=iO,Tb=Bu,Ab=xT,LG=zG,BG=sO,UP="Object already initialized",qE=lO.TypeError,NG=lO.WeakMap,z_,zm,R_,UG=function(t){return R_(t)?zm(t):z_(t,{})},jG=function(t){return function(e){var n;if(!OG(e)||(n=zm(e)).type!==t)throw new qE("Incompatible receiver, "+t+" required");return n}};if(RG||Ab.state){var fs=Ab.state||(Ab.state=new NG);fs.get=fs.get,fs.has=fs.has,fs.set=fs.set,z_=function(t,e){if(fs.has(t))throw new qE(UP);return e.facade=t,fs.set(t,e),e},zm=function(t){return fs.get(t)||{}},R_=function(t){return fs.has(t)}}else{var jh=LG("state");BG[jh]=!0,z_=function(t,e){if(Tb(t,jh))throw new qE(UP);return e.facade=t,FG(t,jh,e),e},zm=function(t){return Tb(t,jh)?t[jh]:{}},R_=function(t){return Tb(t,jh)}}var VG={set:z_,get:zm,has:R_,enforce:UG,getterFor:jG},wT=Cs,$G=dl,WG=ks,Yg=Bu,ZE=Ec,GG=EG.CONFIGURABLE,HG=IG,cO=VG,qG=cO.enforce,ZG=cO.get,jP=String,Yy=Object.defineProperty,KG=wT("".slice),XG=wT("".replace),YG=wT([].join),QG=ZE&&!$G(function(){return Yy(function(){},"length",{value:8}).length!==8}),JG=String(String).split("String"),eH=oO.exports=function(t,e,n){KG(jP(e),0,7)==="Symbol("&&(e="["+XG(jP(e),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),n&&n.getter&&(e="get "+e),n&&n.setter&&(e="set "+e),(!Yg(t,"name")||GG&&t.name!==e)&&(ZE?Yy(t,"name",{value:e,configurable:!0}):t.name=e),QG&&n&&Yg(n,"arity")&&t.length!==n.arity&&Yy(t,"length",{value:n.arity});try{n&&Yg(n,"constructor")&&n.constructor?ZE&&Yy(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch{}var a=qG(t);return Yg(a,"source")||(a.source=YG(JG,typeof e=="string"?e:"")),t};Function.prototype.toString=eH(function(){return WG(this)&&ZG(this).source||HG(this)},"toString");var tH=oO.exports,rH=ks,nH=hv,iH=tH,oH=vT,aH=function(t,e,n,a){a||(a={});var u=a.enumerable,d=a.name!==void 0?a.name:e;if(rH(n)&&iH(n,d,a),a.global)u?t[e]=n:oH(e,n);else{try{a.unsafe?t[e]&&(u=!0):delete t[e]}catch{}u?t[e]=n:nH.f(t,e,{value:n,enumerable:!1,configurable:!a.nonConfigurable,writable:!a.nonWritable})}return t},uO={},sH=Math.ceil,lH=Math.floor,cH=Math.trunc||function(e){var n=+e;return(n>0?lH:sH)(n)},uH=cH,hO=function(t){var e=+t;return e!==e||e===0?0:uH(e)},hH=hO,dH=Math.max,pH=Math.min,fH=function(t,e){var n=hH(t);return n<0?dH(n+e,0):pH(n,e)},mH=hO,gH=Math.min,yH=function(t){var e=mH(t);return e>0?gH(e,9007199254740991):0},_H=yH,vH=function(t){return _H(t.length)},xH=_T,bH=fH,wH=vH,VP=function(t){return function(e,n,a){var u=xH(e),d=wH(u);if(d===0)return!t&&-1;var _=bH(a,d),l;if(t&&n!==n){for(;d>_;)if(l=u[_++],l!==l)return!0}else for(;d>_;_++)if((t||_ in u)&&u[_]===n)return t||_||0;return!t&&-1}},EH={includes:VP(!0),indexOf:VP(!1)},SH=Cs,Ib=Bu,TH=_T,AH=EH.indexOf,IH=sO,$P=SH([].push),dO=function(t,e){var n=TH(t),a=0,u=[],d;for(d in n)!Ib(IH,d)&&Ib(n,d)&&$P(u,d);for(;e.length>a;)Ib(n,d=e[a++])&&(~AH(u,d)||$P(u,d));return u},pO=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],CH=dO,kH=pO,PH=kH.concat("length","prototype");uO.f=Object.getOwnPropertyNames||function(e){return CH(e,PH)};var ET={};ET.f=Object.getOwnPropertySymbols;var DH=H3,MH=Cs,zH=uO,RH=ET,OH=nO,FH=MH([].concat),LH=DH("Reflect","ownKeys")||function(e){var n=zH.f(OH(e)),a=RH.f;return a?FH(n,a(e)):n},WP=Bu,BH=LH,NH=gT,UH=hv,jH=function(t,e,n){for(var a=BH(e),u=UH.f,d=NH.f,_=0;_d;)for(var w=xq(arguments[d++]),T=_?bq(Cb(w),_(w)):Cb(w),C=T.length,P=0,z;C>P;)z=T[P++],(!GP||mq(l,w,z))&&(a[z]=w[z]);return a}:Vh,Eq=ST,qP=wq;Eq({target:"Object",stat:!0,arity:2,forced:Object.assign!==qP},{assign:qP});var Sq=TT;Sq.Object.assign;const Tq=1,Aq=162,Iq=0,Cq={major:Tq,minor:Aq,fix:Iq};var AT={},IT={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.Desktop="desktop",e.Server="server",e.Unknown="unknown"}(t.ExtensionContext||(t.ExtensionContext={})),function(e){e.Authoring="authoring",e.Viewing="viewing",e.Unknown="unknown"}(t.ExtensionMode||(t.ExtensionMode={})),function(e){e.Mark="mark",e.Point="point",e.Area="area"}(t.AnnotateEnum||(t.AnnotateEnum={})),function(e){e.Discrete="discrete",e.Continuous="continuous",e.Unknown="unknown"}(t.ColumnType||(t.ColumnType={})),function(e){e.Blank="blank",e.Worksheet="worksheet",e.QuickFilter="quick-filter",e.ParameterControl="parameter-control",e.PageFilter="page-filter",e.Legend="legend",e.Title="title",e.Text="text",e.Image="image",e.WebPage="web-page",e.Extension="extension"}(t.DashboardObjectType||(t.DashboardObjectType={})),function(e){e.String="string",e.Int="int",e.Float="float",e.Bool="bool",e.Date="date",e.DateTime="date-time",e.Spatial="spatial",e.Unknown="unknown"}(t.DataType||(t.DataType={})),function(e){e.Window="window",e.Modal="modal",e.Modeless="modeless"}(t.DialogStyle||(t.DialogStyle={})),function(e){e.Number="number",e.String="string",e.Date="date",e.Boolean="boolean"}(t.EncodedDataType||(t.EncodedDataType={})),function(e){e.INITIALIZATION_ERROR="initialization-error",e.INTERNAL_ERROR="internal-error",e.MISSING_ENUM_MAPPING="missing-enum-mapping",e.MISSING_PARAMETER="missing-parameter",e.PERMISSION_DENIED="permission-denied",e.PRES_MODEL_PARSING_ERROR="pres-model-parsing-error",e.VERSION_NOT_CONFIGURED="version-not-configured",e.VISIBILITY_ERROR="visibility-error",e.UNKNOWN_VERB_ID="unknown-verb-id"}(t.ErrorCodes||(t.ErrorCodes={})),function(e){e.Sum="sum",e.Avg="avg",e.Min="min",e.Max="max",e.Stdev="stdev",e.Stdevp="stdevp",e.Var="var",e.Varp="varp",e.Collect="collect",e.Count="count",e.Countd="countd",e.Median="median",e.Attr="attr",e.None="none",e.Year="year",e.Qtr="qtr",e.Month="month",e.Day="day",e.Hour="hour",e.Minute="minute",e.Second="second",e.Week="week",e.Weekday="weekday",e.MonthYear="month-year",e.Mdy="mdy",e.End="end",e.TruncYear="trunc-year",e.TruncQtr="trunc-qtr",e.TruncMonth="trunc-month",e.TruncWeek="trunc-week",e.TruncDay="trunc-day",e.TruncHour="trunc-hour",e.TruncMinute="trunc-minute",e.TruncSecond="trunc-second",e.Quart1="quart1",e.Quart3="quart3",e.Skewness="skewness",e.Kurtosis="kurtosis",e.InOut="in-out",e.User="user"}(t.FieldAggregationType||(t.FieldAggregationType={})),function(e){e.Dimension="dimension",e.Measure="measure",e.Unknown="unknown"}(t.FieldRoleType||(t.FieldRoleType={})),function(e){e.Add="add",e.All="all",e.Replace="replace",e.Remove="remove"}(t.FilterUpdateType||(t.FilterUpdateType={})),function(e){e.Dashboard="dashboard",e.Story="story",e.Worksheet="worksheet"}(t.SheetType||(t.SheetType={})),function(e){e.All="all",e.List="list",e.Range="range"}(t.DomainRestrictionType||(t.DomainRestrictionType={})),function(e){e.Years="years",e.Quarters="quarters",e.Months="months",e.Weeks="weeks",e.Days="days",e.Hours="hours",e.Minutes="minutes",e.Seconds="seconds"}(t.DateStepPeriod||(t.DateStepPeriod={})),function(e){e.NullValues="nullvalues",e.NonNullValues="nonnullvalues",e.AllValues="allvalues"}(t.FilterNullOption||(t.FilterNullOption={})),function(e){e.Relevant="relevant",e.Database="database"}(t.FilterDomainType||(t.FilterDomainType={})),function(e){e.Replace="select-replace",e.Add="select-add",e.Remove="select-remove"}(t.SelectionUpdateType||(t.SelectionUpdateType={})),function(e){e.Simple="select-options-simple",e.Toggle="select-options-toggle",e.Menu="select-options-menu",e.Range="select-options-range",e.Search="select-options-search"}(t.SelectOptions||(t.SelectOptions={})),function(e){e.IncludeNull="include-null",e.IncludeNonNull="include-non-null",e.IncludeAll="include-all"}(t.QuantitativeIncludedValues||(t.QuantitativeIncludedValues={})),function(e){e.AllSelected="all-selected",e.NoneSelected="none-selected",e.SomeSelected="some-selected",e.UnknownSelected="unknown-selected"}(t.HierarchicalLevelSelectionState||(t.HierarchicalLevelSelectionState={})),function(e){e.Bar="bar",e.Line="line",e.Area="area",e.Square="square",e.Circle="circle",e.Shape="shape",e.Text="text",e.Map="map",e.Pie="pie",e.GanttBar="gantt-bar",e.Polygon="polygon",e.Heatmap="heatmap",e.VizExtension="viz-extension"}(t.MarkType||(t.MarkType={})),function(e){e.Categorical="categorical",e.Range="range",e.RelativeDate="relativeDate",e.Hierarchical="hierarchical"}(t.FilterType||(t.FilterType={})),function(e){e.Last="last",e.LastN="lastN",e.Next="next",e.NextN="nextN",e.Current="current",e.ToDate="toDate"}(t.DateRangeType||(t.DateRangeType={})),function(e){e.DialogAlreadyOpen="dialog-already-open",e.InvalidDomain="invalid-domain",e.Success="success"}(t.ExtensionDialogResult||(t.ExtensionDialogResult={})),function(e){e.SingleTableId="single-table-id-sentinel",e.SingleTableCaption="Single table id sentinel"}(t.ApiShowDataTableSentinel||(t.ApiShowDataTableSentinel={})),function(e){e.NativeValuesOnly="native-values-only",e.FormattedValuesOnly="formatted-values-only",e.NativeAndFormattedValues="native-and-formatted-values"}(t.ApiShowDataTableFormat||(t.ApiShowDataTableFormat={})),function(e){e.Letter="letter",e.Legal="legal",e.Note="note",e.Folio="folio",e.Tabloid="tabloid",e.Ledger="ledger",e.Statement="statement",e.Executive="executive",e.A3="a3",e.A4="a4",e.A5="a5",e.B4="b4",e.B5="b5",e.Quarto="quarto",e.Unspecified="unspecified"}(t.PageSizeOption||(t.PageSizeOption={})),function(e){e.Printer="printer",e.Portrait="portrait",e.Landscape="landscape"}(t.PageOrientation||(t.PageOrientation={})),function(e){e.ScaleAuto="auto",e.ScalePercentage="percent",e.ScaleFitPages="fit-pages"}(t.ScaleMode||(t.ScaleMode={})),function(e){e.ScalePctAuto="auto",e.ScalePct400="pct400",e.ScalePct200="pct200",e.ScalePct100="pct100",e.ScalePct90="pct90",e.ScalePct80="pct80",e.ScalePct75="pct75",e.ScalePct60="pct60",e.ScalePct50="pct50",e.ScalePct25="pct25"}(t.PageScalingOption||(t.PageScalingOption={})),function(e){e.FitOneHigh="fit0x1",e.FitTwoHigh="fit0x2",e.FitOneWide="fit1x0",e.FitTwoWide="fit2x0"}(t.FitPages||(t.FitPages={})),function(e){e.Color="color",e.Size="size",e.Label="label",e.Detail="detail",e.Tooltip="tooltip",e.Shape="shape",e.Path="path",e.Angle="angle",e.Geometry="geometry",e.Custom="custom"}(t.EncodingType||(t.EncodingType={}))})(IT);Object.defineProperty(AT,"__esModule",{value:!0});var ho=IT,kq=function(){function t(){}return t.isSpecial=function(e){return e.length>2&&e[0]==="%"&&e[e.length-1]==="%"},t.parseBoolean=function(e){var n=e.toLowerCase();return n!=="true"&&n!=="false"?this.specialValueIndicator:n==="true"},t.parseNumber=function(e){var n=Number(e);return isNaN(n)?this.specialValueIndicator:n},t.parseDate=function(e){var n=new Date(e);return Number.isNaN(n.getTime())?null:n},t.parseDateTime=function(e){var n=e.replace(" ","T").concat("Z"),a=new Date(n);return Number.isNaN(a.getTime())?null:a},t.convertValueAsStringToValue=function(e,n){if(e!=null){if(this.isSpecial(e))return e;switch(n){case ho.DataType.Bool:return this.parseBoolean(e);case ho.DataType.Int:case ho.DataType.Float:return this.parseNumber(e);case ho.DataType.Date:return this.parseDate(e)===null?this.specialValueIndicator:e;case ho.DataType.DateTime:return this.parseDateTime(e)===null?this.specialValueIndicator:e;case ho.DataType.Spatial:case ho.DataType.String:default:return e}}},t.convertValueToNativeValue=function(e,n){if(e==null)return null;switch(n){case ho.DataType.Bool:return typeof e=="string"?null:e;case ho.DataType.Int:case ho.DataType.Float:return typeof e=="string"?null:e;case ho.DataType.Date:return this.parseDate(e);case ho.DataType.DateTime:return this.parseDateTime(e);case ho.DataType.String:return this.isSpecial(e)?null:e;case ho.DataType.Spatial:default:return e}},t.convertStringValueToNativeValue=function(e,n){return this.convertValueToNativeValue(this.convertValueAsStringToValue(e,n),n)},t.specialValueIndicator="%null%",t}();AT.DataTypeConverter=kq;var dv={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.CustomMarkContextMenuClicked="custom-mark-context-menu-clicked",e.ContextMenuClick="context-menu-click",e.CustomViewRemoved="custom-view-removed",e.CustomViewSaved="custom-view-saved",e.CustomViewSetDefault="custom-view-set-default",e.CustomViewsLoaded="custom-views-loaded",e.DashboardLayoutChanged="dashboard-layout-changed",e.EditButtonClicked="edit-button-clicked",e.EditInDesktopButtonClicked="edit-in-desktop-button-clicked",e.ExtensionDialogUpdate="extension-dialog-update",e.FilterChanged="filter-changed",e.FirstVizSizeKnown="first-viz-size-known",e.ParameterChanged="parameter-changed",e.SelectedMarksChanged="selected-marks-changed",e.SettingsChanged="settings-changed",e.SummaryDataChanged="summary-data-changed",e.TestConversionNotification="test-conversion-notification",e.ToolbarStateChanged="toolbar-state-changed",e.VizInteractive="viz-interactive",e.AskDataInteractive="ask-data-interactive",e.WorkbookReadyToClose="workbook-ready-to-close",e.WorkbookFormattingChanged="workbook-formatting-changed",e.WorkbookPublished="workbook-published",e.WorkbookPublishedAs="workbook-published-as",e.UrlAction="url-action",e.TabSwitched="tab-switched",e.StoryPointSwitched="story-point-switched",e.ReadyToReceiveAuthToken="ready-to-receive-auth-token"}(t.NotificationId||(t.NotificationId={}))})(dv);var fO={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.ActiveTablesInfo="active-tables-info",e.AnchorDate="anchor-date",e.AnnotateEnum="annotate-enum",e.AnnotationList="annotation-list",e.CategoricalDomain="categorical-domain",e.ClickThroughEnabled="click-through-enabled",e.ColumnsToInclude="columns-to-include",e.ColumnsToIncludeById="columns-to-include-by-id",e.ConnectionDescriptionSummaries="connection-description-summaries",e.CurrentSheetType="current-sheet-type",e.CustomView="custom-view",e.CustomViewIsDefault="custom-view-is-default",e.CustomViewIsPublic="custom-view-is-public",e.CustomViewLuid="custom-view-luid",e.CustomViewName="custom-view-name",e.CustomViews="custom-views",e.Dashboard="dashboard",e.DashboardFilters="dashboard-filters",e.DashboardName="dashboard",e.DashboardObjectPositionAndSizeUpdate="dashboard-object-position-and-size-update",e.DashboardObjectPositionAndSizeUpdateList="dashboard-object-position-and-size-update-list",e.DataRowIndex="data-row-index",e.DataSchema="data-schema",e.DataSource="data-source",e.DataSourceDataTable="data-source-data-table",e.DataSourceId="data-source-id",e.DataSourceName="data-source-name",e.DataTable="data-table",e.DataTableReader="data-table-reader",e.DateRangeType="date-range-type",e.DeltaTimeMs="delta-time-ms",e.DimValSelectionModels="dimensionValueSelectionModels",e.DomainType="domain-type",e.EmbeddingAbstractQuery="embedding-abstract-query",e.EmbeddingBootstrapInfo="embedding-bootstrap-info",e.ExportCrosstabSheetMap="export-crosstab-sheet-map",e.ExportFile="export-file",e.ExportOriginUrl="export-origin-url",e.ExportPdfOptions="export-pdf-options",e.ExtensionBootstrapInfo="extension-bootstrap-info",e.ExtensionContextMenuIds="extension-context-menu-ids",e.ExtensionDialogH="extension-dialog-height",e.ExtensionDialogPayload="extension-dialog-payload",e.ExtensionDialogResult="extension-dialog-result",e.ExtensionDialogStyle="extension-dialog-style",e.ExtensionDialogUrl="extension-dialog-url",e.ExtensionDialogW="extension-dialog-width",e.ExtensionLocator="extension-locator",e.ExtensionSettingsInfo="extension-settings-info",e.ExtensionZoneId="extension-zone-id",e.ExternalMenuDescription="external-menu-description",e.ExternalMenuHeader="external-menu-header",e.ExternalMenuItemDisplayName="external-menu-item-display-name",e.ExternalMenuItemId="external-menu-item-id",e.Field="field",e.FieldId="field-id",e.FieldName="field-name",e.FilterLevels="filter-levels",e.FilterRangeMax="filter-range-max",e.FilterRangeMin="filter-range-min",e.FilterRangeNullOption="filter-range-null-option",e.FilterUpdateType="filter-update-type",e.FilterValues="filter-values",e.FontNameListItems="font-name-list-items",e.FormattedText="formatted-text",e.FunctionName="function-name",e.HierValSelectionModels="hierarchicalValueSelectionModels",e.HighlightedData="highlighted-data",e.HoverTupleInteraction="hover-tuple-interaction",e.IgnoreAliases="ignore-aliases",e.IgnoreSelection="ignore-selection",e.IncludeAllColumns="include-all-columns",e.InvalidAggFieldName="invalid-agg-field-name",e.InvalidDates="invalid-dates",e.InvalidFieldCaption="invalid-field-caption",e.InvalidFields="invalid-fields",e.InvalidValues="invalid-values",e.IsExcludeMode="is-exclude",e.IsExtensionDialog="is-extension-dialog",e.JoinDescription="join-description",e.LogicalTableId="logical-table-id",e.LogicalTableInfoList="logical-table-info-list",e.MaxHeight="max-height",e.MaxRows="max-rows",e.MaxWidth="max-width",e.MinHeight="min-height",e.MinWidth="min-width",e.PageRowCount="page-row-count",e.ParameterCaption="paremeter-caption",e.ParameterError="parameter-error",e.ParameterFieldName="parameter-field-name",e.ParameterInfo="parameter-info",e.ParameterInfos="parameter-infos",e.ParameterValue="parameter-value",e.PeriodType="period-type",e.QuantitativeDomain="quantitative-dmain",e.QuantRangeSelectionModels="quantativeRangeSelectionModels",e.RangeN="range-n",e.ReplaySpeed="replay-speed",e.SelectedData="selected-data",e.SelectedSheetNames="selected-sheet-names",e.Selection="selection",e.SelectionList="selection-list",e.SelectionUpdateType="selectionUpdateType",e.SelectTuplesInteraction="select-tuples-interaction",e.SendNotifications="send-notifications",e.SettingsValues="settings-values",e.SharedFilterSheets="shared-filter-sheets",e.SharedFiltersInfo="shared-filters-info",e.SheetIdentifier="sheet-identifier",e.SheetName="sheet-name",e.SheetPath="sheet-path",e.ShouldRefreshDS="should-refresh-ds",e.ShowDataTableFormat="show-data-table-format",e.State="state",e.StoryPointIndex="story-point-index",e.StoryPointInfo="story-point-info",e.SwitchToSheetName="switch-to-sheet-name",e.TargetPoint="target-point",e.TestConversionParameter="test-conversion-parameter",e.Text="formatted-text",e.TooltipContext="tooltip-context",e.TooltipTextRequest="tooltip-text-request",e.TooltipText="tooltip-text",e.UnderlyingDataTable="underlying-data-table",e.UnderlyingSummaryDataTable="underlying-summary-data-table",e.Url="url",e.UseTabDelimiters="use-tab-delimiters",e.ViewDataTableCacheId="view-data-table-cache-id",e.ViewDataTableId="view-data-table-id",e.VisualId="visual-id",e.VisualSpecification="visual-specification",e.VizAPIInputJson="vizapi-input-json",e.VizAPIStateWithDataModel="vizapi-state-with-data-model",e.VizAPIStateWarningMsg="vizapi-state-warning-msg",e.VizAPISVG="vizapi-svg",e.WorksheetName="worksheet-name",e.WorksheetFilters="worksheet-filters",e.ZoneIdsVisibilityMap="zone-ids-visibility-map"}(t.ParameterId||(t.ParameterId={}))})(fO);var mO={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.ActivateNextStoryPoint="activate-next-story-point",e.ActivatePreviousStoryPoint="activate-previous-story-point",e.ActivateSheet="activateSheet",e.ActivateStoryPoint="activate-story-point",e.AppendExternalMenuItem="append-external-menu-item",e.ApplyCategoricalFilter="categorical-filter",e.ApplyRangeFilter="range-filter",e.ApplyRelativeDateFilter="apply-relative-date-Filter",e.Authenticate="authenticate",e.BlockExtension="block-extension",e.ChangeParameterValue="change-parameter-value",e.ChangeSharedFilter="change-shared-filter",e.ClearFilter="clear-filter",e.ClearSelectedMarks="clear-selected-marks",e.CloseDialog="close-dialog",e.CreateAnnotation="create-annotation",e.DashboardCategoricalFilter="dashboard-categorical-filter",e.DisplayDialog="display-dialog",e.DownloadWorkbook="download-workbook",e.ExecuteExternalMenuItem="execute-external-menu-item",e.ExportCrosstab="export-crosstab",e.ExportCrosstabCsvDownload="export-crosstab-csv-download",e.ExportCrosstabExcelDownload="export-crosstab-excel-download",e.ExportData="export-data",e.ExportDataDownload="export-data-download",e.ExportImage="export-image",e.ExportPdf="export-pdf",e.ExportPdfDownload="export-pdf-download",e.ExportPowerpoint="export-powerpoint",e.ExportPowerpointDownload="export-powerpoint-download",e.FindParameter="find-parameter",e.GetActiveTables="get-active-tables",e.GetAllDataSources="get-all-data-sources",e.GetAnnotations="get-annotations",e.GetCategoricalDomain="get-categorical-domain",e.GetConnectionDescriptionSummaries="get-connection-description-summaries",e.GetCurrentSrc="get-current-src",e.GetCustomViews="get-custom-views",e.GetDashboardFilters="get-dashboard-filters",e.GetDataSource="get-datasource",e.GetDataSourceData="get-datasource-data",e.GetDataSources="get-data-sources",e.GetDataSummaryData="get-summary-data",e.GetDataSummaryDataReader="get-summary-data-reader",e.GetDataTableReaderPage="get-data-table-reader-page",e.GetEmbeddingAbstractQueryWithDataModel="get-embedding-abstract-query-with-data-model",e.GetEmbeddingClientInfo="get-embedding-client-info",e.GetVizStateWithDataModel="get-viz-state-with-data-model",e.GetExportCrosstabSheetMap="get-export-crosstab-sheet-map",e.GetExportPdfOptions="get-export-pdf-options",e.GetField="get-field",e.GetFieldAndDataSource="get-field-and-datasource",e.GetVisualSpecification="get-visual-specification",e.GetFilters="get-filters",e.GetFonts="get-fonts",e.GetHighlightedMarks="get-highlighted-marks",e.GetJoinDescription="get-join-description",e.GetLogicalTableData="get-logical-table-data",e.GetLogicalTableDataReader="get-logical-table-data-reader",e.GetLogicalTables="get-logical-tables",e.GetParametersForSheet="get-parameters-for-sheet",e.GetRangeDomain="get-range-domain",e.GetSelectedMarks="get-selected-marks",e.GetSharedFilter="get-shared-filter",e.GetTooltipText="get-tooltip-text",e.GetUnderlyingData="get-underlying-data",e.GetUnderlyingTableData="get-underlying-table-data",e.GetUnderlyingTableDataReader="get-underlying-table-data-reader",e.GetUnderlyingTables="get-underlying-tables",e.HierarchicalFilter="hierachical-filter",e.InitializeExtension="initialize-extension",e.MoveAndResizeZones="move-and-resize-zones",e.RaiseLeaveMarkNavNotification="raise-leave-mark-nav-notification",e.RaiseHoverTupleNotification="raise-hover-tuple-notification",e.RaiseSelectTuplesNotification="raise-select-tuples-notification",e.Redo="redo",e.RefreshDataSource="refresh-data-source",e.ReleaseDataTableReader="release-data-table-reader",e.RemoveAnnotation="remove-annotation",e.RemoveCustomView="remove-custom-view",e.RemoveExternalMenuItem="remove-external-menu-item",e.RenameExternalMenu="rename-external-menu",e.ReplayAnimation="replay-animation",e.RevertStoryPoint="revert-story-point",e.RevertWorkbook="revert-workbook",e.SaveExtensionSettings="save-extension-settings",e.SaveWorkbookAsCustomView="save-workbook-as-custom-view",e.SelectByValue="select-by-value",e.SetActiveCustomViewAsDefault="set-active-custom-view-as-default",e.SetAutoUpdate="set-auto-update",e.SetClickThrough="set-click-through",e.SetVizStateWithDataModel="set-viz-state-with-data-model",e.SetSheetSize="set-sheet-size",e.SetZoneVisibility="set-zone-visibility",e.Share="share",e.ShowCustomView="show-custom-view",e.TestConversionVerb="test-conversion-verb",e.Undo="undo",e.UpdateCustomView="update-custom-view",e.VizAPI="viz-api"}(t.VerbId||(t.VerbId={}))})(mO);var gO={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.token="token",e.origin="origin",e.showEmbed="showEmbed",e.showPin="showPin",e.showSave="showSave",e.showShare="showShare",e.debug=":jsdebug",e.ApiID=":apiID",e.ApiExternalVersion=":apiExternalVersion",e.ApiInternalVersion=":apiInternalVersion",e.AskDataWebComponent=":askDataWebComponent"}(t.AskDataOptionNames||(t.AskDataOptionNames={}))})(gO);var yO={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.embed="embed",e.token="token",e.disableExploreFilter="disableExploreFilter",e.layout="embed_layout",e.ApiExternalVersion=":apiExternalVersion",e.ApiInternalVersion=":apiInternalVersion",e.PulseWebComponent=":pulseWebComponent"}(t.PulseOptionNames||(t.PulseOptionNames={}))})(yO);var _O={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});var e;(function(a){a.ONE="1",a.ALERTS=":alerts",a.ALIAS="alias",a.ALLOW_DEFERRED_BOOTSTRAP=":allowDeferredBootstrap",a.ALLOW_AUTOGEN_WORKSHEET_PHONE_LAYOUTS="allowAutogenWorksheetPhoneLayouts",a.API_ID=":apiID",a.APP=":app",a.ATTACHMENT="attachment",a.IS_IPAD_APP="app",a.ANIMATE_TRANSITION=":animate_transition",a.ASCENDING="ascending",a.AUTHENTICATION="authentication",a.ATTRIBUTES="attributes",a.AUTHORING_SHEET=":authSheet",a.AXIS="axis",a.BOOTSTRAP_WHEN_NOTIFIED=":bootstrapWhenNotified",a.BROWSER_BACK_BUTTON_UNDO=":browserBackButtonUndo",a.BROWSER_RENDERING_ON="isBrowserRendering",a.BROWSER_RENDERING_THRESHOLD="browserRenderingThreshold",a.CHARSET="charset",a.CLIENT_DIMENSION="clientDimension",a.CLIENT_IP="client_ip",a.CLIENT_NUM="clientNum",a.COLON_EMBEDDED=":embedded",a.COLON_MOBILE=":mobile",a.COLON_DEEP_LINKING_DISABLED=":deepLinkingDisabled",a.COLON_WATERMARK=":watermark",a.COMMENTS=":comments",a.COMMENTING_ENABLED=":commentingEnabled",a.COMMENTING_MENTIONS_ENABLED=":commentingMentions",a.CONNECTION="connection",a.CREATED_BY_FEATURE="createdByFeature",a.CRYPTED_PASSWORD="crypted",a.CSSDEBUG=":cssdebug",a.CSV="csv",a.CUSTOM_VIEWS=":customViews",a.CV=":cv",a.CV_ID="cvId",a.DASHBOARD_PORT_SIZE="dashboardPortSize",a.DATA_DETAILS=":dataDetails",a.DATASOURCE="datasource",a.DEBUG=":debug",a.DELAY=":delay",a.DEPTH="depth",a.DEVICE_TYPE=":device",a.DEVICE_PIXEL_RATIO="devicePixelRatio",a.DEVICE_PREVIEW_MODE=":devicepreviewmode",a.DIMENSIONS=":dimensions",a.DISABLE_SHARED_SESSIONS=":disable_shared_sessions",a.DISABLE_URL_ACTIONS_POPUPS=":disableUrlActionsPopups",a.DIRECTION="direction",a.DISPLAY_OVERLAY=":display_overlay",a.DISPLAY_SHARE=":display_share",a.DISPLAY_SPINNER=":display_spinner",a.DISPLAY_STATIC_IMAGE=":display_static_image",a.DISPLAY_TABS="display_tabs",a.DISPLAY_VIEW_COUNT=":display_count",a.IGNORE_STICKY_SESSION=":ignore_sticky_session",a.INCREMENT_VIEW_COUNT=":increment_view_count",a.DOCMODE="docmode",a.DOMAIN="domain",a.DO_WORK="do_work",a.DX="dx",a.DY="dy",a.EDIT_DATA_ALERT=":editDataAlert",a.EMBED=":embed",a.EMBEDDED="embedded",a.ENCRYPTED="encrypted",a.API_EXTERNAL_VERSION=":apiExternalVersion",a.API_INTERNAL_VERSION=":apiInternalVersion",a.EXCLUDE="exclude",a.EXPORT_FORMAT=":export_format",a.FIELDNAME="fieldname",a.FIELD_NAME="field_name",a.FIELD_SEP="field_sep",a.FILE="file",a.FILTER_TILE_SIZE="filterTileSize",a.FN="fn",a.FOCUS="focus",a.FORCE_CACHE="force_cache",a.FORMAT="format",a.FORMAT_DATA_VALUE_LOCALLY="formatDataValueLocally",a.FROM_WG=":from_wg",a.GRAPHQL_DATABASE_ID=":graphQLDatabaseId",a.GRAPHQL_TABLE_ID=":graphQLTableId",a.GUID=":guid",a.H="h",a.HIDDEN="hidden",a.HIDE_CLOSE_BUTTON=":hideCloseButton",a.HIDE_EDIT_BUTTON=":hideEditButton",a.HIDE_EDIT_IN_DESKTOP_BUTTON=":hideEditInDesktopButton",a.HIGH_DPI=":highdpi",a.IMAGE_SIZE_LIMIT="imageSizeLimit",a.TRANSPARENT_LINE_MARKS_LIMIT="transparentLineMarkLimit",a.CLIENT_RENDER_PIXEL_LIMIT="clientRenderPixelLimit",a.IN="in",a.INSTANCE_ID=":iid",a.IS_GUEST_REDIRECT_FROM_VIZPORTAL=":isGuestRedirectFromVizportal",a.IS_MARK_ANIMATION_ENABLED="isMarkAnimationEnabled",a.IS_VIZPORTAL=":isVizPortal",a.INPUT_="input_string",a.JSDEBUG=":jsdebug",a.JSON="json",a.JSON_ONLY=":jsonOnly",a.KEEPFILE="keepfile",a.KEY="key",a.LANGUAGE="language",a.LANGUAGE_REQUESTED=":language",a.LINKTARGET=":linktarget",a.LOAD_ORDER_ID=":loadOrderID",a.LOAD_NEWEST_REVISION=":loadNewestRevision",a.LOCAL_PATHS=":localPaths",a.LOCALE="locale",a.LOCATION_ID="locationid",a.LOCATION_TYPE="locationtype",a.WORKBOOK_LOCALE="workbookLocale",a.MAXROWS="maxrows",a.MAX_AGE="maxAge",a.MAX_ROWS="maxRows",a.METHOD="method",a.MOBILE="mobile",a.MODIFIER="modifier",a.NAME="name",a.NAV_TYPE="navType",a.NAV_SRC="navSrc",a.NOATTACHMENT="no-attachment",a.NO_OVERWRITE="no_overwrite",a.OPEN_AUTHORING_IN_TOP_WINDOW=":openAuthoringInTopWindow",a.OPENID_HD=":openid_hd",a.OPENID_LOGIN_HINT=":openid_login_hint",a.OAUTHREQUEST="oauthrequest",a.OAUTH_CREDENTIAL_IDS="oauth_credential_ids",a.OFFLINE_MODE=":offlinemode",a.ORIGIN=":origin",a.OVERLAY=":overlay",a.P="p",a.PATH="path",a.PANE_RESOLVER_X="paneResolverX",a.PANE_RESOLVER_Y="paneResolverY",a.PARAM="param",a.PARENT_ID="parent_id",a.PASSWORD="password",a.PATTERN="pattern",a.PIXEL_RATIO=":pixelratio",a.PREFIX=":prefix",a.PREVIEW=":preview",a.PRIMARY_CONTENT_URL="primary_content_url",a.PROJECT="project",a.PROTOCOL="protocol",a.PSEUDO=":pseudo",a.QUERY="query",a.R="r",a.RANGE_TYPE="range_type",a.RECORD_SEP="record_sep",a.RECORD_CLIENT_PERFORMANCE=":record_client_performance",a.RECORD_PERFORMANCE=":record_performance",a.RECOVER_OLD_SESSION_ID=":recover_old_session_id",a.RECOVER_SESSION_STATE_TICKETS=":recover_session_state_tickets",a.REFRESH=":refresh",a.REFRESHUNMODIFIED=":refreshunmodified",a.REGION="region",a.RELOAD_ON_CUSTOM_VIEW_SAVE=":reloadOnCustomViewSave",a.RENDER=":render",a.RENDER_MAPS_CLIENT_SIDE="renderMapsClientSide",a.RETRY=":retry",a.REUSE="reuse",a.REUSE_FOREVER="reuse_forever",a.REVERT=":revert",a.SAVE_DB_PASSWORDS="save_db_passwords",a.SELECT_X="select_x",a.SELECT_Y="select_y",a.SESSION_FEATURE_PREFIX=":ff_",a.SESSION_FLAGS=":session_feature_flags",a.SHARE_BUTTON="share_button",a.SHEET_ID="sheet_id",a.SHARED="shared",a.SHOWALL="showall",a.SHOW_APP_BANNER=":showAppBanner",a.SHOW_ASK_DATA=":showAskData",a.SHOW_PARAMS="showParams",a.SHOW_SHARE_OPTIONS=":showShareOptions",a.SIZE=":size",a.SOURCE="source",a.STATE="state",a.STICKY_SESSION_KEY="stickySessionKey",a.SUBSCRIPTIONS=":subscriptions",a.SUMMARY="summary",a.SUPPRESS_DEFAULT_EDIT_BEHAVIOR=":suppressDefaultEditBehavior",a.SYNC_SESSION=":sync_session",a.SYNC_SESSION_STATE="sync_session_state",a.TABS=":tabs",a.TARGET="target",a.TARGET_SITE="target_site",a.TOOLBAR=":toolbar",a.TOOLTIP=":tooltip",a.TS="ts",a.UNDERLYING_TABLE_ID="underlying_table_id",a.UNDERLYING_TABLE_CAPTION="underlying_table_caption",a.UPDATE_TYPE="update_type",a.USE_GUEST=":useGuest",a.USE_INLINE_IMAGES="use_inline_images",a.USERAGENT="useragent",a.USERNAME="username",a.VALUE="value",a.VERBOSE_MODE="verboseMode",a.VIEW_ID="views_id",a.VIZ_SNAPSHOT_ID="viz_snapshot_id",a.VW=":vw",a.W="w",a.WORKSHEET_PORT_SIZE="worksheetPortSize",a.WATERMARK="watermark",a.WATERMARK_MARGIN=":watermark_margin",a.WB=":wb",a.WHICH="which",a.X="x",a.Y="y",a.ZID="zid",a.ZONE_ID="zone_id",a.KEYCHAIN_VERSION="keychain_version",a.DATASOURCE_ID="datasource_id",a.DATASOURCE_NAME="datasource_name",a.LENS_ID="lens_id",a.WIDTH="width",a.HEIGHT="height",a.LAYOUT_VIEWS="views",a.LAYOUT_MENUS="menus",a.LAYOUT_GEOMETRY="geometry",a.LAYOUT_PAGES="pages",a.LAYOUT_CACHEURL="cacheurl",a.LAYOUT_SHEET="sheet",a.LAYOUT_DEPTH="depth"})(e||(e={}));var n;(function(a){a.SHOW_VIZ_HOME=":showVizHome"})(n||(n={})),function(a){a.Size=":size",a.Embed=":embed",a.ApiInternalVersion=":apiInternalVersion",a.ApiExternalVersion=":apiExternalVersion",a.ShowVizHome=":showVizHome",a.Jsdebug=":jsdebug",a.BootstrapWhenNotified=":bootstrapWhenNotified",a.NavType="navType",a.NavSrc="navSrc",a.debug=":jsdebug",a.ApiID=":apiID",a.disableUrlActionsPopups=":disableUrlActionsPopups",a.hideTabs=":tabs",a.toolbar=":toolbar",a.device=":device",a.instanceIdToClone=":iid",a.touchOptimize="mobile",a.hideEditButton=":hideEditButton",a.hideEditInDesktopButton=":hideEditInDesktopButton",a.suppressDefaultEditBehavior=":suppressDefaultEditBehavior",a.hideCloseButton=":hideCloseButton"}(t.VizOptionNames||(t.VizOptionNames={}))})(_O);var Jg={},vO={exports:{}};(function(t){(function(){var e=new RegExp("^[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}$","i");function n(u){for(var d="",_=0;_this._platformMajorVersion)throw new Error("Cannot convert between external version "+this._externalMajorVersion+" and "+this._platformMajorVersion)}return t.fromData=function(e,n,a,u,d){return new this(e.major,n.major,a,u,d)},t.prototype.upgradeExecuteCall=function(e,n){for(var a={verb:e,parameters:n},u=0,d=this._upgradeExecuteTranslations;uP.major?!1:C.majorV)throw new Error(`External version must be less than or equal to platform version. + externalMajorVersion=`+j+" platformMajorVersion="+V);if(d(C,P))return new e.IdentityVersionConverter;var R=w(j,V,L,z),F=w(j,V,L,W),H=w(j,V,L,U);return F.reverse(),H.reverse(),n.StackingVersionConverter.fromData(C,P,R,F,H)}t.CreateVersionConverterWithTranslators=l;function w(C,P,z,W){for(var U=[],j=C;j<=P;j++)if(j in W)for(var L=j===C?z:0,V=T(Object.keys(W[j])),R=L;R<=V;R++)R in W[j]&&U.push.apply(U,W[j][R]);return U}function T(C){return C.map(function(P){return Number(P)}).reduce(function(P,z){return P>z?P:z})}t.GetMaximumMinorIndex=T})(kT);var mv={};Object.defineProperty(mv,"__esModule",{value:!0});var $q=function(){function t(){}return t.prototype.downgradeExecuteCall=function(e,n){return{verb:e,parameters:n}},t.prototype.upgradeExecuteReturn=function(e,n,a){return e},t.prototype.upgradeNotification=function(e){return e},t}();mv.ExternalIdentityVersionConverter=$q;var kb={},MT={};Object.defineProperty(MT,"__esModule",{value:!0});var Wq=function(){function t(e,n,a,u,d){if(this._externalVersion=e,this._platformVersion=n,this._downgradeExecuteCallTranslations=a,this._upgradeExecuteReturnTranslations=u,this._upgradeNotificationTranslations=d,this._externalVersion.major>this._platformVersion.major)throw new Error("Cannot convert between external version "+this._externalVersion.major+` + and `+this._platformVersion.major)}return t.prototype.downgradeExecuteCall=function(e,n){for(var a={verb:e,parameters:n},u=0,d=this._downgradeExecuteCallTranslations;u0&&zU)throw new Error(`External version must be less than or equal to platform version. + externalMajorVersion=`+W+" platformMajorVersion="+U);if(W0)return{behavior:_s.SheetSizeBehavior.Exactly,minSize:{width:n,height:a},maxSize:{width:n,height:a}};var _=n===0&&u===0;return{behavior:_s.SheetSizeBehavior.Range,minSize:{width:n,height:a},maxSize:{width:_?2147483647:u,height:d}}},t.createAutomaticSize=function(){var e=_s.SheetSizeBehavior.Automatic,n={width:0,height:0},a={width:0,height:0};return{behavior:e,minSize:n,maxSize:a}},t.getPublishedSheetInfoByName=function(e,n){var a=n.find(function(u){return u.name===e});return a},t.getSheetTypeEnum=function(e){var n;switch(e){case Pb.SheetType.Worksheet:{n=_s.SheetType.Worksheet;break}case Pb.SheetType.Dashboard:{n=_s.SheetType.Dashboard;break}case Pb.SheetType.Story:{n=_s.SheetType.Story;break}default:throw new sZ.TableauError(_s.SharedErrorCodes.ServerError,"Invalid SheetType")}return n},t.isValidSheetSize=function(e){return e.behavior!==void 0},t}();Wm.SheetUtils=lZ;Object.defineProperty($d,"__esModule",{value:!0});var un=Nt,sy=pa,xi=Mn,iD=$o(),qh=Vd(),oD=Wm,cZ=function(){function t(e,n){this._sheetInfoImpl=e,this._registryId=n}return Object.defineProperty(t.prototype,"name",{get:function(){return this._sheetInfoImpl.name},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"sheetType",{get:function(){return this._sheetInfoImpl.sheetType},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"sheetPath",{get:function(){return this._sheetInfoImpl.sheetPath},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){return this._sheetInfoImpl.sheetSize},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"hidden",{get:function(){if(this._sheetInfoImpl.isHidden!==void 0)return this._sheetInfoImpl.isHidden;throw new xi.TableauError(un.EmbeddingErrorCodes.ImplementationError,"isHidden not implemented")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"active",{get:function(){if(this._sheetInfoImpl.isActive!==void 0)return this._sheetInfoImpl.isActive;throw new xi.TableauError(un.EmbeddingErrorCodes.ImplementationError,"active not implemented")},set:function(e){this._sheetInfoImpl.isActive!==void 0&&(this._sheetInfoImpl.active=e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"index",{get:function(){if(this._sheetInfoImpl.index!==void 0)return this._sheetInfoImpl.index;throw new xi.TableauError(un.EmbeddingErrorCodes.ImplementationError,"index not implemented")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"url",{get:function(){if(this._sheetInfoImpl.url!==void 0)return this._sheetInfoImpl.url;throw new xi.TableauError(un.EmbeddingErrorCodes.ImplementationError,"url not implemented")},enumerable:!0,configurable:!0}),t.prototype.getSheetSize=function(){if(!oD.SheetUtils.isValidSheetSize(this.size))throw new xi.TableauError(un.EmbeddingErrorCodes.InternalError,"size is not of type SheetSize");return this.size},t.prototype.findParameterAsync=function(e){iD.ErrorHelpers.verifyParameter(e,"parameterName");var n=sy.ApiServiceRegistry.get(this._registryId).getService("parameters-service");return n.findParameterByNameAsync(e)},t.prototype.getParametersAsync=function(){var e=sy.ApiServiceRegistry.get(this._registryId).getService("parameters-service");return e.getParametersForSheetAsync(this.sheetPath)},t.prototype.changeSizeAsync=function(e){var n=this,a=new xi.TableauError(un.EmbeddingErrorCodes.InvalidSize,"Invalid sheet size parameter");if(!e||!e.behavior)throw a;var u=this.normalizeSheetSize(e),d=u.behavior===un.SheetSizeBehavior.Automatic;if(!d&&!u.minSize&&!u.maxSize)throw a;if(!d&&this.sheetType===un.SheetType.Worksheet)throw new xi.TableauError(un.EmbeddingErrorCodes.InvalidSizeBehaviorOnWorksheet,"Only SheetSizeBehavior.Automatic is allowed on Worksheets");if(d&&this.getSheetSize().behavior===u.behavior)return Promise.resolve(e);var _=this.processNewSize(u),l=sy.ApiServiceRegistry.get(this._registryId).getService("size-service");return l.changeSizeAsync(this.name,_).then(function(){var w=sy.ApiServiceRegistry.get(n._registryId).getService("client-info-service");return w.getClientInfoAsync().then(function(T){var C=T.publishedSheets.find(function(z){return z.name===n.name});if(!C)throw new xi.TableauError(un.SharedErrorCodes.InternalError,"Can't find sheet with name "+n.name);var P=oD.SheetUtils.getSheetSizeFromSizeConstraints(C.sizeConstraint);return n._sheetInfoImpl.sheetSize=P,P})})},t.prototype.normalizeSheetSize=function(e){var n=e.behavior;iD.ErrorHelpers.verifyEnumValue(n,un.SheetSizeBehavior,"SheetSizeBehavior");var a=t.parseDimensions(e.minSize),u=t.parseDimensions(e.maxSize);return{behavior:n,minSize:a,maxSize:u}},t.prototype.processNewSize=function(e){var n,a,u,d,_=e.behavior,l=e.minSize,w=e.maxSize,T=!qh.Param.isNullOrUndefined((n=l)===null||n===void 0?void 0:n.width),C=!qh.Param.isNullOrUndefined((a=l)===null||a===void 0?void 0:a.height),P=!qh.Param.isNullOrUndefined((u=w)===null||u===void 0?void 0:u.width),z=!qh.Param.isNullOrUndefined((d=w)===null||d===void 0?void 0:d.height),W=T&&C,U=P&&z;switch(_){case un.SheetSizeBehavior.Automatic:return{behavior:_};case un.SheetSizeBehavior.AtMost:{if(!w||!U)throw new xi.TableauError(un.EmbeddingErrorCodes.MissingMaxSize,"Missing maxSize for SheetSizeBehavior.AtMost");var j={width:w.width,height:w.height};if(j.width<0||j.height<0)throw new xi.TableauError(un.EmbeddingErrorCodes.InvalidSize,"Size value cannot be less than zero");return{behavior:_,maxSize:j}}case un.SheetSizeBehavior.AtLeast:{if(!l||!W)throw new xi.TableauError(un.EmbeddingErrorCodes.MissingMinSize,"Missing minSize for SheetSizeBehavior.AtLeast");var L={width:l.width,height:l.height};if(L.width<0||L.height<0)throw new xi.TableauError(un.EmbeddingErrorCodes.InvalidSize,"Size value cannot be less than zero");return{behavior:_,minSize:L}}case un.SheetSizeBehavior.Range:{if(!l||!w||!W||!U)throw new xi.TableauError(un.EmbeddingErrorCodes.MissingMinMaxSize,"Missing minSize or maxSize for SheetSizeBehavior.Range");var L={width:l.width,height:l.height},j={width:w.width,height:w.height};if(L.width<0||L.height<0||j.width<0||j.height<0||L.width>j.width||L.height>j.height)throw new xi.TableauError(un.EmbeddingErrorCodes.InvalidSize,"Missing minSize or maxSize for SheetSizeBehavior.Range");return{behavior:_,minSize:L,maxSize:j}}case un.SheetSizeBehavior.Exactly:{if(l&&w){if(W&&U){var L={width:l.width,height:l.height},j={width:w.width,height:w.height};if(L.width!==j.width||L.height!==j.height)throw new xi.TableauError(un.EmbeddingErrorCodes.InvalidSize,"Conflicting size values for SheetSizeBehavior.Exactly");return{behavior:_,minSize:L,maxSize:j}}if(W){var L={width:l.width,height:l.height};return{behavior:_,minSize:L,maxSize:L}}if(U){var j={width:w.width,height:w.height};return{behavior:_,minSize:j,maxSize:j}}}throw new xi.TableauError(un.EmbeddingErrorCodes.InvalidSize,"Invalid sheet size parameter")}default:throw new xi.TableauError(un.SharedErrorCodes.InternalError,"Unsupported sheet size behavior: "+_)}},t.parseDimensions=function(e){var n={width:void 0,height:void 0};if(!e)return n;var a=qh.Param.tryParseNumber(e.width),u=a.success,d=a.parsed,_=qh.Param.tryParseNumber(e.height),l=_.success,w=_.parsed;return u&&l?{width:d,height:w}:u?{width:d}:l?{height:w}:n},t}();$d.SheetImpl=cZ;var Gm={};Object.defineProperty(Gm,"__esModule",{value:!0});var uZ=Nt,hZ=function(){function t(e,n,a,u,d,_,l){this._name=e,this._sheetType=n,this._sheetSize=a,this._index=u,this._isActive=d,this._isHidden=_,this._url=l}return Object.defineProperty(t.prototype,"name",{get:function(){return this._name},set:function(e){this._name=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"sheetSize",{get:function(){return this._sheetSize},set:function(e){this._sheetSize=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"sheetType",{get:function(){return this._sheetType},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"sheetPath",{get:function(){return{sheetName:this.name,isDashboard:this.sheetType===uZ.SheetType.Dashboard}},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"index",{get:function(){return this._index},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isActive",{get:function(){return this._isActive},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"active",{set:function(e){this._isActive=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isHidden",{get:function(){return this._isHidden},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"url",{get:function(){return this._url},enumerable:!0,configurable:!0}),t}();Gm.SheetInfoImpl=hZ;var Hm={},bv={};Object.defineProperty(bv,"__esModule",{value:!0});var dZ=function(){function t(e){this._logicalTable=e}return Object.defineProperty(t.prototype,"id",{get:function(){return this._logicalTable.id},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"caption",{get:function(){return this._logicalTable.caption},enumerable:!0,configurable:!0}),t}();bv.LogicalTable=dZ;var RT={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.Summary="summary",e.Underlying="underlying"}(t.GetDataType||(t.GetDataType={}))})(RT);var qm={},OT={};Object.defineProperty(OT,"__esModule",{value:!0});var pZ=function(){function t(e){this._connectionInfo=e}return Object.defineProperty(t.prototype,"name",{get:function(){return this._connectionInfo.name},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"id",{get:function(){return this._connectionInfo.id},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"serverURI",{get:function(){return this._connectionInfo.serverURI},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"type",{get:function(){return this._connectionInfo.type},enumerable:!0,configurable:!0}),t}();OT.ConnectionSummary=pZ;var FT={};Object.defineProperty(FT,"__esModule",{value:!0});var fZ=function(){function t(e){this._tableInfo=e}return Object.defineProperty(t.prototype,"name",{get:function(){return this._tableInfo.name},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"id",{get:function(){return this._tableInfo.id},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"connectionId",{get:function(){return this._tableInfo.connectionId},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"customSQL",{get:function(){return this._tableInfo.customSQL},enumerable:!0,configurable:!0}),t}();FT.TableSummary=fZ;var wv={};Object.defineProperty(wv,"__esModule",{value:!0});var mZ=Nt,gZ=hr(),Db=fl,yZ=function(){function t(e,n){this._fieldInfo=e,this._parentDataSource=n}return Object.defineProperty(t.prototype,"name",{get:function(){return this._fieldInfo.name},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"id",{get:function(){return this._fieldInfo.id},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"description",{get:function(){return this._fieldInfo.description},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dataType",{get:function(){var e;return e=this._fieldInfo.dataType,e??mZ.DataType.Unknown},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"aggregation",{get:function(){return Db.InternalToExternalEnumMappings.fieldAggregationType.convert(this._fieldInfo.aggregation)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dataSource",{get:function(){if(!this._parentDataSource)throw new Error("Data source information is not available for this field. Please use getFieldAsync method to get field's data source information");return this._parentDataSource},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"role",{get:function(){return Db.InternalToExternalEnumMappings.fieldRoleType.convert(this._fieldInfo.role)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"columnType",{get:function(){var e=this._fieldInfo.columnType||gZ.ColumnType.Unknown;return Db.InternalToExternalEnumMappings.columnType.convert(e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isCalculatedField",{get:function(){return this._fieldInfo.isCalculatedField},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isCombinedField",{get:function(){return this._fieldInfo.isCombinedField},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isGenerated",{get:function(){return this._fieldInfo.isGenerated},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isGeospatial",{get:function(){return this._fieldInfo.isGeospatial},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isHidden",{get:function(){return this._fieldInfo.isHidden},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isPresentOnPublishedDatasource",{get:function(){return this._fieldInfo.isPresentOnPublishedDatasource},enumerable:!0,configurable:!0}),t}();wv.FieldImpl=yZ;Object.defineProperty(qm,"__esModule",{value:!0});var Mb=Nt,_Z=OT,aD=$m,vZ=bv,gu=pa,xZ=FT,bZ=$o(),sD=wv,wZ=function(){function t(e,n){var a=this;this._dataSourceInfo=e,this._registryId=n,this._fields=e.fields.map(function(u){var d=new sD.FieldImpl(u,a);return new aD.Field(d)})}return Object.defineProperty(t.prototype,"name",{get:function(){return this._dataSourceInfo.name},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"id",{get:function(){return this._dataSourceInfo.id},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"extractUpdateTime",{get:function(){return this._dataSourceInfo.extractUpdateTime},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"fields",{get:function(){return this._fields},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isExtract",{get:function(){return this._dataSourceInfo.isExtract},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isPublished",{get:function(){return this._dataSourceInfo.isPublished},enumerable:!0,configurable:!0}),t.prototype.publishedUrl=function(){return this._dataSourceInfo.publishedUrl},t.prototype.getMaxPageRowLimit=function(){return 1e4},t.prototype.refreshAsync=function(){var e=gu.ApiServiceRegistry.get(this._registryId).getService("data-source-service");return e.refreshAsync(this._dataSourceInfo.id)},t.prototype.getConnectionSummariesAsync=function(){var e=gu.ApiServiceRegistry.get(this._registryId).getService("data-source-service");return e.getConnectionSummariesAsync(this._dataSourceInfo.id).then(function(n){return n.map(function(a){return new _Z.ConnectionSummary(a)})})},t.prototype.getActiveTablesAsync=function(){var e=gu.ApiServiceRegistry.get(this._registryId).getService("data-source-service");return e.getActiveTablesAsync(this._dataSourceInfo.id).then(function(n){return n.map(function(a){return new xZ.TableSummary(a)})})},t.prototype.getUnderlyingDataAsync=function(e){var n=gu.ApiServiceRegistry.get(this._registryId).getService("get-data-service");return e=e||{},n.getDataSourceDataAsync(this.id,!!e.ignoreAliases,e.maxRows||0,e.columnsToInclude||[],e.columnsToIncludeById||[],e.includeDataValuesOption||Mb.IncludeDataValuesOption.AllValues)},t.prototype.getLogicalTableDataAsync=function(e,n){var a=gu.ApiServiceRegistry.get(this._registryId).getService("get-data-service");return n=n||{},a.getLogicalTableDataAsync(this.id,e,!!n.ignoreAliases,n.maxRows||0,n.columnsToInclude||[],n.columnsToIncludeById||[],n.includeDataValuesOption||Mb.IncludeDataValuesOption.AllValues)},t.prototype.getLogicalTableDataReaderAsync=function(e,n,a){var u=gu.ApiServiceRegistry.get(this._registryId).getService("get-data-service");return a=a||{},u.getLogicalTableDataReaderAsync(this.id,e,n||this.getMaxPageRowLimit(),!!a.ignoreAliases,a.columnsToIncludeById||[],a.includeDataValuesOption||Mb.IncludeDataValuesOption.AllValues)},t.prototype.initializeWithPublicInterfaces=function(e){bZ.ErrorHelpers.verifyInternalValue(e,"dataSource"),this._fields=this._dataSourceInfo.fields.map(function(n){var a=new sD.FieldImpl(n,e);return new aD.Field(a)})},t.prototype.getLogicalTablesAsync=function(){var e=gu.ApiServiceRegistry.get(this._registryId).getService("data-source-service");return e.getLogicalTablesAsync(this.id).then(function(n){return n.map(function(a){return new vZ.LogicalTable(a)})})},t}();qm.DataSourceImpl=wZ;var EZ=$e&&$e.__extends||function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,u){a.__proto__=u}||function(a,u){for(var d in u)u.hasOwnProperty(d)&&(a[d]=u[d])},t(e,n)};return function(e,n){t(e,n);function a(){this.constructor=e}e.prototype=n===null?Object.create(n):(a.prototype=n.prototype,new a)}}();Object.defineProperty(Hm,"__esModule",{value:!0});var Zh=Nt,oa=Nt,SZ=Vm,TZ=bv,lD=RT,Gr=pa,Kh=Mn,ri=$o(),AZ=qm,IZ=$d,CZ=function(t){EZ(e,t);function e(n,a,u,d,_){var l=t.call(this,n,a)||this;return l._visualId=u,l._parentDashboardImpl=d,l._parentStoryPointImpl=_,l}return Object.defineProperty(e.prototype,"parentDashboard",{get:function(){return this._parentDashboardImpl},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"parentStoryPoint",{get:function(){return this._parentStoryPointImpl},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"visualId",{get:function(){return this._visualId},enumerable:!0,configurable:!0}),e.prototype.getMaxPageRowLimit=function(){return 1e4},e.prototype.applyFilterAsync=function(n,a,u,d){ri.ErrorHelpers.verifyEnumValue(u,Zh.FilterUpdateType,"Contract.FilterUpdateType"),this.verifyActiveSheet();var _=Gr.ApiServiceRegistry.get(this._registryId).getService("filter-service");return _.applyFilterAsync(this.visualId,n,a,u,d)},e.prototype.applyRangeFilterAsync=function(n,a){ri.ErrorHelpers.verifyParameter(n,"fieldName"),ri.ErrorHelpers.verifyParameter(a,"filterOptions"),a.nullOption?ri.ErrorHelpers.verifyEnumValue(a.nullOption,oa.FilterNullOption,"FilterNullOption"):ri.ErrorHelpers.verifyRangeParamType(a.min,a.max),this.verifyActiveSheet();var u=Gr.ApiServiceRegistry.get(this._registryId).getService("filter-service");return u.applyRangeFilterAsync(this.visualId,n,a)},e.prototype.applyHierarchicalFilterAsync=function(n,a,u,d){if(ri.ErrorHelpers.verifyParameter(n,"fieldName"),ri.ErrorHelpers.verifyParameter(a,"values"),ri.ErrorHelpers.verifyEnumValue(u,Zh.FilterUpdateType,"Contract.FilterUpdateType"),!Array.isArray(a)&&!a.levels)throw new Kh.TableauError(oa.ErrorCodes.InvalidParameter,"values parameter for applyHierarchicalFilterAsync must be an array or contain a levels key");this.verifyActiveSheet();var _=Gr.ApiServiceRegistry.get(this._registryId).getService("filter-service");return _.applyHierarchicalFilterAsync(this.visualId,n,a,u,d)},e.prototype.clearFilterAsync=function(n){ri.ErrorHelpers.verifyParameter(n,"fieldName"),this.verifyActiveSheet();var a=Gr.ApiServiceRegistry.get(this._registryId).getService("filter-service");return a.clearFilterAsync(this.visualId,n)},e.prototype.applyRelativeDateFilterAsync=function(n,a){ri.ErrorHelpers.verifyStringParameter(n,"fieldName"),ri.ErrorHelpers.verifyParameter(a,"options"),ri.ErrorHelpers.verifyEnumValue(a.periodType,oa.PeriodType,"PeriodType"),ri.ErrorHelpers.verifyEnumValue(a.rangeType,oa.DateRangeType,"DateRangeType"),this.verifyActiveSheet();var u=Gr.ApiServiceRegistry.get(this._registryId).getService("filter-service");return u.applyRelativeDateFilterAsync(this.visualId,n,a)},e.prototype.getDataSourcesAsync=function(){var n=this;this.verifyActiveSheet();var a=Gr.ApiServiceRegistry.get(this._registryId).getService("data-source-service");return a.getDataSourcesAsync(this.visualId).then(function(u){var d=u,_=d.worksheetDataSchemaMap[n.name],l=[],w=_.primaryDataSource;l.push(n.createDataSourceFromInfo(d.dataSources[w]));for(var T=0,C=_.referencedDataSourceList;Tthis._handlers.length},t.prototype.triggerEvent=function(e){for(var n=0,a=this._handlers;n=this._storyPointInfoImpls.length)throw new Bb.TableauError(Lb.EmbeddingErrorCodes.IndexOutOfRange,"The index passed to this command is out of range.");if(n===this._activeStoryPointImpl.index)return Promise.resolve(this._activeStoryPointImpl);var a=this._deferred.getNewPromiseOrThrowIfBusy(),u=uy.ApiServiceRegistry.get(this._registryId).getService("story-activation-service");return u.activateStoryPointAsync(n),a},e.prototype.revertStoryPointAsync=function(n){var a=this;if(hy.ErrorHelpers.verifyParameter(n,"index"),hy.ErrorHelpers.verifyParameterType(n,"number","index"),n<0||n>=this._storyPointInfoImpls.length)throw new Bb.TableauError(Lb.EmbeddingErrorCodes.IndexOutOfRange,"The index passed to this command is out of range.");var u=uy.ApiServiceRegistry.get(this._registryId).getService("story-activation-service");return u.revertStoryPointAsync(n).then(function(d){a.updateStoryInfo(d.index,d);var _=new yD.StoryPointInfoImpl(d.caption,d.index,d.storyPointId,!1,d.updated,a);return _})},e.prototype.clearPendingPromises=function(){this._deferred&&this._deferred.reject("All pending promises cleared")},e}(iK.SheetImpl);BT.StoryImpl=oK;var UT={};Object.defineProperty(UT,"__esModule",{value:!0});var aK=function(){function t(){}return t}();UT.WorkbookImpl=aK;var dy={},jT={},VT={};Object.defineProperty(VT,"__esModule",{value:!0});var sK=function(){function t(e,n){this.visualIdPresModel=e,this.tupleId=n}return t}();VT.TooltipTextRequestModel=sK;var ai={};Object.defineProperty(ai,"__esModule",{value:!0});var lK=fl,cK=Mn,uK=yv,hK=function(){function t(e,n){this._dispatcher=e,this._registryId=n}return t.prototype.execute=function(e,n){return this._dispatcher.execute(e,n).catch(function(a){var u=a,d=lK.InternalToExternalEnumMappings.errorCode.convert(u.errorCode,uK.ShouldThrow.No);throw new cK.TableauError(d,u.message)})},t}();ai.ServiceImplBase=hK;var dK=$e&&$e.__extends||function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,u){a.__proto__=u}||function(a,u){for(var d in u)u.hasOwnProperty(d)&&(a[d]=u[d])},t(e,n)};return function(e,n){t(e,n);function a(){this.constructor=e}e.prototype=n===null?Object.create(n):(a.prototype=n.prototype,new a)}}();Object.defineProperty(jT,"__esModule",{value:!0});var Xh=hr(),pK=VT,fK=ai,mK=function(t){dK(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return Object.defineProperty(e.prototype,"serviceName",{get:function(){return"accessibility"},enumerable:!0,configurable:!0}),e.prototype.getTooltipTextAsync=function(n,a){var u,d=new pK.TooltipTextRequestModel(n,a),_=(u={},u[Xh.ParameterId.FunctionName]="getTooltipTextAsync",u[Xh.ParameterId.TooltipTextRequest]=d,u);return this.execute(Xh.VerbId.GetTooltipText,_).then(function(l){return l.result})},e.prototype.leaveMarkNavigationAsync=function(n){var a,u=(a={},a[Xh.ParameterId.FunctionName]="leaveMarkNavigationAsync",a[Xh.ParameterId.VisualId]=n,a);return this.execute(Xh.VerbId.RaiseLeaveMarkNavNotification,u).then(function(d){})},e}(fK.ServiceImplBase);jT.AccessibilityServiceImpl=mK;var $T={},gK=$e&&$e.__extends||function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,u){a.__proto__=u}||function(a,u){for(var d in u)u.hasOwnProperty(d)&&(a[d]=u[d])},t(e,n)};return function(e,n){t(e,n);function a(){this.constructor=e}e.prototype=n===null?Object.create(n):(a.prototype=n.prototype,new a)}}();Object.defineProperty($T,"__esModule",{value:!0});var yK=Nt,Nb=hr(),_K=Sc,vK=$o(),xK=ai,bK=function(t){gK(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return Object.defineProperty(e.prototype,"serviceName",{get:function(){return"animation-service"},enumerable:!0,configurable:!0}),e.prototype.replayAsync=function(n){var a,u=(a={},a[Nb.ParameterId.ReplaySpeed]=1,a);return vK.ErrorHelpers.verifyEnumValue(n,yK.ReplaySpeedType,"ReplaySpeedType"),u[Nb.ParameterId.ReplaySpeed]=_K.ExternalToInternalEnumMappings.setReplaySpeedType.convert(n),this.execute(Nb.VerbId.ReplayAnimation,u).then(function(d){})},e}(xK.ServiceImplBase);$T.AnimationServiceImpl=bK;var WT={},fa={},Av=$e&&$e.__extends||function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,u){a.__proto__=u}||function(a,u){for(var d in u)u.hasOwnProperty(d)&&(a[d]=u[d])},t(e,n)};return function(e,n){t(e,n);function a(){this.constructor=e}e.prototype=n===null?Object.create(n):(a.prototype=n.prototype,new a)}}();Object.defineProperty(fa,"__esModule",{value:!0});var GT=function(){function t(){}return t}();fa.SelectionModel=GT;var HT=function(t){Av(e,t);function e(){var n=t!==null&&t.apply(this,arguments)||this;return n.selectValues=[],n}return e}(GT);fa.ValueSelectionModel=HT;var wK=function(t){Av(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(HT);fa.HierarchicalSelectionModel=wK;var EK=function(t){Av(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(GT);fa.RangeSelectionModel=EK;var SK=function(t){Av(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(HT);fa.DimensionSelectionModel=SK;var TK=function(){function t(){this.objectIds=[]}return t}();fa.TupleSelectionModel=TK;var AK=function(){function t(){this.hierModelArr=[],this.dimModelArr=[],this.quantModelArr=[]}return t}();fa.SelectionModelsContainer=AK;var IK=function(){function t(e,n,a,u){n===void 0&&(n=[]),this.visualIdPresModel=e,this.tupleIds=n,this.selectOptions=a,this.tooltipContext=u}return t}();fa.SelectTuplesInteractionModel=IK;var CK=function(){function t(e,n,a,u){this.visualIdPresModel=e,this.tupleId=n,this.tooltipContext=a,this.allowHoverActions=u}return t}();fa.HoverTupleInteractionModel=CK;var kK=$e&&$e.__extends||function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,u){a.__proto__=u}||function(a,u){for(var d in u)u.hasOwnProperty(d)&&(a[d]=u[d])},t(e,n)};return function(e,n){t(e,n);function a(){this.constructor=e}e.prototype=n===null?Object.create(n):(a.prototype=n.prototype,new a)}}();Object.defineProperty(WT,"__esModule",{value:!0});var _D=Nt,Yi=hr(),PK=fl,py=fa,vD=Mn,DK=ai,MK=function(t){kK(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return Object.defineProperty(e.prototype,"serviceName",{get:function(){return"annotation-service"},enumerable:!0,configurable:!0}),e.prototype.annotateMarkAsync=function(n,a,u){var d,_=this.parseMarkSelectionIds([a]),l={x:0,y:0},w=""+u+"",T=(d={},d[Yi.ParameterId.FunctionName]="annotateMarkAsync",d[Yi.ParameterId.VisualId]=n,d[Yi.ParameterId.AnnotateEnum]=Yi.AnnotateEnum.Mark,d[Yi.ParameterId.TargetPoint]=l,d[Yi.ParameterId.SelectionList]=[_.selection],d[Yi.ParameterId.FormattedText]=w,d);return this.execute(Yi.VerbId.CreateAnnotation,T).then(function(C){})},e.prototype.getAnnotationsAsync=function(n){var a,u=this,d=(a={},a[Yi.ParameterId.FunctionName]="getAnnotationsAsync",a[Yi.ParameterId.VisualId]=n,a);return this.execute(Yi.VerbId.GetAnnotations,d).then(function(_){var l=_.result;return u.annotationFilterMap(l)})},e.prototype.removeAnnotationAsync=function(n,a){var u,d=this.parseAnnotationSelectionIds([a]),_=(u={},u[Yi.ParameterId.FunctionName]="removeAnnotationAsync",u[Yi.ParameterId.VisualId]=n,u[Yi.ParameterId.SelectionList]=[d.selection],u);return this.execute(Yi.VerbId.RemoveAnnotation,_).then(function(l){})},e.prototype.parseMarkSelectionIds=function(n){var a=[],u=new py.SelectionModelsContainer;if(n.forEach(function(_){var l=_.tupleId;if(l!=null&&l>0)a.push(l.toString());else throw new vD.TableauError(_D.ErrorCodes.InternalError,"invalid tupleId")}),a.length!==0){var d=new py.TupleSelectionModel;d.selectionType="tuples",d.objectIds=a,u.selection=d}return u},e.prototype.parseAnnotationSelectionIds=function(n){var a=[],u=new py.SelectionModelsContainer;if(n.forEach(function(_){var l=_.annotationId;if(l!=null&&l>=0)a.push(l.toString());else throw new vD.TableauError(_D.ErrorCodes.InternalError,"invalid annotationId")}),a.length!==0){var d=new py.TupleSelectionModel;d.selectionType="annotations",d.objectIds=a,u.selection=d}return u},e.prototype.mapAnnotation=function(n){return{annotationHTML:n.annotationText,annotationId:n.annotationId,annotationText:n.annotationPlainText,annotationType:PK.InternalToExternalEnumMappings.annotationType.convert(n.annotateEnum),tupleId:n.tupleId}},e.prototype.annotationFilterMap=function(n){var a=this,u=n.map(function(d){return a.mapAnnotation(d)});return u},e}(DK.ServiceImplBase);WT.AnnotationServiceImpl=MK;var TO={};(function(t){var e=$e&&$e.__extends||function(){var W=function(U,j){return W=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(L,V){L.__proto__=V}||function(L,V){for(var R in V)V.hasOwnProperty(R)&&(L[R]=V[R])},W(U,j)};return function(U,j){W(U,j);function L(){this.constructor=U}U.prototype=j===null?Object.create(j):(L.prototype=j.prototype,new L)}}();Object.defineProperty(t,"__esModule",{value:!0});var n=Nt,a=hr(),u=hr(),d=Vm,_=$m,l=qm,w=wv,T=Mn,C=ai;t.SENTINEL_LOGICAL_TABLE_INFO={id:a.ApiShowDataTableSentinel.SingleTableId,caption:a.ApiShowDataTableSentinel.SingleTableCaption};var P={major:1,minor:20,fix:1},z=function(W){e(U,W);function U(j,L,V){V===void 0&&(V=P);var R=W.call(this,j,L)||this;return R._platformVersion=V,R}return Object.defineProperty(U.prototype,"serviceName",{get:function(){return"data-source-service"},enumerable:!0,configurable:!0}),U.prototype.refreshAsync=function(j){var L,V=(L={},L[u.ParameterId.FunctionName]="refreshAsync",L[u.ParameterId.DeltaTimeMs]=0,L[u.ParameterId.ShouldRefreshDS]=!0,L);return j&&(V[u.ParameterId.DataSourceId]=j),this.execute(u.VerbId.RefreshDataSource,V).then(function(R){})},U.prototype.getActiveTablesAsync=function(j){var L,V=(L={},L[u.ParameterId.FunctionName]="getActiveTablesAsync",L[u.ParameterId.DataSourceId]=j,L);return this.execute(u.VerbId.GetActiveTables,V).then(function(R){var F=R.result;if(F.tables.length===0)throw new T.TableauError(n.ErrorCodes.UnsupportedMethodForDataSourceType,"getActiveTables is not supported for: "+j);return F.tables})},U.prototype.getDataSourcesAsync=function(j){var L,V=(L={},L[u.ParameterId.FunctionName]="getDataSourcesAsync",L[u.ParameterId.VisualId]=j,L);return this.execute(u.VerbId.GetDataSources,V).then(function(R){var F=R.result;return F})},U.prototype.getAllDataSourcesAsync=function(){var j,L=(j={},j[u.ParameterId.FunctionName]="getAllDataSourcesAsync",j);return this.execute(u.VerbId.GetAllDataSources,L).then(function(V){var R=V.result;return R})},U.prototype.getConnectionSummariesAsync=function(j){var L,V=(L={},L[u.ParameterId.FunctionName]="getConnectionSummariesAsync",L[u.ParameterId.DataSourceId]=j,L);return this.execute(u.VerbId.GetConnectionDescriptionSummaries,V).then(function(R){var F=R.result;return F})},U.prototype.getFieldAsync=function(j){var L,V=this,R=u.VerbId.GetFieldAndDataSource,F=(L={},L[u.ParameterId.FunctionName]="getFieldAsync",L[u.ParameterId.FieldId]=j,L);return this.execute(R,F).then(function(H){var Q=H.result[u.ParameterId.DataSource],te=H.result[u.ParameterId.Field];return V.convertField(te,V.convertDataSource(Q))})},U.prototype.getLogicalTablesAsync=function(j){var L;if(!this.isObjectModelSupportedByPlatform())return new Promise(function(R){return R([t.SENTINEL_LOGICAL_TABLE_INFO])});var V=(L={},L[u.ParameterId.FunctionName]="getLogicalTablesAsync",L[u.ParameterId.DataSourceId]=j,L);return this.execute(u.VerbId.GetLogicalTables,V).then(function(R){return R.result})},U.prototype.getUnderlyingTablesAsync=function(j){var L;if(!this.isObjectModelSupportedByPlatform())return new Promise(function(R){return R([t.SENTINEL_LOGICAL_TABLE_INFO])});var V=(L={},L[u.ParameterId.FunctionName]="getUnderlyingTablesAsync",L[u.ParameterId.VisualId]=j,L);return this.execute(u.VerbId.GetUnderlyingTables,V).then(function(R){return R.result})},U.prototype.convertField=function(j,L){return new _.Field(new w.FieldImpl(j,L))},U.prototype.convertDataSource=function(j){return new d.DataSource(new l.DataSourceImpl(j,this._registryId))},U.prototype.isObjectModelSupportedByPlatform=function(){var j={major:1,minor:13,fix:0};return a.VersionLessThan(j,this._platformVersion)},U}(C.ServiceImplBase);t.DataSourceServiceImpl=z})(TO);var qT={},Iv={};Object.defineProperty(Iv,"__esModule",{value:!0});var Er=hr(),vr=Nt,Ub=Mn,zK=function(){function t(){}return t.updateInternalExportPDFOptions=function(e,n,a){e.currentSheet=a[0],this.updateExportLayoutOptions(e,n),this.updateSheetOptions(e,a)},t.updateExportLayoutOptions=function(e,n){var a=e.exportLayoutOptions;switch(a.imageHeight=this.DefaultLayoutOptions.imageHeight,a.imageWidth=this.DefaultLayoutOptions.imageWidth,n.orientation){case vr.PrintOrientation.Landscape:a.pageOrientationOption=Er.PageOrientation.Landscape;break;case vr.PrintOrientation.Portrait:a.pageOrientationOption=Er.PageOrientation.Portrait;break;default:throw new Ub.TableauError(vr.SharedErrorCodes.InternalError,"invalid orientation for ExportPDFOption")}switch(n.pageSize){case vr.PrintPageSize.A3:a.pageSizeOption=Er.PageSizeOption.A3;break;case vr.PrintPageSize.A4:a.pageSizeOption=Er.PageSizeOption.A4;break;case vr.PrintPageSize.A5:a.pageSizeOption=Er.PageSizeOption.A5;break;case vr.PrintPageSize.B4:a.pageSizeOption=Er.PageSizeOption.B4;break;case vr.PrintPageSize.B5:a.pageSizeOption=Er.PageSizeOption.B5;break;case vr.PrintPageSize.Executive:a.pageSizeOption=Er.PageSizeOption.Executive;break;case vr.PrintPageSize.Folio:a.pageSizeOption=Er.PageSizeOption.Folio;break;case vr.PrintPageSize.Ledger:a.pageSizeOption=Er.PageSizeOption.Ledger;break;case vr.PrintPageSize.Legal:a.pageSizeOption=Er.PageSizeOption.Legal;break;case vr.PrintPageSize.Letter:a.pageSizeOption=Er.PageSizeOption.Letter;break;case vr.PrintPageSize.Note:a.pageSizeOption=Er.PageSizeOption.Note;break;case vr.PrintPageSize.Quarto:a.pageSizeOption=Er.PageSizeOption.Quarto;break;case vr.PrintPageSize.Statement:a.pageSizeOption=Er.PageSizeOption.Statement;break;case vr.PrintPageSize.Tabloid:a.pageSizeOption=Er.PageSizeOption.Tabloid;break;case vr.PrintPageSize.Unspecified:a.pageSizeOption=Er.PageSizeOption.Unspecified;break;default:throw new Ub.TableauError(vr.SharedErrorCodes.InternalError,"invalid pageSize for ExportPDFOption")}switch(n.scaling){case vr.PrintScaling.AtMost1PageHigh:this.setFitAndScaleValues(a,Er.FitPages.FitOneHigh);break;case vr.PrintScaling.AtMost1PageWide:this.setFitAndScaleValues(a,Er.FitPages.FitOneWide);break;case vr.PrintScaling.AtMost2PagesHigh:this.setFitAndScaleValues(a,Er.FitPages.FitTwoHigh);break;case vr.PrintScaling.AtMost2PagesWide:this.setFitAndScaleValues(a,Er.FitPages.FitTwoWide);break;case vr.PrintScaling.Automatic:this.setFitAndScaleValues(a,Er.PageScalingOption.ScalePctAuto);break;case vr.PrintScaling.Perc100:this.setFitAndScaleValues(a,Er.PageScalingOption.ScalePct100);break;case vr.PrintScaling.Perc200:this.setFitAndScaleValues(a,Er.PageScalingOption.ScalePct200);break;case vr.PrintScaling.Perc25:this.setFitAndScaleValues(a,Er.PageScalingOption.ScalePct25);break;case vr.PrintScaling.Perc400:this.setFitAndScaleValues(a,Er.PageScalingOption.ScalePct400);break;case vr.PrintScaling.Perc50:this.setFitAndScaleValues(a,Er.PageScalingOption.ScalePct50);break;case vr.PrintScaling.Perc60:this.setFitAndScaleValues(a,Er.PageScalingOption.ScalePct60);break;case vr.PrintScaling.Perc75:this.setFitAndScaleValues(a,Er.PageScalingOption.ScalePct75);break;case vr.PrintScaling.Perc80:this.setFitAndScaleValues(a,Er.PageScalingOption.ScalePct80);break;case vr.PrintScaling.Perc90:this.setFitAndScaleValues(a,Er.PageScalingOption.ScalePct90);break;default:throw new Ub.TableauError(vr.SharedErrorCodes.InternalError,"invalid scaling for ExportPDFOption")}},t.updateSheetOptions=function(e,n){for(var a=e.exportLayoutOptions,u=e.sheetOptions,d=0,_=u;d<_.length;d++){var l=_[d];l.exportLayoutOptions=a,l.isSelected=n.includes(l.sheet)}},t.setFitAndScaleValues=function(e,n){var a,u=this.DefaultLayoutOptions,d=u.pageFitHorizontal,_=u.pageFitVertical,l=u.pageScaleMode,w=u.pageScalePercent,T=this.fitRegex.exec(n),C=this.pctRegex.exec(n);T?(a=T.slice(1).map(function(P){return Number(P)}),d=a[0],_=a[1],l=Er.ScaleMode.ScaleFitPages):C&&(w=C.slice(1).map(function(P){return Number(P)})[0],l=Er.ScaleMode.ScalePercentage),e.pageFitHorizontal=d,e.pageFitVertical=_,e.pageScaleMode=l,e.pageScalePercent=w},t.DefaultDataOptions={ignoreAliases:!1,columnsToIncludeById:[]},t.DefaultPDFOptions={scaling:vr.PrintScaling.Automatic,pageSize:vr.PrintPageSize.Letter,orientation:vr.PrintOrientation.Portrait},t.DefaultLayoutOptions={imageHeight:0,imageWidth:0,pageFitHorizontal:1,pageFitVertical:1,pageOrientationOption:Er.PageOrientation.Portrait,pageScaleMode:Er.ScaleMode.ScaleAuto,pageScalePercent:100,pageSizeOption:Er.PageSizeOption.Letter},t.fitRegex=new RegExp("fit([0-9]+)x([0-9]+)"),t.pctRegex=new RegExp("pct([0-9]+)"),t}();Iv.ExportHelpers=zK;var RK=$e&&$e.__extends||function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,u){a.__proto__=u}||function(a,u){for(var d in u)u.hasOwnProperty(d)&&(a[d]=u[d])},t(e,n)};return function(e,n){t(e,n);function a(){this.constructor=e}e.prototype=n===null?Object.create(n):(a.prototype=n.prototype,new a)}}(),xD=$e&&$e.__awaiter||function(t,e,n,a){function u(d){return d instanceof n?d:new n(function(_){_(d)})}return new(n||(n=Promise))(function(d,_){function l(C){try{T(a.next(C))}catch(P){_(P)}}function w(C){try{T(a.throw(C))}catch(P){_(P)}}function T(C){C.done?d(C.value):u(C.value).then(l,w)}T((a=a.apply(t,e||[])).next())})},bD=$e&&$e.__generator||function(t,e){var n={label:0,sent:function(){if(d[0]&1)throw d[1];return d[1]},trys:[],ops:[]},a,u,d,_;return _={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(_[Symbol.iterator]=function(){return this}),_;function l(T){return function(C){return w([T,C])}}function w(T){if(a)throw new TypeError("Generator is already executing.");for(;n;)try{if(a=1,u&&(d=T[0]&2?u.return:T[0]?u.throw||((d=u.return)&&d.call(u),0):u.next)&&!(d=d.call(u,T[1])).done)return d;switch(u=0,d&&(T=[T[0]&2,d.value]),T[0]){case 0:case 1:d=T;break;case 4:return n.label++,{value:T[1],done:!1};case 5:n.label++,u=T[1],T=[0];continue;case 7:T=n.ops.pop(),n.trys.pop();continue;default:if(d=n.trys,!(d=d.length>0&&d[d.length-1])&&(T[0]===6||T[0]===2)){n=0;continue}if(T[0]===3&&(!d||T[1]>d[0]&&T[1]0&&F[F.length-1])&&(se[0]===6||se[0]===2)){L=0;continue}if(se[0]===3&&(!F||se[1]>F[0]&&se[1]0?se[d.ParameterId.FilterLevels]=ge:R.length>0?se[d.ParameterId.FilterValues]=R:se[d.ParameterId.FilterLevels]=[],se[d.ParameterId.FilterUpdateType]=l.ExternalToInternalEnumMappings.filterUpdateType.convert(F),se[d.ParameterId.IsExcludeMode]=H&&!!H.isExcludeMode,this.execute(te,se).then(function(xe){return V})},j.prototype.clearFilterAsync=function(L,V){var R,F=d.VerbId.ClearFilter,H=(R={},R[d.ParameterId.FunctionName]="clearFilterAsync",R);return H[d.ParameterId.VisualId]=L,H[d.ParameterId.FieldName]=V,this.execute(F,H).then(function(Q){return V})},j.prototype.applyRelativeDateFilterAsync=function(L,V,R){var F,H=d.VerbId.ApplyRelativeDateFilter,Q=(F={},F[d.ParameterId.FunctionName]="applyRelativeDateFilterAsync",F);if(Q[d.ParameterId.VisualId]=L,Q[d.ParameterId.FieldName]=V,Q[d.ParameterId.PeriodType]=l.ExternalToInternalEnumMappings.periodType.convert(R.periodType),Q[d.ParameterId.DateRangeType]=l.ExternalToInternalEnumMappings.dateRangeType.convert(R.rangeType),R.rangeType===a.DateRangeType.LastN||R.rangeType===a.DateRangeType.NextN){if(R.rangeN===void 0||R.rangeN===null)throw new _.TableauError(a.EmbeddingErrorCodes.MissingRangeNForRelativeDateFilters,"Missing rangeN field for a relative date filter of LASTN or NEXTN.");Q[d.ParameterId.RangeN]=R.rangeN}return R.anchorDate!==void 0&&R.anchorDate!==null&&(Q[d.ParameterId.AnchorDate]=this.convertAnchorDate(R.anchorDate)),this.execute(H,Q).then(function(te){return te.result})},j.prototype.getFiltersAsync=function(L){var V,R=this,F=d.VerbId.GetFilters,H=(V={},V[d.ParameterId.FunctionName]="getFiltersAsync",V);return H[d.ParameterId.VisualId]=L,this.execute(F,H).then(function(Q){var te=Q.result;return R.convertDomainFilters(te)})},j.prototype.getCategoricalDomainAsync=function(L,V,R){var F,H=this,Q=d.VerbId.GetCategoricalDomain,te=(F={},F[d.ParameterId.FunctionName]="getCategoricalDomainAsync",F);return te[d.ParameterId.VisualId]={worksheet:L},te[d.ParameterId.FieldId]=V,te[d.ParameterId.DomainType]=l.ExternalToInternalEnumMappings.filterDomainType.convert(R),this.execute(Q,te).then(function(se){var ge=se.result;return H.convertCategoricalDomain(ge,R)})},j.prototype.getRangeDomainAsync=function(L,V,R){var F,H=this,Q=d.VerbId.GetRangeDomain,te=(F={},F[d.ParameterId.FunctionName]="getRangeDomainAsync",F);return te[d.ParameterId.VisualId]={worksheet:L},te[d.ParameterId.FieldId]=V,te[d.ParameterId.DomainType]=l.ExternalToInternalEnumMappings.filterDomainType.convert(R),this.execute(Q,te).then(function(se){var ge=se.result;return H.convertRangeDomain(ge,R)})},j.prototype.getDashboardFiltersAsync=function(){var L,V=this,R=d.VerbId.GetDashboardFilters,F=(L={},L[d.ParameterId.FunctionName]="getDashboardFiltersAsync",L);return this.execute(R,F).then(function(H){var Q=H.result;return V.convertDomainFilters(Q)})},j.prototype.applyDashboardFilterAsync=function(L,V,R,F){var H,Q=d.VerbId.DashboardCategoricalFilter,te=(H={},H[d.ParameterId.FunctionName]="applyDashboardFilterAsync",H);return te[d.ParameterId.FieldName]=L,te[d.ParameterId.FilterValues]=V,te[d.ParameterId.FilterUpdateType]=l.ExternalToInternalEnumMappings.filterUpdateType.convert(R),te[d.ParameterId.IsExcludeMode]=F&&!!F.isExcludeMode,this.execute(Q,te).then(function(se){return se.result})},j.prototype.getAppliedWorksheetsAsync=function(L,V){var R;return e(this,void 0,void 0,function(){var F,H;return n(this,function(Q){switch(Q.label){case 0:return[4,this.executeGetAppliedWorksheets(L,V,"getAppliedWorksheetsAsync")];case 1:return F=Q.sent(),H=[],(R=F.worksheets)===null||R===void 0||R.map(function(te){te.isSelected&&H.push(te.worksheetName)}),[2,H]}})})},j.prototype.setAppliedWorksheetsAsync=function(L,V,R,F){return e(this,void 0,void 0,function(){var H,Q,te,se,ge;return n(this,function(xe){switch(xe.label){case 0:return[4,this.executeGetAppliedWorksheets(L,R,"getAppliedWorksheetsAsyncInternal")];case 1:if(H=xe.sent(),!H||!H.worksheets)throw new _.TableauError(a.SharedErrorCodes.InternalError,"This filter does not apply to multiple worksheets");if(Q=[],te="",H.worksheets.forEach(function(Ee){Ee.isActive&&(te=Ee.worksheetName),(Ee.isSelected||Ee.isEnabled)&&Q.push(Ee.worksheetName)}),te==="")throw new _.TableauError(a.SharedErrorCodes.InternalError,"No active worksheet");if(!F.includes(te))throw new _.TableauError(a.SharedErrorCodes.InternalError,te+" must be included in the applied worksheets");return F.forEach(function(Ee){if(!Q.includes(Ee))throw new _.TableauError(a.SharedErrorCodes.InternalError,"The field "+V+" isn't applicable to the worksheet "+Ee)}),se=d.VerbId.ChangeSharedFilter,ge={},ge[d.ParameterId.FunctionName]="setAppliedWorksheetsAsync",ge[d.ParameterId.VisualId]={worksheet:L},ge[d.ParameterId.FieldId]=R,ge[d.ParameterId.SharedFilterSheets]=F,[2,this.execute(se,ge).then(function(Ee){return F})]}})})},j.prototype.executeGetAppliedWorksheets=function(L,V,R){var F=d.VerbId.GetSharedFilter,H={};return H[d.ParameterId.FunctionName]=R,H[d.ParameterId.VisualId]={worksheet:L},H[d.ParameterId.FieldId]=V,this.execute(F,H).then(function(Q){var te=Q.result;return te})},j.prototype.convertDomainFilters=function(L){var V=this,R=[];return L.forEach(function(F){switch(F.filterType){case d.FilterType.Categorical:{var H=F;if(H)R.push(V.convertCategoricalFilter(H));else throw new Error("Invalid Categorical Filter");break}case d.FilterType.Hierarchical:{var H=F;if(H)R.push(V.convertHierarchicalFilter(H));else throw new Error("Invalid Hierarchical Filter");break}case d.FilterType.Range:{var H=F;if(H)R.push(V.convertRangeFilter(H));else throw new Error("Invalid Range Filter");break}case d.FilterType.RelativeDate:{var H=F;if(H)R.push(V.convertRelativeDateFilter(H));else throw new Error("Invalid Relative Date Filter");break}}}),R},j.prototype.convertCategoricalFilter=function(L){var V=L.values.map(function(R){return C.DataValueFactory.MakeFilterDataValue(R)});return new T.CategoricalFilter(L.visualId.worksheet,L.fieldCaption,L.fieldName,d.FilterType.Categorical,this._registryId,V,L.isExclude,L.isAllSelected)},j.prototype.convertHierarchicalFilter=function(L){var V=L.values.map(function(F){return new T.HierarchicalDataValue(C.DataValueFactory.MakeFilterDataValue(F.value),F.hierarchicalPath,F.level)}),R=L.levelInfo.map(function(F){return new T.HierarchicalLevelDetail(F.name,w.InternalToExternalEnumMappings.hierarchicalLevelSelectionState.convert(F.levelSelectionState))});return new T.HierarchicalFilter(L.visualId.worksheet,L.fieldCaption,L.fieldName,d.FilterType.Hierarchical,this._registryId,L.dimensionName,L.hierarchyCaption,L.levels,R,V,L.isAllSelected)},j.prototype.convertRangeFilter=function(L){var V=C.DataValueFactory.MakeFilterDataValue(L.min),R=C.DataValueFactory.MakeFilterDataValue(L.max);return new T.RangeFilter(L.visualId.worksheet,L.fieldCaption,L.fieldName,d.FilterType.Range,this._registryId,V,R,L.includeNullValues)},j.prototype.convertRelativeDateFilter=function(L){var V=C.DataValueFactory.MakeFilterDataValue(L.anchorDate);return new T.RelativeDateFilter(L.visualId.worksheet,L.fieldCaption,L.fieldName,a.FilterType.RelativeDate,this._registryId,V,w.InternalToExternalEnumMappings.dateStepPeriod.convert(L.periodType),w.InternalToExternalEnumMappings.dateRangeType.convert(L.rangeType),L.rangeN)},j.prototype.convertCategoricalDomain=function(L,V){var R=L.values.map(function(F){return C.DataValueFactory.MakeFilterDataValue(F)});return new T.CategoricalDomain(R,V)},j.prototype.convertRangeDomain=function(L,V){var R=C.DataValueFactory.MakeFilterDataValue(L.min),F=C.DataValueFactory.MakeFilterDataValue(L.max);return new T.RangeDomain(R,F,V)},j.prototype.convertAnchorDate=function(L){var V=L.getUTCFullYear(),R=L.getUTCMonth()+1,F=L.getUTCDate(),H=L.getUTCHours(),Q=L.getUTCMinutes(),te=L.getUTCSeconds();if(isNaN(V)||isNaN(R)||isNaN(F)||isNaN(H)||isNaN(Q)||isNaN(te))throw new _.TableauError(a.EmbeddingErrorCodes.InvalidDateParameter,"Invalid date parameter: anchorDate");var se=V+"-"+R+"-"+F+" "+H+":"+Q+":"+te;return se},j.prototype.apiFilterHandlerCheckForCommandError=function(L){if(L[u.ParameterId.ParameterError])throw L[u.ParameterId.InvalidFieldCaption]?new _.TableauError(a.SharedErrorCodes.InvalidFilterFieldName,L[u.ParameterId.InvalidFieldCaption]):L[u.ParameterId.InvalidValues]?new _.TableauError(a.SharedErrorCodes.InvalidFilterFieldValue,L[u.ParameterId.InvalidValues]):L[u.ParameterId.InvalidAggFieldName]?new _.TableauError(a.SharedErrorCodes.InvalidAggregationFieldName,L[u.ParameterId.InvalidAggFieldName]):new _.TableauError(a.SharedErrorCodes.ServerError,"Server Error")},j}(z.ServiceImplBase);return fy.FilterServiceImpl=W,fy}var my={},gy,YK=new Uint8Array(16);function AO(){if(!gy&&(gy=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!gy))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return gy(YK)}const QK=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function kv(t){return typeof t=="string"&&QK.test(t)}var wi=[];for(var jb=0;jb<256;++jb)wi.push((jb+256).toString(16).substr(1));function Pv(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=(wi[t[e+0]]+wi[t[e+1]]+wi[t[e+2]]+wi[t[e+3]]+"-"+wi[t[e+4]]+wi[t[e+5]]+"-"+wi[t[e+6]]+wi[t[e+7]]+"-"+wi[t[e+8]]+wi[t[e+9]]+"-"+wi[t[e+10]]+wi[t[e+11]]+wi[t[e+12]]+wi[t[e+13]]+wi[t[e+14]]+wi[t[e+15]]).toLowerCase();if(!kv(n))throw TypeError("Stringified UUID is invalid");return n}var ED,Vb,$b=0,Wb=0;function JK(t,e,n){var a=e&&n||0,u=e||new Array(16);t=t||{};var d=t.node||ED,_=t.clockseq!==void 0?t.clockseq:Vb;if(d==null||_==null){var l=t.random||(t.rng||AO)();d==null&&(d=ED=[l[0]|1,l[1],l[2],l[3],l[4],l[5]]),_==null&&(_=Vb=(l[6]<<8|l[7])&16383)}var w=t.msecs!==void 0?t.msecs:Date.now(),T=t.nsecs!==void 0?t.nsecs:Wb+1,C=w-$b+(T-Wb)/1e4;if(C<0&&t.clockseq===void 0&&(_=_+1&16383),(C<0||w>$b)&&t.nsecs===void 0&&(T=0),T>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");$b=w,Wb=T,Vb=_,w+=122192928e5;var P=((w&268435455)*1e4+T)%4294967296;u[a++]=P>>>24&255,u[a++]=P>>>16&255,u[a++]=P>>>8&255,u[a++]=P&255;var z=w/4294967296*1e4&268435455;u[a++]=z>>>8&255,u[a++]=z&255,u[a++]=z>>>24&15|16,u[a++]=z>>>16&255,u[a++]=_>>>8|128,u[a++]=_&255;for(var W=0;W<6;++W)u[a+W]=d[W];return e||Pv(u)}function IO(t){if(!kv(t))throw TypeError("Invalid UUID");var e,n=new Uint8Array(16);return n[0]=(e=parseInt(t.slice(0,8),16))>>>24,n[1]=e>>>16&255,n[2]=e>>>8&255,n[3]=e&255,n[4]=(e=parseInt(t.slice(9,13),16))>>>8,n[5]=e&255,n[6]=(e=parseInt(t.slice(14,18),16))>>>8,n[7]=e&255,n[8]=(e=parseInt(t.slice(19,23),16))>>>8,n[9]=e&255,n[10]=(e=parseInt(t.slice(24,36),16))/1099511627776&255,n[11]=e/4294967296&255,n[12]=e>>>24&255,n[13]=e>>>16&255,n[14]=e>>>8&255,n[15]=e&255,n}function eX(t){t=unescape(encodeURIComponent(t));for(var e=[],n=0;n>5]>>>u%32&255,_=parseInt(a.charAt(d>>>4&15)+a.charAt(d&15),16);e.push(_)}return e}function kO(t){return(t+64>>>9<<4)+14+1}function oX(t,e){t[e>>5]|=128<>5]|=(t[a/8]&255)<>16)+(e>>16)+(n>>16);return a<<16|n&65535}function sX(t,e){return t<>>32-e}function Dv(t,e,n,a,u,d){return ac(sX(ac(ac(e,t),ac(a,d)),u),n)}function Bi(t,e,n,a,u,d,_){return Dv(e&n|~e&a,t,e,u,d,_)}function Ni(t,e,n,a,u,d,_){return Dv(e&a|n&~a,t,e,u,d,_)}function Ui(t,e,n,a,u,d,_){return Dv(e^n^a,t,e,u,d,_)}function ji(t,e,n,a,u,d,_){return Dv(n^(e|~a),t,e,u,d,_)}var lX=CO("v3",48,nX);const cX=lX;function uX(t,e,n){t=t||{};var a=t.random||(t.rng||AO)();if(a[6]=a[6]&15|64,a[8]=a[8]&63|128,e){n=n||0;for(var u=0;u<16;++u)e[n+u]=a[u];return e}return Pv(a)}function hX(t,e,n,a){switch(t){case 0:return e&n^~e&a;case 1:return e^n^a;case 2:return e&n^e&a^n&a;case 3:return e^n^a}}function Gb(t,e){return t<>>32-e}function dX(t){var e=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof t=="string"){var a=unescape(encodeURIComponent(t));t=[];for(var u=0;u>>0;F=R,R=V,V=Gb(L,30)>>>0,L=j,j=te}n[0]=n[0]+j>>>0,n[1]=n[1]+L>>>0,n[2]=n[2]+V>>>0,n[3]=n[3]+R>>>0,n[4]=n[4]+F>>>0}return[n[0]>>24&255,n[0]>>16&255,n[0]>>8&255,n[0]&255,n[1]>>24&255,n[1]>>16&255,n[1]>>8&255,n[1]&255,n[2]>>24&255,n[2]>>16&255,n[2]>>8&255,n[2]&255,n[3]>>24&255,n[3]>>16&255,n[3]>>8&255,n[3]&255,n[4]>>24&255,n[4]>>16&255,n[4]>>8&255,n[4]&255]}var pX=CO("v5",80,dX);const fX=pX,mX="00000000-0000-0000-0000-000000000000";function gX(t){if(!kv(t))throw TypeError("Invalid UUID");return parseInt(t.substr(14,1),16)}const yX=Object.freeze(Object.defineProperty({__proto__:null,NIL:mX,parse:IO,stringify:Pv,v1:JK,v3:cX,v4:uX,v5:fX,validate:kv,version:gX},Symbol.toStringTag,{value:"Module"})),_X=WM(yX);var XT={},vX=$e&&$e.__awaiter||function(t,e,n,a){function u(d){return d instanceof n?d:new n(function(_){_(d)})}return new(n||(n=Promise))(function(d,_){function l(C){try{T(a.next(C))}catch(P){_(P)}}function w(C){try{T(a.throw(C))}catch(P){_(P)}}function T(C){C.done?d(C.value):u(C.value).then(l,w)}T((a=a.apply(t,e||[])).next())})},xX=$e&&$e.__generator||function(t,e){var n={label:0,sent:function(){if(d[0]&1)throw d[1];return d[1]},trys:[],ops:[]},a,u,d,_;return _={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(_[Symbol.iterator]=function(){return this}),_;function l(T){return function(C){return w([T,C])}}function w(T){if(a)throw new TypeError("Generator is already executing.");for(;n;)try{if(a=1,u&&(d=T[0]&2?u.return:T[0]?u.throw||((d=u.return)&&d.call(u),0):u.next)&&!(d=d.call(u,T[1])).done)return d;switch(u=0,d&&(T=[T[0]&2,d.value]),T[0]){case 0:case 1:d=T;break;case 4:return n.label++,{value:T[1],done:!1};case 5:n.label++,u=T[1],T=[0];continue;case 7:T=n.ops.pop(),n.trys.pop();continue;default:if(d=n.trys,!(d=d.length>0&&d[d.length-1])&&(T[0]===6||T[0]===2)){n=0;continue}if(T[0]===3&&(!d||T[1]>d[0]&&T[1]0&&U0?n:0},e}(RX.ServiceImplBase);QT.SelectionServiceImpl=OX;var zv={},FX=$e&&$e.__extends||function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,u){a.__proto__=u}||function(a,u){for(var d in u)u.hasOwnProperty(d)&&(a[d]=u[d])},t(e,n)};return function(e,n){t(e,n);function a(){this.constructor=e}e.prototype=n===null?Object.create(n):(a.prototype=n.prototype,new a)}}();Object.defineProperty(zv,"__esModule",{value:!0});var vu=hr(),LX=ai,BX=function(t){FX(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return Object.defineProperty(e.prototype,"serviceName",{get:function(){return"size-service"},enumerable:!0,configurable:!0}),e.prototype.changeSizeAsync=function(n,a){var u,d,_,l,w,T=(u={},u[vu.ParameterId.FunctionName]="changeSizeAsync",u[vu.ParameterId.SheetName]=n,u[vu.ParameterId.MinHeight]=((d=a.minSize)===null||d===void 0?void 0:d.height)||0,u[vu.ParameterId.MinWidth]=((_=a.minSize)===null||_===void 0?void 0:_.width)||0,u[vu.ParameterId.MaxHeight]=((l=a.maxSize)===null||l===void 0?void 0:l.height)||0,u[vu.ParameterId.MaxWidth]=((w=a.maxSize)===null||w===void 0?void 0:w.width)||0,u);return this.execute(vu.VerbId.SetSheetSize,T).then(function(C){})},e}(LX.ServiceImplBase);zv.SizeServiceImpl=BX;var JT={},NX=$e&&$e.__extends||function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,u){a.__proto__=u}||function(a,u){for(var d in u)u.hasOwnProperty(d)&&(a[d]=u[d])},t(e,n)};return function(e,n){t(e,n);function a(){this.constructor=e}e.prototype=n===null?Object.create(n):(a.prototype=n.prototype,new a)}}();Object.defineProperty(JT,"__esModule",{value:!0});var Hb=hr(),UX=ai,jX=function(t){NX(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return Object.defineProperty(e.prototype,"serviceName",{get:function(){return"visual-model-service"},enumerable:!0,configurable:!0}),e.prototype.getVisualSpecificationAsync=function(n){var a,u=(a={},a[Hb.ParameterId.FunctionName]="getVisualSpecificationAsync",a[Hb.ParameterId.WorksheetName]=n.worksheet,a);return this.execute(Hb.VerbId.GetVisualSpecification,u).then(function(d){var _=d.result;return _})},e}(UX.ServiceImplBase);JT.VisualModelServiceImpl=jX;var _y={},ID;function VX(){if(ID)return _y;ID=1;var t=$e&&$e.__extends||function(){var d=function(_,l){return d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(w,T){w.__proto__=T}||function(w,T){for(var C in T)T.hasOwnProperty(C)&&(w[C]=T[C])},d(_,l)};return function(_,l){d(_,l);function w(){this.constructor=_}_.prototype=l===null?Object.create(l):(w.prototype=l.prototype,new w)}}();Object.defineProperty(_y,"__esModule",{value:!0});var e=hr(),n=wO(),a=ai,u=function(d){t(_,d);function _(){return d!==null&&d.apply(this,arguments)||this}return Object.defineProperty(_.prototype,"serviceName",{get:function(){return"viz-service"},enumerable:!0,configurable:!0}),_.prototype.createVizImageAsync=function(l){var w,T=(w={},w[e.ParameterId.FunctionName]="createVizImageAsync",w[e.ParameterId.VizAPIInputJson]=JSON.stringify(l),w);return this.execute(e.VerbId.VizAPI,T).then(function(C){var P=C.result;return P})},_.prototype.activateSheetAsync=function(l){var w,T=(w={},w[e.ParameterId.FunctionName]="activateSheetAsync",w[e.ParameterId.SwitchToSheetName]=l,w);return this.execute(e.VerbId.ActivateSheet,T).then(function(){})},_.prototype.getCustomViewsAsync=function(){var l,w=this,T=(l={},l[e.ParameterId.FunctionName]="getCustomViewsAsync",l);return this.execute(e.VerbId.GetCustomViews,T).then(function(C){var P=C.result;return P.map(function(z){return new n.CustomViewImpl(z,w._registryId)})})},_.prototype.showCustomViewAsync=function(l){var w,T=this,C=(w={},w[e.ParameterId.FunctionName]="showCustomViewAsync",w[e.ParameterId.CustomViewName]=l||"",w);return this.execute(e.VerbId.ShowCustomView,C).then(function(P){var z,W=P.result;return!((z=W)===null||z===void 0)&&z.luid?new n.CustomViewImpl(W,T._registryId):void 0})},_.prototype.removeCustomViewAsync=function(l){var w,T=this,C=(w={},w[e.ParameterId.FunctionName]="removeCustomViewAsync",w[e.ParameterId.CustomViewName]=l,w);return this.execute(e.VerbId.RemoveCustomView,C).then(function(P){var z=P.result;return new n.CustomViewImpl(z,T._registryId)})},_.prototype.saveCustomViewAsync=function(l){var w,T=this,C=(w={},w[e.ParameterId.FunctionName]="saveCustomViewAsync",w[e.ParameterId.CustomViewName]=l,w[e.ParameterId.CustomViewIsDefault]=!1,w);return this.execute(e.VerbId.SaveWorkbookAsCustomView,C).then(function(P){var z=P.result;return new n.CustomViewImpl(z,T._registryId)})},_.prototype.setActiveCustomViewAsDefaultAsync=function(){var l,w=(l={},l[e.ParameterId.FunctionName]="setActiveCustomViewAsDefaultAsync",l);return this.execute(e.VerbId.SetActiveCustomViewAsDefault,w).then(function(){})},_.prototype.saveAsync=function(l){var w,T=this,C=(w={},w[e.ParameterId.FunctionName]="saveAsync",w[e.ParameterId.CustomViewLuid]=l.luid,w[e.ParameterId.CustomViewName]=l.name,w[e.ParameterId.CustomViewIsDefault]=l.isDefault,w[e.ParameterId.CustomViewIsPublic]=l.shared,w);return this.execute(e.VerbId.UpdateCustomView,C).then(function(P){var z=P.result;return new n.CustomViewImpl(z,T._registryId)})},_.prototype.getCurrentSrcAsync=function(){var l,w=(l={},l[e.ParameterId.FunctionName]="getCurrentSrcAsync",l);return this.execute(e.VerbId.GetCurrentSrc,w).then(function(T){return T.result})},_}(a.ServiceImplBase);return _y.VizServiceImpl=u,_y}var eA={},$X=$e&&$e.__extends||function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,u){a.__proto__=u}||function(a,u){for(var d in u)u.hasOwnProperty(d)&&(a[d]=u[d])},t(e,n)};return function(e,n){t(e,n);function a(){this.constructor=e}e.prototype=n===null?Object.create(n):(a.prototype=n.prototype,new a)}}();Object.defineProperty(eA,"__esModule",{value:!0});var WX=Nt,Xl=hr(),GX=Sc,vy=$o(),HX=Vd(),qX=ai,ZX=function(t){$X(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return Object.defineProperty(e.prototype,"serviceName",{get:function(){return"zone-service"},enumerable:!0,configurable:!0}),e.prototype.setVisibilityAsync=function(n,a,u){var d,_=(d={},d[Xl.ParameterId.FunctionName]="setVisibilityAsync",d[Xl.ParameterId.Dashboard]=n,d[Xl.ParameterId.ZoneIdsVisibilityMap]={},d),l=HX.Param.convertParameterToMap(u,"zoneVisibilityMap");return l.forEach(function(w,T){vy.ErrorHelpers.verifyZoneIsValid(a,Number.parseInt(T,10)),vy.ErrorHelpers.verifyEnumValue(w,WX.DashboardObjectVisibilityType,"DashboardObjectVisibilityType"),_[Xl.ParameterId.ZoneIdsVisibilityMap][T]=GX.ExternalToInternalEnumMappings.setVisibilityType.convert(w)}),this.execute(Xl.VerbId.SetZoneVisibility,_).then(function(w){})},e.prototype.moveAndResizeAsync=function(n,a,u){var d,_=(d={},d[Xl.ParameterId.Dashboard]=n,d[Xl.ParameterId.DashboardObjectPositionAndSizeUpdateList]=u,d);return u.forEach(function(l){vy.ErrorHelpers.verifyZoneIsValidAndFloating(a,l.dashboardObjectID),vy.ErrorHelpers.verifyWidthAndHeightOfDashboardObjectPositionAndSizeUpdate(l)}),this.execute(Xl.VerbId.MoveAndResizeZones,_).then(function(l){})},e}(qX.ServiceImplBase);eA.ZoneServiceImpl=ZX;var CD;function KX(){if(CD)return dy;CD=1,Object.defineProperty(dy,"__esModule",{value:!0});var t=pa,e=jT,n=$T,a=WT,u=TO,d=qT,_=ZT,l=XK(),w=EX(),T=Mv,C=YT,P=QT,z=zv,W=JT,U=VX(),j=eA;function L(V,R,F){t.ApiServiceRegistry.get(R).registerService(new n.AnimationServiceImpl(V,R)),t.ApiServiceRegistry.get(R).registerService(new u.DataSourceServiceImpl(V,R,F)),t.ApiServiceRegistry.get(R).registerService(new d.ExportServiceImpl(V,R)),t.ApiServiceRegistry.get(R).registerService(new w.GetDataServiceImpl(V,R)),t.ApiServiceRegistry.get(R).registerService(new l.FilterServiceImpl(V,R)),t.ApiServiceRegistry.get(R).registerService(new T.NotificationServiceImpl(V)),t.ApiServiceRegistry.get(R).registerService(new C.ParametersServiceImpl(V,R)),t.ApiServiceRegistry.get(R).registerService(new P.SelectionServiceImpl(V,R)),t.ApiServiceRegistry.get(R).registerService(new a.AnnotationServiceImpl(V,R)),t.ApiServiceRegistry.get(R).registerService(new j.ZoneServiceImpl(V,R)),t.ApiServiceRegistry.get(R).registerService(new z.SizeServiceImpl(V,R)),t.ApiServiceRegistry.get(R).registerService(new W.VisualModelServiceImpl(V,R)),t.ApiServiceRegistry.get(R).registerService(new U.VizServiceImpl(V,R)),t.ApiServiceRegistry.get(R).registerService(new _.ExternalContextMenuServiceImpl(V,R)),t.ApiServiceRegistry.get(R).registerService(new e.AccessibilityServiceImpl(V,R))}return dy.registerAllSharedServices=L,dy}var tA={},XX=$e&&$e.__extends||function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,u){a.__proto__=u}||function(a,u){for(var d in u)u.hasOwnProperty(d)&&(a[d]=u[d])},t(e,n)};return function(e,n){t(e,n);function a(){this.constructor=e}e.prototype=n===null?Object.create(n):(a.prototype=n.prototype,new a)}}();Object.defineProperty(tA,"__esModule",{value:!0});var kD=hr(),YX=ai,QX=function(t){XX(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return Object.defineProperty(e.prototype,"serviceName",{get:function(){return"client-info-service"},enumerable:!0,configurable:!0}),e.prototype.getClientInfoAsync=function(){var n,a=kD.VerbId.GetEmbeddingClientInfo,u=(n={},n[kD.ParameterId.FunctionName]="getClientInfoAsync",n);return this.execute(a,u).then(function(d){var _=d.result;return _})},e}(YX.ServiceImplBase);tA.ClientInfoServiceImpl=QX;var rA={},JX=$e&&$e.__extends||function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,u){a.__proto__=u}||function(a,u){for(var d in u)u.hasOwnProperty(d)&&(a[d]=u[d])},t(e,n)};return function(e,n){t(e,n);function a(){this.constructor=e}e.prototype=n===null?Object.create(n):(a.prototype=n.prototype,new a)}}();Object.defineProperty(rA,"__esModule",{value:!0});var vs=hr(),eY=ai,tY=function(t){JX(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return Object.defineProperty(e.prototype,"serviceName",{get:function(){return"story-activation-service"},enumerable:!0,configurable:!0}),e.prototype.activateNextStoryPointAsync=function(){var n,a=vs.VerbId.ActivateNextStoryPoint,u=(n={},n[vs.ParameterId.FunctionName]="activateNextStoryPointAsync",n);return this.execute(a,u).then(function(d){})},e.prototype.activatePreviousStoryPointAsync=function(){var n,a=vs.VerbId.ActivatePreviousStoryPoint,u=(n={},n[vs.ParameterId.FunctionName]="activatePreviousStoryPointAsync",n);return this.execute(a,u).then(function(d){})},e.prototype.activateStoryPointAsync=function(n){var a,u=vs.VerbId.ActivateStoryPoint,d=(a={},a[vs.ParameterId.FunctionName]="activateStoryPointAsync",a);return d[vs.ParameterId.StoryPointIndex]=n,this.execute(u,d).then(function(_){})},e.prototype.revertStoryPointAsync=function(n){var a,u=vs.VerbId.RevertStoryPoint,d=(a={},a[vs.ParameterId.FunctionName]="revertStoryPointAsync",a);return d[vs.ParameterId.StoryPointIndex]=n,this.execute(u,d).then(function(_){return _.result})},e}(eY.ServiceImplBase);rA.StoryActivationServiceImpl=tY;var nA={};Object.defineProperty(nA,"__esModule",{value:!0});var xy=hr(),rY=function(){function t(e,n){var a=this;this._apiDelegateDispatcher=e,this._versionConverter=xy.CreateExternalCompatibleVersionConverter(xy.INTERNAL_CONTRACT_VERSION,n),this._notificationHandlers=[],e.registerNotificationHandler(function(u){if(a._notificationHandlers.length!==0){var d=a._versionConverter.upgradeNotification(u);a._notificationHandlers.forEach(function(_){_(d)})}})}return t.needsVersionConverter=function(e){return xy.VersionLessThan(e,xy.INTERNAL_CONTRACT_VERSION)},t.prototype.execute=function(e,n){var a=this;try{var u=this._versionConverter.downgradeExecuteCall(e,n);return this._apiDelegateDispatcher.execute(u.verb,u.parameters).then(function(d){var _=a._versionConverter.upgradeExecuteReturn(d,e,n);return _})}catch(d){return Promise.reject(d)}},t.prototype.registerNotificationHandler=function(e){this._notificationHandlers.push(e)},t.prototype.unregisterNotificationHandler=function(e){this._notificationHandlers=this._notificationHandlers.filter(function(n){return n!==e})},t}();nA.VersionedExternalApiDispatcher=rY;var PD;function sn(){return PD||(PD=1,function(t){function e(gt){for(var je in gt)t.hasOwnProperty(je)||(t[je]=gt[je])}Object.defineProperty(t,"__esModule",{value:!0});var n=fT;t.ApiVersion=n.ApiVersion,e(mT);var a=gv;t.CrossFrameDispatcher=a.CrossFrameDispatcher;var u=Vm;t.DataSource=u.DataSource;var d=Sc;t.ExternalToInternalEnumMappings=d.ExternalToInternalEnumMappings;var _=fl;t.InternalToExternalEnumMappings=_.InternalToExternalEnumMappings;var l=zT;t.EventListenerManager=l.EventListenerManager;var w=$m;t.Field=w.Field;var T=wO();t.CustomViewImpl=T.CustomViewImpl;var C=_v;t.DashboardImpl=C.DashboardImpl;var P=xv;t.DashboardObjectImpl=P.DashboardObjectImpl;var z=qm;t.DataSourceImpl=z.DataSourceImpl;var W=Ev;t.ParameterImpl=W.ParameterImpl;var U=$d;t.SheetImpl=U.SheetImpl;var j=Gm;t.SheetInfoImpl=j.SheetInfoImpl;var L=LT;t.SingleEventManagerImpl=L.SingleEventManagerImpl;var V=BT;t.StoryImpl=V.StoryImpl;var R=Sv;t.StoryPointImpl=R.StoryPointImpl;var F=Tv;t.StoryPointInfoImpl=F.StoryPointInfoImpl;var H=UT;t.WorkbookImpl=H.WorkbookImpl;var Q=Hm;t.WorksheetImpl=Q.WorksheetImpl;var te=vv;t.Point=te.Point,e(KX()),e(pa);var se=tA;t.ClientInfoServiceImpl=se.ClientInfoServiceImpl;var ge=Mv;t.NotificationServiceImpl=ge.NotificationServiceImpl;var xe=Ym;t.NotificationServiceImplBase=xe.NotificationServiceImplBase,t.Registration=xe.Registration;var Ee=ai;t.ServiceImplBase=Ee.ServiceImplBase;var Be=zv;t.SizeServiceImpl=Be.SizeServiceImpl;var Fe=rA;t.StoryActivationServiceImpl=Fe.StoryActivationServiceImpl;var Ve=Mn;t.TableauError=Ve.TableauError;var kt=Km;t.Deferred=kt.Deferred;var Dt=$o();t.ErrorHelpers=Dt.ErrorHelpers;var Ut=Iv;t.ExportHelpers=Ut.ExportHelpers;var cr=Wm;t.SheetUtils=cr.SheetUtils;var qe=cv;t.VersionNumber=qe.VersionNumber;var Tt=nA;t.VersionedExternalApiDispatcher=Tt.VersionedExternalApiDispatcher}(hb)),hb}var Rv={},Ov={},Tc={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.SANITIZED_VALUES={YES_VALUE:"y",NO_VALUE:"n"};const e=new Set(["https:","http:"]);class n{build(){return this._url}appendDefaultParameters(T){for(const C of T.keys()){const P=T.get(C);P&&!this._url.searchParams.has(C)&&this._url.searchParams.append(C,P)}return this}appendUserOptions(T){for(const C of Object.keys(T)){if(T[C]===null||T[C]===void 0)continue;const P=this._optionNames[C];if(!P)continue;const z=this.sanitizeParameterValue(P,T[C]);this._url.searchParams.append(P,z)}return this}appendCustomParams(T){for(const C of T)this._url.searchParams.set(C.name,C.value);return this}setToken(T){if(this._token)throw new Error(`The token has already been set to ${this._token}`);if(!T)return this;this._token=T;const C=this._url.toString().substring(this._url.origin.length);return this._url=new URL(`${this._url.origin}/vizportal/api/web/v1/auth/embed/target`),this._url.searchParams.append("token",T),this._url.searchParams.append("target",C),this}sanitizeValue(T){const C=String(T);switch(C){case"true":return t.SANITIZED_VALUES.YES_VALUE;case"false":return t.SANITIZED_VALUES.NO_VALUE;default:return C}}}t.EmbeddingUrlBuilder=n;function a(w){u(w)}t.validateUrl=a;function u(w){const T=w.protocol;if(!e.has(T))throw new Error(`Invalid protocol in URL '${w}'. The protocols supported are ${Array.from(e).join(", ")}.`)}function d(w){const C=l(new URL(w.toString())).pathname.split("/").filter(P=>P);return C.length===0?"":C[0]==="site"?C[1]:C[0]==="pulse"&&C[1]==="site"?C[2]:""}t.getSiteIdForPulse=d;function _(w){const C=l(new URL(w.toString())).pathname.split("/").filter(P=>P);return C.length===0||C[0]!=="t"||C.length<2?"":C[1]}t.getSiteId=_;function l(w){let T=w.toString();return T=T.replace("/#/site/","/t/").replace("/#/","/"),new URL(T)}t.canonicalizeVizPortalRoutingHashes=l})(Tc);Object.defineProperty(Ov,"__esModule",{value:!0});const nY=Nt,Ql=hr(),DO=sn(),MO=Tc;function iY(t,e,n,a){const u=t.split("?")[0];let d;try{d=new URL(u),MO.validateUrl(d)}catch(w){throw new DO.TableauError(nY.EmbeddingErrorCodes.InvalidUrl,w.message)}const _=oY(d,n),l=new zO(d).appendDefaultParameters(_).appendUserOptions(e).appendCustomParams(a);return e.iframeAuth&&l.setToken(e.token),l.build()}Ov.createAskDataUrl=iY;function oY(t,e){const n=new Map,a=`${Ql.INTERNAL_CONTRACT_VERSION.major}.${Ql.INTERNAL_CONTRACT_VERSION.minor}.${Ql.INTERNAL_CONTRACT_VERSION.fix}`;n.set(Ql.AskDataOptionNames.ApiInternalVersion,a);const u=DO.ApiVersion.Instance.formattedValue;return n.set(Ql.AskDataOptionNames.ApiExternalVersion,u),n.set(Ql.AskDataOptionNames.ApiID,`embhost${e}`),n.set(Ql.AskDataOptionNames.AskDataWebComponent,"true"),n}class zO extends MO.EmbeddingUrlBuilder{constructor(e){super(),this._url=e,this._optionNames=Ql.AskDataOptionNames}sanitizeParameterValue(e,n){return this.sanitizeValue(n)}}Ov.EmbeddingAskDataUrlBuilder=zO;var Uu={},iA={},aY=$e&&$e.__awaiter||function(t,e,n,a){function u(d){return d instanceof n?d:new n(function(_){_(d)})}return new(n||(n=Promise))(function(d,_){function l(C){try{T(a.next(C))}catch(P){_(P)}}function w(C){try{T(a.throw(C))}catch(P){_(P)}}function T(C){C.done?d(C.value):u(C.value).then(l,w)}T((a=a.apply(t,e||[])).next())})};Object.defineProperty(iA,"__esModule",{value:!0});class sY{constructor(){this.queue=[],this.pending=0,this.concurrency=1}add(e){return new Promise((a,u)=>{this.queue.push(()=>aY(this,void 0,void 0,function*(){try{const d=yield e();a(d)}catch(d){u(d)}finally{this.pending--,this.poll()}}))})}poll(){if(this.pending0){const e=this.queue.shift();this.pending++,e()}}size(){return this.queue.length}}iA.PromiseQueue=sY;Object.defineProperty(Uu,"__esModule",{value:!0});const lY=iA;class Qm{static authRequired(e,n){if(!n)return!0;try{const a=new URL(e);if(this.signedInOrigins.has(a.origin))return!1}catch{return!0}return!0}static updateSignedInOrigin(e,n){if(n)try{const a=new URL(e);this.signedInOrigins.add(a.origin)}catch{return}}static clearOrigin(e,n){if(n&&e)try{const a=new URL(e);this.signedInOrigins.delete(a.origin)}catch{return}}static registerWebComponent(e){const n=this.embeddingIndex;return this.webComponents.set(n,e),this.embeddingIndex++,n}static unregisterWebComponent(e){this.webComponents.delete(e)}static getWebComponents(){const e=new Map;return this.webComponents.forEach((n,a)=>{e.set(a,n)}),e}static synchronizeRender(e){const n=this.queue.add(e);return this.queue.poll(),n}static clear(){this.webComponents.clear()}}Uu.WebComponentManager=Qm;Qm.embeddingIndex=0;Qm.webComponents=new Map;Qm.queue=new lY.PromiseQueue;Qm.signedInOrigins=new Set;var Jm={},oA={};Object.defineProperty(oA,"__esModule",{value:!0});class cY{constructor(e,n){this._errorCode=e,this._message=n}get message(){return this._message}get errorCode(){return this._errorCode}}oA.VizLoadErrorEvent=cY;var Fv={};Object.defineProperty(Fv,"__esModule",{value:!0});class RO{}Fv.HtmlElementHelpers=RO;RO.getContentSize=t=>{const e=window.getComputedStyle(t),n=parseInt(e.paddingLeft,10)||0,a=parseInt(e.paddingTop,10)||0,u=parseInt(e.paddingRight,10)||0,d=parseInt(e.paddingBottom,10)||0,_=t.clientWidth-Math.round(n+u),l=t.clientHeight-Math.round(a+d);return{width:_,height:l}};(function(t){var e=$e&&$e.__awaiter||function(C,P,z,W){function U(j){return j instanceof z?j:new z(function(L){L(j)})}return new(z||(z=Promise))(function(j,L){function V(H){try{F(W.next(H))}catch(Q){L(Q)}}function R(H){try{F(W.throw(H))}catch(Q){L(Q)}}function F(H){H.done?j(H.value):U(H.value).then(V,R)}F((W=W.apply(C,P||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0});const n=Nt,a=sn(),u=oA,d=Fv,_=Uu;var l;(function(C){C.Skip="skip",C.Success="success",C.Failure="failure"})(l=t.TableauAuthResponse||(t.TableauAuthResponse={}));const w={allowTransparency:"allowTransparency",allowFullScreen:"allowFullScreen",style:"style",class:"class",loading:"loading"};t.getLocalizedTitle=C=>{const P={en:"Data Visualization","en-GB":"Data Visualisation",fr:"Visualisation de données",es:"Visualización de datos",it:"Visualizzazione dati",pt:"Visualização de dados",ja:"データ ビジュアライゼーション",de:"Datenvisualisierung",ko:"데이터 비주얼리제이션","zh-CN":"数据可视化","zh-TW":"資料可視化"};return P[C]||P[C.substr(0,2)]||P.en};class T extends HTMLElement{constructor(){super(),this._initialized=!1,this._embeddingIdCounter=0,this._fixedSize=!1,this.attachShadow({mode:"open"})}disconnectedCallback(){var P,z;this._iframe&&((P=this.shadowRoot)===null||P===void 0||P.removeChild(this._iframe)),this._iframeStyle&&((z=this.shadowRoot)===null||z===void 0||z.removeChild(this._iframeStyle)),_.WebComponentManager.clearOrigin(this.src,this.forceTokenSync),_.WebComponentManager.unregisterWebComponent(this._embeddingIdCounter),this._initialized=!1}connectedCallback(){document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{this.initialize()}):this.initialize()}attributeChangedCallback(P,z,W){if(!(!z&&z===W)){if(P===n.WebComponentAttributes.Width||P===n.WebComponentAttributes.Height){this.setFrameSize();return}P===n.WebComponentAttributes.Token&&z&&z!==W&&_.WebComponentManager.clearOrigin(this.src,this.forceTokenSync),_.WebComponentManager.synchronizeRender(this.updateRenderingIfInitialized.bind(this,this.src))}}static get observedAttributes(){return Object.values(n.WebComponentAttributes)}initialize(){this._initialized||(this.style.display="flex",this.setupFrame(),this.registerAttributeAuthErrorEvent(),_.WebComponentManager.synchronizeRender(this.updateRendering.bind(this,this.src)))}get fixedSize(){return this._fixedSize}readCustomParamsFromChildren(){const P=[];return Array.from(this.children).forEach(z=>{z.localName===n.WebComponentChildElements.CustomParameter&&z.getAttribute(n.WebComponentChildElementAttributes.Name)&&z.getAttribute(n.WebComponentChildElementAttributes.Value)&&P.push({name:z.getAttribute(n.WebComponentChildElementAttributes.Name),value:z.getAttribute(n.WebComponentChildElementAttributes.Value)})}),P}getIframeStyleChild(){let P;for(const z of Array.from(this.children))if(z.localName===n.WebComponentChildElements.IframeStyle){if(P)throw new a.TableauError(n.EmbeddingErrorCodes.InternalError,`Only one ${n.WebComponentChildElements.IframeStyle} child element is supported. Please combine your styles.`);P=z}return P}setupFrame(){var P;this._iframe=document.createElement("iframe");const z=navigator.language,W=t.getLocalizedTitle(z);if(this._iframe.setAttribute("title",W),this._iframe.setAttribute(w.allowTransparency,"true"),this._iframe.setAttribute(w.allowFullScreen,"true"),this.iframeAttributeLoading&&this._iframe.setAttribute("loading",this.iframeAttributeLoading),this._iframe.style.margin="0px",this._iframe.style.padding="0px",this._iframe.style.border="none",this._iframe.style.position="relative",this._iframe.id=this.id,this._iframe.name=this.id,this.setFrameSize(),this.iframeAttributeStyle){const U=this._iframe.getAttribute(w.style);this._iframe.setAttribute(w.style,`${U} ${this.iframeAttributeStyle}`)}if(this.iframeAttributeClass&&this._iframe.setAttribute(w.class,this.iframeAttributeClass),this.shadowRoot){const U=this.getIframeStyleChild();if(U){U.style.display="none";const j=(P=U.textContent)===null||P===void 0?void 0:P.trim();j&&(this._iframeStyle=document.createElement("style"),this._iframeStyle.textContent=j,this.shadowRoot.appendChild(this._iframeStyle))}this.shadowRoot.appendChild(this._iframe)}}setFrameSize(){this._iframe&&(this._iframe.style.height=this.height,this._iframe.style.width=this.width)}computeElementSize(){const P=this.getPixelAttribute(n.WebComponentAttributes.Height),z=this.getPixelAttribute(n.WebComponentAttributes.Width);if(P&&z)return this._fixedSize=!0,{height:P,width:z};if(this.parentElement){const{height:W,width:U}=d.HtmlElementHelpers.getContentSize(this.parentElement);if(W&&U)return this._fixedSize=!0,{height:`${W}px`,width:`${U}px`}}return this._fixedSize=!1,{height:T.AttributeDefaults.height,width:T.AttributeDefaults.width}}get src(){return this.getAttribute(n.WebComponentAttributes.Src)}set src(P){P&&this.setAttribute(n.WebComponentAttributes.Src,P)}get forceTokenSync(){return this.hasAttribute(n.WebComponentAttributes.ForceTokenSync)}set forceTokenSync(P){P?this.setAttribute(n.WebComponentAttributes.ForceTokenSync,""):this.removeAttribute(n.WebComponentAttributes.ForceTokenSync)}get width(){return this.computeElementSize().width}set width(P){this.setAttribute(n.WebComponentAttributes.Width,P)}get height(){return this.computeElementSize().height}set height(P){this.setAttribute(n.WebComponentAttributes.Height,P)}get debug(){return this.hasAttribute(n.WebComponentAttributes.Debug)}set debug(P){P?this.setAttribute(n.WebComponentAttributes.Debug,""):this.removeAttribute(n.WebComponentAttributes.Debug)}get token(){const P=this.getAttribute(n.WebComponentAttributes.Token);if(P)return P}set token(P){P?this.setAttribute(n.WebComponentAttributes.Token,P):this.removeAttribute(n.WebComponentAttributes.Token)}get iframeAuth(){return this.hasAttribute(n.WebComponentAttributes.IframeAuth)}set iframeAuth(P){P?this.setAttribute(n.WebComponentAttributes.IframeAuth,""):this.removeAttribute(n.WebComponentAttributes.IframeAuth)}get iframeAttributeLoading(){const P=this.getAttribute(n.EmbeddedIframeAttributes.Loading);if(P)return P}set iframeAttributeLoading(P){var z,W;P?(this.setAttribute(n.EmbeddedIframeAttributes.Loading,P),(z=this._iframe)===null||z===void 0||z.setAttribute(w.loading,P)):(this.removeAttribute(n.EmbeddedIframeAttributes.Loading),(W=this._iframe)===null||W===void 0||W.removeAttribute(w.loading))}get iframeAttributeStyle(){const P=this.getAttribute(n.EmbeddedIframeAttributes.Style);if(P)return P}set iframeAttributeStyle(P){var z,W;P?(this.setAttribute(n.EmbeddedIframeAttributes.Style,P),(z=this._iframe)===null||z===void 0||z.setAttribute(w.style,P)):(this.removeAttribute(n.EmbeddedIframeAttributes.Style),(W=this._iframe)===null||W===void 0||W.removeAttribute(w.style))}get iframeAttributeClass(){const P=this.getAttribute(n.EmbeddedIframeAttributes.Class);if(P)return P}set iframeAttributeClass(P){var z,W;P?(this.setAttribute(n.EmbeddedIframeAttributes.Class,P),(z=this._iframe)===null||z===void 0||z.setAttribute(w.class,P)):(this.removeAttribute(n.EmbeddedIframeAttributes.Class),(W=this._iframe)===null||W===void 0||W.removeAttribute(w.class))}getPixelAttribute(P){const z=this.getAttribute(P);return z&&z!==""?isNaN(Number(z))?z:`${Math.round(Number(z))}px`:""}get iframe(){return this._iframe}registerAttributeAuthErrorEvent(){this.getWebComponentAttributeEvents().forEach(P=>{const[z,W]=P;this.registerCallback(z,W)})}getWebComponentAttributeEvents(){return[[n.WebComponentAttributes.OnVizLoadError,n.EmbeddingTableauEventType.VizLoadError]]}registerCallback(P,z){const W=this.getAttribute(P);W&&/^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(W)&&window[W]&&this.addEventListener(z,window[W])}auth(P){return e(this,void 0,void 0,function*(){try{if(!this.src||!this.token||this.iframeAuth||!_.WebComponentManager.authRequired(this.src,this.forceTokenSync))return l.Skip;const U=`${new URL(this.src).origin.toString()}/vizportal/api/web/v1/auth/embed/signin`,j={siteName:P,jwt:this.token},L={method:"POST",credentials:"include",headers:{"content-type":"application/json"},body:JSON.stringify(j)},V=yield fetch(U,L);if(V.ok)return _.WebComponentManager.updateSignedInOrigin(this.src,this.forceTokenSync),l.Success;const F=yield V.text(),H={statusCode:V.status,errorMessage:F};return this.isFallbackToRedirectAuthNeeded(H)?(this.iframeAuth=!0,console.debug("Auth Fallback trigger"),l.Failure):(this.raiseVizLoadErrorNotification(n.EmbeddingErrorCodes.AuthFailed,H),l.Failure)}catch(z){return this.raiseVizLoadErrorNotification(n.EmbeddingErrorCodes.UnknownAuthError,z),l.Failure}})}isFallbackToRedirectAuthNeeded(P){try{if(P.statusCode===404)return!0;if(P.statusCode===401){let z=JSON.parse(P.errorMessage).result.errors;if(z&&z.length>0&&z[0].code===67)return!0}return!1}catch(z){return console.error("Parsing error: "+z),!1}}raiseIframeSrcUpdatedNotification(){this.dispatchEvent(new CustomEvent(n.EmbeddingTableauEventType.IframeSrcUpdated))}raiseVizLoadErrorNotification(P,z){try{console.error(z);const W=new u.VizLoadErrorEvent(P,JSON.stringify(z));this.dispatchEvent(new CustomEvent(n.EmbeddingTableauEventType.VizLoadError,{detail:W}))}catch{const U=new u.VizLoadErrorEvent(n.EmbeddingErrorCodes.UnknownAuthError,"");this.dispatchEvent(new CustomEvent(n.EmbeddingTableauEventType.VizLoadError,{detail:U}))}}}t.TableauWebComponent=T,T.AttributeDefaults={width:"800px",height:"600px"}})(Jm);var DD=$e&&$e.__awaiter||function(t,e,n,a){function u(d){return d instanceof n?d:new n(function(_){_(d)})}return new(n||(n=Promise))(function(d,_){function l(C){try{T(a.next(C))}catch(P){_(P)}}function w(C){try{T(a.throw(C))}catch(P){_(P)}}function T(C){C.done?d(C.value):u(C.value).then(l,w)}T((a=a.apply(t,e||[])).next())})};Object.defineProperty(Rv,"__esModule",{value:!0});const Vi=Nt,uY=Ov,hY=Tc,MD=Uu,zD=Jm;class dY extends zD.TableauWebComponent{constructor(){super()}static get observedAttributes(){return[...super.observedAttributes,...Object.values(Vi.AskDataAttributes)]}updateRenderingIfInitialized(e){return DD(this,void 0,void 0,function*(){if(this._initialized)return MD.WebComponentManager.unregisterWebComponent(this._embeddingIdCounter),this.updateRendering(e)})}updateRendering(e){return DD(this,void 0,void 0,function*(){try{if(this._initialized=!0,!e){console.debug(`A src needs to be set on the ${this.tagName.toLowerCase()} element. Skipping rendering.`);return}if((yield this.auth(hY.getSiteId(e)))===zD.TableauAuthResponse.Failure){console.debug("Authentication failed.");return}if(!this.src){console.debug(`A src needs to be set on the ${this.tagName.toLowerCase()} element. Skipping rendering.`);return}if(!this.iframe){console.debug("No iframe available to update the src.");return}const a=this.readCustomParamsFromChildren();this._embeddingIdCounter=MD.WebComponentManager.registerWebComponent(this);const u=uY.createAskDataUrl(this.src,this.constructOptions(),this._embeddingIdCounter,a).toString();this.iframe.src=u,this.raiseIframeSrcUpdatedNotification();return}catch(n){console.warn(n)}})}constructOptions(){return{origin:this.origin,showEmbed:this.showEmbed,showPin:this.showPin,showSave:this.showSave,showShare:this.showShare,token:this.token,iframeAuth:this.iframeAuth,debug:this.debug}}get origin(){const e=this.getAttribute(Vi.AskDataAttributes.Origin);return e||void 0}set origin(e){e?this.setAttribute(Vi.AskDataAttributes.Origin,e):this.removeAttribute(Vi.AskDataAttributes.Origin)}get showEmbed(){return this.hasAttribute(Vi.AskDataAttributes.ShowEmbed)}set showEmbed(e){e?this.setAttribute(Vi.AskDataAttributes.ShowEmbed,""):this.removeAttribute(Vi.AskDataAttributes.ShowEmbed)}get showPin(){return this.hasAttribute(Vi.AskDataAttributes.ShowPin)}set showPin(e){e?this.setAttribute(Vi.AskDataAttributes.ShowPin,""):this.removeAttribute(Vi.AskDataAttributes.ShowPin)}get showShare(){return this.hasAttribute(Vi.AskDataAttributes.ShowShare)}set showShare(e){e?this.setAttribute(Vi.AskDataAttributes.ShowShare,""):this.removeAttribute(Vi.AskDataAttributes.ShowShare)}get showSave(){return this.hasAttribute(Vi.AskDataAttributes.ShowSave)}set showSave(e){e?this.setAttribute(Vi.AskDataAttributes.ShowSave,""):this.removeAttribute(Vi.AskDataAttributes.ShowSave)}}Rv.TableauAskData=dY;var Lv={},aA={},sA={};Object.defineProperty(sA,"__esModule",{value:!0});const qb=sn();class pY{constructor(e){this._registryId=e}getAbstractQueryWithDataModel(){return qb.ApiServiceRegistry.get(this._registryId).getService("EmbeddingVizApiService").getEmbeddingAbstractQueryAsync()}getVizStateWithDataModel(){return qb.ApiServiceRegistry.get(this._registryId).getService("EmbeddingVizApiService").getEmbeddingVizStateWithDataModelAsync()}setVizStateWithDataModel(e){return qb.ApiServiceRegistry.get(this._registryId).getService("EmbeddingVizApiService").setEmbeddingVizStateWithDataModelAsync(e)}}sA.AuthoringWorksheetImpl=pY;var lA={};Object.defineProperty(lA,"__esModule",{value:!0});class fY{constructor(e){this._authoringWorksheetImpl=e}getAbstractQueryWithDataModelAsync(){return this._authoringWorksheetImpl.getAbstractQueryWithDataModel()}getVizStateWithDataModelAsync(){return this._authoringWorksheetImpl.getVizStateWithDataModel()}setVizStateWithDataModelAsync(e){return this._authoringWorksheetImpl.setVizStateWithDataModel(e)}}lA.AuthoringWorksheet=fY;var mY=$e&&$e.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(aA,"__esModule",{value:!0});const RD=mY(Nt),gY=sn(),yY=sA,_Y=lA;class vY{constructor(e,n){this._workbookImpl=e,this._registryId=n}get activeSheet(){if(this._workbookImpl.activeSheet.sheetType===RD.SheetType.Worksheet){const e=new yY.AuthoringWorksheetImpl(this._registryId);return new _Y.AuthoringWorksheet(e)}throw new gY.TableauError(RD.EmbeddingErrorCodes.InvalidSheetType,"Worksheet type not yet supported in Authoring")}}aA.AuthoringWorkbook=vY;var cA={},OO={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Tc;t.VizUrlMode={Viewing:"views",Authoring:"authoring"};class n{constructor(u,d){this._url=u,this._segments=d}get mode(){return this._segments.mode}get siteId(){return this._segments.siteId}get workbookId(){return this._segments.workbookId}get sheetId(){return this._segments.sheetId}get customView(){return this._segments.customView}static create(u){const d=e.canonicalizeVizPortalRoutingHashes(new URL(u.toString())),_=n._parsePathName(d.pathname);return d.pathname=n._buildPathName(_),new n(d,_)}toURL(){return new URL(this.toString())}toString(){return this._url.toString()}withMode(u){if(this._segments.mode===u)return this;const d=this._getSegmentsForMode(u);return this._makeVizUrlFromPathSegments(d)}withCustomView(u){var d;if(u.luid===((d=this.customView)===null||d===void 0?void 0:d.luid)&&u.name===this.customView.name)return this;const _=this._getSegmentsForMode(this.mode);return _.customView=u,this._makeVizUrlFromPathSegments(_)}withSheetId(u){if(this.sheetId===u)return this;const d=Object.assign(Object.assign({},this._segments),{sheetId:u});return this._makeVizUrlFromPathSegments(d)}withWorkbookId(u){if(this.workbookId===u)return this;const d=Object.assign(Object.assign({},this._segments),{workbookId:u});return this._makeVizUrlFromPathSegments(d)}_getSegmentsForMode(u){return u===t.VizUrlMode.Authoring&&(this._segments.customView=void 0),Object.assign(Object.assign({},this._segments),{mode:u})}_makeVizUrlFromPathSegments(u){const d=n._buildPathName(u),_=new URL(this._url.toString());return _.pathname=d,new n(_,u)}static _parsePathName(u){var d,_,l;const w=u.split("/").filter(j=>j);if(w.length===0)throw new Error("Invalid path name");let T;if(w[0]==="t"){if(w.length<2)throw new Error(`Invalid site in path '${u}'`);T=w[1],w.splice(0,2)}const C=w.shift();if(!C)throw new Error(`Missing mode in path '${u}'`);const P=C;if(!Object.values(t.VizUrlMode).includes(P))throw new Error(`Invalid Viz Url Mode '${C}' in path '${u}'`);if(w.length===0)throw new Error(`Missing workbook/sheet name in path '${u}'`);const z=(d=w.shift(),d??""),W=w.shift();if(w.length!==0&&w.length!==2)throw new Error(`Invalid path name: unknown parts after sheet id: '${u}'`);let U;if(w.length===2){const j=(_=w.shift(),_??""),L=(l=w.shift(),l??"");U={luid:j,name:L}}return{mode:P,siteId:T,workbookId:z,sheetId:W,customView:U}}static _buildPathName(u){const d=[];return u.siteId&&(d.push("t"),d.push(u.siteId)),d.push(u.mode),u.workbookId&&d.push(u.workbookId),u.sheetId&&d.push(u.sheetId),u.customView&&u.mode===t.VizUrlMode.Viewing&&(d.push(u.customView.luid),d.push(u.customView.name)),d.join("/")}}t.VizUrl=n})(OO);(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Nt,n=hr(),a=sn(),u=Tc,d=OO;var _;(function(P){P[P.Viewing=0]="Viewing",P[P.Authoring=1]="Authoring"})(_=t.EmbeddingUrlMode||(t.EmbeddingUrlMode={}));const l=new Map([[_.Viewing,d.VizUrlMode.Viewing],[_.Authoring,d.VizUrlMode.Authoring]]);class w extends u.EmbeddingUrlBuilder{constructor(z){super(),this._url=z,this._optionNames=n.VizOptionNames}appendFilters(z){for(const W of z)this._url.searchParams.append(W.field,W.value);return this}appendParams(z){for(const W of z)this._url.searchParams.append(W.name,W.value);return this}sanitizeParameterValue(z,W){let U;switch(z){case n.VizOptionNames.hideTabs:U=this.sanitizeValue(!W);break;case n.VizOptionNames.toolbar:U=this.sanitizeValue(W===e.Toolbar.Hidden?!1:W);break;default:U=this.sanitizeValue(W);break}return U}}t.EmbeddingVizUrlBuilder=w;function T(P,z,W,U,j,L,V){if(!P)throw new a.TableauError(e.EmbeddingErrorCodes.InternalError,"We should not have attempted to render the component without a src");const R=l.get(z);if(!R)throw new a.TableauError(e.EmbeddingErrorCodes.InternalError,`'${z}' is not yet supported.`);const F=P.split("?")[0];let H;try{H=new URL(F),u.validateUrl(H)}catch(se){throw new a.TableauError(e.EmbeddingErrorCodes.InvalidUrl,se.message)}try{H=d.VizUrl.create(F).withMode(R).toURL()}catch{}const Q=C(H,U),te=new w(H).appendDefaultParameters(Q).appendUserOptions(W).appendFilters(j).appendParams(L).appendCustomParams(V);return W.iframeAuth&&te.setToken(W.token),te.build()}t.createVizUrl=T;function C(P,z){const W=new Map;W.set(n.VizOptionNames.Embed,u.SANITIZED_VALUES.YES_VALUE),W.set(n.VizOptionNames.ApiID,`embhost${z}`),P.hostname==="public.tableau.com"&&W.set(n.VizOptionNames.ShowVizHome,u.SANITIZED_VALUES.NO_VALUE);const U=`${n.INTERNAL_CONTRACT_VERSION.major}.${n.INTERNAL_CONTRACT_VERSION.minor}.${n.INTERNAL_CONTRACT_VERSION.fix}`;W.set(n.VizOptionNames.ApiInternalVersion,U);const j=a.ApiVersion.Instance.formattedValue;return W.set(n.VizOptionNames.ApiExternalVersion,j),W.set(n.VizOptionNames.NavType,"0"),W.set(n.VizOptionNames.NavSrc,"Opt"),W}})(cA);var Wd={},uA={},hA={};Object.defineProperty(hA,"__esModule",{value:!0});class xY{constructor(e){this._vizSize=e}get vizSize(){return this._vizSize}}hA.FirstVizSizeKnownEvent=xY;var dA={};Object.defineProperty(dA,"__esModule",{value:!0});class bY{constructor(e,n){this._oldSheetName=e,this._newSheetName=n}get oldSheetName(){return this._oldSheetName}get newSheetName(){return this._newSheetName}}dA.TabSwitchedEvent=bY;var pA={};Object.defineProperty(pA,"__esModule",{value:!0});class wY{constructor(e,n){this._canRedo=e,this._canUndo=n}get canRedo(){return this._canRedo}get canUndo(){return this._canUndo}}pA.ToolbarStateChangedEvent=wY;var fA={},EY=$e&&$e.__awaiter||function(t,e,n,a){function u(d){return d instanceof n?d:new n(function(_){_(d)})}return new(n||(n=Promise))(function(d,_){function l(C){try{T(a.next(C))}catch(P){_(P)}}function w(C){try{T(a.throw(C))}catch(P){_(P)}}function T(C){C.done?d(C.value):u(C.value).then(l,w)}T((a=a.apply(t,e||[])).next())})},SY=$e&&$e.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(fA,"__esModule",{value:!0});const Qs=SY(Nt),by=hr(),rn=sn();class TY extends rn.WorkbookImpl{constructor(e,n){super(),this._registryId=n,this._publishedSheetsInfo=[],this._customViews=new Map,this._name=e.workbookName,this._canDownloadWorkbook=e.canDownloadWorkbook,this.initializeWorkbook(e)}get activeSheet(){return this._activeSheetImpl}get publishedSheetsInfo(){return this._publishedSheetsInfo}get name(){return this._name}get canDownloadWorkbook(){return this._canDownloadWorkbook}get pendingTabSwitchPromise(){return this._pendingTabSwitchPromise}get pendingShowCustomViewPromise(){return this._pendingShowCustomViewPromise}clearPendingShowCustomViewPromise(){this._pendingShowCustomViewPromise=void 0}get activeCustomView(){return this._currentCustomView}activateSheetAsync(e){rn.ErrorHelpers.verifyParameter(e,"sheetNameOrIndex");let n=this.convertSheetIndexToSheetName(e);return rn.ErrorHelpers.verifyParameterType(n,"string","sheetNameOrIndex"),this.validatePublishedSheet(n)||this.verifyDashboardSheets(n),this._activeSheetImpl&&n===this._activeSheetImpl.name?new Promise((d,_)=>{d(this)}):(rn.ApiServiceRegistry.get(this._registryId).getService("viz-service").activateSheetAsync(n),new Promise((d,_)=>{this._pendingTabSwitchPromise={resolve:d,reject:_}}))}getParametersAsync(){return rn.ApiServiceRegistry.get(this._registryId).getService("parameters-service").getAllParametersAsync()}changeParameterValueAsync(e,n){return EY(this,void 0,void 0,function*(){rn.ErrorHelpers.verifyParameter(e,"parameterName");const u=yield rn.ApiServiceRegistry.get(this._registryId).getService("parameters-service").findParameterByNameAsync(e);if(u)return u.changeValueAsync(n).then(()=>u)})}updateExistingActiveSheetReferences(e){if(this._activeSheetImpl){if(this._activeSheetImpl.name===e)return;this._activeSheetImpl.active=!1,this._publishedSheetsInfo.forEach((n,a)=>{n.name===this._activeSheetImpl.name&&(n.active=!1)})}}processCustomViews(e,n){var a;const u=(a=n.currentView)===null||a===void 0?void 0:a.luid;let d=[];switch(e){case by.NotificationId.CustomViewsLoaded:case by.NotificationId.CustomViewSaved:{if(this.refreshCustomViewCache(n),u){const _=this._customViews.get(u);_&&d.push(_)}break}case by.NotificationId.CustomViewRemoved:{let _=new Map(this._customViews);this._customViews.clear(),n.customViewsList.map(l=>{this._customViews.set(l.luid,new rn.CustomViewImpl(l,this._registryId)),_.delete(l.luid)});for(let l of _.values())d.push(l);break}case by.NotificationId.CustomViewSetDefault:{this.refreshCustomViewCache(n);const _=n.customViewsList.find(l=>l.isDefault);_&&d.push(new rn.CustomViewImpl(_,this._registryId));break}}return this._currentCustomView=u?this._customViews.get(u):void 0,d}refreshCustomViewCache(e){this._customViews.clear(),e.customViewsList.map(n=>{this._customViews.set(n.luid,new rn.CustomViewImpl(n,this._registryId))})}revertAllAsync(){return rn.ApiServiceRegistry.get(this._registryId).getService("ToolbarService").revertAllAsync()}getCustomViewsAsync(){return rn.ApiServiceRegistry.get(this._registryId).getService("viz-service").getCustomViewsAsync()}showCustomViewAsync(e){return rn.ApiServiceRegistry.get(this._registryId).getService("viz-service").showCustomViewAsync(e),new Promise((u,d)=>{this._pendingShowCustomViewPromise={resolve:u,reject:d}})}removeCustomViewAsync(e){return rn.ApiServiceRegistry.get(this._registryId).getService("viz-service").removeCustomViewAsync(e)}saveCustomViewAsync(e){return rn.ApiServiceRegistry.get(this._registryId).getService("viz-service").saveCustomViewAsync(e)}setActiveCustomViewAsDefaultAsync(){return rn.ApiServiceRegistry.get(this._registryId).getService("viz-service").setActiveCustomViewAsDefaultAsync()}initializeWorkbook(e){e.publishedSheets.forEach((n,a)=>{const u=rn.SheetUtils.getSheetSizeFromSizeConstraints(n.sizeConstraint),d=n.name===e.currWorksheetName,_=!1,l=rn.SheetUtils.getSheetTypeEnum(n.sheetType),w=new rn.SheetInfoImpl(n.name,l,u,a,d,_,n.url);if(this._publishedSheetsInfo.push(w),d)switch(w.sheetType){case Qs.SheetType.Worksheet:{const T={worksheet:w.name};this._activeSheetImpl=new rn.WorksheetImpl(w,this._registryId,T,null,null);break}case Qs.SheetType.Dashboard:{const T={sheetName:w.name,isDashboard:!0};this._activeSheetImpl=new rn.DashboardImpl(w,e.dashboardZones,T,this._registryId,null);break}case Qs.SheetType.Story:{if(!e.story)throw new rn.TableauError(Qs.SharedErrorCodes.ServerError,"Unable to receive story information from Tableau");this._activeSheetImpl=new rn.StoryImpl(w,e.story,e.publishedSheets,this._registryId);break}default:throw new rn.TableauError(Qs.SharedErrorCodes.ServerError,"Invalid SheetType")}})}convertSheetIndexToSheetName(e){if(typeof e=="number"){const n=e;if(this.publishedSheetsInfo[n])return this.publishedSheetsInfo[n].name;throw new rn.TableauError(Qs.EmbeddingErrorCodes.IndexOutOfRange,`Index ${n} is out of range.`)}return e}validatePublishedSheet(e){return this.publishedSheetsInfo.find(a=>a.name===e)!==void 0}verifyDashboardSheets(e){if(this._activeSheetImpl.sheetType===Qs.SheetType.Dashboard){let n=this._activeSheetImpl,a=n.worksheetsImpl.findIndex(u=>u.name===e);if(a!==-1){if(n.worksheetsImpl[a].hidden)throw new rn.TableauError(Qs.SharedErrorCodes.ServerError,"Cannot activate hidden sheet");return}}throw new rn.TableauError(Qs.EmbeddingErrorCodes.SheetNotInWorkbook,"Sheet is not found in Workbook")}}fA.EmbeddingWorkbookImpl=TY;var wy={},Ey={},Sy={},Ty={},Ay={},Iy={},OD;function mA(){if(OD)return Iy;OD=1;var t=$e&&$e.__importStar||function(d){if(d&&d.__esModule)return d;var _={};if(d!=null)for(var l in d)Object.hasOwnProperty.call(d,l)&&(_[l]=d[l]);return _.default=d,_};Object.defineProperty(Iy,"__esModule",{value:!0});const e=t(Nt),n=sn(),a=Vv();let u=class{constructor(_,l){this._sheetImpl=_,this._workbookImpl=l}get isHidden(){return this._sheetImpl.hidden}get isActive(){return this._sheetImpl.active}get name(){return this._sheetImpl.name}get sheetType(){return this._sheetImpl.sheetType}get size(){if(n.SheetUtils.isValidSheetSize(this._sheetImpl.size))return this._sheetImpl.size;throw new n.TableauError(e.EmbeddingErrorCodes.NotImplemented,"Not implemented")}get url(){if(this.isHidden)throw new n.TableauError(e.EmbeddingErrorCodes.NoUrlForHiddenWorksheet,"No URL for hidden worksheet");return this._sheetImpl.url}get index(){return this._sheetImpl.index}get workbook(){return new a.Workbook(this._workbookImpl)}changeSizeAsync(_){return this._sheetImpl.changeSizeAsync(_)}};return Iy.Sheet=u,Iy}var Cy={},ky={},Py={},FD;function FO(){if(FD)return Py;FD=1,Object.defineProperty(Py,"__esModule",{value:!0});const t=gA();let e=class{constructor(a,u){this._storyPointInfoImpl=a,this._workbookImpl=u}get index(){return this._storyPointInfoImpl.index}get caption(){return this._storyPointInfoImpl.caption}get active(){return this._storyPointInfoImpl.active}get updated(){return this._storyPointInfoImpl.updated}get parentStory(){return new t.Story(this._storyPointInfoImpl.parentStory,this._workbookImpl)}};return Py.StoryPointInfo=e,Py}var LD;function gA(){if(LD)return ky;LD=1;var t=$e&&$e.__importStar||function(l){if(l&&l.__esModule)return l;var w={};if(l!=null)for(var T in l)Object.hasOwnProperty.call(l,T)&&(w[T]=l[T]);return w.default=l,w};Object.defineProperty(ky,"__esModule",{value:!0});const e=t(Nt),n=sn(),a=mA(),u=Bv(),d=FO();let _=class extends a.Sheet{constructor(w,T){super(w,T),this._storyImpl=w}get activeStoryPoint(){if(!this._storyImpl.activeStoryPoint)throw new n.TableauError(e.EmbeddingErrorCodes.ImplementationError,"Active story point has not been initialized");return new u.StoryPoint(this._storyImpl.activeStoryPoint,this._workbookImpl)}get storyPointsInfo(){return this._storyImpl.storyPointsInfo.map(w=>new d.StoryPointInfo(w,this._workbookImpl))}activateNextStoryPointAsync(){return this._storyImpl.activateNextStoryPointAsync().then(w=>new u.StoryPoint(w,this._workbookImpl))}activatePreviousStoryPointAsync(){return this._storyImpl.activatePreviousStoryPointAsync().then(w=>new u.StoryPoint(w,this._workbookImpl))}activateStoryPointAsync(w){return this._storyImpl.activateStoryPointAsync(w).then(T=>new u.StoryPoint(T,this._workbookImpl))}revertStoryPointAsync(w){return this._storyImpl.revertStoryPointAsync(w).then(T=>new d.StoryPointInfo(T,this._workbookImpl))}};return ky.Story=_,ky}var BD;function Bv(){if(BD)return Cy;BD=1;var t=$e&&$e.__importStar||function(l){if(l&&l.__esModule)return l;var w={};if(l!=null)for(var T in l)Object.hasOwnProperty.call(l,T)&&(w[T]=l[T]);return w.default=l,w};Object.defineProperty(Cy,"__esModule",{value:!0});const e=t(Nt),n=sn(),a=Uv(),u=gA(),d=Nv();let _=class{constructor(w,T){this._storyPointImpl=w,this._workbookImpl=T}get index(){return this._storyPointImpl.index}get caption(){return this._storyPointImpl.caption}get active(){return this._storyPointImpl.active}get updated(){return this._storyPointImpl.updated}get containedSheet(){const w=this._storyPointImpl.containedSheet;if(w)switch(w.sheetType){case e.SheetType.Worksheet:return new d.Worksheet(w,this._workbookImpl);case e.SheetType.Dashboard:return new a.Dashboard(w,this._workbookImpl);case e.SheetType.Story:throw new n.TableauError(e.EmbeddingErrorCodes.ImplementationError,"A story cannot contain another story");default:throw new n.TableauError(e.EmbeddingErrorCodes.ImplementationError,"Unable to initialize contained sheet")}}get parentStory(){return new u.Story(this._storyPointImpl.parentStory,this._workbookImpl)}};return Cy.StoryPoint=_,Cy}var ND;function Nv(){if(ND)return Ay;ND=1,Object.defineProperty(Ay,"__esModule",{value:!0});const t=Uv(),e=mA(),n=Bv();let a=class extends e.Sheet{constructor(d,_){super(d,_),this._worksheetImpl=d}get parentDashboard(){return this._worksheetImpl.parentDashboard==null?null:new t.Dashboard(this._worksheetImpl.parentDashboard,this._workbookImpl)}get parentStoryPoint(){return this._worksheetImpl.parentStoryPoint==null?null:new n.StoryPoint(this._worksheetImpl.parentStoryPoint,this._workbookImpl)}getDataSourcesAsync(){return this._worksheetImpl.getDataSourcesAsync()}getSummaryDataAsync(d){return this._worksheetImpl.getSummaryDataAsync(d)}getSummaryDataReaderAsync(d,_){return this._worksheetImpl.getSummaryDataReaderAsync(d,_)}getSummaryColumnsInfoAsync(){return this._worksheetImpl.getSummaryColumnsInfoAsync()}getUnderlyingDataAsync(d){return console.warn("Worksheet.getUnderlyingDataAsync is deprecated. Please use Worksheet.getUnderlyingTablesAsync and Worksheet.getUnderlyingTableDataAsync"),this._worksheetImpl.getUnderlyingDataAsync(d)}getUnderlyingTablesAsync(){return this._worksheetImpl.getUnderlyingTablesAsync()}getUnderlyingTableDataAsync(d,_){return this._worksheetImpl.getUnderlyingTableDataAsync(d,_)}getUnderlyingTableDataReaderAsync(d,_,l){return this._worksheetImpl.getUnderlyingTableDataReaderAsync(d,_,l)}getFiltersAsync(){return this._worksheetImpl.getFiltersAsync()}applyFilterAsync(d,_,l,w){return this._worksheetImpl.applyFilterAsync(d,_,l,w)}applyRangeFilterAsync(d,_){return this._worksheetImpl.applyRangeFilterAsync(d,_)}clearFilterAsync(d){return this._worksheetImpl.clearFilterAsync(d)}applyRelativeDateFilterAsync(d,_){return this._worksheetImpl.applyRelativeDateFilterAsync(d,_)}applyHierarchicalFilterAsync(d,_,l,w){return this._worksheetImpl.applyHierarchicalFilterAsync(d,_,l,w)}clearSelectedMarksAsync(){return this._worksheetImpl.clearSelectedMarksAsync()}getSelectedMarksAsync(){return this._worksheetImpl.getSelectedMarksAsync()}annotateMarkAsync(d,_){return this._worksheetImpl.annotateMarkAsync(d,_)}getAnnotationsAsync(){return this._worksheetImpl.getAnnotationsAsync()}removeAnnotationAsync(d){return this._worksheetImpl.removeAnnotationAsync(d)}selectMarksByValueAsync(d,_){return this._worksheetImpl.selectMarksByValueAsync(d,_)}appendContextMenuAsync(d,_){return this._worksheetImpl.appendContextMenuAsync(d,_)}removeContextMenuAsync(d,_){return this._worksheetImpl.removeContextMenuAsync(d,_)}executeContextMenuAsync(d,_){return this._worksheetImpl.executeContextMenuAsync(d,_)}renameContextMenuAsync(d,_,l){return this._worksheetImpl.renameContextMenuAsync(d,_,l)}getVisualSpecificationAsync(){return this._worksheetImpl.getVisualSpecificationAsync()}};return Ay.Worksheet=a,Ay}var UD;function AY(){if(UD)return Ty;UD=1,Object.defineProperty(Ty,"__esModule",{value:!0});const t=Uv(),e=Nv();let n=class{constructor(u,d){this._dashboardObjectImpl=u,this._workbookImpl=d}get dashboard(){return new t.Dashboard(this._dashboardObjectImpl.dashboardImpl,this._workbookImpl)}get type(){return this._dashboardObjectImpl.type}get position(){return this._dashboardObjectImpl.position}get size(){return this._dashboardObjectImpl.size}get worksheet(){if(this._dashboardObjectImpl.worksheetImpl)return new e.Worksheet(this._dashboardObjectImpl.worksheetImpl,this._workbookImpl)}get name(){return this._dashboardObjectImpl.name}get isFloating(){return this._dashboardObjectImpl.isFloating}get isVisible(){return this._dashboardObjectImpl.isVisible}get id(){return this._dashboardObjectImpl.id}};return Ty.DashboardObject=n,Ty}var jD;function Uv(){if(jD)return Sy;jD=1,Object.defineProperty(Sy,"__esModule",{value:!0});const t=AY(),e=mA(),n=Bv(),a=Nv();let u=class extends e.Sheet{constructor(_,l){super(_,l),this._dashboardImpl=_,_.initializeWithPublicInterfaces()}get objects(){return this._dashboardImpl.objects.map(_=>new t.DashboardObject(_,this._workbookImpl))}get worksheets(){return this._dashboardImpl.worksheetsImpl.map(_=>new a.Worksheet(_,this._workbookImpl))}get parentStoryPoint(){return this._dashboardImpl.parentStoryPoint==null?null:new n.StoryPoint(this._dashboardImpl.parentStoryPoint,this._workbookImpl)}getFiltersAsync(){return this._dashboardImpl.getFiltersAsync()}applyFilterAsync(_,l,w,T){return this._dashboardImpl.applyFilterAsync(_,l,w,T)}};return Sy.Dashboard=u,Sy}var jv={};Object.defineProperty(jv,"__esModule",{value:!0});class IY{constructor(e){this.parameterImpl=e}get name(){return this.parameterImpl.name}get currentValue(){return this.parameterImpl.currentValue}get dataType(){return this.parameterImpl.dataType}get allowableValues(){return this.parameterImpl.allowableValues}get id(){return this.parameterImpl.id}changeValueAsync(e){return this.parameterImpl.changeValueAsync(e)}}jv.Parameter=IY;var Dy={},VD;function CY(){if(VD)return Dy;VD=1;var t=$e&&$e.__importStar||function(d){if(d&&d.__esModule)return d;var _={};if(d!=null)for(var l in d)Object.hasOwnProperty.call(d,l)&&(_[l]=d[l]);return _.default=d,_};Object.defineProperty(Dy,"__esModule",{value:!0});const e=t(Nt),n=sn(),a=Vv();let u=class{constructor(_,l){this._sheetInfoImpl=_,this._workbookImpl=l}get name(){return this._sheetInfoImpl.name}get sheetType(){return this._sheetInfoImpl.sheetType}get index(){if(this._sheetInfoImpl.index!==void 0)return this._sheetInfoImpl.index;throw new n.TableauError(e.EmbeddingErrorCodes.ImplementationError,"index not implemented")}get isActive(){return this._sheetInfoImpl.isActive?this._sheetInfoImpl.isActive:!1}get isHidden(){return this._sheetInfoImpl.isHidden?this._sheetInfoImpl.isHidden:!1}get workbook(){return new a.Workbook(this._workbookImpl)}get url(){return this._sheetInfoImpl.url?this._sheetInfoImpl.url:""}get size(){if(n.SheetUtils.isValidSheetSize(this._sheetInfoImpl.sheetSize))return this._sheetInfoImpl.sheetSize;throw new n.TableauError(e.EmbeddingErrorCodes.NotImplemented,"Not implemented")}};return Dy.SheetInfo=u,Dy}var $D;function Vv(){if($D)return Ey;$D=1;var t=$e&&$e.__importStar||function(C){if(C&&C.__esModule)return C;var P={};if(C!=null)for(var z in C)Object.hasOwnProperty.call(C,z)&&(P[z]=C[z]);return P.default=C,P};Object.defineProperty(Ey,"__esModule",{value:!0});const e=t(Nt),n=sn(),a=BO(),u=Uv(),d=jv,_=CY(),l=gA(),w=Nv();let T=class{constructor(P){this._workbookImpl=P}get activeSheet(){switch(this._workbookImpl.activeSheet.sheetType){case e.SheetType.Worksheet:return new w.Worksheet(this._workbookImpl.activeSheet,this._workbookImpl);case e.SheetType.Dashboard:return new u.Dashboard(this._workbookImpl.activeSheet,this._workbookImpl);case e.SheetType.Story:return new l.Story(this._workbookImpl.activeSheet,this._workbookImpl);default:throw new n.TableauError(e.EmbeddingErrorCodes.ImplementationError,"Unable to initialize ActiveSheet")}}get publishedSheetsInfo(){return this._workbookImpl.publishedSheetsInfo.map(P=>new _.SheetInfo(P,this._workbookImpl))}get name(){return this._workbookImpl.name}get activeCustomView(){if(this._workbookImpl.activeCustomView)return new a.CustomView(this._workbookImpl.activeCustomView,this._workbookImpl)}activateSheetAsync(P){return this._workbookImpl.activateSheetAsync(P).then(z=>(this._workbookImpl!==z&&(this._workbookImpl=z),this.activeSheet))}revertAllAsync(){return this._workbookImpl.revertAllAsync()}getCustomViewsAsync(){return this._workbookImpl.getCustomViewsAsync().then(P=>P.map(z=>new a.CustomView(z,this._workbookImpl)))}showCustomViewAsync(P){return this._workbookImpl.showCustomViewAsync(P).then(z=>z?new a.CustomView(z,this._workbookImpl):void 0)}removeCustomViewAsync(P){return this._workbookImpl.removeCustomViewAsync(P).then(z=>new a.CustomView(z,this._workbookImpl))}saveCustomViewAsync(P){return this._workbookImpl.saveCustomViewAsync(P).then(z=>new a.CustomView(z,this._workbookImpl))}setActiveCustomViewAsDefaultAsync(){return this._workbookImpl.setActiveCustomViewAsDefaultAsync()}getParametersAsync(){return this._workbookImpl.getParametersAsync().then(P=>P.map(z=>new d.Parameter(z)))}changeParameterValueAsync(P,z){return this._workbookImpl.changeParameterValueAsync(P,z).then(W=>{if(W)return new d.Parameter(W);throw new n.TableauError(e.EmbeddingErrorCodes.InvalidParameter,`Invalid parameter: ${P}`)})}};return Ey.Workbook=T,Ey}var WD;function BO(){if(WD)return wy;WD=1,Object.defineProperty(wy,"__esModule",{value:!0});const t=Vv();let e=class LO{constructor(a,u){this._customViewImpl=a,this._workbookImpl=u}get name(){return this._customViewImpl.name}set name(a){this._customViewImpl.name=a}get shared(){return this._customViewImpl.shared}set shared(a){this._customViewImpl.shared=a}get default(){return this._customViewImpl.isDefault}set default(a){this._customViewImpl.isDefault=a}get ownerName(){return this._customViewImpl.ownerName}get url(){return this._customViewImpl.url}get workbook(){return new t.Workbook(this._workbookImpl)}saveAsync(){return this._customViewImpl.saveAsync().then(a=>new LO(a,this._workbookImpl))}};return wy.CustomView=e,wy}var yA={};Object.defineProperty(yA,"__esModule",{value:!0});class kY{constructor(e,n){this._sheetSize=e,this._chromeHeight=n}get sheetSize(){return this._sheetSize}get chromeHeight(){return this._chromeHeight}}yA.VizSize=kY;var $v={},Gd={},_A={};Object.defineProperty(_A,"__esModule",{value:!0});const PY=hr(),DY=sn();class MY extends DY.ServiceImplBase{get serviceName(){return"authentication"}setAuthToken(e){const n={authToken:e};return this.execute(PY.VerbId.Authenticate,n).then(a=>{})}}_A.AuthServiceImpl=MY;var vA={};Object.defineProperty(vA,"__esModule",{value:!0});const GD=Nt,xs=hr(),Zb=sn();class zY extends Zb.ServiceImplBase{get serviceName(){return"EmbeddingVizApiService"}getEmbeddingVizStateWithDataModelAsync(){const e=xs.VerbId.GetVizStateWithDataModel,n={[xs.ParameterId.FunctionName]:"getVizStateWithDataModel"};return this.execute(e,n).then(a=>{const u=a.result;return this.checkForErrorParameter(u),{vizStateWithDataModel:u[xs.ParameterId.VizAPIStateWithDataModel]}})}checkForErrorParameter(e){if(e[xs.ParameterId.VizAPIStateWarningMsg])throw new Zb.TableauError(GD.ErrorCodes.InternalError,e[xs.ParameterId.VizAPIStateWarningMsg])}setEmbeddingVizStateWithDataModelAsync(e){const n=xs.VerbId.SetVizStateWithDataModel,a={[xs.ParameterId.FunctionName]:"setVizStateWithDataModel",[xs.ParameterId.VizAPIStateWithDataModel]:e.vizStateWithDataModel};return this.execute(n,a).then(u=>{if(Object.keys(u.result).length!==0){const d=u.result;throw new Zb.TableauError(GD.ErrorCodes.InternalError,d)}})}getEmbeddingAbstractQueryAsync(){const e=xs.VerbId.GetEmbeddingAbstractQueryWithDataModel,n={[xs.ParameterId.FunctionName]:"getEmbeddingAbstractQuery"};return this.execute(e,n).then(a=>a.result)}}vA.EmbeddingVizApiServiceImpl=zY;var xA={};Object.defineProperty(xA,"__esModule",{value:!0});const RY=sn();class OY extends RY.NotificationServiceImplBase{get serviceName(){return"initialization-service"}}xA.InitializationServiceImpl=OY;var bA={};Object.defineProperty(bA,"__esModule",{value:!0});const In=hr(),FY=sn();class LY extends FY.ServiceImplBase{get serviceName(){return"ToolbarService"}revertAllAsync(){const e=In.VerbId.RevertWorkbook,n={[In.ParameterId.FunctionName]:"revertAllAsync"};return this.execute(e,n).then(a=>{})}redoAsync(){const e=In.VerbId.Redo,n={[In.ParameterId.FunctionName]:"redoAsync"};return this.execute(e,n).then(a=>{})}undoAsync(){const e=In.VerbId.Undo,n={[In.ParameterId.FunctionName]:"undoAsync"};return this.execute(e,n).then(a=>{})}exportImageAsync(){const e=In.VerbId.ExportImage,n={[In.ParameterId.FunctionName]:"exportImageAsync"};return this.execute(e,n).then(a=>{})}setAutoUpdateAsync(e){const n=In.VerbId.SetAutoUpdate,a={[In.ParameterId.FunctionName]:"setAutoUpdateAsync",[In.ParameterId.State]:e};return this.execute(n,a).then(()=>{})}displayDownloadWorkbookDialogAsync(){const e=In.VerbId.DownloadWorkbook,n={[In.ParameterId.FunctionName]:"displayDialogAsync(Workbook)"};return this.execute(e,n).then(a=>{})}displayExportPdfDialogAsync(){const e=In.VerbId.ExportPdf,n={[In.ParameterId.FunctionName]:"displayDialogAsync(ExportPDF)"};return this.execute(e,n).then(a=>{})}displayExportPowerpointDialogAsync(){const e=In.VerbId.ExportPowerpoint,n={[In.ParameterId.FunctionName]:"displayDialogAsync(ExportPowerPoint)"};return this.execute(e,n).then(a=>{})}displayExportDataDialogAsync(){const e=In.VerbId.ExportData,n={[In.ParameterId.FunctionName]:"displayDialogAsync(ExportData)"};return this.execute(e,n).then(a=>{})}displayExportCrosstabDialogAsync(){const e=In.VerbId.ExportCrosstab,n={[In.ParameterId.FunctionName]:"displayDialogAsync(ExportCrossTab)"};return this.execute(e,n).then(a=>{})}displayShareDialogAsync(){const e=In.VerbId.Share,n={[In.ParameterId.FunctionName]:"displayDialogAsync(Share)"};return this.execute(e,n).then(a=>{})}}bA.ToolbarServiceImpl=LY;Object.defineProperty(Gd,"__esModule",{value:!0});const fd=sn(),BY=_A,NY=vA,UY=xA,jY=bA;function VY(t,e){const n=fd.ApiServiceRegistry.get(e);n.registerService(new fd.ClientInfoServiceImpl(t,e)),n.registerService(new NY.EmbeddingVizApiServiceImpl(t,e)),n.registerService(new fd.SizeServiceImpl(t,e)),n.registerService(new fd.StoryActivationServiceImpl(t,e)),n.registerService(new jY.ToolbarServiceImpl(t,e))}Gd.registerAllEmbeddingServices=VY;function $Y(t,e){fd.ApiServiceRegistry.get(e).registerService(new UY.InitializationServiceImpl(t))}Gd.registerInitializationEmbeddingServices=$Y;function WY(t,e){fd.ApiServiceRegistry.get(e).registerService(new BY.AuthServiceImpl(t,e))}Gd.registerAuthServices=WY;Object.defineProperty($v,"__esModule",{value:!0});var NO=Gd;$v.registerAllEmbeddingServices=NO.registerAllEmbeddingServices;$v.registerInitializationEmbeddingServices=NO.registerInitializationEmbeddingServices;var Kb=$e&&$e.__awaiter||function(t,e,n,a){function u(d){return d instanceof n?d:new n(function(_){_(d)})}return new(n||(n=Promise))(function(d,_){function l(C){try{T(a.next(C))}catch(P){_(P)}}function w(C){try{T(a.throw(C))}catch(P){_(P)}}function T(C){C.done?d(C.value):u(C.value).then(l,w)}T((a=a.apply(t,e||[])).next())})},GY=$e&&$e.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(uA,"__esModule",{value:!0});const Ir=GY(Nt),Jh=dT,ni=hr(),Qr=sn(),HY=Jm,qY=hA,ZY=dA,KY=pA,HD=fA,XY=BO(),YY=yA,qD=$v,QY=Gd,JY=Fv;class eQ{constructor(e,n,a,u){if(this._viz=e,this._iframe=n,this._frameUrl=a,this._embeddingId=u,this._automaticUpdatesArePaused=!1,this._resizeEventType="resize",!this._iframe)throw new Qr.TableauError(Ir.EmbeddingErrorCodes.InternalError,"Iframe has not been created yet")}get workbookImpl(){return this._workbookImpl}get iframe(){return this._iframe}get embeddingId(){return this._embeddingId}get exportScenariosForPdfAndPowerPoint(){return{currentSheetName:this._workbookImpl.activeSheet.name,exportableSheetNamesFromDashboard:this.exportableSheetNamesFromDashboard,exportableSheetNamesFromWorkbook:this.exportableSheetNamesFromWorkbook}}get exportableSheetNamesFromDashboard(){const e=this._workbookImpl.activeSheet;return e&&e.sheetType===Ir.SheetType.Dashboard?e.getWorksheetNamesFromZones():[]}get exportableSheetNamesFromWorkbook(){const e=[];if(this._workbookImpl)for(const n of this._workbookImpl.publishedSheetsInfo)e.push(n.name);return e}get automaticUpdatesArePaused(){return this._automaticUpdatesArePaused}set automaticUpdatesArePaused(e){this._automaticUpdatesArePaused=e}getVisualIdForSheetName(e){var n,a,u;const d=this._workbookImpl.activeSheet;switch(d.sheetType){case Ir.SheetType.Worksheet:if(d.name===e)return d.visualId;break;case Ir.SheetType.Dashboard:{const _=d;for(const l of _.getWorksheetNamesFromZones())if(l===e)return{worksheet:l,dashboard:_.name};break}case Ir.SheetType.Story:{const _=d,l=(n=_.activeStoryPoint)===null||n===void 0?void 0:n.containedSheet;if(l&&l.sheetType===Ir.SheetType.Worksheet&&l.name===e){const w=Object.assign({},l.visualId);return w.dashboard=w.worksheet,w.storyboard=_.name,w.storyPointID=(a=_.activeStoryPoint)===null||a===void 0?void 0:a.storyPointId,w}else if(l&&l.sheetType===Ir.SheetType.Dashboard){const w=l;for(const T of w.getWorksheetNamesFromZones())if(T===e)return{worksheet:T,dashboard:w.name,storyboard:_.name,storyPointID:(u=_.activeStoryPoint)===null||u===void 0?void 0:u.storyPointId}}break}default:throw new Qr.TableauError(Ir.SharedErrorCodes.ServerError,"Invalid SheetType")}throw new Qr.TableauError(Ir.SharedErrorCodes.InvalidParameter,"sheetName parameter must belong to a worksheet within the current view")}get exportableWorksheetNames(){var e;const n=this._workbookImpl.activeSheet;switch(n.sheetType){case Ir.SheetType.Worksheet:return[n.name];case Ir.SheetType.Dashboard:return n.getWorksheetNamesFromZones();case Ir.SheetType.Story:{const a=(e=n.activeStoryPoint)===null||e===void 0?void 0:e.containedSheet;if(a&&a.sheetType===Ir.SheetType.Worksheet)return[a.name];if(a&&a.sheetType===Ir.SheetType.Dashboard)return a.getWorksheetNamesFromZones();break}}return[]}initializeViz(){const e=this._iframe.contentWindow;if(!e)throw new Qr.TableauError(Ir.EmbeddingErrorCodes.InternalError,"Iframe has not been created yet");try{this._messenger=new ni.CrossFrameMessenger(window,e,this._frameUrl.origin),this._dispatcher=new Qr.CrossFrameDispatcher(this._messenger),qD.registerInitializationEmbeddingServices(this._dispatcher,this.embeddingId),QY.registerAuthServices(this._dispatcher,this.embeddingId);const n=Qr.ApiServiceRegistry.get(this.embeddingId).getService("initialization-service"),a=n.registerHandler(ni.NotificationId.FirstVizSizeKnown,()=>!0,d=>{this.handleVizSizeKnownEvent(d),a()}),u=n.registerHandler(ni.NotificationId.VizInteractive,()=>!0,d=>{this.handleVizInteractiveEvent(d),u()});n.registerHandler(ni.NotificationId.ReadyToReceiveAuthToken,()=>!0,()=>{this._viz.dispatchEvent(new CustomEvent(Ir.EmbeddingTableauEventType.ReadyToReceiveAuthToken,{}))}),n.registerHandler(ni.NotificationId.ToolbarStateChanged,()=>!0,d=>this.handleToolbarStateEvent(d)),n.registerHandler(ni.NotificationId.TabSwitched,()=>!0,d=>this.handleTabSwitch(d)),n.registerHandler(ni.NotificationId.CustomViewsLoaded,()=>!0,d=>this.handleCustomViews(d)),n.registerHandler(ni.NotificationId.CustomViewRemoved,()=>!0,d=>this.handleCustomViewRemoved(d)),n.registerHandler(ni.NotificationId.CustomViewSaved,()=>!0,d=>this.handleCustomViewSaved(d)),n.registerHandler(ni.NotificationId.CustomViewSetDefault,()=>!0,d=>this.handleCustomViewSetDefault(d)),this._messenger.startListening()}catch{throw new Qr.TableauError(Ir.EmbeddingErrorCodes.InternalError,"Unexpected error during initialization.")}}dispose(){this._messenger&&this._messenger.stopListening(),this.removeWindowResizeHandler()}getCurrentSrcAsync(){return Qr.ApiServiceRegistry.get(this.embeddingId).getService("viz-service").getCurrentSrcAsync()}revertAllAsync(){return Qr.ApiServiceRegistry.get(this.embeddingId).getService("ToolbarService").revertAllAsync()}redoAsync(){return Qr.ApiServiceRegistry.get(this.embeddingId).getService("ToolbarService").redoAsync()}undoAsync(){return Qr.ApiServiceRegistry.get(this.embeddingId).getService("ToolbarService").undoAsync()}refreshDataAsync(){return Qr.ApiServiceRegistry.get(this.embeddingId).getService("data-source-service").refreshAsync()}pauseAutomaticUpdatesAsync(){return this._automaticUpdatesArePaused?Promise.resolve():this.setAutoUpdateAsync(!1)}resumeAutomaticUpdatesAsync(){return this._automaticUpdatesArePaused?this.setAutoUpdateAsync(!0):Promise.resolve()}toggleAutomaticUpdatesAsync(){return this.setAutoUpdateAsync(this._automaticUpdatesArePaused)}exportImageAsync(){return Qr.ApiServiceRegistry.get(this.embeddingId).getService("ToolbarService").exportImageAsync()}exportCrosstabAsync(e,n){return Kb(this,void 0,void 0,function*(){yield Qr.ApiServiceRegistry.get(this.embeddingId).getService("export-service").exportCrosstabAsync(e,n,this.exportableWorksheetNames,this._workbookImpl.activeSheet.sheetType)})}exportDataAsync(e,n=Qr.ExportHelpers.DefaultDataOptions){return Qr.ApiServiceRegistry.get(this.embeddingId).getService("export-service").exportDataAsync(this.getVisualIdForSheetName(e),n)}exportPowerPointAsync(e=[]){return Kb(this,void 0,void 0,function*(){const n=Qr.ApiServiceRegistry.get(this.embeddingId).getService("export-service"),a=this.exportScenariosForPdfAndPowerPoint;e.length===0&&e.push(a.currentSheetName),yield n.exportPowerPointAsync(e,a)})}exportPDFAsync(e=[],n=Qr.ExportHelpers.DefaultPDFOptions){return Kb(this,void 0,void 0,function*(){const a=Qr.ApiServiceRegistry.get(this.embeddingId).getService("export-service"),u=this.exportScenariosForPdfAndPowerPoint;e.length===0&&e.push(u.currentSheetName),yield a.exportPDFAsync(e,n,u)})}displayDialogAsync(e){const n=Qr.ApiServiceRegistry.get(this.embeddingId).getService("ToolbarService");switch(e){case Jh.TableauDialogType.ExportWorkbook:if(!this.workbookImpl.canDownloadWorkbook)throw new Qr.TableauError(Ir.EmbeddingErrorCodes.DownloadWorkbookNotAllowed,"Download workbook is not allowed");return n.displayDownloadWorkbookDialogAsync();case Jh.TableauDialogType.ExportPDF:return n.displayExportPdfDialogAsync();case Jh.TableauDialogType.ExportPowerPoint:return n.displayExportPowerpointDialogAsync();case Jh.TableauDialogType.ExportData:return n.displayExportDataDialogAsync();case Jh.TableauDialogType.ExportCrossTab:return n.displayExportCrosstabDialogAsync();case Jh.TableauDialogType.Share:return n.displayShareDialogAsync();default:throw new Qr.TableauError(Ir.EmbeddingErrorCodes.UnknownDialogType,"Unknown dialog type")}}setAuthToken(e){Qr.ApiServiceRegistry.get(this.embeddingId).getService("authentication").setAuthToken(e)}setAutoUpdateAsync(e){return Qr.ApiServiceRegistry.get(this.embeddingId).getService("ToolbarService").setAutoUpdateAsync(e).then(()=>{this._automaticUpdatesArePaused=!e})}isVersionCompatible(e){return e?ni.VersionLessThan(ni.INTERNAL_CONTRACT_VERSION,e)||ni.VersionEqualTo(ni.INTERNAL_CONTRACT_VERSION,e):!1}updateIframeTitle(e){this._iframe.setAttribute("title",HY.getLocalizedTitle(navigator.language)+": "+e.workbookName+": "+e.currWorksheetName)}handleVizInteractiveEvent(e){if(!this._viz.disableVersionCheck&&!this.isVersionCompatible(e.platformVersion))throw this._messenger.stopListening(),new Qr.TableauError(Ir.EmbeddingErrorCodes.IncompatibleVersionError,"The version of the Embedding library is not compatible with the version of Tableau. The visualization will load, but the Embedding API methods and events are not available.");this.updateIframeTitle(e),Qr.registerAllSharedServices(this._dispatcher,this.embeddingId),qD.registerAllEmbeddingServices(this._dispatcher,this.embeddingId),this._viz.initializeEvents(),this._workbookImpl=new HD.EmbeddingWorkbookImpl(e,this.embeddingId);let n=[];this._customViewsTemp&&(n=this._workbookImpl.processCustomViews(ni.NotificationId.CustomViewsLoaded,this._customViewsTemp)),this._viz.dispatchEvent(new CustomEvent(Ir.EmbeddingTableauEventType.FirstInteractive)),this._customViewsTemp&&(this.sendCustomViewEvents(Ir.EmbeddingTableauEventType.CustomViewLoaded,n),this._customViewsTemp=null)}handleVizSizeKnownEvent(e){const n=Qr.SheetUtils.getSheetSizeFromSizeConstraints(e.sheetSize);this._vizSize=new YY.VizSize(n,e.chromeHeight);const a=new qY.FirstVizSizeKnownEvent(this._vizSize);this._viz.dispatchEvent(new CustomEvent(Ir.EmbeddingTableauEventType.FirstVizSizeKnown,{detail:a})),!this._viz.fixedSize&&(this.resize(),this.addWindowResizeHandler())}resize(){const{height:e,width:n}=this.calculateLayoutSize();e!==this._vizSize.chromeHeight&&(this._iframe.style.height=e+"px",this._iframe.style.width=n+"px")}calculateLayoutSize(){const e=this._viz.parentElement?JY.HtmlElementHelpers.getContentSize(this._viz.parentElement):{height:0,width:0},{chromeHeight:n,sheetSize:a}=this._vizSize;let u=0,d=0;const _=a.minSize||{height:0,width:0},l=a.maxSize||{height:0,width:0};if(a.behavior===Ir.SheetSizeBehavior.Exactly)u=l.width,d=l.height+n;else{let w,T,C,P;switch(a.behavior){case Ir.SheetSizeBehavior.Range:w=_.width,T=l.width,C=_.height+n,P=l.height+n,u=Math.max(w,Math.min(T,e.width)),d=Math.max(C,Math.min(P,e.height));break;case Ir.SheetSizeBehavior.AtLeast:w=_.width,C=_.height+n,u=Math.max(w,e.width),d=Math.max(C,e.height);break;case Ir.SheetSizeBehavior.AtMost:T=l.width,P=l.height+n,u=Math.min(T,e.width),d=Math.min(P,e.height);break;case Ir.SheetSizeBehavior.Automatic:u=e.width,d=Math.max(e.height,n);break;default:throw new Qr.TableauError(Ir.EmbeddingErrorCodes.InvalidSizeBehavior,"Unknown SheetSizeBehavior for viz: "+a.behavior)}}return{height:d,width:u}}removeWindowResizeHandler(){this._windowResizeHandler&&window.removeEventListener(this._resizeEventType,this._windowResizeHandler)}addWindowResizeHandler(){this._windowResizeHandler||(this._windowResizeHandler=this.resize.bind(this),window.addEventListener(this._resizeEventType,this._windowResizeHandler))}handleToolbarStateEvent(e){const n=new KY.ToolbarStateChangedEvent(e.toolbarState.canRedo,e.toolbarState.canUndo);this._viz.dispatchEvent(new CustomEvent(Ir.EmbeddingTableauEventType.ToolbarStateChanged,{detail:n}))}handleTabSwitch(e){if(!this._workbookImpl||!e.oldSheetName)return;this.updateIframeTitle(e);const n=this._workbookImpl.pendingTabSwitchPromise;this._workbookImpl.updateExistingActiveSheetReferences(e.currWorksheetName),this._workbookImpl=new HD.EmbeddingWorkbookImpl(e,this.embeddingId),n&&n.resolve(this._workbookImpl);const a=new ZY.TabSwitchedEvent(e.oldSheetName,e.currWorksheetName);this._viz.dispatchEvent(new CustomEvent(Ir.EmbeddingTableauEventType.TabSwitched,{detail:a}))}handleCustomViews(e){if(!this._workbookImpl)this._customViewsTemp=e;else{const n=this._workbookImpl.processCustomViews(ni.NotificationId.CustomViewsLoaded,e),a=this._workbookImpl.pendingShowCustomViewPromise;if(a){const u=n[0];a.resolve(u),this._workbookImpl.clearPendingShowCustomViewPromise()}this.sendCustomViewEvents(Ir.EmbeddingTableauEventType.CustomViewLoaded,n)}}handleCustomViewRemoved(e){const n=this._workbookImpl.processCustomViews(ni.NotificationId.CustomViewRemoved,e);this.sendCustomViewEvents(Ir.EmbeddingTableauEventType.CustomViewRemoved,n)}handleCustomViewSaved(e){const n=this._workbookImpl.processCustomViews(ni.NotificationId.CustomViewSaved,e);this.sendCustomViewEvents(Ir.EmbeddingTableauEventType.CustomViewSaved,n)}handleCustomViewSetDefault(e){const n=this._workbookImpl.processCustomViews(ni.NotificationId.CustomViewSetDefault,e);this.sendCustomViewEvents(Ir.EmbeddingTableauEventType.CustomViewSetDefault,n)}sendCustomViewEvents(e,n){for(let a of n){const u={customView:new XY.CustomView(a,this._workbookImpl)};this._viz.dispatchEvent(new CustomEvent(e,{detail:u}))}}}uA.VizImpl=eQ;var ZD=$e&&$e.__awaiter||function(t,e,n,a){function u(d){return d instanceof n?d:new n(function(_){_(d)})}return new(n||(n=Promise))(function(d,_){function l(C){try{T(a.next(C))}catch(P){_(P)}}function w(C){try{T(a.throw(C))}catch(P){_(P)}}function T(C){C.done?d(C.value):u(C.value).then(l,w)}T((a=a.apply(t,e||[])).next())})},tQ=$e&&$e.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(Wd,"__esModule",{value:!0});const Ei=tQ(Nt),rQ=hr(),KD=sn(),nQ=uA,iQ=Tc,XD=Uu,YD=Jm;class UO extends YD.TableauWebComponent{disconnectedCallback(){super.disconnectedCallback(),this._vizImpl&&this._vizImpl.dispose()}static get observedAttributes(){return[...super.observedAttributes,...Object.values(Ei.VizSharedAttributes)]}updateRenderingIfInitialized(e){return ZD(this,void 0,void 0,function*(){if(this._initialized)return this._vizImpl&&this._vizImpl.dispose(),XD.WebComponentManager.unregisterWebComponent(this._embeddingIdCounter),this.updateRendering(e)})}updateRendering(e){return ZD(this,void 0,void 0,function*(){try{if(this._initialized=!0,!e){console.debug(`A src needs to be set on the ${this.tagName.toLowerCase()} element. Skipping rendering.`);return}if((yield this.auth(iQ.getSiteId(e)))===YD.TableauAuthResponse.Failure){console.debug("Authentication failed.");return}if(!this.src){console.debug(`A src needs to be set on the ${this.tagName.toLowerCase()} element. Skipping rendering.`);return}if(!this.iframe){console.debug("No iframe available to update the src.");return}this._embeddingIdCounter=XD.WebComponentManager.registerWebComponent(this),this.registerAttributeEvents();const a=this.createFrameUrlWithParams();this._vizImpl=this.createAndInitializeVizImpl(a),this.iframe.src=a.toString(),this.raiseIframeSrcUpdatedNotification();return}catch(n){console.debug(n)}})}createAndInitializeVizImpl(e){const n=new nQ.VizImpl(this,this.iframe,e,this._embeddingIdCounter);return n.initializeViz(),n}registerAttributeEvents(){this.getAttributeEvents().forEach(e=>{const[n,a]=e;this.registerCallback(n,a)})}initializeEvents(){let e;try{e=KD.ApiServiceRegistry.get(this.vizImpl.embeddingId).getService("notification-service")}catch{throw new KD.TableauError(Ei.EmbeddingErrorCodes.EventInitializationError,"Event initialization failed")}const n=this.getRegisteredEvents();for(const[a,u,d]of n)e.registerHandler(a,u,d)}getRegisteredEvents(){return[[rQ.NotificationId.EditInDesktopButtonClicked,()=>!0,()=>this.dispatchEvent(new CustomEvent(Ei.EmbeddingTableauEventType.EditInDesktopButtonClicked))]]}get touchOptimize(){return this.hasAttribute(Ei.VizSharedAttributes.TouchOptimize)}set touchOptimize(e){e?this.setAttribute(Ei.VizSharedAttributes.TouchOptimize,""):this.removeAttribute(Ei.VizSharedAttributes.TouchOptimize)}get vizImpl(){return this._vizImpl}get hideEditInDesktopButton(){return this.hasAttribute(Ei.VizSharedAttributes.HideEditInDesktopButton)}set hideEditInDesktopButton(e){e?this.setAttribute(Ei.VizSharedAttributes.HideEditInDesktopButton,""):this.removeAttribute(Ei.VizSharedAttributes.HideEditInDesktopButton)}get suppressDefaultEditBehavior(){return this.hasAttribute(Ei.VizSharedAttributes.SuppressDefaultEditBehavior)}set suppressDefaultEditBehavior(e){e?this.setAttribute(Ei.VizSharedAttributes.SuppressDefaultEditBehavior,""):this.removeAttribute(Ei.VizSharedAttributes.SuppressDefaultEditBehavior)}get disableVersionCheck(){return this.hasAttribute(Ei.VizSharedAttributes.DisableVersionCheck)}set disableVersionCheck(e){e?this.setAttribute(Ei.VizSharedAttributes.DisableVersionCheck,""):this.removeAttribute(Ei.VizSharedAttributes.DisableVersionCheck)}getCurrentSrcAsync(){return this.vizImpl.getCurrentSrcAsync()}resize(){this.vizImpl.resize()}}Wd.TableauVizBase=UO;UO.VizAttributeDefaults={device:Ei.DeviceType.Default,toolbar:Ei.Toolbar.Bottom};function oQ(t){if(!t||t.length<1)return"";const e=t.toLowerCase();return e[0].toUpperCase()+e.substring(1)}Wd.attributeToEnumKey=oQ;var aQ=$e&&$e.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(Lv,"__esModule",{value:!0});const Fn=aQ(Nt),Xb=hr(),sQ=aA,QD=cA,lQ=Wd;class cQ extends lQ.TableauVizBase{static get observedAttributes(){return[...super.observedAttributes,...Object.values(Fn.VizAuthoringAttributes)]}getAttributeEvents(){return[[Fn.VizSharedAttributes.OnEditInDesktopButtonClicked,Fn.EmbeddingTableauEventType.EditInDesktopButtonClicked],[Fn.VizSharedAttributes.OnFirstInteractive,Fn.EmbeddingTableauEventType.FirstInteractive],[Fn.VizSharedAttributes.OnFirstVizSizeKnown,Fn.EmbeddingTableauEventType.FirstVizSizeKnown],[Fn.VizAuthoringAttributes.OnWorkbookPublished,Fn.EmbeddingTableauEventType.WorkbookPublished],[Fn.VizAuthoringAttributes.OnWorkbookPublishedAs,Fn.EmbeddingTableauEventType.WorkbookPublishedAs],[Fn.VizAuthoringAttributes.OnWorkbookReadyToClose,Fn.EmbeddingTableauEventType.WorkbookReadyToClose],[Fn.VizAttributes.OnReadyToReceiveAuthToken,Fn.EmbeddingTableauEventType.ReadyToReceiveAuthToken]]}createFrameUrlWithParams(){const e=this.constructVizqlOptions(),n=this.readCustomParamsFromChildren();return QD.createVizUrl(this.src,QD.EmbeddingUrlMode.Authoring,e,this._embeddingIdCounter,[],[],n)}constructVizqlOptions(){return{token:this.token,touchOptimize:this.touchOptimize,hideEditInDesktopButton:this.hideEditInDesktopButton,suppressDefaultEditBehavior:this.suppressDefaultEditBehavior,hideCloseButton:this.hideCloseButton,debug:this.debug,iframeAuth:this.iframeAuth}}getRegisteredEvents(){return super.getRegisteredEvents().concat([[Xb.NotificationId.WorkbookPublished,()=>!0,()=>this.dispatchEvent(new CustomEvent(Fn.EmbeddingTableauEventType.WorkbookPublished))],[Xb.NotificationId.WorkbookPublishedAs,()=>!0,e=>this.handleWorkbookPublishedAsEvent(e)],[Xb.NotificationId.WorkbookReadyToClose,()=>!0,()=>this.dispatchEvent(new CustomEvent(Fn.EmbeddingTableauEventType.WorkbookReadyToClose))]])}handleWorkbookPublishedAsEvent(e){const n={newUrl:e.newUrl};this.dispatchEvent(new CustomEvent(Fn.EmbeddingTableauEventType.WorkbookPublishedAs,{detail:n}))}set hideCloseButton(e){e?this.setAttribute(Fn.VizAuthoringAttributes.HideCloseButton,""):this.removeAttribute(Fn.VizAuthoringAttributes.HideCloseButton)}get hideCloseButton(){return this.hasAttribute(Fn.VizAuthoringAttributes.HideCloseButton)}get workbook(){return new sQ.AuthoringWorkbook(this.vizImpl.workbookImpl,this.vizImpl.embeddingId)}setAuthToken(e){this.vizImpl.setAuthToken(e)}}Lv.TableauAuthoringViz=cQ;var Wv={},Gv={};Object.defineProperty(Gv,"__esModule",{value:!0});const uQ=Nt,Jl=hr(),jO=sn(),VO=Tc;function hQ(t,e,n){const a=t.split("?")[0];let u;try{u=new URL(a),VO.validateUrl(u)}catch(l){throw new jO.TableauError(uQ.EmbeddingErrorCodes.InvalidUrl,l.message)}const d=dQ();return new $O(u).appendDefaultParameters(d).appendUserOptions(e).appendCustomParams(n).build()}Gv.createPulseUrl=hQ;function dQ(t){const e=new Map,n=`${Jl.INTERNAL_CONTRACT_VERSION.major}.${Jl.INTERNAL_CONTRACT_VERSION.minor}.${Jl.INTERNAL_CONTRACT_VERSION.fix}`;e.set(Jl.PulseOptionNames.ApiInternalVersion,n),e.set(Jl.PulseOptionNames.embed,"y");const a=jO.ApiVersion.Instance.formattedValue;return e.set(Jl.PulseOptionNames.ApiExternalVersion,a),e.set(Jl.PulseOptionNames.PulseWebComponent,"true"),e}class $O extends VO.EmbeddingUrlBuilder{constructor(e){super(),this._url=e,this._optionNames=Jl.PulseOptionNames}sanitizeParameterValue(e,n){return this.sanitizeValue(n)}}Gv.EmbeddingPulseUrlBuilder=$O;var JD=$e&&$e.__awaiter||function(t,e,n,a){function u(d){return d instanceof n?d:new n(function(_){_(d)})}return new(n||(n=Promise))(function(d,_){function l(C){try{T(a.next(C))}catch(P){_(P)}}function w(C){try{T(a.throw(C))}catch(P){_(P)}}function T(C){C.done?d(C.value):u(C.value).then(l,w)}T((a=a.apply(t,e||[])).next())})};Object.defineProperty(Wv,"__esModule",{value:!0});const bs=Nt,pQ=Gv,fQ=Tc,eM=Uu,mQ=Wd,tM=Jm;class gQ extends tM.TableauWebComponent{constructor(){super()}static get observedAttributes(){return[...super.observedAttributes,...Object.values(bs.PulseAttributes)]}updateRenderingIfInitialized(e){return JD(this,void 0,void 0,function*(){if(this._initialized)return eM.WebComponentManager.unregisterWebComponent(this._embeddingIdCounter),this.updateRendering(e)})}updateRendering(e){return JD(this,void 0,void 0,function*(){try{if(this._initialized=!0,!e){console.debug(`A src needs to be set on the ${this.tagName.toLowerCase()} element. Skipping rendering.`);return}if(!this.token){console.debug(`A token needs to be set on the ${this.tagName.toLowerCase()} element. Skipping rendering.`);return}if((yield this.auth(fQ.getSiteIdForPulse(e)))===tM.TableauAuthResponse.Failure){console.debug("Authentication failed.");return}if(!this.src){console.debug(`A src needs to be set on the ${this.tagName.toLowerCase()} element. Skipping rendering.`);return}if(!this.iframe){console.debug("No iframe available to update the src.");return}const a=this.readCustomParamsFromChildren();this._embeddingIdCounter=eM.WebComponentManager.registerWebComponent(this);const u=pQ.createPulseUrl(this.src,this.constructOptions(),a).toString();this.iframe.src=u,this.raiseIframeSrcUpdatedNotification();return}catch(n){console.warn(n)}})}constructOptions(){const e={token:this.token};return this.disableExploreFilter&&(e.disableExploreFilter=this.disableExploreFilter),this.layout&&this.layout!==bs.PulseLayout.Default&&(e.layout=this.layout),e}get disableExploreFilter(){return this.hasAttribute(bs.PulseAttributes.DisableExploreFilter)}set disableExploreFilter(e){e?this.setAttribute(bs.PulseAttributes.DisableExploreFilter,""):this.removeAttribute(bs.PulseAttributes.DisableExploreFilter)}get layout(){const e=mQ.attributeToEnumKey(this.getAttribute(bs.PulseAttributes.Layout)),n=bs.PulseLayout[e];return n||bs.PulseLayout.Default}set layout(e){e?this.setAttribute(bs.PulseAttributes.Layout,e):this.removeAttribute(bs.PulseAttributes.Layout)}}Wv.TableauPulse=gQ;var Hv={},wA={},Hd={},EA={};Object.defineProperty(EA,"__esModule",{value:!0});class yQ{constructor(e,n){this._sheet=n}get sheet(){return this._sheet}}EA.TableauSheetEvent=yQ;Object.defineProperty(Hd,"__esModule",{value:!0});const _Q=EA;class vQ extends _Q.TableauSheetEvent{constructor(e,n){super(e,n),this._worksheet=n}get worksheet(){return this._worksheet}}Hd.TableauWorksheetEvent=vQ;Object.defineProperty(wA,"__esModule",{value:!0});const xQ=Nt,bQ=Hd;class wQ extends bQ.TableauWorksheetEvent{constructor(e,n){super(xQ.EmbeddingTableauEventType.CustomMarkContextMenuEvent,e),this._contextMenuId=n}getContextMenuId(){return this._contextMenuId}getSelectedMarksAsync(){return this.worksheet.getSelectedMarksAsync()}}wA.CustomMarkContextMenuEvent=wQ;var SA={};Object.defineProperty(SA,"__esModule",{value:!0});const rM=Nt,EQ=sn(),SQ=Hd;class TQ extends SQ.TableauWorksheetEvent{constructor(e,n,a){super(rM.EmbeddingTableauEventType.FilterChanged,e),this._fieldName=n,this._fieldId=a}get fieldName(){return this._fieldName}get fieldId(){return this._fieldId}getFilterAsync(){return this.worksheet.getFiltersAsync().then(e=>{const n=this.fieldId?e.find(a=>a.fieldId===this.fieldId,this):e.find(a=>a.fieldName===this.fieldName,this);if(!n)throw new EQ.TableauError(rM.EmbeddingErrorCodes.FilterMissingOrNotImplemented,`Cannot find filter: ${this._fieldName}.`);return n})}}SA.FilterChangedEvent=TQ;var TA={};Object.defineProperty(TA,"__esModule",{value:!0});const AQ=Nt,IQ=Hd;class CQ extends IQ.TableauWorksheetEvent{constructor(e){super(AQ.EmbeddingTableauEventType.MarkSelectionChanged,e)}getMarksAsync(){return this.worksheet.getSelectedMarksAsync()}}TA.MarksSelectedEvent=CQ;var AA={};Object.defineProperty(AA,"__esModule",{value:!0});const kQ=Nt,nM=sn(),PQ=jv;class DQ{constructor(e,n){this._globalFieldName=e,this._embeddingId=n}getParameterAsync(){return nM.ApiServiceRegistry.get(this._embeddingId).getService("parameters-service").findParameterByGlobalFieldNameAsync(this._globalFieldName).then(n=>{if(n===void 0)throw new nM.TableauError(kQ.EmbeddingErrorCodes.MissingParameter,`Cannot find parameter: ${this._globalFieldName}`);return new PQ.Parameter(n)})}}AA.ParameterChangedEvent=DQ;var IA={};Object.defineProperty(IA,"__esModule",{value:!0});const MQ=Bv(),zQ=FO();class RQ{constructor(e,n,a){this._oldStoryPointInfoImpl=e,this._currStoryPointImpl=n,this._workbookImpl=a}get oldStoryPointInfo(){return new zQ.StoryPointInfo(this._oldStoryPointInfoImpl,this._workbookImpl)}get newStoryPoint(){return new MQ.StoryPoint(this._currStoryPointImpl,this._workbookImpl)}}IA.StoryPointSwitchedEvent=RQ;var CA={};Object.defineProperty(CA,"__esModule",{value:!0});const OQ=Nt,FQ=Hd;class LQ extends FQ.TableauWorksheetEvent{constructor(e){super(OQ.EmbeddingTableauEventType.SummaryDataChanged,e)}}CA.SummaryDataChangedEvent=LQ;var kA={};Object.defineProperty(kA,"__esModule",{value:!0});class BQ{constructor(e,n){this._url=e,this._target=n}get url(){return this._url}get target(){return this._target}}kA.UrlActionEvent=BQ;var NQ=$e&&$e.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(Hv,"__esModule",{value:!0});const wt=NQ(Nt),Yl=hr(),Zf=sn(),UQ=wA,jQ=SA,VQ=TA,$Q=AA,WQ=IA,GQ=CA,HQ=kA,iM=cA,qQ=Vv(),ZQ=Uu,Kf=Wd;let KQ=class extends Kf.TableauVizBase{constructor(){super(...arguments),this.preInitFilters=[]}readFiltersFromChild(){const e=[];return[].forEach.call(this.children,n=>{n.localName===wt.VizChildElements.VizFilter&&n.getAttribute(wt.VizChildElementAttributes.Field)&&n.getAttribute(wt.VizChildElementAttributes.Value)!==void 0&&e.push({field:n.getAttribute(wt.VizChildElementAttributes.Field),value:n.getAttribute(wt.VizChildElementAttributes.Value)})}),e}readParametersFromChild(){const e=[];return[].forEach.call(this.children,n=>{n.localName===wt.VizChildElements.VizParameter&&n.getAttribute(wt.VizChildElementAttributes.Name)&&n.getAttribute(wt.VizChildElementAttributes.Value)&&e.push({name:n.getAttribute(wt.VizChildElementAttributes.Name),value:n.getAttribute(wt.VizChildElementAttributes.Value)})}),e}static get observedAttributes(){return[...super.observedAttributes,...Object.values(wt.VizAttributes)]}disconnectedCallback(){this.preInitFilters=[],super.disconnectedCallback()}createFrameUrlWithParams(){const e=this.constructVizqlOptions(),n=this.readFiltersFromChild().concat(this.preInitFilters),a=this.readParametersFromChild(),u=this.readCustomParamsFromChildren();return iM.createVizUrl(this.src,iM.EmbeddingUrlMode.Viewing,e,this._embeddingIdCounter,n,a,u)}constructVizqlOptions(){return{disableUrlActionsPopups:this.disableUrlActionsPopups,hideTabs:this.hideTabs,toolbar:this.toolbar,instanceIdToClone:this.instanceIdToClone,device:this.device,token:this.token,touchOptimize:this.touchOptimize,hideEditButton:this.hideEditButton,hideEditInDesktopButton:this.hideEditInDesktopButton,suppressDefaultEditBehavior:this.suppressDefaultEditBehavior,debug:this.debug,iframeAuth:this.iframeAuth}}getAttributeEvents(){return[[wt.VizAttributes.OnCustomMarkContextMenuEvent,wt.EmbeddingTableauEventType.CustomMarkContextMenuEvent],[wt.VizAttributes.OnEditButtonClicked,wt.EmbeddingTableauEventType.EditButtonClicked],[wt.VizSharedAttributes.OnEditInDesktopButtonClicked,wt.EmbeddingTableauEventType.EditInDesktopButtonClicked],[wt.VizAttributes.OnFilterChanged,wt.EmbeddingTableauEventType.FilterChanged],[wt.VizSharedAttributes.OnFirstInteractive,wt.EmbeddingTableauEventType.FirstInteractive],[wt.VizSharedAttributes.OnFirstVizSizeKnown,wt.EmbeddingTableauEventType.FirstVizSizeKnown],[wt.VizAttributes.OnMarkSelectionChanged,wt.EmbeddingTableauEventType.MarkSelectionChanged],[wt.VizAttributes.OnParameterChanged,wt.EmbeddingTableauEventType.ParameterChanged],[wt.VizAttributes.OnTabSwitched,wt.EmbeddingTableauEventType.TabSwitched],[wt.VizAttributes.OnToolbarStateChanged,wt.EmbeddingTableauEventType.ToolbarStateChanged],[wt.VizAttributes.OnUrlAction,wt.EmbeddingTableauEventType.UrlAction],[wt.VizAttributes.OnCustomViewLoaded,wt.EmbeddingTableauEventType.CustomViewLoaded],[wt.VizAttributes.OnCustomViewRemoved,wt.EmbeddingTableauEventType.CustomViewRemoved],[wt.VizAttributes.OnCustomViewSaved,wt.EmbeddingTableauEventType.CustomViewSaved],[wt.VizAttributes.OnCustomViewSetDefault,wt.EmbeddingTableauEventType.CustomViewSetDefault],[wt.VizAttributes.OnStoryPointSwitched,wt.EmbeddingTableauEventType.StoryPointSwitched],[wt.VizAttributes.OnSummaryDataChanged,wt.EmbeddingTableauEventType.SummaryDataChanged],[wt.VizAttributes.OnReadyToReceiveAuthToken,wt.EmbeddingTableauEventType.ReadyToReceiveAuthToken]]}getRegisteredEvents(){return super.getRegisteredEvents().concat([[Yl.NotificationId.SelectedMarksChanged,e=>this.shouldNotifyEvent(e),e=>this.handleSelectedMarksChangedEvent(e)],[Yl.NotificationId.FilterChanged,e=>this.shouldNotifyEvent(e.visualId),e=>this.handleFilterChangedEvent(e)],[Yl.NotificationId.EditButtonClicked,()=>!0,()=>this.handleEditButtonClicked()],[Yl.NotificationId.CustomMarkContextMenuClicked,e=>this.shouldNotifyEvent(e.visualId),e=>this.handleCustomMarkClickedContextMenuEvent(e)],[Yl.NotificationId.ParameterChanged,()=>!0,e=>this.handleParameterChangedEvent(e)],[Yl.NotificationId.UrlAction,()=>!0,e=>this.handleUrlAction(e)],[Yl.NotificationId.StoryPointSwitched,()=>!0,e=>this.handleStoryPointSwitch(e)],[Yl.NotificationId.SummaryDataChanged,e=>this.shouldNotifyEvent(e.visualId),e=>this.handleSummaryDataChangedEvent(e)]])}shouldNotifyEvent(e){switch(this.workbook.activeSheet.sheetType){case wt.SheetType.Worksheet:return this.workbook.activeSheet.name===e.worksheet;case wt.SheetType.Dashboard:return this.workbook.activeSheet.worksheets.filter(u=>u.name===e.worksheet).length===1;case wt.SheetType.Story:{const a=this.workbook.activeSheet.activeStoryPoint.containedSheet;return a?a.sheetType===wt.SheetType.Worksheet?a.name===e.worksheet:a.sheetType===wt.SheetType.Dashboard?a.worksheets.filter(_=>_.name===e.worksheet).length===1:!1:!1}default:return!1}}handleSelectedMarksChangedEvent(e){const n=new VQ.MarksSelectedEvent(this.getWorksheetForNotificationHandler(e));this.dispatchEvent(new CustomEvent(wt.EmbeddingTableauEventType.MarkSelectionChanged,{detail:n}))}handleFilterChangedEvent(e){const n=new jQ.FilterChangedEvent(this.getWorksheetForNotificationHandler(e.visualId),e.fieldName,e.fieldId);this.dispatchEvent(new CustomEvent(wt.EmbeddingTableauEventType.FilterChanged,{detail:n}))}handleSummaryDataChangedEvent(e){const n=new GQ.SummaryDataChangedEvent(this.getWorksheetForNotificationHandler(e.visualId));this.dispatchEvent(new CustomEvent(wt.EmbeddingTableauEventType.SummaryDataChanged,{detail:n}))}handleEditButtonClicked(){this.dispatchEvent(new CustomEvent(wt.EmbeddingTableauEventType.EditButtonClicked))}handleCustomMarkClickedContextMenuEvent(e){const n=new UQ.CustomMarkContextMenuEvent(this.getWorksheetForNotificationHandler(e.visualId),e.contextMenuId);this.dispatchEvent(new CustomEvent(wt.EmbeddingTableauEventType.CustomMarkContextMenuEvent,{detail:n}))}handleParameterChangedEvent(e){const n=new $Q.ParameterChangedEvent(e,this.vizImpl.embeddingId);this.dispatchEvent(new CustomEvent(wt.EmbeddingTableauEventType.ParameterChanged,{detail:n}))}handleUrlAction(e){const n=new HQ.UrlActionEvent(e.url,e.target);this.dispatchEvent(new CustomEvent(wt.EmbeddingTableauEventType.UrlAction,{detail:n}))}handleStoryPointSwitch(e){const n=this.vizImpl.workbookImpl.activeSheet,a=n.storyPointsInfo.find(u=>u.active===!0);if(n.activeStoryPoint&&a&&n.activeStoryPoint.index!==e.index){n.updateStory(e);const u=new WQ.StoryPointSwitchedEvent(a,n.activeStoryPoint,this.vizImpl.workbookImpl);this.dispatchEvent(new CustomEvent(wt.EmbeddingTableauEventType.StoryPointSwitched,{detail:u}))}}getWorksheetForNotificationHandler(e){let n;switch(this.workbook.activeSheet.sheetType){case wt.SheetType.Worksheet:{n=this.workbook.activeSheet;break}case wt.SheetType.Dashboard:{const u=this.workbook.activeSheet.worksheets.filter(d=>d.name===e.worksheet);if(u.length===1)n=u[0];else throw new Zf.TableauError(wt.EmbeddingErrorCodes.IndexOutOfRange,"Worksheet not found");break}case wt.SheetType.Story:{const u=this.workbook.activeSheet.activeStoryPoint.containedSheet;if(!u)throw new Zf.TableauError(wt.EmbeddingErrorCodes.IndexOutOfRange,"Worksheet not found");if(u.sheetType===wt.SheetType.Worksheet)n=u;else if(u.sheetType===wt.SheetType.Dashboard){const _=u.worksheets.filter(l=>l.name===e.worksheet);if(_.length===1)n=_[0];else throw new Zf.TableauError(wt.EmbeddingErrorCodes.IndexOutOfRange,"Worksheet not found")}else throw new Zf.TableauError(wt.EmbeddingErrorCodes.ImplementationError,"Could not find sheetType");break}default:throw new Zf.TableauError(wt.EmbeddingErrorCodes.ImplementationError,"Could not find sheetType")}return n}get disableUrlActionsPopups(){return this.hasAttribute(wt.VizAttributes.DisableUrlActionsPopups)}set disableUrlActionsPopups(e){e?this.setAttribute(wt.VizAttributes.DisableUrlActionsPopups,""):this.removeAttribute(wt.VizAttributes.DisableUrlActionsPopups)}get hideTabs(){return this.hasAttribute(wt.VizAttributes.HideTabs)}set hideTabs(e){e?this.setAttribute(wt.VizAttributes.HideTabs,""):this.removeAttribute(wt.VizAttributes.HideTabs)}get toolbar(){const e=Kf.attributeToEnumKey(this.getAttribute(wt.VizAttributes.Toolbar)),n=wt.Toolbar[e];return n||Kf.TableauVizBase.VizAttributeDefaults.toolbar}set toolbar(e){e&&this.setAttribute(wt.VizAttributes.Toolbar,e)}get instanceIdToClone(){const e=this.getAttribute(wt.VizAttributes.InstanceIdToClone);if(e)return e}set instanceIdToClone(e){e?this.setAttribute(wt.VizAttributes.InstanceIdToClone,e):this.removeAttribute(wt.VizAttributes.InstanceIdToClone)}get device(){const e=Kf.attributeToEnumKey(this.getAttribute(wt.VizAttributes.Device)),n=wt.DeviceType[e];return n||Kf.TableauVizBase.VizAttributeDefaults.device}set device(e){this.setAttribute(wt.VizAttributes.Device,e)}get hideEditButton(){return this.hasAttribute(wt.VizAttributes.HideEditButton)}set hideEditButton(e){e?this.setAttribute(wt.VizAttributes.HideEditButton,""):this.removeAttribute(wt.VizAttributes.HideEditButton)}get automaticUpdatesArePaused(){return this.vizImpl.automaticUpdatesArePaused}pauseAutomaticUpdatesAsync(){return this.vizImpl.pauseAutomaticUpdatesAsync()}resumeAutomaticUpdatesAsync(){return this.vizImpl.resumeAutomaticUpdatesAsync()}toggleAutomaticUpdatesAsync(){return this.vizImpl.toggleAutomaticUpdatesAsync()}revertAllAsync(){return this.vizImpl.revertAllAsync()}refreshDataAsync(){return this.vizImpl.refreshDataAsync()}exportImageAsync(){return this.vizImpl.exportImageAsync()}exportCrosstabAsync(e,n){return this.vizImpl.exportCrosstabAsync(e,n)}exportDataAsync(e,n){return this.vizImpl.exportDataAsync(e,n)}exportPowerPointAsync(e){return this.vizImpl.exportPowerPointAsync(e)}exportPDFAsync(e,n){return this.vizImpl.exportPDFAsync(e,n)}displayDialogAsync(e){return this.vizImpl.displayDialogAsync(e)}redoAsync(){return this.vizImpl.redoAsync()}undoAsync(){return this.vizImpl.undoAsync()}setAuthToken(e){this.vizImpl.setAuthToken(e)}addFilter(e,n){this.preInitFilters.push({field:e,value:n}),ZQ.WebComponentManager.synchronizeRender(this.updateRenderingIfInitialized.bind(this,this.src))}get workbook(){return new qQ.Workbook(this.vizImpl.workbookImpl)}};Hv.TableauViz=KQ;Object.defineProperty(Jt,"__esModule",{value:!0});const oM=Nt,XQ=sn(),YQ=Rv,QQ=Lv,JQ=Wv,eJ=Hv,tJ=typeof VERSION_IS_ALPHA<"u"?VERSION_IS_ALPHA:!1;XQ.ApiVersion.SetVersionNumber(typeof API_VERSION_NUMBER<"u"?API_VERSION_NUMBER:"0.0.0",tJ);function My(t,e){try{window.customElements.get(t)?console.warn(`Custom element '${t}' is already defined.`):window.customElements.define(t,e)}catch(n){console.error(`Error defining custom element '${t}':`,n)}}function rJ(){return"customElements"in window}rJ()?(My("tableau-viz",eJ.TableauViz),My("tableau-authoring-viz",QQ.TableauAuthoringViz),My("tableau-ask-data",YQ.TableauAskData),My("tableau-pulse",JQ.TableauPulse)):console.error("Custom Elements API is not supported in this browser.");const nJ=Object.assign(Object.assign({},oM.EmbeddingErrorCodes),oM.SharedErrorCodes);Jt.ErrorCodes=nJ;var sr=Nt;Jt.AnalyticsObjectType=sr.AnalyticsObjectType;Jt.AnnotationType=sr.AnnotationType;Jt.ApiMenuType=sr.ApiMenuType;Jt.ClassNameKey=sr.ClassNameKey;Jt.ColumnType=sr.ColumnType;Jt.CrosstabFileFormat=sr.CrosstabFileFormat;Jt.DashboardLayoutChange=sr.DashboardLayoutChange;Jt.DashboardObjectType=sr.DashboardObjectType;Jt.DataType=sr.DataType;Jt.DateRangeType=sr.DateRangeType;Jt.DeviceType=sr.DeviceType;Jt.EncodingType=sr.EncodingType;Jt.FieldAggregationType=sr.FieldAggregationType;Jt.FieldRoleType=sr.FieldRoleType;Jt.FileFormats=sr.FileFormats;Jt.FilterDomainType=sr.FilterDomainType;Jt.FilterNullOption=sr.FilterNullOption;Jt.FilterType=sr.FilterType;Jt.FilterUpdateType=sr.FilterUpdateType;Jt.HierarchicalLevelSelectionState=sr.HierarchicalLevelSelectionState;Jt.IncludeDataValuesOption=sr.IncludeDataValuesOption;Jt.MarkType=sr.MarkType;Jt.ParameterValueType=sr.ParameterValueType;Jt.PeriodType=sr.PeriodType;Jt.PrintOrientation=sr.PrintOrientation;Jt.PrintPageSize=sr.PrintPageSize;Jt.PrintScaling=sr.PrintScaling;Jt.PulseAttributes=sr.PulseAttributes;Jt.PulseLayout=sr.PulseLayout;Jt.QuickTableCalcType=sr.QuickTableCalcType;Jt.SelectionUpdateType=sr.SelectionUpdateType;Jt.SheetSizeBehavior=sr.SheetSizeBehavior;var Yb=Jt.SheetType=sr.SheetType;Jt.SortDirection=sr.SortDirection;Jt.TableauDialogType=sr.TableauDialogType;var aM=Jt.TableauEventType=sr.EmbeddingTableauEventType;Jt.Toolbar=sr.Toolbar;Jt.TrendLineModelType=sr.TrendLineModelType;Jt.VizAttributes=sr.VizAttributes;Jt.VizAuthoringAttributes=sr.VizAuthoringAttributes;Jt.VizSharedAttributes=sr.VizSharedAttributes;Jt.WebComponentAttributes=sr.WebComponentAttributes;var iJ=Rv;Jt.TableauAskData=iJ.TableauAskData;var oJ=Lv;Jt.TableauAuthoringViz=oJ.TableauAuthoringViz;var aJ=Wv;Jt.TableauPulse=aJ.TableauPulse;var sJ=Hv;Jt.TableauViz=sJ.TableauViz;var WO={exports:{}};function lJ(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Qb={exports:{}};const cJ={},uJ=Object.freeze(Object.defineProperty({__proto__:null,default:cJ},Symbol.toStringTag,{value:"Module"})),hJ=WM(uJ);var sM;function kr(){return sM||(sM=1,function(t,e){(function(n,a){t.exports=a()})($e,function(){var n=n||function(a,u){var d;if(typeof window<"u"&&window.crypto&&(d=window.crypto),typeof self<"u"&&self.crypto&&(d=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(d=globalThis.crypto),!d&&typeof window<"u"&&window.msCrypto&&(d=window.msCrypto),!d&&typeof $e<"u"&&$e.crypto&&(d=$e.crypto),!d&&typeof lJ=="function")try{d=hJ}catch{}var _=function(){if(d){if(typeof d.getRandomValues=="function")try{return d.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof d.randomBytes=="function")try{return d.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},l=Object.create||function(){function R(){}return function(F){var H;return R.prototype=F,H=new R,R.prototype=null,H}}(),w={},T=w.lib={},C=T.Base=function(){return{extend:function(R){var F=l(this);return R&&F.mixIn(R),(!F.hasOwnProperty("init")||this.init===F.init)&&(F.init=function(){F.$super.init.apply(this,arguments)}),F.init.prototype=F,F.$super=this,F},create:function(){var R=this.extend();return R.init.apply(R,arguments),R},init:function(){},mixIn:function(R){for(var F in R)R.hasOwnProperty(F)&&(this[F]=R[F]);R.hasOwnProperty("toString")&&(this.toString=R.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),P=T.WordArray=C.extend({init:function(R,F){R=this.words=R||[],F!=u?this.sigBytes=F:this.sigBytes=R.length*4},toString:function(R){return(R||W).stringify(this)},concat:function(R){var F=this.words,H=R.words,Q=this.sigBytes,te=R.sigBytes;if(this.clamp(),Q%4)for(var se=0;se>>2]>>>24-se%4*8&255;F[Q+se>>>2]|=ge<<24-(Q+se)%4*8}else for(var xe=0;xe>>2]=H[xe>>>2];return this.sigBytes+=te,this},clamp:function(){var R=this.words,F=this.sigBytes;R[F>>>2]&=4294967295<<32-F%4*8,R.length=a.ceil(F/4)},clone:function(){var R=C.clone.call(this);return R.words=this.words.slice(0),R},random:function(R){for(var F=[],H=0;H>>2]>>>24-te%4*8&255;Q.push((se>>>4).toString(16)),Q.push((se&15).toString(16))}return Q.join("")},parse:function(R){for(var F=R.length,H=[],Q=0;Q>>3]|=parseInt(R.substr(Q,2),16)<<24-Q%8*4;return new P.init(H,F/2)}},U=z.Latin1={stringify:function(R){for(var F=R.words,H=R.sigBytes,Q=[],te=0;te>>2]>>>24-te%4*8&255;Q.push(String.fromCharCode(se))}return Q.join("")},parse:function(R){for(var F=R.length,H=[],Q=0;Q>>2]|=(R.charCodeAt(Q)&255)<<24-Q%4*8;return new P.init(H,F)}},j=z.Utf8={stringify:function(R){try{return decodeURIComponent(escape(U.stringify(R)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(R){return U.parse(unescape(encodeURIComponent(R)))}},L=T.BufferedBlockAlgorithm=C.extend({reset:function(){this._data=new P.init,this._nDataBytes=0},_append:function(R){typeof R=="string"&&(R=j.parse(R)),this._data.concat(R),this._nDataBytes+=R.sigBytes},_process:function(R){var F,H=this._data,Q=H.words,te=H.sigBytes,se=this.blockSize,ge=se*4,xe=te/ge;R?xe=a.ceil(xe):xe=a.max((xe|0)-this._minBufferSize,0);var Ee=xe*se,Be=a.min(Ee*4,te);if(Ee){for(var Fe=0;Fe>>2]|=w[P]<<24-P%4*8;_.call(this,C,T)}else _.apply(this,arguments)};l.prototype=d}}(),n.lib.WordArray})}(ew)),ew.exports}var tw={exports:{}},uM;function pJ(){return uM||(uM=1,function(t,e){(function(n,a){t.exports=a(kr())})($e,function(n){return function(){var a=n,u=a.lib,d=u.WordArray,_=a.enc;_.Utf16=_.Utf16BE={stringify:function(w){for(var T=w.words,C=w.sigBytes,P=[],z=0;z>>2]>>>16-z%4*8&65535;P.push(String.fromCharCode(W))}return P.join("")},parse:function(w){for(var T=w.length,C=[],P=0;P>>1]|=w.charCodeAt(P)<<16-P%2*16;return d.create(C,T*2)}},_.Utf16LE={stringify:function(w){for(var T=w.words,C=w.sigBytes,P=[],z=0;z>>2]>>>16-z%4*8&65535);P.push(String.fromCharCode(W))}return P.join("")},parse:function(w){for(var T=w.length,C=[],P=0;P>>1]|=l(w.charCodeAt(P)<<16-P%2*16);return d.create(C,T*2)}};function l(w){return w<<8&4278255360|w>>>8&16711935}}(),n.enc.Utf16})}(tw)),tw.exports}var rw={exports:{}},hM;function ju(){return hM||(hM=1,function(t,e){(function(n,a){t.exports=a(kr())})($e,function(n){return function(){var a=n,u=a.lib,d=u.WordArray,_=a.enc;_.Base64={stringify:function(w){var T=w.words,C=w.sigBytes,P=this._map;w.clamp();for(var z=[],W=0;W>>2]>>>24-W%4*8&255,j=T[W+1>>>2]>>>24-(W+1)%4*8&255,L=T[W+2>>>2]>>>24-(W+2)%4*8&255,V=U<<16|j<<8|L,R=0;R<4&&W+R*.75>>6*(3-R)&63));var F=P.charAt(64);if(F)for(;z.length%4;)z.push(F);return z.join("")},parse:function(w){var T=w.length,C=this._map,P=this._reverseMap;if(!P){P=this._reverseMap=[];for(var z=0;z>>6-W%4*2,L=U|j;P[z>>>2]|=L<<24-z%4*8,z++}return d.create(P,z)}}(),n.enc.Base64})}(rw)),rw.exports}var nw={exports:{}},dM;function fJ(){return dM||(dM=1,function(t,e){(function(n,a){t.exports=a(kr())})($e,function(n){return function(){var a=n,u=a.lib,d=u.WordArray,_=a.enc;_.Base64url={stringify:function(w,T){T===void 0&&(T=!0);var C=w.words,P=w.sigBytes,z=T?this._safe_map:this._map;w.clamp();for(var W=[],U=0;U>>2]>>>24-U%4*8&255,L=C[U+1>>>2]>>>24-(U+1)%4*8&255,V=C[U+2>>>2]>>>24-(U+2)%4*8&255,R=j<<16|L<<8|V,F=0;F<4&&U+F*.75>>6*(3-F)&63));var H=z.charAt(64);if(H)for(;W.length%4;)W.push(H);return W.join("")},parse:function(w,T){T===void 0&&(T=!0);var C=w.length,P=T?this._safe_map:this._map,z=this._reverseMap;if(!z){z=this._reverseMap=[];for(var W=0;W>>6-W%4*2,L=U|j;P[z>>>2]|=L<<24-z%4*8,z++}return d.create(P,z)}}(),n.enc.Base64url})}(nw)),nw.exports}var iw={exports:{}},pM;function Vu(){return pM||(pM=1,function(t,e){(function(n,a){t.exports=a(kr())})($e,function(n){return function(a){var u=n,d=u.lib,_=d.WordArray,l=d.Hasher,w=u.algo,T=[];(function(){for(var j=0;j<64;j++)T[j]=a.abs(a.sin(j+1))*4294967296|0})();var C=w.MD5=l.extend({_doReset:function(){this._hash=new _.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(j,L){for(var V=0;V<16;V++){var R=L+V,F=j[R];j[R]=(F<<8|F>>>24)&16711935|(F<<24|F>>>8)&4278255360}var H=this._hash.words,Q=j[L+0],te=j[L+1],se=j[L+2],ge=j[L+3],xe=j[L+4],Ee=j[L+5],Be=j[L+6],Fe=j[L+7],Ve=j[L+8],kt=j[L+9],Dt=j[L+10],Ut=j[L+11],cr=j[L+12],qe=j[L+13],Tt=j[L+14],gt=j[L+15],je=H[0],et=H[1],nt=H[2],it=H[3];je=P(je,et,nt,it,Q,7,T[0]),it=P(it,je,et,nt,te,12,T[1]),nt=P(nt,it,je,et,se,17,T[2]),et=P(et,nt,it,je,ge,22,T[3]),je=P(je,et,nt,it,xe,7,T[4]),it=P(it,je,et,nt,Ee,12,T[5]),nt=P(nt,it,je,et,Be,17,T[6]),et=P(et,nt,it,je,Fe,22,T[7]),je=P(je,et,nt,it,Ve,7,T[8]),it=P(it,je,et,nt,kt,12,T[9]),nt=P(nt,it,je,et,Dt,17,T[10]),et=P(et,nt,it,je,Ut,22,T[11]),je=P(je,et,nt,it,cr,7,T[12]),it=P(it,je,et,nt,qe,12,T[13]),nt=P(nt,it,je,et,Tt,17,T[14]),et=P(et,nt,it,je,gt,22,T[15]),je=z(je,et,nt,it,te,5,T[16]),it=z(it,je,et,nt,Be,9,T[17]),nt=z(nt,it,je,et,Ut,14,T[18]),et=z(et,nt,it,je,Q,20,T[19]),je=z(je,et,nt,it,Ee,5,T[20]),it=z(it,je,et,nt,Dt,9,T[21]),nt=z(nt,it,je,et,gt,14,T[22]),et=z(et,nt,it,je,xe,20,T[23]),je=z(je,et,nt,it,kt,5,T[24]),it=z(it,je,et,nt,Tt,9,T[25]),nt=z(nt,it,je,et,ge,14,T[26]),et=z(et,nt,it,je,Ve,20,T[27]),je=z(je,et,nt,it,qe,5,T[28]),it=z(it,je,et,nt,se,9,T[29]),nt=z(nt,it,je,et,Fe,14,T[30]),et=z(et,nt,it,je,cr,20,T[31]),je=W(je,et,nt,it,Ee,4,T[32]),it=W(it,je,et,nt,Ve,11,T[33]),nt=W(nt,it,je,et,Ut,16,T[34]),et=W(et,nt,it,je,Tt,23,T[35]),je=W(je,et,nt,it,te,4,T[36]),it=W(it,je,et,nt,xe,11,T[37]),nt=W(nt,it,je,et,Fe,16,T[38]),et=W(et,nt,it,je,Dt,23,T[39]),je=W(je,et,nt,it,qe,4,T[40]),it=W(it,je,et,nt,Q,11,T[41]),nt=W(nt,it,je,et,ge,16,T[42]),et=W(et,nt,it,je,Be,23,T[43]),je=W(je,et,nt,it,kt,4,T[44]),it=W(it,je,et,nt,cr,11,T[45]),nt=W(nt,it,je,et,gt,16,T[46]),et=W(et,nt,it,je,se,23,T[47]),je=U(je,et,nt,it,Q,6,T[48]),it=U(it,je,et,nt,Fe,10,T[49]),nt=U(nt,it,je,et,Tt,15,T[50]),et=U(et,nt,it,je,Ee,21,T[51]),je=U(je,et,nt,it,cr,6,T[52]),it=U(it,je,et,nt,ge,10,T[53]),nt=U(nt,it,je,et,Dt,15,T[54]),et=U(et,nt,it,je,te,21,T[55]),je=U(je,et,nt,it,Ve,6,T[56]),it=U(it,je,et,nt,gt,10,T[57]),nt=U(nt,it,je,et,Be,15,T[58]),et=U(et,nt,it,je,qe,21,T[59]),je=U(je,et,nt,it,xe,6,T[60]),it=U(it,je,et,nt,Ut,10,T[61]),nt=U(nt,it,je,et,se,15,T[62]),et=U(et,nt,it,je,kt,21,T[63]),H[0]=H[0]+je|0,H[1]=H[1]+et|0,H[2]=H[2]+nt|0,H[3]=H[3]+it|0},_doFinalize:function(){var j=this._data,L=j.words,V=this._nDataBytes*8,R=j.sigBytes*8;L[R>>>5]|=128<<24-R%32;var F=a.floor(V/4294967296),H=V;L[(R+64>>>9<<4)+15]=(F<<8|F>>>24)&16711935|(F<<24|F>>>8)&4278255360,L[(R+64>>>9<<4)+14]=(H<<8|H>>>24)&16711935|(H<<24|H>>>8)&4278255360,j.sigBytes=(L.length+1)*4,this._process();for(var Q=this._hash,te=Q.words,se=0;se<4;se++){var ge=te[se];te[se]=(ge<<8|ge>>>24)&16711935|(ge<<24|ge>>>8)&4278255360}return Q},clone:function(){var j=l.clone.call(this);return j._hash=this._hash.clone(),j}});function P(j,L,V,R,F,H,Q){var te=j+(L&V|~L&R)+F+Q;return(te<>>32-H)+L}function z(j,L,V,R,F,H,Q){var te=j+(L&R|V&~R)+F+Q;return(te<>>32-H)+L}function W(j,L,V,R,F,H,Q){var te=j+(L^V^R)+F+Q;return(te<>>32-H)+L}function U(j,L,V,R,F,H,Q){var te=j+(V^(L|~R))+F+Q;return(te<>>32-H)+L}u.MD5=l._createHelper(C),u.HmacMD5=l._createHmacHelper(C)}(Math),n.MD5})}(iw)),iw.exports}var ow={exports:{}},fM;function GO(){return fM||(fM=1,function(t,e){(function(n,a){t.exports=a(kr())})($e,function(n){return function(){var a=n,u=a.lib,d=u.WordArray,_=u.Hasher,l=a.algo,w=[],T=l.SHA1=_.extend({_doReset:function(){this._hash=new d.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(C,P){for(var z=this._hash.words,W=z[0],U=z[1],j=z[2],L=z[3],V=z[4],R=0;R<80;R++){if(R<16)w[R]=C[P+R]|0;else{var F=w[R-3]^w[R-8]^w[R-14]^w[R-16];w[R]=F<<1|F>>>31}var H=(W<<5|W>>>27)+V+w[R];R<20?H+=(U&j|~U&L)+1518500249:R<40?H+=(U^j^L)+1859775393:R<60?H+=(U&j|U&L|j&L)-1894007588:H+=(U^j^L)-899497514,V=L,L=j,j=U<<30|U>>>2,U=W,W=H}z[0]=z[0]+W|0,z[1]=z[1]+U|0,z[2]=z[2]+j|0,z[3]=z[3]+L|0,z[4]=z[4]+V|0},_doFinalize:function(){var C=this._data,P=C.words,z=this._nDataBytes*8,W=C.sigBytes*8;return P[W>>>5]|=128<<24-W%32,P[(W+64>>>9<<4)+14]=Math.floor(z/4294967296),P[(W+64>>>9<<4)+15]=z,C.sigBytes=P.length*4,this._process(),this._hash},clone:function(){var C=_.clone.call(this);return C._hash=this._hash.clone(),C}});a.SHA1=_._createHelper(T),a.HmacSHA1=_._createHmacHelper(T)}(),n.SHA1})}(ow)),ow.exports}var aw={exports:{}},mM;function PA(){return mM||(mM=1,function(t,e){(function(n,a){t.exports=a(kr())})($e,function(n){return function(a){var u=n,d=u.lib,_=d.WordArray,l=d.Hasher,w=u.algo,T=[],C=[];(function(){function W(V){for(var R=a.sqrt(V),F=2;F<=R;F++)if(!(V%F))return!1;return!0}function U(V){return(V-(V|0))*4294967296|0}for(var j=2,L=0;L<64;)W(j)&&(L<8&&(T[L]=U(a.pow(j,1/2))),C[L]=U(a.pow(j,1/3)),L++),j++})();var P=[],z=w.SHA256=l.extend({_doReset:function(){this._hash=new _.init(T.slice(0))},_doProcessBlock:function(W,U){for(var j=this._hash.words,L=j[0],V=j[1],R=j[2],F=j[3],H=j[4],Q=j[5],te=j[6],se=j[7],ge=0;ge<64;ge++){if(ge<16)P[ge]=W[U+ge]|0;else{var xe=P[ge-15],Ee=(xe<<25|xe>>>7)^(xe<<14|xe>>>18)^xe>>>3,Be=P[ge-2],Fe=(Be<<15|Be>>>17)^(Be<<13|Be>>>19)^Be>>>10;P[ge]=Ee+P[ge-7]+Fe+P[ge-16]}var Ve=H&Q^~H&te,kt=L&V^L&R^V&R,Dt=(L<<30|L>>>2)^(L<<19|L>>>13)^(L<<10|L>>>22),Ut=(H<<26|H>>>6)^(H<<21|H>>>11)^(H<<7|H>>>25),cr=se+Ut+Ve+C[ge]+P[ge],qe=Dt+kt;se=te,te=Q,Q=H,H=F+cr|0,F=R,R=V,V=L,L=cr+qe|0}j[0]=j[0]+L|0,j[1]=j[1]+V|0,j[2]=j[2]+R|0,j[3]=j[3]+F|0,j[4]=j[4]+H|0,j[5]=j[5]+Q|0,j[6]=j[6]+te|0,j[7]=j[7]+se|0},_doFinalize:function(){var W=this._data,U=W.words,j=this._nDataBytes*8,L=W.sigBytes*8;return U[L>>>5]|=128<<24-L%32,U[(L+64>>>9<<4)+14]=a.floor(j/4294967296),U[(L+64>>>9<<4)+15]=j,W.sigBytes=U.length*4,this._process(),this._hash},clone:function(){var W=l.clone.call(this);return W._hash=this._hash.clone(),W}});u.SHA256=l._createHelper(z),u.HmacSHA256=l._createHmacHelper(z)}(Math),n.SHA256})}(aw)),aw.exports}var sw={exports:{}},gM;function mJ(){return gM||(gM=1,function(t,e){(function(n,a,u){t.exports=a(kr(),PA())})($e,function(n){return function(){var a=n,u=a.lib,d=u.WordArray,_=a.algo,l=_.SHA256,w=_.SHA224=l.extend({_doReset:function(){this._hash=new d.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var T=l._doFinalize.call(this);return T.sigBytes-=4,T}});a.SHA224=l._createHelper(w),a.HmacSHA224=l._createHmacHelper(w)}(),n.SHA224})}(sw)),sw.exports}var lw={exports:{}},yM;function HO(){return yM||(yM=1,function(t,e){(function(n,a,u){t.exports=a(kr(),qv())})($e,function(n){return function(){var a=n,u=a.lib,d=u.Hasher,_=a.x64,l=_.Word,w=_.WordArray,T=a.algo;function C(){return l.create.apply(l,arguments)}var P=[C(1116352408,3609767458),C(1899447441,602891725),C(3049323471,3964484399),C(3921009573,2173295548),C(961987163,4081628472),C(1508970993,3053834265),C(2453635748,2937671579),C(2870763221,3664609560),C(3624381080,2734883394),C(310598401,1164996542),C(607225278,1323610764),C(1426881987,3590304994),C(1925078388,4068182383),C(2162078206,991336113),C(2614888103,633803317),C(3248222580,3479774868),C(3835390401,2666613458),C(4022224774,944711139),C(264347078,2341262773),C(604807628,2007800933),C(770255983,1495990901),C(1249150122,1856431235),C(1555081692,3175218132),C(1996064986,2198950837),C(2554220882,3999719339),C(2821834349,766784016),C(2952996808,2566594879),C(3210313671,3203337956),C(3336571891,1034457026),C(3584528711,2466948901),C(113926993,3758326383),C(338241895,168717936),C(666307205,1188179964),C(773529912,1546045734),C(1294757372,1522805485),C(1396182291,2643833823),C(1695183700,2343527390),C(1986661051,1014477480),C(2177026350,1206759142),C(2456956037,344077627),C(2730485921,1290863460),C(2820302411,3158454273),C(3259730800,3505952657),C(3345764771,106217008),C(3516065817,3606008344),C(3600352804,1432725776),C(4094571909,1467031594),C(275423344,851169720),C(430227734,3100823752),C(506948616,1363258195),C(659060556,3750685593),C(883997877,3785050280),C(958139571,3318307427),C(1322822218,3812723403),C(1537002063,2003034995),C(1747873779,3602036899),C(1955562222,1575990012),C(2024104815,1125592928),C(2227730452,2716904306),C(2361852424,442776044),C(2428436474,593698344),C(2756734187,3733110249),C(3204031479,2999351573),C(3329325298,3815920427),C(3391569614,3928383900),C(3515267271,566280711),C(3940187606,3454069534),C(4118630271,4000239992),C(116418474,1914138554),C(174292421,2731055270),C(289380356,3203993006),C(460393269,320620315),C(685471733,587496836),C(852142971,1086792851),C(1017036298,365543100),C(1126000580,2618297676),C(1288033470,3409855158),C(1501505948,4234509866),C(1607167915,987167468),C(1816402316,1246189591)],z=[];(function(){for(var U=0;U<80;U++)z[U]=C()})();var W=T.SHA512=d.extend({_doReset:function(){this._hash=new w.init([new l.init(1779033703,4089235720),new l.init(3144134277,2227873595),new l.init(1013904242,4271175723),new l.init(2773480762,1595750129),new l.init(1359893119,2917565137),new l.init(2600822924,725511199),new l.init(528734635,4215389547),new l.init(1541459225,327033209)])},_doProcessBlock:function(U,j){for(var L=this._hash.words,V=L[0],R=L[1],F=L[2],H=L[3],Q=L[4],te=L[5],se=L[6],ge=L[7],xe=V.high,Ee=V.low,Be=R.high,Fe=R.low,Ve=F.high,kt=F.low,Dt=H.high,Ut=H.low,cr=Q.high,qe=Q.low,Tt=te.high,gt=te.low,je=se.high,et=se.low,nt=ge.high,it=ge.low,ur=xe,Xt=Ee,Pr=Be,Yt=Fe,si=Ve,mr=kt,Vt=Dt,Ii=Ut,qr=cr,pn=qe,Tr=Tt,Bn=gt,ma=je,yi=et,Yn=nt,bo=it,Nn=0;Nn<80;Nn++){var Un,Qn,wo=z[Nn];if(Nn<16)Qn=wo.high=U[j+Nn*2]|0,Un=wo.low=U[j+Nn*2+1]|0;else{var Ps=z[Nn-15],Eo=Ps.high,jn=Ps.low,Wo=(Eo>>>1|jn<<31)^(Eo>>>8|jn<<24)^Eo>>>7,Qa=(jn>>>1|Eo<<31)^(jn>>>8|Eo<<24)^(jn>>>7|Eo<<25),Go=z[Nn-2],Hi=Go.high,So=Go.low,ga=(Hi>>>19|So<<13)^(Hi<<3|So>>>29)^Hi>>>6,To=(So>>>19|Hi<<13)^(So<<3|Hi>>>29)^(So>>>6|Hi<<26),Ho=z[Nn-7],ya=Ho.high,Ja=Ho.low,Ds=z[Nn-16],fe=Ds.high,X=Ds.low;Un=Qa+Ja,Qn=Wo+ya+(Un>>>0>>0?1:0),Un=Un+To,Qn=Qn+ga+(Un>>>0>>0?1:0),Un=Un+X,Qn=Qn+fe+(Un>>>0>>0?1:0),wo.high=Qn,wo.low=Un}var Y=qr&Tr^~qr&ma,de=pn&Bn^~pn&yi,ve=ur&Pr^ur&si^Pr&si,Ae=Xt&Yt^Xt&mr^Yt&mr,Pe=(ur>>>28|Xt<<4)^(ur<<30|Xt>>>2)^(ur<<25|Xt>>>7),ke=(Xt>>>28|ur<<4)^(Xt<<30|ur>>>2)^(Xt<<25|ur>>>7),Te=(qr>>>14|pn<<18)^(qr>>>18|pn<<14)^(qr<<23|pn>>>9),Le=(pn>>>14|qr<<18)^(pn>>>18|qr<<14)^(pn<<23|qr>>>9),dt=P[Nn],mt=dt.high,ct=dt.low,Ft=bo+Le,jt=Yn+Te+(Ft>>>0>>0?1:0),Ft=Ft+de,jt=jt+Y+(Ft>>>0>>0?1:0),Ft=Ft+ct,jt=jt+mt+(Ft>>>0>>0?1:0),Ft=Ft+Un,jt=jt+Qn+(Ft>>>0>>0?1:0),Wt=ke+Ae,Qt=Pe+ve+(Wt>>>0>>0?1:0);Yn=ma,bo=yi,ma=Tr,yi=Bn,Tr=qr,Bn=pn,pn=Ii+Ft|0,qr=Vt+jt+(pn>>>0>>0?1:0)|0,Vt=si,Ii=mr,si=Pr,mr=Yt,Pr=ur,Yt=Xt,Xt=Ft+Wt|0,ur=jt+Qt+(Xt>>>0>>0?1:0)|0}Ee=V.low=Ee+Xt,V.high=xe+ur+(Ee>>>0>>0?1:0),Fe=R.low=Fe+Yt,R.high=Be+Pr+(Fe>>>0>>0?1:0),kt=F.low=kt+mr,F.high=Ve+si+(kt>>>0>>0?1:0),Ut=H.low=Ut+Ii,H.high=Dt+Vt+(Ut>>>0>>0?1:0),qe=Q.low=qe+pn,Q.high=cr+qr+(qe>>>0>>0?1:0),gt=te.low=gt+Bn,te.high=Tt+Tr+(gt>>>0>>0?1:0),et=se.low=et+yi,se.high=je+ma+(et>>>0>>0?1:0),it=ge.low=it+bo,ge.high=nt+Yn+(it>>>0>>0?1:0)},_doFinalize:function(){var U=this._data,j=U.words,L=this._nDataBytes*8,V=U.sigBytes*8;j[V>>>5]|=128<<24-V%32,j[(V+128>>>10<<5)+30]=Math.floor(L/4294967296),j[(V+128>>>10<<5)+31]=L,U.sigBytes=j.length*4,this._process();var R=this._hash.toX32();return R},clone:function(){var U=d.clone.call(this);return U._hash=this._hash.clone(),U},blockSize:1024/32});a.SHA512=d._createHelper(W),a.HmacSHA512=d._createHmacHelper(W)}(),n.SHA512})}(lw)),lw.exports}var cw={exports:{}},_M;function gJ(){return _M||(_M=1,function(t,e){(function(n,a,u){t.exports=a(kr(),qv(),HO())})($e,function(n){return function(){var a=n,u=a.x64,d=u.Word,_=u.WordArray,l=a.algo,w=l.SHA512,T=l.SHA384=w.extend({_doReset:function(){this._hash=new _.init([new d.init(3418070365,3238371032),new d.init(1654270250,914150663),new d.init(2438529370,812702999),new d.init(355462360,4144912697),new d.init(1731405415,4290775857),new d.init(2394180231,1750603025),new d.init(3675008525,1694076839),new d.init(1203062813,3204075428)])},_doFinalize:function(){var C=w._doFinalize.call(this);return C.sigBytes-=16,C}});a.SHA384=w._createHelper(T),a.HmacSHA384=w._createHmacHelper(T)}(),n.SHA384})}(cw)),cw.exports}var uw={exports:{}},vM;function yJ(){return vM||(vM=1,function(t,e){(function(n,a,u){t.exports=a(kr(),qv())})($e,function(n){return function(a){var u=n,d=u.lib,_=d.WordArray,l=d.Hasher,w=u.x64,T=w.Word,C=u.algo,P=[],z=[],W=[];(function(){for(var L=1,V=0,R=0;R<24;R++){P[L+5*V]=(R+1)*(R+2)/2%64;var F=V%5,H=(2*L+3*V)%5;L=F,V=H}for(var L=0;L<5;L++)for(var V=0;V<5;V++)z[L+5*V]=V+(2*L+3*V)%5*5;for(var Q=1,te=0;te<24;te++){for(var se=0,ge=0,xe=0;xe<7;xe++){if(Q&1){var Ee=(1<>>24)&16711935|(Q<<24|Q>>>8)&4278255360,te=(te<<8|te>>>24)&16711935|(te<<24|te>>>8)&4278255360;var se=R[H];se.high^=te,se.low^=Q}for(var ge=0;ge<24;ge++){for(var xe=0;xe<5;xe++){for(var Ee=0,Be=0,Fe=0;Fe<5;Fe++){var se=R[xe+5*Fe];Ee^=se.high,Be^=se.low}var Ve=U[xe];Ve.high=Ee,Ve.low=Be}for(var xe=0;xe<5;xe++)for(var kt=U[(xe+4)%5],Dt=U[(xe+1)%5],Ut=Dt.high,cr=Dt.low,Ee=kt.high^(Ut<<1|cr>>>31),Be=kt.low^(cr<<1|Ut>>>31),Fe=0;Fe<5;Fe++){var se=R[xe+5*Fe];se.high^=Ee,se.low^=Be}for(var qe=1;qe<25;qe++){var Ee,Be,se=R[qe],Tt=se.high,gt=se.low,je=P[qe];je<32?(Ee=Tt<>>32-je,Be=gt<>>32-je):(Ee=gt<>>64-je,Be=Tt<>>64-je);var et=U[z[qe]];et.high=Ee,et.low=Be}var nt=U[0],it=R[0];nt.high=it.high,nt.low=it.low;for(var xe=0;xe<5;xe++)for(var Fe=0;Fe<5;Fe++){var qe=xe+5*Fe,se=R[qe],ur=U[qe],Xt=U[(xe+1)%5+5*Fe],Pr=U[(xe+2)%5+5*Fe];se.high=ur.high^~Xt.high&Pr.high,se.low=ur.low^~Xt.low&Pr.low}var se=R[0],Yt=W[ge];se.high^=Yt.high,se.low^=Yt.low}},_doFinalize:function(){var L=this._data,V=L.words;this._nDataBytes*8;var R=L.sigBytes*8,F=this.blockSize*32;V[R>>>5]|=1<<24-R%32,V[(a.ceil((R+1)/F)*F>>>5)-1]|=128,L.sigBytes=V.length*4,this._process();for(var H=this._state,Q=this.cfg.outputLength/8,te=Q/8,se=[],ge=0;ge>>24)&16711935|(Ee<<24|Ee>>>8)&4278255360,Be=(Be<<8|Be>>>24)&16711935|(Be<<24|Be>>>8)&4278255360,se.push(Be),se.push(Ee)}return new _.init(se,Q)},clone:function(){for(var L=l.clone.call(this),V=L._state=this._state.slice(0),R=0;R<25;R++)V[R]=V[R].clone();return L}});u.SHA3=l._createHelper(j),u.HmacSHA3=l._createHmacHelper(j)}(Math),n.SHA3})}(uw)),uw.exports}var hw={exports:{}},xM;function _J(){return xM||(xM=1,function(t,e){(function(n,a){t.exports=a(kr())})($e,function(n){/** @preserve + (c) 2012 by Cédric Mesnil. All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */return function(a){var u=n,d=u.lib,_=d.WordArray,l=d.Hasher,w=u.algo,T=_.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),C=_.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),P=_.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),z=_.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),W=_.create([0,1518500249,1859775393,2400959708,2840853838]),U=_.create([1352829926,1548603684,1836072691,2053994217,0]),j=w.RIPEMD160=l.extend({_doReset:function(){this._hash=_.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(te,se){for(var ge=0;ge<16;ge++){var xe=se+ge,Ee=te[xe];te[xe]=(Ee<<8|Ee>>>24)&16711935|(Ee<<24|Ee>>>8)&4278255360}var Be=this._hash.words,Fe=W.words,Ve=U.words,kt=T.words,Dt=C.words,Ut=P.words,cr=z.words,qe,Tt,gt,je,et,nt,it,ur,Xt,Pr;nt=qe=Be[0],it=Tt=Be[1],ur=gt=Be[2],Xt=je=Be[3],Pr=et=Be[4];for(var Yt,ge=0;ge<80;ge+=1)Yt=qe+te[se+kt[ge]]|0,ge<16?Yt+=L(Tt,gt,je)+Fe[0]:ge<32?Yt+=V(Tt,gt,je)+Fe[1]:ge<48?Yt+=R(Tt,gt,je)+Fe[2]:ge<64?Yt+=F(Tt,gt,je)+Fe[3]:Yt+=H(Tt,gt,je)+Fe[4],Yt=Yt|0,Yt=Q(Yt,Ut[ge]),Yt=Yt+et|0,qe=et,et=je,je=Q(gt,10),gt=Tt,Tt=Yt,Yt=nt+te[se+Dt[ge]]|0,ge<16?Yt+=H(it,ur,Xt)+Ve[0]:ge<32?Yt+=F(it,ur,Xt)+Ve[1]:ge<48?Yt+=R(it,ur,Xt)+Ve[2]:ge<64?Yt+=V(it,ur,Xt)+Ve[3]:Yt+=L(it,ur,Xt)+Ve[4],Yt=Yt|0,Yt=Q(Yt,cr[ge]),Yt=Yt+Pr|0,nt=Pr,Pr=Xt,Xt=Q(ur,10),ur=it,it=Yt;Yt=Be[1]+gt+Xt|0,Be[1]=Be[2]+je+Pr|0,Be[2]=Be[3]+et+nt|0,Be[3]=Be[4]+qe+it|0,Be[4]=Be[0]+Tt+ur|0,Be[0]=Yt},_doFinalize:function(){var te=this._data,se=te.words,ge=this._nDataBytes*8,xe=te.sigBytes*8;se[xe>>>5]|=128<<24-xe%32,se[(xe+64>>>9<<4)+14]=(ge<<8|ge>>>24)&16711935|(ge<<24|ge>>>8)&4278255360,te.sigBytes=(se.length+1)*4,this._process();for(var Ee=this._hash,Be=Ee.words,Fe=0;Fe<5;Fe++){var Ve=Be[Fe];Be[Fe]=(Ve<<8|Ve>>>24)&16711935|(Ve<<24|Ve>>>8)&4278255360}return Ee},clone:function(){var te=l.clone.call(this);return te._hash=this._hash.clone(),te}});function L(te,se,ge){return te^se^ge}function V(te,se,ge){return te&se|~te&ge}function R(te,se,ge){return(te|~se)^ge}function F(te,se,ge){return te&ge|se&~ge}function H(te,se,ge){return te^(se|~ge)}function Q(te,se){return te<>>32-se}u.RIPEMD160=l._createHelper(j),u.HmacRIPEMD160=l._createHmacHelper(j)}(),n.RIPEMD160})}(hw)),hw.exports}var dw={exports:{}},bM;function DA(){return bM||(bM=1,function(t,e){(function(n,a){t.exports=a(kr())})($e,function(n){(function(){var a=n,u=a.lib,d=u.Base,_=a.enc,l=_.Utf8,w=a.algo;w.HMAC=d.extend({init:function(T,C){T=this._hasher=new T.init,typeof C=="string"&&(C=l.parse(C));var P=T.blockSize,z=P*4;C.sigBytes>z&&(C=T.finalize(C)),C.clamp();for(var W=this._oKey=C.clone(),U=this._iKey=C.clone(),j=W.words,L=U.words,V=0;V>>2]&255;Ee.sigBytes-=Be}};d.BlockCipher=W.extend({cfg:W.cfg.extend({mode:L,padding:R}),reset:function(){var Ee;W.reset.call(this);var Be=this.cfg,Fe=Be.iv,Ve=Be.mode;this._xformMode==this._ENC_XFORM_MODE?Ee=Ve.createEncryptor:(Ee=Ve.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==Ee?this._mode.init(this,Fe&&Fe.words):(this._mode=Ee.call(Ve,this,Fe&&Fe.words),this._mode.__creator=Ee)},_doProcessBlock:function(Ee,Be){this._mode.processBlock(Ee,Be)},_doFinalize:function(){var Ee,Be=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(Be.pad(this._data,this.blockSize),Ee=this._process(!0)):(Ee=this._process(!0),Be.unpad(Ee)),Ee},blockSize:128/32});var F=d.CipherParams=_.extend({init:function(Ee){this.mixIn(Ee)},toString:function(Ee){return(Ee||this.formatter).stringify(this)}}),H=u.format={},Q=H.OpenSSL={stringify:function(Ee){var Be,Fe=Ee.ciphertext,Ve=Ee.salt;return Ve?Be=l.create([1398893684,1701076831]).concat(Ve).concat(Fe):Be=Fe,Be.toString(C)},parse:function(Ee){var Be,Fe=C.parse(Ee),Ve=Fe.words;return Ve[0]==1398893684&&Ve[1]==1701076831&&(Be=l.create(Ve.slice(2,4)),Ve.splice(0,4),Fe.sigBytes-=16),F.create({ciphertext:Fe,salt:Be})}},te=d.SerializableCipher=_.extend({cfg:_.extend({format:Q}),encrypt:function(Ee,Be,Fe,Ve){Ve=this.cfg.extend(Ve);var kt=Ee.createEncryptor(Fe,Ve),Dt=kt.finalize(Be),Ut=kt.cfg;return F.create({ciphertext:Dt,key:Fe,iv:Ut.iv,algorithm:Ee,mode:Ut.mode,padding:Ut.padding,blockSize:Ee.blockSize,formatter:Ve.format})},decrypt:function(Ee,Be,Fe,Ve){Ve=this.cfg.extend(Ve),Be=this._parse(Be,Ve.format);var kt=Ee.createDecryptor(Fe,Ve).finalize(Be.ciphertext);return kt},_parse:function(Ee,Be){return typeof Ee=="string"?Be.parse(Ee,this):Ee}}),se=u.kdf={},ge=se.OpenSSL={execute:function(Ee,Be,Fe,Ve,kt){if(Ve||(Ve=l.random(64/8)),kt)var Dt=z.create({keySize:Be+Fe,hasher:kt}).compute(Ee,Ve);else var Dt=z.create({keySize:Be+Fe}).compute(Ee,Ve);var Ut=l.create(Dt.words.slice(Be),Fe*4);return Dt.sigBytes=Be*4,F.create({key:Dt,iv:Ut,salt:Ve})}},xe=d.PasswordBasedCipher=te.extend({cfg:te.cfg.extend({kdf:ge}),encrypt:function(Ee,Be,Fe,Ve){Ve=this.cfg.extend(Ve);var kt=Ve.kdf.execute(Fe,Ee.keySize,Ee.ivSize,Ve.salt,Ve.hasher);Ve.iv=kt.iv;var Dt=te.encrypt.call(this,Ee,Be,kt.key,Ve);return Dt.mixIn(kt),Dt},decrypt:function(Ee,Be,Fe,Ve){Ve=this.cfg.extend(Ve),Be=this._parse(Be,Ve.format);var kt=Ve.kdf.execute(Fe,Ee.keySize,Ee.ivSize,Be.salt,Ve.hasher);Ve.iv=kt.iv;var Dt=te.decrypt.call(this,Ee,Be,kt.key,Ve);return Dt}})}()})}(mw)),mw.exports}var gw={exports:{}},TM;function xJ(){return TM||(TM=1,function(t,e){(function(n,a,u){t.exports=a(kr(),gi())})($e,function(n){return n.mode.CFB=function(){var a=n.lib.BlockCipherMode.extend();a.Encryptor=a.extend({processBlock:function(d,_){var l=this._cipher,w=l.blockSize;u.call(this,d,_,w,l),this._prevBlock=d.slice(_,_+w)}}),a.Decryptor=a.extend({processBlock:function(d,_){var l=this._cipher,w=l.blockSize,T=d.slice(_,_+w);u.call(this,d,_,w,l),this._prevBlock=T}});function u(d,_,l,w){var T,C=this._iv;C?(T=C.slice(0),this._iv=void 0):T=this._prevBlock,w.encryptBlock(T,0);for(var P=0;P>24&255)===255){var w=l>>16&255,T=l>>8&255,C=l&255;w===255?(w=0,T===255?(T=0,C===255?C=0:++C):++T):++w,l=0,l+=w<<16,l+=T<<8,l+=C}else l+=1<<24;return l}function d(l){return(l[0]=u(l[0]))===0&&(l[1]=u(l[1])),l}var _=a.Encryptor=a.extend({processBlock:function(l,w){var T=this._cipher,C=T.blockSize,P=this._iv,z=this._counter;P&&(z=this._counter=P.slice(0),this._iv=void 0),d(z);var W=z.slice(0);T.encryptBlock(W,0);for(var U=0;U>>2]|=l<<24-w%4*8,a.sigBytes+=l},unpad:function(a){var u=a.words[a.sigBytes-1>>>2]&255;a.sigBytes-=u}},n.pad.Ansix923})}(bw)),bw.exports}var ww={exports:{}},DM;function AJ(){return DM||(DM=1,function(t,e){(function(n,a,u){t.exports=a(kr(),gi())})($e,function(n){return n.pad.Iso10126={pad:function(a,u){var d=u*4,_=d-a.sigBytes%d;a.concat(n.lib.WordArray.random(_-1)).concat(n.lib.WordArray.create([_<<24],1))},unpad:function(a){var u=a.words[a.sigBytes-1>>>2]&255;a.sigBytes-=u}},n.pad.Iso10126})}(ww)),ww.exports}var Ew={exports:{}},MM;function IJ(){return MM||(MM=1,function(t,e){(function(n,a,u){t.exports=a(kr(),gi())})($e,function(n){return n.pad.Iso97971={pad:function(a,u){a.concat(n.lib.WordArray.create([2147483648],1)),n.pad.ZeroPadding.pad(a,u)},unpad:function(a){n.pad.ZeroPadding.unpad(a),a.sigBytes--}},n.pad.Iso97971})}(Ew)),Ew.exports}var Sw={exports:{}},zM;function CJ(){return zM||(zM=1,function(t,e){(function(n,a,u){t.exports=a(kr(),gi())})($e,function(n){return n.pad.ZeroPadding={pad:function(a,u){var d=u*4;a.clamp(),a.sigBytes+=d-(a.sigBytes%d||d)},unpad:function(a){for(var u=a.words,d=a.sigBytes-1,d=a.sigBytes-1;d>=0;d--)if(u[d>>>2]>>>24-d%4*8&255){a.sigBytes=d+1;break}}},n.pad.ZeroPadding})}(Sw)),Sw.exports}var Tw={exports:{}},RM;function kJ(){return RM||(RM=1,function(t,e){(function(n,a,u){t.exports=a(kr(),gi())})($e,function(n){return n.pad.NoPadding={pad:function(){},unpad:function(){}},n.pad.NoPadding})}(Tw)),Tw.exports}var Aw={exports:{}},OM;function PJ(){return OM||(OM=1,function(t,e){(function(n,a,u){t.exports=a(kr(),gi())})($e,function(n){return function(a){var u=n,d=u.lib,_=d.CipherParams,l=u.enc,w=l.Hex,T=u.format;T.Hex={stringify:function(C){return C.ciphertext.toString(w)},parse:function(C){var P=w.parse(C);return _.create({ciphertext:P})}}}(),n.format.Hex})}(Aw)),Aw.exports}var Iw={exports:{}},FM;function DJ(){return FM||(FM=1,function(t,e){(function(n,a,u){t.exports=a(kr(),ju(),Vu(),Ac(),gi())})($e,function(n){return function(){var a=n,u=a.lib,d=u.BlockCipher,_=a.algo,l=[],w=[],T=[],C=[],P=[],z=[],W=[],U=[],j=[],L=[];(function(){for(var F=[],H=0;H<256;H++)H<128?F[H]=H<<1:F[H]=H<<1^283;for(var Q=0,te=0,H=0;H<256;H++){var se=te^te<<1^te<<2^te<<3^te<<4;se=se>>>8^se&255^99,l[Q]=se,w[se]=Q;var ge=F[Q],xe=F[ge],Ee=F[xe],Be=F[se]*257^se*16843008;T[Q]=Be<<24|Be>>>8,C[Q]=Be<<16|Be>>>16,P[Q]=Be<<8|Be>>>24,z[Q]=Be;var Be=Ee*16843009^xe*65537^ge*257^Q*16843008;W[se]=Be<<24|Be>>>8,U[se]=Be<<16|Be>>>16,j[se]=Be<<8|Be>>>24,L[se]=Be,Q?(Q=ge^F[F[F[Ee^ge]]],te^=F[F[te]]):Q=te=1}})();var V=[0,1,2,4,8,16,32,64,128,27,54],R=_.AES=d.extend({_doReset:function(){var F;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var H=this._keyPriorReset=this._key,Q=H.words,te=H.sigBytes/4,se=this._nRounds=te+6,ge=(se+1)*4,xe=this._keySchedule=[],Ee=0;Ee6&&Ee%te==4&&(F=l[F>>>24]<<24|l[F>>>16&255]<<16|l[F>>>8&255]<<8|l[F&255]):(F=F<<8|F>>>24,F=l[F>>>24]<<24|l[F>>>16&255]<<16|l[F>>>8&255]<<8|l[F&255],F^=V[Ee/te|0]<<24),xe[Ee]=xe[Ee-te]^F);for(var Be=this._invKeySchedule=[],Fe=0;Fe>>24]]^U[l[F>>>16&255]]^j[l[F>>>8&255]]^L[l[F&255]]}}},encryptBlock:function(F,H){this._doCryptBlock(F,H,this._keySchedule,T,C,P,z,l)},decryptBlock:function(F,H){var Q=F[H+1];F[H+1]=F[H+3],F[H+3]=Q,this._doCryptBlock(F,H,this._invKeySchedule,W,U,j,L,w);var Q=F[H+1];F[H+1]=F[H+3],F[H+3]=Q},_doCryptBlock:function(F,H,Q,te,se,ge,xe,Ee){for(var Be=this._nRounds,Fe=F[H]^Q[0],Ve=F[H+1]^Q[1],kt=F[H+2]^Q[2],Dt=F[H+3]^Q[3],Ut=4,cr=1;cr>>24]^se[Ve>>>16&255]^ge[kt>>>8&255]^xe[Dt&255]^Q[Ut++],Tt=te[Ve>>>24]^se[kt>>>16&255]^ge[Dt>>>8&255]^xe[Fe&255]^Q[Ut++],gt=te[kt>>>24]^se[Dt>>>16&255]^ge[Fe>>>8&255]^xe[Ve&255]^Q[Ut++],je=te[Dt>>>24]^se[Fe>>>16&255]^ge[Ve>>>8&255]^xe[kt&255]^Q[Ut++];Fe=qe,Ve=Tt,kt=gt,Dt=je}var qe=(Ee[Fe>>>24]<<24|Ee[Ve>>>16&255]<<16|Ee[kt>>>8&255]<<8|Ee[Dt&255])^Q[Ut++],Tt=(Ee[Ve>>>24]<<24|Ee[kt>>>16&255]<<16|Ee[Dt>>>8&255]<<8|Ee[Fe&255])^Q[Ut++],gt=(Ee[kt>>>24]<<24|Ee[Dt>>>16&255]<<16|Ee[Fe>>>8&255]<<8|Ee[Ve&255])^Q[Ut++],je=(Ee[Dt>>>24]<<24|Ee[Fe>>>16&255]<<16|Ee[Ve>>>8&255]<<8|Ee[kt&255])^Q[Ut++];F[H]=qe,F[H+1]=Tt,F[H+2]=gt,F[H+3]=je},keySize:256/32});a.AES=d._createHelper(R)}(),n.AES})}(Iw)),Iw.exports}var Cw={exports:{}},LM;function MJ(){return LM||(LM=1,function(t,e){(function(n,a,u){t.exports=a(kr(),ju(),Vu(),Ac(),gi())})($e,function(n){return function(){var a=n,u=a.lib,d=u.WordArray,_=u.BlockCipher,l=a.algo,w=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],T=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],C=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],P=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],z=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],W=l.DES=_.extend({_doReset:function(){for(var V=this._key,R=V.words,F=[],H=0;H<56;H++){var Q=w[H]-1;F[H]=R[Q>>>5]>>>31-Q%32&1}for(var te=this._subKeys=[],se=0;se<16;se++){for(var ge=te[se]=[],xe=C[se],H=0;H<24;H++)ge[H/6|0]|=F[(T[H]-1+xe)%28]<<31-H%6,ge[4+(H/6|0)]|=F[28+(T[H+24]-1+xe)%28]<<31-H%6;ge[0]=ge[0]<<1|ge[0]>>>31;for(var H=1;H<7;H++)ge[H]=ge[H]>>>(H-1)*4+3;ge[7]=ge[7]<<5|ge[7]>>>27}for(var Ee=this._invSubKeys=[],H=0;H<16;H++)Ee[H]=te[15-H]},encryptBlock:function(V,R){this._doCryptBlock(V,R,this._subKeys)},decryptBlock:function(V,R){this._doCryptBlock(V,R,this._invSubKeys)},_doCryptBlock:function(V,R,F){this._lBlock=V[R],this._rBlock=V[R+1],U.call(this,4,252645135),U.call(this,16,65535),j.call(this,2,858993459),j.call(this,8,16711935),U.call(this,1,1431655765);for(var H=0;H<16;H++){for(var Q=F[H],te=this._lBlock,se=this._rBlock,ge=0,xe=0;xe<8;xe++)ge|=P[xe][((se^Q[xe])&z[xe])>>>0];this._lBlock=se,this._rBlock=te^ge}var Ee=this._lBlock;this._lBlock=this._rBlock,this._rBlock=Ee,U.call(this,1,1431655765),j.call(this,8,16711935),j.call(this,2,858993459),U.call(this,16,65535),U.call(this,4,252645135),V[R]=this._lBlock,V[R+1]=this._rBlock},keySize:64/32,ivSize:64/32,blockSize:64/32});function U(V,R){var F=(this._lBlock>>>V^this._rBlock)&R;this._rBlock^=F,this._lBlock^=F<>>V^this._lBlock)&R;this._lBlock^=F,this._rBlock^=F<192.");var F=R.slice(0,2),H=R.length<4?R.slice(0,2):R.slice(2,4),Q=R.length<6?R.slice(0,2):R.slice(4,6);this._des1=W.createEncryptor(d.create(F)),this._des2=W.createEncryptor(d.create(H)),this._des3=W.createEncryptor(d.create(Q))},encryptBlock:function(V,R){this._des1.encryptBlock(V,R),this._des2.decryptBlock(V,R),this._des3.encryptBlock(V,R)},decryptBlock:function(V,R){this._des3.decryptBlock(V,R),this._des2.encryptBlock(V,R),this._des1.decryptBlock(V,R)},keySize:192/32,ivSize:64/32,blockSize:64/32});a.TripleDES=_._createHelper(L)}(),n.TripleDES})}(Cw)),Cw.exports}var kw={exports:{}},BM;function zJ(){return BM||(BM=1,function(t,e){(function(n,a,u){t.exports=a(kr(),ju(),Vu(),Ac(),gi())})($e,function(n){return function(){var a=n,u=a.lib,d=u.StreamCipher,_=a.algo,l=_.RC4=d.extend({_doReset:function(){for(var C=this._key,P=C.words,z=C.sigBytes,W=this._S=[],U=0;U<256;U++)W[U]=U;for(var U=0,j=0;U<256;U++){var L=U%z,V=P[L>>>2]>>>24-L%4*8&255;j=(j+W[U]+V)%256;var R=W[U];W[U]=W[j],W[j]=R}this._i=this._j=0},_doProcessBlock:function(C,P){C[P]^=w.call(this)},keySize:256/32,ivSize:0});function w(){for(var C=this._S,P=this._i,z=this._j,W=0,U=0;U<4;U++){P=(P+1)%256,z=(z+C[P])%256;var j=C[P];C[P]=C[z],C[z]=j,W|=C[(C[P]+C[z])%256]<<24-U*8}return this._i=P,this._j=z,W}a.RC4=d._createHelper(l);var T=_.RC4Drop=l.extend({cfg:l.cfg.extend({drop:192}),_doReset:function(){l._doReset.call(this);for(var C=this.cfg.drop;C>0;C--)w.call(this)}});a.RC4Drop=d._createHelper(T)}(),n.RC4})}(kw)),kw.exports}var Pw={exports:{}},NM;function RJ(){return NM||(NM=1,function(t,e){(function(n,a,u){t.exports=a(kr(),ju(),Vu(),Ac(),gi())})($e,function(n){return function(){var a=n,u=a.lib,d=u.StreamCipher,_=a.algo,l=[],w=[],T=[],C=_.Rabbit=d.extend({_doReset:function(){for(var z=this._key.words,W=this.cfg.iv,U=0;U<4;U++)z[U]=(z[U]<<8|z[U]>>>24)&16711935|(z[U]<<24|z[U]>>>8)&4278255360;var j=this._X=[z[0],z[3]<<16|z[2]>>>16,z[1],z[0]<<16|z[3]>>>16,z[2],z[1]<<16|z[0]>>>16,z[3],z[2]<<16|z[1]>>>16],L=this._C=[z[2]<<16|z[2]>>>16,z[0]&4294901760|z[1]&65535,z[3]<<16|z[3]>>>16,z[1]&4294901760|z[2]&65535,z[0]<<16|z[0]>>>16,z[2]&4294901760|z[3]&65535,z[1]<<16|z[1]>>>16,z[3]&4294901760|z[0]&65535];this._b=0;for(var U=0;U<4;U++)P.call(this);for(var U=0;U<8;U++)L[U]^=j[U+4&7];if(W){var V=W.words,R=V[0],F=V[1],H=(R<<8|R>>>24)&16711935|(R<<24|R>>>8)&4278255360,Q=(F<<8|F>>>24)&16711935|(F<<24|F>>>8)&4278255360,te=H>>>16|Q&4294901760,se=Q<<16|H&65535;L[0]^=H,L[1]^=te,L[2]^=Q,L[3]^=se,L[4]^=H,L[5]^=te,L[6]^=Q,L[7]^=se;for(var U=0;U<4;U++)P.call(this)}},_doProcessBlock:function(z,W){var U=this._X;P.call(this),l[0]=U[0]^U[5]>>>16^U[3]<<16,l[1]=U[2]^U[7]>>>16^U[5]<<16,l[2]=U[4]^U[1]>>>16^U[7]<<16,l[3]=U[6]^U[3]>>>16^U[1]<<16;for(var j=0;j<4;j++)l[j]=(l[j]<<8|l[j]>>>24)&16711935|(l[j]<<24|l[j]>>>8)&4278255360,z[W+j]^=l[j]},blockSize:128/32,ivSize:64/32});function P(){for(var z=this._X,W=this._C,U=0;U<8;U++)w[U]=W[U];W[0]=W[0]+1295307597+this._b|0,W[1]=W[1]+3545052371+(W[0]>>>0>>0?1:0)|0,W[2]=W[2]+886263092+(W[1]>>>0>>0?1:0)|0,W[3]=W[3]+1295307597+(W[2]>>>0>>0?1:0)|0,W[4]=W[4]+3545052371+(W[3]>>>0>>0?1:0)|0,W[5]=W[5]+886263092+(W[4]>>>0>>0?1:0)|0,W[6]=W[6]+1295307597+(W[5]>>>0>>0?1:0)|0,W[7]=W[7]+3545052371+(W[6]>>>0>>0?1:0)|0,this._b=W[7]>>>0>>0?1:0;for(var U=0;U<8;U++){var j=z[U]+W[U],L=j&65535,V=j>>>16,R=((L*L>>>17)+L*V>>>15)+V*V,F=((j&4294901760)*j|0)+((j&65535)*j|0);T[U]=R^F}z[0]=T[0]+(T[7]<<16|T[7]>>>16)+(T[6]<<16|T[6]>>>16)|0,z[1]=T[1]+(T[0]<<8|T[0]>>>24)+T[7]|0,z[2]=T[2]+(T[1]<<16|T[1]>>>16)+(T[0]<<16|T[0]>>>16)|0,z[3]=T[3]+(T[2]<<8|T[2]>>>24)+T[1]|0,z[4]=T[4]+(T[3]<<16|T[3]>>>16)+(T[2]<<16|T[2]>>>16)|0,z[5]=T[5]+(T[4]<<8|T[4]>>>24)+T[3]|0,z[6]=T[6]+(T[5]<<16|T[5]>>>16)+(T[4]<<16|T[4]>>>16)|0,z[7]=T[7]+(T[6]<<8|T[6]>>>24)+T[5]|0}a.Rabbit=d._createHelper(C)}(),n.Rabbit})}(Pw)),Pw.exports}var Dw={exports:{}},UM;function OJ(){return UM||(UM=1,function(t,e){(function(n,a,u){t.exports=a(kr(),ju(),Vu(),Ac(),gi())})($e,function(n){return function(){var a=n,u=a.lib,d=u.StreamCipher,_=a.algo,l=[],w=[],T=[],C=_.RabbitLegacy=d.extend({_doReset:function(){var z=this._key.words,W=this.cfg.iv,U=this._X=[z[0],z[3]<<16|z[2]>>>16,z[1],z[0]<<16|z[3]>>>16,z[2],z[1]<<16|z[0]>>>16,z[3],z[2]<<16|z[1]>>>16],j=this._C=[z[2]<<16|z[2]>>>16,z[0]&4294901760|z[1]&65535,z[3]<<16|z[3]>>>16,z[1]&4294901760|z[2]&65535,z[0]<<16|z[0]>>>16,z[2]&4294901760|z[3]&65535,z[1]<<16|z[1]>>>16,z[3]&4294901760|z[0]&65535];this._b=0;for(var L=0;L<4;L++)P.call(this);for(var L=0;L<8;L++)j[L]^=U[L+4&7];if(W){var V=W.words,R=V[0],F=V[1],H=(R<<8|R>>>24)&16711935|(R<<24|R>>>8)&4278255360,Q=(F<<8|F>>>24)&16711935|(F<<24|F>>>8)&4278255360,te=H>>>16|Q&4294901760,se=Q<<16|H&65535;j[0]^=H,j[1]^=te,j[2]^=Q,j[3]^=se,j[4]^=H,j[5]^=te,j[6]^=Q,j[7]^=se;for(var L=0;L<4;L++)P.call(this)}},_doProcessBlock:function(z,W){var U=this._X;P.call(this),l[0]=U[0]^U[5]>>>16^U[3]<<16,l[1]=U[2]^U[7]>>>16^U[5]<<16,l[2]=U[4]^U[1]>>>16^U[7]<<16,l[3]=U[6]^U[3]>>>16^U[1]<<16;for(var j=0;j<4;j++)l[j]=(l[j]<<8|l[j]>>>24)&16711935|(l[j]<<24|l[j]>>>8)&4278255360,z[W+j]^=l[j]},blockSize:128/32,ivSize:64/32});function P(){for(var z=this._X,W=this._C,U=0;U<8;U++)w[U]=W[U];W[0]=W[0]+1295307597+this._b|0,W[1]=W[1]+3545052371+(W[0]>>>0>>0?1:0)|0,W[2]=W[2]+886263092+(W[1]>>>0>>0?1:0)|0,W[3]=W[3]+1295307597+(W[2]>>>0>>0?1:0)|0,W[4]=W[4]+3545052371+(W[3]>>>0>>0?1:0)|0,W[5]=W[5]+886263092+(W[4]>>>0>>0?1:0)|0,W[6]=W[6]+1295307597+(W[5]>>>0>>0?1:0)|0,W[7]=W[7]+3545052371+(W[6]>>>0>>0?1:0)|0,this._b=W[7]>>>0>>0?1:0;for(var U=0;U<8;U++){var j=z[U]+W[U],L=j&65535,V=j>>>16,R=((L*L>>>17)+L*V>>>15)+V*V,F=((j&4294901760)*j|0)+((j&65535)*j|0);T[U]=R^F}z[0]=T[0]+(T[7]<<16|T[7]>>>16)+(T[6]<<16|T[6]>>>16)|0,z[1]=T[1]+(T[0]<<8|T[0]>>>24)+T[7]|0,z[2]=T[2]+(T[1]<<16|T[1]>>>16)+(T[0]<<16|T[0]>>>16)|0,z[3]=T[3]+(T[2]<<8|T[2]>>>24)+T[1]|0,z[4]=T[4]+(T[3]<<16|T[3]>>>16)+(T[2]<<16|T[2]>>>16)|0,z[5]=T[5]+(T[4]<<8|T[4]>>>24)+T[3]|0,z[6]=T[6]+(T[5]<<16|T[5]>>>16)+(T[4]<<16|T[4]>>>16)|0,z[7]=T[7]+(T[6]<<8|T[6]>>>24)+T[5]|0}a.RabbitLegacy=d._createHelper(C)}(),n.RabbitLegacy})}(Dw)),Dw.exports}var Mw={exports:{}},jM;function FJ(){return jM||(jM=1,function(t,e){(function(n,a,u){t.exports=a(kr(),ju(),Vu(),Ac(),gi())})($e,function(n){return function(){var a=n,u=a.lib,d=u.BlockCipher,_=a.algo;const l=16,w=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],T=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var C={pbox:[],sbox:[]};function P(L,V){let R=V>>24&255,F=V>>16&255,H=V>>8&255,Q=V&255,te=L.sbox[0][R]+L.sbox[1][F];return te=te^L.sbox[2][H],te=te+L.sbox[3][Q],te}function z(L,V,R){let F=V,H=R,Q;for(let te=0;te1;--te)F=F^L.pbox[te],H=P(L,F)^H,Q=F,F=H,H=Q;return Q=F,F=H,H=Q,H=H^L.pbox[1],F=F^L.pbox[0],{left:F,right:H}}function U(L,V,R){for(let se=0;se<4;se++){L.sbox[se]=[];for(let ge=0;ge<256;ge++)L.sbox[se][ge]=T[se][ge]}let F=0;for(let se=0;se=R&&(F=0);let H=0,Q=0,te=0;for(let se=0;se0&&setTimeout(T=>{console.log(`Will append content to ${w.className}: `,l),l.childNodes.forEach(C=>{if(C.nodeType===1){const P=C;T.insertAdjacentElement("beforeend",P)}})},53,w),d=!0)}}return St.useEffect(()=>{n!==null&&a!==null&&setTimeout(function(){const l=typeof e=="function"?e():null;if(console.log("viz_content:",l),l!==null){const w=l==null?void 0:l.querySelector(n);console.log("viz:",w),w.token=$J(UJ,BJ,NJ,LJ,VJ),new Promise((T,C)=>{console.log("About to reference @tableau/embedding-api..."),w.addEventListener(aM.FirstInteractive,()=>{console.log("Viz is interactive!"),T()}),w.addEventListener(aM.VizLoadError,P=>{const z=JSON.parse(P.detail.message),U=`ca-error-${JSON.parse(z.errorMessage).result.errors[0].code}`;console.log("Error",U,z),C(U)})}).then(T=>{var z;let C,P;((z=w.workbook.activeSheet)==null?void 0:z.sheetType)===(Yb==null?void 0:Yb.Dashboard)?(C=w.workbook.activeSheet,P=C==null?void 0:C.worksheets.find(W=>W.name==="Replace-Name-of-Worksheet")):P=w.workbook.activeSheet,console.log("Tableau Viz Dashboard: ",C),console.log("Tableau Viz Worksheet: ",P)}),t&&w!==null?_(l):d=!0}},a+1e3)},[]),St.createElement("div",{className:u})}const Rw="pk.eyJ1IjoicnVyYWxpbm5vIiwiYSI6ImNqeHl0cW0xODBlMm0zY2x0dXltYzRuazUifQ.zZBovoCHzLIW0wCZveEKzA",$M="/examples/cori.data.rin/rin_service_areas.geojson";function WJ({app_id:t,attach_content:e=!1,content:n,content_selector:a,content_timeout:u}){var U;const d=St.useContext(ZR),[_,l]=St.useState(!0);function w(){u&&u!==null&&setTimeout(function(){if(!_){const j=document.getElementById(t);if(j){const L=typeof n=="function"?n():null;L!==null&&L.childNodes!==null&&L.childNodes.length>0&&(console.log(`Will append content to ${t}: `,L),setTimeout(V=>{L.childNodes.forEach(R=>{if(R.nodeType===1){const F=R;V.insertAdjacentElement("beforeend",F)}})},53,j),l(!0))}}},u+1e3)}St.useEffect(()=>{console.log("Viz content loaded:",_,a,u,n()),e?w():l(!0)},[]);const T=St.useRef(null),C=St.useMemo(()=>(j,L,V,R)=>{const F=new hT.Popup;return R.hasOwnProperty(V)?(F.setLngLat([j,L]),F.setText(R[V])):F.setText("Hello world!"),F},[]);let P=!1;function z(j,L,V,R,F,H,Q){return console.log(`Set marker (${Q[H]+"-marker"}): `,T),St.createElement(KR,{ref:j,longitude:L,latitude:V,color:R,popup:F(L,V,H,Q),key:Q[H]+"-marker"})}St.useEffect(()=>{if(d&&!d.data.hasOwnProperty("placeData")&&!P){console.log("Initial place data fetch..."),console.log($M),P=!0;const j=window.document.getElementById("info-wrapper");j!==null&&(j.style.opacity="1.0",j.style.position="absolute",j.style.background=`rgba(46, 60, 67, 0.5) url('${d.baseURL}/images/loading.gif') no-repeat fixed center`,j.style.backgroundSize="20px"),d.setData({...(d==null?void 0:d.data)||{},placeData:null}),d==null||d.apiClient.get($M).then(L=>{L&&L.hasOwnProperty("data")&&(d.setData({...d.data,placeData:L.data.features}),P=!1,j!==null&&(j.style.opacity="0.0",j.style.pointerEvents="none",setTimeout(()=>{j.style.background="transparent"},533)))}).catch(L=>{console.error("Error fetching data:",L),P=!1,j!==null&&(j.style.opacity="0.0",j.style.pointerEvents="none",setTimeout(()=>{j.style.background="transparent"},533))})}},[d==null?void 0:d.data]);const W=[];return St.createElement(St.Fragment,null,St.createElement("div",{className:"slippy-map"},St.createElement(jV,{mapboxAccessToken:Rw,initialViewState:{latitude:40,longitude:-99,pitch:45,zoom:4},style:{width:600,height:400},mapStyle:`https://api.mapbox.com/styles/v1/ruralinno/cl010e7b7001p15pe3l0306hv?access_token=${Rw}`},!!(d!=null&&d.data)&&!!((U=d==null?void 0:d.data)!=null&&U.placeData)&&d.data.placeData.length>0&&!!T&&typeof T!==void 0&&d.data.placeData.filter(j=>{const L=j.properties.rin_community.toString();return W.filter(V=>V===L).length<1?(W.push(L),!0):!1}).map(j=>{console.log(j.properties.rin_community);const L=typeof j.geometry.coordinates[0]=="number"?j.geometry.coordinates[0]:0,V=typeof j.geometry.coordinates[1]=="number"?j.geometry.coordinates[1]:0;return z(T,L,V,"#16343e",C,"rin_community",j.properties)}),St.createElement(Q9,{mapboxAccessToken:Rw,position:"top-right"}),St.createElement($V,{position:"top-right"}),St.createElement(VV,{position:"top-right"}),St.createElement(WV,{position:"bottom-left",unit:"imperial"}))),St.createElement("div",{id:"info-wrapper",style:{pointerEvents:"none",position:"absolute",top:0,left:0,minWidth:"100vw",minHeight:"100vh",transition:"opacity 5.05s ease-in-out 0.025s",opacity:"initial",background:"transparent",backgroundSize:"20px",zIndex:100}}),!!_&&!!a&&!!u&&(e?St.createElement(VM,{attach_content:e,content:()=>n(),content_selector:a,content_timeout:u+1e3}):St.createElement("div",{className:"hide tableau-viz-container",style:{display:"block",visibility:"hidden",width:0,height:0}},St.createElement(VM,{attach_content:e,content:()=>n(),content_selector:a,content_timeout:u+1e3}))))}const GJ="https://cori-risi-apps.s3.amazonaws.com",HJ=333;function qJ(t,e){const n=document.getElementById(t)||document.createElement("div"),a=document.createElement("div");n.id=t,document.getElementById("loader")!==null&&document.getElementById("loader").remove();for(const u of n.childNodes){const d=u;u.nodeType===1&&a.appendChild(d)}tR(n).render(St.createElement(St.StrictMode,null,St.createElement(uV,{baseURL:GJ},St.createElement(WJ,{app_id:t,attach_content:!1,content:()=>e!==null&&document.querySelector(e)!==null?document.querySelector(e).parentElement:a,content_selector:e,content_timeout:HJ}))))}qJ("app","tableau-viz, tableau-authoring-viz"); diff --git a/docs/assets/index-f19a5a1d.js b/docs/assets/index-f19a5a1d.js new file mode 100644 index 0000000..3b82c9d --- /dev/null +++ b/docs/assets/index-f19a5a1d.js @@ -0,0 +1,1404 @@ +function bL(t,e){for(var n=0;na[u]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const u of document.querySelectorAll('link[rel="modulepreload"]'))a(u);new MutationObserver(u=>{for(const d of u)if(d.type==="childList")for(const _ of d.addedNodes)_.tagName==="LINK"&&_.rel==="modulepreload"&&a(_)}).observe(document,{childList:!0,subtree:!0});function n(u){const d={};return u.integrity&&(d.integrity=u.integrity),u.referrerPolicy&&(d.referrerPolicy=u.referrerPolicy),u.crossOrigin==="use-credentials"?d.credentials="include":u.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function a(u){if(u.ep)return;u.ep=!0;const d=n(u);fetch(u.href,d)}})();var $e=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function XE(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function WM(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var n=function a(){return this instanceof a?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(a){var u=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(n,a,u.get?u:{enumerable:!0,get:function(){return t[a]}})}),n}var GM={exports:{}},xr={};/** + * @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 Rm=Symbol.for("react.element"),wL=Symbol.for("react.portal"),EL=Symbol.for("react.fragment"),SL=Symbol.for("react.strict_mode"),TL=Symbol.for("react.profiler"),AL=Symbol.for("react.provider"),IL=Symbol.for("react.context"),CL=Symbol.for("react.forward_ref"),kL=Symbol.for("react.suspense"),PL=Symbol.for("react.memo"),DL=Symbol.for("react.lazy"),lC=Symbol.iterator;function ML(t){return t===null||typeof t!="object"?null:(t=lC&&t[lC]||t["@@iterator"],typeof t=="function"?t:null)}var HM={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},qM=Object.assign,ZM={};function Md(t,e,n){this.props=t,this.context=e,this.refs=ZM,this.updater=n||HM}Md.prototype.isReactComponent={};Md.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=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,t,e,"setState")};Md.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function KM(){}KM.prototype=Md.prototype;function YE(t,e,n){this.props=t,this.context=e,this.refs=ZM,this.updater=n||HM}var QE=YE.prototype=new KM;QE.constructor=YE;qM(QE,Md.prototype);QE.isPureReactComponent=!0;var cC=Array.isArray,XM=Object.prototype.hasOwnProperty,JE={current:null},YM={key:!0,ref:!0,__self:!0,__source:!0};function QM(t,e,n){var a,u={},d=null,_=null;if(e!=null)for(a in e.ref!==void 0&&(_=e.ref),e.key!==void 0&&(d=""+e.key),e)XM.call(e,a)&&!YM.hasOwnProperty(a)&&(u[a]=e[a]);var l=arguments.length-2;if(l===1)u.children=n;else if(1>>1,et=qe[je];if(0>>1;jeu(ur,gt))Xtu(Pr,ur)?(qe[je]=Pr,qe[Xt]=gt,je=Xt):(qe[je]=ur,qe[it]=gt,je=it);else if(Xtu(Pr,gt))qe[je]=Pr,qe[Xt]=gt,je=Xt;else break e}}return Tt}function u(qe,Tt){var gt=qe.sortIndex-Tt.sortIndex;return gt!==0?gt:qe.id-Tt.id}if(typeof performance=="object"&&typeof performance.now=="function"){var d=performance;t.unstable_now=function(){return d.now()}}else{var _=Date,l=_.now();t.unstable_now=function(){return _.now()-l}}var w=[],T=[],C=1,P=null,z=3,W=!1,U=!1,j=!1,L=typeof setTimeout=="function"?setTimeout:null,V=typeof clearTimeout=="function"?clearTimeout:null,R=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function F(qe){for(var Tt=n(T);Tt!==null;){if(Tt.callback===null)a(T);else if(Tt.startTime<=qe)a(T),Tt.sortIndex=Tt.expirationTime,e(w,Tt);else break;Tt=n(T)}}function H(qe){if(j=!1,F(qe),!U)if(n(w)!==null)U=!0,Ut(Q);else{var Tt=n(T);Tt!==null&&cr(H,Tt.startTime-qe)}}function Q(qe,Tt){U=!1,j&&(j=!1,V(ge),ge=-1),W=!0;var gt=z;try{for(F(Tt),P=n(w);P!==null&&(!(P.expirationTime>Tt)||qe&&!Be());){var je=P.callback;if(typeof je=="function"){P.callback=null,z=P.priorityLevel;var et=je(P.expirationTime<=Tt);Tt=t.unstable_now(),typeof et=="function"?P.callback=et:P===n(w)&&a(w),F(Tt)}else a(w);P=n(w)}if(P!==null)var nt=!0;else{var it=n(T);it!==null&&cr(H,it.startTime-Tt),nt=!1}return nt}finally{P=null,z=gt,W=!1}}var te=!1,se=null,ge=-1,xe=5,Ee=-1;function Be(){return!(t.unstable_now()-Eeqe||125je?(qe.sortIndex=gt,e(T,qe),n(w)===null&&qe===n(T)&&(j?(V(ge),ge=-1):j=!0,cr(H,gt-je))):(qe.sortIndex=et,e(w,qe),U||W||(U=!0,Ut(Q))),qe},t.unstable_shouldYield=Be,t.unstable_wrapCallback=function(qe){var Tt=z;return function(){var gt=z;z=Tt;try{return qe.apply(this,arguments)}finally{z=gt}}}})(rz);tz.exports=rz;var LL=tz.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 BL=St,Uo=LL;function yt(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ow=Object.prototype.hasOwnProperty,NL=/^[: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]*$/,hC={},dC={};function UL(t){return Ow.call(dC,t)?!0:Ow.call(hC,t)?!1:NL.test(t)?dC[t]=!0:(hC[t]=!0,!1)}function jL(t,e,n,a){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return a?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function VL(t,e,n,a){if(e===null||typeof e>"u"||jL(t,e,n,a))return!0;if(a)return!1;if(n!==null)switch(n.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function to(t,e,n,a,u,d,_){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=a,this.attributeNamespace=u,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=d,this.removeEmptyString=_}var Ai={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Ai[t]=new to(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Ai[e]=new to(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Ai[t]=new to(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Ai[t]=new to(t,2,!1,t,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(t){Ai[t]=new to(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Ai[t]=new to(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Ai[t]=new to(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Ai[t]=new to(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Ai[t]=new to(t,5,!1,t.toLowerCase(),null,!1,!1)});var tS=/[\-:]([a-z])/g;function rS(t){return t[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(t){var e=t.replace(tS,rS);Ai[e]=new to(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(tS,rS);Ai[e]=new to(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(tS,rS);Ai[e]=new to(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Ai[t]=new to(t,1,!1,t.toLowerCase(),null,!1,!1)});Ai.xlinkHref=new to("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Ai[t]=new to(t,1,!1,t.toLowerCase(),null,!0,!0)});function nS(t,e,n,a){var u=Ai.hasOwnProperty(e)?Ai[e]:null;(u!==null?u.type!==0:a||!(2l||u[_]!==d[l]){var w=` +`+u[_].replace(" at new "," at ");return t.displayName&&w.includes("")&&(w=w.replace("",t.displayName)),w}while(1<=_&&0<=l);break}}}finally{P1=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?Xf(t):""}function $L(t){switch(t.tag){case 5:return Xf(t.type);case 16:return Xf("Lazy");case 13:return Xf("Suspense");case 19:return Xf("SuspenseList");case 0:case 2:case 15:return t=D1(t.type,!1),t;case 11:return t=D1(t.type.render,!1),t;case 1:return t=D1(t.type,!0),t;default:return""}}function Nw(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case td:return"Fragment";case ed:return"Portal";case Fw:return"Profiler";case iS:return"StrictMode";case Lw:return"Suspense";case Bw:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case oz:return(t.displayName||"Context")+".Consumer";case iz:return(t._context.displayName||"Context")+".Provider";case oS:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case aS:return e=t.displayName||null,e!==null?e:Nw(t.type)||"Memo";case ec:e=t._payload,t=t._init;try{return Nw(t(e))}catch{}}return null}function WL(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Nw(e);case 8:return e===iS?"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 e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function gc(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function sz(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function GL(t){var e=sz(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),a=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var u=n.get,d=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return u.call(this)},set:function(_){a=""+_,d.call(this,_)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return a},setValue:function(_){a=""+_},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function Ig(t){t._valueTracker||(t._valueTracker=GL(t))}function lz(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),a="";return t&&(a=sz(t)?t.checked?"true":"false":t.value),t=a,t!==n?(e.setValue(t),!0):!1}function Jy(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function Uw(t,e){var n=e.checked;return Pn({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function fC(t,e){var n=e.defaultValue==null?"":e.defaultValue,a=e.checked!=null?e.checked:e.defaultChecked;n=gc(e.value!=null?e.value:n),t._wrapperState={initialChecked:a,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function cz(t,e){e=e.checked,e!=null&&nS(t,"checked",e,!1)}function jw(t,e){cz(t,e);var n=gc(e.value),a=e.type;if(n!=null)a==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(a==="submit"||a==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?Vw(t,e.type,n):e.hasOwnProperty("defaultValue")&&Vw(t,e.type,gc(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function mC(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var a=e.type;if(!(a!=="submit"&&a!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function Vw(t,e,n){(e!=="number"||Jy(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var Yf=Array.isArray;function md(t,e,n,a){if(t=t.options,e){e={};for(var u=0;u"+e.valueOf().toString()+"",e=Cg.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function dm(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var em={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},HL=["Webkit","ms","Moz","O"];Object.keys(em).forEach(function(t){HL.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),em[e]=em[t]})});function pz(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||em.hasOwnProperty(t)&&em[t]?(""+e).trim():e+"px"}function fz(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var a=n.indexOf("--")===0,u=pz(n,e[n],a);n==="float"&&(n="cssFloat"),a?t.setProperty(n,u):t[n]=u}}var qL=Pn({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 Gw(t,e){if(e){if(qL[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(yt(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(yt(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(yt(61))}if(e.style!=null&&typeof e.style!="object")throw Error(yt(62))}}function Hw(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){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 qw=null;function sS(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Zw=null,gd=null,yd=null;function _C(t){if(t=Lm(t)){if(typeof Zw!="function")throw Error(yt(280));var e=t.stateNode;e&&(e=U_(e),Zw(t.stateNode,t.type,e))}}function mz(t){gd?yd?yd.push(t):yd=[t]:gd=t}function gz(){if(gd){var t=gd,e=yd;if(yd=gd=null,_C(t),e)for(t=0;t>>=0,t===0?32:31-(iB(t)/oB|0)|0}var kg=64,Pg=4194304;function Qf(t){switch(t&-t){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 t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function n_(t,e){var n=t.pendingLanes;if(n===0)return 0;var a=0,u=t.suspendedLanes,d=t.pingedLanes,_=n&268435455;if(_!==0){var l=_&~u;l!==0?a=Qf(l):(d&=_,d!==0&&(a=Qf(d)))}else _=n&~u,_!==0?a=Qf(_):d!==0&&(a=Qf(d));if(a===0)return 0;if(e!==0&&e!==a&&!(e&u)&&(u=a&-a,d=e&-e,u>=d||u===16&&(d&4194240)!==0))return e;if(a&4&&(a|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=a;0n;n++)e.push(t);return e}function Om(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Wa(e),t[e]=n}function cB(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var a=t.eventTimes;for(t=t.expirationTimes;0=rm),IC=String.fromCharCode(32),CC=!1;function Fz(t,e){switch(t){case"keyup":return LB.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Lz(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var rd=!1;function NB(t,e){switch(t){case"compositionend":return Lz(e);case"keypress":return e.which!==32?null:(CC=!0,IC);case"textInput":return t=e.data,t===IC&&CC?null:t;default:return null}}function UB(t,e){if(rd)return t==="compositionend"||!mS&&Fz(t,e)?(t=Rz(),Fy=dS=ic=null,rd=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:n,offset:e-t};t=a}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=MC(n)}}function jz(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?jz(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function Vz(){for(var t=window,e=Jy();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=Jy(t.document)}return e}function gS(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function KB(t){var e=Vz(),n=t.focusedElem,a=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&jz(n.ownerDocument.documentElement,n)){if(a!==null&&gS(n)){if(e=a.start,t=a.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var u=n.textContent.length,d=Math.min(a.start,u);a=a.end===void 0?d:Math.min(a.end,u),!t.extend&&d>a&&(u=a,a=d,d=u),u=zC(n,d);var _=zC(n,a);u&&_&&(t.rangeCount!==1||t.anchorNode!==u.node||t.anchorOffset!==u.offset||t.focusNode!==_.node||t.focusOffset!==_.offset)&&(e=e.createRange(),e.setStart(u.node,u.offset),t.removeAllRanges(),d>a?(t.addRange(e),t.extend(_.node,_.offset)):(e.setEnd(_.node,_.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,nd=null,eE=null,im=null,tE=!1;function RC(t,e,n){var a=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;tE||nd==null||nd!==Jy(a)||(a=nd,"selectionStart"in a&&gS(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),im&&_m(im,a)||(im=a,a=a_(eE,"onSelect"),0ad||(t.current=sE[ad],sE[ad]=null,ad--)}function on(t,e){ad++,sE[ad]=t.current,t.current=e}var yc={},Wi=bc(yc),go=bc(!1),ku=yc;function Sd(t,e){var n=t.type.contextTypes;if(!n)return yc;var a=t.stateNode;if(a&&a.__reactInternalMemoizedUnmaskedChildContext===e)return a.__reactInternalMemoizedMaskedChildContext;var u={},d;for(d in n)u[d]=e[d];return a&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=u),u}function yo(t){return t=t.childContextTypes,t!=null}function l_(){dn(go),dn(Wi)}function jC(t,e,n){if(Wi.current!==yc)throw Error(yt(168));on(Wi,e),on(go,n)}function Yz(t,e,n){var a=t.stateNode;if(e=e.childContextTypes,typeof a.getChildContext!="function")return n;a=a.getChildContext();for(var u in a)if(!(u in e))throw Error(yt(108,WL(t)||"Unknown",u));return Pn({},n,a)}function c_(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||yc,ku=Wi.current,on(Wi,t),on(go,go.current),!0}function VC(t,e,n){var a=t.stateNode;if(!a)throw Error(yt(169));n?(t=Yz(t,e,ku),a.__reactInternalMemoizedMergedChildContext=t,dn(go),dn(Wi),on(Wi,t)):dn(go),on(go,n)}var tl=null,j_=!1,G1=!1;function Qz(t){tl===null?tl=[t]:tl.push(t)}function s8(t){j_=!0,Qz(t)}function wc(){if(!G1&&tl!==null){G1=!0;var t=0,e=Kr;try{var n=tl;for(Kr=1;t>=_,u-=_,il=1<<32-Wa(e)+u|n<ge?(xe=se,se=null):xe=se.sibling;var Ee=z(V,se,F[ge],H);if(Ee===null){se===null&&(se=xe);break}t&&se&&Ee.alternate===null&&e(V,se),R=d(Ee,R,ge),te===null?Q=Ee:te.sibling=Ee,te=Ee,se=xe}if(ge===F.length)return n(V,se),gn&&xu(V,ge),Q;if(se===null){for(;gege?(xe=se,se=null):xe=se.sibling;var Be=z(V,se,Ee.value,H);if(Be===null){se===null&&(se=xe);break}t&&se&&Be.alternate===null&&e(V,se),R=d(Be,R,ge),te===null?Q=Be:te.sibling=Be,te=Be,se=xe}if(Ee.done)return n(V,se),gn&&xu(V,ge),Q;if(se===null){for(;!Ee.done;ge++,Ee=F.next())Ee=P(V,Ee.value,H),Ee!==null&&(R=d(Ee,R,ge),te===null?Q=Ee:te.sibling=Ee,te=Ee);return gn&&xu(V,ge),Q}for(se=a(V,se);!Ee.done;ge++,Ee=F.next())Ee=W(se,V,ge,Ee.value,H),Ee!==null&&(t&&Ee.alternate!==null&&se.delete(Ee.key===null?ge:Ee.key),R=d(Ee,R,ge),te===null?Q=Ee:te.sibling=Ee,te=Ee);return t&&se.forEach(function(Fe){return e(V,Fe)}),gn&&xu(V,ge),Q}function L(V,R,F,H){if(typeof F=="object"&&F!==null&&F.type===td&&F.key===null&&(F=F.props.children),typeof F=="object"&&F!==null){switch(F.$$typeof){case Ag:e:{for(var Q=F.key,te=R;te!==null;){if(te.key===Q){if(Q=F.type,Q===td){if(te.tag===7){n(V,te.sibling),R=u(te,F.props.children),R.return=V,V=R;break e}}else if(te.elementType===Q||typeof Q=="object"&&Q!==null&&Q.$$typeof===ec&&GC(Q)===te.type){n(V,te.sibling),R=u(te,F.props),R.ref=Pf(V,te,F),R.return=V,V=R;break e}n(V,te);break}else e(V,te);te=te.sibling}F.type===td?(R=Cu(F.props.children,V.mode,H,F.key),R.return=V,V=R):(H=Wy(F.type,F.key,F.props,null,V.mode,H),H.ref=Pf(V,R,F),H.return=V,V=H)}return _(V);case ed:e:{for(te=F.key;R!==null;){if(R.key===te)if(R.tag===4&&R.stateNode.containerInfo===F.containerInfo&&R.stateNode.implementation===F.implementation){n(V,R.sibling),R=u(R,F.children||[]),R.return=V,V=R;break e}else{n(V,R);break}else e(V,R);R=R.sibling}R=J1(F,V.mode,H),R.return=V,V=R}return _(V);case ec:return te=F._init,L(V,R,te(F._payload),H)}if(Yf(F))return U(V,R,F,H);if(Tf(F))return j(V,R,F,H);Lg(V,F)}return typeof F=="string"&&F!==""||typeof F=="number"?(F=""+F,R!==null&&R.tag===6?(n(V,R.sibling),R=u(R,F),R.return=V,V=R):(n(V,R),R=Q1(F,V.mode,H),R.return=V,V=R),_(V)):n(V,R)}return L}var Ad=r4(!0),n4=r4(!1),d_=bc(null),p_=null,cd=null,xS=null;function bS(){xS=cd=p_=null}function wS(t){var e=d_.current;dn(d_),t._currentValue=e}function uE(t,e,n){for(;t!==null;){var a=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,a!==null&&(a.childLanes|=e)):a!==null&&(a.childLanes&e)!==e&&(a.childLanes|=e),t===n)break;t=t.return}}function vd(t,e){p_=t,xS=cd=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(mo=!0),t.firstContext=null)}function ha(t){var e=t._currentValue;if(xS!==t)if(t={context:t,memoizedValue:e,next:null},cd===null){if(p_===null)throw Error(yt(308));cd=t,p_.dependencies={lanes:0,firstContext:t}}else cd=cd.next=t;return e}var Su=null;function ES(t){Su===null?Su=[t]:Su.push(t)}function i4(t,e,n,a){var u=e.interleaved;return u===null?(n.next=n,ES(e)):(n.next=u.next,u.next=n),e.interleaved=n,cl(t,a)}function cl(t,e){t.lanes|=e;var n=t.alternate;for(n!==null&&(n.lanes|=e),n=t,t=t.return;t!==null;)t.childLanes|=e,n=t.alternate,n!==null&&(n.childLanes|=e),n=t,t=t.return;return n.tag===3?n.stateNode:null}var tc=!1;function SS(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function o4(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function al(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function hc(t,e,n){var a=t.updateQueue;if(a===null)return null;if(a=a.shared,Dr&2){var u=a.pending;return u===null?e.next=e:(e.next=u.next,u.next=e),a.pending=e,cl(t,n)}return u=a.interleaved,u===null?(e.next=e,ES(a)):(e.next=u.next,u.next=e),a.interleaved=e,cl(t,n)}function By(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194240)!==0)){var a=e.lanes;a&=t.pendingLanes,n|=a,e.lanes=n,cS(t,n)}}function HC(t,e){var n=t.updateQueue,a=t.alternate;if(a!==null&&(a=a.updateQueue,n===a)){var u=null,d=null;if(n=n.firstBaseUpdate,n!==null){do{var _={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};d===null?u=d=_:d=d.next=_,n=n.next}while(n!==null);d===null?u=d=e:d=d.next=e}else u=d=e;n={baseState:a.baseState,firstBaseUpdate:u,lastBaseUpdate:d,shared:a.shared,effects:a.effects},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}function f_(t,e,n,a){var u=t.updateQueue;tc=!1;var d=u.firstBaseUpdate,_=u.lastBaseUpdate,l=u.shared.pending;if(l!==null){u.shared.pending=null;var w=l,T=w.next;w.next=null,_===null?d=T:_.next=T,_=w;var C=t.alternate;C!==null&&(C=C.updateQueue,l=C.lastBaseUpdate,l!==_&&(l===null?C.firstBaseUpdate=T:l.next=T,C.lastBaseUpdate=w))}if(d!==null){var P=u.baseState;_=0,C=T=w=null,l=d;do{var z=l.lane,W=l.eventTime;if((a&z)===z){C!==null&&(C=C.next={eventTime:W,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var U=t,j=l;switch(z=e,W=n,j.tag){case 1:if(U=j.payload,typeof U=="function"){P=U.call(W,P,z);break e}P=U;break e;case 3:U.flags=U.flags&-65537|128;case 0:if(U=j.payload,z=typeof U=="function"?U.call(W,P,z):U,z==null)break e;P=Pn({},P,z);break e;case 2:tc=!0}}l.callback!==null&&l.lane!==0&&(t.flags|=64,z=u.effects,z===null?u.effects=[l]:z.push(l))}else W={eventTime:W,lane:z,tag:l.tag,payload:l.payload,callback:l.callback,next:null},C===null?(T=C=W,w=P):C=C.next=W,_|=z;if(l=l.next,l===null){if(l=u.shared.pending,l===null)break;z=l,l=z.next,z.next=null,u.lastBaseUpdate=z,u.shared.pending=null}}while(1);if(C===null&&(w=P),u.baseState=w,u.firstBaseUpdate=T,u.lastBaseUpdate=C,e=u.shared.interleaved,e!==null){u=e;do _|=u.lane,u=u.next;while(u!==e)}else d===null&&(u.shared.lanes=0);Mu|=_,t.lanes=_,t.memoizedState=P}}function qC(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;en?n:4,t(!0);var a=q1.transition;q1.transition={};try{t(!1),e()}finally{Kr=n,q1.transition=a}}function w4(){return da().memoizedState}function h8(t,e,n){var a=pc(t);if(n={lane:a,action:n,hasEagerState:!1,eagerState:null,next:null},E4(t))S4(e,n);else if(n=i4(t,e,n,a),n!==null){var u=Ji();Ga(n,t,a,u),T4(n,e,a)}}function d8(t,e,n){var a=pc(t),u={lane:a,action:n,hasEagerState:!1,eagerState:null,next:null};if(E4(t))S4(e,u);else{var d=t.alternate;if(t.lanes===0&&(d===null||d.lanes===0)&&(d=e.lastRenderedReducer,d!==null))try{var _=e.lastRenderedState,l=d(_,n);if(u.hasEagerState=!0,u.eagerState=l,Za(l,_)){var w=e.interleaved;w===null?(u.next=u,ES(e)):(u.next=w.next,w.next=u),e.interleaved=u;return}}catch{}finally{}n=i4(t,e,u,a),n!==null&&(u=Ji(),Ga(n,t,a,u),T4(n,e,a))}}function E4(t){var e=t.alternate;return t===kn||e!==null&&e===kn}function S4(t,e){om=g_=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function T4(t,e,n){if(n&4194240){var a=e.lanes;a&=t.pendingLanes,n|=a,e.lanes=n,cS(t,n)}}var y_={readContext:ha,useCallback:Fi,useContext:Fi,useEffect:Fi,useImperativeHandle:Fi,useInsertionEffect:Fi,useLayoutEffect:Fi,useMemo:Fi,useReducer:Fi,useRef:Fi,useState:Fi,useDebugValue:Fi,useDeferredValue:Fi,useTransition:Fi,useMutableSource:Fi,useSyncExternalStore:Fi,useId:Fi,unstable_isNewReconciler:!1},p8={readContext:ha,useCallback:function(t,e){return ws().memoizedState=[t,e===void 0?null:e],t},useContext:ha,useEffect:KC,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,Uy(4194308,4,y4.bind(null,e,t),n)},useLayoutEffect:function(t,e){return Uy(4194308,4,t,e)},useInsertionEffect:function(t,e){return Uy(4,2,t,e)},useMemo:function(t,e){var n=ws();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var a=ws();return e=n!==void 0?n(e):e,a.memoizedState=a.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},a.queue=t,t=t.dispatch=h8.bind(null,kn,t),[a.memoizedState,t]},useRef:function(t){var e=ws();return t={current:t},e.memoizedState=t},useState:ZC,useDebugValue:MS,useDeferredValue:function(t){return ws().memoizedState=t},useTransition:function(){var t=ZC(!1),e=t[0];return t=u8.bind(null,t[1]),ws().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var a=kn,u=ws();if(gn){if(n===void 0)throw Error(yt(407));n=n()}else{if(n=e(),mi===null)throw Error(yt(349));Du&30||c4(a,e,n)}u.memoizedState=n;var d={value:n,getSnapshot:e};return u.queue=d,KC(h4.bind(null,a,d,t),[t]),a.flags|=2048,Am(9,u4.bind(null,a,d,n,e),void 0,null),n},useId:function(){var t=ws(),e=mi.identifierPrefix;if(gn){var n=ol,a=il;n=(a&~(1<<32-Wa(a)-1)).toString(32)+n,e=":"+e+"R"+n,n=Sm++,0<\/script>",t=t.removeChild(t.firstChild)):typeof a.is=="string"?t=_.createElement(n,{is:a.is}):(t=_.createElement(n),n==="select"&&(_=t,a.multiple?_.multiple=!0:a.size&&(_.size=a.size))):t=_.createElementNS(t,n),t[Es]=e,t[bm]=a,O4(t,e,!1,!1),e.stateNode=t;e:{switch(_=Hw(n,a),n){case"dialog":hn("cancel",t),hn("close",t),u=a;break;case"iframe":case"object":case"embed":hn("load",t),u=a;break;case"video":case"audio":for(u=0;ukd&&(e.flags|=128,a=!0,Df(d,!1),e.lanes=4194304)}else{if(!a)if(t=m_(_),t!==null){if(e.flags|=128,a=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),Df(d,!0),d.tail===null&&d.tailMode==="hidden"&&!_.alternate&&!gn)return Li(e),null}else 2*Ln()-d.renderingStartTime>kd&&n!==1073741824&&(e.flags|=128,a=!0,Df(d,!1),e.lanes=4194304);d.isBackwards?(_.sibling=e.child,e.child=_):(n=d.last,n!==null?n.sibling=_:e.child=_,d.last=_)}return d.tail!==null?(e=d.tail,d.rendering=e,d.tail=e.sibling,d.renderingStartTime=Ln(),e.sibling=null,n=Cn.current,on(Cn,a?n&1|2:n&1),e):(Li(e),null);case 22:case 23:return BS(),a=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==a&&(e.flags|=8192),a&&e.mode&1?Fo&1073741824&&(Li(e),e.subtreeFlags&6&&(e.flags|=8192)):Li(e),null;case 24:return null;case 25:return null}throw Error(yt(156,e.tag))}function b8(t,e){switch(_S(e),e.tag){case 1:return yo(e.type)&&l_(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Id(),dn(go),dn(Wi),IS(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return AS(e),null;case 13:if(dn(Cn),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(yt(340));Td()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return dn(Cn),null;case 4:return Id(),null;case 10:return wS(e.type._context),null;case 22:case 23:return BS(),null;case 24:return null;default:return null}}var Ng=!1,$i=!1,w8=typeof WeakSet=="function"?WeakSet:Set,Rt=null;function ud(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(a){On(t,e,a)}else n.current=null}function vE(t,e,n){try{n()}catch(a){On(t,e,a)}}var ak=!1;function E8(t,e){if(rE=i_,t=Vz(),gS(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var a=n.getSelection&&n.getSelection();if(a&&a.rangeCount!==0){n=a.anchorNode;var u=a.anchorOffset,d=a.focusNode;a=a.focusOffset;try{n.nodeType,d.nodeType}catch{n=null;break e}var _=0,l=-1,w=-1,T=0,C=0,P=t,z=null;t:for(;;){for(var W;P!==n||u!==0&&P.nodeType!==3||(l=_+u),P!==d||a!==0&&P.nodeType!==3||(w=_+a),P.nodeType===3&&(_+=P.nodeValue.length),(W=P.firstChild)!==null;)z=P,P=W;for(;;){if(P===t)break t;if(z===n&&++T===u&&(l=_),z===d&&++C===a&&(w=_),(W=P.nextSibling)!==null)break;P=z,z=P.parentNode}P=W}n=l===-1||w===-1?null:{start:l,end:w}}else n=null}n=n||{start:0,end:0}}else n=null;for(nE={focusedElem:t,selectionRange:n},i_=!1,Rt=e;Rt!==null;)if(e=Rt,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,Rt=t;else for(;Rt!==null;){e=Rt;try{var U=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(U!==null){var j=U.memoizedProps,L=U.memoizedState,V=e.stateNode,R=V.getSnapshotBeforeUpdate(e.elementType===e.type?j:Ua(e.type,j),L);V.__reactInternalSnapshotBeforeUpdate=R}break;case 3:var F=e.stateNode.containerInfo;F.nodeType===1?F.textContent="":F.nodeType===9&&F.documentElement&&F.removeChild(F.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(yt(163))}}catch(H){On(e,e.return,H)}if(t=e.sibling,t!==null){t.return=e.return,Rt=t;break}Rt=e.return}return U=ak,ak=!1,U}function am(t,e,n){var a=e.updateQueue;if(a=a!==null?a.lastEffect:null,a!==null){var u=a=a.next;do{if((u.tag&t)===t){var d=u.destroy;u.destroy=void 0,d!==void 0&&vE(e,n,d)}u=u.next}while(u!==a)}}function W_(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var a=n.create;n.destroy=a()}n=n.next}while(n!==e)}}function xE(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function B4(t){var e=t.alternate;e!==null&&(t.alternate=null,B4(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[Es],delete e[bm],delete e[aE],delete e[o8],delete e[a8])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function N4(t){return t.tag===5||t.tag===3||t.tag===4}function sk(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||N4(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function bE(t,e,n){var a=t.tag;if(a===5||a===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=s_));else if(a!==4&&(t=t.child,t!==null))for(bE(t,e,n),t=t.sibling;t!==null;)bE(t,e,n),t=t.sibling}function wE(t,e,n){var a=t.tag;if(a===5||a===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(a!==4&&(t=t.child,t!==null))for(wE(t,e,n),t=t.sibling;t!==null;)wE(t,e,n),t=t.sibling}var Si=null,ja=!1;function Gl(t,e,n){for(n=n.child;n!==null;)U4(t,e,n),n=n.sibling}function U4(t,e,n){if(Ts&&typeof Ts.onCommitFiberUnmount=="function")try{Ts.onCommitFiberUnmount(F_,n)}catch{}switch(n.tag){case 5:$i||ud(n,e);case 6:var a=Si,u=ja;Si=null,Gl(t,e,n),Si=a,ja=u,Si!==null&&(ja?(t=Si,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):Si.removeChild(n.stateNode));break;case 18:Si!==null&&(ja?(t=Si,n=n.stateNode,t.nodeType===8?W1(t.parentNode,n):t.nodeType===1&&W1(t,n),gm(t)):W1(Si,n.stateNode));break;case 4:a=Si,u=ja,Si=n.stateNode.containerInfo,ja=!0,Gl(t,e,n),Si=a,ja=u;break;case 0:case 11:case 14:case 15:if(!$i&&(a=n.updateQueue,a!==null&&(a=a.lastEffect,a!==null))){u=a=a.next;do{var d=u,_=d.destroy;d=d.tag,_!==void 0&&(d&2||d&4)&&vE(n,e,_),u=u.next}while(u!==a)}Gl(t,e,n);break;case 1:if(!$i&&(ud(n,e),a=n.stateNode,typeof a.componentWillUnmount=="function"))try{a.props=n.memoizedProps,a.state=n.memoizedState,a.componentWillUnmount()}catch(l){On(n,e,l)}Gl(t,e,n);break;case 21:Gl(t,e,n);break;case 22:n.mode&1?($i=(a=$i)||n.memoizedState!==null,Gl(t,e,n),$i=a):Gl(t,e,n);break;default:Gl(t,e,n)}}function lk(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new w8),e.forEach(function(a){var u=M8.bind(null,t,a);n.has(a)||(n.add(a),a.then(u,u))})}}function Ba(t,e){var n=e.deletions;if(n!==null)for(var a=0;au&&(u=_),a&=~d}if(a=u,a=Ln()-a,a=(120>a?120:480>a?480:1080>a?1080:1920>a?1920:3e3>a?3e3:4320>a?4320:1960*T8(a/1960))-a,10t?16:t,oc===null)var a=!1;else{if(t=oc,oc=null,x_=0,Dr&6)throw Error(yt(331));var u=Dr;for(Dr|=4,Rt=t.current;Rt!==null;){var d=Rt,_=d.child;if(Rt.flags&16){var l=d.deletions;if(l!==null){for(var w=0;wLn()-FS?Iu(t,0):OS|=n),_o(t,e)}function Z4(t,e){e===0&&(t.mode&1?(e=Pg,Pg<<=1,!(Pg&130023424)&&(Pg=4194304)):e=1);var n=Ji();t=cl(t,e),t!==null&&(Om(t,e,n),_o(t,n))}function D8(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),Z4(t,n)}function M8(t,e){var n=0;switch(t.tag){case 13:var a=t.stateNode,u=t.memoizedState;u!==null&&(n=u.retryLane);break;case 19:a=t.stateNode;break;default:throw Error(yt(314))}a!==null&&a.delete(e),Z4(t,n)}var K4;K4=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||go.current)mo=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return mo=!1,v8(t,e,n);mo=!!(t.flags&131072)}else mo=!1,gn&&e.flags&1048576&&Jz(e,h_,e.index);switch(e.lanes=0,e.tag){case 2:var a=e.type;jy(t,e),t=e.pendingProps;var u=Sd(e,Wi.current);vd(e,n),u=kS(null,e,a,t,u,n);var d=PS();return e.flags|=1,typeof u=="object"&&u!==null&&typeof u.render=="function"&&u.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,yo(a)?(d=!0,c_(e)):d=!1,e.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,SS(e),u.updater=$_,e.stateNode=u,u._reactInternals=e,dE(e,a,t,n),e=mE(null,e,a,!0,d,n)):(e.tag=0,gn&&d&&yS(e),Qi(null,e,u,n),e=e.child),e;case 16:a=e.elementType;e:{switch(jy(t,e),t=e.pendingProps,u=a._init,a=u(a._payload),e.type=a,u=e.tag=R8(a),t=Ua(a,t),u){case 0:e=fE(null,e,a,t,n);break e;case 1:e=nk(null,e,a,t,n);break e;case 11:e=tk(null,e,a,t,n);break e;case 14:e=rk(null,e,a,Ua(a.type,t),n);break e}throw Error(yt(306,a,""))}return e;case 0:return a=e.type,u=e.pendingProps,u=e.elementType===a?u:Ua(a,u),fE(t,e,a,u,n);case 1:return a=e.type,u=e.pendingProps,u=e.elementType===a?u:Ua(a,u),nk(t,e,a,u,n);case 3:e:{if(M4(e),t===null)throw Error(yt(387));a=e.pendingProps,d=e.memoizedState,u=d.element,o4(t,e),f_(e,a,null,n);var _=e.memoizedState;if(a=_.element,d.isDehydrated)if(d={element:a,isDehydrated:!1,cache:_.cache,pendingSuspenseBoundaries:_.pendingSuspenseBoundaries,transitions:_.transitions},e.updateQueue.baseState=d,e.memoizedState=d,e.flags&256){u=Cd(Error(yt(423)),e),e=ik(t,e,a,n,u);break e}else if(a!==u){u=Cd(Error(yt(424)),e),e=ik(t,e,a,n,u);break e}else for(Lo=uc(e.stateNode.containerInfo.firstChild),Bo=e,gn=!0,Va=null,n=n4(e,null,a,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Td(),a===u){e=ul(t,e,n);break e}Qi(t,e,a,n)}e=e.child}return e;case 5:return a4(e),t===null&&cE(e),a=e.type,u=e.pendingProps,d=t!==null?t.memoizedProps:null,_=u.children,iE(a,u)?_=null:d!==null&&iE(a,d)&&(e.flags|=32),D4(t,e),Qi(t,e,_,n),e.child;case 6:return t===null&&cE(e),null;case 13:return z4(t,e,n);case 4:return TS(e,e.stateNode.containerInfo),a=e.pendingProps,t===null?e.child=Ad(e,null,a,n):Qi(t,e,a,n),e.child;case 11:return a=e.type,u=e.pendingProps,u=e.elementType===a?u:Ua(a,u),tk(t,e,a,u,n);case 7:return Qi(t,e,e.pendingProps,n),e.child;case 8:return Qi(t,e,e.pendingProps.children,n),e.child;case 12:return Qi(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(a=e.type._context,u=e.pendingProps,d=e.memoizedProps,_=u.value,on(d_,a._currentValue),a._currentValue=_,d!==null)if(Za(d.value,_)){if(d.children===u.children&&!go.current){e=ul(t,e,n);break e}}else for(d=e.child,d!==null&&(d.return=e);d!==null;){var l=d.dependencies;if(l!==null){_=d.child;for(var w=l.firstContext;w!==null;){if(w.context===a){if(d.tag===1){w=al(-1,n&-n),w.tag=2;var T=d.updateQueue;if(T!==null){T=T.shared;var C=T.pending;C===null?w.next=w:(w.next=C.next,C.next=w),T.pending=w}}d.lanes|=n,w=d.alternate,w!==null&&(w.lanes|=n),uE(d.return,n,e),l.lanes|=n;break}w=w.next}}else if(d.tag===10)_=d.type===e.type?null:d.child;else if(d.tag===18){if(_=d.return,_===null)throw Error(yt(341));_.lanes|=n,l=_.alternate,l!==null&&(l.lanes|=n),uE(_,n,e),_=d.sibling}else _=d.child;if(_!==null)_.return=d;else for(_=d;_!==null;){if(_===e){_=null;break}if(d=_.sibling,d!==null){d.return=_.return,_=d;break}_=_.return}d=_}Qi(t,e,u.children,n),e=e.child}return e;case 9:return u=e.type,a=e.pendingProps.children,vd(e,n),u=ha(u),a=a(u),e.flags|=1,Qi(t,e,a,n),e.child;case 14:return a=e.type,u=Ua(a,e.pendingProps),u=Ua(a.type,u),rk(t,e,a,u,n);case 15:return k4(t,e,e.type,e.pendingProps,n);case 17:return a=e.type,u=e.pendingProps,u=e.elementType===a?u:Ua(a,u),jy(t,e),e.tag=1,yo(a)?(t=!0,c_(e)):t=!1,vd(e,n),A4(e,a,u),dE(e,a,u,n),mE(null,e,a,!0,t,n);case 19:return R4(t,e,n);case 22:return P4(t,e,n)}throw Error(yt(156,e.tag))};function X4(t,e){return Ez(t,e)}function z8(t,e,n,a){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=a,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ca(t,e,n,a){return new z8(t,e,n,a)}function US(t){return t=t.prototype,!(!t||!t.isReactComponent)}function R8(t){if(typeof t=="function")return US(t)?1:0;if(t!=null){if(t=t.$$typeof,t===oS)return 11;if(t===aS)return 14}return 2}function fc(t,e){var n=t.alternate;return n===null?(n=ca(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function Wy(t,e,n,a,u,d){var _=2;if(a=t,typeof t=="function")US(t)&&(_=1);else if(typeof t=="string")_=5;else e:switch(t){case td:return Cu(n.children,u,d,e);case iS:_=8,u|=8;break;case Fw:return t=ca(12,n,e,u|2),t.elementType=Fw,t.lanes=d,t;case Lw:return t=ca(13,n,e,u),t.elementType=Lw,t.lanes=d,t;case Bw:return t=ca(19,n,e,u),t.elementType=Bw,t.lanes=d,t;case az:return H_(n,u,d,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case iz:_=10;break e;case oz:_=9;break e;case oS:_=11;break e;case aS:_=14;break e;case ec:_=16,a=null;break e}throw Error(yt(130,t==null?t:typeof t,""))}return e=ca(_,n,e,u),e.elementType=t,e.type=a,e.lanes=d,e}function Cu(t,e,n,a){return t=ca(7,t,a,e),t.lanes=n,t}function H_(t,e,n,a){return t=ca(22,t,a,e),t.elementType=az,t.lanes=n,t.stateNode={isHidden:!1},t}function Q1(t,e,n){return t=ca(6,t,null,e),t.lanes=n,t}function J1(t,e,n){return e=ca(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function O8(t,e,n,a,u){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=z1(0),this.expirationTimes=z1(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=z1(0),this.identifierPrefix=a,this.onRecoverableError=u,this.mutableSourceEagerHydrationData=null}function jS(t,e,n,a,u,d,_,l,w){return t=new O8(t,e,n,l,w),e===1?(e=1,d===!0&&(e|=8)):e=0,d=ca(3,null,null,e),t.current=d,d.stateNode=t,d.memoizedState={element:a,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},SS(d),t}function F8(t,e,n){var a=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(eR)}catch(t){console.error(t)}}eR(),ez.exports=jo;var GS=ez.exports,tR,gk=GS;tR=gk.createRoot,gk.hydrateRoot;const j8="Logging",V8="NoHubcallbackProvidedException";var Oo;(function(t){t.DEBUG="DEBUG",t.ERROR="ERROR",t.INFO="INFO",t.WARN="WARN",t.VERBOSE="VERBOSE",t.NONE="NONE"})(Oo||(Oo={}));const yk={VERBOSE:1,DEBUG:2,INFO:3,WARN:4,ERROR:5,NONE:6};class Ha{constructor(e,n=Oo.WARN){this.name=e,this.level=n,this._pluggables=[]}_padding(e){return e<10?"0"+e:""+e}_ts(){const e=new Date;return[this._padding(e.getMinutes()),this._padding(e.getSeconds())].join(":")+"."+e.getMilliseconds()}configure(e){return e?(this._config=e,this._config):this._config}_log(e,...n){let a=this.level;Ha.LOG_LEVEL&&(a=Ha.LOG_LEVEL),typeof window<"u"&&window.LOG_LEVEL&&(a=window.LOG_LEVEL);const u=yk[a];if(!(yk[e]>=u))return;let _=console.log.bind(console);e===Oo.ERROR&&console.error&&(_=console.error.bind(console)),e===Oo.WARN&&console.warn&&(_=console.warn.bind(console)),Ha.BIND_ALL_LOG_LEVELS&&(e===Oo.INFO&&console.info&&(_=console.info.bind(console)),e===Oo.DEBUG&&console.debug&&(_=console.debug.bind(console)));const l=`[${e}] ${this._ts()} ${this.name}`;let w="";if(n.length===1&&typeof n[0]=="string")w=`${l} - ${n[0]}`,_(w);else if(n.length===1)w=`${l} ${n[0]}`,_(l,n[0]);else if(typeof n[0]=="string"){let T=n.slice(1);T.length===1&&(T=T[0]),w=`${l} - ${n[0]} ${T}`,_(`${l} - ${n[0]}`,T)}else w=`${l} ${n}`,_(l,n);for(const T of this._pluggables){const C={message:w,timestamp:Date.now()};T.pushLogs([C])}}log(...e){this._log(Oo.INFO,...e)}info(...e){this._log(Oo.INFO,...e)}warn(...e){this._log(Oo.WARN,...e)}error(...e){this._log(Oo.ERROR,...e)}debug(...e){this._log(Oo.DEBUG,...e)}verbose(...e){this._log(Oo.VERBOSE,...e)}addPluggable(e){e&&e.getCategoryName()===j8&&(this._pluggables.push(e),e.configure(this._config))}listPluggables(){return this._pluggables}}Ha.LOG_LEVEL=null;Ha.BIND_ALL_LOG_LEVELS=!1;class Is extends Error{constructor({message:e,name:n,recoverySuggestion:a,underlyingError:u}){super(e),this.name=n,this.underlyingError=u,this.recoverySuggestion=a,this.constructor=Is,Object.setPrototypeOf(this,Is.prototype)}}var Cm;(function(t){t.NoEndpointId="NoEndpointId",t.PlatformNotSupported="PlatformNotSupported",t.Unknown="Unknown",t.NetworkError="NetworkError"})(Cm||(Cm={}));const rR=(t,e=Is)=>(n,a,u)=>{const{message:d,recoverySuggestion:_}=t[a];if(!n)throw new e({name:a,message:u?`${d} ${u}`:d,recoverySuggestion:_})},E_=typeof Symbol<"u"?Symbol("amplify_default"):"@@amplify_default",zf=new Ha("Hub");class $8{constructor(e){this.listeners=new Map,this.protectedChannels=["core","auth","api","analytics","interactions","pubsub","storage","ui","xr"],this.name=e}_remove(e,n){const a=this.listeners.get(e);if(!a){zf.warn(`No listeners for ${e}`);return}this.listeners.set(e,[...a.filter(({callback:u})=>u!==n)])}dispatch(e,n,a,u){typeof e=="string"&&this.protectedChannels.indexOf(e)>-1&&(u===E_||zf.warn(`WARNING: ${e} is protected and dispatching on it can have unintended consequences`));const d={channel:e,payload:{...n},source:a,patternInfo:[]};try{this._toListeners(d)}catch(_){zf.error(_)}}listen(e,n,a="noname"){let u;if(typeof n!="function")throw new Is({name:V8,message:"No callback supplied to Hub"});u=n;let d=this.listeners.get(e);return d||(d=[],this.listeners.set(e,d)),d.push({name:a,callback:u}),()=>{this._remove(e,u)}}_toListeners(e){const{channel:n,payload:a}=e,u=this.listeners.get(n);u&&u.forEach(d=>{zf.debug(`Dispatching to ${n} with `,a);try{d.callback(e)}catch(_){zf.error(_)}})}}const IE=new $8("__default__"),W8=()=>{if(typeof window<"u"&&typeof window.atob=="function")return window.atob;if(typeof atob=="function")return atob;throw new Is({name:"Base64EncoderError",message:"Cannot resolve the `atob` function from the environment."})},G8={convert(t){return W8()(t)}};var rl;(function(t){t.AuthTokenConfigException="AuthTokenConfigException",t.AuthUserPoolAndIdentityPoolException="AuthUserPoolAndIdentityPoolException",t.AuthUserPoolException="AuthUserPoolException",t.InvalidIdentityPoolIdException="InvalidIdentityPoolIdException",t.OAuthNotConfigureException="OAuthNotConfigureException"})(rl||(rl={}));const H8={[rl.AuthTokenConfigException]:{message:"Auth Token Provider not configured.",recoverySuggestion:"Make sure to call Amplify.configure in your app."},[rl.AuthUserPoolAndIdentityPoolException]:{message:"Auth UserPool or IdentityPool not configured.",recoverySuggestion:"Make sure to call Amplify.configure in your app with UserPoolId and IdentityPoolId."},[rl.AuthUserPoolException]:{message:"Auth UserPool not configured.",recoverySuggestion:"Make sure to call Amplify.configure in your app with userPoolId and userPoolClientId."},[rl.InvalidIdentityPoolIdException]:{message:"Invalid identity pool id provided.",recoverySuggestion:"Make sure a valid identityPoolId is given in the config."},[rl.OAuthNotConfigureException]:{message:"oauth param not configured.",recoverySuggestion:"Make sure to call Amplify.configure with oauth parameter in your app."}},nR=rR(H8);function po(t){let e=!0;t?e=!!t.userPoolId&&!!t.userPoolClientId:e=!1,nR(e,rl.AuthUserPoolException)}function Gy(t){const e=!!(t!=null&&t.identityPoolId);nR(e,rl.InvalidIdentityPoolIdException)}function km(t){const e=t.split(".");if(e.length!==3)throw new Error("Invalid token");try{const a=e[1].replace(/-/g,"+").replace(/_/g,"/"),u=decodeURIComponent(G8.convert(a).split("").map(_=>`%${`00${_.charCodeAt(0).toString(16)}`.slice(-2)}`).join("")),d=JSON.parse(u);return{toString:()=>t,payload:d}}catch{throw new Error("Invalid token payload")}}const iR=t=>{const e=Reflect.ownKeys(t);for(const n of e){const a=t[n];(a&&typeof a=="object"||typeof a=="function")&&iR(a)}return Object.freeze(t)},q8=new Ha("parseAWSExports"),Z8={API_KEY:"apiKey",AWS_IAM:"iam",AMAZON_COGNITO_USER_POOLS:"userPool",OPENID_CONNECT:"oidc",NONE:"none",AWS_LAMBDA:"lambda",LAMBDA:"lambda"},K8=(t={})=>{var it,ur,Xt,Pr,Yt,si;if(!Object.prototype.hasOwnProperty.call(t,"aws_project_region"))throw new Is({name:"InvalidParameterException",message:"Invalid config parameter.",recoverySuggestion:"Ensure passing the config object imported from `amplifyconfiguration.json`."});const{aws_appsync_apiKey:e,aws_appsync_authenticationType:n,aws_appsync_graphqlEndpoint:a,aws_appsync_region:u,aws_bots_config:d,aws_cognito_identity_pool_id:_,aws_cognito_sign_up_verification_method:l,aws_cognito_mfa_configuration:w,aws_cognito_mfa_types:T,aws_cognito_password_protection_settings:C,aws_cognito_verification_mechanisms:P,aws_cognito_signup_attributes:z,aws_cognito_social_providers:W,aws_cognito_username_attributes:U,aws_mandatory_sign_in:j,aws_mobile_analytics_app_id:L,aws_mobile_analytics_app_region:V,aws_user_files_s3_bucket:R,aws_user_files_s3_bucket_region:F,aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing:H,aws_user_pools_id:Q,aws_user_pools_web_client_id:te,geo:se,oauth:ge,predictions:xe,aws_cloud_logic_custom:Ee,Notifications:Be,modelIntrospection:Fe}=t,Ve={};L&&(Ve.Analytics={Pinpoint:{appId:L,region:V}});const{InAppMessaging:kt,Push:Dt}=Be??{};if(kt!=null&&kt.AWSPinpoint||Dt!=null&&Dt.AWSPinpoint){if(kt!=null&&kt.AWSPinpoint){const{appId:mr,region:Vt}=kt.AWSPinpoint;Ve.Notifications={InAppMessaging:{Pinpoint:{appId:mr,region:Vt}}}}if(Dt!=null&&Dt.AWSPinpoint){const{appId:mr,region:Vt}=Dt.AWSPinpoint;Ve.Notifications={...Ve.Notifications,PushNotification:{Pinpoint:{appId:mr,region:Vt}}}}}if(Array.isArray(d)&&(Ve.Interactions={LexV1:Object.fromEntries(d.map(mr=>[mr.name,mr]))}),a){const mr=Z8[n];mr||q8.debug(`Invalid authentication type ${n}. Falling back to IAM.`),Ve.API={GraphQL:{endpoint:a,apiKey:e,region:u,defaultAuthMode:mr??"iam"}},Fe&&(Ve.API.GraphQL.modelIntrospection=Fe)}const Ut=w?{status:w&&w.toLowerCase(),totpEnabled:(T==null?void 0:T.includes("TOTP"))??!1,smsEnabled:(T==null?void 0:T.includes("SMS"))??!1}:void 0,cr=C?{minLength:C.passwordPolicyMinLength,requireLowercase:((it=C.passwordPolicyCharacters)==null?void 0:it.includes("REQUIRES_LOWERCASE"))??!1,requireUppercase:((ur=C.passwordPolicyCharacters)==null?void 0:ur.includes("REQUIRES_UPPERCASE"))??!1,requireNumbers:((Xt=C.passwordPolicyCharacters)==null?void 0:Xt.includes("REQUIRES_NUMBERS"))??!1,requireSpecialCharacters:((Pr=C.passwordPolicyCharacters)==null?void 0:Pr.includes("REQUIRES_SYMBOLS"))??!1}:void 0,Tt=Array.from(new Set([...P??[],...z??[]])).reduce((mr,Vt)=>({...mr,[Vt.toLowerCase()]:{required:!0}}),{}),gt=(U==null?void 0:U.includes("EMAIL"))??!1,je=(U==null?void 0:U.includes("PHONE_NUMBER"))??!1;(_||Q)&&(Ve.Auth={Cognito:{identityPoolId:_,allowGuestAccess:j!=="enable",signUpVerificationMethod:l,userAttributes:Tt,userPoolClientId:te,userPoolId:Q,mfa:Ut,passwordFormat:cr,loginWith:{username:!(gt||je),email:gt,phone:je}}});const et=ge?Object.keys(ge).length>0:!1,nt=W?W.length>0:!1;if(Ve.Auth&&et&&(Ve.Auth.Cognito.loginWith={...Ve.Auth.Cognito.loginWith,oauth:{...X8(ge),...nt&&{providers:Y8(W)}}}),R&&(Ve.Storage={S3:{bucket:R,region:F,dangerouslyConnectToHttpEndpointForTesting:H}}),se){const{amazon_location_service:mr}=se;Ve.Geo={LocationService:{maps:mr.maps,geofenceCollections:mr.geofenceCollections,searchIndices:mr.search_indices,region:mr.region}}}if(Ee&&(Ve.API={...Ve.API,REST:Ee.reduce((mr,Vt)=>{const{name:Ii,endpoint:qr,region:pn,service:Tr}=Vt;return{...mr,[Ii]:{endpoint:qr,...Tr?{service:Tr}:void 0,...pn?{region:pn}:void 0}}},{})}),xe){const{VoiceId:mr}=((si=(Yt=xe==null?void 0:xe.convert)==null?void 0:Yt.speechGenerator)==null?void 0:si.defaults)??{};Ve.Predictions=mr?{...xe,convert:{...xe.convert,speechGenerator:{...xe.convert.speechGenerator,defaults:{voiceId:mr}}}}:xe}return Ve},_k=t=>(t==null?void 0:t.split(","))??[],X8=({domain:t,scope:e,redirectSignIn:n,redirectSignOut:a,responseType:u})=>({domain:t,scopes:e,redirectSignIn:_k(n),redirectSignOut:_k(a),responseType:u}),Y8=t=>t.map(e=>{const n=e.toLowerCase();return n.charAt(0).toUpperCase()+n.slice(1)}),Q8=Symbol("oauth-listener");function J8(t){const{version:e}=t;return e?e.startsWith("1"):!1}function e6(t){if(!t)return;const{bucket_name:e,aws_region:n,buckets:a}=t;return{S3:{bucket:e,region:n,buckets:a&&h6(a)}}}function t6(t){if(!t)return;const{user_pool_id:e,user_pool_client_id:n,identity_pool_id:a,password_policy:u,mfa_configuration:d,mfa_methods:_,unauthenticated_identities_enabled:l,oauth:w,username_attributes:T,standard_required_attributes:C}=t,P={Cognito:{userPoolId:e,userPoolClientId:n}};return a&&(P.Cognito={...P.Cognito,identityPoolId:a}),u&&(P.Cognito.passwordFormat={requireLowercase:u.require_lowercase,requireNumbers:u.require_numbers,requireUppercase:u.require_uppercase,requireSpecialCharacters:u.require_symbols,minLength:u.min_length??6}),d&&(P.Cognito.mfa={status:u6(d),smsEnabled:_==null?void 0:_.includes("SMS"),totpEnabled:_==null?void 0:_.includes("TOTP")}),l&&(P.Cognito.allowGuestAccess=l),w&&(P.Cognito.loginWith={oauth:{domain:w.domain,redirectSignIn:w.redirect_sign_in_uri,redirectSignOut:w.redirect_sign_out_uri,responseType:w.response_type==="token"?"token":"code",scopes:w.scopes,providers:c6(w.identity_providers)}}),T&&(P.Cognito.loginWith={...P.Cognito.loginWith,email:T.includes("email"),phone:T.includes("phone_number"),username:T.includes("username")}),C&&(P.Cognito.userAttributes=C.reduce((z,W)=>({...z,[W]:{required:!0}}),{})),P}function r6(t){if(!(t!=null&&t.amazon_pinpoint))return;const{amazon_pinpoint:e}=t;return{Pinpoint:{appId:e.app_id,region:e.aws_region}}}function n6(t){if(!t)return;const{aws_region:e,geofence_collections:n,maps:a,search_indices:u}=t;return{LocationService:{region:e,searchIndices:u,geofenceCollections:n,maps:a}}}function i6(t){if(!t)return;const{aws_region:e,default_authorization_type:n,url:a,api_key:u,model_introspection:d}=t;return{GraphQL:{endpoint:a,defaultAuthMode:l6(n),region:e,apiKey:u,modelIntrospection:d}}}function o6(t){if(!t)return;const{aws_region:e,channels:n,amazon_pinpoint_app_id:a}=t,u=n.includes("IN_APP_MESSAGING"),d=n.includes("APNS")||n.includes("FCM");if(!(u||d))return;const _={};return u&&(_.InAppMessaging={Pinpoint:{appId:a,region:e}}),d&&(_.PushNotification={Pinpoint:{appId:a,region:e}}),_}function a6(t){const e={};return t.storage&&(e.Storage=e6(t.storage)),t.auth&&(e.Auth=t6(t.auth)),t.analytics&&(e.Analytics=r6(t.analytics)),t.geo&&(e.Geo=n6(t.geo)),t.data&&(e.API=i6(t.data)),t.notifications&&(e.Notifications=o6(t.notifications)),e}const s6={AMAZON_COGNITO_USER_POOLS:"userPool",API_KEY:"apiKey",AWS_IAM:"iam",AWS_LAMBDA:"lambda",OPENID_CONNECT:"oidc"};function l6(t){return s6[t]}const vk={GOOGLE:"Google",LOGIN_WITH_AMAZON:"Amazon",FACEBOOK:"Facebook",SIGN_IN_WITH_APPLE:"Apple"};function c6(t=[]){return t.reduce((e,n)=>(vk[n]!==void 0&&e.push(vk[n]),e),[])}function u6(t){return t==="OPTIONAL"?"optional":t==="REQUIRED"?"on":"off"}function h6(t){const e={};return t.forEach(({name:n,bucket_name:a,aws_region:u})=>{if(n in e)throw new Error(`Duplicate friendly name found: ${n}. Name must be unique.`);e[n]={bucketName:a,region:u}}),e}const oR=t=>Object.keys(t).some(e=>e.startsWith("aws_"))?K8(t):J8(t)?a6(t):t;function xk({expiresAt:t,clockDrift:e}){return Date.now()+e>t}class d6{configure(e,n){this.authConfig=e,this.authOptions=n}async fetchAuthSession(e={}){var d,_,l,w,T,C;let n,a;const u=await this.getTokens(e);return u?(a=(_=(d=u.accessToken)==null?void 0:d.payload)==null?void 0:_.sub,n=await((w=(l=this.authOptions)==null?void 0:l.credentialsProvider)==null?void 0:w.getCredentialsAndIdentityId({authConfig:this.authConfig,tokens:u,authenticated:!0,forceRefresh:e.forceRefresh}))):n=await((C=(T=this.authOptions)==null?void 0:T.credentialsProvider)==null?void 0:C.getCredentialsAndIdentityId({authConfig:this.authConfig,authenticated:!1,forceRefresh:e.forceRefresh})),{tokens:u,credentials:n==null?void 0:n.credentials,identityId:n==null?void 0:n.identityId,userSub:a}}async clearCredentials(){var e,n;await((n=(e=this.authOptions)==null?void 0:e.credentialsProvider)==null?void 0:n.clearCredentialsAndIdentityId())}async getTokens(e){var n,a;return await((a=(n=this.authOptions)==null?void 0:n.tokenProvider)==null?void 0:a.getTokens(e))??void 0}}const p6=t=>new TextEncoder().encode(t);typeof Buffer<"u"&&Buffer.from;for(let t=0;t<256;t++){let e=t.toString(16).toLowerCase();e.length===1&&(e=`0${e}`)}var Zn;(function(t){t.WebUnknown="0",t.React="1",t.NextJs="2",t.Angular="3",t.VueJs="4",t.Nuxt="5",t.Svelte="6",t.ServerSideUnknown="100",t.ReactSSR="101",t.NextJsSSR="102",t.AngularSSR="103",t.VueJsSSR="104",t.NuxtSSR="105",t.SvelteSSR="106",t.ReactNative="201",t.Expo="202"})(Zn||(Zn={}));var bk;(function(t){t.API="api",t.Auth="auth",t.Analytics="analytics",t.DataStore="datastore",t.Geo="geo",t.InAppMessaging="inappmessaging",t.Interactions="interactions",t.Predictions="predictions",t.PubSub="pubsub",t.PushNotification="pushnotification",t.Storage="storage"})(bk||(bk={}));var wk;(function(t){t.Record="1",t.IdentifyUser="2"})(wk||(wk={}));var Ek;(function(t){t.GraphQl="1",t.Get="2",t.Post="3",t.Put="4",t.Patch="5",t.Del="6",t.Head="7"})(Ek||(Ek={}));var Sk;(function(t){t.SignUp="1",t.ConfirmSignUp="2",t.ResendSignUpCode="3",t.SignIn="4",t.FetchMFAPreference="6",t.UpdateMFAPreference="7",t.SetUpTOTP="10",t.VerifyTOTPSetup="11",t.ConfirmSignIn="12",t.DeleteUserAttributes="15",t.DeleteUser="16",t.UpdateUserAttributes="17",t.FetchUserAttributes="18",t.ConfirmUserAttribute="22",t.SignOut="26",t.UpdatePassword="27",t.ResetPassword="28",t.ConfirmResetPassword="29",t.FederatedSignIn="30",t.RememberDevice="32",t.ForgetDevice="33",t.FetchDevices="34",t.SendUserAttributeVerificationCode="35",t.SignInWithRedirect="36"})(Sk||(Sk={}));var Tk;(function(t){t.Subscribe="1",t.GraphQl="2"})(Tk||(Tk={}));var Ak;(function(t){t.SearchByText="0",t.SearchByCoordinates="1",t.SearchForSuggestions="2",t.SearchByPlaceId="3",t.SaveGeofences="4",t.GetGeofence="5",t.ListGeofences="6",t.DeleteGeofences="7"})(Ak||(Ak={}));var Ik;(function(t){t.SyncMessages="1",t.IdentifyUser="2",t.NotifyMessageInteraction="3"})(Ik||(Ik={}));var Ck;(function(t){t.None="0"})(Ck||(Ck={}));var kk;(function(t){t.Convert="1",t.Identify="2",t.Interpret="3"})(kk||(kk={}));var Pk;(function(t){t.Subscribe="1"})(Pk||(Pk={}));var Dk;(function(t){t.InitializePushNotifications="1",t.IdentifyUser="2"})(Dk||(Dk={}));var Mk;(function(t){t.UploadData="1",t.DownloadData="2",t.List="3",t.Copy="4",t.Remove="5",t.GetProperties="6",t.GetUrl="7"})(Mk||(Mk={}));const Y_=()=>typeof global<"u",Od=()=>typeof window<"u",aR=()=>typeof document<"u",HS=()=>typeof process<"u",Pm=(t,e)=>!!Object.keys(t).find(n=>n.startsWith(e));function f6(){const t=a=>a.startsWith("_react")||a.startsWith("__react"),e=a=>Object.keys(a).find(t),n=()=>Array.from(document.querySelectorAll("[id]"));return aR()&&n().some(e)}function m6(){return HS()&&typeof process.env<"u"&&!!Object.keys(process.env).find(t=>t.includes("react"))}function g6(){return Od()&&Pm(window,"__VUE")}function y6(){return Y_()&&Pm(global,"__VUE")}function _6(){return Od()&&Pm(window,"__SVELTE")}function v6(){return HS()&&typeof process.env<"u"&&!!Object.keys(process.env).find(t=>t.includes("svelte"))}function x6(){return Od()&&window.next&&typeof window.next=="object"}function b6(){return Y_()&&(Pm(global,"__next")||Pm(global,"__NEXT"))}function w6(){return Od()&&(window.__NUXT__!==void 0||window.$nuxt!==void 0)}function E6(){return Y_()&&typeof global.__NUXT_PATHS__<"u"}function S6(){const t=!!(aR()&&document.querySelector("[ng-version]")),e=!!(Od()&&typeof window.ng<"u");return t||e}function T6(){var t;return HS()&&typeof process.env=="object"&&((t={}.npm_lifecycle_script)==null?void 0:t.startsWith("ng "))||!1}function A6(){return typeof navigator<"u"&&typeof navigator.product<"u"&&navigator.product==="ReactNative"}function I6(){return Y_()&&typeof global.expo<"u"}function C6(){return Od()}const k6=[{platform:Zn.Expo,detectionMethod:I6},{platform:Zn.ReactNative,detectionMethod:A6},{platform:Zn.NextJs,detectionMethod:x6},{platform:Zn.Nuxt,detectionMethod:w6},{platform:Zn.Angular,detectionMethod:S6},{platform:Zn.React,detectionMethod:f6},{platform:Zn.VueJs,detectionMethod:g6},{platform:Zn.Svelte,detectionMethod:_6},{platform:Zn.WebUnknown,detectionMethod:C6},{platform:Zn.NextJsSSR,detectionMethod:b6},{platform:Zn.NuxtSSR,detectionMethod:E6},{platform:Zn.ReactSSR,detectionMethod:m6},{platform:Zn.VueJsSSR,detectionMethod:y6},{platform:Zn.AngularSSR,detectionMethod:T6},{platform:Zn.SvelteSSR,detectionMethod:v6}];function P6(){var t;return((t=k6.find(e=>e.detectionMethod()))==null?void 0:t.platform)||Zn.ServerSideUnknown}const D6=()=>typeof window<"u"&&typeof window.document<"u";class M6{constructor(){this.oAuthListener=void 0,this.resourcesConfig={},this.libraryOptions={},this.Auth=new d6}configure(e,n){const a=oR(e);this.resourcesConfig=a,n&&(this.libraryOptions=n),this.resourcesConfig=iR(this.resourcesConfig),this.Auth.configure(this.resourcesConfig.Auth,this.libraryOptions.Auth),IE.dispatch("core",{event:"configure",data:this.resourcesConfig},"Configure",E_),this.notifyOAuthListener()}getConfig(){return this.resourcesConfig}[Q8](e){var n,a,u;(a=(n=this.resourcesConfig.Auth)==null?void 0:n.Cognito.loginWith)!=null&&a.oauth?e((u=this.resourcesConfig.Auth)==null?void 0:u.Cognito):this.oAuthListener=e}notifyOAuthListener(){var e,n,a;!((n=(e=this.resourcesConfig.Auth)==null?void 0:e.Cognito.loginWith)!=null&&n.oauth)||!this.oAuthListener||(this.oAuthListener((a=this.resourcesConfig.Auth)==null?void 0:a.Cognito),this.oAuthListener=void 0)}}const Js=new M6,Q_=t=>{const{headers:e,statusCode:n}=t;return{...z6(t)?t.$metadata:{},httpStatusCode:n,requestId:e["x-amzn-requestid"]??e["x-amzn-request-id"]??e["x-amz-request-id"],extendedRequestId:e["x-amz-id-2"],cfId:e["x-amz-cf-id"]}},z6=t=>typeof(t==null?void 0:t.$metadata)=="object",Nm=async t=>{if(!t||t.statusCode<300)return;const e=await J_(t),a=(_=>{const[l]=_.toString().split(/[,:]+/);return l.includes("#")?l.split("#")[1]:l})(t.headers["x-amzn-errortype"]??e.code??e.__type??"UnknownError"),u=e.message??e.Message??"Unknown error",d=new Error(u);return Object.assign(d,{name:a,$metadata:Q_(t)})},J_=async t=>{if(!t.body)throw new Error("Missing response payload");const e=await t.body.json();return Object.assign(e,{$metadata:Q_(t)})},qS=(t,e,n,a)=>async(u,d)=>{const _={...a,...u},l=await _.endpointResolver(_,d),w=await e(d,l),T=await t(w,{..._});return n(T)},sR={id:"aws",outputs:{dnsSuffix:"amazonaws.com"},regionRegex:"^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$",regions:["aws-global"]},R6={partitions:[sR,{id:"aws-cn",outputs:{dnsSuffix:"amazonaws.com.cn"},regionRegex:"^cn\\-\\w+\\-\\d+$",regions:["aws-cn-global"]}]},lR=t=>{const{partitions:e}=R6;for(const{regions:n,outputs:a,regionRegex:u}of e){const d=new RegExp(u);if(n.includes(t)||d.test(t))return a.dnsSuffix}return sR.outputs.dnsSuffix},O6=3,F6=({maxAttempts:t=O6,retryDecider:e,computeDelay:n,abortSignal:a})=>{if(t<1)throw new Error("maxAttempts must be greater than 0");return(u,d)=>async function(l){let w,T=d.attemptsCount??0,C;const P=()=>{if(C)return zk(C,T),C;throw zk(w,T),w};for(;!(a!=null&&a.aborted)&&TT?d.attemptsCount??0:T+1,d.attemptsCount=T,await e(C,w)){if(!(a!=null&&a.aborted)&&T{if(e!=null&&e.aborted)return Promise.resolve();let n,a;const u=new Promise(d=>{a=d,n=setTimeout(d,t)});return e==null||e.addEventListener("abort",function d(_){clearTimeout(n),e==null||e.removeEventListener("abort",d),a()}),u},zk=(t,e)=>{Object.prototype.toString.call(t)==="[object Object]"&&(t.$metadata={...t.$metadata??{},attempts:e})},B6=({userAgentHeader:t="x-amz-user-agent",userAgentValue:e=""})=>n=>async function(u){if(e.trim().length===0)return await n(u);{const d=t.toLowerCase();return u.headers[d]=u.headers[d]?`${u.headers[d]} ${e}`:e,await n(u)}},ZS=(t,e)=>(n,a)=>{const u={};let d=_=>t(_,a);for(let _=e.length-1;_>=0;_--){const l=e[_];d=l(a)(d,u)}return d(n)},eb=t=>{let e;return()=>(e||(e=t()),e)},N6=t=>!["HEAD","GET","DELETE"].includes(t.toUpperCase()),U6=async({url:t,method:e,headers:n,body:a},{abortSignal:u,cache:d,withCrossDomainCredentials:_})=>{var P;let l;try{l=await fetch(t,{method:e,headers:n,body:N6(e)?a:void 0,signal:u,cache:d,credentials:_?"include":"same-origin"})}catch(z){throw z instanceof TypeError?new Is({name:Cm.NetworkError,message:"A network error has occurred.",underlyingError:z}):z}const w={};(P=l.headers)==null||P.forEach((z,W)=>{w[W.toLowerCase()]=z});const T={statusCode:l.status,headers:w,body:null},C=Object.assign(l.body??{},{text:eb(()=>l.text()),blob:eb(()=>l.blob()),json:eb(()=>l.json())});return{...T,body:C}},cR=ZS(U6,[B6,F6]),j6=5*60*1e3;function V6(t=j6){return a=>{const u=2**a*100+100*Math.random();return u>t?!1:u}}const Rk=5*60*1e3,uR=t=>{const n=V6(Rk)(t);return n===!1?Rk:n},$6=["AuthFailure","InvalidSignatureException","RequestExpired","RequestInTheFuture","RequestTimeTooSkewed","SignatureDoesNotMatch","BadRequestException"],W6=t=>!!t&&$6.includes(t),hR=t=>async(e,n)=>{const a=n??await t(e)??void 0,u=(a==null?void 0:a.code)||(a==null?void 0:a.name),d=e==null?void 0:e.statusCode;return Z6(n)||q6(d,u)||W6(u)||K6(d,u)},G6=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException"],H6=["TimeoutError","RequestTimeout","RequestTimeoutException"],q6=(t,e)=>t===429||!!e&&G6.includes(e),Z6=t=>(t==null?void 0:t.name)==="Network error",K6=(t,e)=>!!t&&[500,502,503,504].includes(t)||!!e&&H6.includes(e),CE=URL,X6="6.6.0";let cm;const Hy=[];let S_=!1;const Y6=10,Q6=10,J6=1e3,dR=()=>{var t;if(!cm){if(cm=P6(),S_)for(;Hy.length;)(t=Hy.pop())==null||t();else Hy.forEach(e=>{e()});Ok(Zn.ServerSideUnknown,Y6),Ok(Zn.WebUnknown,Q6)}return cm},eN=t=>{S_||Hy.push(t)};function tN(){cm=void 0}function Ok(t,e){cm===t&&!S_&&setTimeout(()=>{tN(),S_=!0,setTimeout(dR,J6)},e)}const rN={},nN=(t,e)=>{var n,a;return(a=(n=rN[t])==null?void 0:n[e])==null?void 0:a.additionalDetails},iN="aws-amplify",oN=({category:t,action:e}={})=>{const n=[[iN,X6]];if(t&&n.push([t,e]),n.push(["framework",dR()]),t&&e){const a=nN(t,e);a&&a.forEach(u=>{n.push(u)})}return n},KS=t=>oN(t).map(([a,u])=>a&&u?`${a}/${u}`:a).join(" "),aN="cognito-identity",sN=({region:t})=>({url:new CE(`https://cognito-identity.${t}.${lR(t)}`)}),lN=()=>t=>async function(n){return n.headers["cache-control"]="no-store",t(n)},pR=ZS(cR,[lN]),XS={service:aN,endpointResolver:sN,retryDecider:hR(Nm),computeDelay:uR,userAgentValue:KS(),cache:"no-store"};eN(()=>{XS.userAgentValue=KS()});const fR=t=>({"content-type":"application/x-amz-json-1.1","x-amz-target":`AWSCognitoIdentityService.${t}`}),mR=({url:t},e,n)=>({headers:e,url:t,body:n,method:"POST"}),cN=(t,e)=>{const n=fR("GetId"),a=JSON.stringify(t);return mR(e,n,a)},uN=async t=>{if(t.statusCode>=300)throw await Nm(t);return{IdentityId:(await J_(t)).IdentityId,$metadata:Q_(t)}},hN=qS(pR,cN,uN,XS),dN=(t,e)=>{const n=fR("GetCredentialsForIdentity"),a=JSON.stringify(t);return mR(e,n,a)},pN=async t=>{if(t.statusCode>=300)throw await Nm(t);{const e=await J_(t);return{IdentityId:e.IdentityId,Credentials:fN(e.Credentials),$metadata:Q_(t)}}},fN=({AccessKeyId:t,SecretKey:e,SessionToken:n,Expiration:a}={})=>({AccessKeyId:t,SecretKey:e,SessionToken:n,Expiration:a&&new Date(a*1e3)}),Fk=qS(pR,dN,pN,XS);class Vg extends Is{constructor(){super({name:Cm.PlatformNotSupported,message:"Function not supported on current platform"})}}class gR{constructor(e){this.storage=e}async setItem(e,n){if(!this.storage)throw new Vg;this.storage.setItem(e,n)}async getItem(e){if(!this.storage)throw new Vg;return this.storage.getItem(e)}async removeItem(e){if(!this.storage)throw new Vg;this.storage.removeItem(e)}async clear(){if(!this.storage)throw new Vg;this.storage.clear()}}class yR{constructor(){this.storage=new Map}get length(){return this.storage.size}key(e){return e>this.length-1?null:Array.from(this.storage.keys())[e]}setItem(e,n){this.storage.set(e,n)}getItem(e){return this.storage.get(e)??null}removeItem(e){this.storage.delete(e)}clear(){this.storage.clear()}}const mN=()=>typeof window<"u"&&window.localStorage?window.localStorage:new yR,gN=()=>typeof window<"u"&&window.sessionStorage?window.sessionStorage:new yR;class yN extends gR{constructor(){super(mN())}}class _N extends gR{constructor(){super(gN())}}/*! js-cookie v3.0.5 | MIT */function $g(t){for(var e=1;e"u")){_=$g({},e,_),typeof _.expires=="number"&&(_.expires=new Date(Date.now()+_.expires*864e5)),_.expires&&(_.expires=_.expires.toUTCString()),u=encodeURIComponent(u).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var l="";for(var w in _)_[w]&&(l+="; "+w,_[w]!==!0&&(l+="="+_[w].split(";")[0]));return document.cookie=u+"="+t.write(d,u)+l}}function a(u){if(!(typeof document>"u"||arguments.length&&!u)){for(var d=document.cookie?document.cookie.split("; "):[],_={},l=0;lthis.removeItem(a));await Promise.all(n)}getData(){return{path:this.path,expires:this.expires,domain:this.domain,secure:this.secure,...this.sameSite&&{sameSite:this.sameSite}}}}const Dm=new yN;new _N;const xN=t=>{let e;return async(...n)=>e||(e=new Promise((a,u)=>{t(...n).then(d=>{a(d)}).catch(d=>{u(d)}).finally(()=>{e=void 0})}),e)};class Dn extends Is{constructor(e){super(e),this.constructor=Dn,Object.setPrototypeOf(this,Dn.prototype)}}function _R(t){if(!t||t.name==="Error"||t instanceof TypeError)throw new Dn({name:Cm.Unknown,message:"An unknown error has occurred.",underlyingError:t})}const vR="cognito-idp",bN=({region:t})=>{var u;const e=(u=Js.getConfig().Auth)==null?void 0:u.Cognito,n=e==null?void 0:e.userPoolEndpoint,a=new CE(`https://${vR}.${t}.${lR(t)}`);return{url:n?new CE(n):a}},wN=()=>(t,e)=>async function(a){return a.headers["cache-control"]="no-store",t(a)},EN=ZS(cR,[wN]),SN={service:vR,endpointResolver:bN,retryDecider:hR(Nm),computeDelay:uR,userAgentValue:KS(),cache:"no-store"},TN=t=>({"content-type":"application/x-amz-json-1.1","x-amz-target":`AWSCognitoIdentityProviderService.${t}`}),AN=({url:t},e,n)=>({headers:e,url:t,body:n,method:"POST"}),IN=t=>(e,n)=>{const a=TN(t),u=JSON.stringify(e);return AN(n,a,u)},CN=()=>async t=>{if(t.statusCode>=300){const e=await Nm(t);throw _R(e),new Dn({name:e.name,message:e.message})}else return await J_(t)},kN=qS(EN,IN("InitiateAuth"),CN(),SN);function PN(t){const e=t==null?void 0:t.split("_")[0];if(!t||t.indexOf("_")<0||!e||typeof e!="string")throw new Dn({name:"InvalidUserPoolId",message:"Invalid user pool id provided."});return e}function PE(t){if(!t||!t.includes(":"))throw new Dn({name:"InvalidIdentityPoolIdException",message:"Invalid identity pool id provided.",recoverySuggestion:"Make sure a valid identityPoolId is given in the config."});return t.split(":")[0]}const xR="UserUnAuthenticatedException",DN="InvalidRedirectException",MN="InvalidAppSchemeException",zN="InvalidPreferredRedirectUrlException";new Dn({name:DN,message:"signInRedirect or signOutRedirect had an invalid format or was not found.",recoverySuggestion:"Please make sure the signIn/Out redirect in your oauth config is valid."});new Dn({name:MN,message:"A valid non-http app scheme was not found in the config.",recoverySuggestion:"Please make sure a valid custom app scheme is present in the config."});new Dn({name:zN,message:"The given preferredRedirectUrl does not match any items in the redirectSignOutUrls array from the config.",recoverySuggestion:"Please make sure a matching preferredRedirectUrl is provided."});const RN="InvalidOriginException";new Dn({name:RN,message:"redirect is coming from a different origin. The oauth flow needs to be initiated from the same origin",recoverySuggestion:"Please call signInWithRedirect from the same origin."});const ON="TokenRefreshException";function FN(t){if(!t||!t.idToken)throw new Dn({name:xR,message:"User needs to be authenticated to call this API.",recoverySuggestion:"Sign in before calling this API again."})}const LN=new Dn({name:ON,message:`Token refresh is not supported when authenticated with the 'implicit grant' (token) oauth flow. + Please change your oauth configuration to use 'code grant' flow.`,recoverySuggestion:`Please logout and change your Amplify configuration to use "code grant" flow. + E.g { responseType: 'code' }`}),BN=new Dn({name:xR,message:"User needs to be authenticated to call this API.",recoverySuggestion:"Sign in before calling this API again."});function NN(t){if(VN(t))throw LN;if(!jN(t))throw BN}const UN={inflightOAuth:"inflightOAuth",oauthSignIn:"oauthSignIn",oauthPKCE:"oauthPKCE",oauthState:"oauthState"};function bR(t){return(t==null?void 0:t.accessToken)||(t==null?void 0:t.idToken)}function jN(t){return bR(t)&&(t==null?void 0:t.refreshToken)}function VN(t){return bR(t)&&!(t!=null&&t.refreshToken)}function $N({username:t,userPoolId:e,userPoolClientId:n}){if(typeof window>"u")return;const a=window.AmazonCognitoAdvancedSecurityData;if(typeof a>"u")return;const u=a.getData(t,e,n);return u?{EncodedData:u}:{}}const WN=async({tokens:t,authConfig:e,username:n})=>{var z,W;po(e==null?void 0:e.Cognito);const a=PN(e.Cognito.userPoolId);NN(t);const u=t.refreshToken,d={REFRESH_TOKEN:u};(z=t.deviceMetadata)!=null&&z.deviceKey&&(d.DEVICE_KEY=t.deviceMetadata.deviceKey);const _=$N({username:n,userPoolId:e.Cognito.userPoolId,userPoolClientId:e.Cognito.userPoolClientId}),{AuthenticationResult:l}=await kN({region:a},{ClientId:(W=e==null?void 0:e.Cognito)==null?void 0:W.userPoolClientId,AuthFlow:"REFRESH_TOKEN_AUTH",AuthParameters:d,UserContextData:_}),w=km((l==null?void 0:l.AccessToken)??""),T=l!=null&&l.IdToken?km(l.IdToken):void 0,{iat:C}=w.payload;if(!C)throw new Dn({name:"iatNotFoundException",message:"iat not found in access token"});const P=C*1e3-new Date().getTime();return{accessToken:w,idToken:T,clockDrift:P,refreshToken:u,username:n}},GN=xN(WN),HN={accessToken:"accessToken",idToken:"idToken",oidcProvider:"oidcProvider",clockDrift:"clockDrift",refreshToken:"refreshToken",deviceKey:"deviceKey",randomPasswordKey:"randomPasswordKey",deviceGroupKey:"deviceGroupKey",signInDetails:"signInDetails",oauthMetadata:"oauthMetadata"};var T_;(function(t){t.InvalidAuthTokens="InvalidAuthTokens"})(T_||(T_={}));const qN={[T_.InvalidAuthTokens]:{message:"Invalid tokens.",recoverySuggestion:"Make sure the tokens are valid."}},ZN=rR(qN);class KN{constructor(){this.name="CognitoIdentityServiceProvider"}getKeyValueStorage(){if(!this.keyValueStorage)throw new Dn({name:"KeyValueStorageNotFoundException",message:"KeyValueStorage was not found in TokenStore"});return this.keyValueStorage}setKeyValueStorage(e){this.keyValueStorage=e}setAuthConfig(e){this.authConfig=e}async loadTokens(){try{const e=await this.getAuthKeys(),n=await this.getKeyValueStorage().getItem(e.accessToken);if(!n)throw new Dn({name:"NoSessionFoundException",message:"Auth session was not found. Make sure to call signIn."});const a=km(n),u=await this.getKeyValueStorage().getItem(e.idToken),d=u?km(u):void 0,_=await this.getKeyValueStorage().getItem(e.refreshToken)??void 0,l=await this.getKeyValueStorage().getItem(e.clockDrift)??"0",w=Number.parseInt(l),T=await this.getKeyValueStorage().getItem(e.signInDetails),C={accessToken:a,idToken:d,refreshToken:_,deviceMetadata:await this.getDeviceMetadata()??void 0,clockDrift:w,username:await this.getLastAuthUser()};return T&&(C.signInDetails=JSON.parse(T)),C}catch{return null}}async storeTokens(e){ZN(e!==void 0,T_.InvalidAuthTokens),await this.clearTokens();const n=e.username;await this.getKeyValueStorage().setItem(this.getLastAuthUserKey(),n);const a=await this.getAuthKeys();await this.getKeyValueStorage().setItem(a.accessToken,e.accessToken.toString()),e.idToken&&await this.getKeyValueStorage().setItem(a.idToken,e.idToken.toString()),e.refreshToken&&await this.getKeyValueStorage().setItem(a.refreshToken,e.refreshToken),e.deviceMetadata&&(e.deviceMetadata.deviceKey&&await this.getKeyValueStorage().setItem(a.deviceKey,e.deviceMetadata.deviceKey),e.deviceMetadata.deviceGroupKey&&await this.getKeyValueStorage().setItem(a.deviceGroupKey,e.deviceMetadata.deviceGroupKey),await this.getKeyValueStorage().setItem(a.randomPasswordKey,e.deviceMetadata.randomPassword)),e.signInDetails&&await this.getKeyValueStorage().setItem(a.signInDetails,JSON.stringify(e.signInDetails)),await this.getKeyValueStorage().setItem(a.clockDrift,`${e.clockDrift}`)}async clearTokens(){const e=await this.getAuthKeys();await Promise.all([this.getKeyValueStorage().removeItem(e.accessToken),this.getKeyValueStorage().removeItem(e.idToken),this.getKeyValueStorage().removeItem(e.clockDrift),this.getKeyValueStorage().removeItem(e.refreshToken),this.getKeyValueStorage().removeItem(e.signInDetails),this.getKeyValueStorage().removeItem(this.getLastAuthUserKey()),this.getKeyValueStorage().removeItem(e.oauthMetadata)])}async getDeviceMetadata(e){const n=await this.getAuthKeys(e),a=await this.getKeyValueStorage().getItem(n.deviceKey),u=await this.getKeyValueStorage().getItem(n.deviceGroupKey),d=await this.getKeyValueStorage().getItem(n.randomPasswordKey);return d&&u&&a?{deviceKey:a,deviceGroupKey:u,randomPassword:d}:null}async clearDeviceMetadata(e){const n=await this.getAuthKeys(e);await Promise.all([this.getKeyValueStorage().removeItem(n.deviceKey),this.getKeyValueStorage().removeItem(n.deviceGroupKey),this.getKeyValueStorage().removeItem(n.randomPasswordKey)])}async getAuthKeys(e){var a;po((a=this.authConfig)==null?void 0:a.Cognito);const n=e??await this.getLastAuthUser();return XN(this.name,`${this.authConfig.Cognito.userPoolClientId}.${n}`)}getLastAuthUserKey(){var n;po((n=this.authConfig)==null?void 0:n.Cognito);const e=this.authConfig.Cognito.userPoolClientId;return`${this.name}.${e}.LastAuthUser`}async getLastAuthUser(){return await this.getKeyValueStorage().getItem(this.getLastAuthUserKey())??"username"}async setOAuthMetadata(e){const{oauthMetadata:n}=await this.getAuthKeys();await this.getKeyValueStorage().setItem(n,JSON.stringify(e))}async getOAuthMetadata(){const{oauthMetadata:e}=await this.getAuthKeys(),n=await this.getKeyValueStorage().getItem(e);return n&&JSON.parse(n)}}const XN=(t,e)=>YS(HN)(`${t}`,e);function YS(t){const e=Object.values({...t});return(n,a)=>e.reduce((u,d)=>({...u,[d]:`${n}.${a}.${d}`}),{})}const Bk="amplify-signin-with-hostedUI",ds="CognitoIdentityServiceProvider";class YN{constructor(e){this.keyValueStorage=e}async clearOAuthInflightData(){po(this.cognitoConfig);const e=ps(ds,this.cognitoConfig.userPoolClientId);await Promise.all([this.keyValueStorage.removeItem(e.inflightOAuth),this.keyValueStorage.removeItem(e.oauthPKCE),this.keyValueStorage.removeItem(e.oauthState)])}async clearOAuthData(){po(this.cognitoConfig);const e=ps(ds,this.cognitoConfig.userPoolClientId);return await this.clearOAuthInflightData(),await this.keyValueStorage.removeItem(Bk),this.keyValueStorage.removeItem(e.oauthSignIn)}loadOAuthState(){po(this.cognitoConfig);const e=ps(ds,this.cognitoConfig.userPoolClientId);return this.keyValueStorage.getItem(e.oauthState)}storeOAuthState(e){po(this.cognitoConfig);const n=ps(ds,this.cognitoConfig.userPoolClientId);return this.keyValueStorage.setItem(n.oauthState,e)}loadPKCE(){po(this.cognitoConfig);const e=ps(ds,this.cognitoConfig.userPoolClientId);return this.keyValueStorage.getItem(e.oauthPKCE)}storePKCE(e){po(this.cognitoConfig);const n=ps(ds,this.cognitoConfig.userPoolClientId);return this.keyValueStorage.setItem(n.oauthPKCE,e)}setAuthConfig(e){this.cognitoConfig=e}async loadOAuthInFlight(){po(this.cognitoConfig);const e=ps(ds,this.cognitoConfig.userPoolClientId);return await this.keyValueStorage.getItem(e.inflightOAuth)==="true"}async storeOAuthInFlight(e){po(this.cognitoConfig);const n=ps(ds,this.cognitoConfig.userPoolClientId);await this.keyValueStorage.setItem(n.inflightOAuth,`${e}`)}async loadOAuthSignIn(){var d;po(this.cognitoConfig);const e=ps(ds,this.cognitoConfig.userPoolClientId),n=await this.keyValueStorage.getItem(Bk),[a,u]=((d=await this.keyValueStorage.getItem(e.oauthSignIn))==null?void 0:d.split(","))??[];return{isOAuthSignIn:a==="true"||n==="true",preferPrivateSession:u==="true"}}async storeOAuthSignIn(e,n=!1){po(this.cognitoConfig);const a=ps(ds,this.cognitoConfig.userPoolClientId);await this.keyValueStorage.setItem(a.oauthSignIn,`${e},${n}`)}}const ps=(t,e)=>YS(UN)(t,e),Nk=new YN(Dm),QN=[],JN=t=>{QN.push(t)};class eU{constructor(){this.waitForInflightOAuth=D6()?async()=>{if(await Nk.loadOAuthInFlight())return this.inflightPromise?this.inflightPromise:(this.inflightPromise=new Promise((e,n)=>{JN(e)}),this.inflightPromise)}:async()=>{}}setAuthConfig(e){Nk.setAuthConfig(e.Cognito),this.authConfig=e}setTokenRefresher(e){this.tokenRefresher=e}setAuthTokenStore(e){this.tokenStore=e}getTokenStore(){if(!this.tokenStore)throw new Dn({name:"EmptyTokenStoreException",message:"TokenStore not set"});return this.tokenStore}getTokenRefresher(){if(!this.tokenRefresher)throw new Dn({name:"EmptyTokenRefresherException",message:"TokenRefresher not set"});return this.tokenRefresher}async getTokens(e){var _,l,w,T,C;let n;try{po((_=this.authConfig)==null?void 0:_.Cognito)}catch{return null}await this.waitForInflightOAuth(),this.inflightPromise=void 0,n=await this.getTokenStore().loadTokens();const a=await this.getTokenStore().getLastAuthUser();if(n===null)return null;const u=!!(n!=null&&n.idToken)&&xk({expiresAt:(((w=(l=n.idToken)==null?void 0:l.payload)==null?void 0:w.exp)??0)*1e3,clockDrift:n.clockDrift??0}),d=xk({expiresAt:(((C=(T=n.accessToken)==null?void 0:T.payload)==null?void 0:C.exp)??0)*1e3,clockDrift:n.clockDrift??0});return(e!=null&&e.forceRefresh||u||d)&&(n=await this.refreshTokens({tokens:n,username:a}),n===null)?null:{accessToken:n==null?void 0:n.accessToken,idToken:n==null?void 0:n.idToken,signInDetails:n==null?void 0:n.signInDetails}}async refreshTokens({tokens:e,username:n}){try{const{signInDetails:a}=e,u=await this.getTokenRefresher()({tokens:e,authConfig:this.authConfig,username:n});return u.signInDetails=a,await this.setTokens({tokens:u}),IE.dispatch("auth",{event:"tokenRefresh"},"Auth",E_),u}catch(a){return this.handleErrors(a)}}handleErrors(e){if(_R(e),e.message!=="Network error"&&this.clearTokens(),IE.dispatch("auth",{event:"tokenRefresh_failure",data:{error:e}},"Auth",E_),e.name.startsWith("NotAuthorizedException"))return null;throw e}async setTokens({tokens:e}){return this.getTokenStore().storeTokens(e)}async clearTokens(){return this.getTokenStore().clearTokens()}getDeviceMetadata(e){return this.getTokenStore().getDeviceMetadata(e)}clearDeviceMetadata(e){return this.getTokenStore().clearDeviceMetadata(e)}setOAuthMetadata(e){return this.getTokenStore().setOAuthMetadata(e)}getOAuthMetadata(){return this.getTokenStore().getOAuthMetadata()}}class tU{constructor(){this.authTokenStore=new KN,this.authTokenStore.setKeyValueStorage(Dm),this.tokenOrchestrator=new eU,this.tokenOrchestrator.setAuthTokenStore(this.authTokenStore),this.tokenOrchestrator.setTokenRefresher(GN)}getTokens({forceRefresh:e}={forceRefresh:!1}){return this.tokenOrchestrator.getTokens({forceRefresh:e})}setKeyValueStorage(e){this.authTokenStore.setKeyValueStorage(e)}setAuthConfig(e){this.authTokenStore.setAuthConfig(e),this.tokenOrchestrator.setAuthConfig(e)}}const Gg=new tU,rU={identityId:"identityId"},nU=new Ha("DefaultIdentityIdStore");class iU{setAuthConfig(e){Gy(e.Cognito),this.authConfig=e,this._authKeys=oU("Cognito",e.Cognito.identityPoolId)}constructor(e){this._authKeys={},this.keyValueStorage=e}async loadIdentityId(){var e;Gy((e=this.authConfig)==null?void 0:e.Cognito);try{if(this._primaryIdentityId)return{id:this._primaryIdentityId,type:"primary"};{const n=await this.keyValueStorage.getItem(this._authKeys.identityId);return n?{id:n,type:"guest"}:null}}catch(n){return nU.log("Error getting stored IdentityId.",n),null}}async storeIdentityId(e){var n;Gy((n=this.authConfig)==null?void 0:n.Cognito),e.type==="guest"?(this.keyValueStorage.setItem(this._authKeys.identityId,e.id),this._primaryIdentityId=void 0):(this._primaryIdentityId=e.id,this.keyValueStorage.removeItem(this._authKeys.identityId))}async clearIdentityId(){this._primaryIdentityId=void 0,await this.keyValueStorage.removeItem(this._authKeys.identityId)}}const oU=(t,e)=>YS(rU)(`com.amplify.${t}`,e);function wR(t){const e=km(t).payload.iss,n={};if(!e)throw new Dn({name:"InvalidIdTokenException",message:"Invalid Idtoken."});const a=e.replace(/(^\w+:|^)\/\//,"");return n[a]=t,n}const aU=new Ha("CognitoIdentityIdProvider");async function sU({tokens:t,authConfig:e,identityIdStore:n}){n.setAuthConfig({Cognito:e});let a=await n.loadIdentityId();if(t){if(a&&a.type==="primary")return a.id;{const u=t.idToken?wR(t.idToken.toString()):{},d=await Uk(u,e);a&&a.id===d&&aU.debug(`The guest identity ${a.id} has become the primary identity.`),a={id:d,type:"primary"}}}else{if(a&&a.type==="guest")return a.id;a={id:await Uk({},e),type:"guest"}}return n.storeIdentityId(a),a.id}async function Uk(t,e){const n=e==null?void 0:e.identityPoolId,a=PE(n),u=(await hN({region:a},{IdentityPoolId:n,Logins:t})).IdentityId;if(!u)throw new Dn({name:"GetIdResponseException",message:"Received undefined response from getId operation",recoverySuggestion:"Make sure to pass a valid identityPoolId in the configuration."});return u}const Hg=new Ha("CognitoCredentialsProvider"),jk=50*60*1e3;class lU{constructor(e){this._nextCredentialsRefresh=0,this._identityIdStore=e}async clearCredentialsAndIdentityId(){Hg.debug("Clearing out credentials and identityId"),this._credentialsAndIdentityId=void 0,await this._identityIdStore.clearIdentityId()}async clearCredentials(){Hg.debug("Clearing out in-memory credentials"),this._credentialsAndIdentityId=void 0}async getCredentialsAndIdentityId(e){const n=e.authenticated,{tokens:a}=e,{authConfig:u}=e;try{Gy(u==null?void 0:u.Cognito)}catch{return}if(!n&&!u.Cognito.allowGuestAccess)return;const{forceRefresh:d}=e,_=this.hasTokenChanged(a),l=await sU({tokens:a,authConfig:u.Cognito,identityIdStore:this._identityIdStore});return(d||_)&&this.clearCredentials(),n?(FN(a),this.credsForOIDCTokens(u.Cognito,a,l)):this.getGuestCredentials(l,u.Cognito)}async getGuestCredentials(e,n){if(this._credentialsAndIdentityId&&!this.isPastTTL()&&this._credentialsAndIdentityId.isAuthenticatedCreds===!1)return Hg.info("returning stored credentials as they neither past TTL nor expired."),this._credentialsAndIdentityId;this.clearCredentials();const a=PE(n.identityPoolId),u=await Fk({region:a},{IdentityId:e});if(u.Credentials&&u.Credentials.AccessKeyId&&u.Credentials.SecretKey){this._nextCredentialsRefresh=new Date().getTime()+jk;const d={credentials:{accessKeyId:u.Credentials.AccessKeyId,secretAccessKey:u.Credentials.SecretKey,sessionToken:u.Credentials.SessionToken,expiration:u.Credentials.Expiration},identityId:e},_=u.IdentityId;return _&&(d.identityId=_,this._identityIdStore.storeIdentityId({id:_,type:"guest"})),this._credentialsAndIdentityId={...d,isAuthenticatedCreds:!1},d}else throw new Dn({name:"CredentialsNotFoundException",message:"Cognito did not respond with either Credentials, AccessKeyId or SecretKey."})}async credsForOIDCTokens(e,n,a){var l;if(this._credentialsAndIdentityId&&!this.isPastTTL()&&this._credentialsAndIdentityId.isAuthenticatedCreds===!0)return Hg.debug("returning stored credentials as they neither past TTL nor expired."),this._credentialsAndIdentityId;this.clearCredentials();const u=n.idToken?wR(n.idToken.toString()):{},d=PE(e.identityPoolId),_=await Fk({region:d},{IdentityId:a,Logins:u});if(_.Credentials&&_.Credentials.AccessKeyId&&_.Credentials.SecretKey){const w={credentials:{accessKeyId:_.Credentials.AccessKeyId,secretAccessKey:_.Credentials.SecretKey,sessionToken:_.Credentials.SessionToken,expiration:_.Credentials.Expiration},identityId:a};this._credentialsAndIdentityId={...w,isAuthenticatedCreds:!0,associatedIdToken:(l=n.idToken)==null?void 0:l.toString()},this._nextCredentialsRefresh=new Date().getTime()+jk;const T=_.IdentityId;return T&&(w.identityId=T,this._identityIdStore.storeIdentityId({id:T,type:"primary"})),w}else throw new Dn({name:"CredentialsException",message:"Cognito did not respond with either Credentials, AccessKeyId or SecretKey."})}isPastTTL(){return this._nextCredentialsRefresh===void 0?!0:this._nextCredentialsRefresh<=Date.now()}hasTokenChanged(e){var n,a;return!!e&&!!((n=this._credentialsAndIdentityId)!=null&&n.associatedIdToken)&&((a=e.idToken)==null?void 0:a.toString())!==this._credentialsAndIdentityId.associatedIdToken}}const cU=new lU(new iU(Dm)),uU={configure(t,e){const n=oR(t);if(!n.Auth){Js.configure(n,e);return}if(e!=null&&e.Auth){Js.configure(n,e);return}if(!Js.libraryOptions.Auth){Gg.setAuthConfig(n.Auth),Gg.setKeyValueStorage(e!=null&&e.ssr?new Lk({sameSite:"lax"}):Dm),Js.configure(n,{...e,Auth:{tokenProvider:Gg,credentialsProvider:cU}});return}if(e){e.ssr!==void 0&&Gg.setKeyValueStorage(e.ssr?new Lk({sameSite:"lax"}):Dm),Js.configure(n,{Auth:Js.libraryOptions.Auth,...e});return}Js.configure(n)},getConfig(){return Js.getConfig()}};/* + * Frontend UI component library for the CORI Data API + * {@link https://github.com/ruralinnovation/cori.data.api} + * @copyright Rural Innovation Strategies, Inc. + * @license ISC + */var hU={oauth:{domain:"authcori.auth.us-east-1.amazoncognito.com"}},dU="us-east-1",pU="us-east-1_QeA4600FA",fU="5eusi16g0o2q1g1rr5ehgudodm",mU="authcori.auth.us-east-1.amazoncognito.com",gU="us-east-1",yU="us-east-1:2194a76a-fa3d-4c33-999e-e3c4b2b049ee",_U=["EMAIL"],vU=["EMAIL","OPENID"],xU=["EMAIL","OPENID"],bU={passwordPolicyMinLength:8,passwordPolicyCharacters:["REQUIRES_NUMBERS","REQUIRES_LOWERCASE","REQUIRES_UPPERCASE","REQUIRES_SYMBOLS"]},wU="https://bdkxhfgus5dztobic7gvn5ymue.appsync-api.us-east-1.amazonaws.com/graphql",EU="us-east-1",SU="da2-yexc3mow25fc3amaendi4vscuq",TU="API_KEY",AU="AMAZON_COGNITO_USER_POOLS,AWS_IAM",IU={version:1,models:{Todo:{name:"Todo",fields:{id:{name:"id",isArray:!1,type:"ID",isRequired:!0,attributes:[]},content:{name:"content",isArray:!1,type:"String",isRequired:!1,attributes:[]},owner:{name:"owner",isArray:!1,type:"String",isRequired:!1,attributes:[]},createdAt:{name:"createdAt",isArray:!1,type:"AWSDateTime",isRequired:!0,attributes:[]},updatedAt:{name:"updatedAt",isArray:!1,type:"AWSDateTime",isRequired:!0,attributes:[]}},syncable:!0,pluralName:"Todos",attributes:[{type:"model",properties:{}},{type:"key",properties:{fields:["id"]}},{type:"auth",properties:{rules:[{provider:"userPools",ownerField:"owner",allow:"owner",identityClaim:"cognito:username",operations:["create","update","delete","read"]},{allow:"public",operations:["read"]}]}}],primaryKeyInfo:{isCustomPrimaryKey:!1,primaryKeyFieldName:"id",sortKeyFieldNames:[]}}},enums:{},nonModels:{}},CU={Auth:hU,aws_project_region:dU,aws_user_pools_id:pU,aws_user_pools_web_client_id:fU,aws_cognito_domain:mU,aws_cognito_region:gU,aws_cognito_identity_pool_id:yU,aws_cognito_signup_attributes:_U,aws_cognito_username_attributes:vU,aws_cognito_verification_mechanisms:xU,aws_cognito_password_protection_settings:bU,aws_appsync_graphqlEndpoint:wU,aws_appsync_region:EU,aws_appsync_apiKey:SU,aws_appsync_authenticationType:TU,aws_appsync_additionalAuthenticationTypes:AU,modelIntrospection:IU};/* + * Frontend UI component library for the CORI Data API + * {@link https://github.com/ruralinnovation/cori.data.api} + * @copyright Rural Innovation Strategies, Inc. + * @license ISC + */uU.configure(CU);const kU={domain:void 0,region:void 0,identityPoolId:void 0,userPoolId:void 0,userPoolClientId:void 0};St.createContext(kU);function ER(t,e){return function(){return t.apply(e,arguments)}}const{toString:PU}=Object.prototype,{getPrototypeOf:QS}=Object,ev=(t=>e=>{const n=PU.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Ka=t=>(t=t.toLowerCase(),e=>ev(e)===t),tv=t=>e=>typeof e===t,{isArray:Fd}=Array,Mm=tv("undefined");function DU(t){return t!==null&&!Mm(t)&&t.constructor!==null&&!Mm(t.constructor)&&No(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const SR=Ka("ArrayBuffer");function MU(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&SR(t.buffer),e}const zU=tv("string"),No=tv("function"),TR=tv("number"),rv=t=>t!==null&&typeof t=="object",RU=t=>t===!0||t===!1,qy=t=>{if(ev(t)!=="object")return!1;const e=QS(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},OU=Ka("Date"),FU=Ka("File"),LU=Ka("Blob"),BU=Ka("FileList"),NU=t=>rv(t)&&No(t.pipe),UU=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||No(t.append)&&((e=ev(t))==="formdata"||e==="object"&&No(t.toString)&&t.toString()==="[object FormData]"))},jU=Ka("URLSearchParams"),[VU,$U,WU,GU]=["ReadableStream","Request","Response","Headers"].map(Ka),HU=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Um(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let a,u;if(typeof t!="object"&&(t=[t]),Fd(t))for(a=0,u=t.length;a0;)if(u=n[a],e===u.toLowerCase())return u;return null}const Au=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),IR=t=>!Mm(t)&&t!==Au;function DE(){const{caseless:t}=IR(this)&&this||{},e={},n=(a,u)=>{const d=t&&AR(e,u)||u;qy(e[d])&&qy(a)?e[d]=DE(e[d],a):qy(a)?e[d]=DE({},a):Fd(a)?e[d]=a.slice():e[d]=a};for(let a=0,u=arguments.length;a(Um(e,(u,d)=>{n&&No(u)?t[d]=ER(u,n):t[d]=u},{allOwnKeys:a}),t),ZU=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),KU=(t,e,n,a)=>{t.prototype=Object.create(e.prototype,a),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},XU=(t,e,n,a)=>{let u,d,_;const l={};if(e=e||{},t==null)return e;do{for(u=Object.getOwnPropertyNames(t),d=u.length;d-- >0;)_=u[d],(!a||a(_,t,e))&&!l[_]&&(e[_]=t[_],l[_]=!0);t=n!==!1&&QS(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},YU=(t,e,n)=>{t=String(t),(n===void 0||n>t.length)&&(n=t.length),n-=e.length;const a=t.indexOf(e,n);return a!==-1&&a===n},QU=t=>{if(!t)return null;if(Fd(t))return t;let e=t.length;if(!TR(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},JU=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&QS(Uint8Array)),ej=(t,e)=>{const a=(t&&t[Symbol.iterator]).call(t);let u;for(;(u=a.next())&&!u.done;){const d=u.value;e.call(t,d[0],d[1])}},tj=(t,e)=>{let n;const a=[];for(;(n=t.exec(e))!==null;)a.push(n);return a},rj=Ka("HTMLFormElement"),nj=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,a,u){return a.toUpperCase()+u}),Vk=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),ij=Ka("RegExp"),CR=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),a={};Um(n,(u,d)=>{let _;(_=e(u,d,t))!==!1&&(a[d]=_||u)}),Object.defineProperties(t,a)},oj=t=>{CR(t,(e,n)=>{if(No(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const a=t[n];if(No(a)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},aj=(t,e)=>{const n={},a=u=>{u.forEach(d=>{n[d]=!0})};return Fd(t)?a(t):a(String(t).split(e)),n},sj=()=>{},lj=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e,tb="abcdefghijklmnopqrstuvwxyz",$k="0123456789",kR={DIGIT:$k,ALPHA:tb,ALPHA_DIGIT:tb+tb.toUpperCase()+$k},cj=(t=16,e=kR.ALPHA_DIGIT)=>{let n="";const{length:a}=e;for(;t--;)n+=e[Math.random()*a|0];return n};function uj(t){return!!(t&&No(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}const hj=t=>{const e=new Array(10),n=(a,u)=>{if(rv(a)){if(e.indexOf(a)>=0)return;if(!("toJSON"in a)){e[u]=a;const d=Fd(a)?[]:{};return Um(a,(_,l)=>{const w=n(_,u+1);!Mm(w)&&(d[l]=w)}),e[u]=void 0,d}}return a};return n(t,0)},dj=Ka("AsyncFunction"),pj=t=>t&&(rv(t)||No(t))&&No(t.then)&&No(t.catch),PR=((t,e)=>t?setImmediate:e?((n,a)=>(Au.addEventListener("message",({source:u,data:d})=>{u===Au&&d===n&&a.length&&a.shift()()},!1),u=>{a.push(u),Au.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",No(Au.postMessage)),fj=typeof queueMicrotask<"u"?queueMicrotask.bind(Au):typeof process<"u"&&process.nextTick||PR,Ye={isArray:Fd,isArrayBuffer:SR,isBuffer:DU,isFormData:UU,isArrayBufferView:MU,isString:zU,isNumber:TR,isBoolean:RU,isObject:rv,isPlainObject:qy,isReadableStream:VU,isRequest:$U,isResponse:WU,isHeaders:GU,isUndefined:Mm,isDate:OU,isFile:FU,isBlob:LU,isRegExp:ij,isFunction:No,isStream:NU,isURLSearchParams:jU,isTypedArray:JU,isFileList:BU,forEach:Um,merge:DE,extend:qU,trim:HU,stripBOM:ZU,inherits:KU,toFlatObject:XU,kindOf:ev,kindOfTest:Ka,endsWith:YU,toArray:QU,forEachEntry:ej,matchAll:tj,isHTMLForm:rj,hasOwnProperty:Vk,hasOwnProp:Vk,reduceDescriptors:CR,freezeMethods:oj,toObjectSet:aj,toCamelCase:nj,noop:sj,toFiniteNumber:lj,findKey:AR,global:Au,isContextDefined:IR,ALPHABET:kR,generateString:cj,isSpecCompliantForm:uj,toJSONObject:hj,isAsyncFn:dj,isThenable:pj,setImmediate:PR,asap:fj};function ar(t,e,n,a,u){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),a&&(this.request=a),u&&(this.response=u,this.status=u.status?u.status:null)}Ye.inherits(ar,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Ye.toJSONObject(this.config),code:this.code,status:this.status}}});const DR=ar.prototype,MR={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{MR[t]={value:t}});Object.defineProperties(ar,MR);Object.defineProperty(DR,"isAxiosError",{value:!0});ar.from=(t,e,n,a,u,d)=>{const _=Object.create(DR);return Ye.toFlatObject(t,_,function(w){return w!==Error.prototype},l=>l!=="isAxiosError"),ar.call(_,t.message,e,n,a,u),_.cause=t,_.name=t.name,d&&Object.assign(_,d),_};const mj=null;function ME(t){return Ye.isPlainObject(t)||Ye.isArray(t)}function zR(t){return Ye.endsWith(t,"[]")?t.slice(0,-2):t}function Wk(t,e,n){return t?t.concat(e).map(function(u,d){return u=zR(u),!n&&d?"["+u+"]":u}).join(n?".":""):e}function gj(t){return Ye.isArray(t)&&!t.some(ME)}const yj=Ye.toFlatObject(Ye,{},null,function(e){return/^is[A-Z]/.test(e)});function nv(t,e,n){if(!Ye.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=Ye.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(j,L){return!Ye.isUndefined(L[j])});const a=n.metaTokens,u=n.visitor||C,d=n.dots,_=n.indexes,w=(n.Blob||typeof Blob<"u"&&Blob)&&Ye.isSpecCompliantForm(e);if(!Ye.isFunction(u))throw new TypeError("visitor must be a function");function T(U){if(U===null)return"";if(Ye.isDate(U))return U.toISOString();if(!w&&Ye.isBlob(U))throw new ar("Blob is not supported. Use a Buffer instead.");return Ye.isArrayBuffer(U)||Ye.isTypedArray(U)?w&&typeof Blob=="function"?new Blob([U]):Buffer.from(U):U}function C(U,j,L){let V=U;if(U&&!L&&typeof U=="object"){if(Ye.endsWith(j,"{}"))j=a?j:j.slice(0,-2),U=JSON.stringify(U);else if(Ye.isArray(U)&&gj(U)||(Ye.isFileList(U)||Ye.endsWith(j,"[]"))&&(V=Ye.toArray(U)))return j=zR(j),V.forEach(function(F,H){!(Ye.isUndefined(F)||F===null)&&e.append(_===!0?Wk([j],H,d):_===null?j:j+"[]",T(F))}),!1}return ME(U)?!0:(e.append(Wk(L,j,d),T(U)),!1)}const P=[],z=Object.assign(yj,{defaultVisitor:C,convertValue:T,isVisitable:ME});function W(U,j){if(!Ye.isUndefined(U)){if(P.indexOf(U)!==-1)throw Error("Circular reference detected in "+j.join("."));P.push(U),Ye.forEach(U,function(V,R){(!(Ye.isUndefined(V)||V===null)&&u.call(e,V,Ye.isString(R)?R.trim():R,j,z))===!0&&W(V,j?j.concat(R):[R])}),P.pop()}}if(!Ye.isObject(t))throw new TypeError("data must be an object");return W(t),e}function Gk(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(a){return e[a]})}function JS(t,e){this._pairs=[],t&&nv(t,this,e)}const RR=JS.prototype;RR.append=function(e,n){this._pairs.push([e,n])};RR.toString=function(e){const n=e?function(a){return e.call(this,a,Gk)}:Gk;return this._pairs.map(function(u){return n(u[0])+"="+n(u[1])},"").join("&")};function _j(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function OR(t,e,n){if(!e)return t;const a=n&&n.encode||_j,u=n&&n.serialize;let d;if(u?d=u(e,n):d=Ye.isURLSearchParams(e)?e.toString():new JS(e,n).toString(a),d){const _=t.indexOf("#");_!==-1&&(t=t.slice(0,_)),t+=(t.indexOf("?")===-1?"?":"&")+d}return t}class vj{constructor(){this.handlers=[]}use(e,n,a){return this.handlers.push({fulfilled:e,rejected:n,synchronous:a?a.synchronous:!1,runWhen:a?a.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Ye.forEach(this.handlers,function(a){a!==null&&e(a)})}}const Hk=vj,FR={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},xj=typeof URLSearchParams<"u"?URLSearchParams:JS,bj=typeof FormData<"u"?FormData:null,wj=typeof Blob<"u"?Blob:null,Ej={isBrowser:!0,classes:{URLSearchParams:xj,FormData:bj,Blob:wj},protocols:["http","https","file","blob","url","data"]},eT=typeof window<"u"&&typeof document<"u",zE=typeof navigator=="object"&&navigator||void 0,Sj=eT&&(!zE||["ReactNative","NativeScript","NS"].indexOf(zE.product)<0),Tj=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),Aj=eT&&window.location.href||"http://localhost",Ij=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:eT,hasStandardBrowserEnv:Sj,hasStandardBrowserWebWorkerEnv:Tj,navigator:zE,origin:Aj},Symbol.toStringTag,{value:"Module"})),vo={...Ij,...Ej};function Cj(t,e){return nv(t,new vo.classes.URLSearchParams,Object.assign({visitor:function(n,a,u,d){return vo.isNode&&Ye.isBuffer(n)?(this.append(a,n.toString("base64")),!1):d.defaultVisitor.apply(this,arguments)}},e))}function kj(t){return Ye.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function Pj(t){const e={},n=Object.keys(t);let a;const u=n.length;let d;for(a=0;a=n.length;return _=!_&&Ye.isArray(u)?u.length:_,w?(Ye.hasOwnProp(u,_)?u[_]=[u[_],a]:u[_]=a,!l):((!u[_]||!Ye.isObject(u[_]))&&(u[_]=[]),e(n,a,u[_],d)&&Ye.isArray(u[_])&&(u[_]=Pj(u[_])),!l)}if(Ye.isFormData(t)&&Ye.isFunction(t.entries)){const n={};return Ye.forEachEntry(t,(a,u)=>{e(kj(a),u,n,0)}),n}return null}function Dj(t,e,n){if(Ye.isString(t))try{return(e||JSON.parse)(t),Ye.trim(t)}catch(a){if(a.name!=="SyntaxError")throw a}return(n||JSON.stringify)(t)}const tT={transitional:FR,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){const a=n.getContentType()||"",u=a.indexOf("application/json")>-1,d=Ye.isObject(e);if(d&&Ye.isHTMLForm(e)&&(e=new FormData(e)),Ye.isFormData(e))return u?JSON.stringify(LR(e)):e;if(Ye.isArrayBuffer(e)||Ye.isBuffer(e)||Ye.isStream(e)||Ye.isFile(e)||Ye.isBlob(e)||Ye.isReadableStream(e))return e;if(Ye.isArrayBufferView(e))return e.buffer;if(Ye.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let l;if(d){if(a.indexOf("application/x-www-form-urlencoded")>-1)return Cj(e,this.formSerializer).toString();if((l=Ye.isFileList(e))||a.indexOf("multipart/form-data")>-1){const w=this.env&&this.env.FormData;return nv(l?{"files[]":e}:e,w&&new w,this.formSerializer)}}return d||u?(n.setContentType("application/json",!1),Dj(e)):e}],transformResponse:[function(e){const n=this.transitional||tT.transitional,a=n&&n.forcedJSONParsing,u=this.responseType==="json";if(Ye.isResponse(e)||Ye.isReadableStream(e))return e;if(e&&Ye.isString(e)&&(a&&!this.responseType||u)){const _=!(n&&n.silentJSONParsing)&&u;try{return JSON.parse(e)}catch(l){if(_)throw l.name==="SyntaxError"?ar.from(l,ar.ERR_BAD_RESPONSE,this,null,this.response):l}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:vo.classes.FormData,Blob:vo.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Ye.forEach(["delete","get","head","post","put","patch"],t=>{tT.headers[t]={}});const rT=tT,Mj=Ye.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),zj=t=>{const e={};let n,a,u;return t&&t.split(` +`).forEach(function(_){u=_.indexOf(":"),n=_.substring(0,u).trim().toLowerCase(),a=_.substring(u+1).trim(),!(!n||e[n]&&Mj[n])&&(n==="set-cookie"?e[n]?e[n].push(a):e[n]=[a]:e[n]=e[n]?e[n]+", "+a:a)}),e},qk=Symbol("internals");function Rf(t){return t&&String(t).trim().toLowerCase()}function Zy(t){return t===!1||t==null?t:Ye.isArray(t)?t.map(Zy):String(t)}function Rj(t){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let a;for(;a=n.exec(t);)e[a[1]]=a[2];return e}const Oj=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function rb(t,e,n,a,u){if(Ye.isFunction(a))return a.call(this,e,n);if(u&&(e=n),!!Ye.isString(e)){if(Ye.isString(a))return e.indexOf(a)!==-1;if(Ye.isRegExp(a))return a.test(e)}}function Fj(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,a)=>n.toUpperCase()+a)}function Lj(t,e){const n=Ye.toCamelCase(" "+e);["get","set","has"].forEach(a=>{Object.defineProperty(t,a+n,{value:function(u,d,_){return this[a].call(this,e,u,d,_)},configurable:!0})})}class iv{constructor(e){e&&this.set(e)}set(e,n,a){const u=this;function d(l,w,T){const C=Rf(w);if(!C)throw new Error("header name must be a non-empty string");const P=Ye.findKey(u,C);(!P||u[P]===void 0||T===!0||T===void 0&&u[P]!==!1)&&(u[P||w]=Zy(l))}const _=(l,w)=>Ye.forEach(l,(T,C)=>d(T,C,w));if(Ye.isPlainObject(e)||e instanceof this.constructor)_(e,n);else if(Ye.isString(e)&&(e=e.trim())&&!Oj(e))_(zj(e),n);else if(Ye.isHeaders(e))for(const[l,w]of e.entries())d(w,l,a);else e!=null&&d(n,e,a);return this}get(e,n){if(e=Rf(e),e){const a=Ye.findKey(this,e);if(a){const u=this[a];if(!n)return u;if(n===!0)return Rj(u);if(Ye.isFunction(n))return n.call(this,u,a);if(Ye.isRegExp(n))return n.exec(u);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=Rf(e),e){const a=Ye.findKey(this,e);return!!(a&&this[a]!==void 0&&(!n||rb(this,this[a],a,n)))}return!1}delete(e,n){const a=this;let u=!1;function d(_){if(_=Rf(_),_){const l=Ye.findKey(a,_);l&&(!n||rb(a,a[l],l,n))&&(delete a[l],u=!0)}}return Ye.isArray(e)?e.forEach(d):d(e),u}clear(e){const n=Object.keys(this);let a=n.length,u=!1;for(;a--;){const d=n[a];(!e||rb(this,this[d],d,e,!0))&&(delete this[d],u=!0)}return u}normalize(e){const n=this,a={};return Ye.forEach(this,(u,d)=>{const _=Ye.findKey(a,d);if(_){n[_]=Zy(u),delete n[d];return}const l=e?Fj(d):String(d).trim();l!==d&&delete n[d],n[l]=Zy(u),a[l]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const n=Object.create(null);return Ye.forEach(this,(a,u)=>{a!=null&&a!==!1&&(n[u]=e&&Ye.isArray(a)?a.join(", "):a)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,n])=>e+": "+n).join(` +`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...n){const a=new this(e);return n.forEach(u=>a.set(u)),a}static accessor(e){const a=(this[qk]=this[qk]={accessors:{}}).accessors,u=this.prototype;function d(_){const l=Rf(_);a[l]||(Lj(u,_),a[l]=!0)}return Ye.isArray(e)?e.forEach(d):d(e),this}}iv.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Ye.reduceDescriptors(iv.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(a){this[n]=a}}});Ye.freezeMethods(iv);const qa=iv;function nb(t,e){const n=this||rT,a=e||n,u=qa.from(a.headers);let d=a.data;return Ye.forEach(t,function(l){d=l.call(n,d,u.normalize(),e?e.status:void 0)}),u.normalize(),d}function BR(t){return!!(t&&t.__CANCEL__)}function Ld(t,e,n){ar.call(this,t??"canceled",ar.ERR_CANCELED,e,n),this.name="CanceledError"}Ye.inherits(Ld,ar,{__CANCEL__:!0});function NR(t,e,n){const a=n.config.validateStatus;!n.status||!a||a(n.status)?t(n):e(new ar("Request failed with status code "+n.status,[ar.ERR_BAD_REQUEST,ar.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function Bj(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function Nj(t,e){t=t||10;const n=new Array(t),a=new Array(t);let u=0,d=0,_;return e=e!==void 0?e:1e3,function(w){const T=Date.now(),C=a[d];_||(_=T),n[u]=w,a[u]=T;let P=d,z=0;for(;P!==u;)z+=n[P++],P=P%t;if(u=(u+1)%t,u===d&&(d=(d+1)%t),T-_{n=C,u=null,d&&(clearTimeout(d),d=null),t.apply(null,T)};return[(...T)=>{const C=Date.now(),P=C-n;P>=a?_(T,C):(u=T,d||(d=setTimeout(()=>{d=null,_(u)},a-P)))},()=>u&&_(u)]}const A_=(t,e,n=3)=>{let a=0;const u=Nj(50,250);return Uj(d=>{const _=d.loaded,l=d.lengthComputable?d.total:void 0,w=_-a,T=u(w),C=_<=l;a=_;const P={loaded:_,total:l,progress:l?_/l:void 0,bytes:w,rate:T||void 0,estimated:T&&l&&C?(l-_)/T:void 0,event:d,lengthComputable:l!=null,[e?"download":"upload"]:!0};t(P)},n)},Zk=(t,e)=>{const n=t!=null;return[a=>e[0]({lengthComputable:n,total:t,loaded:a}),e[1]]},Kk=t=>(...e)=>Ye.asap(()=>t(...e)),jj=vo.hasStandardBrowserEnv?function(){const e=vo.navigator&&/(msie|trident)/i.test(vo.navigator.userAgent),n=document.createElement("a");let a;function u(d){let _=d;return e&&(n.setAttribute("href",_),_=n.href),n.setAttribute("href",_),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}return a=u(window.location.href),function(_){const l=Ye.isString(_)?u(_):_;return l.protocol===a.protocol&&l.host===a.host}}():function(){return function(){return!0}}(),Vj=vo.hasStandardBrowserEnv?{write(t,e,n,a,u,d){const _=[t+"="+encodeURIComponent(e)];Ye.isNumber(n)&&_.push("expires="+new Date(n).toGMTString()),Ye.isString(a)&&_.push("path="+a),Ye.isString(u)&&_.push("domain="+u),d===!0&&_.push("secure"),document.cookie=_.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function $j(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function Wj(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function UR(t,e){return t&&!$j(e)?Wj(t,e):e}const Xk=t=>t instanceof qa?{...t}:t;function Ru(t,e){e=e||{};const n={};function a(T,C,P){return Ye.isPlainObject(T)&&Ye.isPlainObject(C)?Ye.merge.call({caseless:P},T,C):Ye.isPlainObject(C)?Ye.merge({},C):Ye.isArray(C)?C.slice():C}function u(T,C,P){if(Ye.isUndefined(C)){if(!Ye.isUndefined(T))return a(void 0,T,P)}else return a(T,C,P)}function d(T,C){if(!Ye.isUndefined(C))return a(void 0,C)}function _(T,C){if(Ye.isUndefined(C)){if(!Ye.isUndefined(T))return a(void 0,T)}else return a(void 0,C)}function l(T,C,P){if(P in e)return a(T,C);if(P in t)return a(void 0,T)}const w={url:d,method:d,data:d,baseURL:_,transformRequest:_,transformResponse:_,paramsSerializer:_,timeout:_,timeoutMessage:_,withCredentials:_,withXSRFToken:_,adapter:_,responseType:_,xsrfCookieName:_,xsrfHeaderName:_,onUploadProgress:_,onDownloadProgress:_,decompress:_,maxContentLength:_,maxBodyLength:_,beforeRedirect:_,transport:_,httpAgent:_,httpsAgent:_,cancelToken:_,socketPath:_,responseEncoding:_,validateStatus:l,headers:(T,C)=>u(Xk(T),Xk(C),!0)};return Ye.forEach(Object.keys(Object.assign({},t,e)),function(C){const P=w[C]||u,z=P(t[C],e[C],C);Ye.isUndefined(z)&&P!==l||(n[C]=z)}),n}const jR=t=>{const e=Ru({},t);let{data:n,withXSRFToken:a,xsrfHeaderName:u,xsrfCookieName:d,headers:_,auth:l}=e;e.headers=_=qa.from(_),e.url=OR(UR(e.baseURL,e.url),t.params,t.paramsSerializer),l&&_.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):"")));let w;if(Ye.isFormData(n)){if(vo.hasStandardBrowserEnv||vo.hasStandardBrowserWebWorkerEnv)_.setContentType(void 0);else if((w=_.getContentType())!==!1){const[T,...C]=w?w.split(";").map(P=>P.trim()).filter(Boolean):[];_.setContentType([T||"multipart/form-data",...C].join("; "))}}if(vo.hasStandardBrowserEnv&&(a&&Ye.isFunction(a)&&(a=a(e)),a||a!==!1&&jj(e.url))){const T=u&&d&&Vj.read(d);T&&_.set(u,T)}return e},Gj=typeof XMLHttpRequest<"u",Hj=Gj&&function(t){return new Promise(function(n,a){const u=jR(t);let d=u.data;const _=qa.from(u.headers).normalize();let{responseType:l,onUploadProgress:w,onDownloadProgress:T}=u,C,P,z,W,U;function j(){W&&W(),U&&U(),u.cancelToken&&u.cancelToken.unsubscribe(C),u.signal&&u.signal.removeEventListener("abort",C)}let L=new XMLHttpRequest;L.open(u.method.toUpperCase(),u.url,!0),L.timeout=u.timeout;function V(){if(!L)return;const F=qa.from("getAllResponseHeaders"in L&&L.getAllResponseHeaders()),Q={data:!l||l==="text"||l==="json"?L.responseText:L.response,status:L.status,statusText:L.statusText,headers:F,config:t,request:L};NR(function(se){n(se),j()},function(se){a(se),j()},Q),L=null}"onloadend"in L?L.onloadend=V:L.onreadystatechange=function(){!L||L.readyState!==4||L.status===0&&!(L.responseURL&&L.responseURL.indexOf("file:")===0)||setTimeout(V)},L.onabort=function(){L&&(a(new ar("Request aborted",ar.ECONNABORTED,t,L)),L=null)},L.onerror=function(){a(new ar("Network Error",ar.ERR_NETWORK,t,L)),L=null},L.ontimeout=function(){let H=u.timeout?"timeout of "+u.timeout+"ms exceeded":"timeout exceeded";const Q=u.transitional||FR;u.timeoutErrorMessage&&(H=u.timeoutErrorMessage),a(new ar(H,Q.clarifyTimeoutError?ar.ETIMEDOUT:ar.ECONNABORTED,t,L)),L=null},d===void 0&&_.setContentType(null),"setRequestHeader"in L&&Ye.forEach(_.toJSON(),function(H,Q){L.setRequestHeader(Q,H)}),Ye.isUndefined(u.withCredentials)||(L.withCredentials=!!u.withCredentials),l&&l!=="json"&&(L.responseType=u.responseType),T&&([z,U]=A_(T,!0),L.addEventListener("progress",z)),w&&L.upload&&([P,W]=A_(w),L.upload.addEventListener("progress",P),L.upload.addEventListener("loadend",W)),(u.cancelToken||u.signal)&&(C=F=>{L&&(a(!F||F.type?new Ld(null,t,L):F),L.abort(),L=null)},u.cancelToken&&u.cancelToken.subscribe(C),u.signal&&(u.signal.aborted?C():u.signal.addEventListener("abort",C)));const R=Bj(u.url);if(R&&vo.protocols.indexOf(R)===-1){a(new ar("Unsupported protocol "+R+":",ar.ERR_BAD_REQUEST,t));return}L.send(d||null)})},qj=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let a=new AbortController,u;const d=function(T){if(!u){u=!0,l();const C=T instanceof Error?T:this.reason;a.abort(C instanceof ar?C:new Ld(C instanceof Error?C.message:C))}};let _=e&&setTimeout(()=>{_=null,d(new ar(`timeout ${e} of ms exceeded`,ar.ETIMEDOUT))},e);const l=()=>{t&&(_&&clearTimeout(_),_=null,t.forEach(T=>{T.unsubscribe?T.unsubscribe(d):T.removeEventListener("abort",d)}),t=null)};t.forEach(T=>T.addEventListener("abort",d));const{signal:w}=a;return w.unsubscribe=()=>Ye.asap(l),w}},Zj=qj,Kj=function*(t,e){let n=t.byteLength;if(!e||n{const u=Xj(t,e);let d=0,_,l=w=>{_||(_=!0,a&&a(w))};return new ReadableStream({async pull(w){try{const{done:T,value:C}=await u.next();if(T){l(),w.close();return}let P=C.byteLength;if(n){let z=d+=P;n(z)}w.enqueue(new Uint8Array(C))}catch(T){throw l(T),T}},cancel(w){return l(w),u.return()}},{highWaterMark:2})},ov=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",VR=ov&&typeof ReadableStream=="function",Qj=ov&&(typeof TextEncoder=="function"?(t=>e=>t.encode(e))(new TextEncoder):async t=>new Uint8Array(await new Response(t).arrayBuffer())),$R=(t,...e)=>{try{return!!t(...e)}catch{return!1}},Jj=VR&&$R(()=>{let t=!1;const e=new Request(vo.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),Qk=64*1024,RE=VR&&$R(()=>Ye.isReadableStream(new Response("").body)),I_={stream:RE&&(t=>t.body)};ov&&(t=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!I_[e]&&(I_[e]=Ye.isFunction(t[e])?n=>n[e]():(n,a)=>{throw new ar(`Response type '${e}' is not supported`,ar.ERR_NOT_SUPPORT,a)})})})(new Response);const eV=async t=>{if(t==null)return 0;if(Ye.isBlob(t))return t.size;if(Ye.isSpecCompliantForm(t))return(await new Request(vo.origin,{method:"POST",body:t}).arrayBuffer()).byteLength;if(Ye.isArrayBufferView(t)||Ye.isArrayBuffer(t))return t.byteLength;if(Ye.isURLSearchParams(t)&&(t=t+""),Ye.isString(t))return(await Qj(t)).byteLength},tV=async(t,e)=>{const n=Ye.toFiniteNumber(t.getContentLength());return n??eV(e)},rV=ov&&(async t=>{let{url:e,method:n,data:a,signal:u,cancelToken:d,timeout:_,onDownloadProgress:l,onUploadProgress:w,responseType:T,headers:C,withCredentials:P="same-origin",fetchOptions:z}=jR(t);T=T?(T+"").toLowerCase():"text";let W=Zj([u,d&&d.toAbortSignal()],_),U;const j=W&&W.unsubscribe&&(()=>{W.unsubscribe()});let L;try{if(w&&Jj&&n!=="get"&&n!=="head"&&(L=await tV(C,a))!==0){let Q=new Request(e,{method:"POST",body:a,duplex:"half"}),te;if(Ye.isFormData(a)&&(te=Q.headers.get("content-type"))&&C.setContentType(te),Q.body){const[se,ge]=Zk(L,A_(Kk(w)));a=Yk(Q.body,Qk,se,ge)}}Ye.isString(P)||(P=P?"include":"omit");const V="credentials"in Request.prototype;U=new Request(e,{...z,signal:W,method:n.toUpperCase(),headers:C.normalize().toJSON(),body:a,duplex:"half",credentials:V?P:void 0});let R=await fetch(U);const F=RE&&(T==="stream"||T==="response");if(RE&&(l||F&&j)){const Q={};["status","statusText","headers"].forEach(xe=>{Q[xe]=R[xe]});const te=Ye.toFiniteNumber(R.headers.get("content-length")),[se,ge]=l&&Zk(te,A_(Kk(l),!0))||[];R=new Response(Yk(R.body,Qk,se,()=>{ge&&ge(),j&&j()}),Q)}T=T||"text";let H=await I_[Ye.findKey(I_,T)||"text"](R,t);return!F&&j&&j(),await new Promise((Q,te)=>{NR(Q,te,{data:H,headers:qa.from(R.headers),status:R.status,statusText:R.statusText,config:t,request:U})})}catch(V){throw j&&j(),V&&V.name==="TypeError"&&/fetch/i.test(V.message)?Object.assign(new ar("Network Error",ar.ERR_NETWORK,t,U),{cause:V.cause||V}):ar.from(V,V&&V.code,t,U)}}),OE={http:mj,xhr:Hj,fetch:rV};Ye.forEach(OE,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const Jk=t=>`- ${t}`,nV=t=>Ye.isFunction(t)||t===null||t===!1,WR={getAdapter:t=>{t=Ye.isArray(t)?t:[t];const{length:e}=t;let n,a;const u={};for(let d=0;d`adapter ${l} `+(w===!1?"is not supported by the environment":"is not available in the build"));let _=e?d.length>1?`since : +`+d.map(Jk).join(` +`):" "+Jk(d[0]):"as no adapter specified";throw new ar("There is no suitable adapter to dispatch the request "+_,"ERR_NOT_SUPPORT")}return a},adapters:OE};function ib(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Ld(null,t)}function eP(t){return ib(t),t.headers=qa.from(t.headers),t.data=nb.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),WR.getAdapter(t.adapter||rT.adapter)(t).then(function(a){return ib(t),a.data=nb.call(t,t.transformResponse,a),a.headers=qa.from(a.headers),a},function(a){return BR(a)||(ib(t),a&&a.response&&(a.response.data=nb.call(t,t.transformResponse,a.response),a.response.headers=qa.from(a.response.headers))),Promise.reject(a)})}const GR="1.7.7",nT={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{nT[t]=function(a){return typeof a===t||"a"+(e<1?"n ":" ")+t}});const tP={};nT.transitional=function(e,n,a){function u(d,_){return"[Axios v"+GR+"] Transitional option '"+d+"'"+_+(a?". "+a:"")}return(d,_,l)=>{if(e===!1)throw new ar(u(_," has been removed"+(n?" in "+n:"")),ar.ERR_DEPRECATED);return n&&!tP[_]&&(tP[_]=!0,console.warn(u(_," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(d,_,l):!0}};function iV(t,e,n){if(typeof t!="object")throw new ar("options must be an object",ar.ERR_BAD_OPTION_VALUE);const a=Object.keys(t);let u=a.length;for(;u-- >0;){const d=a[u],_=e[d];if(_){const l=t[d],w=l===void 0||_(l,d,t);if(w!==!0)throw new ar("option "+d+" must be "+w,ar.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new ar("Unknown option "+d,ar.ERR_BAD_OPTION)}}const FE={assertOptions:iV,validators:nT},Hl=FE.validators;class C_{constructor(e){this.defaults=e,this.interceptors={request:new Hk,response:new Hk}}async request(e,n){try{return await this._request(e,n)}catch(a){if(a instanceof Error){let u;Error.captureStackTrace?Error.captureStackTrace(u={}):u=new Error;const d=u.stack?u.stack.replace(/^.+\n/,""):"";try{a.stack?d&&!String(a.stack).endsWith(d.replace(/^.+\n.+\n/,""))&&(a.stack+=` +`+d):a.stack=d}catch{}}throw a}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=Ru(this.defaults,n);const{transitional:a,paramsSerializer:u,headers:d}=n;a!==void 0&&FE.assertOptions(a,{silentJSONParsing:Hl.transitional(Hl.boolean),forcedJSONParsing:Hl.transitional(Hl.boolean),clarifyTimeoutError:Hl.transitional(Hl.boolean)},!1),u!=null&&(Ye.isFunction(u)?n.paramsSerializer={serialize:u}:FE.assertOptions(u,{encode:Hl.function,serialize:Hl.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let _=d&&Ye.merge(d.common,d[n.method]);d&&Ye.forEach(["delete","get","head","post","put","patch","common"],U=>{delete d[U]}),n.headers=qa.concat(_,d);const l=[];let w=!0;this.interceptors.request.forEach(function(j){typeof j.runWhen=="function"&&j.runWhen(n)===!1||(w=w&&j.synchronous,l.unshift(j.fulfilled,j.rejected))});const T=[];this.interceptors.response.forEach(function(j){T.push(j.fulfilled,j.rejected)});let C,P=0,z;if(!w){const U=[eP.bind(this),void 0];for(U.unshift.apply(U,l),U.push.apply(U,T),z=U.length,C=Promise.resolve(n);P{if(!a._listeners)return;let d=a._listeners.length;for(;d-- >0;)a._listeners[d](u);a._listeners=null}),this.promise.then=u=>{let d;const _=new Promise(l=>{a.subscribe(l),d=l}).then(u);return _.cancel=function(){a.unsubscribe(d)},_},e(function(d,_,l){a.reason||(a.reason=new Ld(d,_,l),n(a.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const e=new AbortController,n=a=>{e.abort(a)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new iT(function(u){e=u}),cancel:e}}}const oV=iT;function aV(t){return function(n){return t.apply(null,n)}}function sV(t){return Ye.isObject(t)&&t.isAxiosError===!0}const LE={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(LE).forEach(([t,e])=>{LE[e]=t});const lV=LE;function HR(t){const e=new Ky(t),n=ER(Ky.prototype.request,e);return Ye.extend(n,Ky.prototype,e,{allOwnKeys:!0}),Ye.extend(n,e,null,{allOwnKeys:!0}),n.create=function(u){return HR(Ru(t,u))},n}const Xn=HR(rT);Xn.Axios=Ky;Xn.CanceledError=Ld;Xn.CancelToken=oV;Xn.isCancel=BR;Xn.VERSION=GR;Xn.toFormData=nv;Xn.AxiosError=ar;Xn.Cancel=Xn.CanceledError;Xn.all=function(e){return Promise.all(e)};Xn.spread=aV;Xn.isAxiosError=sV;Xn.mergeConfig=Ru;Xn.AxiosHeaders=qa;Xn.formToJSON=t=>LR(Ye.isHTMLForm(t)?new FormData(t):t);Xn.getAdapter=WR.getAdapter;Xn.HttpStatusCode=lV;Xn.default=Xn;const cV=Xn;/* + * Frontend UI component library for the CORI Data API + * {@link https://github.com/ruralinnovation/cori.data.api} + * @copyright Rural Innovation Strategies, Inc. + * @license ISC + */const dd="https://cori-data-api.ruralinnovation.us/",BE=cV.create({baseURL:dd,headers:{"Content-Type":"application/json"}}),ob={},qR={apiClient:BE,authenticated:!1,authenticated_user:null,autoSignOut:null,baseURL:dd,token:null,data:{get:()=>ob,set:t=>{for(const e in t)t.hasOwnProperty[e]&&(ob[e]=t)}},setData:t=>{for(const e in t)t.hasOwnProperty[e]&&(ob[e]=t)}},ZR=St.createContext(qR);let qg=!1,rP=!1;function uV(t){const[e,n]=St.useState(Object.assign(Object.assign({},qR),{baseURL:t.baseURL?t.baseURL:dd,setData:a}));function a(u){const d=e;n(Object.assign(Object.assign({},d),{data:Object.assign(Object.assign({},d.data),u),setData:a}))}return t.baseURL&&t.baseURL.length>0&&BE.interceptors.request.use(u=>(u.baseURL=t.baseURL,console.log("API baseURL updated:",u.baseURL),u),u=>Promise.reject(u)),St.useEffect(()=>{if(n(Object.assign(Object.assign({},e),{autoSignOut:t.signOut&&typeof t.signOut=="function"?()=>{const{signOut:u}=t;u(),window.alert("Please refresh this session by clicking the browser's reload button!"),window.location=window.location.protocol+"//"+window.location.host+window.location.pathname}:null,baseURL:t.baseURL?t.baseURL:dd})),t.fetchAuthSession){const{fetchAuthSession:u}=t;u().then(_=>{if(!qg){const l=_.tokens;if(console.log("API tokens:",l),l&&l.hasOwnProperty("idToken")&&(qg=!0,console.log("API Session is authenticated:",qg),console.log("API Session config:",_),console.log("idToken:",l.idToken),BE.interceptors.request.use(w=>{const T=l.idToken;return T&&(w.headers.Authorization=`Bearer ${T}`),t.baseURL&&(w.baseURL=t.baseURL),w},w=>Promise.reject(w)),n(Object.assign(Object.assign({},e),{authenticated:!0,autoSignOut:t.signOut&&typeof t.signOut=="function"?()=>{const{signOut:w}=t;w(),window.alert("Please refresh this session by clicking the browser's reload button!"),window.location=window.location.protocol+"//"+window.location.host+window.location.pathname}:null,baseURL:t.baseURL||dd,token:l.idToken})),t.getCurrentUser)){const{getCurrentUser:w}=t;w().then(C=>{rP||(rP=!0,console.log("API User is authenticated:",qg),console.log("API User:",C),console.log("API User type:",C.constructor.name),n(Object.assign(Object.assign({},e),{authenticated:!0,authenticated_user:C,autoSignOut:t.signOut&&typeof t.signOut=="function"?()=>{const{signOut:P}=t;P(),window.alert("Please refresh this session by clicking the browser's reload button!"),window.location=window.location.protocol+"//"+window.location.host+window.location.pathname}:null,baseURL:t.baseURL||dd,token:l.idToken})))})}}})}},[]),C1.createElement(C1.Fragment,null,C1.createElement(ZR.Provider,{value:e},t.children))}const hV="modulepreload",dV=function(t){return"/"+t},nP={},pV=function(e,n,a){if(!n||n.length===0)return e();const u=document.getElementsByTagName("link");return Promise.all(n.map(d=>{if(d=dV(d),d in nP)return;nP[d]=!0;const _=d.endsWith(".css"),l=_?'[rel="stylesheet"]':"";if(!!a)for(let C=u.length-1;C>=0;C--){const P=u[C];if(P.href===d&&(!_||P.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${d}"]${l}`))return;const T=document.createElement("link");if(T.rel=_?"stylesheet":hV,_||(T.as="script",T.crossOrigin=""),T.href=d,document.head.appendChild(T),_)return new Promise((C,P)=>{T.addEventListener("load",C),T.addEventListener("error",()=>P(new Error(`Unable to preload CSS for ${d}`)))})})).then(()=>e()).catch(d=>{const _=new Event("vite:preloadError",{cancelable:!0});if(_.payload=d,window.dispatchEvent(_),!_.defaultPrevented)throw d})},fV=St.createContext(null);function mV(t,e){const n=Array.isArray(t)?t[0]:t?t.x:0,a=Array.isArray(t)?t[1]:t?t.y:0,u=Array.isArray(e)?e[0]:e?e.x:0,d=Array.isArray(e)?e[1]:e?e.y:0;return n===u&&a===d}function nl(t,e){if(t===e)return!0;if(!t||!e)return!1;if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let n=0;n{let u=null;"interactive"in a&&(u=Object.assign({},a),delete u.interactive);const d=e[a.ref];if(d){u=u||Object.assign({},a),delete u.ref;for(const _ of yV)_ in d&&(u[_]=d[_])}return u||a});return{...t,layers:n}}const lP={version:8,sources:{},layers:[]},cP={mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",click:"onClick",dblclick:"onDblClick",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mouseout:"onMouseOut",contextmenu:"onContextMenu",touchstart:"onTouchStart",touchend:"onTouchEnd",touchmove:"onTouchMove",touchcancel:"onTouchCancel"},ab={movestart:"onMoveStart",move:"onMove",moveend:"onMoveEnd",dragstart:"onDragStart",drag:"onDrag",dragend:"onDragEnd",zoomstart:"onZoomStart",zoom:"onZoom",zoomend:"onZoomEnd",rotatestart:"onRotateStart",rotate:"onRotate",rotateend:"onRotateEnd",pitchstart:"onPitchStart",pitch:"onPitch",pitchend:"onPitchEnd"},uP={wheel:"onWheel",boxzoomstart:"onBoxZoomStart",boxzoomend:"onBoxZoomEnd",boxzoomcancel:"onBoxZoomCancel",resize:"onResize",load:"onLoad",render:"onRender",idle:"onIdle",remove:"onRemove",data:"onData",styledata:"onStyleData",sourcedata:"onSourceData",error:"onError"},_V=["minZoom","maxZoom","minPitch","maxPitch","maxBounds","projection","renderWorldCopies"],vV=["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate","touchPitch"];class Pd{constructor(e,n,a){this._map=null,this._internalUpdate=!1,this._inRender=!1,this._hoveredFeatures=null,this._deferredEvents={move:!1,zoom:!1,pitch:!1,rotate:!1},this._onEvent=u=>{const d=this.props[uP[u.type]];d?d(u):u.type==="error"&&console.error(u.error)},this._onPointerEvent=u=>{(u.type==="mousemove"||u.type==="mouseout")&&this._updateHover(u);const d=this.props[cP[u.type]];d&&(this.props.interactiveLayerIds&&u.type!=="mouseover"&&u.type!=="mouseout"&&(u.features=this._hoveredFeatures||this._queryRenderedFeatures(u.point)),d(u),delete u.features)},this._onCameraEvent=u=>{if(!this._internalUpdate){const d=this.props[ab[u.type]];d&&d(u)}u.type in this._deferredEvents&&(this._deferredEvents[u.type]=!1)},this._MapClass=e,this.props=n,this._initialize(a)}get map(){return this._map}get transform(){return this._renderTransform}setProps(e){const n=this.props;this.props=e;const a=this._updateSettings(e,n);a&&this._createShadowTransform(this._map);const u=this._updateSize(e),d=this._updateViewState(e,!0);this._updateStyle(e,n),this._updateStyleComponents(e,n),this._updateHandlers(e,n),(a||u||d&&!this._map.isMoving())&&this.redraw()}static reuse(e,n){const a=Pd.savedMaps.pop();if(!a)return null;const u=a.map,d=u.getContainer();for(n.className=d.className;d.childNodes.length>0;)n.appendChild(d.childNodes[0]);u._container=n;const _=u._resizeObserver;_&&(_.disconnect(),_.observe(n)),a.setProps({...e,styleDiffing:!1}),u.resize();const{initialViewState:l}=e;return l&&(l.bounds?u.fitBounds(l.bounds,{...l.fitBoundsOptions,duration:0}):a._updateViewState(l,!1)),u.isStyleLoaded()?u.fire("load"):u.once("styledata",()=>u.fire("load")),u._update(),a}_initialize(e){const{props:n}=this,{mapStyle:a=lP}=n,u={...n,...n.initialViewState,accessToken:n.mapboxAccessToken||xV()||null,container:e,style:sP(a)},d=u.initialViewState||u.viewState||u;if(Object.assign(u,{center:[d.longitude||0,d.latitude||0],zoom:d.zoom||0,pitch:d.pitch||0,bearing:d.bearing||0}),n.gl){const C=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=()=>(HTMLCanvasElement.prototype.getContext=C,n.gl)}const _=new this._MapClass(u);d.padding&&_.setPadding(d.padding),n.cursor&&(_.getCanvas().style.cursor=n.cursor),this._createShadowTransform(_);const l=_._render;_._render=C=>{this._inRender=!0,l.call(_,C),this._inRender=!1};const w=_._renderTaskQueue.run;_._renderTaskQueue.run=C=>{w.call(_._renderTaskQueue,C),this._onBeforeRepaint()},_.on("render",()=>this._onAfterRepaint());const T=_.fire;_.fire=this._fireEvent.bind(this,T),_.on("resize",()=>{this._renderTransform.resize(_.transform.width,_.transform.height)}),_.on("styledata",()=>{this._updateStyleComponents(this.props,{}),iP(_.transform,this._renderTransform)}),_.on("sourcedata",()=>this._updateStyleComponents(this.props,{}));for(const C in cP)_.on(C,this._onPointerEvent);for(const C in ab)_.on(C,this._onCameraEvent);for(const C in uP)_.on(C,this._onEvent);this._map=_}recycle(){const n=this.map.getContainer().querySelector("[mapboxgl-children]");n==null||n.remove(),Pd.savedMaps.push(this)}destroy(){this._map.remove()}redraw(){const e=this._map;!this._inRender&&e.style&&(e._frame&&(e._frame.cancel(),e._frame=null),e._render())}_createShadowTransform(e){const n=gV(e.transform);e.painter.transform=n,this._renderTransform=n}_updateSize(e){const{viewState:n}=e;if(n){const a=this._map;if(n.width!==a.transform.width||n.height!==a.transform.height)return a.resize(),!0}return!1}_updateViewState(e,n){if(this._internalUpdate)return!1;const a=this._map,u=this._renderTransform,{zoom:d,pitch:_,bearing:l}=u,w=a.isMoving();w&&(u.cameraElevationReference="sea");const T=aP(u,{...oP(a.transform),...e});if(w&&(u.cameraElevationReference="ground"),T&&n){const C=this._deferredEvents;C.move=!0,C.zoom||(C.zoom=d!==u.zoom),C.rotate||(C.rotate=l!==u.bearing),C.pitch||(C.pitch=_!==u.pitch)}return w||aP(a.transform,e),T}_updateSettings(e,n){const a=this._map;let u=!1;for(const d of _V)if(d in e&&!nl(e[d],n[d])){u=!0;const _=a[`set${d[0].toUpperCase()}${d.slice(1)}`];_==null||_.call(a,e[d])}return u}_updateStyle(e,n){if(e.cursor!==n.cursor&&(this._map.getCanvas().style.cursor=e.cursor||""),e.mapStyle!==n.mapStyle){const{mapStyle:a=lP,styleDiffing:u=!0}=e,d={diff:u};return"localIdeographFontFamily"in e&&(d.localIdeographFontFamily=e.localIdeographFontFamily),this._map.setStyle(sP(a),d),!0}return!1}_updateStyleComponents(e,n){const a=this._map;let u=!1;return a.isStyleLoaded()&&("light"in e&&a.setLight&&!nl(e.light,n.light)&&(u=!0,a.setLight(e.light)),"fog"in e&&a.setFog&&!nl(e.fog,n.fog)&&(u=!0,a.setFog(e.fog)),"terrain"in e&&a.setTerrain&&!nl(e.terrain,n.terrain)&&(!e.terrain||a.getSource(e.terrain.source))&&(u=!0,a.setTerrain(e.terrain))),u}_updateHandlers(e,n){var a,u;const d=this._map;let _=!1;for(const l of vV){const w=(a=e[l])!==null&&a!==void 0?a:!0,T=(u=n[l])!==null&&u!==void 0?u:!0;nl(w,T)||(_=!0,w?d[l].enable(w):d[l].disable())}return _}_queryRenderedFeatures(e){const n=this._map,a=n.transform,{interactiveLayerIds:u=[]}=this.props;try{return n.transform=this._renderTransform,n.queryRenderedFeatures(e,{layers:u.filter(n.getLayer.bind(n))})}catch{return[]}finally{n.transform=a}}_updateHover(e){var n;const{props:a}=this;if(a.interactiveLayerIds&&(a.onMouseMove||a.onMouseEnter||a.onMouseLeave)){const d=e.type,_=((n=this._hoveredFeatures)===null||n===void 0?void 0:n.length)>0,l=this._queryRenderedFeatures(e.point),w=l.length>0;!w&&_&&(e.type="mouseleave",this._onPointerEvent(e)),this._hoveredFeatures=l,w&&!_&&(e.type="mouseenter",this._onPointerEvent(e)),e.type=d}else this._hoveredFeatures=null}_fireEvent(e,n,a){const u=this._map,d=u.transform,_=typeof n=="string"?n:n.type;return _==="move"&&this._updateViewState(this.props,!1),_ in ab&&(typeof n=="object"&&(n.viewState=oP(d)),this._map.isMoving())?(u.transform=this._renderTransform,e.call(u,n,a),u.transform=d,u):(e.call(u,n,a),u)}_onBeforeRepaint(){const e=this._map;this._internalUpdate=!0;for(const a in this._deferredEvents)this._deferredEvents[a]&&e.fire(a);this._internalUpdate=!1;const n=this._map.transform;e.transform=this._renderTransform,this._onAfterRepaint=()=>{iP(this._renderTransform,n),e.transform=n}}}Pd.savedMaps=[];function xV(){let t=null;if(typeof location<"u"){const e=/access_token=([^&\/]*)/.exec(location.search);t=e&&e[1]}try{t=t||void 0}catch{}try{t=t||{}.REACT_APP_MAPBOX_ACCESS_TOKEN}catch{}return t}const bV=["setMaxBounds","setMinZoom","setMaxZoom","setMinPitch","setMaxPitch","setRenderWorldCopies","setProjection","setStyle","addSource","removeSource","addLayer","removeLayer","setLayerZoomRange","setFilter","setPaintProperty","setLayoutProperty","setLight","setTerrain","setFog","remove"];function wV(t){if(!t)return null;const e=t.map,n={getMap:()=>e,getCenter:()=>t.transform.center,getZoom:()=>t.transform.zoom,getBearing:()=>t.transform.bearing,getPitch:()=>t.transform.pitch,getPadding:()=>t.transform.padding,getBounds:()=>t.transform.getBounds(),project:a=>{const u=e.transform;e.transform=t.transform;const d=e.project(a);return e.transform=u,d},unproject:a=>{const u=e.transform;e.transform=t.transform;const d=e.unproject(a);return e.transform=u,d},queryTerrainElevation:(a,u)=>{const d=e.transform;e.transform=t.transform;const _=e.queryTerrainElevation(a,u);return e.transform=d,_},queryRenderedFeatures:(a,u)=>{const d=e.transform;e.transform=t.transform;const _=e.queryRenderedFeatures(a,u);return e.transform=d,_}};for(const a of EV(e))!(a in n)&&!bV.includes(a)&&(n[a]=e[a].bind(e));return n}function EV(t){const e=new Set;let n=t;for(;n;){for(const a of Object.getOwnPropertyNames(n))a[0]!=="_"&&typeof t[a]=="function"&&a!=="fire"&&a!=="setEventedParent"&&e.add(a);n=Object.getPrototypeOf(n)}return Array.from(e)}const SV=typeof document<"u"?St.useLayoutEffect:St.useEffect,TV=["baseApiUrl","maxParallelImageRequests","workerClass","workerCount","workerUrl"];function AV(t,e){for(const a of TV)a in e&&(t[a]=e[a]);const{RTLTextPlugin:n="https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.js"}=e;n&&t.getRTLTextPluginStatus&&t.getRTLTextPluginStatus()==="unavailable"&&t.setRTLTextPlugin(n,a=>{a&&console.error(a)},!0)}const av=St.createContext(null);function IV(t,e,n){const a=St.useContext(fV),[u,d]=St.useState(null),_=St.useRef(),{current:l}=St.useRef({mapLib:null,map:null});St.useEffect(()=>{const C=t.mapLib;let P=!0,z;return Promise.resolve(C||n).then(W=>{if(!P)return;if(!W)throw new Error("Invalid mapLib");const U="Map"in W?W:W.default;if(!U.Map)throw new Error("Invalid mapLib");if(AV(U,t),!U.supported||U.supported(t))t.reuseMaps&&(z=Pd.reuse(t,_.current)),z||(z=new Pd(U.Map,t,_.current)),l.map=wV(z),l.mapLib=U,d(z),a==null||a.onMapMount(l.map,t.id);else throw new Error("Map is not supported by this browser")}).catch(W=>{const{onError:U}=t;U?U({type:"error",target:null,originalEvent:null,error:W}):console.error(W)}),()=>{P=!1,z&&(a==null||a.onMapUnmount(t.id),t.reuseMaps?z.recycle():z.destroy())}},[]),SV(()=>{u&&u.setProps(t)}),St.useImperativeHandle(e,()=>l.map,[u]);const w=St.useMemo(()=>({position:"relative",width:"100%",height:"100%",...t.style}),[t.style]),T={height:"100%"};return St.createElement("div",{id:t.id,ref:_,style:w},u&&St.createElement(av.Provider,{value:l},St.createElement("div",{"mapboxgl-children":"",style:T},t.children)))}const CV=/box|flex|grid|column|lineHeight|fontWeight|opacity|order|tabSize|zIndex/;function Lu(t,e){if(!t||!e)return;const n=t.style;for(const a in e){const u=e[a];Number.isFinite(u)&&!CV.test(a)?n[a]=`${u}px`:n[a]=u}}function kV(t,e){const{map:n,mapLib:a}=St.useContext(av),u=St.useRef({props:t});u.current.props=t;const d=St.useMemo(()=>{let j=!1;St.Children.forEach(t.children,R=>{R&&(j=!0)});const L={...t,element:j?document.createElement("div"):null},V=new a.Marker(L);return V.setLngLat([t.longitude,t.latitude]),V.getElement().addEventListener("click",R=>{var F,H;(H=(F=u.current.props).onClick)===null||H===void 0||H.call(F,{type:"click",target:V,originalEvent:R})}),V.on("dragstart",R=>{var F,H;const Q=R;Q.lngLat=d.getLngLat(),(H=(F=u.current.props).onDragStart)===null||H===void 0||H.call(F,Q)}),V.on("drag",R=>{var F,H;const Q=R;Q.lngLat=d.getLngLat(),(H=(F=u.current.props).onDrag)===null||H===void 0||H.call(F,Q)}),V.on("dragend",R=>{var F,H;const Q=R;Q.lngLat=d.getLngLat(),(H=(F=u.current.props).onDragEnd)===null||H===void 0||H.call(F,Q)}),V},[]);St.useEffect(()=>(d.addTo(n.getMap()),()=>{d.remove()}),[]);const{longitude:_,latitude:l,offset:w,style:T,draggable:C=!1,popup:P=null,rotation:z=0,rotationAlignment:W="auto",pitchAlignment:U="auto"}=t;return St.useEffect(()=>{Lu(d.getElement(),T)},[T]),St.useImperativeHandle(e,()=>d,[]),(d.getLngLat().lng!==_||d.getLngLat().lat!==l)&&d.setLngLat([_,l]),w&&!mV(d.getOffset(),w)&&d.setOffset(w),d.isDraggable()!==C&&d.setDraggable(C),d.getRotation()!==z&&d.setRotation(z),d.getRotationAlignment()!==W&&d.setRotationAlignment(W),d.getPitchAlignment()!==U&&d.setPitchAlignment(U),d.getPopup()!==P&&d.setPopup(P),GS.createPortal(t.children,d.getElement())}const PV=St.memo(St.forwardRef(kV));function hP(t){return new Set(t?t.trim().split(/\s+/):[])}function DV(t,e){const{map:n,mapLib:a}=St.useContext(av),u=St.useMemo(()=>document.createElement("div"),[]),d=St.useRef({props:t});d.current.props=t;const _=St.useMemo(()=>{const l={...t},w=new a.Popup(l);return w.setLngLat([t.longitude,t.latitude]),w.once("open",T=>{var C,P;(P=(C=d.current.props).onOpen)===null||P===void 0||P.call(C,T)}),w},[]);if(St.useEffect(()=>{const l=w=>{var T,C;(C=(T=d.current.props).onClose)===null||C===void 0||C.call(T,w)};return _.on("close",l),_.setDOMContent(u).addTo(n.getMap()),()=>{_.off("close",l),_.isOpen()&&_.remove()}},[]),St.useEffect(()=>{Lu(_.getElement(),t.style)},[t.style]),St.useImperativeHandle(e,()=>_,[]),_.isOpen()&&((_.getLngLat().lng!==t.longitude||_.getLngLat().lat!==t.latitude)&&_.setLngLat([t.longitude,t.latitude]),t.offset&&!nl(_.options.offset,t.offset)&&_.setOffset(t.offset),(_.options.anchor!==t.anchor||_.options.maxWidth!==t.maxWidth)&&(_.options.anchor=t.anchor,_.setMaxWidth(t.maxWidth)),_.options.className!==t.className)){const l=hP(_.options.className),w=hP(t.className);for(const T of l)w.has(T)||_.removeClassName(T);for(const T of w)l.has(T)||_.addClassName(T);_.options.className=t.className}return GS.createPortal(t.children,u)}St.memo(St.forwardRef(DV));function Bd(t,e,n,a){const u=St.useContext(av),d=St.useMemo(()=>t(u),[]);return St.useEffect(()=>{const _=a||n||e,l=typeof e=="function"&&typeof n=="function"?e:null,w=typeof n=="function"?n:typeof e=="function"?e:null,{map:T}=u;return T.hasControl(d)||(T.addControl(d,_==null?void 0:_.position),l&&l(u)),()=>{w&&w(u),T.hasControl(d)&&T.removeControl(d)}},[]),d}function MV(t){const e=Bd(({mapLib:n})=>new n.AttributionControl(t),{position:t.position});return St.useEffect(()=>{Lu(e._container,t.style)},[t.style]),null}St.memo(MV);function zV(t){const e=Bd(({mapLib:n})=>new n.FullscreenControl({container:t.containerId&&document.getElementById(t.containerId)}),{position:t.position});return St.useEffect(()=>{Lu(e._controlContainer,t.style)},[t.style]),null}St.memo(zV);function RV(t,e){const n=St.useRef({props:t}),a=Bd(({mapLib:u})=>{const d=new u.GeolocateControl(t),_=d._setupUI;return d._setupUI=l=>{d._container.hasChildNodes()||_(l)},d.on("geolocate",l=>{var w,T;(T=(w=n.current.props).onGeolocate)===null||T===void 0||T.call(w,l)}),d.on("error",l=>{var w,T;(T=(w=n.current.props).onError)===null||T===void 0||T.call(w,l)}),d.on("outofmaxbounds",l=>{var w,T;(T=(w=n.current.props).onOutOfMaxBounds)===null||T===void 0||T.call(w,l)}),d.on("trackuserlocationstart",l=>{var w,T;(T=(w=n.current.props).onTrackUserLocationStart)===null||T===void 0||T.call(w,l)}),d.on("trackuserlocationend",l=>{var w,T;(T=(w=n.current.props).onTrackUserLocationEnd)===null||T===void 0||T.call(w,l)}),d},{position:t.position});return n.current.props=t,St.useImperativeHandle(e,()=>a,[]),St.useEffect(()=>{Lu(a._container,t.style)},[t.style]),null}const OV=St.memo(St.forwardRef(RV));function FV(t){const e=Bd(({mapLib:n})=>new n.NavigationControl(t),{position:t.position});return St.useEffect(()=>{Lu(e._container,t.style)},[t.style]),null}const LV=St.memo(FV);function BV(t){const e=Bd(({mapLib:d})=>new d.ScaleControl(t),{position:t.position}),n=St.useRef(t),a=n.current;n.current=t;const{style:u}=t;return t.maxWidth!==void 0&&t.maxWidth!==a.maxWidth&&(e.options.maxWidth=t.maxWidth),t.unit!==void 0&&t.unit!==a.unit&&e.setUnit(t.unit),St.useEffect(()=>{Lu(e._container,u)},[u]),null}const NV=St.memo(BV),UV=pV(()=>Promise.resolve().then(()=>_$),void 0),jV=(()=>St.forwardRef(function(e,n){return IV(e,n,UV)}))(),KR=PV,VV=LV,$V=OV,WV=NV;var Nd=HV,GV=Object.prototype.hasOwnProperty;function HV(){for(var t={},e=0;e-1};Gi.prototype.value=function(t){if(this.selected=t,this.el.value=this.getItemValue(t),document.createEvent){var e=document.createEvent("HTMLEvents");e.initEvent("change",!0,!1),this.el.dispatchEvent(e)}else this.el.fireEvent("onchange")};Gi.prototype.getCandidates=function(t){var e={pre:"",post:"",extract:(function(a){return this.getItemValue(a)}).bind(this)},n;this.options.filter?(n=XV.filter(this.query,this.data,e),n=n.map((function(a){return{original:a.original,string:this.render(a.original,a.string)}}).bind(this))):n=this.data.map((function(a){var u=this.render(a);return{original:a,string:u}}).bind(this)),t(n)};Gi.prototype.getItemValue=function(t){return t};Gi.prototype.render=function(t,e){if(e)return e;for(var n=t.original?this.getItemValue(t.original):this.getItemValue(t),a=this.normalize(n),u=a.lastIndexOf(this.query);u>-1;){var d=u+this.query.length;n=n.slice(0,u)+""+n.slice(u,d)+""+n.slice(d),u=a.slice(0,u).lastIndexOf(this.query)}return n};Gi.prototype.renderError=function(t){this.list.drawError(t)};var QV=Gi,YR=QV,JV=YR;typeof window<"u"&&(window.Suggestions=YR);var e7="Expected a function",dP=0/0,t7="[object Symbol]",r7=/^\s+|\s+$/g,n7=/^[-+]0x[0-9a-f]+$/i,i7=/^0b[01]+$/i,o7=/^0o[0-7]+$/i,a7=parseInt,s7=typeof $e=="object"&&$e&&$e.Object===Object&&$e,l7=typeof self=="object"&&self&&self.Object===Object&&self,c7=s7||l7||Function("return this")(),u7=Object.prototype,h7=u7.toString,d7=Math.max,p7=Math.min,sb=function(){return c7.Date.now()};function f7(t,e,n){var a,u,d,_,l,w,T=0,C=!1,P=!1,z=!0;if(typeof t!="function")throw new TypeError(e7);e=pP(e)||0,NE(n)&&(C=!!n.leading,P="maxWait"in n,d=P?d7(pP(n.maxWait)||0,e):d,z="trailing"in n?!!n.trailing:z);function W(te){var se=a,ge=u;return a=u=void 0,T=te,_=t.apply(ge,se),_}function U(te){return T=te,l=setTimeout(V,e),C?W(te):_}function j(te){var se=te-w,ge=te-T,xe=e-se;return P?p7(xe,d-ge):xe}function L(te){var se=te-w,ge=te-T;return w===void 0||se>=e||se<0||P&&ge>=d}function V(){var te=sb();if(L(te))return R(te);l=setTimeout(V,j(te))}function R(te){return l=void 0,z&&a?W(te):(a=u=void 0,_)}function F(){l!==void 0&&clearTimeout(l),T=0,a=w=u=l=void 0}function H(){return l===void 0?_:R(sb())}function Q(){var te=sb(),se=L(te);if(a=arguments,u=this,w=te,se){if(l===void 0)return U(w);if(P)return l=setTimeout(V,e),W(w)}return l===void 0&&(l=setTimeout(V,e)),_}return Q.cancel=F,Q.flush=H,Q}function NE(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function m7(t){return!!t&&typeof t=="object"}function g7(t){return typeof t=="symbol"||m7(t)&&h7.call(t)==t7}function pP(t){if(typeof t=="number")return t;if(g7(t))return dP;if(NE(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=NE(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=t.replace(r7,"");var n=i7.test(t);return n||o7.test(t)?a7(t.slice(2),n?2:8):n7.test(t)?dP:+t}var y7=f7,oT={exports:{}},bd=typeof Reflect=="object"?Reflect:null,fP=bd&&typeof bd.apply=="function"?bd.apply:function(e,n,a){return Function.prototype.apply.call(e,n,a)},Xy;bd&&typeof bd.ownKeys=="function"?Xy=bd.ownKeys:Object.getOwnPropertySymbols?Xy=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Xy=function(e){return Object.getOwnPropertyNames(e)};function _7(t){console&&console.warn&&console.warn(t)}var QR=Number.isNaN||function(e){return e!==e};function Jr(){Jr.init.call(this)}oT.exports=Jr;oT.exports.once=w7;Jr.EventEmitter=Jr;Jr.prototype._events=void 0;Jr.prototype._eventsCount=0;Jr.prototype._maxListeners=void 0;var mP=10;function sv(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(Jr,"defaultMaxListeners",{enumerable:!0,get:function(){return mP},set:function(t){if(typeof t!="number"||t<0||QR(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");mP=t}});Jr.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};Jr.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||QR(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function JR(t){return t._maxListeners===void 0?Jr.defaultMaxListeners:t._maxListeners}Jr.prototype.getMaxListeners=function(){return JR(this)};Jr.prototype.emit=function(e){for(var n=[],a=1;a0&&(_=n[0]),_ instanceof Error)throw _;var l=new Error("Unhandled error."+(_?" ("+_.message+")":""));throw l.context=_,l}var w=d[e];if(w===void 0)return!1;if(typeof w=="function")fP(w,this,n);else for(var T=w.length,C=i3(w,T),a=0;a0&&_.length>u&&!_.warned){_.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+_.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=t,l.type=e,l.count=_.length,_7(l)}return t}Jr.prototype.addListener=function(e,n){return e3(this,e,n,!1)};Jr.prototype.on=Jr.prototype.addListener;Jr.prototype.prependListener=function(e,n){return e3(this,e,n,!0)};function v7(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function t3(t,e,n){var a={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},u=v7.bind(a);return u.listener=n,a.wrapFn=u,u}Jr.prototype.once=function(e,n){return sv(n),this.on(e,t3(this,e,n)),this};Jr.prototype.prependOnceListener=function(e,n){return sv(n),this.prependListener(e,t3(this,e,n)),this};Jr.prototype.removeListener=function(e,n){var a,u,d,_,l;if(sv(n),u=this._events,u===void 0)return this;if(a=u[e],a===void 0)return this;if(a===n||a.listener===n)--this._eventsCount===0?this._events=Object.create(null):(delete u[e],u.removeListener&&this.emit("removeListener",e,a.listener||n));else if(typeof a!="function"){for(d=-1,_=a.length-1;_>=0;_--)if(a[_]===n||a[_].listener===n){l=a[_].listener,d=_;break}if(d<0)return this;d===0?a.shift():x7(a,d),a.length===1&&(u[e]=a[0]),u.removeListener!==void 0&&this.emit("removeListener",e,l||n)}return this};Jr.prototype.off=Jr.prototype.removeListener;Jr.prototype.removeAllListeners=function(e){var n,a,u;if(a=this._events,a===void 0)return this;if(a.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):a[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete a[e]),this;if(arguments.length===0){var d=Object.keys(a),_;for(u=0;u=0;u--)this.removeListener(e,n[u]);return this};function r3(t,e,n){var a=t._events;if(a===void 0)return[];var u=a[e];return u===void 0?[]:typeof u=="function"?n?[u.listener||u]:[u]:n?b7(u):i3(u,u.length)}Jr.prototype.listeners=function(e){return r3(this,e,!0)};Jr.prototype.rawListeners=function(e){return r3(this,e,!1)};Jr.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):n3.call(t,e)};Jr.prototype.listenerCount=n3;function n3(t){var e=this._events;if(e!==void 0){var n=e[t];if(typeof n=="function")return 1;if(n!==void 0)return n.length}return 0}Jr.prototype.eventNames=function(){return this._eventsCount>0?Xy(this._events):[]};function i3(t,e){for(var n=new Array(e),a=0;a]*)>(.*)/);if(!e)return null;var n=e[1],a=e[2].split(";"),u=null,d=a.reduce(function(_,l){var w=A7(l);return w?w.key==="rel"?(u||(u=w.value),_):(_[w.key]=w.value,_):_},{});return u?{url:n,rel:u,params:d}:null}function C7(t){return t?t.split(/,\s*=400){var _=new yP({request:t,body:e.response,statusCode:e.status});a(_);return}n(e)};var d=t.body;typeof d=="string"?e.send(d):d?e.send(JSON.stringify(d)):u?e.send(u):e.send(),k_[t.id]=e}).then(function(n){return U7(t,n)})}function s3(t,e){var n=t.url(e),a=new window.XMLHttpRequest;return a.open(t.method,n),Object.keys(t.headers).forEach(function(u){a.setRequestHeader(u,t.headers[u])}),a}function j7(t){return Promise.resolve().then(function(){var e=s3(t,t.client.accessToken);return a3(t,e)})}var V7={browserAbort:N7,sendRequestXhr:a3,browserSend:j7,createRequestXhr:s3},P_={exports:{}};/*! http://mths.be/base64 v0.1.0 by @mathias | MIT license */P_.exports;(function(t,e){(function(n){var a=e,u=t&&t.exports==a&&t,d=typeof $e=="object"&&$e;(d.global===d||d.window===d)&&(n=d);var _=function(U){this.message=U};_.prototype=new Error,_.prototype.name="InvalidCharacterError";var l=function(U){throw new _(U)},w="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",T=/[\t\n\f\r ]/g,C=function(U){U=String(U).replace(T,"");var j=U.length;j%4==0&&(U=U.replace(/==?$/,""),j=U.length),(j%4==1||/[^+a-zA-Z0-9/]/.test(U))&&l("Invalid character: the string to be decoded is not correctly encoded.");for(var L=0,V,R,F="",H=-1;++H>(-2*L&6)));return F},P=function(U){U=String(U),/[^\0-\xFF]/.test(U)&&l("The string to be encoded contains characters outside of the Latin1 range.");for(var j=U.length%3,L="",V=-1,R,F,H,Q,te=U.length-j;++V>18&63)+w.charAt(Q>>12&63)+w.charAt(Q>>6&63)+w.charAt(Q&63);return j==2?(R=U.charCodeAt(V)<<8,F=U.charCodeAt(++V),Q=R+F,L+=w.charAt(Q>>10)+w.charAt(Q>>4&63)+w.charAt(Q<<2&63)+"="):j==1&&(Q=U.charCodeAt(V),L+=w.charAt(Q>>2)+w.charAt(Q<<4&63)+"=="),L},z={encode:P,decode:C,version:"0.1.0"};if(a&&!a.nodeType)if(u)u.exports=z;else for(var W in z)z.hasOwnProperty(W)&&(a[W]=z[W]);else n.base64=z})($e)})(P_,P_.exports);var $7=P_.exports,W7=$7,cb={};function G7(t){if(cb[t])return cb[t];var e=t.split("."),n=e[0],a=e[1];if(!a)throw new Error("Invalid token");var u=H7(a),d={usage:n,user:u.u};return fu(u,"a")&&(d.authorization=u.a),fu(u,"exp")&&(d.expires=u.exp*1e3),fu(u,"iat")&&(d.created=u.iat*1e3),fu(u,"scopes")&&(d.scopes=u.scopes),fu(u,"client")&&(d.client=u.client),fu(u,"ll")&&(d.lastLogin=u.ll),fu(u,"iu")&&(d.impersonator=u.iu),cb[t]=d,d}function H7(t){try{return JSON.parse(W7.decode(t))}catch{throw new Error("Invalid token")}}function fu(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var l3=G7,c3={exports:{}};(function(t){var e=Object.prototype.hasOwnProperty,n="~";function a(){}Object.create&&(a.prototype=Object.create(null),new a().__proto__||(n=!1));function u(w,T,C){this.fn=w,this.context=T,this.once=C||!1}function d(w,T,C,P,z){if(typeof C!="function")throw new TypeError("The listener must be a function");var W=new u(C,P||w,z),U=n?n+T:T;return w._events[U]?w._events[U].fn?w._events[U]=[w._events[U],W]:w._events[U].push(W):(w._events[U]=W,w._eventsCount++),w}function _(w,T){--w._eventsCount===0?w._events=new a:delete w._events[T]}function l(){this._events=new a,this._eventsCount=0}l.prototype.eventNames=function(){var T=[],C,P;if(this._eventsCount===0)return T;for(P in C=this._events)e.call(C,P)&&T.push(n?P.slice(1):P);return Object.getOwnPropertySymbols?T.concat(Object.getOwnPropertySymbols(C)):T},l.prototype.listeners=function(T){var C=n?n+T:T,P=this._events[C];if(!P)return[];if(P.fn)return[P.fn];for(var z=0,W=P.length,U=new Array(W);zd.length?_:d})}};an.equal=function(e){return function(a){if(a!==e)return JSON.stringify(e)}};an.oneOf=function(){var e=Array.isArray(arguments[0])?arguments[0]:Array.prototype.slice.call(arguments),n=e.map(function(a){return an.equal(a)});return an.oneOfType.apply(this,n)};an.range=function(e){var n=e[0],a=e[1];return function(d){var _=vc(an.number,d);if(_||da)return"number between "+n+" & "+a+" (inclusive)"}};an.any=function(){};an.boolean=function(e){if(typeof e!="boolean")return"boolean"};an.number=function(e){if(typeof e!="number")return"number"};an.plainArray=function(e){if(!Array.isArray(e))return"array"};an.plainObject=function(e){if(!h9(e))return"object"};an.string=function(e){if(typeof e!="string")return"string"};an.func=function(e){if(typeof e!="function")return"function"};function vc(t,e){if(!(e==null&&!t.hasOwnProperty("__required"))){var n=t(e);if(n)return Array.isArray(n)?n:[n]}}function lT(t,e){var n=t.length,a=t[n-1],u=t.slice(0,n-1);return u.length===0&&(u=[y3]),e=d9(e,{path:u}),typeof a=="function"?a(e):v3(e,f9(a))}function p9(t){return t.length<2?t[0]:t.length===2?t.join(" or "):t.slice(0,-1).join(", ")+", or "+t.slice(-1)}function f9(t){return"must be "+m9(t)+"."}function m9(t){return/^an? /.test(t)?t:/^[aeiou]/i.test(t)?"an "+t:/^[a-z]/i.test(t)?"a "+t:t}function v3(t,e){var n=x3(t.path),a=t.path.join(".")+" "+e,u=n?"Item at position ":"";return u+a}function x3(t){return typeof t[t.length-1]=="number"||typeof t[0]=="number"}function g9(t){return Object.keys(t||{}).map(function(e){return{key:e,value:t[e]}})}an.validate=vc;an.processMessage=lT;var y9=an,_9=Nd,wd=y9;function v9(t){if(typeof window<"u")return t instanceof $e.Blob||t instanceof $e.ArrayBuffer?void 0:"Blob or ArrayBuffer";if(!(typeof t=="string"||t.pipe!==void 0))return"Filename or Readable stream"}function x9(t,e){return wd.assert(wd.strictShape(t),e)}function b9(t){var e="date";if(typeof t=="boolean")return e;try{var n=new Date(t);if(n.getTime&&isNaN(n.getTime()))return e}catch{return e}}function w9(t){return wd.tuple(wd.number,wd.number)(t)}var E9=_9(wd,{file:v9,date:b9,coordinates:w9,assertShape:x9});function S9(t,e){var n=function(a,u){return e.indexOf(a)!==-1&&u!==void 0};return typeof e=="function"&&(n=e),Object.keys(t).filter(function(a){return n(a,t[a])}).reduce(function(a,u){return a[u]=t[u],a},{})}var T9=S9;function A9(t,e){return Object.keys(t).reduce(function(n,a){return n[a]=e(a,t[a]),n},{})}var I9=A9,C9=I9;function k9(t){return C9(t,function(e,n){return typeof n=="boolean"?JSON.stringify(n):n})}var P9=k9,D9=p3,M9=g3;function z9(t){return function(e){var n;D9.prototype.isPrototypeOf(e)?n=e:n=M9(e);var a=Object.create(t);return a.client=n,a}}var R9=z9,b3=Nd,Cr=E9,D_=T9,w3=P9,O9=R9,cT={},E3=["country","region","postcode","district","place","locality","neighborhood","address","poi","poi.landmark"];cT.forwardGeocode=function(t){Cr.assertShape({query:Cr.required(Cr.string),mode:Cr.oneOf("mapbox.places","mapbox.places-permanent"),countries:Cr.arrayOf(Cr.string),proximity:Cr.oneOf(Cr.coordinates,"ip"),types:Cr.arrayOf(Cr.oneOf(E3)),autocomplete:Cr.boolean,bbox:Cr.arrayOf(Cr.number),limit:Cr.number,language:Cr.arrayOf(Cr.string),routing:Cr.boolean,fuzzyMatch:Cr.boolean,worldview:Cr.string})(t),t.mode=t.mode||"mapbox.places";var e=w3(b3({country:t.countries},D_(t,["proximity","types","autocomplete","bbox","limit","language","routing","fuzzyMatch","worldview"])));return this.client.createRequest({method:"GET",path:"/geocoding/v5/:mode/:query.json",params:D_(t,["mode","query"]),query:e})};cT.reverseGeocode=function(t){Cr.assertShape({query:Cr.required(Cr.coordinates),mode:Cr.oneOf("mapbox.places","mapbox.places-permanent"),countries:Cr.arrayOf(Cr.string),types:Cr.arrayOf(Cr.oneOf(E3)),bbox:Cr.arrayOf(Cr.number),limit:Cr.number,language:Cr.arrayOf(Cr.string),reverseMode:Cr.oneOf("distance","score"),routing:Cr.boolean,worldview:Cr.string})(t),t.mode=t.mode||"mapbox.places";var e=w3(b3({country:t.countries},D_(t,["country","types","bbox","limit","language","reverseMode","routing","worldview"])));return this.client.createRequest({method:"GET",path:"/geocoding/v5/:mode/:query.json",params:D_(t,["mode","query"]),query:e})};var F9=O9(cT),L9=self.crypto||self.msCrypto,uT="-_",mc=36;for(;mc--;)uT+=mc.toString(36);mc=36;for(;mc---10;)uT+=mc.toString(36).toUpperCase();var B9=function(t){var e="",n=L9.getRandomValues(new Uint8Array(t||21));for(mc=t||21;mc--;)e+=uT[n[mc]&63];return e},N9=B9;function S3(t){this.origin=t.origin||"https://api.mapbox.com",this.endpoint="events/v2",this.access_token=t.accessToken,this.version="0.2.0",this.sessionID=this.generateSessionID(),this.userAgent=this.getUserAgent(),this.options=t,this.send=this.send.bind(this),this.countries=t.countries?t.countries.split(","):null,this.types=t.types?t.types.split(","):null,this.bbox=t.bbox?t.bbox:null,this.language=t.language?t.language.split(","):null,this.limit=t.limit?+t.limit:null,this.locale=navigator.language||null,this.enableEventLogging=this.shouldEnableLogging(t),this.eventQueue=new Array,this.flushInterval=t.flushInterval||1e3,this.maxQueueSize=t.maxQueueSize||100,this.timer=this.flushInterval?setTimeout(this.flush.bind(this),this.flushInterval):null,this.lastSentInput="",this.lastSentIndex=0}S3.prototype={select:function(t,e){var n=this.getSelectedIndex(t,e),a=this.getEventPayload("search.select",e);if(a.resultIndex=n,a.resultPlaceName=t.place_name,a.resultId=t.id,!(n===this.lastSentIndex&&a.queryString===this.lastSentInput||n==-1)&&(this.lastSentIndex=n,this.lastSentInput=a.queryString,!!a.queryString))return this.push(a)},start:function(t){var e=this.getEventPayload("search.start",t);if(e.queryString)return this.push(e)},keyevent:function(t,e){if(t.key&&!(t.metaKey||[9,27,37,39,13,38,40].indexOf(t.keyCode)!==-1)){var n=this.getEventPayload("search.keystroke",e);if(n.lastAction=t.key,!!n.queryString)return this.push(n)}},send:function(t,e){if(!this.enableEventLogging)return e?e():void 0;var n=this.getRequestOptions(t);this.request(n,(function(a){if(a)return this.handleError(a,e);if(e)return e()}).bind(this))},getRequestOptions:function(t){Array.isArray(t)||(t=[t]);var e={method:"POST",host:this.origin,path:this.endpoint+"?access_token="+this.access_token,headers:{"Content-Type":"application/json"},body:JSON.stringify(t)};return e},getEventPayload:function(t,e){var n;e.options.proximity?n=[e.options.proximity.longitude,e.options.proximity.latitude]:n=null;var a=e._map?e._map.getZoom():void 0,u={event:t,created:+new Date,sessionIdentifier:this.sessionID,country:this.countries,userAgent:this.userAgent,language:this.language,bbox:this.bbox,types:this.types,endpoint:"mapbox.places",autocomplete:e.options.autocomplete,fuzzyMatch:e.options.fuzzyMatch,proximity:n,limit:e.options.limit,routing:e.options.routing,worldview:e.options.worldview,mapZoom:a,keyboardLocale:this.locale};return t==="search.select"?u.queryString=e.inputString:t!="search.select"&&e._inputEl?u.queryString=e._inputEl.value:u.queryString=e.inputString,u},request:function(t,e){var n=new XMLHttpRequest;n.onreadystatechange=function(){if(this.readyState==4)return this.status==204?e(null):e(this.statusText)},n.open(t.method,t.host+"/"+t.path,!0);for(var a in t.headers){var u=t.headers[a];n.setRequestHeader(a,u)}n.send(t.body)},handleError:function(t,e){if(e)return e(t)},generateSessionID:function(){return N9()},getUserAgent:function(){return"mapbox-gl-geocoder."+this.version+"."+navigator.userAgent},getSelectedIndex:function(t,e){if(e._typeahead){var n=e._typeahead.data,a=t.id,u=n.map(function(_){return _.id}),d=u.indexOf(a);return d}},shouldEnableLogging:function(t){return!(t.enableEventLogging===!1||t.origin&&t.origin.indexOf("api.mapbox.com")==-1||t.localGeocoder||t.filter)},flush:function(){this.eventQueue.length>0&&(this.send(this.eventQueue),this.eventQueue=new Array),this.timer&&clearTimeout(this.timer),this.flushInterval&&(this.timer=setTimeout(this.flush.bind(this),this.flushInterval))},push:function(t,e){this.eventQueue.push(t),(this.eventQueue.length>=this.maxQueueSize||e)&&this.flush()},remove:function(){this.flush()}};var U9=S3,j9={de:"Suche",it:"Ricerca",en:"Search",nl:"Zoeken",fr:"Chercher",ca:"Cerca",he:"לחפש",ja:"サーチ",lv:"Meklēt",pt:"Procurar",sr:"Претрага",zh:"搜索",cs:"Vyhledávání",hu:"Keresés",ka:"ძიება",nb:"Søke",sk:"Vyhľadávanie",th:"ค้นหา",fi:"Hae",is:"Leita",ko:"수색",pl:"Szukaj",sl:"Iskanje",fa:"جستجو",ru:"Поиск"},V9={placeholder:j9},T3={exports:{}};(function(t){(function(e,n,a){t.exports?t.exports=a():e[n]=a()})($e,"subtag",function(){var e="",n=/^([a-zA-Z]{2,3})(?:[_-]+([a-zA-Z]{3})(?=$|[_-]+))?(?:[_-]+([a-zA-Z]{4})(?=$|[_-]+))?(?:[_-]+([a-zA-Z]{2}|[0-9]{3})(?=$|[_-]+))?/;function a(w){return w.match(n)||[]}function u(w){return a(w).filter(function(T,C){return T&&C})}function d(w){return w=a(w),{language:w[1]||e,extlang:w[2]||e,script:w[3]||e,region:w[4]||e}}function _(w,T,C){Object.defineProperty(w,T,{value:C,enumerable:!0})}function l(w,T,C){function P(z){return a(z)[w]||e}_(P,"pattern",T),_(d,C,P)}return l(1,/^[a-zA-Z]{2,3}$/,"language"),l(2,/^[a-zA-Z]{3}$/,"extlang"),l(3,/^[a-zA-Z]{4}$/,"script"),l(4,/^[a-zA-Z]{2}$|^[0-9]{3}$/,"region"),_(d,"split",u),d})})(T3);var $9=T3.exports,W9=JV,G9=y7,wu=Nd,H9=S7.EventEmitter,xP=T7,bP=l9,wP=F9,q9=U9,Z9=V9,K9=$9;const ql={FORWARD:0,LOCAL:1,REVERSE:2};function A3(t){this._eventEmitter=new H9,this.options=wu({},this.options,t),this.inputString="",this.fresh=!0,this.lastSelected=null}A3.prototype={options:{zoom:16,flyTo:!0,trackProximity:!0,minLength:2,reverseGeocode:!1,limit:5,origin:"https://api.mapbox.com",enableEventLogging:!0,marker:!0,mapboxgl:null,collapsed:!1,clearAndBlurOnEsc:!1,clearOnBlur:!1,getItemValue:function(t){return t.place_name},render:function(t){var e=t.place_name.split(",");return'
'+e[0]+'
'+e.splice(1,e.length).join(",")+"
"}},addTo:function(t){function e(n,a){if(!document.body.contains(a))throw new Error("Element provided to #addTo() exists, but is not in the DOM");const u=n.onAdd();a.appendChild(u)}if(t._controlContainer)t.addControl(this);else if(t instanceof HTMLElement)e(this,t);else if(typeof t=="string"){const n=document.querySelectorAll(t);if(n.length===0)throw new Error("Element ",t,"not found.");if(n.length>1)throw new Error("Geocoder can only be added to a single html element");e(this,n[0])}else throw new Error("Error: addTo must be a mapbox-gl-js map, an html element, or a CSS selector query for a single html element")},onAdd:function(t){if(t&&typeof t!="string"&&(this._map=t),this.setLanguage(),this.options.localGeocoderOnly||(this.geocoderService=wP(bP({accessToken:this.options.accessToken,origin:this.options.origin}))),this.options.localGeocoderOnly&&!this.options.localGeocoder)throw new Error("A localGeocoder function must be specified to use localGeocoderOnly mode");this.eventManager=new q9(this.options),this._onChange=this._onChange.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onPaste=this._onPaste.bind(this),this._onBlur=this._onBlur.bind(this),this._showButton=this._showButton.bind(this),this._hideButton=this._hideButton.bind(this),this._onQueryResult=this._onQueryResult.bind(this),this.clear=this.clear.bind(this),this._updateProximity=this._updateProximity.bind(this),this._collapse=this._collapse.bind(this),this._unCollapse=this._unCollapse.bind(this),this._clear=this._clear.bind(this),this._clearOnBlur=this._clearOnBlur.bind(this);var e=this.container=document.createElement("div");e.className="mapboxgl-ctrl-geocoder mapboxgl-ctrl";var n=this.createIcon("search",'');this._inputEl=document.createElement("input"),this._inputEl.type="text",this._inputEl.className="mapboxgl-ctrl-geocoder--input",this.setPlaceholder(),this.options.collapsed&&(this._collapse(),this.container.addEventListener("mouseenter",this._unCollapse),this.container.addEventListener("mouseleave",this._collapse),this._inputEl.addEventListener("focus",this._unCollapse)),(this.options.collapsed||this.options.clearOnBlur)&&this._inputEl.addEventListener("blur",this._onBlur),this._inputEl.addEventListener("keydown",G9(this._onKeyDown,200)),this._inputEl.addEventListener("paste",this._onPaste),this._inputEl.addEventListener("change",this._onChange),this.container.addEventListener("mouseenter",this._showButton),this.container.addEventListener("mouseleave",this._hideButton),this._inputEl.addEventListener("keyup",(function(d){this.eventManager.keyevent(d,this)}).bind(this));var a=document.createElement("div");a.classList.add("mapboxgl-ctrl-geocoder--pin-right"),this._clearEl=document.createElement("button"),this._clearEl.setAttribute("aria-label","Clear"),this._clearEl.addEventListener("click",this.clear),this._clearEl.className="mapboxgl-ctrl-geocoder--button";var u=this.createIcon("close",'');return this._clearEl.appendChild(u),this._loadingEl=this.createIcon("loading",''),a.appendChild(this._clearEl),a.appendChild(this._loadingEl),e.appendChild(n),e.appendChild(this._inputEl),e.appendChild(a),this._typeahead=new W9(this._inputEl,[],{filter:!1,minLength:this.options.minLength,limit:this.options.limit}),this.setRenderFunction(this.options.render),this._typeahead.getItemValue=this.options.getItemValue,this.mapMarker=null,this._handleMarker=this._handleMarker.bind(this),this._map&&(this.options.trackProximity&&(this._updateProximity(),this._map.on("moveend",this._updateProximity)),this._mapboxgl=this.options.mapboxgl,!this._mapboxgl&&this.options.marker&&(console.error("No mapboxgl detected in options. Map markers are disabled. Please set options.mapboxgl."),this.options.marker=!1)),e},createIcon:function(t,e){var n=document.createElementNS("http://www.w3.org/2000/svg","svg");if(n.setAttribute("class","mapboxgl-ctrl-geocoder--icon mapboxgl-ctrl-geocoder--icon-"+t),n.setAttribute("viewBox","0 0 18 18"),n.setAttribute("xml:space","preserve"),n.setAttribute("width",18),n.setAttribute("height",18),"innerHTML"in n)n.innerHTML=e;else{var a=document.createElement("div");a.innerHTML=""+e.valueOf().toString()+"";var u=a.firstChild,d=u.firstChild;n.appendChild(d)}return n},onRemove:function(){return this.container.parentNode.removeChild(this.container),this.options.trackProximity&&this._map&&this._map.off("moveend",this._updateProximity),this._removeMarker(),this._map=null,this},_onPaste:function(t){var e=(t.clipboardData||window.clipboardData).getData("text");e.length>=this.options.minLength&&this._geocode(e)},_onKeyDown:function(t){var e=27,n=9;if(t.keyCode===e&&this.options.clearAndBlurOnEsc)return this._clear(t),this._inputEl.blur();var a=t.target&&t.target.shadowRoot?t.target.shadowRoot.activeElement:t.target,u=a?a.value:"";if(!u)return this.fresh=!0,t.keyCode!==n&&this.clear(t),this._clearEl.style.display="none";t.metaKey||[n,e,37,39,13,38,40].indexOf(t.keyCode)!==-1||a.value.length>=this.options.minLength&&this._geocode(a.value)},_showButton:function(){this._typeahead.selected&&(this._clearEl.style.display="block")},_hideButton:function(){this._typeahead.selected&&(this._clearEl.style.display="none")},_onBlur:function(t){this.options.clearOnBlur&&this._clearOnBlur(t),this.options.collapsed&&this._collapse()},_onChange:function(){var t=this._typeahead.selected;if(t&&JSON.stringify(t)!==this.lastSelected){if(this._clearEl.style.display="none",this.options.flyTo){var e;if(t.properties&&xP[t.properties.short_code])e=wu({},this.options.flyTo),this._map&&this._map.fitBounds(xP[t.properties.short_code].bbox,e);else if(t.bbox){var n=t.bbox;e=wu({},this.options.flyTo),this._map&&this._map.fitBounds([[n[0],n[1]],[n[2],n[3]]],e)}else{var a={zoom:this.options.zoom};e=wu({},a,this.options.flyTo),t.center?e.center=t.center:t.geometry&&t.geometry.type&&t.geometry.type==="Point"&&t.geometry.coordinates&&(e.center=t.geometry.coordinates),this._map&&this._map.flyTo(e)}}this.options.marker&&this._mapboxgl&&this._handleMarker(t),this._inputEl.focus(),this._inputEl.scrollLeft=0,this._inputEl.setSelectionRange(0,0),this.lastSelected=JSON.stringify(t),this._eventEmitter.emit("result",{result:t}),this.eventManager.select(t,this)}},_requestType:function(t,e){var n;const a=/^[ ]*(-?\d+\.?\d*)[, ]+(-?\d+\.?\d*)[ ]*$/;return t.localGeocoderOnly?n=ql.LOCAL:t.reverseGeocode&&a.test(e)?n=ql.REVERSE:n=ql.FORWARD,n},_setupConfig:function(t,e){const n=["bbox","limit","proximity","countries","types","language","reverseMode","mode","autocomplete","fuzzyMatch","routing","worldview"],a=/[\s,]+/;var u=this,d=n.reduce(function(l,w){if(u.options[w]===void 0||u.options[w]===null)return l;["countries","types","language"].indexOf(w)>-1?l[w]=u.options[w].split(a):l[w]=u.options[w];const T=typeof u.options[w].longitude=="number"&&typeof u.options[w].latitude=="number";if(w==="proximity"&&T){const C=u.options[w].longitude,P=u.options[w].latitude;l[w]=[C,P]}return l},{});switch(t){case ql.REVERSE:{var _=e.split(a).map(function(l){return parseFloat(l,10)}).reverse();d.types&&d.types[0],d=wu(d,{query:_,limit:1}),["proximity","autocomplete","fuzzyMatch","bbox"].forEach(function(l){l in d&&delete d[l]})}break;case ql.FORWARD:/^[ ]*(-?\d+\.?\d*)[, ]+(-?\d+\.?\d*)*[ ]*$/.test(e)&&(e=e.replace(/,/g," ")),d=wu(d,{query:e});break}return d},_geocode:function(t){this.inputString=t,this._loadingEl.style.display="block",this._eventEmitter.emit("loading",{query:t});const e=this._requestType(this.options,t),n=this._setupConfig(e,t);var a;switch(e){case ql.LOCAL:a=Promise.resolve();break;case ql.FORWARD:a=this.geocoderService.forwardGeocode(n).send();break;case ql.REVERSE:a=this.geocoderService.reverseGeocode(n).send();break}var u=this.options.localGeocoder?this.options.localGeocoder(t)||[]:[],d=[],_=null;return a.catch((function(l){_=l}).bind(this)).then((function(l){this._loadingEl.style.display="none";var w={};return l?l.statusCode=="200"&&(w=l.body,w.request=l.request,w.headers=l.headers):w={type:"FeatureCollection",features:[]},w.config=n,this.fresh&&(this.eventManager.start(this),this.fresh=!1),w.features=w.features?u.concat(w.features):u,this.options.externalGeocoder?(d=this.options.externalGeocoder(t,w.features)||[],d.then(function(T){return w.features=w.features?T.concat(w.features):T,w},function(){return w})):w}).bind(this)).then((function(l){if(_)throw _;this.options.filter&&l.features.length&&(l.features=l.features.filter(this.options.filter)),l.features.length?(this._clearEl.style.display="block",this._eventEmitter.emit("results",l),this._typeahead.update(l.features)):(this._clearEl.style.display="none",this._typeahead.selected=null,this._renderNoResults(),this._eventEmitter.emit("results",l))}).bind(this)).catch((function(l){this._loadingEl.style.display="none",u.length&&this.options.localGeocoder||d.length&&this.options.externalGeocoder?(this._clearEl.style.display="block",this._typeahead.update(u)):(this._clearEl.style.display="none",this._typeahead.selected=null,this._renderError()),this._eventEmitter.emit("results",{features:u}),this._eventEmitter.emit("error",{error:l})}).bind(this)),a},_clear:function(t){t&&t.preventDefault(),this._inputEl.value="",this._typeahead.selected=null,this._typeahead.clear(),this._onChange(),this._clearEl.style.display="none",this._removeMarker(),this.lastSelected=null,this._eventEmitter.emit("clear"),this.fresh=!0},clear:function(t){this._clear(t),this._inputEl.focus()},_clearOnBlur:function(t){var e=this;t.relatedTarget&&e._clear(t)},_onQueryResult:function(t){var e=t.body;if(e.features.length){var n=e.features[0];this._typeahead.selected=n,this._inputEl.value=n.place_name,this._onChange()}},_updateProximity:function(){if(this._map)if(this._map.getZoom()>9){var t=this._map.getCenter().wrap();this.setProximity({longitude:t.lng,latitude:t.lat})}else this.setProximity(null)},_collapse:function(){!this._inputEl.value&&this._inputEl!==document.activeElement&&this.container.classList.add("mapboxgl-ctrl-geocoder--collapsed")},_unCollapse:function(){this.container.classList.remove("mapboxgl-ctrl-geocoder--collapsed")},query:function(t){return this._geocode(t).then(this._onQueryResult),this},_renderError:function(){var t="
There was an error reaching the server
";this._renderMessage(t)},_renderNoResults:function(){var t="
No results found
";this._renderMessage(t)},_renderMessage:function(t){this._typeahead.update([]),this._typeahead.selected=null,this._typeahead.clear(),this._typeahead.renderError(t)},_getPlaceholderText:function(){if(this.options.placeholder)return this.options.placeholder;if(this.options.language){var t=this.options.language.split(",")[0],e=K9.language(t),n=Z9.placeholder[e];if(n)return n}return"Search"},setInput:function(t){return this._inputEl.value=t,this._typeahead.selected=null,this._typeahead.clear(),t.length>=this.options.minLength&&this._geocode(t),this},setProximity:function(t){return this.options.proximity=t,this},getProximity:function(){return this.options.proximity},setRenderFunction:function(t){return t&&typeof t=="function"&&(this._typeahead.render=t),this},getRenderFunction:function(){return this._typeahead.render},setLanguage:function(t){var e=navigator.language||navigator.userLanguage||navigator.browserLanguage;return this.options.language=t||this.options.language||e,this},getLanguage:function(){return this.options.language},getZoom:function(){return this.options.zoom},setZoom:function(t){return this.options.zoom=t,this},getFlyTo:function(){return this.options.flyTo},setFlyTo:function(t){return this.options.flyTo=t,this},getPlaceholder:function(){return this.options.placeholder},setPlaceholder:function(t){return this.placeholder=t||this._getPlaceholderText(),this._inputEl.placeholder=this.placeholder,this._inputEl.setAttribute("aria-label",this.placeholder),this},getBbox:function(){return this.options.bbox},setBbox:function(t){return this.options.bbox=t,this},getCountries:function(){return this.options.countries},setCountries:function(t){return this.options.countries=t,this},getTypes:function(){return this.options.types},setTypes:function(t){return this.options.types=t,this},getMinLength:function(){return this.options.minLength},setMinLength:function(t){return this.options.minLength=t,this._typeahead&&(this._typeahead.options.minLength=t),this},getLimit:function(){return this.options.limit},setLimit:function(t){return this.options.limit=t,this._typeahead&&(this._typeahead.options.limit=t),this},getFilter:function(){return this.options.filter},setFilter:function(t){return this.options.filter=t,this},setOrigin:function(t){return this.options.origin=t,this.geocoderService=wP(bP({accessToken:this.options.accessToken,origin:this.options.origin})),this},getOrigin:function(){return this.options.origin},setAutocomplete:function(t){return this.options.autocomplete=t,this},getAutocomplete:function(){return this.options.autocomplete},setFuzzyMatch:function(t){return this.options.fuzzyMatch=t,this},getFuzzyMatch:function(){return this.options.fuzzyMatch},setRouting:function(t){return this.options.routing=t,this},getRouting:function(){return this.options.routing},setWorldview:function(t){return this.options.worldview=t,this},getWorldview:function(){return this.options.worldview},_handleMarker:function(t){if(this._map){this._removeMarker();var e={color:"#4668F2"},n=wu({},e,this.options.marker);return this.mapMarker=new this._mapboxgl.Marker(n),t.center?this.mapMarker.setLngLat(t.center).addTo(this._map):t.geometry&&t.geometry.type&&t.geometry.type==="Point"&&t.geometry.coordinates&&this.mapMarker.setLngLat(t.geometry.coordinates).addTo(this._map),this}},_removeMarker:function(){this.mapMarker&&(this.mapMarker.remove(),this.mapMarker=null)},on:function(t,e){return this._eventEmitter.on(t,e),this},off:function(t,e){return this._eventEmitter.removeListener(t,e),this.eventManager.remove(),this}};var X9=A3;const Y9=XE(X9);/* + * Frontend UI component library for the CORI Data API + * {@link https://github.com/ruralinnovation/cori.data.api} + * @copyright Rural Innovation Strategies, Inc. + * @license ISC + */function Q9(t){const[e,n]=St.useState(null),a=Object.assign({},t),u=Bd(()=>{const d=new Y9(Object.assign(Object.assign({},a),{marker:e||!1,accessToken:a.mapboxAccessToken}));return a.onLoading&&d.on("loading",a.onLoading),a.onResults&&d.on("results",a.onResults),a.onResult&&d.on("result",_=>{var l;a.onResult!==void 0&&a.onResult(_);const{result:w}=_,T=w&&(w.center||((l=w.geometry)===null||l===void 0?void 0:l.type)==="Point"&&w.geometry.coordinates);if(T&&a.marker){const C=typeof a.marker=="object"?a.marker:{};n(St.createElement(KR,Object.assign({},C,{longitude:T[0],latitude:T[1]})))}else n(null)}),a.onError&&d.on("error",a.onError),d},{position:a.position});return u.hasOwnProperty("_map")&&u._map&&(u.getProximity()!==a.proximity&&a.proximity!==void 0&&u.setProximity(a.proximity),u.getRenderFunction()!==a.render&&a.render!==void 0&&u.setRenderFunction(a.render),u.getLanguage()!==a.language&&a.language!==void 0&&u.setLanguage(a.language),u.getZoom()!==a.zoom&&a.zoom!==void 0&&u.setZoom(a.zoom),u.getFlyTo()!==a.flyTo&&a.flyTo!==void 0&&u.setFlyTo(a.flyTo),u.getPlaceholder()!==a.placeholder&&a.placeholder!==void 0&&u.setPlaceholder(a.placeholder),u.getCountries()!==a.countries&&a.countries!==void 0&&u.setCountries(a.countries),u.getTypes()!==a.types&&a.types!==void 0&&u.setTypes(a.types),u.getMinLength()!==a.minLength&&a.minLength!==void 0&&u.setMinLength(a.minLength),u.getLimit()!==a.limit&&a.limit!==void 0&&u.setLimit(a.limit),u.getFilter()!==a.filter&&a.filter!==void 0&&u.setFilter(a.filter),u.getOrigin()!==a.origin&&a.origin!==void 0&&u.setOrigin(a.origin),u.getAutocomplete()!==a.autocomplete&&a.autocomplete!==void 0&&u.setAutocomplete(a.autocomplete),u.getFuzzyMatch()!==a.fuzzyMatch&&a.fuzzyMatch!==void 0&&u.setFuzzyMatch(a.fuzzyMatch),u.getRouting()!==a.routing&&a.routing!==void 0&&u.setRouting(a.routing),u.getWorldview()!==a.worldview&&a.worldview!==void 0&&u.setWorldview(a.worldview)),e}/* + * Frontend UI component library for the CORI Data API + * {@link https://github.com/ruralinnovation/cori.data.api} + * @copyright Rural Innovation Strategies, Inc. + * @license ISC + */var J9=8,e$="LIVE - CORI light basemap - county labels",t$={"mapbox:type":"default","mapbox:origin":"light-v10","mapbox:autocomposite":!0,"mapbox:groups":{"1444855769305.6016":{name:"Tunnels",collapsed:!0},"1444855786460.0557":{name:"Roads",collapsed:!0},"1444855799204.86":{name:"Bridges",collapsed:!0},"1444934295202.7542":{name:"Admin boundaries",collapsed:!1}},"mapbox:sdk-support":{js:"0.54.0",android:"7.4.0",ios:"4.10.0"},"mapbox:uiParadigm":"layers","mapbox:thumb":"data:image/webp;base64,UklGRmAJAABXRUJQVlA4TFQJAAAvO8AOAPX4drZtmWTXts7/wMzUqCCLGZOCMjCzbfx/1jFYYr9m+zeF5Gqx8bj3bozqqoouhWLj6dCYQqn+K1W6Vb1HB+Nn+HqXMatDQowkSVJTM/xwkv+mwu1OF8S2kRxJ7PyjfbMzs6a7+j8Be9jFwDSO7Za6ajtXwy/CHsEeYqSRsWzFQAbkSKlndkzfLGcN0zHLlJYZyNmbaOFmTdM0apq3d+t5Y906dr68rJ16zskdY1kaCWdraPJQE8CKlJazrjk+nrVM2/y0Q8ZpQtFux7BmD3bG8fxnncEJvUfnnPObbeMBsKIKWwJLA5PS8njL3DLP4CPmpnkG4+PxuFaBT22n9wiwUuTNx93WpXE+s4bmwJJyWCFwVAX3SJuMZ8fb5ic/uYKb5qc/HY+XqSvlgEmPIYI91BF5/X6fOW3Hpn0x7BGCGMgOIUVMAPdLSmn8xk/+ddM0zT/NUlqmDDhHT0NSj4pzfDEiNh53M7rOC/ElKUxkESgctcF75jilNBuP35gtU2kUjLo1fQicFbF5v7lCb488VM7WALsaKYd2zVFMDJBTSmn50/F4uY8oH9g2dlja+Pv3HebWDpZz2CAZV8BymTpIaTYb/3SZ9qXU6tvEuVU4hpI2Xye6NVcGNl5gQmAtIFJK47Qcj4/vYUcXT2V/e+hiR0dKjfeJAXNqGGNjZyGHYGhSSrPZcjkbH+83Acwe6dm7BBtfXc6umi7y9rHj4OwwIMkKSw5gmVJqm/FsNhvPlmlc+PcAb+MGLpNvvzvdHEb//8OovHFcQ+Yq/v9FAAPYcsiPFeA6pdTGbLkcz8YpXVyWKaW1nwkYRs7diBfOOr8KN/XMr5rQ0a5ZP9bB2pgIyCgcIBlYpJT6JqXl+HicUjv5Y0rp+jbBBm1ktlJfyo4HjVCu55uvNWTWNgGEcRjHAhvXJeOfjmep/JFd4HvbAxzyF3Odt55noJNjJLBCyEgTLJk6peO0PB7PlmVLsAG10hVYoHr+7tb9Xnc+Gq9LkmUp5EAAOaWOWc5mhcmkYAH+9Y69oGxQ5rm+/blu2ZcnO8ieP+xiF/UnHn5CsSdvpGRwWo4fz5bj8QTIKdUqxA4DhjDSXN3bt/Ha18gPbdnClr2jx9/+C/GJd2vFG1e2C6uWywDw0KQAUNdOEHYNtdW/9Ppr//pCNFKyMNiw+I5lm+I8GpNlnQuACwNyDES2sNDdYzNgTqQqy4CycbYlyn/fGMJR56jXN5Bxl/k8lnLsCjmL/zgc0lfHoSnKIiaEXOZssAXrI0t7EE3HQLYenf4V9p3x7Le+duJxX2Uu4IN6w2A8AvZRYLMfBfv7gOs6f/4Qh9THjV3bkxx+9L5vzc/c983rz+06z4+BKDFWCKySTMgGEOW5ydRzy6pCJj76rcn68b9LrtNns3fqsW0A+cjYLlkRkjH3+nFcfyKbqtCX7v4vzs98Z5ulUMGaHrGvbYdldC/acUDMI+ogY9183D4xWa0atXp1Br1lYw5HKnGOiHB2CO/nHtr6vCTlx0cmz3Gsv3eHObHhVctqJNe877Ab7FbtEc2e1A6XKBS5tkS5X360Y9aVjhVZn9gJGwSNx7N9/c6ZCgLgO3R6exWZUku4tlww9q0U0NLnbVRPI7tw57hOOqLMqjr1TIaJXRYSZIVsii+vgOg4skLzlWTD3c//qfA+yp242/sFnDDP4So+huswWBjmlsucf4/xnfEEj8BG783+2+m1R/Cwpne5evS5sQcLGVuteLpeZ7t/G9xbff0Z2zLAfWyKHbTUtLDN0QHWoN5OvctX2717l9Pva6cXffKx4bCViTpG+tVNnNTa5To8WwdB2UMAAw2Zon5/ALs1zbroWo0Y4X6velAf1fMDOyYxtTE8CTd9B3XbZaOa7TodvmY9vT4jvkIrjFmfqvz74xFhs1bO88CeoLNJpRweGiaO6s0RMyD5SJu+O73drb1VV6tOo9aXe3UGdR4CQ54G9w7T69Pt06SzDDx8Hqf1kXqv+rVsSi2rSZ6bubRsjXZYAOrTBwatmpl3mvaI2tXLv/+bbsw9QFv16qXf50bdXd7OZbV7/XOnV6/3p9ml79Y1ZDzSwgXLPLmji9aluLFNAQ9oAxZdfaknii934lsv8XK2bcAjuF9Pr6/O5W/1a0BhTB523M/AWetlA3tmaFOmXUO5w1i2AQLY0+L3n6c4MEOlxchsfJZ6hhtxcSoAnriA7AlgABsJMGZOcfFHk+sMho1j6TdNfOzUi6rwNkXLqsFl2GDLMjmA36dexbYL3nzu+M2J8ZIFfPpBwZZCtilmwEVh+P79qDeifhpzKNl4Pvdv2mupHWSAAUPx+47wnrFx4b4NBocBs4uqJf0XpTady3fw3Mhy/nZW2/5EGHBYVRgb3IEpWqZ0BlsZA7aFW5fuMyencAAHhvuQ8ye+/fD/fvUw4/vvtso8oiDLYLhPX08oOgYl4u6xhubkBMIc/hqo+UQYYmWxr3MIq5CJN2mq5wDKOdew+XfldefSRoX6NZKV69dHAMXLeD/AddTuqU85SNTfH1s4fAR07k8ekrXJlWXqeDtMNhXYR0F5VQKOHGHxcnyJ79kMC/ousDIHp7Zm2CMaCsbK1psuubIKWlaZrZyzye1oO4cmYwCZty45t7eYTIB/AiMHWlV+U9yrjE3k/E/yv9chv6lqOrXQ2oyrr1lzZ8DyAuNQR28WDBhTqMAR7/7MEACWb5ubKeJ7VUxdW8haAAK7otSADZji39Rd2pUKxPyjO8HTp+AHDmFccMG5BLBsF7xYrOIWzjJtvVtw/sKHF/sLgL9vCYxs4YKHZh8Zm1U1nZqa/PTXBuwdMiLP7OLgrULXSAaBsYRs38GW/rtgyWyMlV9EMSMdAKtGqu7Td3BzPBgxAOrjqKZ0wj16DETYvrZc31VRqj24OoBzp4u7vpT7zvk4OqBEuT4seAG4DFeWbLQ+9ZJclv13AxI8+yvIA/qFKR+AwSIfCVAFYJdAoG99F0uAASJ+7Xi5EzjuZk6s0hOYTLCZqwIsl4NhOjk0QLgQkevcYqaLo5VxjzyzJ/ltOJTB8wgDqICNVX3/cUwBt5OcFdkG/4OAbDbok6v49AOAgnrQJKaTmMi5qmKxcLBaev4vkeePDFjAp+cUg2cm51YN1WMoN56HKE4rgx0vnz19+Fc/ub79ZLILKw5pa4UxHOSSqQE="},r$=[-72.26808525539167,43.37747275058169],n$=10.873762090608595,i$=0,o$=2,a$={composite:{url:"mapbox://mapbox.mapbox-terrain-v2,mapbox.mapbox-streets-v8,ruralinno.2pv0vm2z,ruralinno.3v9y79ly,ruralinno.5639ssfg,ruralinno.c504wkuy,ruralinno.7stpbs93,ruralinno.cwz2k5qc,ruralinno.1joudpqe",type:"vector"}},s$="mapbox://sprites/ruralinno/cl010e7b7001p15pe3l0306hv/68n9slz9mfbus83an19oqbf32",l$="mapbox://fonts/ruralinno/{fontstack}/{range}.pbf",c$=[{id:"land",type:"background",layout:{},paint:{"background-color":"hsl(55, 0%, 100%)"}},{id:"landcover",type:"fill",source:"composite","source-layer":"landcover",maxzoom:7,layout:{},paint:{"fill-color":"hsl(0, 0%, 100%)","fill-opacity":["interpolate",["exponential",1.5],["zoom"],2,.1,7,0],"fill-antialias":!1}},{id:"national-park",type:"fill",source:"composite","source-layer":"landuse_overlay",minzoom:5,filter:["==",["get","class"],"national_park"],layout:{},paint:{"fill-color":"hsla(150, 6%, 93%, 0.63)","fill-opacity":["interpolate",["linear"],["zoom"],5,0,6,.5]}},{id:"landuse",type:"fill",source:"composite","source-layer":"landuse",minzoom:5,filter:["match",["get","class"],["park","airport","glacier","pitch","sand"],!0,!1],layout:{},paint:{"fill-opacity":["interpolate",["linear"],["zoom"],5,0,6,["match",["get","class"],"glacier",.5,1]],"fill-color":"hsl(150, 0%, 100%)"}},{id:"water-shadow",type:"fill",source:"composite","source-layer":"water",layout:{},paint:{"fill-translate-anchor":"viewport","fill-translate":["interpolate",["exponential",1.2],["zoom"],7,["literal",[0,0]],16,["literal",[-1,-1]]],"fill-color":"hsl(185, 7%, 73%)"}},{id:"waterway",type:"line",source:"composite","source-layer":"waterway",minzoom:8,layout:{"line-cap":["step",["zoom"],"butt",11,"round"],"line-join":"round"},paint:{"line-color":"hsl(187, 9%, 81%)","line-width":["interpolate",["exponential",1.3],["zoom"],9,["match",["get","class"],["canal","river"],.1,0],20,["match",["get","class"],["canal","river"],8,3]],"line-opacity":["interpolate",["linear"],["zoom"],8,0,8.5,1]}},{id:"water",type:"fill",source:"composite","source-layer":"water",layout:{},paint:{"fill-color":"#cad2d3","fill-opacity":.5}},{id:"hillshade",type:"fill",source:"composite","source-layer":"hillshade",minzoom:6,layout:{},paint:{"fill-color":["match",["get","class"],"shadow","hsl(0, 0%, 35%)","hsl(0, 0%, 100%)"],"fill-opacity":["interpolate",["linear"],["zoom"],12,["match",["get","level"],[67,56],.02,[89,78],.01,.015],15,0]}},{id:"land-structure-polygon",type:"fill",source:"composite","source-layer":"structure",minzoom:21.1,filter:["all",["==",["geometry-type"],"Polygon"],["==",["get","class"],"land"]],layout:{},paint:{"fill-color":"hsl(156, 20%, 95%)"}},{id:"land-structure-line",type:"line",source:"composite","source-layer":"structure",minzoom:13,filter:["all",["==",["geometry-type"],"LineString"],["==",["get","class"],"land"]],layout:{"line-cap":"round"},paint:{"line-width":["interpolate",["exponential",1.99],["zoom"],14,.75,20,40],"line-color":"hsl(156, 20%, 95%)"}},{id:"aeroway-polygon",type:"fill",source:"composite","source-layer":"aeroway",minzoom:11,filter:["all",["==",["geometry-type"],"Polygon"],["match",["get","type"],["runway","taxiway","helipad"],!0,!1]],layout:{},paint:{"fill-opacity":["interpolate",["linear"],["zoom"],11,0,11.5,1],"fill-color":"hsl(0, 0%, 97%)"}},{id:"aeroway-line",type:"line",source:"composite","source-layer":"aeroway",minzoom:9,filter:["==",["geometry-type"],"LineString"],layout:{},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],9,["match",["get","type"],"runway",1,.5],18,["match",["get","type"],"runway",80,20]],"line-color":"hsl(0, 0%, 97%)"}},{id:"building-outline",type:"line",source:"composite","source-layer":"building",minzoom:15,filter:["all",["!=",["get","type"],"building:part"],["==",["get","underground"],"false"]],layout:{},paint:{"line-color":"hsl(55, 3%, 87%)","line-width":["interpolate",["exponential",1.5],["zoom"],15,.75,20,3],"line-opacity":["interpolate",["linear"],["zoom"],15,0,16,1]}},{id:"building",type:"fill",source:"composite","source-layer":"building",minzoom:15,filter:["all",["!=",["get","type"],"building:part"],["==",["get","underground"],"false"]],layout:{},paint:{"fill-outline-color":"hsl(55, 3%, 87%)","fill-opacity":["interpolate",["linear"],["zoom"],15,0,16,1],"fill-color":"hsl(55, 5%, 91%)"}},{id:"tunnel-street-minor-low",type:"line",metadata:{"mapbox:group":"1444855769305.6016"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["==",["get","structure"],"tunnel"],["step",["zoom"],["match",["get","class"],["street","street_limited","track","primary_link"],!0,!1],14,["match",["get","class"],["street","street_limited","track","primary_link","secondary_link","tertiary_link","service"],!0,!1]],["==",["geometry-type"],"LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],12,.5,14,["match",["get","class"],["street","street_limited","primary_link"],2,"track",1,.5],18,["match",["get","class"],["street","street_limited","primary_link"],18,12]],"line-color":"hsl(185, 7%, 88%)","line-opacity":["step",["zoom"],1,14,0]}},{id:"tunnel-street-minor-case",type:"line",metadata:{"mapbox:group":"1444855769305.6016"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["==",["get","structure"],"tunnel"],["step",["zoom"],["match",["get","class"],["street","street_limited","track","primary_link"],!0,!1],14,["match",["get","class"],["street","street_limited","track","primary_link","secondary_link","tertiary_link","service"],!0,!1]],["==",["geometry-type"],"LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],12,.75,20,2],"line-color":"hsl(185, 12%, 89%)","line-gap-width":["interpolate",["exponential",1.5],["zoom"],12,.5,14,["match",["get","class"],["street","street_limited","primary_link"],2,"track",1,.5],18,["match",["get","class"],["street","street_limited","primary_link"],18,12]],"line-opacity":["step",["zoom"],0,14,1],"line-dasharray":[3,3]}},{id:"tunnel-primary-secondary-tertiary-case",type:"line",metadata:{"mapbox:group":"1444855769305.6016"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["==",["get","structure"],"tunnel"],["match",["get","class"],["primary","secondary","tertiary"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],10,["match",["get","class"],"primary",1,.75],18,2],"line-color":"hsl(185, 12%, 89%)","line-gap-width":["interpolate",["exponential",1.5],["zoom"],5,["match",["get","class"],"primary",.75,.1],18,["match",["get","class"],"primary",32,26]],"line-dasharray":[3,3]}},{id:"tunnel-major-link-case",type:"line",metadata:{"mapbox:group":"1444855769305.6016"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["==",["get","structure"],"tunnel"],["match",["get","class"],["motorway_link","trunk_link"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],12,.75,20,2],"line-color":"hsl(185, 12%, 89%)","line-gap-width":["interpolate",["exponential",1.5],["zoom"],12,.5,14,2,18,18],"line-dasharray":[3,3]}},{id:"tunnel-motorway-trunk-case",type:"line",metadata:{"mapbox:group":"1444855769305.6016"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["==",["get","structure"],"tunnel"],["match",["get","class"],["motorway","trunk"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],10,1,18,2],"line-color":"hsl(185, 12%, 89%)","line-gap-width":["interpolate",["exponential",1.5],["zoom"],5,.75,18,32],"line-dasharray":[3,3]}},{id:"tunnel-construction",type:"line",metadata:{"mapbox:group":"1444855769305.6016"},source:"composite","source-layer":"road",minzoom:14,filter:["all",["==",["get","structure"],"tunnel"],["==",["get","class"],"construction"],["==",["geometry-type"],"LineString"]],layout:{},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],14,2,18,18],"line-color":"hsl(187, 7%, 88%)","line-dasharray":["step",["zoom"],["literal",[.4,.8]],15,["literal",[.3,.6]],16,["literal",[.2,.3]],17,["literal",[.2,.25]],18,["literal",[.15,.15]]]}},{id:"tunnel-path",type:"line",metadata:{"mapbox:group":"1444855769305.6016"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["==",["get","structure"],"tunnel"],["==",["get","class"],"path"],["!=",["get","type"],"steps"],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],15,1,18,4],"line-dasharray":["step",["zoom"],["literal",[1,0]],15,["literal",[1.75,1]],16,["literal",[1,.75]],17,["literal",[1,.5]]],"line-color":"hsl(0, 0%, 85%)"}},{id:"tunnel-steps",type:"line",metadata:{"mapbox:group":"1444855769305.6016"},source:"composite","source-layer":"road",minzoom:14,filter:["all",["==",["get","structure"],"tunnel"],["==",["get","class"],"steps"],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],15,1,16,1.6,18,6],"line-color":"hsl(0, 0%, 85%)","line-dasharray":["step",["zoom"],["literal",[1,0]],15,["literal",[1.75,1]],16,["literal",[1,.75]],17,["literal",[.3,.3]]]}},{id:"tunnel-major-link",type:"line",metadata:{"mapbox:group":"1444855769305.6016"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["==",["get","structure"],"tunnel"],["match",["get","class"],["motorway_link","trunk_link"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],12,.5,14,2,18,18],"line-color":"hsl(187, 7%, 88%)"}},{id:"tunnel-pedestrian",type:"line",metadata:{"mapbox:group":"1444855769305.6016"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["==",["get","structure"],"tunnel"],["==",["get","class"],"pedestrian"],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],14,.5,18,12],"line-color":"hsl(187, 7%, 88%)","line-dasharray":["step",["zoom"],["literal",[1,0]],15,["literal",[1.5,.4]],16,["literal",[1,.2]]]}},{id:"tunnel-street-minor",type:"line",metadata:{"mapbox:group":"1444855769305.6016"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["==",["get","structure"],"tunnel"],["step",["zoom"],["match",["get","class"],["street","street_limited","track","primary_link"],!0,!1],14,["match",["get","class"],["street","street_limited","track","primary_link","secondary_link","tertiary_link","service"],!0,!1]],["==",["geometry-type"],"LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],12,.5,14,["match",["get","class"],["street","street_limited","primary_link"],2,"track",1,.5],18,["match",["get","class"],["street","street_limited","primary_link"],18,12]],"line-color":"hsl(187, 7%, 88%)","line-opacity":["step",["zoom"],0,14,1]}},{id:"tunnel-primary-secondary-tertiary",type:"line",metadata:{"mapbox:group":"1444855769305.6016"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["==",["get","structure"],"tunnel"],["match",["get","class"],["primary","secondary","tertiary"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],5,["match",["get","class"],"primary",.75,.1],18,["match",["get","class"],"primary",32,26]],"line-color":"hsl(187, 7%, 88%)"}},{id:"tunnel-motorway-trunk",type:"line",metadata:{"mapbox:group":"1444855769305.6016"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["==",["get","structure"],"tunnel"],["match",["get","class"],["motorway","trunk"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],5,.75,18,32],"line-color":"hsl(187, 7%, 88%)"}},{id:"road-pedestrian-case",type:"line",metadata:{"mapbox:group":"1444855786460.0557"},source:"composite","source-layer":"road",minzoom:12,filter:["all",["==",["get","class"],"pedestrian"],["match",["get","structure"],["none","ford"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],14,2,18,14.5],"line-color":"hsl(156, 12%, 92%)","line-opacity":["step",["zoom"],0,14,1]}},{id:"road-minor-low",type:"line",metadata:{"mapbox:group":"1444855786460.0557"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["step",["zoom"],["==",["get","class"],"track"],14,["match",["get","class"],["track","secondary_link","tertiary_link","service"],!0,!1]],["match",["get","structure"],["none","ford"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],14,["match",["get","class"],"track",1,.5],18,12],"line-color":"hsl(0, 0%, 100%)","line-opacity":["step",["zoom"],1,14,0]}},{id:"road-street-low",type:"line",metadata:{"mapbox:group":"1444855786460.0557"},source:"composite","source-layer":"road",minzoom:11,filter:["all",["match",["get","class"],["street","street_limited","primary_link"],!0,!1],["match",["get","structure"],["none","ford"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],12,.5,14,2,18,18],"line-color":"hsl(0, 0%, 100%)","line-opacity":["step",["zoom"],1,14,0]}},{id:"road-minor-case",type:"line",metadata:{"mapbox:group":"1444855786460.0557"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["step",["zoom"],["==",["get","class"],"track"],14,["match",["get","class"],["track","secondary_link","tertiary_link","service"],!0,!1]],["match",["get","structure"],["none","ford"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],12,.75,20,2],"line-color":"hsl(156, 12%, 92%)","line-gap-width":["interpolate",["exponential",1.5],["zoom"],14,["match",["get","class"],"track",1,.5],18,12],"line-opacity":["step",["zoom"],0,14,1]}},{id:"road-street-case",type:"line",metadata:{"mapbox:group":"1444855786460.0557"},source:"composite","source-layer":"road",minzoom:11,filter:["all",["match",["get","class"],["street","street_limited","primary_link"],!0,!1],["match",["get","structure"],["none","ford"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],12,.75,20,2],"line-color":"hsl(156, 12%, 92%)","line-gap-width":["interpolate",["exponential",1.5],["zoom"],12,.5,14,2,18,18],"line-opacity":["step",["zoom"],0,14,1]}},{id:"road-secondary-tertiary-case",type:"line",metadata:{"mapbox:group":"1444855786460.0557"},source:"composite","source-layer":"road",minzoom:9.3,filter:["all",["match",["get","class"],["secondary","tertiary"],!0,!1],["match",["get","structure"],["none","ford"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],10,.75,18,2],"line-color":"hsl(156, 12%, 92%)","line-gap-width":["interpolate",["exponential",1.5],["zoom"],5,.1,18,26]}},{id:"road-primary-case",type:"line",metadata:{"mapbox:group":"1444855786460.0557"},source:"composite","source-layer":"road",minzoom:9.9,filter:["all",["==",["get","class"],"primary"],["match",["get","structure"],["none","ford"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],10,1,18,2],"line-color":"hsl(156, 12%, 92%)","line-gap-width":["interpolate",["exponential",1.5],["zoom"],5,.75,18,32]}},{id:"road-major-link-case",type:"line",metadata:{"mapbox:group":"1444855786460.0557"},source:"composite","source-layer":"road",minzoom:10,filter:["all",["match",["get","class"],["motorway_link","trunk_link"],!0,!1],["match",["get","structure"],["none","ford"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],12,.75,20,2],"line-color":"hsl(156, 12%, 92%)","line-gap-width":["interpolate",["exponential",1.5],["zoom"],12,.5,14,2,18,18],"line-opacity":["step",["zoom"],0,11,1]}},{id:"road-motorway-trunk-case",type:"line",metadata:{"mapbox:group":"1444855786460.0557"},source:"composite","source-layer":"road",minzoom:8.5,filter:["all",["match",["get","class"],["motorway","trunk"],!0,!1],["match",["get","structure"],["none","ford"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],10,1,18,2],"line-color":"hsl(156, 12%, 92%)","line-gap-width":["interpolate",["exponential",1.5],["zoom"],5,.75,18,32],"line-opacity":["step",["zoom"],["match",["get","class"],"motorway",1,0],6,1]}},{id:"road-construction",type:"line",metadata:{"mapbox:group":"1444855786460.0557"},source:"composite","source-layer":"road",minzoom:14,filter:["all",["==",["get","class"],"construction"],["match",["get","structure"],["none","ford"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],14,2,18,18],"line-color":"hsl(0, 0%, 100%)","line-dasharray":["step",["zoom"],["literal",[.4,.8]],15,["literal",[.3,.6]],16,["literal",[.2,.3]],17,["literal",[.2,.25]],18,["literal",[.15,.15]]]}},{id:"road-path",type:"line",metadata:{"mapbox:group":"1444855786460.0557"},source:"composite","source-layer":"road",minzoom:12,filter:["all",["==",["get","class"],"path"],["step",["zoom"],["!",["match",["get","type"],["steps","sidewalk","crossing"],!0,!1]],16,["!=",["get","type"],"steps"]],["match",["get","structure"],["none","ford"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],13,.5,14,1,15,1,18,4],"line-color":"hsl(0, 0%, 100%)","line-dasharray":["step",["zoom"],["literal",[1,0]],15,["literal",[1.75,1]],16,["literal",[1,.75]],17,["literal",[1,.5]]]}},{id:"road-steps",type:"line",metadata:{"mapbox:group":"1444855786460.0557"},source:"composite","source-layer":"road",minzoom:14,filter:["all",["==",["get","type"],"steps"],["match",["get","structure"],["none","ford"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],15,1,16,1.6,18,6],"line-color":"hsl(0, 0%, 100%)","line-dasharray":["step",["zoom"],["literal",[1,0]],15,["literal",[1.75,1]],16,["literal",[1,.75]],17,["literal",[.3,.3]]]}},{id:"road-major-link",type:"line",metadata:{"mapbox:group":"1444855786460.0557"},source:"composite","source-layer":"road",minzoom:10,filter:["all",["match",["get","class"],["motorway_link","trunk_link"],!0,!1],["match",["get","structure"],["none","ford"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],12,.5,14,2,18,18],"line-color":"hsl(0, 0%, 100%)"}},{id:"road-pedestrian",type:"line",metadata:{"mapbox:group":"1444855786460.0557"},source:"composite","source-layer":"road",minzoom:12,filter:["all",["==",["get","class"],"pedestrian"],["match",["get","structure"],["none","ford"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],14,.5,18,12],"line-color":"hsl(0, 0%, 100%)","line-dasharray":["step",["zoom"],["literal",[1,0]],15,["literal",[1.5,.4]],16,["literal",[1,.2]]]}},{id:"road-minor",type:"line",metadata:{"mapbox:group":"1444855786460.0557"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["step",["zoom"],["==",["get","class"],"track"],14,["match",["get","class"],["track","secondary_link","tertiary_link","service"],!0,!1]],["match",["get","structure"],["none","ford"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],14,["match",["get","class"],"track",1,.5],18,12],"line-color":"hsl(0, 0%, 100%)","line-opacity":["step",["zoom"],0,14,1]}},{id:"road-street",type:"line",metadata:{"mapbox:group":"1444855786460.0557"},source:"composite","source-layer":"road",minzoom:11,filter:["all",["match",["get","class"],["street","street_limited","primary_link"],!0,!1],["match",["get","structure"],["none","ford"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],12,.5,14,2,18,18],"line-color":"hsl(0, 0%, 100%)","line-opacity":["step",["zoom"],0,14,1]}},{id:"road-secondary-tertiary",type:"line",metadata:{"mapbox:group":"1444855786460.0557"},source:"composite","source-layer":"road",filter:["all",["match",["get","class"],["secondary","tertiary"],!0,!1],["match",["get","structure"],["none","ford"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],5,.1,18,22],"line-color":"hsl(0, 0%, 100%)"}},{id:"road-primary",type:"line",metadata:{"mapbox:group":"1444855786460.0557"},source:"composite","source-layer":"road",minzoom:9,filter:["all",["==",["get","class"],"primary"],["match",["get","structure"],["none","ford"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round","line-cap":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],5,.75,18,32],"line-color":"#f6eac1","line-opacity":["interpolate",["linear"],["zoom"],6,0,8,["match",["get","class"],["trunk"],.2,0],16,["match",["get","class"],["trunk"],1,.81]]}},{id:"road-motorway-trunk",type:"line",metadata:{"mapbox:group":"1444855786460.0557"},source:"composite","source-layer":"road",minzoom:8,filter:["all",["match",["get","class"],["motorway","trunk"],!0,!1],["match",["get","structure"],["none","ford"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],5,.5,18,32],"line-color":["match",["get","class"],["motorway"],"hsl(26, 100%, 68%)","#f2d163"],"line-opacity":["interpolate",["linear"],["zoom"],6,["match",["get","class"],["trunk"],.3,0],8,.4,18,.7]}},{id:"road-rail",type:"line",metadata:{"mapbox:group":"1444855786460.0557"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["match",["get","class"],["major_rail","minor_rail"],!0,!1],["match",["get","structure"],["none","ford"],!0,!1]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],14,.5,20,1],"line-color":"hsl(156, 12%, 92%)"}},{id:"bridge-pedestrian-case",type:"line",metadata:{"mapbox:group":"1444855799204.86"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["==",["get","structure"],"bridge"],["==",["get","class"],"pedestrian"],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],14,2,18,14.5],"line-opacity":["step",["zoom"],0,14,1],"line-color":"hsl(156, 12%, 92%)"}},{id:"bridge-street-minor-low",type:"line",metadata:{"mapbox:group":"1444855799204.86"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["==",["get","structure"],"bridge"],["step",["zoom"],["match",["get","class"],["street","street_limited","track","primary_link"],!0,!1],14,["match",["get","class"],["street","street_limited","track","primary_link","secondary_link","tertiary_link","service"],!0,!1]],["==",["geometry-type"],"LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],12,.5,14,["match",["get","class"],["street","street_limited","primary_link"],2,"track",1,.5],18,["match",["get","class"],["street","street_limited","primary_link"],18,12]],"line-color":"hsl(0, 0%, 100%)","line-opacity":["step",["zoom"],1,14,0]}},{id:"bridge-street-minor-case",type:"line",metadata:{"mapbox:group":"1444855799204.86"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["==",["get","structure"],"bridge"],["step",["zoom"],["match",["get","class"],["street","street_limited","track","primary_link"],!0,!1],14,["match",["get","class"],["street","street_limited","track","primary_link","secondary_link","tertiary_link","service"],!0,!1]],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],12,.75,20,2],"line-opacity":["step",["zoom"],0,14,1],"line-gap-width":["interpolate",["exponential",1.5],["zoom"],12,.5,14,["match",["get","class"],["street","street_limited","primary_link"],2,"track",1,.5],18,["match",["get","class"],["street","street_limited","primary_link"],18,12]],"line-color":"hsl(156, 12%, 92%)"}},{id:"bridge-primary-secondary-tertiary-case",type:"line",metadata:{"mapbox:group":"1444855799204.86"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["==",["get","structure"],"bridge"],["match",["get","class"],["primary","secondary","tertiary"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],10,["match",["get","class"],"primary",1,.75],18,2],"line-opacity":["step",["zoom"],0,10,1],"line-gap-width":["interpolate",["exponential",1.5],["zoom"],5,["match",["get","class"],"primary",.75,.1],18,["match",["get","class"],"primary",32,26]],"line-color":"hsl(156, 12%, 92%)"}},{id:"bridge-major-link-case",type:"line",metadata:{"mapbox:group":"1444855799204.86"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["==",["get","structure"],"bridge"],["match",["get","class"],["motorway_link","trunk_link"],!0,!1],["<=",["get","layer"],1],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],12,.75,20,2],"line-gap-width":["interpolate",["exponential",1.5],["zoom"],12,.5,14,2,18,18],"line-color":"hsl(156, 12%, 92%)"}},{id:"bridge-motorway-trunk-case",type:"line",metadata:{"mapbox:group":"1444855799204.86"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["==",["get","structure"],"bridge"],["match",["get","class"],["motorway","trunk"],!0,!1],["<=",["get","layer"],1],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],10,1,18,2],"line-gap-width":["interpolate",["exponential",1.5],["zoom"],5,.75,18,32],"line-color":"hsl(156, 12%, 92%)"}},{id:"bridge-construction",type:"line",metadata:{"mapbox:group":"1444855799204.86"},source:"composite","source-layer":"road",minzoom:14,filter:["all",["==",["get","structure"],"bridge"],["==",["get","class"],"construction"],["==",["geometry-type"],"LineString"]],layout:{},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],14,2,18,18],"line-dasharray":["step",["zoom"],["literal",[.4,.8]],15,["literal",[.3,.6]],16,["literal",[.2,.3]],17,["literal",[.2,.25]],18,["literal",[.15,.15]]],"line-color":"hsl(156, 0%, 100%)"}},{id:"bridge-path",type:"line",metadata:{"mapbox:group":"1444855799204.86"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["==",["get","structure"],"bridge"],["==",["get","class"],"path"],["!=",["get","type"],"steps"],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],15,1,18,4],"line-color":"hsl(0, 0%, 100%)","line-dasharray":["step",["zoom"],["literal",[1,0]],15,["literal",[1.75,1]],16,["literal",[1,.75]],17,["literal",[1,.5]]]}},{id:"bridge-steps",type:"line",metadata:{"mapbox:group":"1444855799204.86"},source:"composite","source-layer":"road",minzoom:14,filter:["all",["==",["get","type"],"steps"],["==",["get","structure"],"bridge"],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],15,1,16,1.6,18,6],"line-color":"hsl(0, 0%, 100%)","line-dasharray":["step",["zoom"],["literal",[1,0]],15,["literal",[1.75,1]],16,["literal",[1,.75]],17,["literal",[.3,.3]]]}},{id:"bridge-major-link",type:"line",metadata:{"mapbox:group":"1444855799204.86"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["==",["get","structure"],"bridge"],["match",["get","class"],["motorway_link","trunk_link"],!0,!1],["<=",["get","layer"],1],["==",["geometry-type"],"LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],12,.5,14,2,18,18],"line-color":"hsl(0, 0%, 100%)"}},{id:"bridge-pedestrian",type:"line",metadata:{"mapbox:group":"1444855799204.86"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["==",["get","structure"],"bridge"],["==",["get","class"],"pedestrian"],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],14,.5,18,12],"line-color":"hsl(0, 0%, 100%)","line-dasharray":["step",["zoom"],["literal",[1,0]],15,["literal",[1.5,.4]],16,["literal",[1,.2]]]}},{id:"bridge-street-minor",type:"line",metadata:{"mapbox:group":"1444855799204.86"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["==",["get","structure"],"bridge"],["step",["zoom"],["match",["get","class"],["street","street_limited","track","primary_link"],!0,!1],14,["match",["get","class"],["street","street_limited","track","primary_link","secondary_link","tertiary_link","service"],!0,!1]],["==",["geometry-type"],"LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],12,.5,14,["match",["get","class"],["street","street_limited","primary_link"],2,"track",1,.5],18,["match",["get","class"],["street","street_limited","primary_link"],18,12]],"line-color":"hsl(0, 0%, 100%)","line-opacity":["step",["zoom"],0,14,1]}},{id:"bridge-primary-secondary-tertiary",type:"line",metadata:{"mapbox:group":"1444855799204.86"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["==",["get","structure"],"bridge"],["match",["get","class"],["primary","secondary","tertiary"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],5,["match",["get","class"],"primary",.75,.1],18,["match",["get","class"],"primary",32,26]],"line-color":"hsl(0, 0%, 100%)"}},{id:"bridge-motorway-trunk",type:"line",metadata:{"mapbox:group":"1444855799204.86"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["==",["get","structure"],"bridge"],["match",["get","class"],["motorway","trunk"],!0,!1],["<=",["get","layer"],1],["==",["geometry-type"],"LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],5,.75,18,32],"line-color":"hsl(0, 0%, 100%)"}},{id:"bridge-rail",type:"line",metadata:{"mapbox:group":"1444855799204.86"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["==",["get","structure"],"bridge"],["match",["get","class"],["major_rail","minor_rail"],!0,!1]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],14,.5,20,1],"line-color":"hsl(156, 12%, 92%)"}},{id:"bridge-major-link-2-case",type:"line",metadata:{"mapbox:group":"1444855799204.86"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["==",["get","structure"],"bridge"],[">=",["get","layer"],2],["match",["get","class"],["motorway_link","trunk_link"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],12,.75,20,2],"line-color":"hsl(156, 12%, 92%)","line-gap-width":["interpolate",["exponential",1.5],["zoom"],12,.5,14,2,18,18]}},{id:"bridge-motorway-trunk-2-case",type:"line",metadata:{"mapbox:group":"1444855799204.86"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["==",["get","structure"],"bridge"],[">=",["get","layer"],2],["match",["get","class"],["motorway","trunk"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],10,1,18,2],"line-color":"hsl(156, 12%, 92%)","line-gap-width":["interpolate",["exponential",1.5],["zoom"],5,.75,18,32]}},{id:"bridge-major-link-2",type:"line",metadata:{"mapbox:group":"1444855799204.86"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["==",["get","structure"],"bridge"],[">=",["get","layer"],2],["match",["get","class"],["motorway_link","trunk_link"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],12,.5,14,2,18,18],"line-color":"hsl(0, 0%, 100%)"}},{id:"bridge-motorway-trunk-2",type:"line",metadata:{"mapbox:group":"1444855799204.86"},source:"composite","source-layer":"road",minzoom:13,filter:["all",["==",["get","structure"],"bridge"],[">=",["get","layer"],2],["match",["get","class"],["motorway","trunk"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-width":["interpolate",["exponential",1.5],["zoom"],5,.75,18,32],"line-color":"hsl(0, 0%, 100%)"}},{id:"admin-1-boundary-bg",type:"line",metadata:{"mapbox:group":"1444934295202.7542"},source:"composite","source-layer":"admin",filter:["all",["==",["get","admin_level"],1],["==",["get","maritime"],"false"],["match",["get","worldview"],["all","US"],!0,!1]],layout:{"line-join":"bevel"},paint:{"line-blur":["interpolate",["linear"],["zoom"],3,0,8,3],"line-width":["interpolate",["linear"],["zoom"],7,3.75,12,5.5],"line-opacity":["interpolate",["linear"],["zoom"],7,0,8,.75],"line-dasharray":[1,0],"line-translate":[0,0],"line-color":"hsl(0, 0%, 84%)"}},{id:"admin-0-boundary-bg",type:"line",metadata:{"mapbox:group":"1444934295202.7542"},source:"composite","source-layer":"admin",minzoom:1,filter:["all",["==",["get","admin_level"],0],["==",["get","maritime"],"false"],["match",["get","worldview"],["all","US"],!0,!1]],paint:{"line-width":["interpolate",["linear"],["zoom"],3,3.5,10,8],"line-color":"hsl(0, 0%, 84%)","line-opacity":["interpolate",["linear"],["zoom"],3,0,4,.5],"line-translate":[0,0],"line-blur":["interpolate",["linear"],["zoom"],3,0,10,2]}},{id:"admin-1-boundary",type:"line",metadata:{"mapbox:group":"1444934295202.7542"},source:"composite","source-layer":"admin",filter:["all",["==",["get","admin_level"],1],["==",["get","maritime"],"false"],["match",["get","worldview"],["all","US"],!0,!1]],layout:{"line-join":"round","line-cap":"round"},paint:{"line-width":["interpolate",["linear"],["zoom"],7,.75,12,1.5],"line-opacity":["interpolate",["linear"],["zoom"],2,0,3,1],"line-color":["interpolate",["linear"],["zoom"],3,"hsl(0, 0%, 80%)",7,"hsl(0, 0%, 70%)"]}},{id:"admin-0-boundary",type:"line",metadata:{"mapbox:group":"1444934295202.7542"},source:"composite","source-layer":"admin",minzoom:1,filter:["all",["==",["get","admin_level"],0],["==",["get","disputed"],"false"],["==",["get","maritime"],"false"],["match",["get","worldview"],["all","US"],!0,!1]],layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":"hsl(0, 0%, 62%)","line-width":["interpolate",["linear"],["zoom"],3,.5,10,2]}},{id:"admin-0-boundary-disputed",type:"line",metadata:{"mapbox:group":"1444934295202.7542"},source:"composite","source-layer":"admin",minzoom:1,filter:["all",["==",["get","disputed"],"true"],["==",["get","admin_level"],0],["==",["get","maritime"],"false"],["match",["get","worldview"],["all","US"],!0,!1]],layout:{"line-join":"round"},paint:{"line-dasharray":[1.5,1.5],"line-color":"hsl(0, 0%, 62%)","line-width":["interpolate",["linear"],["zoom"],3,.5,10,2]}},{id:"county_border",type:"line",metadata:{"mapbox:group":"1444934295202.7542"},source:"composite","source-layer":"attr_county_labels_pg-155yvu",minzoom:6,maxzoom:12,paint:{"line-width":["interpolate",["linear"],["zoom"],5,.5,9,1.7,18,2],"line-color":"hsl(0, 0%, 59%)","line-opacity":["interpolate",["linear"],["zoom"],5,.2,9,.5,18,1]}},{id:"cousub_border",type:"line",source:"composite","source-layer":"attr_cousub_labels_less_pl-9lemol",minzoom:8,maxzoom:14,layout:{},paint:{"line-color":"hsl(0, 3%, 38%)","line-width":["interpolate",["linear"],["zoom"],0,1,6,1,22,1],"line-opacity":["interpolate",["linear"],["zoom"],7,.1,18,.2]}},{id:"place_border",type:"line",source:"composite","source-layer":"attr_place_labels_less_pl-0n1bxr",minzoom:8,maxzoom:14,paint:{"line-color":"hsla(0, 0%, 58%, 0.62)","line-dasharray":[3,2]}},{id:"road-label",type:"symbol",source:"composite","source-layer":"road",minzoom:10,filter:["step",["zoom"],["match",["get","class"],["motorway","trunk","primary","secondary","tertiary"],!0,!1],12,["match",["get","class"],["motorway","trunk","primary","secondary","tertiary","pedestrian","street","street_limited"],!0,!1],15,["match",["get","class"],["ferry","golf","path"],!1,!0]],layout:{"text-size":["interpolate",["linear"],["zoom"],10,["match",["get","class"],["motorway","trunk","primary","secondary","tertiary"],10,["motorway_link","trunk_link","primary_link","secondary_link","tertiary_link","pedestrian","street","street_limited"],9,6.5],18,["match",["get","class"],["motorway","trunk","primary","secondary","tertiary"],16,["motorway_link","trunk_link","primary_link","secondary_link","tertiary_link","pedestrian","street","street_limited"],14,13]],"text-max-angle":30,"text-font":["DIN Offc Pro Regular","Arial Unicode MS Regular"],"symbol-placement":"line","text-padding":1,"text-rotation-alignment":"map","text-pitch-alignment":"viewport","text-field":["coalesce",["get","name_en"],["get","name"]],"text-letter-spacing":.01},paint:{"text-color":"hsl(0, 0%, 42%)","text-halo-color":["match",["get","class"],["motorway","trunk"],"hsla(0, 0%, 100%, 0.75)","hsl(0, 0%, 100%)"],"text-halo-blur":1,"text-halo-width":.1}},{id:"waterway-label",type:"symbol",source:"composite","source-layer":"natural_label",minzoom:13,filter:["all",["match",["get","class"],["canal","river","stream"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"text-font":["DIN Offc Pro Italic","Arial Unicode MS Regular"],"text-max-angle":30,"symbol-spacing":["interpolate",["linear",1],["zoom"],15,250,17,400],"text-size":["interpolate",["linear"],["zoom"],13,12,18,16],"symbol-placement":"line","text-pitch-alignment":"viewport","text-field":["coalesce",["get","name_en"],["get","name"]]},paint:{"text-color":"hsl(187, 7%, 51%)"}},{id:"natural-line-label",type:"symbol",source:"composite","source-layer":"natural_label",minzoom:4,filter:["all",["match",["get","class"],["glacier","landform"],!0,!1],["==",["geometry-type"],"LineString"],["<=",["get","filterrank"],1]],layout:{"text-size":["step",["zoom"],["step",["get","sizerank"],18,5,12],17,["step",["get","sizerank"],18,13,12]],"text-max-angle":30,"text-field":["coalesce",["get","name_en"],["get","name"]],"text-font":["DIN Offc Pro Medium","Arial Unicode MS Regular"],"symbol-placement":"line-center","text-pitch-alignment":"viewport"},paint:{"text-halo-width":.5,"text-halo-color":"hsl(0, 0%, 100%)","text-halo-blur":.5,"text-color":"hsl(0, 0%, 42%)"}},{id:"natural-point-label",type:"symbol",source:"composite","source-layer":"natural_label",minzoom:4,filter:["all",["match",["get","class"],["dock","glacier","landform","water_feature","wetland"],!0,!1],["==",["geometry-type"],"Point"],["<=",["get","filterrank"],1]],layout:{"text-size":["step",["zoom"],["step",["get","sizerank"],18,5,12],17,["step",["get","sizerank"],18,13,12]],"text-field":["coalesce",["get","name_en"],["get","name"]],"text-font":["DIN Offc Pro Medium","Arial Unicode MS Regular"],"text-offset":["literal",[0,0]]},paint:{"text-color":"hsl(0, 0%, 42%)","text-halo-color":"hsl(0, 0%, 100%)","text-halo-width":.5,"text-halo-blur":.5}},{id:"water-line-label",type:"symbol",source:"composite","source-layer":"natural_label",filter:["all",["match",["get","class"],["bay","ocean","reservoir","sea","water"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"text-size":["interpolate",["linear"],["zoom"],7,["step",["get","sizerank"],24,6,18,12,12],10,["step",["get","sizerank"],18,9,12],18,["step",["get","sizerank"],18,9,16]],"text-max-angle":30,"text-letter-spacing":["match",["get","class"],"ocean",.25,["sea","bay"],.15,0],"text-font":["DIN Offc Pro Italic","Arial Unicode MS Regular"],"symbol-placement":"line-center","text-pitch-alignment":"viewport","text-field":["coalesce",["get","name_en"],["get","name"]]},paint:{"text-color":"hsl(187, 7%, 51%)"}},{id:"water-point-label",type:"symbol",source:"composite","source-layer":"natural_label",filter:["all",["match",["get","class"],["bay","ocean","reservoir","sea","water"],!0,!1],["==",["geometry-type"],"Point"]],layout:{"text-line-height":1.3,"text-size":["interpolate",["linear"],["zoom"],7,["step",["get","sizerank"],24,6,18,12,12],10,["step",["get","sizerank"],18,9,12]],"text-font":["DIN Offc Pro Italic","Arial Unicode MS Regular"],"text-field":["coalesce",["get","name_en"],["get","name"]],"text-letter-spacing":["match",["get","class"],"ocean",.25,["bay","sea"],.15,.01],"text-max-width":["match",["get","class"],"ocean",4,"sea",5,["bay","water"],7,10]},paint:{"text-color":"hsl(187, 7%, 51%)"}},{id:"poi-label",type:"symbol",source:"composite","source-layer":"poi_label",minzoom:6,filter:["<=",["get","filterrank"],1],layout:{"text-size":["step",["zoom"],["step",["get","sizerank"],18,5,12],17,["step",["get","sizerank"],18,13,12]],"text-font":["DIN Offc Pro Medium","Arial Unicode MS Regular"],"text-field":["coalesce",["get","name_en"],["get","name"]]},paint:{"text-halo-color":"hsl(0, 0%, 100%)","text-halo-width":.1,"text-halo-blur":.5,"text-color":["step",["zoom"],["step",["get","sizerank"],"hsl(0, 0%, 66%)",5,"hsl(230, 0%, 56%)"],17,["step",["get","sizerank"],"hsl(0, 0%, 66%)",13,"hsl(0, 0%, 56%)"]]}},{id:"airport-label",type:"symbol",source:"composite","source-layer":"airport_label",minzoom:8,layout:{"text-line-height":1.1,"text-size":["step",["get","sizerank"],18,9,12],"icon-image":["step",["get","sizerank"],["concat",["get","maki"],"-15"],9,["concat",["get","maki"],"-11"]],"text-font":["DIN Offc Pro Medium","Arial Unicode MS Regular"],visibility:"none","text-offset":[0,.75],"text-rotation-alignment":"viewport","text-anchor":"top","text-field":["step",["get","sizerank"],["coalesce",["get","name_en"],["get","name"]],15,["get","ref"]],"text-letter-spacing":.01,"text-max-width":9},paint:{"text-color":"hsla(0, 0%, 42%, 0)","text-halo-color":"hsl(0, 0%, 100%)","text-halo-width":1,"text-opacity":0}},{id:"settlement-subdivision-label",type:"symbol",source:"composite","source-layer":"place_label",minzoom:10,maxzoom:15,filter:["all",["==",["get","class"],"settlement_subdivision"],["<=",["get","filterrank"],4]],layout:{"text-field":["coalesce",["get","name_en"],["get","name"]],"text-transform":"uppercase","text-font":["DIN Offc Pro Regular","Arial Unicode MS Regular"],"text-letter-spacing":["match",["get","type"],"suburb",.15,.1],"text-max-width":7,"text-padding":3,"text-size":["interpolate",["cubic-bezier",.5,0,1,1],["zoom"],11,["match",["get","type"],"suburb",11,10.5],15,["match",["get","type"],"suburb",17,16]],visibility:"none"},paint:{"text-halo-color":"hsl(0, 0%, 100%)","text-color":"hsl(0, 0%, 62%)","text-halo-blur":.5,"text-halo-width":.1}},{id:"state-label",type:"symbol",source:"composite","source-layer":"place_label",minzoom:3,maxzoom:9,filter:["==",["get","class"],"state"],layout:{"text-size":["interpolate",["cubic-bezier",.85,.7,.65,1],["zoom"],4,["step",["get","symbolrank"],10,6,9.5,7,9],9,["step",["get","symbolrank"],24,6,18,7,14]],"text-transform":"uppercase","text-font":["DIN Offc Pro Bold","Arial Unicode MS Bold"],"text-field":["step",["zoom"],["step",["get","symbolrank"],["coalesce",["get","name_en"],["get","name"]],5,["coalesce",["get","abbr"],["get","name_en"],["get","name"]]],5,["coalesce",["get","name_en"],["get","name"]]],"text-letter-spacing":.15,"text-max-width":6},paint:{"text-halo-color":"hsl(0, 0%, 100%)","text-color":"hsl(0, 0%, 66%)","text-halo-width":.1}},{id:"county_label",type:"symbol",source:"composite","source-layer":"attr_county_labels-5i5o0f",minzoom:7.5,maxzoom:14,layout:{"text-field":["step",["zoom"],["upcase",["to-string",["get","name"]]],6,["upcase",["to-string",["get","name"]]],10,["upcase",["to-string",["get","namelsad"]]],22,["upcase",["to-string",["get","namelsad"]]]],"text-font":["step",["zoom"],["literal",["Open Sans Regular","Arial Unicode MS Regular"]],6,["literal",["Montserrat Medium","Arial Unicode MS Regular"]],8,["literal",["Montserrat Medium","Arial Unicode MS Regular"]],11,["literal",["Montserrat Medium","Arial Unicode MS Regular"]],22,["literal",["Montserrat Medium","Arial Unicode MS Regular"]]],"text-size":["interpolate",["linear"],["zoom"],0,0,6,6,6.5,10,7.5,14,9,30,11,75,14,85],"text-allow-overlap":["step",["zoom"],!1,5,!1,10,!1,11,!0],"text-max-width":5,"text-ignore-placement":["step",["zoom"],!1,6,!1,9,!0,12,!0,22,!0]},paint:{"text-color":"hsl(0, 0%, 48%)","text-opacity":["interpolate",["linear"],["zoom"],6.49999,1,6.5,.7,8,.3,11,.1,16,.05]}},{id:"cousub_label",type:"symbol",source:"composite","source-layer":"attr_cousub_labels_plus_pt-0kx5lj",minzoom:9,layout:{"text-field":["upcase",["get","display_name"]],"text-size":["interpolate",["linear"],["zoom"],7.9,0,8,8,9,10,14,30],"text-max-width":5,"text-line-height":1.1,visibility:"none"},paint:{"text-color":"hsla(0, 0%, 31%, 0.76)","text-halo-width":10,"text-halo-color":"hsl(0, 0%, 100%)"}},{id:"place-label new",type:"symbol",source:"composite","source-layer":"rural_places-4rf4i9",minzoom:9,filter:["match",["get","census_boundary_year"],[2020],!0,!1],layout:{"text-line-height":1.1,"text-size":["interpolate",["cubic-bezier",.2,0,.9,1],["zoom"],3,["step",["get","symbolrank"],12,9,11,10,10.5,12,9.5,14,8.5,16,6.5,17,4],15,["step",["get","symbolrank"],28,9,26,10,23,11,21,12,20,13,19,15,17]],"icon-image":["case",["==",["get","capital"],2],"border-dot-13",["step",["get","symbolrank"],"dot-11",9,"dot-10",11,"dot-9"]],"text-font":["Montserrat Medium","Arial Unicode MS Regular"],"text-justify":["step",["zoom"],["match",["get","text_anchor"],["left","bottom-left","top-left"],"left",["right","bottom-right","top-right"],"right","center"],8,"center"],visibility:"none","text-offset":["step",["zoom"],["match",["get","capital"],2,["match",["get","text_anchor"],"bottom",["literal",[0,-.3]],"bottom-left",["literal",[.3,-.1]],"left",["literal",[.45,.1]],"top-left",["literal",[.3,.1]],"top",["literal",[0,.3]],"top-right",["literal",[-.3,.1]],"right",["literal",[-.45,0]],"bottom-right",["literal",[-.3,-.1]],["literal",[0,-.3]]],["match",["get","text_anchor"],"bottom",["literal",[0,-.25]],"bottom-left",["literal",[.2,-.05]],"left",["literal",[.4,.05]],"top-left",["literal",[.2,.05]],"top",["literal",[0,.25]],"top-right",["literal",[-.2,.05]],"right",["literal",[-.4,.05]],"bottom-right",["literal",[-.2,-.05]],["literal",[0,-.25]]]],8,["literal",[0,0]]],"text-anchor":["step",["zoom"],["get","text_anchor"],8,"center"],"text-field":["coalesce",["get","NAME"]],"text-max-width":7},paint:{"text-color":["step",["get","symbolrank"],"hsl(0, 2%, 61%)",11,"hsl(0, 1%, 68%)",16,"hsl(0, 1%, 75%)"],"text-halo-color":"hsl(0, 0%, 100%)","icon-opacity":["step",["zoom"],1,8,0],"text-halo-blur":1,"text-halo-width":.1}},{id:"settlement-label",type:"symbol",source:"composite","source-layer":"place_label",maxzoom:10.76,filter:["all",["<=",["get","filterrank"],3],["==",["get","class"],"settlement"],["step",["zoom"],!0,12,[">=",["get","symbolrank"],11],13,[">=",["get","symbolrank"],12]]],layout:{"text-line-height":1.1,"text-size":["interpolate",["cubic-bezier",.2,0,.9,1],["zoom"],3,["step",["get","symbolrank"],12,9,11,10,10.5,12,9.5,14,8.5,16,6.5,17,4],15,["step",["get","symbolrank"],28,9,26,10,23,11,21,12,20,13,19,15,17]],"icon-image":["case",["==",["get","capital"],2],"border-dot-13",["step",["get","symbolrank"],"dot-11",9,"dot-10",11,"dot-9"]],"text-font":["step",["zoom"],["literal",["DIN Offc Pro Regular","Arial Unicode MS Regular"]],8,["step",["get","symbolrank"],["literal",["DIN Offc Pro Medium","Arial Unicode MS Regular"]],11,["literal",["DIN Offc Pro Regular","Arial Unicode MS Regular"]]],10,["step",["get","symbolrank"],["literal",["DIN Offc Pro Medium","Arial Unicode MS Regular"]],12,["literal",["DIN Offc Pro Regular","Arial Unicode MS Regular"]]],11,["step",["get","symbolrank"],["literal",["DIN Offc Pro Medium","Arial Unicode MS Regular"]],13,["literal",["DIN Offc Pro Regular","Arial Unicode MS Regular"]]],12,["step",["get","symbolrank"],["literal",["DIN Offc Pro Medium","Arial Unicode MS Regular"]],15,["literal",["DIN Offc Pro Regular","Arial Unicode MS Regular"]]],13,["literal",["DIN Offc Pro Medium","Arial Unicode MS Regular"]]],"text-justify":["step",["zoom"],["match",["get","text_anchor"],["left","bottom-left","top-left"],"left",["right","bottom-right","top-right"],"right","center"],8,"center"],"text-offset":["step",["zoom"],["match",["get","capital"],2,["match",["get","text_anchor"],"bottom",["literal",[0,-.3]],"bottom-left",["literal",[.3,-.1]],"left",["literal",[.45,.1]],"top-left",["literal",[.3,.1]],"top",["literal",[0,.3]],"top-right",["literal",[-.3,.1]],"right",["literal",[-.45,0]],"bottom-right",["literal",[-.3,-.1]],["literal",[0,-.3]]],["match",["get","text_anchor"],"bottom",["literal",[0,-.25]],"bottom-left",["literal",[.2,-.05]],"left",["literal",[.4,.05]],"top-left",["literal",[.2,.05]],"top",["literal",[0,.25]],"top-right",["literal",[-.2,.05]],"right",["literal",[-.4,.05]],"bottom-right",["literal",[-.2,-.05]],["literal",[0,-.25]]]],8,["literal",[0,0]]],"text-anchor":["step",["zoom"],["get","text_anchor"],8,"center"],"text-field":["coalesce",["get","name_en"],["get","name"]],"text-max-width":7},paint:{"text-color":["step",["get","symbolrank"],"hsl(0, 0%, 42%)",11,"hsl(0, 0%, 55%)",16,"hsl(0, 0%, 62%)"],"text-halo-color":"hsl(0, 0%, 100%)","icon-opacity":["step",["zoom"],1,8,0],"text-halo-blur":1,"text-halo-width":.1}},{id:"wwb2s-places_lat_lon",type:"symbol",source:"composite","source-layer":"places_lat_lon-awryh9",minzoom:10.75,maxzoom:20,filter:["all",[">=",["get","pop"],101],[">",["get","pct_rural"],0],["step",["zoom"],!0,13,[">=",["get","symbolrank"],11],14,[">=",["get","symbolrank"],13]]],layout:{"text-line-height":1.1,"text-size":["step",["get","symbolrank"],20,9,18,10,16,11,14,12,12],"icon-image":["case",["==",["get","capital"],2],"border-dot-13",["step",["get","symbolrank"],"dot-11",9,"dot-10",11,"dot-9"]],"text-font":["step",["zoom"],["literal",["DIN Offc Pro Regular","Arial Unicode MS Regular"]],8,["step",["get","symbolrank"],["literal",["DIN Offc Pro Medium","Arial Unicode MS Regular"]],11,["literal",["DIN Offc Pro Regular","Arial Unicode MS Regular"]]],10,["step",["get","symbolrank"],["literal",["DIN Offc Pro Medium","Arial Unicode MS Regular"]],12,["literal",["DIN Offc Pro Regular","Arial Unicode MS Regular"]]],11,["step",["get","symbolrank"],["literal",["DIN Offc Pro Medium","Arial Unicode MS Regular"]],13,["literal",["DIN Offc Pro Regular","Arial Unicode MS Regular"]]],12,["step",["get","symbolrank"],["literal",["DIN Offc Pro Medium","Arial Unicode MS Regular"]],15,["literal",["DIN Offc Pro Regular","Arial Unicode MS Regular"]]],13,["literal",["DIN Offc Pro Medium","Arial Unicode MS Regular"]]],"text-justify":["step",["zoom"],["match",["get","text_anchor"],["left","bottom-left","top-left"],"left",["right","bottom-right","top-right"],"right","center"],8,"center"],"text-offset":["step",["zoom"],["match",["get","capital"],2,["match",["get","text_anchor"],"bottom",["literal",[0,-.3]],"bottom-left",["literal",[.3,-.1]],"left",["literal",[.45,.1]],"top-left",["literal",[.3,.1]],"top",["literal",[0,.3]],"top-right",["literal",[-.3,.1]],"right",["literal",[-.45,0]],"bottom-right",["literal",[-.3,-.1]],["literal",[0,-.3]]],["match",["get","text_anchor"],"bottom",["literal",[0,-.25]],"bottom-left",["literal",[.2,-.05]],"left",["literal",[.4,.05]],"top-left",["literal",[.2,.05]],"top",["literal",[0,.25]],"top-right",["literal",[-.2,.05]],"right",["literal",[-.4,.05]],"bottom-right",["literal",[-.2,-.05]],["literal",[0,-.25]]]],8,["literal",[0,0]]],"text-anchor":["step",["zoom"],["get","text_anchor"],8,"center"],"text-field":["coalesce",["get","NAME"],["get","name"]],"text-max-width":7},paint:{"text-halo-color":"hsl(0, 0%, 100%)","icon-opacity":["step",["zoom"],1,8,0],"text-halo-blur":1,"text-halo-width":.1,"text-color":["interpolate",["linear"],["zoom"],0,"hsl(0, 0%, 62%)",22,"#000000"],"text-opacity":["interpolate",["linear"],["zoom"],7,0,9,.97,22,1]}},{id:"custom-pattern",type:"fill",source:"composite","source-layer":"attr_county_labels_pg-155yvu",minzoom:6,layout:{visibility:"none"},paint:{"fill-color":"hsla(303, 73%, 74%, 0.66)","fill-pattern":"stripe-4"}}],u$="2022-02-24T13:16:14.872Z",h$="2024-07-11T16:18:50.102Z",d$="cl010e7b7001p15pe3l0306hv",p$="ruralinno",f$="private",m$=!1,g$={version:J9,name:e$,metadata:t$,center:r$,zoom:n$,bearing:i$,pitch:o$,sources:a$,sprite:s$,glyphs:l$,layers:c$,created:u$,modified:h$,id:d$,owner:p$,visibility:f$,protected:!1,draft:m$};/* + * Frontend UI component library for the CORI Data API + * {@link https://github.com/ruralinnovation/cori.data.api} + * @copyright Rural Innovation Strategies, Inc. + * @license ISC + */Object.assign({},g$);var I3={exports:{}};(function(t,e){(function(n,a){t.exports=a()})($e,function(){var n,a,u;function d(l,w){if(!n)n=w;else if(!a)a=w;else{var T="self.onerror = function() { console.error('An error occurred while parsing the WebWorker bundle. This is most likely due to improper transpilation by Babel; please see https://docs.mapbox.com/mapbox-gl-js/guides/install/#transpiling'); }; var sharedChunk = {}; ("+n+")(sharedChunk); ("+a+")(sharedChunk); self.onerror = null;",C={};n(C),u=w(C),typeof window<"u"&&window&&window.URL&&window.URL.createObjectURL&&(u.workerUrl=window.URL.createObjectURL(new Blob([T],{type:"text/javascript"})))}}d(["exports"],function(l){var w=typeof self<"u"?self:{},T="2.15.0";let C;const P={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){if(C==null){const i=/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i;try{C={}.API_URL_REGEX!=null?new RegExp({}.API_URL_REGEX):i}catch{C=i}}return C},get API_TILEJSON_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/v[0-9]*\/.*\.json.*$)/i},get API_SPRITE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*\/sprite.*\..*$)/i},get API_FONTS_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/fonts\/v[0-9]*\/)(.*\.pbf.*$)/i},get API_STYLE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*$)/i},get API_CDN_URL_REGEX(){return/^((https?:)?\/\/)?api\.mapbox\.c(n|om)(\/mapbox-gl-js\/)(.*$)/i},get EVENTS_URL(){if(!P.API_URL)return null;try{const i=new URL(P.API_URL);return i.hostname==="api.mapbox.cn"?"https://events.mapbox.cn/events/v2":i.hostname==="api.mapbox.com"?"https://events.mapbox.com/events/v2":null}catch{return null}},SESSION_PATH:"/map-sessions/v1",FEEDBACK_URL:"https://apps.mapbox.com/feedback",TILE_URL_VERSION:"v4",RASTER_URL_PREFIX:"raster/v1",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,MAX_PARALLEL_IMAGE_REQUESTS:16},z={supported:!1,testSupport:function(i){!j&&U&&(L?V(i):W=i)}};let W,U,j=!1,L=!1;function V(i){const r=i.createTexture();i.bindTexture(i.TEXTURE_2D,r);try{if(i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,U),i.isContextLost())return;z.supported=!0}catch{}i.deleteTexture(r),j=!0}w.document&&(U=w.document.createElement("img"),U.onload=function(){W&&V(W),W=null,L=!0},U.onerror=function(){j=!0,W=null},U.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const R="01";function F(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var H=Q;function Q(i,r,o,c){this.cx=3*i,this.bx=3*(o-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*r,this.by=3*(c-r)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=r,this.p2x=o,this.p2y=c}Q.prototype={sampleCurveX:function(i){return((this.ax*i+this.bx)*i+this.cx)*i},sampleCurveY:function(i){return((this.ay*i+this.by)*i+this.cy)*i},sampleCurveDerivativeX:function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},solveCurveX:function(i,r){if(r===void 0&&(r=1e-6),i<0)return 0;if(i>1)return 1;for(var o=i,c=0;c<8;c++){var p=this.sampleCurveX(o)-i;if(Math.abs(p)p?y=o:x=o,o=.5*(x-y)+y;return o},solve:function(i,r){return this.sampleCurveY(this.solveCurveX(i,r))}};var te=F(H),se=ge;function ge(i,r){this.x=i,this.y=r}ge.prototype={clone:function(){return new ge(this.x,this.y)},add:function(i){return this.clone()._add(i)},sub:function(i){return this.clone()._sub(i)},multByPoint:function(i){return this.clone()._multByPoint(i)},divByPoint:function(i){return this.clone()._divByPoint(i)},mult:function(i){return this.clone()._mult(i)},div:function(i){return this.clone()._div(i)},rotate:function(i){return this.clone()._rotate(i)},rotateAround:function(i,r){return this.clone()._rotateAround(i,r)},matMult:function(i){return this.clone()._matMult(i)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(i){return this.x===i.x&&this.y===i.y},dist:function(i){return Math.sqrt(this.distSqr(i))},distSqr:function(i){var r=i.x-this.x,o=i.y-this.y;return r*r+o*o},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(i){return Math.atan2(this.y-i.y,this.x-i.x)},angleWith:function(i){return this.angleWithSep(i.x,i.y)},angleWithSep:function(i,r){return Math.atan2(this.x*r-this.y*i,this.x*i+this.y*r)},_matMult:function(i){var r=i[2]*this.x+i[3]*this.y;return this.x=i[0]*this.x+i[1]*this.y,this.y=r,this},_add:function(i){return this.x+=i.x,this.y+=i.y,this},_sub:function(i){return this.x-=i.x,this.y-=i.y,this},_mult:function(i){return this.x*=i,this.y*=i,this},_div:function(i){return this.x/=i,this.y/=i,this},_multByPoint:function(i){return this.x*=i.x,this.y*=i.y,this},_divByPoint:function(i){return this.x/=i.x,this.y/=i.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var i=this.y;return this.y=this.x,this.x=-i,this},_rotate:function(i){var r=Math.cos(i),o=Math.sin(i),c=o*this.x+r*this.y;return this.x=r*this.x-o*this.y,this.y=c,this},_rotateAround:function(i,r){var o=Math.cos(i),c=Math.sin(i),p=r.y+c*(this.x-r.x)+o*(this.y-r.y);return this.x=r.x+o*(this.x-r.x)-c*(this.y-r.y),this.y=p,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},ge.convert=function(i){return i instanceof ge?i:Array.isArray(i)?new ge(i[0],i[1]):i};var xe=F(se);const Ee=Math.PI/180,Be=180/Math.PI;function Fe(i){return i*Ee}function Ve(i){return i*Be}const kt=[[0,0],[1,0],[1,1],[0,1]];function Dt(i){if(i<=0)return 0;if(i>=1)return 1;const r=i*i,o=r*i;return 4*(i<.5?o:3*(i-r)+o-.75)}function Ut(i,r,o,c){const p=new te(i,r,o,c);return function(m){return p.solve(m)}}const cr=Ut(.25,.1,.25,1);function qe(i,r,o){return Math.min(o,Math.max(r,i))}function Tt(i,r,o){return(o=qe((o-i)/(r-i),0,1))*o*(3-2*o)}function gt(i,r,o){const c=o-r,p=((i-r)%c+c)%c+r;return p===r?o:p}function je(i,r,o){if(!i.length)return o(null,[]);let c=i.length;const p=new Array(i.length);let m=null;i.forEach((y,x)=>{r(y,(E,S)=>{E&&(m=E),p[x]=S,--c==0&&o(m,p)})})}function et(i){const r=[];for(const o in i)r.push(i[o]);return r}function nt(i,...r){for(const o of r)for(const c in o)i[c]=o[c];return i}let it=1;function ur(){return it++}function Xt(){return function i(r){return r?(r^Math.random()*(16>>r/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,i)}()}function Pr(i){return i<=1?1:Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function Yt(i){return!!i&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(i)}function si(i,r){i.forEach(o=>{r[o]&&(r[o]=r[o].bind(r))})}function mr(i,r){return i.indexOf(r,i.length-r.length)!==-1}function Vt(i,r,o){const c={};for(const p in i)c[p]=r.call(o||this,i[p],p,i);return c}function Ii(i,r,o){const c={};for(const p in i)r.call(o||this,i[p],p,i)&&(c[p]=i[p]);return c}function qr(i){return Array.isArray(i)?i.map(qr):typeof i=="object"&&i?Vt(i,qr):i}const pn={};function Tr(i){pn[i]||(typeof console<"u"&&console.warn(i),pn[i]=!0)}function Bn(i,r,o){return(o.y-i.y)*(r.x-i.x)>(r.y-i.y)*(o.x-i.x)}function ma(i){let r=0;for(let o,c,p=0,m=i.length,y=m-1;p@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(o,c,p,m)=>{const y=p||m;return r[c]=!y||y.toLowerCase(),""}),r["max-age"]){const o=parseInt(r["max-age"],10);isNaN(o)?delete r["max-age"]:r["max-age"]=o}return r}let bo=null;function Nn(i){if(bo==null){const r=i.navigator?i.navigator.userAgent:null;bo=!!i.safari||!(!r||!(/\b(iPad|iPhone|iPod)\b/.test(r)||r.match("Safari")&&!r.match("Chrome")))}return bo}function Un(i){try{const r=w[i];return r.setItem("_mapbox_test_",1),r.removeItem("_mapbox_test_"),!0}catch{return!1}}function Qn(i,r){return[i[4*r],i[4*r+1],i[4*r+2],i[4*r+3]]}const wo="mapbox-tiles";let Ps=500,Eo=50,jn,Wo;function Qa(){try{return w.caches}catch{}}function Go(){Qa()&&!jn&&(jn=w.caches.open(wo))}function Hi(i){const r=i.indexOf("?");if(r<0)return i;const o=function(p){const m=p.indexOf("?");return m>0?p.slice(m+1).split("&"):[]}(i),c=o.filter(p=>{const m=p.split("=");return m[0]==="language"||m[0]==="worldview"});return c.length?`${i.slice(0,r)}?${c.join("&")}`:i.slice(0,r)}let So=1/0;const ga={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};typeof Object.freeze=="function"&&Object.freeze(ga);class To extends Error{constructor(r,o,c){o===401&&Pe(c)&&(r+=": you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes"),super(r),this.status=o,this.url=c}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}const Ho=yi()?()=>self.worker&&self.worker.referrer:()=>(w.location.protocol==="blob:"?w.parent:w).location.href,ya=function(i,r){if(!(/^file:/.test(o=i.url)||/^file:/.test(Ho())&&!/^\w+:/.test(o))){if(w.fetch&&w.Request&&w.AbortController&&w.Request.prototype.hasOwnProperty("signal"))return function(c,p){const m=new w.AbortController,y=new w.Request(c.url,{method:c.method||"GET",body:c.body,credentials:c.credentials,headers:c.headers,referrer:Ho(),referrerPolicy:c.referrerPolicy,signal:m.signal});let x=!1,E=!1;const S=(k=y.url).indexOf("sku=")>0&&Pe(k);var k;c.type==="json"&&y.headers.set("Accept","application/json");const M=($,G,K)=>{if(E)return;if($&&$.message!=="SecurityError"&&Tr($.toString()),G&&K)return O(G);const ee=Date.now();w.fetch(y).then(le=>{if(le.ok){const me=S?le.clone():null;return O(le,me,ee)}return p(new To(le.statusText,le.status,c.url))}).catch(le=>{le.name!=="AbortError"&&p(new Error(`${le.message} ${c.url}`))})},O=($,G,K)=>{(c.type==="arrayBuffer"?$.arrayBuffer():c.type==="json"?$.json():$.text()).then(ee=>{E||(G&&K&&function(le,me,ce){if(Go(),!jn)return;const pe={status:me.status,statusText:me.statusText,headers:new w.Headers};me.headers.forEach((Oe,Me)=>pe.headers.set(Me,Oe));const _e=Yn(me.headers.get("Cache-Control")||"");if(_e["no-store"])return;_e["max-age"]&&pe.headers.set("Expires",new Date(ce+1e3*_e["max-age"]).toUTCString());const ye=pe.headers.get("Expires");ye&&(new Date(ye).getTime()-ce<42e4||function(Oe,Me){if(Wo===void 0)try{new Response(new ReadableStream),Wo=!0}catch{Wo=!1}Wo?Me(Oe.body):Oe.blob().then(Me)}(me,Oe=>{const Me=new w.Response(Oe,pe);Go(),jn&&jn.then(He=>He.put(Hi(le.url),Me)).catch(He=>Tr(He.message))}))}(y,G,K),x=!0,p(null,ee,$.headers.get("Cache-Control"),$.headers.get("Expires")))}).catch(ee=>{E||p(new Error(ee.message))})};return S?function($,G){if(Go(),!jn)return G(null);const K=Hi($.url);jn.then(ee=>{ee.match(K).then(le=>{const me=function(ce){if(!ce)return!1;const pe=new Date(ce.headers.get("Expires")||0),_e=Yn(ce.headers.get("Cache-Control")||"");return pe>Date.now()&&!_e["no-cache"]}(le);ee.delete(K),me&&ee.put(K,le.clone()),G(null,le,me)}).catch(G)}).catch(G)}(y,M):M(null,null),{cancel:()=>{E=!0,x||m.abort()}}}(i,r);if(yi()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,r,void 0,!0)}var o;return function(c,p){const m=new w.XMLHttpRequest;m.open(c.method||"GET",c.url,!0),c.type==="arrayBuffer"&&(m.responseType="arraybuffer");for(const y in c.headers)m.setRequestHeader(y,c.headers[y]);return c.type==="json"&&(m.responseType="text",m.setRequestHeader("Accept","application/json")),m.withCredentials=c.credentials==="include",m.onerror=()=>{p(new Error(m.statusText))},m.onload=()=>{if((m.status>=200&&m.status<300||m.status===0)&&m.response!==null){let y=m.response;if(c.type==="json")try{y=JSON.parse(m.response)}catch(x){return p(x)}p(null,y,m.getResponseHeader("Cache-Control"),m.getResponseHeader("Expires"))}else p(new To(m.statusText,m.status,c.url))},m.send(c.body),{cancel:()=>m.abort()}}(i,r)},Ja=function(i,r){return ya(nt(i,{type:"arrayBuffer"}),r)};function Ds(i){const r=w.document.createElement("a");return r.href=i,r.protocol===w.document.location.protocol&&r.host===w.document.location.host}const fe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let X,Y;X=[],Y=0;const de=function(i,r){if(z.supported&&(i.headers||(i.headers={}),i.headers.accept="image/webp,*/*"),Y>=P.MAX_PARALLEL_IMAGE_REQUESTS){const m={requestParameters:i,callback:r,cancelled:!1,cancel(){this.cancelled=!0}};return X.push(m),m}Y++;let o=!1;const c=()=>{if(!o)for(o=!0,Y--;X.length&&Y{c(),m?r(m):y&&(w.createImageBitmap?function(S,k){const M=new w.Blob([new Uint8Array(S)],{type:"image/png"});w.createImageBitmap(M).then(O=>{k(null,O)}).catch(O=>{k(new Error(`Could not load image because of ${O.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(y,(S,k)=>r(S,k,x,E)):function(S,k){const M=new w.Image,O=w.URL;M.onload=()=>{k(null,M),O.revokeObjectURL(M.src),M.onload=null,w.requestAnimationFrame(()=>{M.src=fe})},M.onerror=()=>k(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const $=new w.Blob([new Uint8Array(S)],{type:"image/png"});M.src=S.byteLength?O.createObjectURL($):fe}(y,(S,k)=>r(S,k,x,E)))});return{cancel:()=>{p.cancel(),c()}}},ve="NO_ACCESS_TOKEN";function Ae(i){return i.indexOf("mapbox:")===0}function Pe(i){return P.API_URL_REGEX.test(i)}function ke(i){return P.API_CDN_URL_REGEX.test(i)}function Te(i){return P.API_STYLE_REGEX.test(i)&&!Le(i)}function Le(i){return P.API_SPRITE_REGEX.test(i)}const dt=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function mt(i){const r=i.match(dt);if(!r)throw new Error("Unable to parse URL object");return{protocol:r[1],authority:r[2],path:r[3]||"/",params:r[4]?r[4].split("&"):[]}}function ct(i){const r=i.params.length?`?${i.params.join("&")}`:"";return`${i.protocol}://${i.authority}${i.path}${r}`}const Ft="mapbox.eventData";function jt(i){if(!i)return null;const r=i.split(".");if(!r||r.length!==3)return null;try{return JSON.parse(decodeURIComponent(w.atob(r[1]).split("").map(o=>"%"+("00"+o.charCodeAt(0).toString(16)).slice(-2)).join("")))}catch{return null}}class Wt{constructor(r){this.type=r,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(r){const o=jt(P.ACCESS_TOKEN);let c="";return c=o&&o.u?w.btoa(encodeURIComponent(o.u).replace(/%([0-9A-F]{2})/g,(p,m)=>String.fromCharCode(+("0x"+m)))):P.ACCESS_TOKEN||"",r?`${Ft}.${r}:${c}`:`${Ft}:${c}`}fetchEventData(){const r=Un("localStorage"),o=this.getStorageKey(),c=this.getStorageKey("uuid");if(r)try{const p=w.localStorage.getItem(o);p&&(this.eventData=JSON.parse(p));const m=w.localStorage.getItem(c);m&&(this.anonId=m)}catch{Tr("Unable to read from LocalStorage")}}saveEventData(){const r=Un("localStorage"),o=this.getStorageKey(),c=this.getStorageKey("uuid");if(r)try{w.localStorage.setItem(c,this.anonId),Object.keys(this.eventData).length>=1&&w.localStorage.setItem(o,JSON.stringify(this.eventData))}catch{Tr("Unable to write to LocalStorage")}}processRequests(r){}postEvent(r,o,c,p){if(!P.EVENTS_URL)return;const m=mt(P.EVENTS_URL);m.params.push(`access_token=${p||P.ACCESS_TOKEN||""}`);const y={event:this.type,created:new Date(r).toISOString()},x=o?nt(y,o):y,E={url:ct(m),headers:{"Content-Type":"text/plain"},body:JSON.stringify([x])};this.pendingRequest=function(S,k){return ya(nt(S,{method:"POST"}),k)}(E,S=>{this.pendingRequest=null,c(S),this.saveEventData(),this.processRequests(p)})}queueRequest(r,o){this.queue.push(r),this.processRequests(o)}}const Qt=new class extends Wt{constructor(i){super("appUserTurnstile"),this._customAccessToken=i}postTurnstileEvent(i,r){P.EVENTS_URL&&P.ACCESS_TOKEN&&Array.isArray(i)&&i.some(o=>Ae(o)||Pe(o))&&this.queueRequest(Date.now(),r)}processRequests(i){if(this.pendingRequest||this.queue.length===0)return;this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const r=jt(P.ACCESS_TOKEN),o=r?r.u:P.ACCESS_TOKEN;let c=o!==this.eventData.tokenU;Yt(this.anonId)||(this.anonId=Xt(),c=!0);const p=this.queue.shift();if(this.eventData.lastSuccess){const m=new Date(this.eventData.lastSuccess),y=new Date(p),x=(p-this.eventData.lastSuccess)/864e5;c=c||x>=1||x<-1||m.getDate()!==y.getDate()}else c=!0;c?this.postEvent(p,{sdkIdentifier:"mapbox-gl-js",sdkVersion:T,skuId:R,"enabled.telemetry":!1,userId:this.anonId},m=>{m||(this.eventData.lastSuccess=p,this.eventData.tokenU=o)},i):this.processRequests()}},or=Qt.postTurnstileEvent.bind(Qt),en=new class extends Wt{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(i,r,o,c){this.skuToken=r,this.errorCb=c,P.EVENTS_URL&&(o||P.ACCESS_TOKEN?this.queueRequest({id:i,timestamp:Date.now()},o):this.errorCb(new Error(ve)))}processRequests(i){if(this.pendingRequest||this.queue.length===0)return;const{id:r,timestamp:o}=this.queue.shift();r&&this.success[r]||(this.anonId||this.fetchEventData(),Yt(this.anonId)||(this.anonId=Xt()),this.postEvent(o,{sdkIdentifier:"mapbox-gl-js",sdkVersion:T,skuId:R,skuToken:this.skuToken,userId:this.anonId},c=>{c?this.errorCb(c):r&&(this.success[r]=!0)},i))}},yn=en.postMapLoadEvent.bind(en),li=new class extends Wt{constructor(){super("gljs.performance")}postPerformanceEvent(i,r){P.EVENTS_URL&&(i||P.ACCESS_TOKEN)&&this.queueRequest({timestamp:Date.now(),performanceData:r},i)}processRequests(i){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:r,performanceData:o}=this.queue.shift(),c=function(p){const m=w.performance.getEntriesByType("resource"),y=w.performance.getEntriesByType("mark"),x=function(O){const $={};if(O){for(const G in O)if(G!=="other")for(const K of O[G]){const ee=`${G}ResolveRangeMin`,le=`${G}ResolveRangeMax`,me=`${G}RequestCount`,ce=`${G}RequestCachedCount`;$[ee]=Math.min($[ee]||1/0,K.startTime),$[le]=Math.max($[le]||-1/0,K.responseEnd);const pe=_e=>{$[_e]===void 0&&($[_e]=0),++$[_e]};K.transferSize!==void 0&&K.transferSize===0&&pe(ce),pe(me)}}return $}(function(O,$){const G={};if(O)for(const K of O){const ee=$(K);G[ee]===void 0&&(G[ee]=[]),G[ee].push(K)}return G}(m,e0)),E=w.devicePixelRatio,S=w.navigator.connection||w.navigator.mozConnection||w.navigator.webkitConnection,k={counters:[],metadata:[],attributes:[]},M=(O,$,G)=>{G!=null&&O.push({name:$,value:G.toString()})};for(const O in x)M(k.counters,O,x[O]);if(p.interactionRange[0]!==1/0&&p.interactionRange[1]!==-1/0&&(M(k.counters,"interactionRangeMin",p.interactionRange[0]),M(k.counters,"interactionRangeMax",p.interactionRange[1])),y)for(const O of Object.keys(ml)){const $=ml[O],G=y.find(K=>K.name===$);G&&M(k.counters,$,G.startTime)}return M(k.counters,"visibilityHidden",p.visibilityHidden),M(k.attributes,"style",function(O){if(O)for(const $ of O){const G=$.name.split("?")[0];if(Te(G)){const K=G.split("/").slice(-2);if(K.length===2)return`mapbox://styles/${K[0]}/${K[1]}`}}}(m)),M(k.attributes,"terrainEnabled",p.terrainEnabled?"true":"false"),M(k.attributes,"fogEnabled",p.fogEnabled?"true":"false"),M(k.attributes,"projection",p.projection),M(k.attributes,"zoom",p.zoom),M(k.metadata,"devicePixelRatio",E),M(k.metadata,"connectionEffectiveType",S?S.effectiveType:void 0),M(k.metadata,"navigatorUserAgent",w.navigator.userAgent),M(k.metadata,"screenWidth",w.screen.width),M(k.metadata,"screenHeight",w.screen.height),M(k.metadata,"windowWidth",w.innerWidth),M(k.metadata,"windowHeight",w.innerHeight),M(k.metadata,"mapWidth",p.width/E),M(k.metadata,"mapHeight",p.height/E),M(k.metadata,"webglRenderer",p.renderer),M(k.metadata,"webglVendor",p.vendor),M(k.metadata,"sdkVersion",T),M(k.metadata,"sdkIdentifier","mapbox-gl-js"),k}(o);for(const p of c.metadata);for(const p of c.counters);for(const p of c.attributes);this.postEvent(r,c,()=>{},i)}},zn=li.postPerformanceEvent.bind(li),qo=new class extends Wt{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(i,r,o,c){if(!P.API_URL||!P.SESSION_PATH)return;const p=mt(P.API_URL+P.SESSION_PATH);p.params.push(`sku=${r||""}`),p.params.push(`access_token=${c||P.ACCESS_TOKEN||""}`);const m={url:ct(p),headers:{"Content-Type":"text/plain"}};this.pendingRequest=function(y,x){return ya(nt(y,{method:"GET"}),x)}(m,y=>{this.pendingRequest=null,o(y),this.saveEventData(),this.processRequests(c)})}getSessionAPI(i,r,o,c){this.skuToken=r,this.errorCb=c,P.SESSION_PATH&&P.API_URL&&(o||P.ACCESS_TOKEN?this.queueRequest({id:i,timestamp:Date.now()},o):this.errorCb(new Error(ve)))}processRequests(i){if(this.pendingRequest||this.queue.length===0)return;const{id:r,timestamp:o}=this.queue.shift();r&&this.success[r]||this.getSession(o,this.skuToken,c=>{c?this.errorCb(c):r&&(this.success[r]=!0)},i)}},Vn=qo.getSessionAPI.bind(qo),_i=new Set,ml={create:"create",load:"load",fullLoad:"fullLoad"},Zv={mark(i){w.performance.mark(i)},measure(i,r,o){w.performance.measure(i,r,o)}};function e0(i){const r=i.name.split("?")[0];return ke(r)&&r.includes("mapbox-gl.js")?"javascript":ke(r)&&r.includes("mapbox-gl.css")?"css":function(o){return P.API_FONTS_REGEX.test(o)}(r)?"fontRange":Le(r)?"sprite":Te(r)?"style":function(o){return P.API_TILEJSON_REGEX.test(o)}(r)?"tilejson":"other"}const br=w.performance;function qd(i){const r=i?i.url.toString():void 0;return br.getEntriesByName(r)}let Ic,Zd,$u,Zo;const _a={now:()=>$u!==void 0?$u:w.performance.now(),setNow(i){$u=i},restoreNow(){$u=void 0},frame(i){const r=w.requestAnimationFrame(i);return{cancel:()=>w.cancelAnimationFrame(r)}},getImageData(i,r=0){const{width:o,height:c}=i;Zo||(Zo=w.document.createElement("canvas"));const p=Zo.getContext("2d",{willReadFrequently:!0});if(!p)throw new Error("failed to create canvas 2d context");return(o>Zo.width||c>Zo.height)&&(Zo.width=o,Zo.height=c),p.clearRect(-r,-r,o+2*r,c+2*r),p.drawImage(i,0,0,o,c),p.getImageData(-r,-r,o+2*r,c+2*r)},resolveURL:i=>(Ic||(Ic=w.document.createElement("a")),Ic.href=i,Ic.href),get devicePixelRatio(){return w.devicePixelRatio},get prefersReducedMotion(){return!!w.matchMedia&&(Zd==null&&(Zd=w.matchMedia("(prefers-reduced-motion: reduce)")),Zd.matches)}};function Kd(i,r,o){o[i]&&o[i].indexOf(r)!==-1||(o[i]=o[i]||[],o[i].push(r))}function Xd(i,r,o){if(o&&o[i]){const c=o[i].indexOf(r);c!==-1&&o[i].splice(c,1)}}class Ms{constructor(r,o={}){nt(this,o),this.type=r}}class va extends Ms{constructor(r,o={}){super("error",nt({error:r},o))}}class Cc{on(r,o){return this._listeners=this._listeners||{},Kd(r,o,this._listeners),this}off(r,o){return Xd(r,o,this._listeners),Xd(r,o,this._oneTimeListeners),this}once(r,o){return o?(this._oneTimeListeners=this._oneTimeListeners||{},Kd(r,o,this._oneTimeListeners),this):new Promise(c=>this.once(r,c))}fire(r,o){typeof r=="string"&&(r=new Ms(r,o||{}));const c=r.type;if(this.listens(c)){r.target=this;const p=this._listeners&&this._listeners[c]?this._listeners[c].slice():[];for(const x of p)x.call(this,r);const m=this._oneTimeListeners&&this._oneTimeListeners[c]?this._oneTimeListeners[c].slice():[];for(const x of m)Xd(c,x,this._oneTimeListeners),x.call(this,r);const y=this._eventedParent;y&&(nt(r,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),y.fire(r))}else r instanceof va&&console.error(r.error);return this}listens(r){return!!(this._listeners&&this._listeners[r]&&this._listeners[r].length>0||this._oneTimeListeners&&this._oneTimeListeners[r]&&this._oneTimeListeners[r].length>0||this._eventedParent&&this._eventedParent.listens(r))}setEventedParent(r,o){return this._eventedParent=r,this._eventedParentData=o,this}}var Ge=JSON.parse('{"$version":8,"$root":{"version":{"required":true,"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"},"terrain":{"type":"terrain"},"fog":{"type":"fog"},"sources":{"required":true,"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string"},"transition":{"type":"transition"},"projection":{"type":"projection"},"layers":{"required":true,"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":true,"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":false},"*":{"type":"*"}},"source_raster":{"type":{"required":true,"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":false},"*":{"type":"*"}},"source_raster_dem":{"type":{"required":true,"type":"enum","values":{"raster-dem":{}}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512,"units":"pixels"},"attribution":{"type":"string"},"encoding":{"type":"enum","values":{"terrarium":{},"mapbox":{}},"default":"mapbox"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_geojson":{"type":{"required":true,"type":"enum","values":{"geojson":{}}},"data":{"type":"*"},"maxzoom":{"type":"number","default":18},"attribution":{"type":"string"},"buffer":{"type":"number","default":128,"maximum":512,"minimum":0},"filter":{"type":"*"},"tolerance":{"type":"number","default":0.375},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":50,"minimum":0},"clusterMaxZoom":{"type":"number"},"clusterMinPoints":{"type":"number"},"clusterProperties":{"type":"*"},"lineMetrics":{"type":"boolean","default":false},"generateId":{"type":"boolean","default":false},"promoteId":{"type":"promoteId"}},"source_video":{"type":{"required":true,"type":"enum","values":{"video":{}}},"urls":{"required":true,"type":"array","value":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"required":true,"type":"enum","values":{"image":{}}},"url":{"required":true,"type":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"layer":{"id":{"type":"string","required":true},"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"raster":{},"hillshade":{},"background":{},"sky":{}},"required":true},"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_sky"],"layout_background":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_sky":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_fill":{"fill-sort-key":{"type":"number","expression":{"interpolated":false,"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":false,"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"},"fill-extrusion-edge-radius":{"type":"number","private":true,"default":0,"minimum":0,"maximum":1,"property-type":"constant"}},"layout_line":{"line-cap":{"type":"enum","values":{"butt":{},"round":{},"square":{}},"default":"butt","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-join":{"type":"enum","values":{"bevel":{},"round":{},"miter":{}},"default":"miter","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"requires":[{"line-join":"miter"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-round-limit":{"type":"number","default":1.05,"requires":[{"line-join":"round"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-sort-key":{"type":"number","expression":{"interpolated":false,"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":false,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-spacing":{"type":"number","default":250,"minimum":1,"units":"pixels","requires":[{"symbol-placement":"line"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","values":{"auto":{},"viewport-y":{},"source":{}},"default":"auto","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{"type":"boolean","default":false,"requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{"type":"boolean","default":false,"requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-optional":{"type":"boolean","default":false,"requires":["icon-image","text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["icon-image"],"expression":{"interpolated":false,"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":true,"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":false,"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":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-image":{"type":"resolvedImage","tokens":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{"type":"number","default":0,"period":360,"units":"degrees","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{"type":"number","default":2,"minimum":0,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-keep-upright":{"type":"boolean","default":false,"requires":["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"requires":["icon-image"],"expression":{"interpolated":true,"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":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-field":{"type":"formatted","default":"","tokens":true,"expression":{"interpolated":false,"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":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{"type":"number","default":10,"minimum":0,"units":"ems","requires":["text-field",{"symbol-placement":["point"]}],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"units":"ems","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"units":"ems","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-justify":{"type":"enum","values":{"auto":{},"left":{},"center":{},"right":{}},"default":"center","requires":["text-field"],"expression":{"interpolated":false,"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":true,"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":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-anchor":{"type":"enum","values":{"center":{},"left":{},"right":{},"top":{},"bottom":{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},"default":"center","requires":["text-field",{"!":"text-variable-anchor"}],"expression":{"interpolated":false,"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":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":{},"vertical":{}},"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-rotate":{"type":"number","default":0,"period":360,"units":"degrees","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-padding":{"type":"number","default":2,"minimum":0,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-keep-upright":{"type":"boolean","default":true,"requires":["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-transform":{"type":"enum","values":{"none":{},"uppercase":{},"lowercase":{}},"default":"none","requires":["text-field"],"expression":{"interpolated":false,"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":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{"type":"boolean","default":false,"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{"type":"boolean","default":false,"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-optional":{"type":"boolean","default":false,"requires":["text-field","icon-image"],"expression":{"interpolated":false,"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_symbol":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature","pitch","distance-from-center"]}},"filter_fill":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_line":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_circle":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_fill-extrusion":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_heatmap":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_operator":{"type":"enum","values":{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},"in":{},"!in":{},"all":{},"any":{},"none":{},"has":{},"!has":{},"within":{}}},"geometry_type":{"type":"enum","values":{"Point":{},"LineString":{},"Polygon":{}}},"function":{"expression":{"type":"expression"},"stops":{"type":"array","value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"type":{"type":"enum","values":{"identity":{},"exponential":{},"interval":{},"categorical":{}},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":{},"lab":{},"hcl":{}},"default":"rgb"},"default":{"type":"*","required":false}},"function_stop":{"type":"array","minimum":0,"maximum":24,"value":["number","color"],"length":2},"expression":{"type":"array","value":"*","minimum":1},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"high-color":{"type":"color","property-type":"data-constant","default":"#245cdf","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"space-color":{"type":"color","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"horizon-blend":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"star-intensity":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":{},"viewport":{}},"property-type":"data-constant","transition":false,"expression":{"interpolated":false,"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":{},"equalEarth":{},"equirectangular":{},"lambertConformalConic":{},"mercator":{},"naturalEarth":{},"winkelTripel":{},"globe":{}},"default":"mercator","required":true},"center":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-180,-90],"maximum":[180,90],"transition":false,"requires":[{"name":["albers","lambertConformalConic"]}]},"parallels":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-90,-90],"maximum":[90,90],"transition":false,"requires":[{"name":["albers","lambertConformalConic"]}]}},"terrain":{"source":{"type":"string","required":true},"exaggeration":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true,"requires":["source"]}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background","paint_sky"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"fill-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","transition":true,"requires":[{"!":"fill-pattern"},{"fill-antialias":true}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["fill-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-pattern":{"type":"resolvedImage","transition":false,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"fill-extrusion-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["fill-extrusion-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{"type":"resolvedImage","transition":false,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"units":"meters","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"units":"meters","transition":true,"requires":["fill-extrusion-height"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-ambient-occlusion-intensity":{"property-type":"data-constant","type":"number","private":true,"default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-radius":{"property-type":"data-constant","type":"number","private":true,"default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true,"requires":["fill-extrusion-edge-radius"]},"fill-extrusion-rounded-roof":{"type":"boolean","default":true,"requires":["fill-extrusion-edge-radius"],"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"line-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["line-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"transition":false,"units":"line widths","requires":[{"!":"line-pattern"}],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern":{"type":"resolvedImage","transition":false,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-gradient":{"type":"color","transition":false,"requires":[{"!":"line-pattern"},{"source":"geojson","has":{"lineMetrics":true}}],"expression":{"interpolated":true,"parameters":["line-progress"]},"property-type":"color-ramp"},"line-trim-offset":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"transition":false,"requires":[{"source":"geojson","has":{"lineMetrics":true}}],"property-type":"constant"}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["circle-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{}},"default":"viewport","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"transition":false,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"heatmap-color":{"type":"color","default":["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],"transition":false,"expression":{"interpolated":true,"parameters":["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{"type":"color","default":"#000000","transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["icon-image","icon-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{"type":"color","default":"#000000","transition":true,"overridable":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["text-field","text-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"units":"degrees","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-resampling":{"type":"enum","values":{"linear":{},"nearest":{}},"default":"linear","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"transition":false,"units":"milliseconds","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"transition":false,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"viewport","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_background":{"background-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"background-pattern"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"background-pattern":{"type":"resolvedImage","transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":{},"atmosphere":{}},"default":"atmosphere","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"units":"degrees","minimum":[0,0],"maximum":[360,180],"transition":false,"requires":[{"sky-type":"atmosphere"}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun-intensity":{"type":"number","requires":[{"sky-type":"atmosphere"}],"default":10,"minimum":0,"maximum":100,"transition":false,"property-type":"data-constant"},"sky-gradient-center":{"type":"array","requires":[{"sky-type":"gradient"}],"value":"number","default":[0,0],"length":2,"units":"degrees","minimum":[0,0],"maximum":[360,180],"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient-radius":{"type":"number","requires":[{"sky-type":"gradient"}],"default":90,"minimum":0,"maximum":180,"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"transition":false,"requires":[{"sky-type":"gradient"}],"expression":{"interpolated":true,"parameters":["sky-radial-progress"]},"property-type":"color-ramp"},"sky-atmosphere-halo-color":{"type":"color","default":"white","transition":false,"requires":[{"sky-type":"atmosphere"}],"property-type":"data-constant"},"sky-atmosphere-color":{"type":"color","default":"white","transition":false,"requires":[{"sky-type":"atmosphere"}],"property-type":"data-constant"},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"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"},"color-ramp":{"type":"property-type"},"data-constant":{"type":"property-type"},"constant":{"type":"property-type"}},"promoteId":{"*":{"type":"string"}}}');function xa(i,...r){for(const o of r)for(const c in o)i[c]=o[c];return i}function _n(i){return i instanceof Number||i instanceof String||i instanceof Boolean?i.valueOf():i}function $n(i){if(Array.isArray(i))return i.map($n);if(i instanceof Object&&!(i instanceof Number||i instanceof String||i instanceof Boolean)){const r={};for(const o in i)r[o]=$n(i[o]);return r}return _n(i)}class t0 extends Error{constructor(r,o){super(o),this.message=o,this.key=r}}var Ko=t0;class Yd{constructor(r,o=[]){this.parent=r,this.bindings={};for(const[c,p]of o)this.bindings[c]=p}concat(r){return new Yd(this,r)}get(r){if(this.bindings[r])return this.bindings[r];if(this.parent)return this.parent.get(r);throw new Error(`${r} not found in scope.`)}has(r){return!!this.bindings[r]||!!this.parent&&this.parent.has(r)}}var r0=Yd;const gl={kind:"null"},bt={kind:"number"},ir={kind:"string"},tr={kind:"boolean"},qi={kind:"color"},Ao={kind:"object"},rr={kind:"value"},Zi={kind:"collator"},kc={kind:"formatted"},zs={kind:"resolvedImage"};function ro(i,r){return{kind:"array",itemType:i,N:r}}function Xr(i){if(i.kind==="array"){const r=Xr(i.itemType);return typeof i.N=="number"?`array<${r}, ${i.N}>`:i.itemType.kind==="value"?"array":`array<${r}>`}return i.kind}const n0=[gl,bt,ir,tr,qi,kc,Ao,ro(rr),zs];function ba(i,r){if(r.kind==="error")return null;if(i.kind==="array"){if(r.kind==="array"&&(r.N===0&&r.itemType.kind==="value"||!ba(i.itemType,r.itemType))&&(typeof i.N!="number"||i.N===r.N))return null}else{if(i.kind===r.kind)return null;if(i.kind==="value"){for(const o of n0)if(!ba(o,r))return null}}return`Expected ${Xr(i)} but found ${Xr(r)} instead.`}function Pc(i,r){return r.some(o=>o.kind===i.kind)}function Dc(i,r){return r.some(o=>o==="null"?i===null:o==="array"?Array.isArray(i):o==="object"?i&&!Array.isArray(i)&&typeof i=="object":o===typeof i)}var Qd,i0={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function Mc(i){return(i=Math.round(i))<0?0:i>255?255:i}function zc(i){return Mc(i[i.length-1]==="%"?parseFloat(i)/100*255:parseInt(i))}function Wu(i){return(r=i[i.length-1]==="%"?parseFloat(i)/100:parseFloat(i))<0?0:r>1?1:r;var r}function yl(i,r,o){return o<0?o+=1:o>1&&(o-=1),6*o<1?i+(r-i)*o*6:2*o<1?r:3*o<2?i+(r-i)*(2/3-o)*6:i}try{Qd={}.parseCSSColor=function(i){var r,o=i.replace(/ /g,"").toLowerCase();if(o in i0)return i0[o].slice();if(o[0]==="#")return o.length===4?(r=parseInt(o.substr(1),16))>=0&&r<=4095?[(3840&r)>>4|(3840&r)>>8,240&r|(240&r)>>4,15&r|(15&r)<<4,1]:null:o.length===7&&(r=parseInt(o.substr(1),16))>=0&&r<=16777215?[(16711680&r)>>16,(65280&r)>>8,255&r,1]:null;var c=o.indexOf("("),p=o.indexOf(")");if(c!==-1&&p+1===o.length){var m=o.substr(0,c),y=o.substr(c+1,p-(c+1)).split(","),x=1;switch(m){case"rgba":if(y.length!==4)return null;x=Wu(y.pop());case"rgb":return y.length!==3?null:[zc(y[0]),zc(y[1]),zc(y[2]),x];case"hsla":if(y.length!==4)return null;x=Wu(y.pop());case"hsl":if(y.length!==3)return null;var E=(parseFloat(y[0])%360+360)%360/360,S=Wu(y[1]),k=Wu(y[2]),M=k<=.5?k*(S+1):k+S-k*S,O=2*k-M;return[Mc(255*yl(O,M,E+1/3)),Mc(255*yl(O,M,E)),Mc(255*yl(O,M,E-1/3)),x];default:return null}}return null}}catch{}class Ci{constructor(r,o,c,p=1){this.r=r,this.g=o,this.b=c,this.a=p}static parse(r){if(!r)return;if(r instanceof Ci)return r;if(typeof r!="string")return;const o=Qd(r);return o?new Ci(o[0]/255*o[3],o[1]/255*o[3],o[2]/255*o[3],o[3]):void 0}toString(){const[r,o,c,p]=this.toArray();return`rgba(${Math.round(r)},${Math.round(o)},${Math.round(c)},${p})`}toArray(){const{r,g:o,b:c,a:p}=this;return p===0?[0,0,0,0]:[255*r/p,255*o/p,255*c/p,p]}toArray01(){const{r,g:o,b:c,a:p}=this;return p===0?[0,0,0,0]:[r/p,o/p,c/p,p]}toArray01PremultipliedAlpha(){const{r,g:o,b:c,a:p}=this;return[r,o,c,p]}}Ci.black=new Ci(0,0,0,1),Ci.white=new Ci(1,1,1,1),Ci.transparent=new Ci(0,0,0,0),Ci.red=new Ci(1,0,0,1),Ci.blue=new Ci(0,0,1,1);var fn=Ci;class Jd{constructor(r,o,c){this.sensitivity=r?o?"variant":"case":o?"accent":"base",this.locale=c,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(r,o){return this.collator.compare(r,o)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class ep{constructor(r,o,c,p,m){this.text=r.normalize?r.normalize():r,this.image=o,this.scale=c,this.fontStack=p,this.textColor=m}}class ki{constructor(r){this.sections=r}static fromString(r){return new ki([new ep(r,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(r=>r.text.length!==0||r.image&&r.image.name.length!==0)}static factory(r){return r instanceof ki?r:ki.fromString(r)}toString(){return this.sections.length===0?"":this.sections.map(r=>r.text).join("")}serialize(){const r=["format"];for(const o of this.sections){if(o.image){r.push(["image",o.image.name]);continue}r.push(o.text);const c={};o.fontStack&&(c["text-font"]=["literal",o.fontStack.split(",")]),o.scale&&(c["font-scale"]=o.scale),o.textColor&&(c["text-color"]=["rgba"].concat(o.textColor.toArray())),r.push(c)}return r}}class no{constructor(r){this.name=r.name,this.available=r.available}toString(){return this.name}static fromString(r){return r?new no({name:r,available:!1}):null}serialize(){return["image",this.name]}}function o0(i,r,o,c){return typeof i=="number"&&i>=0&&i<=255&&typeof r=="number"&&r>=0&&r<=255&&typeof o=="number"&&o>=0&&o<=255?c===void 0||typeof c=="number"&&c>=0&&c<=1?null:`Invalid rgba value [${[i,r,o,c].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof c=="number"?[i,r,o,c]:[i,r,o]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Rc(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof fn||i instanceof Jd||i instanceof ki||i instanceof no)return!0;if(Array.isArray(i)){for(const r of i)if(!Rc(r))return!1;return!0}if(typeof i=="object"){for(const r in i)if(!Rc(i[r]))return!1;return!0}return!1}function ln(i){if(i===null)return gl;if(typeof i=="string")return ir;if(typeof i=="boolean")return tr;if(typeof i=="number")return bt;if(i instanceof fn)return qi;if(i instanceof Jd)return Zi;if(i instanceof ki)return kc;if(i instanceof no)return zs;if(Array.isArray(i)){const r=i.length;let o;for(const c of i){const p=ln(c);if(o){if(o===p)continue;o=rr;break}o=p}return ro(o||rr,r)}return Ao}function Oc(i){const r=typeof i;return i===null?"":r==="string"||r==="number"||r==="boolean"?String(i):i instanceof fn||i instanceof ki||i instanceof no?i.toString():JSON.stringify(i)}class tp{constructor(r,o){this.type=r,this.value=o}static parse(r,o){if(r.length!==2)return o.error(`'literal' expression requires exactly one argument, but found ${r.length-1} instead.`);if(!Rc(r[1]))return o.error("invalid value");const c=r[1];let p=ln(c);const m=o.expectedType;return p.kind!=="array"||p.N!==0||!m||m.kind!=="array"||typeof m.N=="number"&&m.N!==0||(p=m),new tp(p,c)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return this.type.kind==="array"||this.type.kind==="object"?["literal",this.value]:this.value instanceof fn?["rgba"].concat(this.value.toArray()):this.value instanceof ki?this.value.serialize():this.value}}var Rs=tp,Jn=class{constructor(i){this.name="ExpressionEvaluationError",this.message=i}toJSON(){return this.message}};const rp={string:ir,number:bt,boolean:tr,object:Ao};class np{constructor(r,o){this.type=r,this.args=o}static parse(r,o){if(r.length<2)return o.error("Expected at least one argument.");let c,p=1;const m=r[0];if(m==="array"){let x,E;if(r.length>2){const S=r[1];if(typeof S!="string"||!(S in rp)||S==="object")return o.error('The item type argument of "array" must be one of string, number, boolean',1);x=rp[S],p++}else x=rr;if(r.length>3){if(r[2]!==null&&(typeof r[2]!="number"||r[2]<0||r[2]!==Math.floor(r[2])))return o.error('The length argument to "array" must be a positive integer literal',2);E=r[2],p++}c=ro(x,E)}else c=rp[m];const y=[];for(;pr.outputDefined())}serialize(){const r=this.type,o=[r.kind];if(r.kind==="array"){const c=r.itemType;if(c.kind==="string"||c.kind==="number"||c.kind==="boolean"){o.push(c.kind);const p=r.N;(typeof p=="number"||this.args.length>1)&&o.push(p)}}return o.concat(this.args.map(c=>c.serialize()))}}var wa=np;class es{constructor(r){this.type=kc,this.sections=r}static parse(r,o){if(r.length<2)return o.error("Expected at least one argument.");const c=r[1];if(!Array.isArray(c)&&typeof c=="object")return o.error("First argument must be an image or text section.");const p=[];let m=!1;for(let y=1;y<=r.length-1;++y){const x=r[y];if(m&&typeof x=="object"&&!Array.isArray(x)){m=!1;let E=null;if(x["font-scale"]&&(E=o.parse(x["font-scale"],1,bt),!E))return null;let S=null;if(x["text-font"]&&(S=o.parse(x["text-font"],1,ro(ir)),!S))return null;let k=null;if(x["text-color"]&&(k=o.parse(x["text-color"],1,qi),!k))return null;const M=p[p.length-1];M.scale=E,M.font=S,M.textColor=k}else{const E=o.parse(r[y],1,rr);if(!E)return null;const S=E.type.kind;if(S!=="string"&&S!=="value"&&S!=="null"&&S!=="resolvedImage")return o.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");m=!0,p.push({content:E,scale:null,font:null,textColor:null})}}return new es(p)}evaluate(r){return new ki(this.sections.map(o=>{const c=o.content.evaluate(r);return ln(c)===zs?new ep("",c,null,null,null):new ep(Oc(c),null,o.scale?o.scale.evaluate(r):null,o.font?o.font.evaluate(r).join(","):null,o.textColor?o.textColor.evaluate(r):null)}))}eachChild(r){for(const o of this.sections)r(o.content),o.scale&&r(o.scale),o.font&&r(o.font),o.textColor&&r(o.textColor)}outputDefined(){return!1}serialize(){const r=["format"];for(const o of this.sections){r.push(o.content.serialize());const c={};o.scale&&(c["font-scale"]=o.scale.serialize()),o.font&&(c["text-font"]=o.font.serialize()),o.textColor&&(c["text-color"]=o.textColor.serialize()),r.push(c)}return r}}class Gu{constructor(r){this.type=zs,this.input=r}static parse(r,o){if(r.length!==2)return o.error("Expected two arguments.");const c=o.parse(r[1],1,ir);return c?new Gu(c):o.error("No image name provided.")}evaluate(r){const o=this.input.evaluate(r),c=no.fromString(o);return c&&r.availableImages&&(c.available=r.availableImages.indexOf(o)>-1),c}eachChild(r){r(this.input)}outputDefined(){return!1}serialize(){return["image",this.input.serialize()]}}const Kv={"to-boolean":tr,"to-color":qi,"to-number":bt,"to-string":ir};class ip{constructor(r,o){this.type=r,this.args=o}static parse(r,o){if(r.length<2)return o.error("Expected at least one argument.");const c=r[0];if((c==="to-boolean"||c==="to-string")&&r.length!==2)return o.error("Expected one argument.");const p=Kv[c],m=[];for(let y=1;y4?`Invalid rbga value ${JSON.stringify(o)}: expected an array containing either three or four numeric values.`:o0(o[0],o[1],o[2],o[3]),!c))return new fn(o[0]/255,o[1]/255,o[2]/255,o[3])}throw new Jn(c||`Could not parse color from value '${typeof o=="string"?o:String(JSON.stringify(o))}'`)}if(this.type.kind==="number"){let o=null;for(const c of this.args){if(o=c.evaluate(r),o===null)return 0;const p=Number(o);if(!isNaN(p))return p}throw new Jn(`Could not convert ${JSON.stringify(o)} to number.`)}return this.type.kind==="formatted"?ki.fromString(Oc(this.args[0].evaluate(r))):this.type.kind==="resolvedImage"?no.fromString(Oc(this.args[0].evaluate(r))):Oc(this.args[0].evaluate(r))}eachChild(r){this.args.forEach(r)}outputDefined(){return this.args.every(r=>r.outputDefined())}serialize(){if(this.type.kind==="formatted")return new es([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if(this.type.kind==="resolvedImage")return new Gu(this.args[0]).serialize();const r=[`to-${this.type.kind}`];return this.eachChild(o=>{r.push(o.serialize())}),r}}var _l=ip;const Xo=["Unknown","Point","LineString","Polygon"];var op=class{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null}id(){return this.feature&&this.feature.id!==void 0?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?Xo[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||{}}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const i=this.featureDistanceData.center,r=this.featureDistanceData.scale,{x:o,y:c}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(o*r-i[0])+this.featureDistanceData.bearing[1]*(c*r-i[1])}return 0}parseColor(i){let r=this._parseColorCache[i];return r||(r=this._parseColorCache[i]=fn.parse(i)),r}};class Os{constructor(r,o,c,p){this.name=r,this.type=o,this._evaluate=c,this.args=p}evaluate(r){return this._evaluate(r,this.args)}eachChild(r){this.args.forEach(r)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map(r=>r.serialize()))}static parse(r,o){const c=r[0],p=Os.definitions[c];if(!p)return o.error(`Unknown expression "${c}". If you wanted a literal array, use ["literal", [...]].`,0);const m=Array.isArray(p)?p[0]:p.type,y=Array.isArray(p)?[[p[1],p[2]]]:p.overloads,x=y.filter(([S])=>!Array.isArray(S)||S.length===r.length-1);let E=null;for(const[S,k]of x){E=new hp(o.registry,o.path,null,o.scope);const M=[];let O=!1;for(let $=1;${return O=M,Array.isArray(O)?`(${O.map(Xr).join(", ")})`:`(${Xr(O.type)}...)`;var O}).join(" | "),k=[];for(let M=1;M=r[2]||i[1]<=r[1]||i[3]>=r[3])}function Lc(i,r){const o=(180+i[0])/360,c=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i[1]*Math.PI/360)))/360,p=Math.pow(2,r.z);return[Math.round(o*p*Sa),Math.round(c*p*Sa)]}function a0(i,r,o){const c=i[0]-r[0],p=i[1]-r[1],m=i[0]-o[0],y=i[1]-o[1];return c*y-m*p==0&&c*m<=0&&p*y<=0}function qu(i,r){let o=!1;for(let y=0,x=r.length;y(c=i)[1]!=(m=E[S+1])[1]>c[1]&&c[0]<(m[0]-p[0])*(c[1]-p[1])/(m[1]-p[1])+p[0]&&(o=!o)}}var c,p,m;return o}function ap(i,r){for(let o=0;o0&&x<0||y<0&&x>0}function xl(i,r,o){for(const S of o)for(let k=0;ko[2]){const p=.5*c;let m=i[0]-o[0]>p?-c:o[0]-i[0]>p?c:0;m===0&&(m=i[0]-o[2]>p?-c:o[2]-i[0]>p?c:0),i[0]+=m}Hu(r,i)}function l0(i,r,o,c){const p=Math.pow(2,c.z)*Sa,m=[c.x*Sa,c.y*Sa],y=[];if(!i)return y;for(const x of i)for(const E of x){const S=[E.x+m[0],E.y+m[1]];cp(S,r,o,p),y.push(S)}return y}function up(i,r,o,c){const p=Math.pow(2,c.z)*Sa,m=[c.x*Sa,c.y*Sa],y=[];if(!i)return y;for(const E of i){const S=[];for(const k of E){const M=[k.x+m[0],k.y+m[1]];Hu(r,M),S.push(M)}y.push(S)}if(r[2]-r[0]<=p/2){(x=r)[0]=x[1]=1/0,x[2]=x[3]=-1/0;for(const E of y)for(const S of E)cp(S,r,o,p)}var x;return y}class bl{constructor(r,o){this.type=tr,this.geojson=r,this.geometries=o}static parse(r,o){if(r.length!==2)return o.error(`'within' expression requires exactly one argument, but found ${r.length-1} instead.`);if(Rc(r[1])){const c=r[1];if(c.type==="FeatureCollection")for(let p=0;p{r&&!wl(o)&&(r=!1)}),r}function Ta(i){if(i instanceof Ea&&i.name==="feature-state")return!1;let r=!0;return i.eachChild(o=>{r&&!Ta(o)&&(r=!1)}),r}function Fs(i,r){if(i instanceof Ea&&r.indexOf(i.name)>=0)return!1;let o=!0;return i.eachChild(c=>{o&&!Fs(c,r)&&(o=!1)}),o}class Ku{constructor(r,o){this.type=o.type,this.name=r,this.boundExpression=o}static parse(r,o){if(r.length!==2||typeof r[1]!="string")return o.error("'var' expression requires exactly one string literal argument.");const c=r[1];return o.scope.has(c)?new Ku(c,o.scope.get(c)):o.error(`Unknown variable "${c}". Make sure "${c}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(r){return this.boundExpression.evaluate(r)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}var c0=Ku;class Bc{constructor(r,o=[],c,p=new r0,m=[]){this.registry=r,this.path=o,this.key=o.map(y=>`[${y}]`).join(""),this.scope=p,this.errors=m,this.expectedType=c}parse(r,o,c,p,m={}){return o?this.concat(o,c,p)._parse(r,m):this._parse(r,m)}_parse(r,o){function c(p,m,y){return y==="assert"?new wa(m,[p]):y==="coerce"?new _l(m,[p]):p}if(r!==null&&typeof r!="string"&&typeof r!="boolean"&&typeof r!="number"||(r=["literal",r]),Array.isArray(r)){if(r.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const p=r[0];if(typeof p!="string")return this.error(`Expression name must be a string, but found ${typeof p} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const m=this.registry[p];if(m){let y=m.parse(r,this);if(!y)return null;if(this.expectedType){const x=this.expectedType,E=y.type;if(x.kind!=="string"&&x.kind!=="number"&&x.kind!=="boolean"&&x.kind!=="object"&&x.kind!=="array"||E.kind!=="value")if(x.kind!=="color"&&x.kind!=="formatted"&&x.kind!=="resolvedImage"||E.kind!=="value"&&E.kind!=="string"){if(this.checkSubtype(x,E))return null}else y=c(y,x,o.typeAnnotation||"coerce");else y=c(y,x,o.typeAnnotation||"assert")}if(!(y instanceof Rs)&&y.type.kind!=="resolvedImage"&&dp(y)){const x=new op;try{y=new Rs(y.type,y.evaluate(x))}catch(E){return this.error(E.message),null}}return y}return this.error(`Unknown expression "${p}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(r===void 0?"'undefined' value invalid. Use null instead.":typeof r=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof r} instead.`)}concat(r,o,c){const p=typeof r=="number"?this.path.concat(r):this.path,m=c?this.scope.concat(c):this.scope;return new Bc(this.registry,p,o||null,m,this.errors)}error(r,...o){const c=`${this.key}${o.map(p=>`[${p}]`).join("")}`;this.errors.push(new Ko(c,r))}checkSubtype(r,o){const c=ba(r,o);return c&&this.error(c),c}}var hp=Bc;function dp(i){if(i instanceof c0)return dp(i.boundExpression);if(i instanceof Ea&&i.name==="error"||i instanceof Fc||i instanceof Zu)return!1;const r=i instanceof _l||i instanceof wa;let o=!0;return i.eachChild(c=>{o=r?o&&dp(c):o&&c instanceof Rs}),!!o&&wl(i)&&Fs(i,["zoom","heatmap-density","line-progress","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center"])}function Xu(i,r){const o=i.length-1;let c,p,m=0,y=o,x=0;for(;m<=y;)if(x=Math.floor((m+y)/2),c=i[x],p=i[x+1],c<=r){if(x===o||rr))throw new Jn("Input is not a number.");y=x-1}return 0}class Yu{constructor(r,o,c){this.type=r,this.input=o,this.labels=[],this.outputs=[];for(const[p,m]of c)this.labels.push(p),this.outputs.push(m)}static parse(r,o){if(r.length-1<4)return o.error(`Expected at least 4 arguments, but found only ${r.length-1}.`);if((r.length-1)%2!=0)return o.error("Expected an even number of arguments.");const c=o.parse(r[1],1,bt);if(!c)return null;const p=[];let m=null;o.expectedType&&o.expectedType.kind!=="value"&&(m=o.expectedType);for(let y=1;y=x)return o.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',S);const M=o.parse(E,k,m);if(!M)return null;m=m||M.type,p.push([x,M])}return new Yu(m,c,p)}evaluate(r){const o=this.labels,c=this.outputs;if(o.length===1)return c[0].evaluate(r);const p=this.input.evaluate(r);if(p<=o[0])return c[0].evaluate(r);const m=o.length;return p>=o[m-1]?c[m-1].evaluate(r):c[Xu(o,p)].evaluate(r)}eachChild(r){r(this.input);for(const o of this.outputs)r(o)}outputDefined(){return this.outputs.every(r=>r.outputDefined())}serialize(){const r=["step",this.input.serialize()];for(let o=0;o0&&r.push(this.labels[o]),r.push(this.outputs[o].serialize());return r}}var pp=Yu;function dr(i,r,o){return i*(1-o)+r*o}var Nc=Object.freeze({__proto__:null,array:function(i,r,o){return i.map((c,p)=>dr(c,r[p],o))},color:function(i,r,o){return new fn(dr(i.r,r.r,o),dr(i.g,r.g,o),dr(i.b,r.b,o),dr(i.a,r.a,o))},number:dr});const u0=.95047,fp=1.08883,h0=4/29,Ls=6/29,mp=3*Ls*Ls,Yv=Ls*Ls*Ls,Qv=Math.PI/180,Jv=180/Math.PI;function gp(i){return i>Yv?Math.pow(i,1/3):i/mp+h0}function yp(i){return i>Ls?i*i*i:mp*(i-h0)}function _p(i){return 255*(i<=.0031308?12.92*i:1.055*Math.pow(i,1/2.4)-.055)}function Qu(i){return(i/=255)<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function d0(i){const r=Qu(i.r),o=Qu(i.g),c=Qu(i.b),p=gp((.4124564*r+.3575761*o+.1804375*c)/u0),m=gp((.2126729*r+.7151522*o+.072175*c)/1);return{l:116*m-16,a:500*(p-m),b:200*(m-gp((.0193339*r+.119192*o+.9503041*c)/fp)),alpha:i.a}}function p0(i){let r=(i.l+16)/116,o=isNaN(i.a)?r:r+i.a/500,c=isNaN(i.b)?r:r-i.b/200;return r=1*yp(r),o=u0*yp(o),c=fp*yp(c),new fn(_p(3.2404542*o-1.5371385*r-.4985314*c),_p(-.969266*o+1.8760108*r+.041556*c),_p(.0556434*o-.2040259*r+1.0572252*c),i.alpha)}function ex(i,r,o){const c=r-i;return i+o*(c>180||c<-180?c-360*Math.round(c/360):c)}const Uc={forward:d0,reverse:p0,interpolate:function(i,r,o){return{l:dr(i.l,r.l,o),a:dr(i.a,r.a,o),b:dr(i.b,r.b,o),alpha:dr(i.alpha,r.alpha,o)}}},El={forward:function(i){const{l:r,a:o,b:c}=d0(i),p=Math.atan2(c,o)*Jv;return{h:p<0?p+360:p,c:Math.sqrt(o*o+c*c),l:r,alpha:i.a}},reverse:function(i){const r=i.h*Qv,o=i.c;return p0({l:i.l,a:Math.cos(r)*o,b:Math.sin(r)*o,alpha:i.alpha})},interpolate:function(i,r,o){return{h:ex(i.h,r.h,o),c:dr(i.c,r.c,o),l:dr(i.l,r.l,o),alpha:dr(i.alpha,r.alpha,o)}}};var vp=Object.freeze({__proto__:null,hcl:El,lab:Uc});class jc{constructor(r,o,c,p,m){this.type=r,this.operator=o,this.interpolation=c,this.input=p,this.labels=[],this.outputs=[];for(const[y,x]of m)this.labels.push(y),this.outputs.push(x)}static interpolationFactor(r,o,c,p){let m=0;if(r.name==="exponential")m=xp(o,r.base,c,p);else if(r.name==="linear")m=xp(o,1,c,p);else if(r.name==="cubic-bezier"){const y=r.controlPoints;m=new te(y[0],y[1],y[2],y[3]).solve(xp(o,1,c,p))}return m}static parse(r,o){let[c,p,m,...y]=r;if(!Array.isArray(p)||p.length===0)return o.error("Expected an interpolation type expression.",1);if(p[0]==="linear")p={name:"linear"};else if(p[0]==="exponential"){const S=p[1];if(typeof S!="number")return o.error("Exponential interpolation requires a numeric base.",1,1);p={name:"exponential",base:S}}else{if(p[0]!=="cubic-bezier")return o.error(`Unknown interpolation type ${String(p[0])}`,1,0);{const S=p.slice(1);if(S.length!==4||S.some(k=>typeof k!="number"||k<0||k>1))return o.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);p={name:"cubic-bezier",controlPoints:S}}}if(r.length-1<4)return o.error(`Expected at least 4 arguments, but found only ${r.length-1}.`);if((r.length-1)%2!=0)return o.error("Expected an even number of arguments.");if(m=o.parse(m,2,bt),!m)return null;const x=[];let E=null;c==="interpolate-hcl"||c==="interpolate-lab"?E=qi:o.expectedType&&o.expectedType.kind!=="value"&&(E=o.expectedType);for(let S=0;S=k)return o.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',O);const G=o.parse(M,$,E);if(!G)return null;E=E||G.type,x.push([k,G])}return E.kind==="number"||E.kind==="color"||E.kind==="array"&&E.itemType.kind==="number"&&typeof E.N=="number"?new jc(E,c,p,m,x):o.error(`Type ${Xr(E)} is not interpolatable.`)}evaluate(r){const o=this.labels,c=this.outputs;if(o.length===1)return c[0].evaluate(r);const p=this.input.evaluate(r);if(p<=o[0])return c[0].evaluate(r);const m=o.length;if(p>=o[m-1])return c[m-1].evaluate(r);const y=Xu(o,p),x=jc.interpolationFactor(this.interpolation,p,o[y],o[y+1]),E=c[y].evaluate(r),S=c[y+1].evaluate(r);return this.operator==="interpolate"?Nc[this.type.kind.toLowerCase()](E,S,x):this.operator==="interpolate-hcl"?El.reverse(El.interpolate(El.forward(E),El.forward(S),x)):Uc.reverse(Uc.interpolate(Uc.forward(E),Uc.forward(S),x))}eachChild(r){r(this.input);for(const o of this.outputs)r(o)}outputDefined(){return this.outputs.every(r=>r.outputDefined())}serialize(){let r;r=this.interpolation.name==="linear"?["linear"]:this.interpolation.name==="exponential"?this.interpolation.base===1?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier"].concat(this.interpolation.controlPoints);const o=[this.operator,r,this.input.serialize()];for(let c=0;cba(p,x.type));return new Ju(y?rr:c,m)}evaluate(r){let o,c=null,p=0;for(const m of this.args){if(p++,c=m.evaluate(r),c&&c instanceof no&&!c.available&&(o||(o=c),c=null,p===this.args.length))return o;if(c!==null)break}return c}eachChild(r){this.args.forEach(r)}outputDefined(){return this.args.every(r=>r.outputDefined())}serialize(){const r=["coalesce"];return this.eachChild(o=>{r.push(o.serialize())}),r}}var bp=Ju;class eh{constructor(r,o){this.type=o.type,this.bindings=[].concat(r),this.result=o}evaluate(r){return this.result.evaluate(r)}eachChild(r){for(const o of this.bindings)r(o[1]);r(this.result)}static parse(r,o){if(r.length<4)return o.error(`Expected at least 3 arguments, but found ${r.length-1} instead.`);const c=[];for(let m=1;m=c.length)throw new Jn(`Array index out of bounds: ${o} > ${c.length-1}.`);if(o!==Math.floor(o))throw new Jn(`Array index must be an integer, but found ${o} instead.`);return c[o]}eachChild(r){r(this.index),r(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}var tx=wp;class Ep{constructor(r,o){this.type=tr,this.needle=r,this.haystack=o}static parse(r,o){if(r.length!==3)return o.error(`Expected 2 arguments, but found ${r.length-1} instead.`);const c=o.parse(r[1],1,rr),p=o.parse(r[2],2,rr);return c&&p?Pc(c.type,[tr,ir,bt,gl,rr])?new Ep(c,p):o.error(`Expected first argument to be of type boolean, string, number or null, but found ${Xr(c.type)} instead`):null}evaluate(r){const o=this.needle.evaluate(r),c=this.haystack.evaluate(r);if(c==null)return!1;if(!Dc(o,["boolean","string","number","null"]))throw new Jn(`Expected first argument to be of type boolean, string, number or null, but found ${Xr(ln(o))} instead.`);if(!Dc(c,["string","array"]))throw new Jn(`Expected second argument to be of type array or string, but found ${Xr(ln(c))} instead.`);return c.indexOf(o)>=0}eachChild(r){r(this.needle),r(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}var th=Ep;class Vc{constructor(r,o,c){this.type=bt,this.needle=r,this.haystack=o,this.fromIndex=c}static parse(r,o){if(r.length<=2||r.length>=5)return o.error(`Expected 3 or 4 arguments, but found ${r.length-1} instead.`);const c=o.parse(r[1],1,rr),p=o.parse(r[2],2,rr);if(!c||!p)return null;if(!Pc(c.type,[tr,ir,bt,gl,rr]))return o.error(`Expected first argument to be of type boolean, string, number or null, but found ${Xr(c.type)} instead`);if(r.length===4){const m=o.parse(r[3],3,bt);return m?new Vc(c,p,m):null}return new Vc(c,p)}evaluate(r){const o=this.needle.evaluate(r),c=this.haystack.evaluate(r);if(!Dc(o,["boolean","string","number","null"]))throw new Jn(`Expected first argument to be of type boolean, string, number or null, but found ${Xr(ln(o))} instead.`);if(!Dc(c,["string","array"]))throw new Jn(`Expected second argument to be of type array or string, but found ${Xr(ln(c))} instead.`);if(this.fromIndex){const p=this.fromIndex.evaluate(r);return c.indexOf(o,p)}return c.indexOf(o)}eachChild(r){r(this.needle),r(this.haystack),this.fromIndex&&r(this.fromIndex)}outputDefined(){return!1}serialize(){if(this.fromIndex!=null&&this.fromIndex!==void 0){const r=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),r]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}var m0=Vc;class Sp{constructor(r,o,c,p,m,y){this.inputType=r,this.type=o,this.input=c,this.cases=p,this.outputs=m,this.otherwise=y}static parse(r,o){if(r.length<5)return o.error(`Expected at least 4 arguments, but found only ${r.length-1}.`);if(r.length%2!=1)return o.error("Expected an even number of arguments.");let c,p;o.expectedType&&o.expectedType.kind!=="value"&&(p=o.expectedType);const m={},y=[];for(let S=2;SNumber.MAX_SAFE_INTEGER)return O.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof G=="number"&&Math.floor(G)!==G)return O.error("Numeric branch labels must be integer values.");if(c){if(O.checkSubtype(c,ln(G)))return null}else c=ln(G);if(m[String(G)]!==void 0)return O.error("Branch labels must be unique.");m[String(G)]=y.length}const $=o.parse(M,S,p);if(!$)return null;p=p||$.type,y.push($)}const x=o.parse(r[1],1,rr);if(!x)return null;const E=o.parse(r[r.length-1],r.length-1,p);return E?x.type.kind!=="value"&&o.concat(1).checkSubtype(c,x.type)?null:new Sp(c,p,x,m,y,E):null}evaluate(r){const o=this.input.evaluate(r);return(ln(o)===this.inputType&&this.outputs[this.cases[o]]||this.otherwise).evaluate(r)}eachChild(r){r(this.input),this.outputs.forEach(r),r(this.otherwise)}outputDefined(){return this.outputs.every(r=>r.outputDefined())&&this.otherwise.outputDefined()}serialize(){const r=["match",this.input.serialize()],o=Object.keys(this.cases).sort(),c=[],p={};for(const y of o){const x=p[this.cases[y]];x===void 0?(p[this.cases[y]]=c.length,c.push([this.cases[y],[y]])):c[x][1].push(y)}const m=y=>this.inputType.kind==="number"?Number(y):y;for(const[y,x]of c)r.push(x.length===1?m(x[0]):x.map(m)),r.push(this.outputs[y].serialize());return r.push(this.otherwise.serialize()),r}}var rx=Sp;class Tp{constructor(r,o,c){this.type=r,this.branches=o,this.otherwise=c}static parse(r,o){if(r.length<4)return o.error(`Expected at least 3 arguments, but found only ${r.length-1}.`);if(r.length%2!=0)return o.error("Expected an odd number of arguments.");let c;o.expectedType&&o.expectedType.kind!=="value"&&(c=o.expectedType);const p=[];for(let y=1;yo.outputDefined())&&this.otherwise.outputDefined()}serialize(){const r=["case"];return this.eachChild(o=>{r.push(o.serialize())}),r}}var g0=Tp;class $c{constructor(r,o,c,p){this.type=r,this.input=o,this.beginIndex=c,this.endIndex=p}static parse(r,o){if(r.length<=2||r.length>=5)return o.error(`Expected 3 or 4 arguments, but found ${r.length-1} instead.`);const c=o.parse(r[1],1,rr),p=o.parse(r[2],2,bt);if(!c||!p)return null;if(!Pc(c.type,[ro(rr),ir,rr]))return o.error(`Expected first argument to be of type array or string, but found ${Xr(c.type)} instead`);if(r.length===4){const m=o.parse(r[3],3,bt);return m?new $c(c.type,c,p,m):null}return new $c(c.type,c,p)}evaluate(r){const o=this.input.evaluate(r),c=this.beginIndex.evaluate(r);if(!Dc(o,["string","array"]))throw new Jn(`Expected first argument to be of type array or string, but found ${Xr(ln(o))} instead.`);if(this.endIndex){const p=this.endIndex.evaluate(r);return o.slice(c,p)}return o.slice(c)}eachChild(r){r(this.input),r(this.beginIndex),this.endIndex&&r(this.endIndex)}outputDefined(){return!1}serialize(){if(this.endIndex!=null&&this.endIndex!==void 0){const r=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),r]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}var y0=$c;function rh(i,r){return i==="=="||i==="!="?r.kind==="boolean"||r.kind==="string"||r.kind==="number"||r.kind==="null"||r.kind==="value":r.kind==="string"||r.kind==="number"||r.kind==="value"}function _0(i,r,o,c){return c.compare(r,o)===0}function Sl(i,r,o){const c=i!=="=="&&i!=="!=";return class C3{constructor(m,y,x){this.type=tr,this.lhs=m,this.rhs=y,this.collator=x,this.hasUntypedArgument=m.type.kind==="value"||y.type.kind==="value"}static parse(m,y){if(m.length!==3&&m.length!==4)return y.error("Expected two or three arguments.");const x=m[0];let E=y.parse(m[1],1,rr);if(!E)return null;if(!rh(x,E.type))return y.concat(1).error(`"${x}" comparisons are not supported for type '${Xr(E.type)}'.`);let S=y.parse(m[2],2,rr);if(!S)return null;if(!rh(x,S.type))return y.concat(2).error(`"${x}" comparisons are not supported for type '${Xr(S.type)}'.`);if(E.type.kind!==S.type.kind&&E.type.kind!=="value"&&S.type.kind!=="value")return y.error(`Cannot compare types '${Xr(E.type)}' and '${Xr(S.type)}'.`);c&&(E.type.kind==="value"&&S.type.kind!=="value"?E=new wa(S.type,[E]):E.type.kind!=="value"&&S.type.kind==="value"&&(S=new wa(E.type,[S])));let k=null;if(m.length===4){if(E.type.kind!=="string"&&S.type.kind!=="string"&&E.type.kind!=="value"&&S.type.kind!=="value")return y.error("Cannot use collator to compare non-string types.");if(k=y.parse(m[3],3,Zi),!k)return null}return new C3(E,S,k)}evaluate(m){const y=this.lhs.evaluate(m),x=this.rhs.evaluate(m);if(c&&this.hasUntypedArgument){const E=ln(y),S=ln(x);if(E.kind!==S.kind||E.kind!=="string"&&E.kind!=="number")throw new Jn(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${E.kind}, ${S.kind}) instead.`)}if(this.collator&&!c&&this.hasUntypedArgument){const E=ln(y),S=ln(x);if(E.kind!=="string"||S.kind!=="string")return r(m,y,x)}return this.collator?o(m,y,x,this.collator.evaluate(m)):r(m,y,x)}eachChild(m){m(this.lhs),m(this.rhs),this.collator&&m(this.collator)}outputDefined(){return!0}serialize(){const m=[i];return this.eachChild(y=>{m.push(y.serialize())}),m}}}const nx=Sl("==",function(i,r,o){return r===o},_0),ix=Sl("!=",function(i,r,o){return r!==o},function(i,r,o,c){return!_0(0,r,o,c)}),ox=Sl("<",function(i,r,o){return r",function(i,r,o){return r>o},function(i,r,o,c){return c.compare(r,o)>0}),sx=Sl("<=",function(i,r,o){return r<=o},function(i,r,o,c){return c.compare(r,o)<=0}),v0=Sl(">=",function(i,r,o){return r>=o},function(i,r,o,c){return c.compare(r,o)>=0});class nh{constructor(r,o,c,p,m,y){this.type=ir,this.number=r,this.locale=o,this.currency=c,this.unit=p,this.minFractionDigits=m,this.maxFractionDigits=y}static parse(r,o){if(r.length!==3)return o.error("Expected two arguments.");const c=o.parse(r[1],1,bt);if(!c)return null;const p=r[2];if(typeof p!="object"||Array.isArray(p))return o.error("NumberFormat options argument must be an object.");let m=null;if(p.locale&&(m=o.parse(p.locale,1,ir),!m))return null;let y=null;if(p.currency&&(y=o.parse(p.currency,1,ir),!y))return null;let x=null;if(p.unit&&(x=o.parse(p.unit,1,ir),!x))return null;let E=null;if(p["min-fraction-digits"]&&(E=o.parse(p["min-fraction-digits"],1,bt),!E))return null;let S=null;return p["max-fraction-digits"]&&(S=o.parse(p["max-fraction-digits"],1,bt),!S)?null:new nh(c,m,y,x,E,S)}evaluate(r){return new Intl.NumberFormat(this.locale?this.locale.evaluate(r):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(r):void 0,unit:this.unit?this.unit.evaluate(r):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(r):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(r):void 0}).format(this.number.evaluate(r))}eachChild(r){r(this.number),this.locale&&r(this.locale),this.currency&&r(this.currency),this.unit&&r(this.unit),this.minFractionDigits&&r(this.minFractionDigits),this.maxFractionDigits&&r(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const r={};return this.locale&&(r.locale=this.locale.serialize()),this.currency&&(r.currency=this.currency.serialize()),this.unit&&(r.unit=this.unit.serialize()),this.minFractionDigits&&(r["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(r["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),r]}}class Tl{constructor(r){this.type=bt,this.input=r}static parse(r,o){if(r.length!==2)return o.error(`Expected 1 argument, but found ${r.length-1} instead.`);const c=o.parse(r[1],1);return c?c.type.kind!=="array"&&c.type.kind!=="string"&&c.type.kind!=="value"?o.error(`Expected argument of type string or array, but found ${Xr(c.type)} instead.`):new Tl(c):null}evaluate(r){const o=this.input.evaluate(r);if(typeof o=="string"||Array.isArray(o))return o.length;throw new Jn(`Expected value to be of type string or array, but found ${Xr(ln(o))} instead.`)}eachChild(r){r(this.input)}outputDefined(){return!1}serialize(){const r=["length"];return this.eachChild(o=>{r.push(o.serialize())}),r}}const x0={"==":nx,"!=":ix,">":ax,"<":ox,">=":v0,"<=":sx,array:wa,at:tx,boolean:wa,case:g0,coalesce:bp,collator:Fc,format:es,image:Gu,in:th,"index-of":m0,interpolate:Yo,"interpolate-hcl":Yo,"interpolate-lab":Yo,length:Tl,let:f0,literal:Rs,match:rx,number:wa,"number-format":nh,object:wa,slice:y0,step:pp,string:wa,"to-boolean":_l,"to-color":_l,"to-number":_l,"to-string":_l,var:c0,within:Zu};function b0(i,[r,o,c,p]){r=r.evaluate(i),o=o.evaluate(i),c=c.evaluate(i);const m=p?p.evaluate(i):1,y=o0(r,o,c,m);if(y)throw new Jn(y);return new fn(r/255*m,o/255*m,c/255*m,m)}function Aa(i,r){return i in r}function ih(i,r){const o=r[i];return o===void 0?null:o}function io(i){return{type:i}}Ea.register(x0,{error:[{kind:"error"},[ir],(i,[r])=>{throw new Jn(r.evaluate(i))}],typeof:[ir,[rr],(i,[r])=>Xr(ln(r.evaluate(i)))],"to-rgba":[ro(bt,4),[qi],(i,[r])=>r.evaluate(i).toArray()],rgb:[qi,[bt,bt,bt],b0],rgba:[qi,[bt,bt,bt,bt],b0],has:{type:tr,overloads:[[[ir],(i,[r])=>Aa(r.evaluate(i),i.properties())],[[ir,Ao],(i,[r,o])=>Aa(r.evaluate(i),o.evaluate(i))]]},get:{type:rr,overloads:[[[ir],(i,[r])=>ih(r.evaluate(i),i.properties())],[[ir,Ao],(i,[r,o])=>ih(r.evaluate(i),o.evaluate(i))]]},"feature-state":[rr,[ir],(i,[r])=>ih(r.evaluate(i),i.featureState||{})],properties:[Ao,[],i=>i.properties()],"geometry-type":[ir,[],i=>i.geometryType()],id:[rr,[],i=>i.id()],zoom:[bt,[],i=>i.globals.zoom],pitch:[bt,[],i=>i.globals.pitch||0],"distance-from-center":[bt,[],i=>i.distanceFromCenter()],"heatmap-density":[bt,[],i=>i.globals.heatmapDensity||0],"line-progress":[bt,[],i=>i.globals.lineProgress||0],"sky-radial-progress":[bt,[],i=>i.globals.skyRadialProgress||0],accumulated:[rr,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[bt,io(bt),(i,r)=>{let o=0;for(const c of r)o+=c.evaluate(i);return o}],"*":[bt,io(bt),(i,r)=>{let o=1;for(const c of r)o*=c.evaluate(i);return o}],"-":{type:bt,overloads:[[[bt,bt],(i,[r,o])=>r.evaluate(i)-o.evaluate(i)],[[bt],(i,[r])=>-r.evaluate(i)]]},"/":[bt,[bt,bt],(i,[r,o])=>r.evaluate(i)/o.evaluate(i)],"%":[bt,[bt,bt],(i,[r,o])=>r.evaluate(i)%o.evaluate(i)],ln2:[bt,[],()=>Math.LN2],pi:[bt,[],()=>Math.PI],e:[bt,[],()=>Math.E],"^":[bt,[bt,bt],(i,[r,o])=>Math.pow(r.evaluate(i),o.evaluate(i))],sqrt:[bt,[bt],(i,[r])=>Math.sqrt(r.evaluate(i))],log10:[bt,[bt],(i,[r])=>Math.log(r.evaluate(i))/Math.LN10],ln:[bt,[bt],(i,[r])=>Math.log(r.evaluate(i))],log2:[bt,[bt],(i,[r])=>Math.log(r.evaluate(i))/Math.LN2],sin:[bt,[bt],(i,[r])=>Math.sin(r.evaluate(i))],cos:[bt,[bt],(i,[r])=>Math.cos(r.evaluate(i))],tan:[bt,[bt],(i,[r])=>Math.tan(r.evaluate(i))],asin:[bt,[bt],(i,[r])=>Math.asin(r.evaluate(i))],acos:[bt,[bt],(i,[r])=>Math.acos(r.evaluate(i))],atan:[bt,[bt],(i,[r])=>Math.atan(r.evaluate(i))],min:[bt,io(bt),(i,r)=>Math.min(...r.map(o=>o.evaluate(i)))],max:[bt,io(bt),(i,r)=>Math.max(...r.map(o=>o.evaluate(i)))],abs:[bt,[bt],(i,[r])=>Math.abs(r.evaluate(i))],round:[bt,[bt],(i,[r])=>{const o=r.evaluate(i);return o<0?-Math.round(-o):Math.round(o)}],floor:[bt,[bt],(i,[r])=>Math.floor(r.evaluate(i))],ceil:[bt,[bt],(i,[r])=>Math.ceil(r.evaluate(i))],"filter-==":[tr,[ir,rr],(i,[r,o])=>i.properties()[r.value]===o.value],"filter-id-==":[tr,[rr],(i,[r])=>i.id()===r.value],"filter-type-==":[tr,[ir],(i,[r])=>i.geometryType()===r.value],"filter-<":[tr,[ir,rr],(i,[r,o])=>{const c=i.properties()[r.value],p=o.value;return typeof c==typeof p&&c{const o=i.id(),c=r.value;return typeof o==typeof c&&o":[tr,[ir,rr],(i,[r,o])=>{const c=i.properties()[r.value],p=o.value;return typeof c==typeof p&&c>p}],"filter-id->":[tr,[rr],(i,[r])=>{const o=i.id(),c=r.value;return typeof o==typeof c&&o>c}],"filter-<=":[tr,[ir,rr],(i,[r,o])=>{const c=i.properties()[r.value],p=o.value;return typeof c==typeof p&&c<=p}],"filter-id-<=":[tr,[rr],(i,[r])=>{const o=i.id(),c=r.value;return typeof o==typeof c&&o<=c}],"filter->=":[tr,[ir,rr],(i,[r,o])=>{const c=i.properties()[r.value],p=o.value;return typeof c==typeof p&&c>=p}],"filter-id->=":[tr,[rr],(i,[r])=>{const o=i.id(),c=r.value;return typeof o==typeof c&&o>=c}],"filter-has":[tr,[rr],(i,[r])=>r.value in i.properties()],"filter-has-id":[tr,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[tr,[ro(ir)],(i,[r])=>r.value.indexOf(i.geometryType())>=0],"filter-id-in":[tr,[ro(rr)],(i,[r])=>r.value.indexOf(i.id())>=0],"filter-in-small":[tr,[ir,ro(rr)],(i,[r,o])=>o.value.indexOf(i.properties()[r.value])>=0],"filter-in-large":[tr,[ir,ro(rr)],(i,[r,o])=>function(c,p,m,y){for(;m<=y;){const x=m+y>>1;if(p[x]===c)return!0;p[x]>c?y=x-1:m=x+1}return!1}(i.properties()[r.value],o.value,0,o.value.length-1)],all:{type:tr,overloads:[[[tr,tr],(i,[r,o])=>r.evaluate(i)&&o.evaluate(i)],[io(tr),(i,r)=>{for(const o of r)if(!o.evaluate(i))return!1;return!0}]]},any:{type:tr,overloads:[[[tr,tr],(i,[r,o])=>r.evaluate(i)||o.evaluate(i)],[io(tr),(i,r)=>{for(const o of r)if(o.evaluate(i))return!0;return!1}]]},"!":[tr,[tr],(i,[r])=>!r.evaluate(i)],"is-supported-script":[tr,[ir],(i,[r])=>{const o=i.globals&&i.globals.isSupportedScript;return!o||o(r.evaluate(i))}],upcase:[ir,[ir],(i,[r])=>r.evaluate(i).toUpperCase()],downcase:[ir,[ir],(i,[r])=>r.evaluate(i).toLowerCase()],concat:[ir,io(rr),(i,r)=>r.map(o=>Oc(o.evaluate(i))).join("")],"resolved-locale":[ir,[Zi],(i,[r])=>r.evaluate(i).resolvedLocale()]});var Wc=x0;function w0(i){return{result:"success",value:i}}function Bs(i){return{result:"error",value:i}}function Al(i){return i["property-type"]==="data-driven"}function oh(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function ah(i){return!!i.expression&&i.expression.interpolated}function pr(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":i===null?"null":typeof i}function Gc(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function E0(i){return i}function sh(i,r){const o=r.type==="color",c=i.stops&&typeof i.stops[0][0]=="object",p=c||!(c||i.property!==void 0),m=i.type||(ah(r)?"exponential":"interval");if(o&&((i=xa({},i)).stops&&(i.stops=i.stops.map(S=>[S[0],fn.parse(S[1])])),i.default=fn.parse(i.default?i.default:r.default)),i.colorSpace&&i.colorSpace!=="rgb"&&!vp[i.colorSpace])throw new Error(`Unknown color space: ${i.colorSpace}`);let y,x,E;if(m==="exponential")y=Ia;else if(m==="interval")y=lh;else if(m==="categorical"){y=S0,x=Object.create(null);for(const S of i.stops)x[S[0]]=S[1];E=typeof i.stops[0][0]}else{if(m!=="identity")throw new Error(`Unknown function type "${m}"`);y=T0}if(c){const S={},k=[];for(let $=0;$$[0]),evaluate:({zoom:$},G)=>Ia({stops:M,base:i.base},r,$).evaluate($,G)}}if(p){const S=m==="exponential"?{name:"exponential",base:i.base!==void 0?i.base:1}:null;return{kind:"camera",interpolationType:S,interpolationFactor:Yo.interpolationFactor.bind(void 0,S),zoomStops:i.stops.map(k=>k[0]),evaluate:({zoom:k})=>y(i,r,k,x,E)}}return{kind:"source",evaluate(S,k){const M=k&&k.properties?k.properties[i.property]:void 0;return M===void 0?Il(i.default,r.default):y(i,r,M,x,E)}}}function Il(i,r,o){return i!==void 0?i:r!==void 0?r:o!==void 0?o:void 0}function S0(i,r,o,c,p){return Il(typeof o===p?c[o]:void 0,i.default,r.default)}function lh(i,r,o){if(pr(o)!=="number")return Il(i.default,r.default);const c=i.stops.length;if(c===1||o<=i.stops[0][0])return i.stops[0][1];if(o>=i.stops[c-1][0])return i.stops[c-1][1];const p=Xu(i.stops.map(m=>m[0]),o);return i.stops[p][1]}function Ia(i,r,o){const c=i.base!==void 0?i.base:1;if(pr(o)!=="number")return Il(i.default,r.default);const p=i.stops.length;if(p===1||o<=i.stops[0][0])return i.stops[0][1];if(o>=i.stops[p-1][0])return i.stops[p-1][1];const m=Xu(i.stops.map(k=>k[0]),o),y=function(k,M,O,$){const G=$-O,K=k-O;return G===0?0:M===1?K/G:(Math.pow(M,K)-1)/(Math.pow(M,G)-1)}(o,c,i.stops[m][0],i.stops[m+1][0]),x=i.stops[m][1],E=i.stops[m+1][1];let S=Nc[r.type]||E0;if(i.colorSpace&&i.colorSpace!=="rgb"){const k=vp[i.colorSpace];S=(M,O)=>k.reverse(k.interpolate(k.forward(M),k.forward(O),y))}return typeof x.evaluate=="function"?{evaluate(...k){const M=x.evaluate.apply(void 0,k),O=E.evaluate.apply(void 0,k);if(M!==void 0&&O!==void 0)return S(M,O,y)}}:S(x,E,y)}function T0(i,r,o){return r.type==="color"?o=fn.parse(o):r.type==="formatted"?o=ki.fromString(o.toString()):r.type==="resolvedImage"?o=no.fromString(o.toString()):pr(o)===r.type||r.type==="enum"&&r.values[o]||(o=void 0),Il(o,i.default,r.default)}class ch{constructor(r,o){this.expression=r,this._warningHistory={},this._evaluator=new op,this._defaultValue=o?function(c){return c.type==="color"&&(Gc(c.default)||Array.isArray(c.default))?new fn(0,0,0,0):c.type==="color"?fn.parse(c.default)||null:c.default===void 0?null:c.default}(o):null,this._enumValues=o&&o.type==="enum"?o.values:null}evaluateWithoutErrorHandling(r,o,c,p,m,y,x,E){return this._evaluator.globals=r,this._evaluator.feature=o,this._evaluator.featureState=c,this._evaluator.canonical=p||null,this._evaluator.availableImages=m||null,this._evaluator.formattedSection=y,this._evaluator.featureTileCoord=x||null,this._evaluator.featureDistanceData=E||null,this.expression.evaluate(this._evaluator)}evaluate(r,o,c,p,m,y,x,E){this._evaluator.globals=r,this._evaluator.feature=o||null,this._evaluator.featureState=c||null,this._evaluator.canonical=p||null,this._evaluator.availableImages=m||null,this._evaluator.formattedSection=y||null,this._evaluator.featureTileCoord=x||null,this._evaluator.featureDistanceData=E||null;try{const S=this.expression.evaluate(this._evaluator);if(S==null||typeof S=="number"&&S!=S)return this._defaultValue;if(this._enumValues&&!(S in this._enumValues))throw new Jn(`Expected value to be one of ${Object.keys(this._enumValues).map(k=>JSON.stringify(k)).join(", ")}, but found ${JSON.stringify(S)} instead.`);return S}catch(S){return this._warningHistory[S.message]||(this._warningHistory[S.message]=!0,typeof console<"u"&&console.warn(S.message)),this._defaultValue}}}function Cl(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in Wc}function kl(i,r){const o=new hp(Wc,[],r?function(p){const m={color:qi,string:ir,number:bt,enum:ir,boolean:tr,formatted:kc,resolvedImage:zs};return p.type==="array"?ro(m[p.value]||rr,p.length):m[p.type]}(r):void 0),c=o.parse(i,void 0,void 0,void 0,r&&r.type==="string"?{typeAnnotation:"coerce"}:void 0);return c?w0(new ch(c,r)):Bs(o.errors)}class Ap{constructor(r,o){this.kind=r,this._styleExpression=o,this.isStateDependent=r!=="constant"&&!Ta(o.expression)}evaluateWithoutErrorHandling(r,o,c,p,m,y){return this._styleExpression.evaluateWithoutErrorHandling(r,o,c,p,m,y)}evaluate(r,o,c,p,m,y){return this._styleExpression.evaluate(r,o,c,p,m,y)}}class Hc{constructor(r,o,c,p){this.kind=r,this.zoomStops=c,this._styleExpression=o,this.isStateDependent=r!=="camera"&&!Ta(o.expression),this.interpolationType=p}evaluateWithoutErrorHandling(r,o,c,p,m,y){return this._styleExpression.evaluateWithoutErrorHandling(r,o,c,p,m,y)}evaluate(r,o,c,p,m,y){return this._styleExpression.evaluate(r,o,c,p,m,y)}interpolationFactor(r,o,c){return this.interpolationType?Yo.interpolationFactor(this.interpolationType,r,o,c):0}}function qc(i,r){if((i=kl(i,r)).result==="error")return i;const o=i.value.expression,c=wl(o);if(!c&&!Al(r))return Bs([new Ko("","data expressions not supported")]);const p=Fs(o,["zoom","pitch","distance-from-center"]);if(!p&&!oh(r))return Bs([new Ko("","zoom expressions not supported")]);const m=hh(o);return m||p?m instanceof Ko?Bs([m]):m instanceof Yo&&!ah(r)?Bs([new Ko("",'"interpolate" expressions cannot be used with this property')]):w0(m?new Hc(c?"camera":"composite",i.value,m.labels,m instanceof Yo?m.interpolation:void 0):new Ap(c?"constant":"source",i.value)):Bs([new Ko("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class uh{constructor(r,o){this._parameters=r,this._specification=o,xa(this,sh(this._parameters,this._specification))}static deserialize(r){return new uh(r._parameters,r._specification)}static serialize(r){return{_parameters:r._parameters,_specification:r._specification}}}function hh(i){let r=null;if(i instanceof f0)r=hh(i.result);else if(i instanceof bp){for(const o of i.args)if(r=hh(o),r)break}else(i instanceof pp||i instanceof Yo)&&i.input instanceof Ea&&i.input.name==="zoom"&&(r=i);return r instanceof Ko||i.eachChild(o=>{const c=hh(o);c instanceof Ko?r=c:!r&&c?r=new Ko("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):r&&c&&r!==c&&(r=new Ko("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),r}class Et{constructor(r,o,c,p){this.message=(r?`${r}: `:"")+c,p&&(this.identifier=p),o!=null&&o.__line__&&(this.line=o.__line__)}}function Io(i){const r=i.key,o=i.value,c=i.valueSpec||{},p=i.objectElementValidators||{},m=i.style,y=i.styleSpec;let x=[];const E=pr(o);if(E!=="object")return[new Et(r,o,`object expected, ${E} found`)];for(const S in o){const k=S.split(".")[0];let M;p[k]?M=p[k]:c[k]?M=ci:p["*"]?M=p["*"]:c["*"]&&(M=ci),M?x=x.concat(M({key:(r&&`${r}.`)+S,value:o[S],valueSpec:c[k]||c["*"],style:m,styleSpec:y,object:o,objectKey:S},o)):x.push(new Et(r,o[S],`unknown property "${S}"`))}for(const S in c)p[S]||c[S].required&&c[S].default===void 0&&o[S]===void 0&&x.push(new Et(r,o,`missing required property "${S}"`));return x}function A0(i){const r=i.value,o=i.valueSpec,c=i.style,p=i.styleSpec,m=i.key,y=i.arrayElementValidator||ci;if(pr(r)!=="array")return[new Et(m,r,`array expected, ${pr(r)} found`)];if(o.length&&r.length!==o.length)return[new Et(m,r,`array length ${o.length} expected, length ${r.length} found`)];if(o["min-length"]&&r.lengthm)return[new Et(r,o,`${o} is greater than the maximum value ${m}`)]}return[]}function Kc(i){const r=i.valueSpec,o=_n(i.value.type);let c,p,m,y={};const x=o!=="categorical"&&i.value.property===void 0,E=!x,S=pr(i.value.stops)==="array"&&pr(i.value.stops[0])==="array"&&pr(i.value.stops[0][0])==="object",k=Io({key:i.key,value:i.value,valueSpec:i.styleSpec.function,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{stops:function($){if(o==="identity")return[new Et($.key,$.value,'identity function may not have a "stops" property')];let G=[];const K=$.value;return G=G.concat(A0({key:$.key,value:K,valueSpec:$.valueSpec,style:$.style,styleSpec:$.styleSpec,arrayElementValidator:M})),pr(K)==="array"&&K.length===0&&G.push(new Et($.key,K,"array must have at least one stop")),G},default:function($){return ci({key:$.key,value:$.value,valueSpec:r,style:$.style,styleSpec:$.styleSpec})}}});return o==="identity"&&x&&k.push(new Et(i.key,i.value,'missing required property "property"')),o==="identity"||i.value.stops||k.push(new Et(i.key,i.value,'missing required property "stops"')),o==="exponential"&&i.valueSpec.expression&&!ah(i.valueSpec)&&k.push(new Et(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(E&&!Al(i.valueSpec)?k.push(new Et(i.key,i.value,"property functions not supported")):x&&!oh(i.valueSpec)&&k.push(new Et(i.key,i.value,"zoom functions not supported"))),o!=="categorical"&&!S||i.value.property!==void 0||k.push(new Et(i.key,i.value,'"property" property is required')),k;function M($){let G=[];const K=$.value,ee=$.key;if(pr(K)!=="array")return[new Et(ee,K,`array expected, ${pr(K)} found`)];if(K.length!==2)return[new Et(ee,K,`array length 2 expected, length ${K.length} found`)];if(S){if(pr(K[0])!=="object")return[new Et(ee,K,`object expected, ${pr(K[0])} found`)];if(K[0].zoom===void 0)return[new Et(ee,K,"object stop key must have zoom")];if(K[0].value===void 0)return[new Et(ee,K,"object stop key must have value")];const le=_n(K[0].zoom);if(typeof le!="number")return[new Et(ee,K[0].zoom,"stop zoom values must be numbers")];if(m&&m>le)return[new Et(ee,K[0].zoom,"stop zoom values must appear in ascending order")];le!==m&&(m=le,p=void 0,y={}),G=G.concat(Io({key:`${ee}[0]`,value:K[0],valueSpec:{zoom:{}},style:$.style,styleSpec:$.styleSpec,objectElementValidators:{zoom:Zc,value:O}}))}else G=G.concat(O({key:`${ee}[0]`,value:K[0],valueSpec:{},style:$.style,styleSpec:$.styleSpec},K));return Cl($n(K[1]))?G.concat([new Et(`${ee}[1]`,K[1],"expressions are not allowed in function stops.")]):G.concat(ci({key:`${ee}[1]`,value:K[1],valueSpec:r,style:$.style,styleSpec:$.styleSpec}))}function O($,G){const K=pr($.value),ee=_n($.value),le=$.value!==null?$.value:G;if(c){if(K!==c)return[new Et($.key,le,`${K} stop domain type must match previous stop domain type ${c}`)]}else c=K;if(K!=="number"&&K!=="string"&&K!=="boolean"&&typeof ee!="number"&&typeof ee!="string"&&typeof ee!="boolean")return[new Et($.key,le,"stop domain value must be a number, string, or boolean")];if(K!=="number"&&o!=="categorical"){let me=`number expected, ${K} found`;return Al(r)&&o===void 0&&(me+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Et($.key,le,me)]}return o!=="categorical"||K!=="number"||typeof ee=="number"&&isFinite(ee)&&Math.floor(ee)===ee?o!=="categorical"&&K==="number"&&typeof ee=="number"&&typeof p=="number"&&p!==void 0&&eenew Et(`${i.key}${c.key}`,i.value,c.message));const o=r.value.expression||r.value._styleExpression.expression;if(i.expressionContext==="property"&&i.propertyKey==="text-font"&&!o.outputDefined())return[new Et(i.key,i.value,`Invalid data expression for "${i.propertyKey}". Output values must be contained as literals within the expression.`)];if(i.expressionContext==="property"&&i.propertyType==="layout"&&!Ta(o))return[new Et(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if(i.expressionContext==="filter")return Xc(o,i);if(i.expressionContext&&i.expressionContext.indexOf("cluster")===0){if(!Fs(o,["zoom","feature-state"]))return[new Et(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(i.expressionContext==="cluster-initial"&&!wl(o))return[new Et(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Xc(i,r){const o=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(r.valueSpec&&r.valueSpec.expression)for(const p of r.valueSpec.expression.parameters)o.delete(p);if(o.size===0)return[];const c=[];return i instanceof Ea&&o.has(i.name)?[new Et(r.key,r.value,`["${i.name}"] expression is not supported in a filter for a ${r.object.type} layer with id: ${r.object.id}`)]:(i.eachChild(p=>{c.push(...Xc(p,r))}),c)}function dh(i){const r=i.key,o=i.value,c=i.valueSpec,p=[];return Array.isArray(c.values)?c.values.indexOf(_n(o))===-1&&p.push(new Et(r,o,`expected one of [${c.values.join(", ")}], ${JSON.stringify(o)} found`)):Object.keys(c.values).indexOf(_n(o))===-1&&p.push(new Et(r,o,`expected one of [${Object.keys(c.values).join(", ")}], ${JSON.stringify(o)} found`)),p}function Ip(i){if(i===!0||i===!1)return!0;if(!Array.isArray(i)||i.length===0)return!1;switch(i[0]){case"has":return i.length>=2&&i[1]!=="$id"&&i[1]!=="$type";case"in":return i.length>=3&&(typeof i[1]!="string"||Array.isArray(i[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return i.length!==3||Array.isArray(i[1])||Array.isArray(i[2]);case"any":case"all":for(const r of i.slice(1))if(!Ip(r)&&typeof r!="boolean")return!1;return!0;default:return!0}}function ph(i,r="fill"){if(i==null)return{filter:()=>!0,needGeometry:!1,needFeature:!1};Ip(i)||(i=Dl(i));const o=i;let c=!0;try{c=function(S){if(!Pl(S))return S;let k=$n(S);return fh(k),k=I0(k),k}(o)}catch{console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate. +This is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md +and paste the contents of this message in the report. +Thank you! +Filter Expression: +${JSON.stringify(o,null,2)} + `)}const p=Ge[`filter_${r}`],m=kl(c,p);let y=null;if(m.result==="error")throw new Error(m.value.map(S=>`${S.key}: ${S.message}`).join(", "));y=(S,k,M)=>m.value.evaluate(S,k,{},M);let x=null,E=null;if(c!==o){const S=kl(o,p);if(S.result==="error")throw new Error(S.value.map(k=>`${k.key}: ${k.message}`).join(", "));x=(k,M,O,$,G)=>S.value.evaluate(k,M,{},O,void 0,void 0,$,G),E=!wl(S.value.expression)}return{filter:y,dynamicFilter:x||void 0,needGeometry:C0(c),needFeature:!!E}}function I0(i){if(!Array.isArray(i))return i;const r=function(o){if(Cp.has(o[0])){for(let c=1;cI0(o))}function fh(i){let r=!1;const o=[];if(i[0]==="case"){for(let c=1;c",">=","<","<=","to-boolean"]);function lx(i,r){return ir?1:0}function C0(i){if(!Array.isArray(i))return!1;if(i[0]==="within")return!0;for(let r=1;r"||r==="<="||r===">="?kp(i[1],i[2],r):r==="any"?(o=i.slice(1),["any"].concat(o.map(Dl))):r==="all"?["all"].concat(i.slice(1).map(Dl)):r==="none"?["all"].concat(i.slice(1).map(Dl).map(mh)):r==="in"?Pp(i[1],i.slice(2)):r==="!in"?mh(Pp(i[1],i.slice(2))):r==="has"?Dp(i[1]):r==="!has"?mh(Dp(i[1])):r!=="within"||i;var o}function kp(i,r,o){switch(i){case"$type":return[`filter-type-${o}`,r];case"$id":return[`filter-id-${o}`,r];default:return[`filter-${o}`,i,r]}}function Pp(i,r){if(r.length===0)return!1;switch(i){case"$type":return["filter-type-in",["literal",r]];case"$id":return["filter-id-in",["literal",r]];default:return r.length>200&&!r.some(o=>typeof o!=typeof r[0])?["filter-in-large",i,["literal",r.sort(lx)]]:["filter-in-small",i,["literal",r]]}}function Dp(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function mh(i){return["!",i]}function Yc(i){return Ip($n(i.value))?Wn(xa({},i,{expressionContext:"filter",valueSpec:i.styleSpec[`filter_${i.layerType||"fill"}`]})):Qc(i)}function Qc(i){const r=i.value,o=i.key;if(pr(r)!=="array")return[new Et(o,r,`array expected, ${pr(r)} found`)];const c=i.styleSpec;let p,m=[];if(r.length<1)return[new Et(o,r,"filter array must have at least 1 element")];switch(m=m.concat(dh({key:`${o}[0]`,value:r[0],valueSpec:c.filter_operator,style:i.style,styleSpec:i.styleSpec})),_n(r[0])){case"<":case"<=":case">":case">=":r.length>=2&&_n(r[1])==="$type"&&m.push(new Et(o,r,`"$type" cannot be use with operator "${r[0]}"`));case"==":case"!=":r.length!==3&&m.push(new Et(o,r,`filter array for operator "${r[0]}" must have 3 elements`));case"in":case"!in":r.length>=2&&(p=pr(r[1]),p!=="string"&&m.push(new Et(`${o}[1]`,r[1],`string expected, ${p} found`)));for(let y=2;y{S in o&&r.push(new Et(c,o[S],`"${S}" is prohibited for ref layers`))}),p.layers.forEach(S=>{_n(S.id)===x&&(E=S)}),E?E.ref?r.push(new Et(c,o.ref,"ref cannot reference another ref layer")):y=_n(E.type):typeof x=="string"&&r.push(new Et(c,o.ref,`ref layer "${x}" not found`))}else if(y!=="background"&&y!=="sky")if(o.source){const E=p.sources&&p.sources[o.source],S=E&&_n(E.type);E?S==="vector"&&y==="raster"?r.push(new Et(c,o.source,`layer "${o.id}" requires a raster source`)):S==="raster"&&y!=="raster"?r.push(new Et(c,o.source,`layer "${o.id}" requires a vector source`)):S!=="vector"||o["source-layer"]?S==="raster-dem"&&y!=="hillshade"?r.push(new Et(c,o.source,"raster-dem source can only be used with layer type 'hillshade'.")):y!=="line"||!o.paint||!o.paint["line-gradient"]&&!o.paint["line-trim-offset"]||S==="geojson"&&E.lineMetrics||r.push(new Et(c,o,`layer "${o.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):r.push(new Et(c,o,`layer "${o.id}" must specify a "source-layer"`)):r.push(new Et(c,o.source,`source "${o.source}" not found`))}else r.push(new Et(c,o,'missing required property "source"'));return r=r.concat(Io({key:c,value:o,valueSpec:m.layer,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":()=>[],type:()=>ci({key:`${c}.type`,value:o.type,valueSpec:m.layer.type,style:i.style,styleSpec:i.styleSpec,object:o,objectKey:"type"}),filter:E=>Yc(xa({layerType:y},E)),layout:E=>Io({layer:o,key:E.key,value:E.value,valueSpec:{},style:E.style,styleSpec:E.styleSpec,objectElementValidators:{"*":S=>zp(xa({layerType:y},S))}}),paint:E=>Io({layer:o,key:E.key,value:E.value,valueSpec:{},style:E.style,styleSpec:E.styleSpec,objectElementValidators:{"*":S=>k0(xa({layerType:y},S))}})}})),r}function ts(i){const r=i.value,o=i.key,c=pr(r);return c!=="string"?[new Et(o,r,`string expected, ${c} found`)]:[]}const D0={promoteId:function({key:i,value:r}){if(pr(r)==="string")return ts({key:i,value:r});{const o=[];for(const c in r)o.push(...ts({key:`${i}.${c}`,value:r[c]}));return o}}};function M0(i){const r=i.value,o=i.key,c=i.styleSpec,p=i.style;if(!r.type)return[new Et(o,r,'"type" is required')];const m=_n(r.type);let y;switch(m){case"vector":case"raster":case"raster-dem":return y=Io({key:o,value:r,valueSpec:c[`source_${m.replace("-","_")}`],style:i.style,styleSpec:c,objectElementValidators:D0}),y;case"geojson":if(y=Io({key:o,value:r,valueSpec:c.source_geojson,style:p,styleSpec:c,objectElementValidators:D0}),r.cluster)for(const x in r.clusterProperties){const[E,S]=r.clusterProperties[x],k=typeof E=="string"?[E,["accumulated"],["get",x]]:E;y.push(...Wn({key:`${o}.${x}.map`,value:S,expressionContext:"cluster-map"})),y.push(...Wn({key:`${o}.${x}.reduce`,value:k,expressionContext:"cluster-reduce"}))}return y;case"video":return Io({key:o,value:r,valueSpec:c.source_video,style:p,styleSpec:c});case"image":return Io({key:o,value:r,valueSpec:c.source_image,style:p,styleSpec:c});case"canvas":return[new Et(o,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return dh({key:`${o}.type`,value:r.type,valueSpec:{values:cx(c)},style:p,styleSpec:c})}}function cx(i){return i.source.reduce((r,o)=>{const c=i[o];return c.type.type==="enum"&&(r=r.concat(Object.keys(c.type.values))),r},[])}function z0(i){const r=i.value,o=i.styleSpec,c=o.light,p=i.style;let m=[];const y=pr(r);if(r===void 0)return m;if(y!=="object")return m=m.concat([new Et("light",r,`object expected, ${y} found`)]),m;for(const x in r){const E=x.match(/^(.*)-transition$/);m=m.concat(E&&c[E[1]]&&c[E[1]].transition?ci({key:x,value:r[x],valueSpec:o.transition,style:p,styleSpec:o}):c[x]?ci({key:x,value:r[x],valueSpec:c[x],style:p,styleSpec:o}):[new Et(x,r[x],`unknown property "${x}"`)])}return m}function Rp(i){const r=i.value,o=i.key,c=i.style,p=i.styleSpec,m=p.terrain;let y=[];const x=pr(r);if(r===void 0)return y;if(x!=="object")return y=y.concat([new Et("terrain",r,`object expected, ${x} found`)]),y;for(const E in r){const S=E.match(/^(.*)-transition$/);y=y.concat(S&&m[S[1]]&&m[S[1]].transition?ci({key:E,value:r[E],valueSpec:p.transition,style:c,styleSpec:p}):m[E]?ci({key:E,value:r[E],valueSpec:m[E],style:c,styleSpec:p}):[new Et(E,r[E],`unknown property "${E}"`)])}if(r.source){const E=c.sources&&c.sources[r.source],S=E&&_n(E.type);E?S!=="raster-dem"&&y.push(new Et(o,r.source,`terrain cannot be used with a source of type ${String(S)}, it only be used with a "raster-dem" source type`)):y.push(new Et(o,r.source,`source "${r.source}" not found`))}else y.push(new Et(o,r,'terrain is missing required property "source"'));return y}function R0(i){const r=i.value,o=i.style,c=i.styleSpec,p=c.fog;let m=[];const y=pr(r);if(r===void 0)return m;if(y!=="object")return m=m.concat([new Et("fog",r,`object expected, ${y} found`)]),m;for(const x in r){const E=x.match(/^(.*)-transition$/);m=m.concat(E&&p[E[1]]&&p[E[1]].transition?ci({key:x,value:r[x],valueSpec:c.transition,style:o,styleSpec:c}):p[x]?ci({key:x,value:r[x],valueSpec:p[x],style:o,styleSpec:c}):[new Et(x,r[x],`unknown property "${x}"`)])}return m}const O0={"*":()=>[],array:A0,boolean:function(i){const r=i.value,o=i.key,c=pr(r);return c!=="boolean"?[new Et(o,r,`boolean expected, ${c} found`)]:[]},number:Zc,color:function(i){const r=i.key,o=i.value,c=pr(o);return c!=="string"?[new Et(r,o,`color expected, ${c} found`)]:Qd(o)===null?[new Et(r,o,`color expected, "${o}" found`)]:[]},enum:dh,filter:Yc,function:Kc,layer:P0,object:Io,source:M0,light:z0,terrain:Rp,fog:R0,string:ts,formatted:function(i){return ts(i).length===0?[]:Wn(i)},resolvedImage:function(i){return ts(i).length===0?[]:Wn(i)},projection:function(i){const r=i.value,o=i.styleSpec,c=o.projection,p=i.style;let m=[];const y=pr(r);if(y==="object")for(const x in r)m=m.concat(ci({key:x,value:r[x],valueSpec:c[x],style:p,styleSpec:o}));else y!=="string"&&(m=m.concat([new Et("projection",r,`object or string expected, ${y} found`)]));return m}};function ci(i){const r=i.value,o=i.valueSpec,c=i.styleSpec;return o.expression&&Gc(_n(r))?Kc(i):o.expression&&Cl($n(r))?Wn(i):o.type&&O0[o.type]?O0[o.type](i):Io(xa({},i,{valueSpec:o.type?c[o.type]:o}))}function ux(i){const r=i.value,o=i.key,c=ts(i);return c.length||(r.indexOf("{fontstack}")===-1&&c.push(new Et(o,r,'"glyphs" url must include a "{fontstack}" token')),r.indexOf("{range}")===-1&&c.push(new Et(o,r,'"glyphs" url must include a "{range}" token'))),c}function F0(i,r=Ge){return oo(ci({key:"",value:i,valueSpec:r.$root,styleSpec:r,style:i,objectElementValidators:{glyphs:ux,"*":()=>[]}}))}const hx=i=>oo(k0(i)),dx=i=>oo(zp(i));function oo(i){return i.slice().sort((r,o)=>r.line&&o.line?r.line-o.line:0)}function L0(i,r){let o=!1;if(r&&r.length)for(const c of r)i.fire(new va(new Error(c.message))),o=!0;return o}var px=Qo,Co=3;function Qo(i,r,o){var c=this.cells=[];if(i instanceof ArrayBuffer){this.arrayBuffer=i;var p=new Int32Array(this.arrayBuffer);i=p[0],this.d=(r=p[1])+2*(o=p[2]);for(var m=0;m=k[$+0]&&c>=k[$+1])?(y[O]=!0,m.push(S[O])):y[O]=!1}}},Qo.prototype._forEachCell=function(i,r,o,c,p,m,y,x){for(var E=this._convertToCellCoord(i),S=this._convertToCellCoord(r),k=this._convertToCellCoord(o),M=this._convertToCellCoord(c),O=E;O<=k;O++)for(var $=S;$<=M;$++){var G=this.d*$+O;if((!x||x(this._convertFromCellCoord(O),this._convertFromCellCoord($),this._convertFromCellCoord(O+1),this._convertFromCellCoord($+1)))&&p.call(this,i,r,o,c,G,m,y,x))return}},Qo.prototype._convertFromCellCoord=function(i){return(i-this.padding)/this.scale},Qo.prototype._convertToCellCoord=function(i){return Math.max(0,Math.min(this.d-1,Math.floor(i*this.scale)+this.padding))},Qo.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var i=this.cells,r=Co+this.cells.length+1+1,o=0,c=0;c=0||(p[m]=Ml(i[m],r)));i instanceof Error&&(p.message=i.message)}if(p.$name)throw new Error("$name property is reserved for worker serialization logic.");return c!=="Object"&&(p.$name=c),p}throw new Error("can't serialize object of type "+typeof i)}function Us(i){if(i==null||typeof i=="boolean"||typeof i=="number"||typeof i=="string"||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp||Op(i)||Fp(i)||ArrayBuffer.isView(i)||i instanceof w.ImageData)return i;if(Array.isArray(i))return i.map(Us);if(typeof i=="object"){const r=i.$name||"Object",{klass:o}=gh[r];if(!o)throw new Error(`can't deserialize unregistered class ${r}`);if(o.deserialize)return o.deserialize(i);const c=Object.create(o.prototype);for(const p of Object.keys(i))p!=="$name"&&(c[p]=Us(i[p]));return c}throw new Error("can't deserialize object of type "+typeof i)}const xt={"Latin-1 Supplement":i=>i>=128&&i<=255,Arabic:i=>i>=1536&&i<=1791,"Arabic Supplement":i=>i>=1872&&i<=1919,"Arabic Extended-A":i=>i>=2208&&i<=2303,"Hangul Jamo":i=>i>=4352&&i<=4607,"Unified Canadian Aboriginal Syllabics":i=>i>=5120&&i<=5759,Khmer:i=>i>=6016&&i<=6143,"Unified Canadian Aboriginal Syllabics Extended":i=>i>=6320&&i<=6399,"General Punctuation":i=>i>=8192&&i<=8303,"Letterlike Symbols":i=>i>=8448&&i<=8527,"Number Forms":i=>i>=8528&&i<=8591,"Miscellaneous Technical":i=>i>=8960&&i<=9215,"Control Pictures":i=>i>=9216&&i<=9279,"Optical Character Recognition":i=>i>=9280&&i<=9311,"Enclosed Alphanumerics":i=>i>=9312&&i<=9471,"Geometric Shapes":i=>i>=9632&&i<=9727,"Miscellaneous Symbols":i=>i>=9728&&i<=9983,"Miscellaneous Symbols and Arrows":i=>i>=11008&&i<=11263,"CJK Radicals Supplement":i=>i>=11904&&i<=12031,"Kangxi Radicals":i=>i>=12032&&i<=12255,"Ideographic Description Characters":i=>i>=12272&&i<=12287,"CJK Symbols and Punctuation":i=>i>=12288&&i<=12351,Hiragana:i=>i>=12352&&i<=12447,Katakana:i=>i>=12448&&i<=12543,Bopomofo:i=>i>=12544&&i<=12591,"Hangul Compatibility Jamo":i=>i>=12592&&i<=12687,Kanbun:i=>i>=12688&&i<=12703,"Bopomofo Extended":i=>i>=12704&&i<=12735,"CJK Strokes":i=>i>=12736&&i<=12783,"Katakana Phonetic Extensions":i=>i>=12784&&i<=12799,"Enclosed CJK Letters and Months":i=>i>=12800&&i<=13055,"CJK Compatibility":i=>i>=13056&&i<=13311,"CJK Unified Ideographs Extension A":i=>i>=13312&&i<=19903,"Yijing Hexagram Symbols":i=>i>=19904&&i<=19967,"CJK Unified Ideographs":i=>i>=19968&&i<=40959,"Yi Syllables":i=>i>=40960&&i<=42127,"Yi Radicals":i=>i>=42128&&i<=42191,"Hangul Jamo Extended-A":i=>i>=43360&&i<=43391,"Hangul Syllables":i=>i>=44032&&i<=55215,"Hangul Jamo Extended-B":i=>i>=55216&&i<=55295,"Private Use Area":i=>i>=57344&&i<=63743,"CJK Compatibility Ideographs":i=>i>=63744&&i<=64255,"Arabic Presentation Forms-A":i=>i>=64336&&i<=65023,"Vertical Forms":i=>i>=65040&&i<=65055,"CJK Compatibility Forms":i=>i>=65072&&i<=65103,"Small Form Variants":i=>i>=65104&&i<=65135,"Arabic Presentation Forms-B":i=>i>=65136&&i<=65279,"Halfwidth and Fullwidth Forms":i=>i>=65280&&i<=65519};function Lp(i){for(const r of i)if(Bp(r.charCodeAt(0)))return!0;return!1}function fx(i){for(const r of i)if(!B0(r.charCodeAt(0)))return!1;return!0}function B0(i){return!(xt.Arabic(i)||xt["Arabic Supplement"](i)||xt["Arabic Extended-A"](i)||xt["Arabic Presentation Forms-A"](i)||xt["Arabic Presentation Forms-B"](i))}function Bp(i){return!(i!==746&&i!==747&&(i<4352||!(xt["Bopomofo Extended"](i)||xt.Bopomofo(i)||xt["CJK Compatibility Forms"](i)&&!(i>=65097&&i<=65103)||xt["CJK Compatibility Ideographs"](i)||xt["CJK Compatibility"](i)||xt["CJK Radicals Supplement"](i)||xt["CJK Strokes"](i)||!(!xt["CJK Symbols and Punctuation"](i)||i>=12296&&i<=12305||i>=12308&&i<=12319||i===12336)||xt["CJK Unified Ideographs Extension A"](i)||xt["CJK Unified Ideographs"](i)||xt["Enclosed CJK Letters and Months"](i)||xt["Hangul Compatibility Jamo"](i)||xt["Hangul Jamo Extended-A"](i)||xt["Hangul Jamo Extended-B"](i)||xt["Hangul Jamo"](i)||xt["Hangul Syllables"](i)||xt.Hiragana(i)||xt["Ideographic Description Characters"](i)||xt.Kanbun(i)||xt["Kangxi Radicals"](i)||xt["Katakana Phonetic Extensions"](i)||xt.Katakana(i)&&i!==12540||!(!xt["Halfwidth and Fullwidth Forms"](i)||i===65288||i===65289||i===65293||i>=65306&&i<=65310||i===65339||i===65341||i===65343||i>=65371&&i<=65503||i===65507||i>=65512&&i<=65519)||!(!xt["Small Form Variants"](i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||xt["Unified Canadian Aboriginal Syllabics"](i)||xt["Unified Canadian Aboriginal Syllabics Extended"](i)||xt["Vertical Forms"](i)||xt["Yijing Hexagram Symbols"](i)||xt["Yi Syllables"](i)||xt["Yi Radicals"](i))))}function N0(i){return!(Bp(i)||function(r){return!!(xt["Latin-1 Supplement"](r)&&(r===167||r===169||r===174||r===177||r===188||r===189||r===190||r===215||r===247)||xt["General Punctuation"](r)&&(r===8214||r===8224||r===8225||r===8240||r===8241||r===8251||r===8252||r===8258||r===8263||r===8264||r===8265||r===8273)||xt["Letterlike Symbols"](r)||xt["Number Forms"](r)||xt["Miscellaneous Technical"](r)&&(r>=8960&&r<=8967||r>=8972&&r<=8991||r>=8996&&r<=9e3||r===9003||r>=9085&&r<=9114||r>=9150&&r<=9165||r===9167||r>=9169&&r<=9179||r>=9186&&r<=9215)||xt["Control Pictures"](r)&&r!==9251||xt["Optical Character Recognition"](r)||xt["Enclosed Alphanumerics"](r)||xt["Geometric Shapes"](r)||xt["Miscellaneous Symbols"](r)&&!(r>=9754&&r<=9759)||xt["Miscellaneous Symbols and Arrows"](r)&&(r>=11026&&r<=11055||r>=11088&&r<=11097||r>=11192&&r<=11243)||xt["CJK Symbols and Punctuation"](r)||xt.Katakana(r)||xt["Private Use Area"](r)||xt["CJK Compatibility Forms"](r)||xt["Small Form Variants"](r)||xt["Halfwidth and Fullwidth Forms"](r)||r===8734||r===8756||r===8757||r>=9984&&r<=10087||r>=10102&&r<=10131||r===65532||r===65533)}(i))}function U0(i){return i>=1424&&i<=2303||xt["Arabic Presentation Forms-A"](i)||xt["Arabic Presentation Forms-B"](i)}function mx(i,r){return!(!r&&U0(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||xt.Khmer(i))}function gx(i){for(const r of i)if(U0(r.charCodeAt(0)))return!0;return!1}const Np="deferred",Up="loading",jp="loaded";let zl=null,f="unavailable",s=null;const h=function(i){i&&typeof i=="string"&&i.indexOf("NetworkError")>-1&&(f="error"),zl&&zl(i)};function g(){v.fire(new Ms("pluginStateChange",{pluginStatus:f,pluginURL:s}))}const v=new Cc,b=function(){return f},A=function(){if(f!==Np||!s)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");f=Up,g(),s&&Ja({url:s},i=>{i?h(i):(f=jp,g())})},I={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>f===jp||I.applyArabicShaping!=null,isLoading:()=>f===Up,setState(i){f=i.pluginStatus,s=i.pluginURL},isParsed:()=>I.applyArabicShaping!=null&&I.processBidirectionalText!=null&&I.processStyledBidirectionalText!=null,getPluginURL:()=>s};class D{constructor(r,o){this.zoom=r,o?(this.now=o.now,this.fadeDuration=o.fadeDuration,this.transition=o.transition,this.pitch=o.pitch):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0)}isSupportedScript(r){return function(o,c){for(const p of o)if(!mx(p.charCodeAt(0),c))return!1;return!0}(r,I.isLoaded())}}class N{constructor(r,o){this.property=r,this.value=o,this.expression=function(c,p){if(Gc(c))return new uh(c,p);if(Cl(c)){const m=qc(c,p);if(m.result==="error")throw new Error(m.value.map(y=>`${y.key}: ${y.message}`).join(", "));return m.value}{let m=c;return typeof c=="string"&&p.type==="color"&&(m=fn.parse(c)),{kind:"constant",evaluate:()=>m}}}(o===void 0?r.specification.default:o,r.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(r,o,c){return this.property.possiblyEvaluate(this,r,o,c)}}class B{constructor(r){this.property=r,this.value=new N(r,void 0)}transitioned(r,o){return new J(this.property,this.value,o,nt({},r.transition,this.transition),r.now)}untransitioned(){return new J(this.property,this.value,null,{},0)}}class q{constructor(r){this._properties=r,this._values=Object.create(r.defaultTransitionablePropertyValues)}getValue(r){return qr(this._values[r].value.value)}setValue(r,o){this._values.hasOwnProperty(r)||(this._values[r]=new B(this._values[r].property)),this._values[r].value=new N(this._values[r].property,o===null?void 0:qr(o))}getTransition(r){return qr(this._values[r].transition)}setTransition(r,o){this._values.hasOwnProperty(r)||(this._values[r]=new B(this._values[r].property)),this._values[r].transition=qr(o)||void 0}serialize(){const r={};for(const o of Object.keys(this._values)){const c=this.getValue(o);c!==void 0&&(r[o]=c);const p=this.getTransition(o);p!==void 0&&(r[`${o}-transition`]=p)}return r}transitioned(r,o){const c=new ne(this._properties);for(const p of Object.keys(this._values))c._values[p]=this._values[p].transitioned(r,o._values[p]);return c}untransitioned(){const r=new ne(this._properties);for(const o of Object.keys(this._values))r._values[o]=this._values[o].untransitioned();return r}}class J{constructor(r,o,c,p,m){const y=p.delay||0,x=p.duration||0;m=m||0,this.property=r,this.value=o,this.begin=m+y,this.end=this.begin+x,r.specification.transition&&(p.delay||p.duration)&&(this.prior=c)}possiblyEvaluate(r,o,c){const p=r.now||0,m=this.value.possiblyEvaluate(r,o,c),y=this.prior;if(y){if(p>this.end)return this.prior=null,m;if(this.value.isDataDriven())return this.prior=null,m;if(pthis.capacity){this.capacity=Math.max(r,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const o=this.uint8;this._refreshViews(),o&&this.uint8.set(o)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}destroy(){this.int8=this.uint8=this.int16=this.uint16=this.int32=this.uint32=this.float32=null,this.arrayBuffer=null}}function Ie(i,r=1){let o=0,c=0;return{members:i.map(p=>{const m=Se[p.type].BYTES_PER_ELEMENT,y=o=Re(o,Math.max(r,m)),x=p.components||1;return c=Math.max(c,m),o+=m*x,{name:p.name,type:p.type,components:x,offset:y}}),size:Re(o,Math.max(c,r)),alignment:r}}function Re(i,r){return Math.ceil(i/r)*r}class st extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,o){const c=this.length;return this.resize(c+1),this.emplace(c,r,o)}emplace(r,o,c){const p=2*r;return this.int16[p+0]=o,this.int16[p+1]=c,r}}st.prototype.bytesPerElement=4,At(st,"StructArrayLayout2i4");class De extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,o,c){const p=this.length;return this.resize(p+1),this.emplace(p,r,o,c)}emplace(r,o,c,p){const m=3*r;return this.int16[m+0]=o,this.int16[m+1]=c,this.int16[m+2]=p,r}}De.prototype.bytesPerElement=6,At(De,"StructArrayLayout3i6");class Ke extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,o,c,p){const m=this.length;return this.resize(m+1),this.emplace(m,r,o,c,p)}emplace(r,o,c,p,m){const y=4*r;return this.int16[y+0]=o,this.int16[y+1]=c,this.int16[y+2]=p,this.int16[y+3]=m,r}}Ke.prototype.bytesPerElement=8,At(Ke,"StructArrayLayout4i8");class Ne extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,o,c,p,m,y,x){const E=this.length;return this.resize(E+1),this.emplace(E,r,o,c,p,m,y,x)}emplace(r,o,c,p,m,y,x,E){const S=6*r,k=12*r,M=3*r;return this.int16[S+0]=o,this.int16[S+1]=c,this.uint8[k+4]=p,this.uint8[k+5]=m,this.uint8[k+6]=y,this.uint8[k+7]=x,this.float32[M+2]=E,r}}Ne.prototype.bytesPerElement=12,At(Ne,"StructArrayLayout2i4ub1f12");class at extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,o,c,p){const m=this.length;return this.resize(m+1),this.emplace(m,r,o,c,p)}emplace(r,o,c,p,m){const y=4*r;return this.float32[y+0]=o,this.float32[y+1]=c,this.float32[y+2]=p,this.float32[y+3]=m,r}}at.prototype.bytesPerElement=16,At(at,"StructArrayLayout4f16");class ze extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,o,c,p,m){const y=this.length;return this.resize(y+1),this.emplace(y,r,o,c,p,m)}emplace(r,o,c,p,m,y){const x=6*r,E=3*r;return this.uint16[x+0]=o,this.uint16[x+1]=c,this.uint16[x+2]=p,this.uint16[x+3]=m,this.float32[E+2]=y,r}}ze.prototype.bytesPerElement=12,At(ze,"StructArrayLayout4ui1f12");class Ze extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r,o,c,p){const m=this.length;return this.resize(m+1),this.emplace(m,r,o,c,p)}emplace(r,o,c,p,m){const y=4*r;return this.uint16[y+0]=o,this.uint16[y+1]=c,this.uint16[y+2]=p,this.uint16[y+3]=m,r}}Ze.prototype.bytesPerElement=8,At(Ze,"StructArrayLayout4ui8");class ut extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,o,c,p,m,y){const x=this.length;return this.resize(x+1),this.emplace(x,r,o,c,p,m,y)}emplace(r,o,c,p,m,y,x){const E=6*r;return this.int16[E+0]=o,this.int16[E+1]=c,this.int16[E+2]=p,this.int16[E+3]=m,this.int16[E+4]=y,this.int16[E+5]=x,r}}ut.prototype.bytesPerElement=12,At(ut,"StructArrayLayout6i12");class tt extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r,o,c,p,m,y,x,E,S,k,M,O){const $=this.length;return this.resize($+1),this.emplace($,r,o,c,p,m,y,x,E,S,k,M,O)}emplace(r,o,c,p,m,y,x,E,S,k,M,O,$){const G=12*r;return this.int16[G+0]=o,this.int16[G+1]=c,this.int16[G+2]=p,this.int16[G+3]=m,this.uint16[G+4]=y,this.uint16[G+5]=x,this.uint16[G+6]=E,this.uint16[G+7]=S,this.int16[G+8]=k,this.int16[G+9]=M,this.int16[G+10]=O,this.int16[G+11]=$,r}}tt.prototype.bytesPerElement=24,At(tt,"StructArrayLayout4i4ui4i24");class ht extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,o,c,p,m,y){const x=this.length;return this.resize(x+1),this.emplace(x,r,o,c,p,m,y)}emplace(r,o,c,p,m,y,x){const E=10*r,S=5*r;return this.int16[E+0]=o,this.int16[E+1]=c,this.int16[E+2]=p,this.float32[S+2]=m,this.float32[S+3]=y,this.float32[S+4]=x,r}}ht.prototype.bytesPerElement=20,At(ht,"StructArrayLayout3i3f20");class Mt extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(r){const o=this.length;return this.resize(o+1),this.emplace(o,r)}emplace(r,o){return this.uint32[1*r+0]=o,r}}Mt.prototype.bytesPerElement=4,At(Mt,"StructArrayLayout1ul4");class $t extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r,o,c,p,m,y,x,E,S,k,M,O,$){const G=this.length;return this.resize(G+1),this.emplace(G,r,o,c,p,m,y,x,E,S,k,M,O,$)}emplace(r,o,c,p,m,y,x,E,S,k,M,O,$,G){const K=20*r,ee=10*r;return this.int16[K+0]=o,this.int16[K+1]=c,this.int16[K+2]=p,this.int16[K+3]=m,this.int16[K+4]=y,this.float32[ee+3]=x,this.float32[ee+4]=E,this.float32[ee+5]=S,this.float32[ee+6]=k,this.int16[K+14]=M,this.uint32[ee+8]=O,this.uint16[K+18]=$,this.uint16[K+19]=G,r}}$t.prototype.bytesPerElement=40,At($t,"StructArrayLayout5i4f1i1ul2ui40");class It extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,o,c,p,m,y,x){const E=this.length;return this.resize(E+1),this.emplace(E,r,o,c,p,m,y,x)}emplace(r,o,c,p,m,y,x,E){const S=8*r;return this.int16[S+0]=o,this.int16[S+1]=c,this.int16[S+2]=p,this.int16[S+4]=m,this.int16[S+5]=y,this.int16[S+6]=x,this.int16[S+7]=E,r}}It.prototype.bytesPerElement=16,At(It,"StructArrayLayout3i2i2i16");class Lt extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,o,c,p,m){const y=this.length;return this.resize(y+1),this.emplace(y,r,o,c,p,m)}emplace(r,o,c,p,m,y){const x=4*r,E=8*r;return this.float32[x+0]=o,this.float32[x+1]=c,this.float32[x+2]=p,this.int16[E+6]=m,this.int16[E+7]=y,r}}Lt.prototype.bytesPerElement=16,At(Lt,"StructArrayLayout2f1f2i16");class nr extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,o,c,p){const m=this.length;return this.resize(m+1),this.emplace(m,r,o,c,p)}emplace(r,o,c,p,m){const y=12*r,x=3*r;return this.uint8[y+0]=o,this.uint8[y+1]=c,this.float32[x+1]=p,this.float32[x+2]=m,r}}nr.prototype.bytesPerElement=12,At(nr,"StructArrayLayout2ub2f12");class er extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,o,c){const p=this.length;return this.resize(p+1),this.emplace(p,r,o,c)}emplace(r,o,c,p){const m=3*r;return this.float32[m+0]=o,this.float32[m+1]=c,this.float32[m+2]=p,r}}er.prototype.bytesPerElement=12,At(er,"StructArrayLayout3f12");class Pt extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r,o,c){const p=this.length;return this.resize(p+1),this.emplace(p,r,o,c)}emplace(r,o,c,p){const m=3*r;return this.uint16[m+0]=o,this.uint16[m+1]=c,this.uint16[m+2]=p,r}}Pt.prototype.bytesPerElement=6,At(Pt,"StructArrayLayout3ui6");class Ar extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(r,o,c,p,m,y,x,E,S,k,M,O,$,G,K,ee,le,me,ce,pe,_e){const ye=this.length;return this.resize(ye+1),this.emplace(ye,r,o,c,p,m,y,x,E,S,k,M,O,$,G,K,ee,le,me,ce,pe,_e)}emplace(r,o,c,p,m,y,x,E,S,k,M,O,$,G,K,ee,le,me,ce,pe,_e,ye){const Oe=30*r,Me=15*r,He=60*r;return this.int16[Oe+0]=o,this.int16[Oe+1]=c,this.int16[Oe+2]=p,this.float32[Me+2]=m,this.float32[Me+3]=y,this.uint16[Oe+8]=x,this.uint16[Oe+9]=E,this.uint32[Me+5]=S,this.uint32[Me+6]=k,this.uint32[Me+7]=M,this.uint16[Oe+16]=O,this.uint16[Oe+17]=$,this.uint16[Oe+18]=G,this.float32[Me+10]=K,this.float32[Me+11]=ee,this.uint8[He+48]=le,this.uint8[He+49]=me,this.uint8[He+50]=ce,this.uint32[Me+13]=pe,this.int16[Oe+28]=_e,this.uint8[He+58]=ye,r}}Ar.prototype.bytesPerElement=60,At(Ar,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class Mr extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(r,o,c,p,m,y,x,E,S,k,M,O,$,G,K,ee,le,me,ce,pe,_e,ye,Oe,Me,He,lt,Ue,Qe,Je,ot){const pt=this.length;return this.resize(pt+1),this.emplace(pt,r,o,c,p,m,y,x,E,S,k,M,O,$,G,K,ee,le,me,ce,pe,_e,ye,Oe,Me,He,lt,Ue,Qe,Je,ot)}emplace(r,o,c,p,m,y,x,E,S,k,M,O,$,G,K,ee,le,me,ce,pe,_e,ye,Oe,Me,He,lt,Ue,Qe,Je,ot,pt){const We=38*r,_t=19*r;return this.int16[We+0]=o,this.int16[We+1]=c,this.int16[We+2]=p,this.float32[_t+2]=m,this.float32[_t+3]=y,this.int16[We+8]=x,this.int16[We+9]=E,this.int16[We+10]=S,this.int16[We+11]=k,this.int16[We+12]=M,this.int16[We+13]=O,this.uint16[We+14]=$,this.uint16[We+15]=G,this.uint16[We+16]=K,this.uint16[We+17]=ee,this.uint16[We+18]=le,this.uint16[We+19]=me,this.uint16[We+20]=ce,this.uint16[We+21]=pe,this.uint16[We+22]=_e,this.uint16[We+23]=ye,this.uint16[We+24]=Oe,this.uint16[We+25]=Me,this.uint16[We+26]=He,this.uint16[We+27]=lt,this.uint16[We+28]=Ue,this.uint32[_t+15]=Qe,this.float32[_t+16]=Je,this.float32[_t+17]=ot,this.float32[_t+18]=pt,r}}Mr.prototype.bytesPerElement=76,At(Mr,"StructArrayLayout3i2f6i15ui1ul3f76");class zr extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r){const o=this.length;return this.resize(o+1),this.emplace(o,r)}emplace(r,o){return this.float32[1*r+0]=o,r}}zr.prototype.bytesPerElement=4,At(zr,"StructArrayLayout1f4");class Rr extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,o,c,p,m){const y=this.length;return this.resize(y+1),this.emplace(y,r,o,c,p,m)}emplace(r,o,c,p,m,y){const x=5*r;return this.float32[x+0]=o,this.float32[x+1]=c,this.float32[x+2]=p,this.float32[x+3]=m,this.float32[x+4]=y,r}}Rr.prototype.bytesPerElement=20,At(Rr,"StructArrayLayout5f20");class ui extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r,o,c,p){const m=this.length;return this.resize(m+1),this.emplace(m,r,o,c,p)}emplace(r,o,c,p,m){const y=6*r;return this.uint32[3*r+0]=o,this.uint16[y+2]=c,this.uint16[y+3]=p,this.uint16[y+4]=m,r}}ui.prototype.bytesPerElement=12,At(ui,"StructArrayLayout1ul3ui12");class Gn extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r,o){const c=this.length;return this.resize(c+1),this.emplace(c,r,o)}emplace(r,o,c){const p=2*r;return this.uint16[p+0]=o,this.uint16[p+1]=c,r}}Gn.prototype.bytesPerElement=4,At(Gn,"StructArrayLayout2ui4");class ao extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r){const o=this.length;return this.resize(o+1),this.emplace(o,r)}emplace(r,o){return this.uint16[1*r+0]=o,r}}ao.prototype.bytesPerElement=2,At(ao,"StructArrayLayout1ui2");class Jo extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,o){const c=this.length;return this.resize(c+1),this.emplace(c,r,o)}emplace(r,o,c){const p=2*r;return this.float32[p+0]=o,this.float32[p+1]=c,r}}Jo.prototype.bytesPerElement=8,At(Jo,"StructArrayLayout2f8");class Yr extends we{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.int16[this._pos2+3]}get tileAnchorY(){return this._structArray.int16[this._pos2+4]}get x1(){return this._structArray.float32[this._pos4+3]}get y1(){return this._structArray.float32[this._pos4+4]}get x2(){return this._structArray.float32[this._pos4+5]}get y2(){return this._structArray.float32[this._pos4+6]}get padding(){return this._structArray.int16[this._pos2+14]}get featureIndex(){return this._structArray.uint32[this._pos4+8]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+18]}get bucketIndex(){return this._structArray.uint16[this._pos2+19]}}Yr.prototype.size=40;class Or extends $t{get(r){return new Yr(this,r)}}At(Or,"CollisionBoxArray");class gr extends we{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+8]}get numGlyphs(){return this._structArray.uint16[this._pos2+9]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+5]}get lineStartIndex(){return this._structArray.uint32[this._pos4+6]}get lineLength(){return this._structArray.uint32[this._pos4+7]}get segment(){return this._structArray.uint16[this._pos2+16]}get lowerSize(){return this._structArray.uint16[this._pos2+17]}get upperSize(){return this._structArray.uint16[this._pos2+18]}get lineOffsetX(){return this._structArray.float32[this._pos4+10]}get lineOffsetY(){return this._structArray.float32[this._pos4+11]}get writingMode(){return this._structArray.uint8[this._pos1+48]}get placedOrientation(){return this._structArray.uint8[this._pos1+49]}set placedOrientation(r){this._structArray.uint8[this._pos1+49]=r}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(r){this._structArray.uint8[this._pos1+50]=r}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(r){this._structArray.uint32[this._pos4+13]=r}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(r){this._structArray.uint8[this._pos1+58]=r}}gr.prototype.size=60;class vn extends Ar{get(r){return new gr(this,r)}}At(vn,"PlacedSymbolArray");class vi extends we{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+8]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+9]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+10]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+11]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+12]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+13]}get key(){return this._structArray.uint16[this._pos2+14]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+17]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+18]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+19]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+20]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+21]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+22]}get featureIndex(){return this._structArray.uint16[this._pos2+23]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+24]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+25]}get numIconVertices(){return this._structArray.uint16[this._pos2+26]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+27]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+28]}get crossTileID(){return this._structArray.uint32[this._pos4+15]}set crossTileID(r){this._structArray.uint32[this._pos4+15]=r}get textOffset0(){return this._structArray.float32[this._pos4+16]}get textOffset1(){return this._structArray.float32[this._pos4+17]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+18]}}vi.prototype.size=76;class Zr extends Mr{get(r){return new vi(this,r)}}At(Zr,"SymbolInstanceArray");class Pi extends zr{getoffsetX(r){return this.float32[1*r+0]}}At(Pi,"GlyphOffsetArray");class yh extends st{getx(r){return this.int16[2*r+0]}gety(r){return this.int16[2*r+1]}}At(yh,"SymbolLineVertexArray");class js extends we{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]}get layoutVertexArrayOffset(){return this._structArray.uint16[this._pos2+4]}}js.prototype.size=12;class Jc extends ui{get(r){return new js(this,r)}}At(Jc,"FeatureIndexArray");class Ca extends Gn{geta_centroid_pos0(r){return this.uint16[2*r+0]}geta_centroid_pos1(r){return this.uint16[2*r+1]}}At(Ca,"FillExtrusionCentroidArray");const rs=Ie([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),Vs=Ie([{name:"a_dash",components:4,type:"Uint16"}]);var _h={exports:{}},eu={exports:{}};eu.exports=function(i,r){var o,c,p,m,y,x,E,S;for(c=i.length-(o=3&i.length),p=r,y=3432918353,x=461845907,S=0;S>>16)*y&65535)<<16)&4294967295)<<15|E>>>17))*x+(((E>>>16)*x&65535)<<16)&4294967295)<<13|p>>>19))+((5*(p>>>16)&65535)<<16)&4294967295))+((58964+(m>>>16)&65535)<<16);switch(E=0,o){case 3:E^=(255&i.charCodeAt(S+2))<<16;case 2:E^=(255&i.charCodeAt(S+1))<<8;case 1:p^=E=(65535&(E=(E=(65535&(E^=255&i.charCodeAt(S)))*y+(((E>>>16)*y&65535)<<16)&4294967295)<<15|E>>>17))*x+(((E>>>16)*x&65535)<<16)&4294967295}return p^=i.length,p=2246822507*(65535&(p^=p>>>16))+((2246822507*(p>>>16)&65535)<<16)&4294967295,p=3266489909*(65535&(p^=p>>>13))+((3266489909*(p>>>16)&65535)<<16)&4294967295,(p^=p>>>16)>>>0};var Vp=eu.exports,MA={exports:{}};MA.exports=function(i,r){for(var o,c=i.length,p=r^c,m=0;c>=4;)o=1540483477*(65535&(o=255&i.charCodeAt(m)|(255&i.charCodeAt(++m))<<8|(255&i.charCodeAt(++m))<<16|(255&i.charCodeAt(++m))<<24))+((1540483477*(o>>>16)&65535)<<16),p=1540483477*(65535&p)+((1540483477*(p>>>16)&65535)<<16)^(o=1540483477*(65535&(o^=o>>>24))+((1540483477*(o>>>16)&65535)<<16)),c-=4,++m;switch(c){case 3:p^=(255&i.charCodeAt(m+2))<<16;case 2:p^=(255&i.charCodeAt(m+1))<<8;case 1:p=1540483477*(65535&(p^=255&i.charCodeAt(m)))+((1540483477*(p>>>16)&65535)<<16)}return p=1540483477*(65535&(p^=p>>>13))+((1540483477*(p>>>16)&65535)<<16),(p^=p>>>15)>>>0};var zA=Vp,qO=MA.exports;_h.exports=zA,_h.exports.murmur3=zA,_h.exports.murmur2=qO;var yx=F(_h.exports);class j0{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(r,o,c,p){this.ids.push(RA(r)),this.positions.push(o,c,p)}getPositions(r){const o=RA(r);let c=0,p=this.ids.length-1;for(;c>1;this.ids[y]>=o?p=y:c=y+1}const m=[];for(;this.ids[c]===o;)m.push({index:this.positions[3*c],start:this.positions[3*c+1],end:this.positions[3*c+2]}),c++;return m}static serialize(r,o){const c=new Float64Array(r.ids),p=new Uint32Array(r.positions);return _x(c,p,0,c.length-1),o&&o.push(c.buffer,p.buffer),{ids:c,positions:p}}static deserialize(r){const o=new j0;return o.ids=r.ids,o.positions=r.positions,o.indexed=!0,o}}function RA(i){const r=+i;return!isNaN(r)&&Number.MIN_SAFE_INTEGER<=r&&r<=Number.MAX_SAFE_INTEGER?r:yx(String(i))}function _x(i,r,o,c){for(;o>1];let m=o-1,y=c+1;for(;;){do m++;while(i[m]p);if(m>=y)break;V0(i,m,y),V0(r,3*m,3*y),V0(r,3*m+1,3*y+1),V0(r,3*m+2,3*y+2)}y-o`u_${p}`),this.type=c}setUniform(r,o,c,p,m){o.set(r,m,p.constantOr(this.value))}getBinding(r,o){return this.type==="color"?new FA(r):new $0(r)}}class vh{constructor(r,o){this.uniformNames=o.map(c=>`u_${c}`),this.pattern=null,this.pixelRatio=1}setConstantPatternPositions(r){this.pixelRatio=r.pixelRatio||1,this.pattern=r.tl.concat(r.br)}setUniform(r,o,c,p,m){const y=m==="u_pattern"||m==="u_dash"?this.pattern:m==="u_pixel_ratio"?this.pixelRatio:null;y&&o.set(r,m,y)}getBinding(r,o){return o==="u_pattern"||o==="u_dash"?new OA(r):new $0(r)}}class Ws{constructor(r,o,c,p){this.expression=r,this.type=c,this.maxValue=0,this.paintVertexAttributes=o.map(m=>({name:`a_${m}`,type:"Float32",components:c==="color"?2:1,offset:0})),this.paintVertexArray=new p}populatePaintArray(r,o,c,p,m,y){const x=this.paintVertexArray.length,E=this.expression.evaluate(new D(0),o,{},m,p,y);this.paintVertexArray.resize(r),this._setPaintValue(x,r,E)}updatePaintArray(r,o,c,p,m){const y=this.expression.evaluate({zoom:0},c,p,void 0,m);this._setPaintValue(r,o,y)}_setPaintValue(r,o,c){if(this.type==="color"){const p=vx(c);for(let m=r;m`u_${x}_t`),this.type=c,this.useIntegerZoom=p,this.zoom=m,this.maxValue=0,this.paintVertexAttributes=o.map(x=>({name:`a_${x}`,type:"Float32",components:c==="color"?4:2,offset:0})),this.paintVertexArray=new y}populatePaintArray(r,o,c,p,m,y){const x=this.expression.evaluate(new D(this.zoom),o,{},m,p,y),E=this.expression.evaluate(new D(this.zoom+1),o,{},m,p,y),S=this.paintVertexArray.length;this.paintVertexArray.resize(r),this._setPaintValue(S,r,x,E)}updatePaintArray(r,o,c,p,m){const y=this.expression.evaluate({zoom:this.zoom},c,p,void 0,m),x=this.expression.evaluate({zoom:this.zoom+1},c,p,void 0,m);this._setPaintValue(r,o,y,x)}_setPaintValue(r,o,c,p){if(this.type==="color"){const m=vx(c),y=vx(p);for(let x=r;x!0){this.binders={},this._buffers=[];const p=[];for(const m in r.paint._values){if(!c(m))continue;const y=r.paint.get(m);if(!(y instanceof ie&&Al(y.property.specification)))continue;const x=QO(m,r.type),E=y.value,S=y.property.specification.type,k=!!y.property.useIntegerZoom,M=m==="line-dasharray"||m.endsWith("pattern"),O=m==="line-dasharray"&&r.layout.get("line-cap").value.kind!=="constant";if(E.kind!=="constant"||O)if(E.kind==="source"||O||M){const $=LA(m,S,"source");this.binders[m]=M?new Rl(E,x,S,$,r.id):new Ws(E,x,S,$),p.push(`/a_${m}`)}else{const $=LA(m,S,"composite");this.binders[m]=new ka(E,x,S,k,o,$),p.push(`/z_${m}`)}else this.binders[m]=M?new vh(E.value,x):new $p(E.value,x,S),p.push(`/u_${m}`)}this.cacheKey=p.sort().join("")}getMaxValue(r){const o=this.binders[r];return o instanceof Ws||o instanceof ka?o.maxValue:0}populatePaintArrays(r,o,c,p,m,y){for(const x in this.binders){const E=this.binders[x];(E instanceof Ws||E instanceof ka||E instanceof Rl)&&E.populatePaintArray(r,o,c,p,m,y)}}setConstantPatternPositions(r){for(const o in this.binders){const c=this.binders[o];c instanceof vh&&c.setConstantPatternPositions(r)}}updatePaintArrays(r,o,c,p,m,y){let x=!1;for(const E in r){const S=o.getPositions(E);for(const k of S){const M=c.feature(k.index);for(const O in this.binders){const $=this.binders[O];if(($ instanceof Ws||$ instanceof ka||$ instanceof Rl)&&$.expression.isStateDependent===!0){const G=p.paint.get(O);$.expression=G.value,$.updatePaintArray(k.start,k.end,M,r[E],m,y),x=!0}}}}return x}defines(){const r=[];for(const o in this.binders){const c=this.binders[o];(c instanceof $p||c instanceof vh)&&r.push(...c.uniformNames.map(p=>`#define HAS_UNIFORM_${p}`))}return r}getBinderAttributes(){const r=[];for(const o in this.binders){const c=this.binders[o];if(c instanceof Ws||c instanceof ka||c instanceof Rl)for(let p=0;p!0){this.programConfigurations={};for(const p of r)this.programConfigurations[p.id]=new Ol(p,o,c);this.needsUpload=!1,this._featureMap=new j0,this._bufferOffset=0}populatePaintArrays(r,o,c,p,m,y,x){for(const E in this.programConfigurations)this.programConfigurations[E].populatePaintArrays(r,o,p,m,y,x);o.id!==void 0&&this._featureMap.add(o.id,c,this._bufferOffset,r),this._bufferOffset=r,this.needsUpload=!0}updatePaintArrays(r,o,c,p,m){for(const y of c)this.needsUpload=this.programConfigurations[y.id].updatePaintArrays(r,this._featureMap,o,y,p,m)||this.needsUpload}get(r){return this.programConfigurations[r]}upload(r){if(this.needsUpload){for(const o in this.programConfigurations)this.programConfigurations[o].upload(r);this.needsUpload=!1}}destroy(){for(const r in this.programConfigurations)this.programConfigurations[r].destroy()}}const YO={"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","pixel_ratio"],"fill-pattern":["pattern","pixel_ratio"],"fill-extrusion-pattern":["pattern","pixel_ratio"],"line-dasharray":["dash"]};function QO(i,r){return YO[i]||[i.replace(`${r}-`,"").replace(/-/g,"_")]}const JO={"line-pattern":{source:ze,composite:ze},"fill-pattern":{source:ze,composite:ze},"fill-extrusion-pattern":{source:ze,composite:ze},"line-dasharray":{source:Ze,composite:Ze}},e5={color:{source:Jo,composite:at},number:{source:zr,composite:Jo}};function LA(i,r,o){const c=JO[i];return c&&c[o]||e5[r][o]}At($p,"ConstantBinder"),At(vh,"PatternConstantBinder"),At(Ws,"SourceExpressionBinder"),At(Rl,"PatternCompositeBinder"),At(ka,"CompositeExpressionBinder"),At(Ol,"ProgramConfiguration",{omit:["_buffers"]}),At(tu,"ProgramConfigurationSet");const BA="-transition";class Pa extends Cc{constructor(r,o){if(super(),this.id=r.id,this.type=r.type,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,r.type!=="custom"&&(this.metadata=r.metadata,this.minzoom=r.minzoom,this.maxzoom=r.maxzoom,r.type!=="background"&&r.type!=="sky"&&(this.source=r.source,this.sourceLayer=r["source-layer"],this.filter=r.filter),o.layout&&(this._unevaluatedLayout=new oe(o.layout)),o.paint)){this._transitionablePaint=new q(o.paint);for(const c in r.paint)this.setPaintProperty(c,r.paint[c],{validate:!1});for(const c in r.layout)this.setLayoutProperty(c,r.layout[c],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new ae(o.paint)}}getLayoutProperty(r){return r==="visibility"?this.visibility:this._unevaluatedLayout.getValue(r)}setLayoutProperty(r,o,c={}){o!=null&&this._validate(dx,`layers.${this.id}.layout.${r}`,r,o,c)||(r!=="visibility"?this._unevaluatedLayout.setValue(r,o):this.visibility=o)}getPaintProperty(r){return mr(r,BA)?this._transitionablePaint.getTransition(r.slice(0,-11)):this._transitionablePaint.getValue(r)}setPaintProperty(r,o,c={}){if(o!=null&&this._validate(hx,`layers.${this.id}.paint.${r}`,r,o,c))return!1;if(mr(r,BA))return this._transitionablePaint.setTransition(r.slice(0,-11),o||void 0),!1;{const p=this._transitionablePaint._values[r],m=p.value.isDataDriven(),y=p.value;this._transitionablePaint.setValue(r,o),this._handleSpecialPaintPropertyUpdate(r);const x=this._transitionablePaint._values[r].value,E=x.isDataDriven(),S=mr(r,"pattern")||r==="line-dasharray";return E||m||S||this._handleOverridablePaintPropertyUpdate(r,y,x)}}_handleSpecialPaintPropertyUpdate(r){}getProgramIds(){return null}getProgramConfiguration(r){return null}_handleOverridablePaintPropertyUpdate(r,o,c){return!1}isHidden(r){return!!(this.minzoom&&r=this.maxzoom)||this.visibility==="none"}updateTransitions(r){this._transitioningPaint=this._transitionablePaint.transitioned(r,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(r,o){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(r,void 0,o)),this.paint=this._transitioningPaint.possiblyEvaluate(r,void 0,o)}serialize(){const r={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&&(r.layout=r.layout||{},r.layout.visibility=this.visibility),Ii(r,(o,c)=>!(o===void 0||c==="layout"&&!Object.keys(o).length||c==="paint"&&!Object.keys(o).length))}_validate(r,o,c,p,m={}){return(!m||m.validate!==!1)&&L0(this,r.call(F0,{key:o,layerType:this.type,objectKey:c,value:p,styleSpec:Ge,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const r in this.paint._values){const o=this.paint.get(r);if(o instanceof ie&&Al(o.property.specification)&&(o.value.kind==="source"||o.value.kind==="composite")&&o.value.isStateDependent)return!0}return!1}compileFilter(){this._filterCompiled||(this._featureFilter=ph(this.filter),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}}const t5=Ie([{name:"a_pos",components:2,type:"Int16"}],4),r5=Ie([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class xn{constructor(r=[]){this.segments=r}prepareSegment(r,o,c,p){let m=this.segments[this.segments.length-1];return r>xn.MAX_VERTEX_ARRAY_LENGTH&&Tr(`Max vertices per segment is ${xn.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${r}`),(!m||m.vertexLength+r>xn.MAX_VERTEX_ARRAY_LENGTH||m.sortKey!==p)&&(m={vertexOffset:o.length,primitiveOffset:c.length,vertexLength:0,primitiveLength:0},p!==void 0&&(m.sortKey=p),this.segments.push(m)),m}get(){return this.segments}destroy(){for(const r of this.segments)for(const o in r.vaos)r.vaos[o].destroy()}static simpleSegment(r,o,c,p){return new xn([{vertexOffset:r,primitiveOffset:o,vertexLength:c,primitiveLength:p,vaos:{},sortKey:0}])}}xn.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,At(xn,"SegmentVector");var Ot=8192;class Fl{constructor(r,o){r&&(o?this.setSouthWest(r).setNorthEast(o):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 Fr?new Fr(r.lng,r.lat):Fr.convert(r),this}setSouthWest(r){return this._sw=r instanceof Fr?new Fr(r.lng,r.lat):Fr.convert(r),this}extend(r){const o=this._sw,c=this._ne;let p,m;if(r instanceof Fr)p=r,m=r;else{if(!(r instanceof Fl))return Array.isArray(r)?r.length===4||r.every(Array.isArray)?this.extend(Fl.convert(r)):this.extend(Fr.convert(r)):typeof r=="object"&&r!==null&&r.hasOwnProperty("lat")&&(r.hasOwnProperty("lon")||r.hasOwnProperty("lng"))?this.extend(Fr.convert(r)):this;if(p=r._sw,m=r._ne,!p||!m)return this}return o||c?(o.lng=Math.min(p.lng,o.lng),o.lat=Math.min(p.lat,o.lat),c.lng=Math.max(m.lng,c.lng),c.lat=Math.max(m.lat,c.lat)):(this._sw=new Fr(p.lng,p.lat),this._ne=new Fr(m.lng,m.lat)),this}getCenter(){return new Fr((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 Fr(this.getWest(),this.getNorth())}getSouthEast(){return new Fr(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:o,lat:c}=Fr.convert(r);let p=this._sw.lng<=o&&o<=this._ne.lng;return this._sw.lng>this._ne.lng&&(p=this._sw.lng>=o&&o>=this._ne.lng),this._sw.lat<=c&&c<=this._ne.lat&&p}static convert(r){return!r||r instanceof Fl?r:new Fl(r)}}var W0=1e-6,so=typeof Float32Array<"u"?Float32Array:Array;function NA(){var i=new so(9);return so!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[5]=0,i[6]=0,i[7]=0),i[0]=1,i[4]=1,i[8]=1,i}function UA(i,r,o){var c=r[0],p=r[1],m=r[2],y=r[3],x=r[4],E=r[5],S=r[6],k=r[7],M=r[8],O=o[0],$=o[1],G=o[2],K=o[3],ee=o[4],le=o[5],me=o[6],ce=o[7],pe=o[8];return i[0]=O*c+$*y+G*S,i[1]=O*p+$*x+G*k,i[2]=O*m+$*E+G*M,i[3]=K*c+ee*y+le*S,i[4]=K*p+ee*x+le*k,i[5]=K*m+ee*E+le*M,i[6]=me*c+ce*y+pe*S,i[7]=me*p+ce*x+pe*k,i[8]=me*m+ce*E+pe*M,i}function Da(i){return i[0]=1,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=1,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=1,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i}function xx(i,r){var o=r[0],c=r[1],p=r[2],m=r[3],y=r[4],x=r[5],E=r[6],S=r[7],k=r[8],M=r[9],O=r[10],$=r[11],G=r[12],K=r[13],ee=r[14],le=r[15],me=o*x-c*y,ce=o*E-p*y,pe=o*S-m*y,_e=c*E-p*x,ye=c*S-m*x,Oe=p*S-m*E,Me=k*K-M*G,He=k*ee-O*G,lt=k*le-$*G,Ue=M*ee-O*K,Qe=M*le-$*K,Je=O*le-$*ee,ot=me*Je-ce*Qe+pe*Ue+_e*lt-ye*He+Oe*Me;return ot?(i[0]=(x*Je-E*Qe+S*Ue)*(ot=1/ot),i[1]=(p*Qe-c*Je-m*Ue)*ot,i[2]=(K*Oe-ee*ye+le*_e)*ot,i[3]=(O*ye-M*Oe-$*_e)*ot,i[4]=(E*lt-y*Je-S*He)*ot,i[5]=(o*Je-p*lt+m*He)*ot,i[6]=(ee*pe-G*Oe-le*ce)*ot,i[7]=(k*Oe-O*pe+$*ce)*ot,i[8]=(y*Qe-x*lt+S*Me)*ot,i[9]=(c*lt-o*Qe-m*Me)*ot,i[10]=(G*ye-K*pe+le*me)*ot,i[11]=(M*pe-k*ye-$*me)*ot,i[12]=(x*He-y*Ue-E*Me)*ot,i[13]=(o*Ue-c*He+p*Me)*ot,i[14]=(K*ce-G*_e-ee*me)*ot,i[15]=(k*_e-M*ce+O*me)*ot,i):null}function ru(i,r,o){var c=r[0],p=r[1],m=r[2],y=r[3],x=r[4],E=r[5],S=r[6],k=r[7],M=r[8],O=r[9],$=r[10],G=r[11],K=r[12],ee=r[13],le=r[14],me=r[15],ce=o[0],pe=o[1],_e=o[2],ye=o[3];return i[0]=ce*c+pe*x+_e*M+ye*K,i[1]=ce*p+pe*E+_e*O+ye*ee,i[2]=ce*m+pe*S+_e*$+ye*le,i[3]=ce*y+pe*k+_e*G+ye*me,i[4]=(ce=o[4])*c+(pe=o[5])*x+(_e=o[6])*M+(ye=o[7])*K,i[5]=ce*p+pe*E+_e*O+ye*ee,i[6]=ce*m+pe*S+_e*$+ye*le,i[7]=ce*y+pe*k+_e*G+ye*me,i[8]=(ce=o[8])*c+(pe=o[9])*x+(_e=o[10])*M+(ye=o[11])*K,i[9]=ce*p+pe*E+_e*O+ye*ee,i[10]=ce*m+pe*S+_e*$+ye*le,i[11]=ce*y+pe*k+_e*G+ye*me,i[12]=(ce=o[12])*c+(pe=o[13])*x+(_e=o[14])*M+(ye=o[15])*K,i[13]=ce*p+pe*E+_e*O+ye*ee,i[14]=ce*m+pe*S+_e*$+ye*le,i[15]=ce*y+pe*k+_e*G+ye*me,i}function Wp(i,r,o){var c,p,m,y,x,E,S,k,M,O,$,G,K=o[0],ee=o[1],le=o[2];return r===i?(i[12]=r[0]*K+r[4]*ee+r[8]*le+r[12],i[13]=r[1]*K+r[5]*ee+r[9]*le+r[13],i[14]=r[2]*K+r[6]*ee+r[10]*le+r[14],i[15]=r[3]*K+r[7]*ee+r[11]*le+r[15]):(p=r[1],m=r[2],y=r[3],x=r[4],E=r[5],S=r[6],k=r[7],M=r[8],O=r[9],$=r[10],G=r[11],i[0]=c=r[0],i[1]=p,i[2]=m,i[3]=y,i[4]=x,i[5]=E,i[6]=S,i[7]=k,i[8]=M,i[9]=O,i[10]=$,i[11]=G,i[12]=c*K+x*ee+M*le+r[12],i[13]=p*K+E*ee+O*le+r[13],i[14]=m*K+S*ee+$*le+r[14],i[15]=y*K+k*ee+G*le+r[15]),i}function nu(i,r,o){var c=o[0],p=o[1],m=o[2];return i[0]=r[0]*c,i[1]=r[1]*c,i[2]=r[2]*c,i[3]=r[3]*c,i[4]=r[4]*p,i[5]=r[5]*p,i[6]=r[6]*p,i[7]=r[7]*p,i[8]=r[8]*m,i[9]=r[9]*m,i[10]=r[10]*m,i[11]=r[11]*m,i[12]=r[12],i[13]=r[13],i[14]=r[14],i[15]=r[15],i}function bx(i,r,o){var c=Math.sin(o),p=Math.cos(o),m=r[4],y=r[5],x=r[6],E=r[7],S=r[8],k=r[9],M=r[10],O=r[11];return r!==i&&(i[0]=r[0],i[1]=r[1],i[2]=r[2],i[3]=r[3],i[12]=r[12],i[13]=r[13],i[14]=r[14],i[15]=r[15]),i[4]=m*p+S*c,i[5]=y*p+k*c,i[6]=x*p+M*c,i[7]=E*p+O*c,i[8]=S*p-m*c,i[9]=k*p-y*c,i[10]=M*p-x*c,i[11]=O*p-E*c,i}function G0(i,r,o){var c=Math.sin(o),p=Math.cos(o),m=r[0],y=r[1],x=r[2],E=r[3],S=r[8],k=r[9],M=r[10],O=r[11];return r!==i&&(i[4]=r[4],i[5]=r[5],i[6]=r[6],i[7]=r[7],i[12]=r[12],i[13]=r[13],i[14]=r[14],i[15]=r[15]),i[0]=m*p-S*c,i[1]=y*p-k*c,i[2]=x*p-M*c,i[3]=E*p-O*c,i[8]=m*c+S*p,i[9]=y*c+k*p,i[10]=x*c+M*p,i[11]=E*c+O*p,i}function jA(i,r){return i[0]=r[0],i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=r[1],i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=r[2],i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i}function VA(i,r,o){var c,p,m,y=o[0],x=o[1],E=o[2],S=Math.hypot(y,x,E);return S0&&(m=1/Math.sqrt(m)),i[0]=r[0]*m,i[1]=r[1]*m,i[2]=r[2]*m,i}function ea(i,r){return i[0]*r[0]+i[1]*r[1]+i[2]*r[2]}function Sx(i,r,o){var c=r[0],p=r[1],m=r[2],y=o[0],x=o[1],E=o[2];return i[0]=p*E-m*x,i[1]=m*y-c*E,i[2]=c*x-p*y,i}function mn(i,r,o){var c=r[0],p=r[1],m=r[2],y=o[3]*c+o[7]*p+o[11]*m+o[15];return i[0]=(o[0]*c+o[4]*p+o[8]*m+o[12])/(y=y||1),i[1]=(o[1]*c+o[5]*p+o[9]*m+o[13])/y,i[2]=(o[2]*c+o[6]*p+o[10]*m+o[14])/y,i}function GA(i,r,o){var c=o[0],p=o[1],m=o[2],y=r[0],x=r[1],E=r[2],S=p*E-m*x,k=m*y-c*E,M=c*x-p*y,O=p*M-m*k,$=m*S-c*M,G=c*k-p*S,K=2*o[3];return k*=K,M*=K,$*=2,G*=2,i[0]=y+(S*=K)+(O*=2),i[1]=x+k+$,i[2]=E+M+G,i}var Kp,Ma=Ex,i5=WA,o5=Gp;function HA(i,r,o){return i[0]=r[0]*o,i[1]=r[1]*o,i[2]=r[2]*o,i[3]=r[3]*o,i}function qA(i,r){var o=r[0],c=r[1],p=r[2],m=r[3],y=o*o+c*c+p*p+m*m;return y>0&&(y=1/Math.sqrt(y)),i[0]=o*y,i[1]=c*y,i[2]=p*y,i[3]=m*y,i}function iu(i,r,o){var c=r[0],p=r[1],m=r[2],y=r[3];return i[0]=o[0]*c+o[4]*p+o[8]*m+o[12]*y,i[1]=o[1]*c+o[5]*p+o[9]*m+o[13]*y,i[2]=o[2]*c+o[6]*p+o[10]*m+o[14]*y,i[3]=o[3]*c+o[7]*p+o[11]*m+o[15]*y,i}function ZA(){var i=new so(4);return so!=Float32Array&&(i[0]=0,i[1]=0,i[2]=0),i[3]=1,i}function KA(i){return i[0]=0,i[1]=0,i[2]=0,i[3]=1,i}function XA(i,r,o){o*=.5;var c=r[0],p=r[1],m=r[2],y=r[3],x=Math.sin(o),E=Math.cos(o);return i[0]=c*E+y*x,i[1]=p*E+m*x,i[2]=m*E-p*x,i[3]=y*E-c*x,i}function YA(i,r,o){o*=.5;var c=r[0],p=r[1],m=r[2],y=r[3],x=Math.sin(o),E=Math.cos(o);return i[0]=c*E-m*x,i[1]=p*E+y*x,i[2]=m*E+c*x,i[3]=y*E-p*x,i}wx(),Kp=new so(4),so!=Float32Array&&(Kp[0]=0,Kp[1]=0,Kp[2]=0,Kp[3]=0);var a5=qA;wx(),xh(1,0,0),xh(0,1,0),ZA(),ZA(),NA();const s5=Ie([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]),{members:QA}=s5,JA=Ie([{name:"a_pos_3",components:3,type:"Int16"}]);var Xp=Ie([{name:"a_pos",type:"Int16",components:2}]);class Tx{constructor(r,o){this.pos=r,this.dir=o}intersectsPlane(r,o,c){const p=ea(o,this.dir);if(Math.abs(p)<1e-6)return!1;const m=((r[0]-this.pos[0])*o[0]+(r[1]-this.pos[1])*o[1]+(r[2]-this.pos[2])*o[2])/p;return c[0]=this.pos[0]+this.dir[0]*m,c[1]=this.pos[1]+this.dir[1]*m,c[2]=this.pos[2]+this.dir[2]*m,!0}closestPointOnSphere(r,o,c){if(function($,G){var K=$[0],ee=$[1],le=$[2],me=G[0],ce=G[1],pe=G[2];return Math.abs(K-me)<=W0*Math.max(1,Math.abs(K),Math.abs(me))&&Math.abs(ee-ce)<=W0*Math.max(1,Math.abs(ee),Math.abs(ce))&&Math.abs(le-pe)<=W0*Math.max(1,Math.abs(le),Math.abs(pe))}(this.pos,r)||o===0)return c[0]=c[1]=c[2]=0,!1;const[p,m,y]=this.dir,x=this.pos[0]-r[0],E=this.pos[1]-r[1],S=this.pos[2]-r[2],k=p*p+m*m+y*y,M=2*(x*p+E*m+S*y),O=M*M-4*k*(x*x+E*E+S*S-o*o);if(O<0){const $=Math.max(-M/2,0),G=x+p*$,K=E+m*$,ee=S+y*$,le=Math.hypot(G,K,ee);return c[0]=G*o/le,c[1]=K*o/le,c[2]=ee*o/le,!1}{const $=(-M-Math.sqrt(O))/(2*k);if($<0){const G=Math.hypot(x,E,S);return c[0]=x*o/G,c[1]=E*o/G,c[2]=S*o/G,!1}return c[0]=x+p*$,c[1]=E+m*$,c[2]=S+y*$,!0}}}class Ax{constructor(r,o,c,p,m){this.TL=r,this.TR=o,this.BR=c,this.BL=p,this.horizon=m}static fromInvProjectionMatrix(r,o,c){const p=[-1,1,1],m=[1,1,1],y=[1,-1,1],x=[-1,-1,1],E=mn(p,p,r),S=mn(m,m,r),k=mn(y,y,r),M=mn(x,x,r);return new Ax(E,S,k,M,o/c)}}class Ix{constructor(r,o){this.points=r,this.planes=o}static fromInvProjectionMatrix(r,o,c,p){const m=Math.pow(2,c),y=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(E=>{const S=iu([],E,r),k=1/S[3]/o*m;return function(M,O,$){return M[0]=O[0]*$[0],M[1]=O[1]*$[1],M[2]=O[2]*$[2],M[3]=O[3]*$[3],M}(S,S,[k,k,p?1/S[3]:k,k])}),x=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(E=>{const S=Di([],Sx([],Ma([],y[E[0]],y[E[1]]),Ma([],y[E[2]],y[E[1]]))),k=-ea(S,y[E[1]]);return S.concat(k)});return new Ix(y,x)}}class Mi{static fromPoints(r){const o=[1/0,1/0,1/0],c=[-1/0,-1/0,-1/0];for(const p of r)Hp(o,o,p),qp(c,c,p);return new Mi(o,c)}static applyTransform(r,o){const c=r.getCorners();for(let p=0;p=0;if(y===0)return 0;y!==o.length&&(c=!1)}if(c)return 2;for(let p=0;p<3;p++){let m=Number.MAX_VALUE,y=-Number.MAX_VALUE;for(let x=0;xthis.max[p]-this.min[p])return 0}return 1}}const Cx=5,e2=6,ns=Ot/Math.PI/2,l5=16383,ou=64,Yp=[ou,32,16],ta=-ns,ra=ns,c5=[new Mi([ta,ta,ta],[ra,ra,ra]),new Mi([ta,ta,ta],[0,0,ra]),new Mi([0,ta,ta],[ra,0,ra]),new Mi([ta,0,ta],[0,ra,ra]),new Mi([0,0,ta],[ra,ra,ra])];function H0(i){return i*ns/ef}function t2(i,r,o,c=!0){const p=ko([],i._camera.position,i.worldSize),m=[r,o,1,1];iu(m,m,i.pixelMatrixInverse),HA(m,m,1/m[3]);const y=Di([],Ma([],m,p)),x=i.globeMatrix,E=[x[12],x[13],x[14]],S=Ma([],E,p),k=Gp(S),M=Di([],S),O=i.worldSize/(2*Math.PI),$=ea(M,y),G=Math.asin(O/k);if(G1?null:function(c,p,m,y){const x=Math.sin(m);return c*(Math.sin((1-y)*m)/x)+p*(Math.sin(y*m)/x)}(i.a[r],i.b[r],i.angle,qe(o,0,1))+i.center[r]}function is(i){if(i.z<=1)return c5[i.z+2*i.y+i.x];const r=Px(q0(i));return Mi.fromPoints(r)}function au(i,r,o){return ko(i,i,1-o),Zp(i,i,r,o)}function r2(i,r){const o=Eh(r.zoom);if(o===0)return is(i);const c=q0(i),p=Px(c),m=os(c.getWest())*r.worldSize,y=os(c.getEast())*r.worldSize,x=as(c.getNorth())*r.worldSize,E=as(c.getSouth())*r.worldSize,S=[m,x,0],k=[y,x,0],M=[m,E,0],O=[y,E,0],$=xx([],r.globeMatrix);return mn(S,S,$),mn(k,k,$),mn(M,M,$),mn(O,O,$),p[0]=au(p[0],M,o),p[1]=au(p[1],O,o),p[2]=au(p[2],k,o),p[3]=au(p[3],S,o),Mi.fromPoints(p)}function n2(i,r,o){for(const c of i)mn(c,c,r),ko(c,c,o)}function h5(i,r,o){const c=r/i.worldSize,p=i.globeMatrix;if(o.z<=1){const Me=is(o).getCorners();return n2(Me,p,c),Mi.fromPoints(Me)}const m=q0(o),y=Px(m);n2(y,p,c);const x=Number.MAX_VALUE,E=[-x,-x,-x],S=[x,x,x];if(m.contains(i.center)){for(const lt of y)Hp(S,S,lt),qp(E,E,lt);E[2]=0;const Me=i.point,He=[Me.x*c,Me.y*c,0];return Hp(S,S,He),qp(E,E,He),new Mi(S,E)}const k=[p[12]*c,p[13]*c,p[14]*c],M=m.getCenter(),O=qe(i.center.lat,-di,di),$=qe(M.lat,-di,di),G=os(i.center.lng),K=as(O);let ee=G-os(M.lng);const le=K-as($);ee>.5?ee-=1:ee<-.5&&(ee+=1);let me=0;Math.abs(ee)>Math.abs(le)?me=ee>=0?1:3:(me=le>=0?0:2,Zp(k,k,[p[4]*c,p[5]*c,p[6]*c],-Math.sin(Fe(le>=0?m.getSouth():m.getNorth()))*ns));const ce=y[me],pe=y[(me+1)%4],_e=new u5(ce,pe,k),ye=[kx(_e,0)||ce[0],kx(_e,1)||ce[1],kx(_e,2)||ce[2]],Oe=Eh(i.zoom);if(Oe>0){const Me=function({x:lt,y:Ue,z:Qe},Je,ot,pt,We){const _t=1/(1<.5?zt=-1:Ht<-.5&&(zt=1),Ct=((Ct+zt)*Je-(pt*=Je))*ot+pt,vt=((vt+zt)*Je-pt)*ot+pt,Gt=(Gt*Je-(We*=Je))*ot+We,ft=(ft*Je-We)*ot+We,[[Ct,ft,0],[vt,ft,0],[vt,Gt,0],[Ct,Gt,0]]}(o,r,i._pixelsPerMercatorPixel,G,K);for(let lt=0;ltMath.PI/2*1.01}const s2=Fe(85),d5=Math.cos(s2),p5=Math.sin(s2),ef=63710088e-1,l2=2*Math.PI*ef;class Ll{constructor(r,o){if(isNaN(r)||isNaN(o))throw new Error(`Invalid LngLat object: (${r}, ${o})`);if(this.lng=+r,this.lat=+o,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Ll(gt(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(r){const o=Math.PI/180,c=this.lat*o,p=r.lat*o,m=Math.sin(c)*Math.sin(p)+Math.cos(c)*Math.cos(p)*Math.cos((r.lng-this.lng)*o);return ef*Math.acos(Math.min(m,1))}toBounds(r=0){const o=360*r/40075017,c=o/Math.cos(Math.PI/180*this.lat);return new Fl(new Ll(this.lng-c,this.lat-o),new Ll(this.lng+c,this.lat+o))}toEcef(r){const o=H0(r);return wh(this.lat,this.lng,ns+o)}static convert(r){if(r instanceof Ll)return r;if(Array.isArray(r)&&(r.length===2||r.length===3))return new Ll(Number(r[0]),Number(r[1]));if(!Array.isArray(r)&&typeof r=="object"&&r!==null)return new Ll(Number("lng"in r?r.lng:r.lon),Number(r.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 [, ]")}}var Fr=Ll;function zx(i){return l2*Math.cos(i*Math.PI/180)}function os(i){return(180+i)/360}function as(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function za(i,r){return i/zx(r)}function Po(i){return 360*i-180}function hi(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}function c2(i,r){return i*zx(hi(r))}const di=85.051129;function u2(i){return 1/Math.cos(i*Math.PI/180)}class Sh{constructor(r,o,c=0){this.x=+r,this.y=+o,this.z=+c}static fromLngLat(r,o=0){const c=Fr.convert(r);return new Sh(os(c.lng),as(c.lat),za(o,c.lat))}toLngLat(){return new Fr(Po(this.x),hi(this.y))}toAltitude(){return c2(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/l2*u2(hi(this.y))}}function Rx(i,r,o,c,p,m,y,x,E){const S=(r+c)/2,k=(o+p)/2,M=new xe(S,k);x(M),function(O,$,G,K,ee,le){const me=G-ee,ce=K-le;return Math.abs((K-$)*me-(G-O)*ce)/Math.hypot(me,ce)}(M.x,M.y,m.x,m.y,y.x,y.y)>=E?(Rx(i,r,o,S,k,m,M,x,E),Rx(i,S,k,c,p,M,y,x,E)):i.push(y)}function h2(i,r,o){let c=i[0],p=c.x,m=c.y;r(c);const y=[c];for(let x=1;xi.x+1||ci.y+1)&&Tr("Geometry exceeds allowed extent, reduce your vector tile buffer size"),i}function Hs(i,r,o){const c=i.loadGeometry(),p=i.extent,m=Ot/p;if(r&&o&&o.projection.isReprojectedInTileSpace){const y=1<{const $=Po((r.x+O.x/p)/y),G=hi((r.y+O.y/p)/y),K=k.project($,G);O.x=(K.x*x-E)*p,O.y=(K.y*x-S)*p};for(let O=0;O=p||G.y<0||G.y>=p||(M(G),$.push(G));c[O]=$}}for(const y of c)for(const x of y)m5(x,m);return c}function su(i,r){return{type:i.type,id:i.id,properties:i.properties,geometry:r?Hs(i):[]}}function K0(i,r,o,c,p){i.emplaceBack(2*r+(c+1)/2,2*o+(p+1)/2)}function X0(i,r,o){i.emplaceBack(r.x,r.y,r.z,o[0]*16384,o[1]*16384,o[2]*16384)}class Lx{constructor(r){this.zoom=r.zoom,this.overscaling=r.overscaling,this.layers=r.layers,this.layerIds=this.layers.map(o=>o.id),this.index=r.index,this.hasPattern=!1,this.projection=r.projection,this.layoutVertexArray=new st,this.indexArray=new Pt,this.segments=new xn,this.programConfigurations=new tu(r.layers,r.zoom),this.stateDependentLayerIds=this.layers.filter(o=>o.isStateDependent()).map(o=>o.id)}populate(r,o,c,p){const m=this.layers[0],y=[];let x=null;m.type==="circle"&&(x=m.layout.get("circle-sort-key"));for(const{feature:S,id:k,index:M,sourceLayerIndex:O}of r){const $=this.layers[0]._featureFilter.needGeometry,G=su(S,$);if(!this.layers[0]._featureFilter.filter(new D(this.zoom),G,c))continue;const K=x?x.evaluate(G,{},c):void 0,ee={id:k,properties:S.properties,type:S.type,sourceLayerIndex:O,index:M,geometry:$?G.geometry:Hs(S,c,p),patterns:{},sortKey:K};y.push(ee)}x&&y.sort((S,k)=>S.sortKey-k.sortKey);let E=null;p.projection.name==="globe"&&(this.globeExtVertexArray=new ut,E=p.projection);for(const S of y){const{geometry:k,index:M,sourceLayerIndex:O}=S,$=r[M].feature;this.addFeature(S,k,M,o.availableImages,c,E),o.featureIndex.insert($,k,M,O,this.index)}}update(r,o,c,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(r,o,this.stateDependentLayers,c,p)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(r){this.uploaded||(this.layoutVertexBuffer=r.createVertexBuffer(this.layoutVertexArray,t5.members),this.indexBuffer=r.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=r.createVertexBuffer(this.globeExtVertexArray,r5.members))),this.programConfigurations.upload(r),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy())}addFeature(r,o,c,p,m,y){for(const x of o)for(const E of x){const S=E.x,k=E.y;if(S<0||S>=Ot||k<0||k>=Ot)continue;if(y){const $=y.projectTilePoint(S,k,m),G=y.upVector(m,S,k),K=this.globeExtVertexArray;X0(K,$,G),X0(K,$,G),X0(K,$,G),X0(K,$,G)}const M=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,r.sortKey),O=M.vertexLength;K0(this.layoutVertexArray,S,k,-1,-1),K0(this.layoutVertexArray,S,k,1,-1),K0(this.layoutVertexArray,S,k,1,1),K0(this.layoutVertexArray,S,k,-1,1),this.indexArray.emplaceBack(O,O+1,O+2),this.indexArray.emplaceBack(O,O+2,O+3),M.vertexLength+=4,M.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,r,c,{},p,m)}}function p2(i,r){for(let o=0;o1){if(Bx(i,r))return!0;for(let c=0;c1?o:o.sub(r)._mult(p)._add(r))}function g2(i,r){let o,c,p,m=!1;for(let y=0;yr.y!=p.y>r.y&&r.x<(p.x-c.x)*(r.y-c.y)/(p.y-c.y)+c.x&&(m=!m)}return m}function lu(i,r){let o=!1;for(let c=0,p=i.length-1;cr.y!=y.y>r.y&&r.x<(y.x-m.x)*(r.y-m.y)/(y.y-m.y)+m.x&&(o=!o)}return o}function y2(i,r,o,c,p){for(const y of i)if(r<=y.x&&o<=y.y&&c>=y.x&&p>=y.y)return!0;const m=[new xe(r,o),new xe(r,p),new xe(c,p),new xe(c,o)];if(i.length>2){for(const y of m)if(lu(i,y))return!0}for(let y=0;yp.x&&r.x>p.x||i.yp.y&&r.y>p.y)return!1;const m=Bn(i,r,o[0]);return m!==Bn(i,r,o[1])||m!==Bn(i,r,o[2])||m!==Bn(i,r,o[3])}function Th(i,r,o){const c=r.paint.get(i).value;return c.kind==="constant"?c.value:o.programConfigurations.get(r.id).getMaxValue(i)}function Y0(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function _2(i,r,o,c,p){if(!r[0]&&!r[1])return i;const m=xe.convert(r)._mult(p);o==="viewport"&&m._rotate(-c);const y=[];for(let x=0;x0){const ce=o.projection.upVector(S,$.x,$.y);K.x+=ce[0]*k*G,K.y+=ce[1]*k*G,K.z+=ce[2]*k*G}const ee=m?$:w5(K.x,K.y,K.z,c),le=m?i.tilespaceRays.map(ce=>S5(ce,G)):i.queryGeometry.screenGeometry,me=iu([],[K.x,K.y,K.z,1],c);if(!y&&m?E*=me[3]/o.cameraToCenterDistance:y&&!m&&(E*=o.cameraToCenterDistance/me[3]),m){const ce=hi((O.y/Ot+S.y)/(1<i.width||p.height>i.height||o.x>i.width-p.width||o.y>i.height-p.height)throw new RangeError("out of range source coordinates for image copy");if(p.width>r.width||p.height>r.height||c.x>r.width-p.width||c.y>r.height-p.height)throw new RangeError("out of range destination coordinates for image copy");const y=i.data,x=r.data;for(let E=0;E{r[i.evaluationKey]=E;const S=i.expression.evaluate(r);p.data[y+x+0]=Math.floor(255*S.r/S.a),p.data[y+x+1]=Math.floor(255*S.g/S.a),p.data[y+x+2]=Math.floor(255*S.b/S.a),p.data[y+x+3]=Math.floor(255*S.a)};if(i.clips)for(let y=0,x=0;y80*o){c=m=i[0],p=y=i[1];for(var G=o;Gm&&(m=x),E>y&&(y=E);S=(S=Math.max(m-c,y-p))!==0?32767/S:0}return tf(O,$,o,c,p,S,0),$}function T2(i,r,o,c,p){var m,y;if(p===Gx(i,r,o,c)>0)for(m=r;m=r;m-=c)y=C2(m,i[m],i[m+1],y);return y&&J0(y,y.next)&&(nf(y),y=y.next),y}function cu(i,r){if(!i)return i;r||(r=i);var o,c=i;do if(o=!1,c.steiner||!J0(c,c.next)&&bn(c.prev,c,c.next)!==0)c=c.next;else{if(nf(c),(c=r=c.prev)===c.next)break;o=!0}while(o||c!==r);return r}function tf(i,r,o,c,p,m,y){if(i){!y&&m&&function(k,M,O,$){var G=k;do G.z===0&&(G.z=$x(G.x,G.y,M,O,$)),G.prevZ=G.prev,G.nextZ=G.next,G=G.next;while(G!==k);G.prevZ.nextZ=null,G.prevZ=null,function(K){var ee,le,me,ce,pe,_e,ye,Oe,Me=1;do{for(le=K,K=null,pe=null,_e=0;le;){for(_e++,me=le,ye=0,ee=0;ee0||Oe>0&&me;)ye!==0&&(Oe===0||!me||le.z<=me.z)?(ce=le,le=le.nextZ,ye--):(ce=me,me=me.nextZ,Oe--),pe?pe.nextZ=ce:K=ce,ce.prevZ=pe,pe=ce;le=me}pe.nextZ=null,Me*=2}while(_e>1)}(G)}(i,c,p,m);for(var x,E,S=i;i.prev!==i.next;)if(x=i.prev,E=i.next,m?P5(i,c,p,m):k5(i))r.push(x.i/o|0),r.push(i.i/o|0),r.push(E.i/o|0),nf(i),i=E.next,S=E.next;else if((i=E)===S){y?y===1?tf(i=D5(cu(i),r,o),r,o,c,p,m,2):y===2&&M5(i,r,o,c,p,m):tf(cu(i),r,o,c,p,m,1);break}}}function k5(i){var r=i.prev,o=i,c=i.next;if(bn(r,o,c)>=0)return!1;for(var p=r.x,m=o.x,y=c.x,x=r.y,E=o.y,S=c.y,k=pm?p>y?p:y:m>y?m:y,$=x>E?x>S?x:S:E>S?E:S,G=c.next;G!==r;){if(G.x>=k&&G.x<=O&&G.y>=M&&G.y<=$&&Ah(p,x,m,E,y,S,G.x,G.y)&&bn(G.prev,G,G.next)>=0)return!1;G=G.next}return!0}function P5(i,r,o,c){var p=i.prev,m=i,y=i.next;if(bn(p,m,y)>=0)return!1;for(var x=p.x,E=m.x,S=y.x,k=p.y,M=m.y,O=y.y,$=xE?x>S?x:S:E>S?E:S,ee=k>M?k>O?k:O:M>O?M:O,le=$x($,G,r,o,c),me=$x(K,ee,r,o,c),ce=i.prevZ,pe=i.nextZ;ce&&ce.z>=le&&pe&&pe.z<=me;){if(ce.x>=$&&ce.x<=K&&ce.y>=G&&ce.y<=ee&&ce!==p&&ce!==y&&Ah(x,k,E,M,S,O,ce.x,ce.y)&&bn(ce.prev,ce,ce.next)>=0||(ce=ce.prevZ,pe.x>=$&&pe.x<=K&&pe.y>=G&&pe.y<=ee&&pe!==p&&pe!==y&&Ah(x,k,E,M,S,O,pe.x,pe.y)&&bn(pe.prev,pe,pe.next)>=0))return!1;pe=pe.nextZ}for(;ce&&ce.z>=le;){if(ce.x>=$&&ce.x<=K&&ce.y>=G&&ce.y<=ee&&ce!==p&&ce!==y&&Ah(x,k,E,M,S,O,ce.x,ce.y)&&bn(ce.prev,ce,ce.next)>=0)return!1;ce=ce.prevZ}for(;pe&&pe.z<=me;){if(pe.x>=$&&pe.x<=K&&pe.y>=G&&pe.y<=ee&&pe!==p&&pe!==y&&Ah(x,k,E,M,S,O,pe.x,pe.y)&&bn(pe.prev,pe,pe.next)>=0)return!1;pe=pe.nextZ}return!0}function D5(i,r,o){var c=i;do{var p=c.prev,m=c.next.next;!J0(p,m)&&A2(p,c,c.next,m)&&rf(p,m)&&rf(m,p)&&(r.push(p.i/o|0),r.push(c.i/o|0),r.push(m.i/o|0),nf(c),nf(c.next),c=i=m),c=c.next}while(c!==i);return cu(c)}function M5(i,r,o,c,p,m){var y=i;do{for(var x=y.next.next;x!==y.prev;){if(y.i!==x.i&&L5(y,x)){var E=I2(y,x);return y=cu(y,y.next),E=cu(E,E.next),tf(y,r,o,c,p,m,0),void tf(E,r,o,c,p,m,0)}x=x.next}y=y.next}while(y!==i)}function z5(i,r){return i.x-r.x}function R5(i,r){var o=function(p,m){var y,x=m,E=p.x,S=p.y,k=-1/0;do{if(S<=x.y&&S>=x.next.y&&x.next.y!==x.y){var M=x.x+(S-x.y)*(x.next.x-x.x)/(x.next.y-x.y);if(M<=E&&M>k&&(k=M,y=x.x=x.x&&x.x>=G&&E!==x.x&&Ah(Sy.x||x.x===y.x&&O5(y,x)))&&(y=x,ee=O)),x=x.next;while(x!==$);return y}(i,r);if(!o)return r;var c=I2(o,i);return cu(c,c.next),cu(o,o.next)}function O5(i,r){return bn(i.prev,i,r.prev)<0&&bn(r.next,i,i.next)<0}function $x(i,r,o,c,p){return(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=(i-o)*p|0)|i<<8))|i<<4))|i<<2))|i<<1))|(r=1431655765&((r=858993459&((r=252645135&((r=16711935&((r=(r-c)*p|0)|r<<8))|r<<4))|r<<2))|r<<1))<<1}function F5(i){var r=i,o=i;do(r.x=(i-y)*(m-x)&&(i-y)*(c-x)>=(o-y)*(r-x)&&(o-y)*(m-x)>=(p-y)*(c-x)}function L5(i,r){return i.next.i!==r.i&&i.prev.i!==r.i&&!function(o,c){var p=o;do{if(p.i!==o.i&&p.next.i!==o.i&&p.i!==c.i&&p.next.i!==c.i&&A2(p,p.next,o,c))return!0;p=p.next}while(p!==o);return!1}(i,r)&&(rf(i,r)&&rf(r,i)&&function(o,c){var p=o,m=!1,y=(o.x+c.x)/2,x=(o.y+c.y)/2;do p.y>x!=p.next.y>x&&p.next.y!==p.y&&y<(p.next.x-p.x)*(x-p.y)/(p.next.y-p.y)+p.x&&(m=!m),p=p.next;while(p!==o);return m}(i,r)&&(bn(i.prev,i,r.prev)||bn(i,r.prev,r))||J0(i,r)&&bn(i.prev,i,i.next)>0&&bn(r.prev,r,r.next)>0)}function bn(i,r,o){return(r.y-i.y)*(o.x-r.x)-(r.x-i.x)*(o.y-r.y)}function J0(i,r){return i.x===r.x&&i.y===r.y}function A2(i,r,o,c){var p=tg(bn(i,r,o)),m=tg(bn(i,r,c)),y=tg(bn(o,c,i)),x=tg(bn(o,c,r));return p!==m&&y!==x||!(p!==0||!eg(i,o,r))||!(m!==0||!eg(i,c,r))||!(y!==0||!eg(o,i,c))||!(x!==0||!eg(o,r,c))}function eg(i,r,o){return r.x<=Math.max(i.x,o.x)&&r.x>=Math.min(i.x,o.x)&&r.y<=Math.max(i.y,o.y)&&r.y>=Math.min(i.y,o.y)}function tg(i){return i>0?1:i<0?-1:0}function rf(i,r){return bn(i.prev,i,i.next)<0?bn(i,r,i.next)>=0&&bn(i,i.prev,r)>=0:bn(i,r,i.prev)<0||bn(i,i.next,r)<0}function I2(i,r){var o=new Wx(i.i,i.x,i.y),c=new Wx(r.i,r.x,r.y),p=i.next,m=r.prev;return i.next=r,r.prev=i,o.next=p,p.prev=o,c.next=o,o.prev=c,m.next=c,c.prev=m,c}function C2(i,r,o,c){var p=new Wx(i,r,o);return c?(p.next=c.next,p.prev=c,c.next.prev=p,c.next=p):(p.prev=p,p.next=p),p}function nf(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function Wx(i,r,o){this.i=i,this.x=r,this.y=o,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Gx(i,r,o,c){for(var p=0,m=r,y=o-c;m0&&o.holes.push(c+=i[p-1].length)}return o};var Hx=F(Vx.exports);function B5(i,r,o,c,p){k2(i,r,o||0,c||i.length-1,p||N5)}function k2(i,r,o,c,p){for(;c>o;){if(c-o>600){var m=c-o+1,y=r-o+1,x=Math.log(m),E=.5*Math.exp(2*x/3),S=.5*Math.sqrt(x*E*(m-E)/m)*(y-m/2<0?-1:1);k2(i,r,Math.max(o,Math.floor(r-y*E/m+S)),Math.min(c,Math.floor(r+(m-y)*E/m+S)),p)}var k=i[r],M=o,O=c;for(of(i,o,r),p(i[c],k)>0&&of(i,o,c);M0;)O--}p(i[o],k)===0?of(i,o,O):of(i,++O,c),O<=r&&(o=O+1),r<=O&&(c=O-1)}}function of(i,r,o){var c=i[r];i[r]=i[o],i[o]=c}function N5(i,r){return ir?1:0}function qx(i,r){const o=i.length;if(o<=1)return[i];const c=[];let p,m;for(let y=0;y1)for(let y=0;yo.id),this.index=r.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new st,this.indexArray=new Pt,this.indexArray2=new Gn,this.programConfigurations=new tu(r.layers,r.zoom),this.segments=new xn,this.segments2=new xn,this.stateDependentLayerIds=this.layers.filter(o=>o.isStateDependent()).map(o=>o.id),this.projection=r.projection}populate(r,o,c,p){this.hasPattern=Zx("fill",this.layers,o);const m=this.layers[0].layout.get("fill-sort-key"),y=[];for(const{feature:x,id:E,index:S,sourceLayerIndex:k}of r){const M=this.layers[0]._featureFilter.needGeometry,O=su(x,M);if(!this.layers[0]._featureFilter.filter(new D(this.zoom),O,c))continue;const $=m?m.evaluate(O,{},c,o.availableImages):void 0,G={id:E,properties:x.properties,type:x.type,sourceLayerIndex:k,index:S,geometry:M?O.geometry:Hs(x,c,p),patterns:{},sortKey:$};y.push(G)}m&&y.sort((x,E)=>x.sortKey-E.sortKey);for(const x of y){const{geometry:E,index:S,sourceLayerIndex:k}=x;if(this.hasPattern){const M=Kx("fill",this.layers,x,this.zoom,o);this.patternFeatures.push(M)}else this.addFeature(x,E,S,c,{},o.availableImages);o.featureIndex.insert(r[S].feature,E,S,k,this.index)}}update(r,o,c,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(r,o,this.stateDependentLayers,c,p)}addFeatures(r,o,c,p,m){for(const y of this.patternFeatures)this.addFeature(y,y.geometry,y.index,o,c,p)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(r){this.uploaded||(this.layoutVertexBuffer=r.createVertexBuffer(this.layoutVertexArray,C5),this.indexBuffer=r.createIndexBuffer(this.indexArray),this.indexBuffer2=r.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(r),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(r,o,c,p,m,y=[]){for(const x of qx(o,500)){let E=0;for(const G of x)E+=G.length;const S=this.segments.prepareSegment(E,this.layoutVertexArray,this.indexArray),k=S.vertexLength,M=[],O=[];for(const G of x){if(G.length===0)continue;G!==x[0]&&O.push(M.length/2);const K=this.segments2.prepareSegment(G.length,this.layoutVertexArray,this.indexArray2),ee=K.vertexLength;this.layoutVertexArray.emplaceBack(G[0].x,G[0].y),this.indexArray2.emplaceBack(ee+G.length-1,ee),M.push(G[0].x),M.push(G[0].y);for(let le=1;le>3}if(p--,c===1||c===2)m+=i.readSVarint(),y+=i.readSVarint(),c===1&&(r&&x.push(r),r=[]),r.push(new q5(m,y));else{if(c!==7)throw new Error("unknown command "+c);r&&r.push(r[0].clone())}}return r&&x.push(r),x},Ih.prototype.bbox=function(){var i=this._pbf;i.pos=this._geometry;for(var r=i.readVarint()+i.pos,o=1,c=0,p=0,m=0,y=1/0,x=-1/0,E=1/0,S=-1/0;i.pos>3}if(c--,o===1||o===2)(p+=i.readSVarint())x&&(x=p),(m+=i.readSVarint())S&&(S=m);else if(o!==7)throw new Error("unknown command "+o)}return[y,E,x,S]},Ih.prototype.toGeoJSON=function(i,r,o){var c,p,m=this.extent*Math.pow(2,o),y=this.extent*i,x=this.extent*r,E=this.loadGeometry(),S=Ih.types[this.type];function k($){for(var G=0;G<$.length;G++){var K=$[G];$[G]=[360*(K.x+y)/m-180,360/Math.PI*Math.atan(Math.exp((180-360*(K.y+x)/m)*Math.PI/180))-90]}}switch(this.type){case 1:var M=[];for(c=0;c>3;p=y===1?c.readString():y===2?c.readFloat():y===3?c.readDouble():y===4?c.readVarint64():y===5?c.readVarint():y===6?c.readSVarint():y===7?c.readBoolean():null}return p}(o))}M2.prototype.feature=function(i){if(i<0||i>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[i];var r=this._pbf.readVarint()+this._pbf.pos;return new X5(this._pbf,r,this.extent,this._keys,this._values)};var Q5=D2;function J5(i,r,o){if(i===3){var c=new Q5(o,o.readVarint()+o.pos);c.length&&(r[c.name]=c)}}var Xx=ng.VectorTile=function(i,r){this.layers=i.readFields(J5,{},r)},ig=ng.VectorTileFeature=P2;function og(i,r,o,c){const p=[],m=c===0?(y,x,E,S,k,M)=>{y.push(new xe(M,E+(M-x)/(S-x)*(k-E)))}:(y,x,E,S,k,M)=>{y.push(new xe(x+(M-E)/(k-E)*(S-x),M))};for(const y of i){const x=[];for(const E of y){if(E.length<=2)continue;const S=[];for(let O=0;Or&&m(S,$,G,K,ee,r):le>o?me=r&&m(S,$,G,K,ee,r),me>o&&le<=o&&m(S,$,G,K,ee,o)}let k=E[E.length-1];const M=c===0?k.x:k.y;M>=r&&M<=o&&S.push(k),S.length&&(k=S[S.length-1],S[0].x===k.x&&S[0].y===k.y||S.push(S[0]),x.push(S))}x.length&&p.push(x)}return p}ng.VectorTileLayer=D2;const eF=ig.types,tF=Math.pow(2,13);function af(i,r,o,c,p,m,y,x){i.emplaceBack((r<<1)+y,(o<<1)+m,(Math.floor(c*tF)<<1)+p,Math.round(x))}function sf(i,r,o){i.emplaceBack(r.x,r.y,r.z,o[0]*16384,o[1]*16384,o[2]*16384)}class z2{constructor(){this.acc=new xe(0,0),this.polyCount=[]}startRing(r){this.currentPolyCount={edges:0,top:0},this.polyCount.push(this.currentPolyCount),this.min||(this.min=new xe(r.x,r.y),this.max=new xe(r.x,r.y))}append(r,o){this.currentPolyCount.edges++,this.acc._add(r);const c=this.min,p=this.max;r.xp.x&&(p.x=r.x),r.yp.y&&(p.y=r.y),((r.x===0||r.x===Ot)&&r.x===o.x)!=((r.y===0||r.y===Ot)&&r.y===o.y)&&this.processBorderOverlap(r,o),o.x<0!=r.x<0&&this.addBorderIntersection(0,dr(o.y,r.y,(0-o.x)/(r.x-o.x))),o.x>Ot!=r.x>Ot&&this.addBorderIntersection(1,dr(o.y,r.y,(Ot-o.x)/(r.x-o.x))),o.y<0!=r.y<0&&this.addBorderIntersection(2,dr(o.x,r.x,(0-o.y)/(r.y-o.y))),o.y>Ot!=r.y>Ot&&this.addBorderIntersection(3,dr(o.x,r.x,(Ot-o.y)/(r.y-o.y)))}addBorderIntersection(r,o){this.borders||(this.borders=[[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE]]);const c=this.borders[r];oc[1]&&(c[1]=o)}processBorderOverlap(r,o){if(r.x===o.x){if(r.y===o.y)return;const c=r.x===0?0:1;this.addBorderIntersection(c,o.y),this.addBorderIntersection(c,r.y)}else{const c=r.y===0?2:3;this.addBorderIntersection(c,o.x),this.addBorderIntersection(c,r.x)}}centroid(){const r=this.polyCount.reduce((o,c)=>o+c.edges,0);return r!==0?this.acc.div(r)._round():new xe(0,0)}span(){return new xe(this.max.x-this.min.x,this.max.y-this.min.y)}intersectsCount(){return this.borders.reduce((r,o)=>r+ +(o[0]!==Number.MAX_VALUE),0)}}class lf{constructor(r){this.zoom=r.zoom,this.canonical=r.canonical,this.overscaling=r.overscaling,this.layers=r.layers,this.layerIds=this.layers.map(o=>o.id),this.index=r.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=r.projection,this.layoutVertexArray=new Ke,this.centroidVertexArray=new Ca,this.indexArray=new Pt,this.programConfigurations=new tu(r.layers,r.zoom),this.segments=new xn,this.stateDependentLayerIds=this.layers.filter(o=>o.isStateDependent()).map(o=>o.id),this.enableTerrain=r.enableTerrain}populate(r,o,c,p){this.features=[],this.hasPattern=Zx("fill-extrusion",this.layers,o),this.featuresOnBorder=[],this.borders=[[],[],[],[]],this.borderDoneWithNeighborZ=[-1,-1,-1,-1],this.tileToMeter=function(m){const y=Math.exp(Math.PI*(1-m.y/(1<=0;le--){const me=$[le];(me.length===0||(G=me[0]).every(ce=>ce.x<=0)||G.every(ce=>ce.x>=Ot)||G.every(ce=>ce.y<=0)||G.every(ce=>ce.y>=Ot))&&$.splice(le,1)}var G;let K;if(k)K=U2($,E,p);else{K=[];for(const le of $)K.push({polygon:le,bounds:E})}const ee=O?this.edgeRadius:0;for(const{polygon:le,bounds:me}of K){let ce=0,pe=0;for(const ye of le)O&&!ye[0].equals(ye[ye.length-1])&&ye.push(ye[0]),pe+=O?ye.length-1:ye.length;const _e=this.segments.prepareSegment((O?5:4)*pe,this.layoutVertexArray,this.indexArray);if(O){const ye=[],Oe=[];ce=_e.vertexLength;for(const He of le){let lt,Ue;He.length&&He!==le[0]&&Oe.push(ye.length/2),lt=He[1].sub(He[0])._perp()._unit();for(let Qe=1;Qe4&&L2(ye[ye.length-2],ye[0],ye[1]),Ue=ee?rF(ye[ye.length-2],ye[0],ye[1],ee):0;Me=ye[1].sub(ye[0])._perp()._unit();let Qe=!0;for(let Je=1,ot=0;Je0?1:0,ft=pt.dist(We);if(ot+ft>32768&&(ot=0),ee){He=_t.sub(We)._perp()._unit();let qt=O2(pt,We,_t,R2(Me,He),ee);isNaN(qt)&&(qt=0);const Bt=We.sub(pt)._unit();pt=pt.add(Bt.mult(Ue))._round(),We=We.add(Bt.mult(-qt))._round(),Ue=qt,Me=He}const zt=_e.vertexLength,Ht=ye.length>4&&L2(pt,We,_t);let fr=B2(ot,lt,Qe);if(af(this.layoutVertexArray,pt.x,pt.y,vt,Gt,0,0,fr),af(this.layoutVertexArray,pt.x,pt.y,vt,Gt,0,1,fr),ot+=ft,fr=B2(ot,Ht,!Qe),lt=Ht,af(this.layoutVertexArray,We.x,We.y,vt,Gt,0,0,fr),af(this.layoutVertexArray,We.x,We.y,vt,Gt,0,1,fr),_e.vertexLength+=4,this.indexArray.emplaceBack(zt+0,zt+1,zt+2),this.indexArray.emplaceBack(zt+1,zt+3,zt+2),_e.primitiveLength+=2,ee){const qt=ce+(Je===1?ye.length-2:Je-2),Bt=Je===1?ce:qt+1;if(this.indexArray.emplaceBack(zt+1,qt,zt+3),this.indexArray.emplaceBack(qt,Bt,zt+3),_e.primitiveLength+=2,Oe===void 0&&(Oe=zt),!F2(_t,ye[Je],me)){const Hr=Je===ye.length-1?Oe:_e.vertexLength;this.indexArray.emplaceBack(zt+2,zt+3,Hr),this.indexArray.emplaceBack(zt+3,Hr+1,Hr),this.indexArray.emplaceBack(zt+3,Bt,Hr+1),_e.primitiveLength+=3}Qe=!Qe}if(k){const qt=this.layoutVertexExtArray,Bt=S.projectTilePoint(pt.x,pt.y,p),Hr=S.projectTilePoint(We.x,We.y,p),Zt=S.upVector(p,pt.x,pt.y),Kt=S.upVector(p,We.x,We.y);sf(qt,Bt,Zt),sf(qt,Bt,Zt),sf(qt,Hr,Kt),sf(qt,Hr,Kt)}}O&&(ce+=ye.length-1)}}if(M&&M.polyCount.length>0){if(M.borders){M.vertexArrayOffset=this.centroidVertexArray.length;const le=M.borders,me=this.featuresOnBorder.push(M)-1;for(let ce=0;ce<4;ce++)le[ce][0]!==Number.MAX_VALUE&&this.borders[ce].push(me)}this.encodeCentroid(M.borders?void 0:M.centroid(),M)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,r,c,m,y,p)}sortBorders(){for(let r=0;r<4;r++)this.borders[r].sort((o,c)=>this.featuresOnBorder[o].borders[r][0]-this.featuresOnBorder[c].borders[r][0])}encodeCentroid(r,o,c=!0){let p,m;if(r)if(r.y!==0){const x=o.span()._mult(this.tileToMeter);p=(Math.max(r.x,1)<<3)+Math.min(7,Math.round(x.x/10)),m=(Math.max(r.y,1)<<3)+Math.min(7,Math.round(x.y/10))}else p=Math.ceil(7*(r.x+450)),m=0;else p=0,m=+c;let y=c?this.centroidVertexArray.length:o.vertexArrayOffset;for(const x of o.polyCount){c&&this.centroidVertexArray.resize(this.centroidVertexArray.length+4*x.edges+x.top);for(let E=0;Eo[1].x&&r.x>o[1].x||i.yo[1].y&&r.y>o[1].y}function L2(i,r,o){if(i.x<0||i.x>=Ot||r.x<0||r.x>=Ot||o.x<0||o.x>=Ot)return!1;const c=o.sub(r),p=c.perp(),m=i.sub(r);return(c.x*m.x+c.y*m.y)/Math.sqrt((c.x*c.x+c.y*c.y)*(m.x*m.x+m.y*m.y))>-.866&&p.x*m.x+p.y*m.y<0}function B2(i,r,o){const c=r?2|i:-3&i;return o?1|c:-2&c}function N2(){const i=Math.PI/32,r=Math.tan(i),o=ef;return o*Math.sqrt(1+2*r*r)-o}function U2(i,r,o){const c=1<{for(const Me of ye)G.push({polygon:Me,bounds:Oe})},ee=Math.ceil(Math.log2(k)),le=Math.ceil(Math.log2(M)),me=ee-le,ce=[];for(let ye=0;ye0?0:1);for(let ye=0;yeOe+1?_e.push({polygons:ot,bounds:We,depth:Oe+1}):K(ot,We)}if(pt.length){const We=[new xe(Me===0?Je:He.x,Me===1?Je:He.y),lt];ce.length>Oe+1?_e.push({polygons:pt,bounds:We,depth:Oe+1}):K(pt,We)}}return G}(i,r,Math.ceil((m-p)/11.25),Math.ceil((y-x)/11.25),1,(E,S,k)=>{if(E===0)return .5*(S+k);{const M=hi((o.y+S/Ot)/c);return(as(.5*(hi((o.y+k/Ot)/c)+M))*c-o.y)*Ot}})}At(lf,"FillExtrusionBucket",{omit:["layers","features"]}),At(z2,"PartMetadata");const nF=new he({"fill-extrusion-edge-radius":new Z(Ge["layout_fill-extrusion"]["fill-extrusion-edge-radius"])});var iF={paint:new he({"fill-extrusion-opacity":new Z(Ge["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new re(Ge["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Z(Ge["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Z(Ge["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new re(Ge["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new re(Ge["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new re(Ge["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Z(Ge["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-ambient-occlusion-intensity":new Z(Ge["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),"fill-extrusion-ambient-occlusion-radius":new Z(Ge["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"]),"fill-extrusion-rounded-roof":new Z(Ge["paint_fill-extrusion"]["fill-extrusion-rounded-roof"])}),layout:nF};function j2(i,r,o){var c=2*Math.PI*6378137/256/Math.pow(2,o);return[i*c-2*Math.PI*6378137/2,r*c-2*Math.PI*6378137/2]}class ag{constructor(r,o,c){this.z=r,this.x=o,this.y=c,this.key=cf(0,r,r,o,c)}equals(r){return this.z===r.z&&this.x===r.x&&this.y===r.y}url(r,o){const c=function(m,y,x){var E=j2(256*m,256*(y=Math.pow(2,x)-y-1),x),S=j2(256*(m+1),256*(y+1),x);return E[0]+","+E[1]+","+S[0]+","+S[1]}(this.x,this.y,this.z),p=function(m,y,x){let E,S="";for(let k=m;k>0;k--)E=1<this.canonical.z?new zi(r,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new zi(r,this.wrap,r,this.canonical.x>>o,this.canonical.y>>o)}calculateScaledKey(r,o=!0){if(this.overscaledZ===r&&o)return this.key;if(r>this.canonical.z)return cf(this.wrap*+o,r,this.canonical.z,this.canonical.x,this.canonical.y);{const c=this.canonical.z-r;return cf(this.wrap*+o,r,r,this.canonical.x>>c,this.canonical.y>>c)}}isChildOf(r){if(r.wrap!==this.wrap)return!1;const o=this.canonical.z-r.canonical.z;return r.overscaledZ===0||r.overscaledZ>o&&r.canonical.y===this.canonical.y>>o}children(r){if(this.overscaledZ>=r)return[new zi(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const o=this.canonical.z+1,c=2*this.canonical.x,p=2*this.canonical.y;return[new zi(o,this.wrap,o,c,p),new zi(o,this.wrap,o,c+1,p),new zi(o,this.wrap,o,c,p+1),new zi(o,this.wrap,o,c+1,p+1)]}isLessThan(r){return this.wrapr.wrap)&&(this.overscaledZr.overscaledZ)&&(this.canonical.xr.canonical.x)&&this.canonical.yo.id),this.index=r.index,this.projection=r.projection,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(o=>{this.gradients[o.id]={}}),this.layoutVertexArray=new Ne,this.layoutVertexArray2=new at,this.indexArray=new Pt,this.programConfigurations=new tu(r.layers,r.zoom),this.segments=new xn,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(o=>o.isStateDependent()).map(o=>o.id)}populate(r,o,c,p){this.hasPattern=Zx("line",this.layers,o);const m=this.layers[0].layout.get("line-sort-key"),y=[];for(const{feature:k,id:M,index:O,sourceLayerIndex:$}of r){const G=this.layers[0]._featureFilter.needGeometry,K=su(k,G);if(!this.layers[0]._featureFilter.filter(new D(this.zoom),K,c))continue;const ee=m?m.evaluate(K,{},c):void 0,le={id:M,properties:k.properties,type:k.type,sourceLayerIndex:$,index:O,geometry:G?K.geometry:Hs(k,c,p),patterns:{},sortKey:ee};y.push(le)}m&&y.sort((k,M)=>k.sortKey-M.sortKey);const{lineAtlas:x,featureIndex:E}=o,S=this.addConstantDashes(x);for(const k of y){const{geometry:M,index:O,sourceLayerIndex:$}=k;if(S&&this.addFeatureDashes(k,x),this.hasPattern){const G=Kx("line",this.layers,k,this.zoom,o);this.patternFeatures.push(G)}else this.addFeature(k,M,O,c,x.positions,o.availableImages);E.insert(r[O].feature,M,O,$,this.index)}}addConstantDashes(r){let o=!1;for(const c of this.layers){const p=c.paint.get("line-dasharray").value,m=c.layout.get("line-cap").value;if(p.kind!=="constant"||m.kind!=="constant")o=!0;else{const y=m.value,x=p.value;if(!x)continue;r.addDash(x,y)}}return o}addFeatureDashes(r,o){const c=this.zoom;for(const p of this.layers){const m=p.paint.get("line-dasharray").value,y=p.layout.get("line-cap").value;if(m.kind==="constant"&&y.kind==="constant")continue;let x,E;if(m.kind==="constant"){if(x=m.value,!x)continue}else x=m.evaluate({zoom:c},r);E=y.kind==="constant"?y.value:y.evaluate({zoom:c},r),o.addDash(x,E),r.patterns[p.id]=o.getKey(x,E)}}update(r,o,c,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(r,o,this.stateDependentLayers,c,p)}addFeatures(r,o,c,p,m){for(const y of this.patternFeatures)this.addFeature(y,y.geometry,y.index,o,c,p)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(r){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=r.createVertexBuffer(this.layoutVertexArray2,lF)),this.layoutVertexBuffer=r.createVertexBuffer(this.layoutVertexArray,aF),this.indexBuffer=r.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(r),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(r){if(r.properties&&r.properties.hasOwnProperty("mapbox_clip_start")&&r.properties.hasOwnProperty("mapbox_clip_end"))return{start:+r.properties.mapbox_clip_start,end:+r.properties.mapbox_clip_end}}addFeature(r,o,c,p,m,y){const x=this.layers[0].layout,E=x.get("line-join").evaluate(r,{}),S=x.get("line-cap").evaluate(r,{}),k=x.get("line-miter-limit"),M=x.get("line-round-limit");this.lineClips=this.lineFeatureClips(r);for(const O of o)this.addLine(O,r,E,S,k,M);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,r,c,m,y,p)}addLine(r,o,c,p,m,y){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineSoFar=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let le=0;le=2&&r[E-1].equals(r[E-2]);)E--;let S=0;for(;S0;if(Oe&&le>S){const Ue=O.dist($);if(Ue>2*k){const Qe=O.sub(O.sub($)._mult(k/Ue)._round());this.updateDistance($,Qe),this.addCurrentVertex(Qe,K,0,0,M),$=Qe}}const He=$&&G;let lt=He?c:x?"butt":p;if(He&<==="round"&&(_em&&(lt="bevel"),lt==="bevel"&&(_e>2&&(lt="flipbevel"),_e100)me=ee.mult(-1);else{const Ue=_e*K.add(ee).mag()/K.sub(ee).mag();me._perp()._mult(Ue*(Me?-1:1))}this.addCurrentVertex(O,me,0,0,M),this.addCurrentVertex(O,me.mult(-1),0,0,M)}else if(lt==="bevel"||lt==="fakeround"){const Ue=-Math.sqrt(_e*_e-1),Qe=Me?Ue:0,Je=Me?0:Ue;if($&&this.addCurrentVertex(O,K,Qe,Je,M),lt==="fakeround"){const ot=Math.round(180*ye/Math.PI/20);for(let pt=1;pt2*k){const Qe=O.add(G.sub(O)._mult(k/Ue)._round());this.updateDistance(O,Qe),this.addCurrentVertex(Qe,ee,0,0,M),O=Qe}}}}addCurrentVertex(r,o,c,p,m,y=!1){const x=o.y*p-o.x,E=-o.y-o.x*p;this.addHalfVertex(r,o.x+o.y*c,o.y-o.x*c,y,!1,c,m),this.addHalfVertex(r,x,E,y,!0,-p,m)}addHalfVertex({x:r,y:o},c,p,m,y,x,E){this.layoutVertexArray.emplaceBack((r<<1)+(m?1:0),(o<<1)+(y?1:0),Math.round(63*c)+128,Math.round(63*p)+128,1+(x===0?0:x<0?-1:1),0,this.lineSoFar),this.lineClips&&this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,this.lineClips.start,this.lineClips.end);const S=E.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,S),E.primitiveLength++),y?this.e2=S:this.e1=S}updateScaledDistance(){if(this.lineClips){const r=this.totalDistance/(this.lineClips.end-this.lineClips.start);this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=r*this.lineClips.start+this.distance}else this.lineSoFar=this.distance}updateDistance(r,o){this.distance+=r.dist(o),this.updateScaledDistance()}}At(sg,"LineBucket",{omit:["layers","patternFeatures"]});const hF=new he({"line-cap":new re(Ge.layout_line["line-cap"]),"line-join":new re(Ge.layout_line["line-join"]),"line-miter-limit":new Z(Ge.layout_line["line-miter-limit"]),"line-round-limit":new Z(Ge.layout_line["line-round-limit"]),"line-sort-key":new re(Ge.layout_line["line-sort-key"])});var G2={paint:new he({"line-opacity":new re(Ge.paint_line["line-opacity"]),"line-color":new re(Ge.paint_line["line-color"]),"line-translate":new Z(Ge.paint_line["line-translate"]),"line-translate-anchor":new Z(Ge.paint_line["line-translate-anchor"]),"line-width":new re(Ge.paint_line["line-width"]),"line-gap-width":new re(Ge.paint_line["line-gap-width"]),"line-offset":new re(Ge.paint_line["line-offset"]),"line-blur":new re(Ge.paint_line["line-blur"]),"line-dasharray":new re(Ge.paint_line["line-dasharray"]),"line-pattern":new re(Ge.paint_line["line-pattern"]),"line-gradient":new ue(Ge.paint_line["line-gradient"]),"line-trim-offset":new Z(Ge.paint_line["line-trim-offset"])}),layout:hF};const H2=new class extends re{possiblyEvaluate(i,r){return r=new D(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,transition:r.transition}),super.possiblyEvaluate(i,r)}evaluate(i,r,o,c){return r=nt({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(i,r,o,c)}}(G2.paint.properties["line-width"].specification);function q2(i,r){return r>0?r+2*i:i}H2.useIntegerZoom=!0;const dF=Ie([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),pF=Ie([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),fF=Ie([{name:"a_projected_pos",components:4,type:"Float32"}],4);Ie([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const mF=Ie([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]),gF=Ie([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"}]);Ie([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"tileAnchorX"},{type:"Int16",name:"tileAnchorY"},{type:"Float32",name:"x1"},{type:"Float32",name:"y1"},{type:"Float32",name:"x2"},{type:"Float32",name:"y2"},{type:"Int16",name:"padding"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const Z2=Ie([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),yF=Ie([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);Ie([{name:"triangle",components:3,type:"Uint16"}]),Ie([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"},{type:"Uint8",name:"flipState"}]),Ie([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{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",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),Ie([{type:"Float32",name:"offsetX"}]),Ie([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);var ei=24;const Ra=128;function Yx(i,r){const{expression:o}=r;if(o.kind==="constant")return{kind:"constant",layoutSize:o.evaluate(new D(i+1))};if(o.kind==="source")return{kind:"source"};{const{zoomStops:c,interpolationType:p}=o;let m=0;for(;m{c.text=function(p,m,y){const x=m.layout.get("text-transform").evaluate(y,{});return x==="uppercase"?p=p.toLocaleUpperCase():x==="lowercase"&&(p=p.toLocaleLowerCase()),I.applyArabicShaping&&(p=I.applyArabicShaping(p)),p}(c.text,r,o)}),i}const hf={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂","←":"↑","→":"↓"};function xF(i){return i==="︶"||i==="﹈"||i==="︸"||i==="﹄"||i==="﹂"||i==="︾"||i==="︼"||i==="︺"||i==="︘"||i==="﹀"||i==="︐"||i==="︓"||i==="︔"||i==="`"||i===" ̄"||i==="︑"||i==="︒"}function bF(i){return i==="︵"||i==="﹇"||i==="︷"||i==="﹃"||i==="﹁"||i==="︽"||i==="︻"||i==="︹"||i==="︗"||i==="︿"}var K2=jr,X2=function(i,r,o,c,p){var m,y,x=8*p-c-1,E=(1<>1,k=-7,M=o?p-1:0,O=o?-1:1,$=i[r+M];for(M+=O,m=$&(1<<-k)-1,$>>=-k,k+=x;k>0;m=256*m+i[r+M],M+=O,k-=8);for(y=m&(1<<-k)-1,m>>=-k,k+=c;k>0;y=256*y+i[r+M],M+=O,k-=8);if(m===0)m=1-S;else{if(m===E)return y?NaN:1/0*($?-1:1);y+=Math.pow(2,c),m-=S}return($?-1:1)*y*Math.pow(2,m-c)},Y2=function(i,r,o,c,p,m){var y,x,E,S=8*m-p-1,k=(1<>1,O=p===23?Math.pow(2,-24)-Math.pow(2,-77):0,$=c?0:m-1,G=c?1:-1,K=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(x=isNaN(r)?1:0,y=k):(y=Math.floor(Math.log(r)/Math.LN2),r*(E=Math.pow(2,-y))<1&&(y--,E*=2),(r+=y+M>=1?O/E:O*Math.pow(2,1-M))*E>=2&&(y++,E/=2),y+M>=k?(x=0,y=k):y+M>=1?(x=(r*E-1)*Math.pow(2,p),y+=M):(x=r*Math.pow(2,M-1)*Math.pow(2,p),y=0));p>=8;i[o+$]=255&x,$+=G,x/=256,p-=8);for(y=y<0;i[o+$]=255&y,$+=G,y/=256,S-=8);i[o+$-G]|=128*K};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */function jr(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}jr.Varint=0,jr.Fixed64=1,jr.Bytes=2,jr.Fixed32=5;var Qx=4294967296,Q2=1/Qx,J2=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function Zs(i){return i.type===jr.Bytes?i.readVarint()+i.pos:i.pos+1}function Ph(i,r,o){return o?4294967296*r+(i>>>0):4294967296*(r>>>0)+(i>>>0)}function eI(i,r,o){var c=r<=16383?1:r<=2097151?2:r<=268435455?3:Math.floor(Math.log(r)/(7*Math.LN2));o.realloc(c);for(var p=o.pos-1;p>=i;p--)o.buf[p+c]=o.buf[p]}function wF(i,r){for(var o=0;o>>8,i[o+2]=r>>>16,i[o+3]=r>>>24}function tI(i,r){return(i[r]|i[r+1]<<8|i[r+2]<<16)+(i[r+3]<<24)}jr.prototype={destroy:function(){this.buf=null},readFields:function(i,r,o){for(o=o||this.length;this.pos>3,m=this.pos;this.type=7&c,i(p,r,this),this.pos===m&&this.skip(c)}return r},readMessage:function(i,r){return this.readFields(i,r,this.readVarint()+this.pos)},readFixed32:function(){var i=cg(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=tI(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=cg(this.buf,this.pos)+cg(this.buf,this.pos+4)*Qx;return this.pos+=8,i},readSFixed64:function(){var i=cg(this.buf,this.pos)+tI(this.buf,this.pos+4)*Qx;return this.pos+=8,i},readFloat:function(){var i=X2(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=X2(this.buf,this.pos,!0,52,8);return this.pos+=8,i},readVarint:function(i){var r,o,c=this.buf;return r=127&(o=c[this.pos++]),o<128?r:(r|=(127&(o=c[this.pos++]))<<7,o<128?r:(r|=(127&(o=c[this.pos++]))<<14,o<128?r:(r|=(127&(o=c[this.pos++]))<<21,o<128?r:function(p,m,y){var x,E,S=y.buf;if(x=(112&(E=S[y.pos++]))>>4,E<128||(x|=(127&(E=S[y.pos++]))<<3,E<128)||(x|=(127&(E=S[y.pos++]))<<10,E<128)||(x|=(127&(E=S[y.pos++]))<<17,E<128)||(x|=(127&(E=S[y.pos++]))<<24,E<128)||(x|=(1&(E=S[y.pos++]))<<31,E<128))return Ph(p,x,m);throw new Error("Expected varint not more than 10 bytes")}(r|=(15&(o=c[this.pos]))<<28,i,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var i=this.readVarint();return i%2==1?(i+1)/-2:i/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var i=this.readVarint()+this.pos,r=this.pos;return this.pos=i,i-r>=12&&J2?function(o,c,p){return J2.decode(o.subarray(c,p))}(this.buf,r,i):function(o,c,p){for(var m="",y=c;y239?4:k>223?3:k>191?2:1;if(y+O>p)break;O===1?k<128&&(M=k):O===2?(192&(x=o[y+1]))==128&&(M=(31&k)<<6|63&x)<=127&&(M=null):O===3?(E=o[y+2],(192&(x=o[y+1]))==128&&(192&E)==128&&((M=(15&k)<<12|(63&x)<<6|63&E)<=2047||M>=55296&&M<=57343)&&(M=null)):O===4&&(E=o[y+2],S=o[y+3],(192&(x=o[y+1]))==128&&(192&E)==128&&(192&S)==128&&((M=(15&k)<<18|(63&x)<<12|(63&E)<<6|63&S)<=65535||M>=1114112)&&(M=null)),M===null?(M=65533,O=1):M>65535&&(M-=65536,m+=String.fromCharCode(M>>>10&1023|55296),M=56320|1023&M),m+=String.fromCharCode(M),y+=O}return m}(this.buf,r,i)},readBytes:function(){var i=this.readVarint()+this.pos,r=this.buf.subarray(this.pos,i);return this.pos=i,r},readPackedVarint:function(i,r){if(this.type!==jr.Bytes)return i.push(this.readVarint(r));var o=Zs(this);for(i=i||[];this.pos127;);else if(r===jr.Bytes)this.pos=this.readVarint()+this.pos;else if(r===jr.Fixed32)this.pos+=4;else{if(r!==jr.Fixed64)throw new Error("Unimplemented type: "+r);this.pos+=8}},writeTag:function(i,r){this.writeVarint(i<<3|r)},realloc:function(i){for(var r=this.length||16;r268435455||i<0?function(r,o){var c,p;if(r>=0?(c=r%4294967296|0,p=r/4294967296|0):(p=~(-r/4294967296),4294967295^(c=~(-r%4294967296))?c=c+1|0:(c=0,p=p+1|0)),r>=18446744073709552e3||r<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");o.realloc(10),function(m,y,x){x.buf[x.pos++]=127&m|128,m>>>=7,x.buf[x.pos++]=127&m|128,m>>>=7,x.buf[x.pos++]=127&m|128,m>>>=7,x.buf[x.pos++]=127&m|128,x.buf[x.pos]=127&(m>>>=7)}(c,0,o),function(m,y){var x=(7&m)<<4;y.buf[y.pos++]|=x|((m>>>=3)?128:0),m&&(y.buf[y.pos++]=127&m|((m>>>=7)?128:0),m&&(y.buf[y.pos++]=127&m|((m>>>=7)?128:0),m&&(y.buf[y.pos++]=127&m|((m>>>=7)?128:0),m&&(y.buf[y.pos++]=127&m|((m>>>=7)?128:0),m&&(y.buf[y.pos++]=127&m)))))}(p,o)}(i,this):(this.realloc(4),this.buf[this.pos++]=127&i|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=i>>>7&127))))},writeSVarint:function(i){this.writeVarint(i<0?2*-i-1:2*i)},writeBoolean:function(i){this.writeVarint(!!i)},writeString:function(i){i=String(i),this.realloc(4*i.length),this.pos++;var r=this.pos;this.pos=function(c,p,m){for(var y,x,E=0;E55295&&y<57344){if(!x){y>56319||E+1===p.length?(c[m++]=239,c[m++]=191,c[m++]=189):x=y;continue}if(y<56320){c[m++]=239,c[m++]=191,c[m++]=189,x=y;continue}y=x-55296<<10|y-56320|65536,x=null}else x&&(c[m++]=239,c[m++]=191,c[m++]=189,x=null);y<128?c[m++]=y:(y<2048?c[m++]=y>>6|192:(y<65536?c[m++]=y>>12|224:(c[m++]=y>>18|240,c[m++]=y>>12&63|128),c[m++]=y>>6&63|128),c[m++]=63&y|128)}return m}(this.buf,i,this.pos);var o=this.pos-r;o>=128&&eI(r,o,this),this.pos=r-1,this.writeVarint(o),this.pos+=o},writeFloat:function(i){this.realloc(4),Y2(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),Y2(this.buf,i,this.pos,!0,52,8),this.pos+=8},writeBytes:function(i){var r=i.length;this.writeVarint(r),this.realloc(r);for(var o=0;o=128&&eI(o,c,this),this.pos=o-1,this.writeVarint(c),this.pos+=c},writeMessage:function(i,r,o){this.writeTag(i,jr.Bytes),this.writeRawMessage(r,o)},writePackedVarint:function(i,r){r.length&&this.writeMessage(i,wF,r)},writePackedSVarint:function(i,r){r.length&&this.writeMessage(i,EF,r)},writePackedBoolean:function(i,r){r.length&&this.writeMessage(i,AF,r)},writePackedFloat:function(i,r){r.length&&this.writeMessage(i,SF,r)},writePackedDouble:function(i,r){r.length&&this.writeMessage(i,TF,r)},writePackedFixed32:function(i,r){r.length&&this.writeMessage(i,IF,r)},writePackedSFixed32:function(i,r){r.length&&this.writeMessage(i,CF,r)},writePackedFixed64:function(i,r){r.length&&this.writeMessage(i,kF,r)},writePackedSFixed64:function(i,r){r.length&&this.writeMessage(i,PF,r)},writeBytesField:function(i,r){this.writeTag(i,jr.Bytes),this.writeBytes(r)},writeFixed32Field:function(i,r){this.writeTag(i,jr.Fixed32),this.writeFixed32(r)},writeSFixed32Field:function(i,r){this.writeTag(i,jr.Fixed32),this.writeSFixed32(r)},writeFixed64Field:function(i,r){this.writeTag(i,jr.Fixed64),this.writeFixed64(r)},writeSFixed64Field:function(i,r){this.writeTag(i,jr.Fixed64),this.writeSFixed64(r)},writeVarintField:function(i,r){this.writeTag(i,jr.Varint),this.writeVarint(r)},writeSVarintField:function(i,r){this.writeTag(i,jr.Varint),this.writeSVarint(r)},writeStringField:function(i,r){this.writeTag(i,jr.Bytes),this.writeString(r)},writeFloatField:function(i,r){this.writeTag(i,jr.Fixed32),this.writeFloat(r)},writeDoubleField:function(i,r){this.writeTag(i,jr.Fixed64),this.writeDouble(r)},writeBooleanField:function(i,r){this.writeVarintField(i,!!r)}};var ug=F(K2);const Jx=3;function DF(i,r,o){r.glyphs=[],i===1&&o.readMessage(MF,r)}function MF(i,r,o){if(i===3){const{id:c,bitmap:p,width:m,height:y,left:x,top:E,advance:S}=o.readMessage(zF,{});r.glyphs.push({id:c,bitmap:new qs({width:m+2*Jx,height:y+2*Jx},p),metrics:{width:m,height:y,left:x,top:E,advance:S}})}else i===4?r.ascender=o.readSVarint():i===5&&(r.descender=o.readSVarint())}function zF(i,r,o){i===1?r.id=o.readVarint():i===2?r.bitmap=o.readBytes():i===3?r.width=o.readVarint():i===4?r.height=o.readVarint():i===5?r.left=o.readSVarint():i===6?r.top=o.readSVarint():i===7&&(r.advance=o.readVarint())}const rI=Jx;function e1(i){let r=0,o=0;for(const y of i)r+=y.w*y.h,o=Math.max(o,y.w);i.sort((y,x)=>x.h-y.h);const c=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(r/.95)),o),h:1/0}];let p=0,m=0;for(const y of i)for(let x=c.length-1;x>=0;x--){const E=c[x];if(!(y.w>E.w||y.h>E.h)){if(y.x=E.x,y.y=E.y,m=Math.max(m,y.y+y.h),p=Math.max(p,y.x+y.w),y.w===E.w&&y.h===E.h){const S=c.pop();xr.hasImage(c)),r.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const c in r.updatedImages)this.patchUpdatedImage(this.iconPositions[c],r.getImage(c),o),this.patchUpdatedImage(this.patternPositions[c],r.getImage(c),o)}patchUpdatedImage(r,o,c){if(!r||!o||r.version===o.version)return;r.version=o.version;const[p,m]=r.tl;c.update(o.data,void 0,{x:p,y:m})}}At(t1,"ImagePosition"),At(nI,"ImageAtlas");const Do={horizontal:1,vertical:2,horizontalOnly:3},iI=-17;class df{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(r,o){const c=new df;return c.scale=r||1,c.fontStack=o,c}static forImage(r){const o=new df;return o.imageName=r,o}}class Mh{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(r,o){const c=new Mh;for(let p=0;p=0&&c>=r&&hg[this.text.charCodeAt(c)];c--)o--;this.text=this.text.substring(r,o),this.sectionIndex=this.sectionIndex.slice(r,o)}substring(r,o){const c=new Mh;return c.text=this.text.substring(r,o),c.sectionIndex=this.sectionIndex.slice(r,o),c.sections=this.sections,c}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((r,o)=>Math.max(r,this.sections[o].scale),0)}addTextSection(r,o){this.text+=r.text,this.sections.push(df.forText(r.scale,r.fontStack||o));const c=this.sections.length-1;for(let p=0;p=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function r1(i,r,o,c,p,m,y,x,E,S,k,M,O,$,G){const K=Mh.fromFeature(i,p);M===Do.vertical&&K.verticalizePunctuation(O);let ee=[];const le=function(ye,Oe,Me,He,lt,Ue){if(!ye)return[];const Qe=[],Je=function(_t,Ct,vt,Gt,ft,zt){let Ht=0;for(let fr=0;fr<_t.length();fr++){const qt=_t.getSection(fr);Ht+=oI(_t.getCharCode(fr),qt,Gt,ft,Ct,zt)}return Ht/Math.max(1,Math.ceil(Ht/vt))}(ye,Oe,Me,He,lt,Ue),ot=ye.text.indexOf("​")>=0;let pt=0;for(let _t=0;_t0&&La>Br&&(Br=La)}else{const Oi=Me[Rn.fontStack];if(!Oi)continue;Oi[nn]&&(Wr=Oi[nn]);const qn=Oe[Rn.fontStack];if(!qn)continue;const La=qn.glyphs[nn];if(!La)continue;if(Sn=La.metrics,Tn=nn!==8203?ei:0,zt){const Nh=qn.ascender!==void 0?Math.abs(qn.ascender):0,wf=qn.descender!==void 0?Math.abs(qn.descender):0,Ef=(Nh+wf)*yr;tn-o/2;){if(y--,y<0)return!1;x-=i[y].dist(m),m=i[y]}x+=i[y].dist(i[y+1]),y++;const E=[];let S=0;for(;xc;)S-=E.shift().angleDelta;if(S>p)return!1;y++,x+=k.dist(M)}return!0}function dI(i){let r=0;for(let o=0;oS){const G=(S-E)/$,K=dr(M.x,O.x,G),ee=dr(M.y,O.y,G),le=new Ks(K,ee,0,O.angleTo(M),k);return!y||hI(i,le,x,y,r)?le:void 0}E+=$}}function BF(i,r,o,c,p,m,y,x,E){const S=pI(c,m,y),k=fI(c,p),M=k*y,O=i[0].x===0||i[0].x===E||i[0].y===0||i[0].y===E;return r-M=0&&pe=0&&_e=0&&O+S<=k){const ye=new Ks(pe,_e,0,me,G);ye._round(),c&&!hI(i,ye,m,c,p)||$.push(ye)}}M+=le}return x||$.length||y||($=mI(i,M/2,o,c,p,m,y,!0,E)),$}function gI(i,r,o,c,p){const m=[];for(let y=0;y=c&&M.x>=c||(k.x>=c?k=new xe(c,k.y+(c-k.x)/(M.x-k.x)*(M.y-k.y))._round():M.x>=c&&(M=new xe(c,k.y+(c-k.x)/(M.x-k.x)*(M.y-k.y))._round()),k.y>=p&&M.y>=p||(k.y>=p?k=new xe(k.x+(p-k.y)/(M.y-k.y)*(M.x-k.x),p)._round():M.y>=p&&(M=new xe(k.x+(p-k.y)/(M.y-k.y)*(M.x-k.x),p)._round()),E&&k.equals(E[E.length-1])||(E=[k],m.push(E)),E.push(M)))))}}return m}At(Ks,"Anchor");const pf=1e20;function yI(i,r,o,c,p,m,y,x,E){for(let S=r;S-1);E++,m[E]=x,y[E]=S,y[E+1]=pf}for(let x=0,E=0;x{let x=this.entries[p];x||(x=this.entries[p]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let E=x.glyphs[m];if(E!==void 0)return void y(null,{stack:p,id:m,glyph:E});if(E=this._tinySDF(x,p,m),E)return x.glyphs[m]=E,void y(null,{stack:p,id:m,glyph:E});const S=Math.floor(m/256);if(256*S>65535)return void y(new Error("glyphs > 65535 not supported"));if(x.ranges[S])return void y(null,{stack:p,id:m,glyph:E});let k=x.requests[S];k||(k=x.requests[S]=[],zh.loadGlyphRange(p,S,this.url,this.requestManager,(M,O)=>{if(O){x.ascender=O.ascender,x.descender=O.descender;for(const $ in O.glyphs)this._doesCharSupportLocalGlyph(+$)||(x.glyphs[+$]=O.glyphs[+$]);x.ranges[S]=!0}for(const $ of k)$(M,O);delete x.requests[S]})),k.push((M,O)=>{M?y(M):O&&y(null,{stack:p,id:m,glyph:O.glyphs[m]||null})})},(p,m)=>{if(p)o(p);else if(m){const y={};for(const{stack:x,id:E,glyph:S}of m)y[x]===void 0&&(y[x]={}),y[x].glyphs===void 0&&(y[x].glyphs={}),y[x].glyphs[E]=S&&{id:S.id,bitmap:S.bitmap.clone(),metrics:S.metrics},y[x].ascender=this.entries[x].ascender,y[x].descender=this.entries[x].descender;o(null,y)}})}_doesCharSupportLocalGlyph(r){return this.localGlyphMode!==i1.none&&(this.localGlyphMode===i1.all?!!this.localFontFamily:!!this.localFontFamily&&(xt["CJK Unified Ideographs"](r)||xt["Hangul Syllables"](r)||xt.Hiragana(r)||xt.Katakana(r)||xt["CJK Symbols and Punctuation"](r)))}_tinySDF(r,o,c){const p=this.localFontFamily;if(!p||!this._doesCharSupportLocalGlyph(c))return;let m=r.tinySDF;if(!m){let K="400";/bold/i.test(o)?K="900":/medium/i.test(o)?K="500":/light/i.test(o)&&(K="200"),m=r.tinySDF=new zh.TinySDF({fontFamily:p,fontWeight:K,fontSize:24*Oa,buffer:3*Oa,radius:8*Oa}),m.fontWeight=K}if(this.localGlyphs[m.fontWeight][c])return this.localGlyphs[m.fontWeight][c];const y=String.fromCharCode(c),{data:x,width:E,height:S,glyphWidth:k,glyphHeight:M,glyphLeft:O,glyphTop:$,glyphAdvance:G}=m.draw(y);return this.localGlyphs[m.fontWeight][c]={id:c,bitmap:new qs({width:E,height:S},x),metrics:{width:k/Oa,height:M/Oa,left:O/Oa,top:$/Oa-27,advance:G/Oa,localGlyph:!0}}}}zh.loadGlyphRange=function(i,r,o,c,p){const m=256*r,y=m+255,x=c.transformRequest(c.normalizeGlyphsURL(o).replace("{fontstack}",i).replace("{range}",`${m}-${y}`),ga.Glyphs);Ja(x,(E,S)=>{if(E)p(E);else if(S){const k={},M=function(O){return new ug(O).readFields(DF,{})}(S);for(const O of M.glyphs)k[O.id]=O;p(null,{glyphs:k,ascender:M.ascender,descender:M.descender})}})},zh.TinySDF=class{constructor({fontSize:i=24,buffer:r=3,radius:o=8,cutoff:c=.25,fontFamily:p="sans-serif",fontWeight:m="normal",fontStyle:y="normal"}={}){this.buffer=r,this.cutoff=c,this.radius=o;const x=this.size=i+4*r,E=this._createCanvas(x),S=this.ctx=E.getContext("2d",{willReadFrequently:!0});S.font=`${y} ${m} ${i}px ${p}`,S.textBaseline="alphabetic",S.textAlign="left",S.fillStyle="black",this.gridOuter=new Float64Array(x*x),this.gridInner=new Float64Array(x*x),this.f=new Float64Array(x),this.z=new Float64Array(x+1),this.v=new Uint16Array(x)}_createCanvas(i){const r=document.createElement("canvas");return r.width=r.height=i,r}draw(i){const{width:r,actualBoundingBoxAscent:o,actualBoundingBoxDescent:c,actualBoundingBoxLeft:p,actualBoundingBoxRight:m}=this.ctx.measureText(i),y=Math.ceil(o),x=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(m-p))),E=Math.min(this.size-this.buffer,y+Math.ceil(c)),S=x+2*this.buffer,k=E+2*this.buffer,M=Math.max(S*k,0),O=new Uint8ClampedArray(M),$={data:O,width:S,height:k,glyphWidth:x,glyphHeight:E,glyphTop:y,glyphLeft:0,glyphAdvance:r};if(x===0||E===0)return $;const{ctx:G,buffer:K,gridInner:ee,gridOuter:le}=this;G.clearRect(K,K,x,E),G.fillText(i,K,K+y);const me=G.getImageData(K,K,x,E);le.fill(pf,0,M),ee.fill(0,0,M);for(let ce=0;ce0?Oe*Oe:0,ee[ye]=Oe<0?Oe*Oe:0}}yI(le,0,0,S,k,S,this.f,this.v,this.z),yI(ee,K,K,x,E,S,this.f,this.v,this.z);for(let ce=0;ceUe+Qe[1]-Qe[0],G=M.reduce($,0),K=O.reduce($,0),ee=x-G,le=E-K;let me=0,ce=G,pe=0,_e=K,ye=0,Oe=ee,Me=0,He=le;if(m.content&&c){const Ue=m.content;me=dg(M,0,Ue[0]),pe=dg(O,0,Ue[1]),ce=dg(M,Ue[0],Ue[2]),_e=dg(O,Ue[1],Ue[3]),ye=Ue[0]-me,Me=Ue[1]-pe,Oe=Ue[2]-Ue[0]-ce,He=Ue[3]-Ue[1]-_e}const lt=(Ue,Qe,Je,ot)=>{const pt=pg(Ue.stretch-me,ce,S,i.left),We=fg(Ue.fixed-ye,Oe,Ue.stretch,G),_t=pg(Qe.stretch-pe,_e,k,i.top),Ct=fg(Qe.fixed-Me,He,Qe.stretch,K),vt=pg(Je.stretch-me,ce,S,i.left),Gt=fg(Je.fixed-ye,Oe,Je.stretch,G),ft=pg(ot.stretch-pe,_e,k,i.top),zt=fg(ot.fixed-Me,He,ot.stretch,K),Ht=new xe(pt,_t),fr=new xe(vt,_t),qt=new xe(vt,ft),Bt=new xe(pt,ft),Hr=new xe(We/y,Ct/y),Zt=new xe(Gt/y,zt/y),Kt=r*Math.PI/180;if(Kt){const $r=Math.sin(Kt),Br=Math.cos(Kt),tn=[Br,-$r,$r,Br];Ht._matMult(tn),fr._matMult(tn),Bt._matMult(tn),qt._matMult(tn)}const Lr=Ue.stretch+Ue.fixed,Vr=Qe.stretch+Qe.fixed;return{tl:Ht,tr:fr,bl:Bt,br:qt,tex:{x:m.paddedRect.x+Rh+Lr,y:m.paddedRect.y+Rh+Vr,w:Je.stretch+Je.fixed-Lr,h:ot.stretch+ot.fixed-Vr},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Hr,pixelOffsetBR:Zt,minFontScaleX:Oe/y/S,minFontScaleY:He/y/k,isSDF:o}};if(c&&(m.stretchX||m.stretchY)){const Ue=xI(M,ee,G),Qe=xI(O,le,K);for(let Je=0;Je0)for(let c=(this.length>>1)-1;c>=0;c--)this._down(c)}push(r){this.data.push(r),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const r=this.data[0],o=this.data.pop();return this.length--,this.length>0&&(this.data[0]=o,this._down(0)),r}peek(){return this.data[0]}_up(r){const{data:o,compare:c}=this,p=o[r];for(;r>0;){const m=r-1>>1,y=o[m];if(c(p,y)>=0)break;o[r]=y,r=m}o[r]=p}_down(r){const{data:o,compare:c}=this,p=this.length>>1,m=o[r];for(;r=0)break;o[r]=x,r=y}o[r]=m}}function jF(i,r){return ir?1:0}function VF(i,r=1,o=!1){let c=1/0,p=1/0,m=-1/0,y=-1/0;const x=i[0];for(let $=0;$m)&&(m=G.x),(!$||G.y>y)&&(y=G.y)}const E=Math.min(m-c,y-p);let S=E/2;const k=new UF([],$F);if(E===0)return new xe(c,p);for(let $=c;$M.d||!M.d)&&(M=$,o&&console.log("found best %d after %d probes",Math.round(1e4*$.d)/1e4,O)),$.max-M.d<=r||(S=$.h/2,k.push(new Oh($.p.x-S,$.p.y-S,S,i)),k.push(new Oh($.p.x+S,$.p.y-S,S,i)),k.push(new Oh($.p.x-S,$.p.y+S,S,i)),k.push(new Oh($.p.x+S,$.p.y+S,S,i)),O+=4)}return o&&(console.log(`num probes: ${O}`),console.log(`best distance: ${M.d}`)),M.p}function $F(i,r){return r.max-i.max}class Oh{constructor(r,o,c,p){this.p=new xe(r,o),this.h=c,this.d=function(m,y){let x=!1,E=1/0;for(let S=0;Sm.y!=K.y>m.y&&m.x<(K.x-G.x)*(m.y-G.y)/(K.y-G.y)+G.x&&(x=!x),E=Math.min(E,m2(m,G,K))}}return(x?1:-1)*Math.sqrt(E)}(this.p,p),this.max=this.d+this.h*Math.SQRT2}}const Fh=7,o1=Number.POSITIVE_INFINITY,WF=Math.sqrt(2);function bI(i,[r,o]){let c=0,p=0;if(o===o1){r<0&&(r=0);const m=r/WF;switch(i){case"top-right":case"top-left":p=m-Fh;break;case"bottom-right":case"bottom-left":p=-m+Fh;break;case"bottom":p=-r+Fh;break;case"top":p=r-Fh}switch(i){case"top-right":case"bottom-right":c=-m;break;case"top-left":case"bottom-left":c=m;break;case"left":c=r;break;case"right":c=-r}}else{switch(r=Math.abs(r),o=Math.abs(o),i){case"top-right":case"top-left":case"top":p=o-Fh;break;case"bottom-right":case"bottom-left":case"bottom":p=-o+Fh}switch(i){case"top-right":case"bottom-right":case"right":c=-r;break;case"top-left":case"bottom-left":case"left":c=r}}return[c,p]}function GF(i,r,o,c,p,m,y,x,E,S){i.createArrays(),i.tilePixelRatio=Ot/(512*i.overscaling),i.compareText={},i.iconsNeedLinear=!1;const k=i.layers[0].layout,M=i.layers[0]._unevaluatedLayout._values,O={};if(i.textSizeData.kind==="composite"){const{minZoom:K,maxZoom:ee}=i.textSizeData;O.compositeTextSizes=[M["text-size"].possiblyEvaluate(new D(K),x),M["text-size"].possiblyEvaluate(new D(ee),x)]}if(i.iconSizeData.kind==="composite"){const{minZoom:K,maxZoom:ee}=i.iconSizeData;O.compositeIconSizes=[M["icon-size"].possiblyEvaluate(new D(K),x),M["icon-size"].possiblyEvaluate(new D(ee),x)]}O.layoutTextSize=M["text-size"].possiblyEvaluate(new D(E+1),x),O.layoutIconSize=M["icon-size"].possiblyEvaluate(new D(E+1),x),O.textMaxSize=M["text-size"].possiblyEvaluate(new D(18),x);const $=k.get("text-rotation-alignment")==="map"&&k.get("symbol-placement")!=="point",G=k.get("text-size");for(const K of i.features){const ee=k.get("text-font").evaluate(K,{},x).join(","),le=G.evaluate(K,{},x),me=O.layoutTextSize.evaluate(K,{},x),ce=(O.layoutIconSize.evaluate(K,{},x),{horizontal:{},vertical:void 0}),pe=K.text;let _e,ye=[0,0];if(pe){const He=pe.toString(),lt=k.get("text-letter-spacing").evaluate(K,{},x)*ei,Ue=k.get("text-line-height").evaluate(K,{},x)*ei,Qe=fx(He)?lt:0,Je=k.get("text-anchor").evaluate(K,{},x),ot=k.get("text-variable-anchor");if(!ot){const vt=k.get("text-radial-offset").evaluate(K,{},x);ye=vt?bI(Je,[vt*ei,o1]):k.get("text-offset").evaluate(K,{},x).map(Gt=>Gt*ei)}let pt=$?"center":k.get("text-justify").evaluate(K,{},x);const We=k.get("symbol-placement")==="point",_t=We?k.get("text-max-width").evaluate(K,{},x)*ei:1/0,Ct=vt=>{i.allowVerticalPlacement&&Lp(He)&&(ce.vertical=r1(pe,r,o,p,ee,_t,Ue,Je,vt,Qe,ye,Do.vertical,!0,me,le))};if(!$&&ot){const vt=pt==="auto"?ot.map(ft=>a1(ft)):[pt];let Gt=!1;for(let ft=0;ft=0||!Lp(He)){const vt=r1(pe,r,o,p,ee,_t,Ue,Je,pt,Qe,ye,Do.horizontal,!1,me,le);vt&&(ce.horizontal[pt]=vt)}Ct(We?"left":pt)}}let Oe=!1;if(K.icon&&K.icon.name){const He=c[K.icon.name];He&&(_e=FF(p[K.icon.name],k.get("icon-offset").evaluate(K,{},x),k.get("icon-anchor").evaluate(K,{},x)),Oe=He.sdf,i.sdfIcons===void 0?i.sdfIcons=He.sdf:i.sdfIcons!==He.sdf&&Tr("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(He.pixelRatio!==i.pixelRatio||k.get("icon-rotate").constantOr(1)!==0)&&(i.iconsNeedLinear=!0))}const Me=EI(ce.horizontal)||ce.vertical;i.iconsInText||(i.iconsInText=!!Me&&Me.iconsInText),(Me||_e)&&HF(i,K,ce,_e,c,O,me,0,ye,Oe,y,x,S)}m&&i.generateCollisionDebugBuffers(E,i.collisionBoxArray)}function a1(i){switch(i){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function HF(i,r,o,c,p,m,y,x,E,S,k,M,O){let $=m.textMaxSize.evaluate(r,{},M);$===void 0&&($=y);const G=i.layers[0].layout,K=G.get("icon-offset").evaluate(r,{},M),ee=EI(o.horizontal)||o.vertical,le=O.name==="globe",me=ei,ce=y/me,pe=i.tilePixelRatio*$/me,_e=(Je=i.overscaling,i.zoom>18&&Je>2&&(Je>>=1),Math.max(Ot/(512*Je),1)*G.get("symbol-spacing")),ye=G.get("text-padding")*i.tilePixelRatio,Oe=G.get("icon-padding")*i.tilePixelRatio,Me=Fe(G.get("text-max-angle")),He=G.get("text-rotation-alignment")==="map"&&G.get("symbol-placement")!=="point",lt=G.get("icon-rotation-alignment")==="map"&&G.get("symbol-placement")!=="point",Ue=G.get("symbol-placement"),Qe=_e/2;var Je;const ot=G.get("icon-text-fit");let pt;c&&ot!=="none"&&(i.allowVerticalPlacement&&o.vertical&&(pt=uI(c,o.vertical,ot,G.get("icon-text-fit-padding"),K,ce)),ee&&(c=uI(c,ee,ot,G.get("icon-text-fit-padding"),K,ce)));const We=(_t,Ct,vt)=>{if(Ct.x<0||Ct.x>=Ot||Ct.y<0||Ct.y>=Ot)return;let Gt=null;if(le){const{x:ft,y:zt,z:Ht}=O.projectTilePoint(Ct.x,Ct.y,vt);Gt={anchor:new Ks(ft,zt,Ht,0,void 0),up:O.upVector(vt,Ct.x,Ct.y)}}(function(ft,zt,Ht,fr,qt,Bt,Hr,Zt,Kt,Lr,Vr,$r,Br,tn,cn,wn,Nr,Rn,En,nn,yr,Sn,Wr,Ri,Tn){const ti=ft.addToLineVertexArray(zt,fr);let Hn,Oi,qn,La,Nh,wf,Ef,rC=0,nC=0,iC=0,oC=0,b1=-1,w1=-1;const us={};let aC=yx("");const du=Ht?Ht.anchor:zt;let E1=0,S1=0;if(Kt._unevaluatedLayout.getValue("text-radial-offset")===void 0?[E1,S1]=Kt.layout.get("text-offset").evaluate(yr,{},Tn).map(co=>co*ei):(E1=Kt.layout.get("text-radial-offset").evaluate(yr,{},Tn)*ei,S1=o1),ft.allowVerticalPlacement&&qt.vertical){const co=qt.vertical;if(cn)wf=s1(co),Zt&&(Ef=s1(Zt));else{const uo=Kt.layout.get("text-rotate").evaluate(yr,{},Tn)+90;qn=mg(Lr,du,zt,Vr,$r,Br,co,tn,uo,wn),Zt&&(La=mg(Lr,du,zt,Vr,$r,Br,Zt,Rn,uo))}}if(Bt){const co=Kt.layout.get("icon-rotate").evaluate(yr,{},Tn),uo=Kt.layout.get("icon-text-fit")!=="none",Sf=vI(Bt,co,Wr,uo),A1=Zt?vI(Zt,co,Wr,uo):void 0;Oi=mg(Lr,du,zt,Vr,$r,Br,Bt,Rn,co),rC=4*Sf.length;const sC=ft.iconSizeData;let pu=null;sC.kind==="source"?(pu=[Ra*Kt.layout.get("icon-size").evaluate(yr,{},Tn)],pu[0]>Bl&&Tr(`${ft.layerIds[0]}: Value for "icon-size" is >= ${ff}. Reduce your "icon-size".`)):sC.kind==="composite"&&(pu=[Ra*Sn.compositeIconSizes[0].evaluate(yr,{},Tn),Ra*Sn.compositeIconSizes[1].evaluate(yr,{},Tn)],(pu[0]>Bl||pu[1]>Bl)&&Tr(`${ft.layerIds[0]}: Value for "icon-size" is >= ${ff}. Reduce your "icon-size".`)),ft.addSymbols(ft.icon,Sf,pu,nn,En,yr,!1,Ht,zt,ti.lineStartIndex,ti.lineLength,-1,Ri,Tn),b1=ft.icon.placedSymbolArray.length-1,A1&&(nC=4*A1.length,ft.addSymbols(ft.icon,A1,pu,nn,En,yr,Do.vertical,Ht,zt,ti.lineStartIndex,ti.lineLength,-1,Ri,Tn),w1=ft.icon.placedSymbolArray.length-1)}for(const co in qt.horizontal){const uo=qt.horizontal[co];Hn||(aC=yx(uo.text),cn?Nh=s1(uo):Hn=mg(Lr,du,zt,Vr,$r,Br,uo,tn,Kt.layout.get("text-rotate").evaluate(yr,{},Tn),wn));const Sf=uo.positionedLines.length===1;if(iC+=wI(ft,Ht,zt,uo,Hr,Kt,cn,yr,wn,ti,qt.vertical?Do.horizontal:Do.horizontalOnly,Sf?Object.keys(qt.horizontal):[co],us,b1,Sn,Ri,Tn),Sf)break}qt.vertical&&(oC+=wI(ft,Ht,zt,qt.vertical,Hr,Kt,cn,yr,wn,ti,Do.vertical,["vertical"],us,w1,Sn,Ri,Tn));let Wl=-1;const T1=(co,uo)=>co?Math.max(co,uo):uo;Wl=T1(Nh,Wl),Wl=T1(wf,Wl),Wl=T1(Ef,Wl);const xL=Wl>-1?1:0;ft.glyphOffsetArray.length>=Ul.MAX_GLYPHS&&Tr("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),yr.sortKey!==void 0&&ft.addToSortKeyRanges(ft.symbolInstances.length,yr.sortKey),ft.symbolInstances.emplaceBack(du.x,du.y,du.z,zt.x,zt.y,us.right>=0?us.right:-1,us.center>=0?us.center:-1,us.left>=0?us.left:-1,us.vertical>=0?us.vertical:-1,b1,w1,aC,Hn!==void 0?Hn:ft.collisionBoxArray.length,Hn!==void 0?Hn+1:ft.collisionBoxArray.length,qn!==void 0?qn:ft.collisionBoxArray.length,qn!==void 0?qn+1:ft.collisionBoxArray.length,Oi!==void 0?Oi:ft.collisionBoxArray.length,Oi!==void 0?Oi+1:ft.collisionBoxArray.length,La||ft.collisionBoxArray.length,La?La+1:ft.collisionBoxArray.length,Vr,iC,oC,rC,nC,xL,0,E1,S1,Wl)})(i,Ct,Gt,_t,o,c,p,pt,i.layers[0],i.collisionBoxArray,r.index,r.sourceLayerIndex,i.index,ye,He,E,0,Oe,lt,K,r,m,S,k,M)};if(Ue==="line")for(const _t of gI(r.geometry,0,0,Ot,Ot)){const Ct=BF(_t,_e,Me,o.vertical||ee,c,me,pe,i.overscaling,Ot);for(const vt of Ct)ee&&qF(i,ee.text,Qe,vt)||We(_t,vt,M)}else if(Ue==="line-center"){for(const _t of r.geometry)if(_t.length>1){const Ct=LF(_t,Me,o.vertical||ee,c,me,pe);Ct&&We(_t,Ct,M)}}else if(r.type==="Polygon")for(const _t of qx(r.geometry,0)){const Ct=VF(_t,16);We(_t[0],new Ks(Ct.x,Ct.y,0,0,void 0),M)}else if(r.type==="LineString")for(const _t of r.geometry)We(_t,new Ks(_t[0].x,_t[0].y,0,0,void 0),M);else if(r.type==="Point")for(const _t of r.geometry)for(const Ct of _t)We([Ct],new Ks(Ct.x,Ct.y,0,0,void 0),M)}const ff=255,Bl=ff*Ra;function wI(i,r,o,c,p,m,y,x,E,S,k,M,O,$,G,K,ee){const le=function(pe,_e,ye,Oe,Me,He,lt,Ue){const Qe=[];if(_e.positionedLines.length===0)return Qe;const Je=Oe.layout.get("text-rotate").evaluate(He,{})*Math.PI/180,ot=function(vt){const Gt=vt[0],ft=vt[1],zt=Gt*ft;return zt>0?[Gt,-ft]:zt<0?[-Gt,ft]:Gt===0?[ft,Gt]:[ft,-Gt]}(ye);let pt=Math.abs(_e.top-_e.bottom);for(const vt of _e.positionedLines)pt-=vt.lineOffset;const We=_e.positionedLines.length,_t=pt/We;let Ct=_e.top-ye[1];for(let vt=0;vtBl&&Tr(`${i.layerIds[0]}: Value for "text-size" is >= ${ff}. Reduce your "text-size".`)):me.kind==="composite"&&(ce=[Ra*G.compositeTextSizes[0].evaluate(x,{},ee),Ra*G.compositeTextSizes[1].evaluate(x,{},ee)],(ce[0]>Bl||ce[1]>Bl)&&Tr(`${i.layerIds[0]}: Value for "text-size" is >= ${ff}. Reduce your "text-size".`)),i.addSymbols(i.text,le,ce,E,y,x,k,r,o,S.lineStartIndex,S.lineLength,$,K,ee);for(const pe of M)O[pe]=i.text.placedSymbolArray.length-1;return 4*le.length}function EI(i){for(const r in i)return i[r];return null}function mg(i,r,o,c,p,m,y,x,E,S){let k=y.top,M=y.bottom,O=y.left,$=y.right;const G=y.collisionPadding;if(G&&(O-=G[0],k-=G[1],$+=G[2],M+=G[3]),E){const K=new xe(O,k),ee=new xe($,k),le=new xe(O,M),me=new xe($,M),ce=Fe(E);let pe=new xe(0,0);S&&(pe=new xe(S[0],S[1])),K._rotateAround(ce,pe),ee._rotateAround(ce,pe),le._rotateAround(ce,pe),me._rotateAround(ce,pe),O=Math.min(K.x,ee.x,le.x,me.x),$=Math.max(K.x,ee.x,le.x,me.x),k=Math.min(K.y,ee.y,le.y,me.y),M=Math.max(K.y,ee.y,le.y,me.y)}return i.emplaceBack(r.x,r.y,r.z,o.x,o.y,O,k,$,M,x,c,p,m),i.length-1}function s1(i){i.collisionPadding&&(i.top-=i.collisionPadding[1],i.bottom+=i.collisionPadding[3]);const r=i.bottom-i.top;return r>0?Math.max(10,r):null}function qF(i,r,o,c){const p=i.compareText;if(r in p){const m=p[r];for(let y=m.length-1;y>=0;y--)if(c.dist(m[y])ce&&(pe(ye,ot,Me,He,Qe,Je),pe(ot,Oe,Qe,Je,lt,Ue))}pe(M,O,c,m,p,m),pe(O,$,p,m,p,y),pe($,G,p,y,c,y),pe(G,M,c,y,c,m),K-=ce,ee-=ce,le+=ce,me+=ce;const _e=1/Math.max(le-K,me-ee);return{scale:_e,x:K*_e,y:ee*_e,x2:le*_e,y2:me*_e,projection:r}}const ZF=Da(new Float32Array(16));class Nl{constructor(r){this.spec=r,this.name=r.name,this.wrap=!1,this.requiresDraping=!1,this.supportsWorldCopies=!1,this.supportsTerrain=!1,this.supportsFog=!1,this.supportsFreeCamera=!1,this.zAxisUnit="meters",this.isReprojectedInTileSpace=!0,this.unsupportedLayers=["custom"],this.center=[0,0],this.range=[3.5,7]}project(r,o){return{x:0,y:0,z:0}}unproject(r,o){return new Fr(0,0)}projectTilePoint(r,o,c){return{x:r,y:o,z:0}}locationPoint(r,o,c=!0){return r._coordinatePoint(r.locationCoordinate(o),c)}pixelsPerMeter(r,o){return za(1,r)*o}pixelSpaceConversion(r,o,c){return 1}farthestPixelDistance(r){return SI(r,r.pixelsPerMeter)}pointCoordinate(r,o,c,p){const m=r.horizonLineFromTop(!1),y=new xe(o,Math.max(m,c));return r.rayIntersectionCoordinate(r.pointRayIntersection(y,p))}pointCoordinate3D(r,o,c){const p=new xe(o,c);if(r.elevation)return r.elevation.pointCoordinate(p);{const m=this.pointCoordinate(r,p.x,p.y,0);return[m.x,m.y,m.z]}}isPointAboveHorizon(r,o){if(r.elevation)return!this.pointCoordinate3D(r,o.x,o.y);const c=r.horizonLineFromTop();return o.y0?o<-Lh+c&&(o=-Lh+c):o>Lh-c&&(o=Lh-c);const y=m/Math.pow(yg(o),p);let x=y*Math.sin(p*r),E=m-y*Math.cos(p*r);return x=.5*(x/Math.PI+.5),E=.5*(E/Math.PI+.5),{x,y:this.southernCenter?E:1-E,z:0}}unproject(r,o){r=(2*r-.5)*Math.PI,this.southernCenter&&(o=1-o),o=(2*(1-o)-.5)*Math.PI;const{n:c,f:p}=this,m=p-o,y=Math.sign(m),x=Math.sign(c)*Math.sqrt(r*r+m*m);let E=Math.atan2(r,Math.abs(m))*y;m*c<0&&(E-=Math.PI*Math.sign(r)*y);const S=qe(Ve(E/c)+this.center[0],-180,180),k=qe(Ve(2*Math.atan(Math.pow(p/x,1/c))-Lh),-di,di);return new Fr(S,this.southernCenter?-k:k)}}class TI extends Nl{constructor(r){super(r),this.wrap=!0,this.supportsWorldCopies=!0,this.supportsTerrain=!0,this.supportsFog=!0,this.supportsFreeCamera=!0,this.isReprojectedInTileSpace=!1,this.unsupportedLayers=[],this.range=null}project(r,o){return{x:os(r),y:as(o),z:0}}unproject(r,o){const c=Po(r),p=hi(o);return new Fr(c,p)}}const AI=Fe(di);class JF extends Nl{project(r,o){const c=(o=Fe(o))*o,p=c*c;return{x:.5*((r=Fe(r))*(.8707-.131979*c+p*(p*(.003971*c-.001529*p)-.013791))/Math.PI+.5),y:1-.5*(o*(1.007226+c*(.015085+p*(.028874*c-.044475-.005916*p)))/Math.PI+1),z:0}}unproject(r,o){r=(2*r-.5)*Math.PI;let c=o=(2*(1-o)-1)*Math.PI,p=25,m=0,y=c*c;do{y=c*c;const S=y*y;m=(c*(1.007226+y*(.015085+S*(.028874*y-.044475-.005916*S)))-o)/(1.007226+y*(.045255+S*(.259866*y-.311325-.005916*11*S))),c=qe(c-m,-AI,AI)}while(Math.abs(m)>1e-6&&--p>0);y=c*c;const x=qe(Ve(r/(.8707+y*(y*(y*y*y*(.003971-.001529*y)-.013791)-.131979))),-180,180),E=Ve(c);return new Fr(x,E)}}const II=Fe(di);class eL extends Nl{project(r,o){o=Fe(o),r=Fe(r);const c=Math.cos(o),p=2/Math.PI,m=Math.acos(c*Math.cos(r/2)),y=Math.sin(m)/m,x=.5*(r*p+2*c*Math.sin(r/2)/y)||0,E=.5*(o+Math.sin(o)/y)||0;return{x:.5*(x/Math.PI+.5),y:1-.5*(E/Math.PI+1),z:0}}unproject(r,o){let c=r=(2*r-.5)*Math.PI,p=o=(2*(1-o)-1)*Math.PI,m=25;const y=1e-6;let x=0,E=0;do{const S=Math.cos(p),k=Math.sin(p),M=2*k*S,O=k*k,$=S*S,G=Math.cos(c/2),K=Math.sin(c/2),ee=2*G*K,le=K*K,me=1-$*G*G,ce=me?1/me:0,pe=me?Math.acos(S*G)*Math.sqrt(1/me):0,_e=.5*(2*pe*S*K+2*c/Math.PI)-r,ye=.5*(pe*k+p)-o,Oe=.5*ce*($*le+pe*S*G*O)+1/Math.PI,Me=ce*(ee*M/4-pe*k*K),He=.125*ce*(M*K-pe*k*$*ee),lt=.5*ce*(O*G+pe*le*S)+.5,Ue=Me*He-lt*Oe;x=(ye*Me-_e*lt)/Ue,E=(_e*He-ye*Oe)/Ue,c=qe(c-x,-Math.PI,Math.PI),p=qe(p-E,-II,II)}while((Math.abs(x)>y||Math.abs(E)>y)&&--m>0);return new Fr(Ve(c),Ve(p))}}class CI extends Nl{constructor(r){super(r),this.center=r.center||[0,0],this.parallels=r.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(Fe(this.parallels[0]))),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(r,o){const{scale:c,cosPhi:p}=this;return{x:Fe(r)*p*c+.5,y:-Math.sin(Fe(o))/p*c+.5,z:0}}unproject(r,o){const{scale:c,cosPhi:p}=this,m=-(o-.5)/c,y=qe(Ve((r-.5)/c)/p,-180,180),x=Math.asin(qe(m*p,-1,1)),E=qe(Ve(x),-di,di);return new Fr(y,E)}}class tL extends TI{constructor(r){super(r),this.requiresDraping=!0,this.supportsWorldCopies=!1,this.supportsFog=!0,this.zAxisUnit="pixels",this.unsupportedLayers=["debug"],this.range=[3,5]}projectTilePoint(r,o,c){const p=Qp(r,o,c);return mn(p,p,Jp(is(c))),{x:p[0],y:p[1],z:p[2]}}locationPoint(r,o){const c=wh(o.lat,o.lng),p=Di([],c),m=r.elevation?r.elevation.getAtPointOrZero(r.locationCoordinate(o),r._centerAltitude):r._centerAltitude;Zp(c,c,p,za(1,0)*Ot*m);const y=Da(new Float64Array(16));return ru(y,r.pixelMatrix,r.globeMatrix),mn(c,c,y),new xe(c[0],c[1])}pixelsPerMeter(r,o){return za(1,0)*o}pixelSpaceConversion(r,o,c){const p=za(1,r)*o,m=dr(za(1,45)*o,p,c);return this.pixelsPerMeter(r,o)/m}createTileMatrix(r,o,c){const p=Dx(is(c.canonical));return ru(new Float64Array(16),r.globeMatrix,p)}createInversionMatrix(r,o){const{center:c}=r,p=Jp(is(o));return G0(p,p,Fe(c.lng)),bx(p,p,Fe(c.lat)),nu(p,p,[r._pixelsPerMercatorPixel,r._pixelsPerMercatorPixel,1]),Float32Array.from(p)}pointCoordinate(r,o,c,p){return t2(r,o,c,!0)||new Sh(0,0)}pointCoordinate3D(r,o,c){const p=this.pointCoordinate(r,o,c,0);return[p.x,p.y,p.z]}isPointAboveHorizon(r,o){return!t2(r,o.x,o.y,!1)}farthestPixelDistance(r){const o=function(p,m){const y=p.cameraToCenterDistance,x=p._centerAltitude*m,E=p._camera,S=p._camera.forward(),k=Gs([],ko([],S,-y),[0,0,x]),M=p.worldSize/(2*Math.PI),O=[0,0,-M],$=p.width/p.height,G=Math.tan(p.fovAboveCenter),K=ko([],E.up(),G),ee=ko([],E.right(),G*$),le=Di([],Gs([],Gs([],S,K),ee)),me=[];let ce;if(new Tx(k,le).closestPointOnSphere(O,M,me)){const pe=Gs([],me,O),_e=Ma([],pe,k);ce=Math.cos(p.fovAboveCenter)*Gp(_e)}else{const pe=Ma([],k,O),_e=Ma([],O,k);Di(_e,_e);const ye=Gp(pe)-M;ce=Math.sqrt(ye*(ye+2*M));const Oe=Math.acos(ce/(M+ye))-Math.acos(ea(S,_e));ce*=Math.cos(Oe)}return 1.01*ce}(r,this.pixelsPerMeter(r.center.lat,r.worldSize)),c=Eh(r.zoom);if(c>0){const p=SI(r,za(1,r.center.lat)*r.worldSize),m=r.worldSize/(2*Math.PI),y=Math.max(r.width,r.height)/r.worldSize*Math.PI;return dr(o,p+m*(1-Math.cos(y)),Math.pow(c,10))}return o}upVector(r,o,c){return Qp(o,c,r,1)}upVectorScale(r){return{metersToTile:H0(Z0(is(r)))}}}function kI(i){const r=i.parallels,o=!!r&&Math.abs(r[0]+r[1])<.01;switch(i.name){case"mercator":return new TI(i);case"equirectangular":return new YF(i);case"naturalEarth":return new JF(i);case"equalEarth":return new XF(i);case"winkelTripel":return new eL(i);case"albers":return o?new CI(i):new KF(i);case"lambertConformalConic":return o?new CI(i):new QF(i);case"globe":return new tL(i)}throw new Error(`Invalid projection name: ${i.name}`)}const rL=ig.types,nL=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function _g(i,r,o,c,p,m,y,x,E,S,k,M,O){const $=x?Math.min(Bl,Math.round(x[0])):0,G=x?Math.min(Bl,Math.round(x[1])):0;i.emplaceBack(r,o,Math.round(32*c),Math.round(32*p),m,y,($<<1)+(E?1:0),G,16*S,16*k,256*M,256*O)}function vg(i,r,o,c,p,m,y){i.emplaceBack(r,o,c,p,m,y)}function xg(i,r,o,c,p){i.emplaceBack(r,o,c,p),i.emplaceBack(r,o,c,p),i.emplaceBack(r,o,c,p),i.emplaceBack(r,o,c,p)}function iL(i){for(const r of i.sections)if(gx(r.text))return!0;return!1}class l1{constructor(r){this.layoutVertexArray=new tt,this.indexArray=new Pt,this.programConfigurations=r,this.segments=new xn,this.dynamicLayoutVertexArray=new at,this.opacityVertexArray=new Mt,this.placedSymbolArray=new vn,this.globeExtVertexArray=new ht}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(r,o,c,p){this.isEmpty()||(c&&(this.layoutVertexBuffer=r.createVertexBuffer(this.layoutVertexArray,dF.members),this.indexBuffer=r.createIndexBuffer(this.indexArray,o),this.dynamicLayoutVertexBuffer=r.createVertexBuffer(this.dynamicLayoutVertexArray,fF.members,!0),this.opacityVertexBuffer=r.createVertexBuffer(this.opacityVertexArray,nL,!0),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=r.createVertexBuffer(this.globeExtVertexArray,pF.members,!0)),this.opacityVertexBuffer.itemSize=1),(c||p)&&this.programConfigurations.upload(r))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy())}}At(l1,"SymbolBuffers");class c1{constructor(r,o,c){this.layoutVertexArray=new r,this.layoutAttributes=o,this.indexArray=new c,this.segments=new xn,this.collisionVertexArray=new nr,this.collisionVertexArrayExt=new er}upload(r){this.layoutVertexBuffer=r.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=r.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=r.createVertexBuffer(this.collisionVertexArray,mF.members,!0),this.collisionVertexBufferExt=r.createVertexBuffer(this.collisionVertexArrayExt,gF.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.destroy())}}At(c1,"CollisionBuffers");class Ul{constructor(r){this.collisionBoxArray=r.collisionBoxArray,this.zoom=r.zoom,this.overscaling=r.overscaling,this.layers=r.layers,this.layerIds=this.layers.map(y=>y.id),this.index=r.index,this.pixelRatio=r.pixelRatio,this.sourceLayerIndex=r.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=Da([]),this.placementViewportMatrix=Da([]);const o=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Yx(this.zoom,o["text-size"]),this.iconSizeData=Yx(this.zoom,o["icon-size"]);const c=this.layers[0].layout,p=c.get("symbol-sort-key"),m=c.get("symbol-z-order");this.canOverlap=c.get("text-allow-overlap")||c.get("icon-allow-overlap")||c.get("text-ignore-placement")||c.get("icon-ignore-placement"),this.sortFeaturesByKey=m!=="viewport-y"&&p.constantOr(1)!==void 0,this.sortFeaturesByY=(m==="viewport-y"||m==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=c.get("text-writing-mode").map(y=>Do[y]),this.stateDependentLayerIds=this.layers.filter(y=>y.isStateDependent()).map(y=>y.id),this.sourceID=r.sourceID,this.projection=r.projection}createArrays(){this.text=new l1(new tu(this.layers,this.zoom,r=>/^text/.test(r))),this.icon=new l1(new tu(this.layers,this.zoom,r=>/^icon/.test(r))),this.glyphOffsetArray=new Pi,this.lineVertexArray=new yh,this.symbolInstances=new Zr}calculateGlyphDependencies(r,o,c,p,m){for(let y=0;y0)&&(E.value.kind!=="constant"||E.value.value.length>0),O=k.value.kind!=="constant"||!!k.value.value||Object.keys(k.parameters).length>0,$=y.get("symbol-sort-key");if(this.features=[],!M&&!O)return;const G=o.iconDependencies,K=o.glyphDependencies,ee=o.availableImages,le=new D(this.zoom);for(const{feature:me,id:ce,index:pe,sourceLayerIndex:_e}of r){const ye=m._featureFilter.needGeometry,Oe=su(me,ye);if(!m._featureFilter.filter(le,Oe,c))continue;if(ye||(Oe.geometry=Hs(me,c,p)),x&&me.type!==1&&c.z<=5){const Ue=Oe.geometry,Qe=.98078528056,Je=(ot,pt)=>ea(Qp(ot.x,ot.y,c,1),Qp(pt.x,pt.y,c,1))=0;for(const Je of Me.sections)if(Je.image)G[Je.image.name]=!0;else{const ot=Lp(Me.toString()),pt=Je.fontStack||Ue,We=K[pt]=K[pt]||{};this.calculateGlyphDependencies(Je.text,We,Qe,this.allowVerticalPlacement,ot)}}}y.get("symbol-placement")==="line"&&(this.features=function(me){const ce={},pe={},_e=[];let ye=0;function Oe(Ue){_e.push(me[Ue]),ye++}function Me(Ue,Qe,Je){const ot=pe[Ue];return delete pe[Ue],pe[Qe]=ot,_e[ot].geometry[0].pop(),_e[ot].geometry[0]=_e[ot].geometry[0].concat(Je[0]),ot}function He(Ue,Qe,Je){const ot=ce[Qe];return delete ce[Qe],ce[Ue]=ot,_e[ot].geometry[0].shift(),_e[ot].geometry[0]=Je[0].concat(_e[ot].geometry[0]),ot}function lt(Ue,Qe,Je){const ot=Je?Qe[0][Qe[0].length-1]:Qe[0][0];return`${Ue}:${ot.x}:${ot.y}`}for(let Ue=0;UeUe.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((me,ce)=>me.sortKey-ce.sortKey)}update(r,o,c,p){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(r,o,this.layers,c,p),this.icon.programConfigurations.updatePaintArrays(r,o,this.layers,c,p))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(r){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(r),this.iconCollisionBox.upload(r)),this.text.upload(r,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(r,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=kI(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(r,o){const c=this.lineVertexArray.length;if(r.segment!==void 0)for(const{x:p,y:m}of o)this.lineVertexArray.emplaceBack(p,m);return{lineStartIndex:c,lineLength:this.lineVertexArray.length-c}}addSymbols(r,o,c,p,m,y,x,E,S,k,M,O,$,G){const K=r.indexArray,ee=r.layoutVertexArray,le=r.globeExtVertexArray,me=r.segments.prepareSegment(4*o.length,ee,K,this.canOverlap?y.sortKey:void 0),ce=this.glyphOffsetArray.length,pe=me.vertexLength,_e=this.allowVerticalPlacement&&x===Do.vertical?Math.PI/2:0,ye=y.text&&y.text.sections;for(let Me=0;Me=0?o.rightJustifiedTextSymbolIndex:o.centerJustifiedTextSymbolIndex>=0?o.centerJustifiedTextSymbolIndex:o.leftJustifiedTextSymbolIndex>=0?o.leftJustifiedTextSymbolIndex:o.verticalPlacedTextSymbolIndex>=0?o.verticalPlacedTextSymbolIndex:p),y=lg(this.textSizeData,r,m)/ei;return this.tilePixelRatio*y}getSymbolInstanceIconSize(r,o,c){const p=this.icon.placedSymbolArray.get(c),m=lg(this.iconSizeData,r,p);return this.tilePixelRatio*m}_commitDebugCollisionVertexUpdate(r,o,c){r.emplaceBack(o,-c,-c),r.emplaceBack(o,c,-c),r.emplaceBack(o,c,c),r.emplaceBack(o,-c,c)}_updateTextDebugCollisionBoxes(r,o,c,p,m,y){for(let x=p;x0}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(r,o){const c=r.placedSymbolArray.get(o),p=c.vertexStartIndex+4*c.numGlyphs;for(let m=c.vertexStartIndex;mp[x]-p[E]||m[E]-m[x]),y}addToSortKeyRanges(r,o){const c=this.sortKeyRanges[this.sortKeyRanges.length-1];c&&c.sortKey===o?c.symbolInstanceEnd=r+1:this.sortKeyRanges.push({sortKey:o,symbolInstanceStart:r,symbolInstanceEnd:r+1})}sortFeatures(r){if(this.sortFeaturesByY&&this.sortedAngle!==r&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(r),this.sortedAngle=r,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const o of this.symbolInstanceIndexes){const c=this.symbolInstances.get(o);this.featureSortOrder.push(c.featureIndex);const{rightJustifiedTextSymbolIndex:p,centerJustifiedTextSymbolIndex:m,leftJustifiedTextSymbolIndex:y,verticalPlacedTextSymbolIndex:x,placedIconSymbolIndex:E,verticalPlacedIconSymbolIndex:S}=c;p>=0&&this.addIndicesForPlacedSymbol(this.text,p),m>=0&&m!==p&&this.addIndicesForPlacedSymbol(this.text,m),y>=0&&y!==m&&y!==p&&this.addIndicesForPlacedSymbol(this.text,y),x>=0&&this.addIndicesForPlacedSymbol(this.text,x),E>=0&&this.addIndicesForPlacedSymbol(this.icon,E),S>=0&&this.addIndicesForPlacedSymbol(this.icon,S)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}At(Ul,"SymbolBucket",{omit:["layers","collisionBoxArray","features","compareText"]}),Ul.MAX_GLYPHS=65535,Ul.addDynamicAttributes=xg;const oL=new he({"symbol-placement":new Z(Ge.layout_symbol["symbol-placement"]),"symbol-spacing":new Z(Ge.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Z(Ge.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new re(Ge.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Z(Ge.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Z(Ge.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new Z(Ge.layout_symbol["icon-ignore-placement"]),"icon-optional":new Z(Ge.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Z(Ge.layout_symbol["icon-rotation-alignment"]),"icon-size":new re(Ge.layout_symbol["icon-size"]),"icon-text-fit":new Z(Ge.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Z(Ge.layout_symbol["icon-text-fit-padding"]),"icon-image":new re(Ge.layout_symbol["icon-image"]),"icon-rotate":new re(Ge.layout_symbol["icon-rotate"]),"icon-padding":new Z(Ge.layout_symbol["icon-padding"]),"icon-keep-upright":new Z(Ge.layout_symbol["icon-keep-upright"]),"icon-offset":new re(Ge.layout_symbol["icon-offset"]),"icon-anchor":new re(Ge.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Z(Ge.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Z(Ge.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Z(Ge.layout_symbol["text-rotation-alignment"]),"text-field":new re(Ge.layout_symbol["text-field"]),"text-font":new re(Ge.layout_symbol["text-font"]),"text-size":new re(Ge.layout_symbol["text-size"]),"text-max-width":new re(Ge.layout_symbol["text-max-width"]),"text-line-height":new re(Ge.layout_symbol["text-line-height"]),"text-letter-spacing":new re(Ge.layout_symbol["text-letter-spacing"]),"text-justify":new re(Ge.layout_symbol["text-justify"]),"text-radial-offset":new re(Ge.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Z(Ge.layout_symbol["text-variable-anchor"]),"text-anchor":new re(Ge.layout_symbol["text-anchor"]),"text-max-angle":new Z(Ge.layout_symbol["text-max-angle"]),"text-writing-mode":new Z(Ge.layout_symbol["text-writing-mode"]),"text-rotate":new re(Ge.layout_symbol["text-rotate"]),"text-padding":new Z(Ge.layout_symbol["text-padding"]),"text-keep-upright":new Z(Ge.layout_symbol["text-keep-upright"]),"text-transform":new re(Ge.layout_symbol["text-transform"]),"text-offset":new re(Ge.layout_symbol["text-offset"]),"text-allow-overlap":new Z(Ge.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new Z(Ge.layout_symbol["text-ignore-placement"]),"text-optional":new Z(Ge.layout_symbol["text-optional"])});var u1={paint:new he({"icon-opacity":new re(Ge.paint_symbol["icon-opacity"]),"icon-color":new re(Ge.paint_symbol["icon-color"]),"icon-halo-color":new re(Ge.paint_symbol["icon-halo-color"]),"icon-halo-width":new re(Ge.paint_symbol["icon-halo-width"]),"icon-halo-blur":new re(Ge.paint_symbol["icon-halo-blur"]),"icon-translate":new Z(Ge.paint_symbol["icon-translate"]),"icon-translate-anchor":new Z(Ge.paint_symbol["icon-translate-anchor"]),"text-opacity":new re(Ge.paint_symbol["text-opacity"]),"text-color":new re(Ge.paint_symbol["text-color"],{runtimeType:qi,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new re(Ge.paint_symbol["text-halo-color"]),"text-halo-width":new re(Ge.paint_symbol["text-halo-width"]),"text-halo-blur":new re(Ge.paint_symbol["text-halo-blur"]),"text-translate":new Z(Ge.paint_symbol["text-translate"]),"text-translate-anchor":new Z(Ge.paint_symbol["text-translate-anchor"])}),layout:oL};class PI{constructor(r){this.type=r.property.overrides?r.property.overrides.runtimeType:gl,this.defaultValue=r}evaluate(r){if(r.formattedSection){const o=this.defaultValue.property.overrides;if(o&&o.hasOverride(r.formattedSection))return o.getOverride(r.formattedSection)}return r.feature&&r.featureState?this.defaultValue.evaluate(r.feature,r.featureState):this.defaultValue.property.specification.default}eachChild(r){this.defaultValue.isConstant()||r(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}At(PI,"FormatSectionOverride",{omit:["defaultValue"]});class bg extends Pa{constructor(r){super(r,u1)}recalculate(r,o){super.recalculate(r,o),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")),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment"));const c=this.layout.get("text-writing-mode");if(c){const p=[];for(const m of c)p.indexOf(m)<0&&p.push(m);this.layout._values["text-writing-mode"]=p}else this.layout._values["text-writing-mode"]=this.layout.get("symbol-placement")==="point"?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getValueAndResolveTokens(r,o,c,p){const m=this.layout.get(r).evaluate(o,{},c,p),y=this._unevaluatedLayout._values[r];return y.isDataDriven()||Cl(y.value)||!m?m:function(x,E){return E.replace(/{([^{}]+)}/g,(S,k)=>k in x?String(x[k]):"")}(o.properties,m)}createBucket(r){return new Ul(r)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const r of u1.paint.overridableProperties){if(!bg.hasPaintOverride(this.layout,r))continue;const o=this.paint.get(r),c=new PI(o),p=new ch(c,o.property.specification);let m=null;m=o.value.kind==="constant"||o.value.kind==="source"?new Ap("source",p):new Hc("composite",p,o.value.zoomStops,o.value._interpolationType),this.paint._values[r]=new ie(o.property,m,o.parameters)}}_handleOverridablePaintPropertyUpdate(r,o,c){return!(!this.layout||o.isDataDriven()||c.isDataDriven())&&bg.hasPaintOverride(this.layout,r)}static hasPaintOverride(r,o){const c=r.get("text-field"),p=u1.paint.properties[o];let m=!1;const y=x=>{for(const E of x)if(p.overrides&&p.overrides.hasOverride(E))return void(m=!0)};if(c.value.kind==="constant"&&c.value.value instanceof ki)y(c.value.value.sections);else if(c.value.kind==="source"){const x=S=>{m||(S instanceof Rs&&ln(S.value)===kc?y(S.value.sections):S instanceof es?y(S.sections):S.eachChild(x))},E=c.value;E._styleExpression&&x(E._styleExpression.expression)}return m}getProgramConfiguration(r){return new Ol(this,r)}}var aL={paint:new he({"background-color":new Z(Ge.paint_background["background-color"]),"background-pattern":new Z(Ge.paint_background["background-pattern"]),"background-opacity":new Z(Ge.paint_background["background-opacity"])})},sL={paint:new he({"raster-opacity":new Z(Ge.paint_raster["raster-opacity"]),"raster-hue-rotate":new Z(Ge.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Z(Ge.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Z(Ge.paint_raster["raster-brightness-max"]),"raster-saturation":new Z(Ge.paint_raster["raster-saturation"]),"raster-contrast":new Z(Ge.paint_raster["raster-contrast"]),"raster-resampling":new Z(Ge.paint_raster["raster-resampling"]),"raster-fade-duration":new Z(Ge.paint_raster["raster-fade-duration"])})};class lL extends Pa{constructor(r){super(r,{}),this.implementation=r}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}isLayerDraped(){return this.implementation.renderToTile!==void 0}shouldRedrape(){return!!this.implementation.shouldRerenderTiles&&this.implementation.shouldRerenderTiles()}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){}onAdd(r){this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)}onRemove(r){this.implementation.onRemove&&this.implementation.onRemove(r,r.painter.context.gl)}}var cL={paint:new he({"sky-type":new Z(Ge.paint_sky["sky-type"]),"sky-atmosphere-sun":new Z(Ge.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new Z(Ge.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new Z(Ge.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new Z(Ge.paint_sky["sky-gradient-radius"]),"sky-gradient":new ue(Ge.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new Z(Ge.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new Z(Ge.paint_sky["sky-atmosphere-color"]),"sky-opacity":new Z(Ge.paint_sky["sky-opacity"])})};function h1(i,r,o){const c=[0,0,1],p=KA([]);return YA(p,p,o?-Fe(i)+Math.PI:Fe(i)),XA(p,p,-Fe(r)),GA(c,c,p),Di(c,c)}const uL={circle:class extends Pa{constructor(i){super(i,b5)}createBucket(i){return new Lx(i)}queryRadius(i){const r=i;return Th("circle-radius",this,r)+Th("circle-stroke-width",this,r)+Y0(this.paint.get("circle-translate"))}queryIntersectsFeature(i,r,o,c,p,m,y,x){const E=v2(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),m.angle,i.pixelToTileUnitsFactor),S=this.paint.get("circle-radius").evaluate(r,o)+this.paint.get("circle-stroke-width").evaluate(r,o);return x2(i,c,m,y,x,this.paint.get("circle-pitch-alignment")==="map",this.paint.get("circle-pitch-scale")==="map",E,S)}getProgramIds(){return["circle"]}getProgramConfiguration(i){return new Ol(this,i)}},heatmap:class extends Pa{createBucket(i){return new w2(i)}constructor(i){super(i,T5),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(i){i==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=jx({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(i){return Th("heatmap-radius",this,i)}queryIntersectsFeature(i,r,o,c,p,m,y,x){const E=this.paint.get("heatmap-radius").evaluate(r,o);return x2(i,c,m,y,x,!0,!0,new xe(0,0),E)}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}getProgramIds(){return["heatmap","heatmapTexture"]}getProgramConfiguration(i){return new Ol(this,i)}},hillshade:class extends Pa{constructor(i){super(i,A5)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}getProgramIds(){return["hillshade","hillshadePrepare"]}},fill:class extends Pa{constructor(i){super(i,V5)}getProgramIds(){const i=this.paint.get("fill-pattern"),r=i&&i.constantOr(1),o=[r?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&o.push(r&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),o}getProgramConfiguration(i){return new Ol(this,i)}recalculate(i,r){super.recalculate(i,r);const o=this.paint._values["fill-outline-color"];o.value.kind==="constant"&&o.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(i){return new rg(i)}queryRadius(){return Y0(this.paint.get("fill-translate"))}queryIntersectsFeature(i,r,o,c,p,m){return!i.queryGeometry.isAboveHorizon&&f2(_2(i.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),m.angle,i.pixelToTileUnitsFactor),c)}isTileClipped(){return!0}},"fill-extrusion":class extends Pa{constructor(i){super(i,iF)}createBucket(i){return new lf(i)}queryRadius(){return Y0(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}getProgramIds(){return[this.paint.get("fill-extrusion-pattern").constantOr(1)?"fillExtrusionPattern":"fillExtrusion"]}getProgramConfiguration(i){return new Ol(this,i)}queryIntersectsFeature(i,r,o,c,p,m,y,x,E){const S=v2(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),m.angle,i.pixelToTileUnitsFactor),k=this.paint.get("fill-extrusion-height").evaluate(r,o),M=this.paint.get("fill-extrusion-base").evaluate(r,o),O=[0,0],$=x&&m.elevation,G=m.elevation?m.elevation.exaggeration():1,K=i.tile.getBucket(this);if($&&K instanceof lf){const pe=K.centroidVertexArray,_e=E+1;_epe.polygon).flat());const ee=$?x:null,[le,me]=function(pe,_e,ye,Oe,Me,He,lt,Ue,Qe,Je,ot){return pe.projection.name==="globe"?function(pt,We,_t,Ct,vt,Gt,ft,zt,Ht,fr,qt){const Bt=[],Hr=[],Zt=pt.projection.upVectorScale(qt,pt.center.lat,pt.worldSize).metersToTile,Kt=[0,0,0,1],Lr=[0,0,0,1],Vr=(Br,tn,cn,wn)=>{Br[0]=tn,Br[1]=cn,Br[2]=wn,Br[3]=1},$r=N2();_t>0&&(_t+=$r),Ct+=$r;for(const Br of We){const tn=[],cn=[];for(const wn of Br){const Nr=wn.x+vt.x,Rn=wn.y+vt.y,En=pt.projection.projectTilePoint(Nr,Rn,qt),nn=pt.projection.upVector(qt,wn.x,wn.y);let yr=_t,Sn=Ct;if(ft){const Wr=W2(Nr,Rn,_t,Ct,ft,zt,Ht,fr);yr+=Wr.base,Sn+=Wr.top}_t!==0?Vr(Kt,En.x+nn[0]*Zt*yr,En.y+nn[1]*Zt*yr,En.z+nn[2]*Zt*yr):Vr(Kt,En.x,En.y,En.z),Vr(Lr,En.x+nn[0]*Zt*Sn,En.y+nn[1]*Zt*Sn,En.z+nn[2]*Zt*Sn),mn(Kt,Kt,Gt),mn(Lr,Lr,Gt),tn.push(new Ch(Kt[0],Kt[1],Kt[2])),cn.push(new Ch(Lr[0],Lr[1],Lr[2]))}Bt.push(tn),Hr.push(cn)}return[Bt,Hr]}(pe,_e,ye,Oe,Me,He,lt,Ue,Qe,Je,ot):lt?function(pt,We,_t,Ct,vt,Gt,ft,zt,Ht){const fr=[],qt=[],Bt=[0,0,0,1];for(const Hr of pt){const Zt=[],Kt=[];for(const Lr of Hr){const Vr=Lr.x+Ct.x,$r=Lr.y+Ct.y,Br=W2(Vr,$r,We,_t,Gt,ft,zt,Ht);Bt[0]=Vr,Bt[1]=$r,Bt[2]=Br.base,Bt[3]=1,iu(Bt,Bt,vt),Bt[3]=Math.max(Bt[3],1e-5);const tn=new Ch(Bt[0]/Bt[3],Bt[1]/Bt[3],Bt[2]/Bt[3]);Bt[0]=Vr,Bt[1]=$r,Bt[2]=Br.top,Bt[3]=1,iu(Bt,Bt,vt),Bt[3]=Math.max(Bt[3],1e-5);const cn=new Ch(Bt[0]/Bt[3],Bt[1]/Bt[3],Bt[2]/Bt[3]);Zt.push(tn),Kt.push(cn)}fr.push(Zt),qt.push(Kt)}return[fr,qt]}(_e,ye,Oe,Me,He,lt,Ue,Qe,Je):function(pt,We,_t,Ct,vt){const Gt=[],ft=[],zt=vt[8]*We,Ht=vt[9]*We,fr=vt[10]*We,qt=vt[11]*We,Bt=vt[8]*_t,Hr=vt[9]*_t,Zt=vt[10]*_t,Kt=vt[11]*_t;for(const Lr of pt){const Vr=[],$r=[];for(const Br of Lr){const tn=Br.x+Ct.x,cn=Br.y+Ct.y,wn=vt[0]*tn+vt[4]*cn+vt[12],Nr=vt[1]*tn+vt[5]*cn+vt[13],Rn=vt[2]*tn+vt[6]*cn+vt[14],En=vt[3]*tn+vt[7]*cn+vt[15],nn=wn+zt,yr=Nr+Ht,Sn=Rn+fr,Wr=Math.max(En+qt,1e-5),Ri=wn+Bt,Tn=Nr+Hr,ti=Rn+Zt,Hn=Math.max(En+Kt,1e-5);Vr.push(new Ch(nn/Wr,yr/Wr,Sn/Wr)),$r.push(new Ch(Ri/Hn,Tn/Hn,ti/Hn))}Gt.push(Vr),ft.push($r)}return[Gt,ft]}(_e,ye,Oe,Me,He)}(m,c,M,k,S,y,ee,O,G,m.center.lat,i.tileID.canonical),ce=i.queryGeometry;return function(pe,_e,ye){let Oe=1/0;f2(ye,_e)&&(Oe=$2(ye,_e[0]));for(let Me=0;Me<_e.length;Me++){const He=_e[Me],lt=pe[Me];for(let Ue=0;Ue=3){for(let G=0;G<$.length;G++)if(lu(S,$[G]))return!0}if(y5(S,$,M))return!0}return!1}(y,c,x)}isTileClipped(){return!0}},symbol:bg,background:class extends Pa{constructor(i){super(i,aL)}getProgramIds(){return[this.paint.get("background-pattern")?"backgroundPattern":"background"]}},raster:class extends Pa{constructor(i){super(i,sL)}getProgramIds(){return["raster"]}},sky:class extends Pa{constructor(i){super(i,cL),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(i){i==="sky-gradient"?this._updateColorRamp():i!=="sky-atmosphere-sun"&&i!=="sky-atmosphere-halo-color"&&i!=="sky-atmosphere-color"&&i!=="sky-atmosphere-sun-intensity"||(this._skyboxInvalidated=!0)}_updateColorRamp(){this.colorRamp=jx({expression:this._transitionablePaint._values["sky-gradient"].value.expression,evaluationKey:"skyRadialProgress"}),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}needsSkyboxCapture(i){if(this._skyboxInvalidated||!this.skyboxTexture||!this.skyboxGeometry)return!0;if(!this.paint.get("sky-atmosphere-sun")){const r=i.style.light.properties.get("position");return this._lightPosition.azimuthal!==r.azimuthal||this._lightPosition.polar!==r.polar}return!1}getCenter(i,r){if(this.paint.get("sky-type")==="atmosphere"){const c=this.paint.get("sky-atmosphere-sun"),p=!c,m=i.style.light,y=m.properties.get("position");return p&&m.properties.get("anchor")==="viewport"&&Tr("The sun direction is attached to a light with viewport anchor, lighting may behave unexpectedly."),p?h1(y.azimuthal,90-y.polar,r):h1(c[0],90-c[1],r)}const o=this.paint.get("sky-gradient-center");return h1(o[0],90-o[1],r)}is3D(){return!1}isSky(){return!0}markSkyboxValid(i){this._skyboxInvalidated=!1,this._lightPosition=i.style.light.properties.get("position")}hasOffscreenPass(){return!0}getProgramIds(){const i=this.paint.get("sky-type");return i==="atmosphere"?["skyboxCapture","skybox"]:i==="gradient"?["skyboxGradient"]:null}}};class vf{constructor(r,o,c,p){this.context=r,this.format=c,this.texture=r.gl.createTexture(),this.update(o,p)}update(r,o,c){const{width:p,height:m}=r,{context:y}=this,{gl:x}=y,{HTMLImageElement:E,HTMLCanvasElement:S,HTMLVideoElement:k,ImageData:M,ImageBitmap:O}=w;if(x.bindTexture(x.TEXTURE_2D,this.texture),y.pixelStoreUnpackFlipY.set(!1),y.pixelStoreUnpack.set(1),y.pixelStoreUnpackPremultiplyAlpha.set(this.format===x.RGBA&&(!o||o.premultiply!==!1)),c||this.size&&this.size[0]===p&&this.size[1]===m){const{x:$,y:G}=c||{x:0,y:0};r instanceof E||r instanceof S||r instanceof k||r instanceof M||O&&r instanceof O?x.texSubImage2D(x.TEXTURE_2D,0,$,G,x.RGBA,x.UNSIGNED_BYTE,r):x.texSubImage2D(x.TEXTURE_2D,0,$,G,p,m,x.RGBA,x.UNSIGNED_BYTE,r.data)}else this.size=[p,m],r instanceof E||r instanceof S||r instanceof k||r instanceof M||O&&r instanceof O?x.texImage2D(x.TEXTURE_2D,0,this.format,this.format,x.UNSIGNED_BYTE,r):x.texImage2D(x.TEXTURE_2D,0,this.format,p,m,0,this.format,x.UNSIGNED_BYTE,r.data);this.useMipmap=!!(o&&o.useMipmap&&this.isSizePowerOfTwo()),this.useMipmap&&x.generateMipmap(x.TEXTURE_2D)}bind(r,o){const{context:c}=this,{gl:p}=c;p.bindTexture(p.TEXTURE_2D,this.texture),r!==this.filter&&(p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MAG_FILTER,r),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MIN_FILTER,this.useMipmap?r===p.NEAREST?p.NEAREST_MIPMAP_NEAREST:p.LINEAR_MIPMAP_NEAREST:r),this.filter=r),o!==this.wrap&&(p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_S,o),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_T,o),this.wrap=o)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:r}=this.context;r.deleteTexture(this.texture),this.texture=null}}class hL{constructor(r){this._callback=r,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){this._channel=void 0,this._callback=()=>{}}}class dL{constructor(){this.tasks={},this.taskQueue=[],si(["process"],this),this.invoker=new hL(this.process),this.nextId=0}add(r,o){const c=this.nextId++,p=function({type:m,isSymbolTile:y,zoom:x}){return x=x||0,m==="message"?0:m!=="maybePrepare"||y?m!=="parseTile"||y?m==="parseTile"&&y?300-x:m==="maybePrepare"&&y?400-x:500:200-x:100-x}(o);if(p===0){yi();try{r()}finally{}return{cancel:()=>{}}}return this.tasks[c]={fn:r,metadata:o,priority:p,id:c},this.taskQueue.push(c),this.invoker.trigger(),{cancel:()=>{delete this.tasks[c]}}}process(){yi();try{if(this.taskQueue=this.taskQueue.filter(c=>!!this.tasks[c]),!this.taskQueue.length)return;const r=this.pick();if(r===null)return;const o=this.tasks[r];if(delete this.tasks[r],this.taskQueue.length&&this.invoker.trigger(),!o)return;o.fn()}finally{}}pick(){let r=null,o=1/0;for(let p=0;p>=1)>1;){const S=o+p>>1,k=c+m>>1;1&r?(p=o,m=c,o=y,c=x):(o=p,c=m,p=y,m=x),y=S,x=k}const E=4*i;jl[E+0]=o,jl[E+1]=c,jl[E+2]=p,jl[E+3]=m}const ls=new Uint16Array(2178),Vl=new Uint8Array(1089),wg=new Uint16Array(1089);function zI(i){return i===0?-.03125:i===32?.03125:0}var RI=Ie([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);const OI={type:2,extent:Ot,loadGeometry:()=>[[new xe(0,0),new xe(Ot+1,0),new xe(Ot+1,Ot+1),new xe(0,Ot+1),new xe(0,0)]]};class d1{constructor(r,o,c,p,m){this.tileID=r,this.uid=ur(),this.uses=0,this.tileSize=o,this.tileZoom=c,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=m,this.expiredRequestCount=0,this.state="loading",p&&p.transform&&(this.projection=p.transform.projection)}registerFadeDuration(r){const o=r+this.timeAdded;o<_a.now()||this.fadeEndTime&&om.getLayer(S)).filter(Boolean);if(E.length!==0){x.layers=E,x.stateDependentLayerIds&&(x.stateDependentLayers=x.stateDependentLayerIds.map(S=>E.filter(k=>k.id===S)[0]));for(const S of E)y[S.id]=x}}return y}(r.buckets,o.style),this.hasSymbolBuckets=!1;for(const p in this.buckets){const m=this.buckets[p];if(m instanceof Ul){if(this.hasSymbolBuckets=!0,!c)break;m.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const p in this.buckets){const m=this.buckets[p];if(m instanceof Ul&&m.hasRTLText){this.hasRTLText=!0,I.isLoading()||I.isLoaded()||b()!=="deferred"||A();break}}this.queryPadding=0;for(const p in this.buckets){const m=this.buckets[p];this.queryPadding=Math.max(this.queryPadding,o.style.getLayer(p).queryRadius(m))}r.imageAtlas&&(this.imageAtlas=r.imageAtlas),r.glyphAtlasImage&&(this.glyphAtlasImage=r.glyphAtlasImage),r.lineAtlas&&(this.lineAtlas=r.lineAtlas)}else this.collisionBoxArray=new Or}unloadVectorData(){if(this.hasData()){for(const r in this.buckets)this.buckets[r].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.lineAtlasTexture&&this.lineAtlasTexture.destroy(),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),this.latestFeatureIndex=null,this.state="unloaded"}}getBucket(r){return this.buckets[r.id]}upload(r){for(const c in this.buckets){const p=this.buckets[c];p.uploadPending()&&p.upload(r)}const o=r.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new vf(r,this.imageAtlas.image,o.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new vf(r,this.glyphAtlasImage,o.ALPHA),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new vf(r,this.lineAtlas.image,o.ALPHA),this.lineAtlas.uploaded=!0)}prepare(r){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(r,this.imageAtlasTexture)}queryRenderedFeatures(r,o,c,p,m,y,x,E){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({tileResult:p,pixelPosMatrix:x,transform:y,params:m,tileTransform:this.tileTransform},r,o,c):{}}querySourceFeatures(r,o){const c=this.latestFeatureIndex;if(!c||!c.rawTileData)return;const p=c.loadVTLayers(),m=o?o.sourceLayer:"",y=p._geojsonTileLayer||p[m];if(!y)return;const x=ph(o&&o.filter),{z:E,x:S,y:k}=this.tileID.canonical,M={z:E,x:S,y:k};for(let O=0;Oc)p=!1;else if(o)if(this.expirationTime=0;ee--){const le=4*ee,me=jl[le+0],ce=jl[le+1],pe=jl[le+2],_e=jl[le+3],ye=me+pe>>1,Oe=ce+_e>>1,Me=ye+Oe-ce,He=Oe+me-ye,lt=ce*ss+me,Ue=_e*ss+pe,Qe=Oe*ss+ye,Je=Math.hypot((ls[2*lt+0]+ls[2*Ue+0])/2-ls[2*Qe+0],(ls[2*lt+1]+ls[2*Ue+1])/2-ls[2*Qe+1])>=16;Vl[Qe]=Vl[Qe]||(Je?1:0),ee<1022&&(Vl[Qe]=Vl[Qe]||Vl[(ce+He>>1)*ss+(me+Me>>1)]||Vl[(_e+He>>1)*ss+(pe+Me>>1)])}const M=new Ke,O=new Pt;let $=0;function G(ee,le){const me=le*ss+ee;return wg[me]===0&&(M.emplaceBack(ls[2*me+0],ls[2*me+1],ee*Ot/na,le*Ot/na),wg[me]=++$),wg[me]-1}function K(ee,le,me,ce,pe,_e){const ye=ee+me>>1,Oe=le+ce>>1;if(Math.abs(ee-pe)+Math.abs(le-_e)>1&&Vl[Oe*ss+ye])K(pe,_e,ee,le,ye,Oe),K(me,ce,pe,_e,ye,Oe);else{const Me=G(ee,le),He=G(me,ce),lt=G(pe,_e);O.emplaceBack(Me,He,lt)}}return K(0,0,na,na,na,0),K(na,na,0,0,0,na),{vertices:M,indices:O}}(this.tileID.canonical,o);p=y.vertices,m=y.indices}else{p=new Ke,m=new Pt;for(const{x,y:E}of c)p.emplaceBack(x,E,0,0);const y=Hx(p.int16,void 0,4);for(let x=0;x0&&(x=xx(new Float64Array(16),o.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(r,p,o,m,x,y),this._makeGlobeTileDebugTextBuffer(r,p,o,m,x,y)}_globePoint(r,o,c,p,m,y,x){let E=Qp(r,o,c);if(y){const S=1<.5?$=-1:O<-.5&&($=1);let G=(r/Ot+c.x)/S+$,K=(o/Ot+c.y)/S;G=(G-k)*p._pixelsPerMercatorPixel+k,K=(K-M)*p._pixelsPerMercatorPixel+M;const ee=[G*p.worldSize,K*p.worldSize,0];mn(ee,ee,y),E=au(E,ee,x)}return mn(E,E,m)}_makeGlobeTileDebugBorderBuffer(r,o,c,p,m,y){const x=new st,E=new ao,S=new De,k=(O,$,G,K,ee)=>{const le=(G-O)/(ee-1),me=(K-$)/(ee-1),ce=x.length;for(let pe=0;peM*$+G;for(let $=0;$r[y])return null}else{const x=1/c[y];let E=(i[y]-o[y])*x,S=(r[y]-o[y])*x;if(E>S){const k=E;E=S,S=k}if(E>p&&(p=E),Sm)return null}return p}function BI(i,r,o,c,p,m,y,x,E,S,k){const M=c-i,O=p-r,$=m-o,G=y-i,K=x-r,ee=E-o,le=k[1]*ee-k[2]*K,me=k[2]*G-k[0]*ee,ce=k[0]*K-k[1]*G,pe=M*le+O*me+$*ce;if(Math.abs(pe)<1e-15)return null;const _e=1/pe,ye=S[0]-i,Oe=S[1]-r,Me=S[2]-o,He=(ye*le+Oe*me+Me*ce)*_e;if(He<0||He>1)return null;const lt=Oe*$-Me*O,Ue=Me*M-ye*$,Qe=ye*O-Oe*M,Je=(k[0]*lt+k[1]*Ue+k[2]*Qe)*_e;return Je<0||He+Je>1?null:(G*lt+K*Ue+ee*Qe)*_e}function NI(i,r,o){return(i-r)/(o-r)}function UI(i,r,o,c,p,m,y,x,E){const S=1<{const me=ee?1:0,ce=($+1)*K-me,pe=G*K,_e=(G+1)*K-me;le[0]=$*K,le[1]=pe,le[2]=ce,le[3]=_e};let M=new FI(E);const O=[];for(let $=0;$=1;E/=2){const $=x[x.length-1];M=new FI(E);for(let G=0;G0;){const{idx:G,t:K,nodex:ee,nodey:le,depth:me}=$.pop();if(this.leaves[G]){UI(ee,le,me,r,o,c,p,M,O);const pe=1<=We[2])return K}continue}let ce=0;for(let pe=0;pe=S[k[Me]]&&(k.splice(Me,0,pe),Oe=!0);Oe||(k[ce]=pe),ce++}}for(let pe=0;pe=this.dim+1||o<-1||o>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(o+1)*this.stride+(r+1)}static pack(r,o){const c=[0,0,0,0],p=Eg.getUnpackVector(o);let m=Math.floor((r+p[3])/p[2]);return c[2]=m%256,m=Math.floor(m/256),c[1]=m%256,m=Math.floor(m/256),c[0]=m,c}getPixels(){return new lo({width:this.stride,height:this.stride},this.pixels)}backfillBorder(r,o,c){if(this.dim!==r.dim)throw new Error("dem dimension mismatch");let p=o*this.dim,m=o*this.dim+this.dim,y=c*this.dim,x=c*this.dim+this.dim;switch(o){case-1:p=m-1;break;case 1:m=p+1}switch(c){case-1:y=x-1;break;case 1:x=y+1}const E=-o*this.dim,S=-c*this.dim;for(let k=y;k{this.remove(r,m)},c)),this.data[p].push(m),this.order.push(p),this.order.length>this.max){const y=this._getAndRemoveByKey(this.order[0]);y&&this.onRemove(y)}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 o=this.data[r].shift();return o.timeout&&clearTimeout(o.timeout),this.data[r].length===0&&delete this.data[r],this.order.splice(this.order.indexOf(r),1),o.value}getByKey(r){const o=this.data[r];return o?o[0].value:null}get(r){return this.has(r)?this.data[r.wrapped().key][0].value:null}remove(r,o){if(!this.has(r))return this;const c=r.wrapped().key,p=o===void 0?0:this.data[c].indexOf(o),m=this.data[c][p];return this.data[c].splice(p,1),m.timeout&&clearTimeout(m.timeout),this.data[c].length===0&&delete this.data[c],this.onRemove(m.value),this.order.splice(this.order.indexOf(c),1),this}setMaxSize(r){for(this.max=r;this.order.length>this.max;){const o=this._getAndRemoveByKey(this.order[0]);o&&this.onRemove(o)}return this}filter(r){const o=[];for(const c in this.data)for(const p of this.data[c])r(p.value)||o.push(p);for(const c of o)this.remove(c.value.tileID,c)}}class Bh{constructor(r,o,c){this.func=r,this.mask=o,this.range=c}}Bh.ReadOnly=!1,Bh.ReadWrite=!0,Bh.disabled=new Bh(519,Bh.ReadOnly,[0,1]);const p1=7680;class f1{constructor(r,o,c,p,m,y){this.test=r,this.ref=o,this.mask=c,this.fail=p,this.depthFail=m,this.pass=y}}f1.disabled=new f1({func:519,mask:0},0,0,p1,p1,p1);class cs{constructor(r,o,c){this.blendFunction=r,this.blendColor=o,this.mask=c}}cs.Replace=[1,0],cs.disabled=new cs(cs.Replace,fn.transparent,[!1,!1,!1,!1]),cs.unblended=new cs(cs.Replace,fn.transparent,[!0,!0,!0,!0]),cs.alphaBlended=new cs([1,771],fn.transparent,[!0,!0,!0,!0]);const m1=1029,g1=2305;class Fa{constructor(r,o,c){this.enable=r,this.mode=o,this.frontFace=c}}Fa.disabled=new Fa(!1,m1,g1),Fa.backCCW=new Fa(!0,m1,g1),Fa.backCW=new Fa(!0,m1,2304),Fa.frontCW=new Fa(!0,1028,2304),Fa.frontCCW=new Fa(!0,1028,g1);class hu extends Cc{constructor(r,o,c){super(),this.id=r,this._onlySymbols=c,o.on("data",p=>{p.dataType==="source"&&p.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&p.dataType==="source"&&p.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform))}),o.on("error",()=>{this._sourceErrored=!0}),this._source=o,this._tiles={},this._cache=new yL(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._minTileCacheSize=o.minTileCacheSize,this._maxTileCacheSize=o.maxTileCacheSize,this._loadedParentTiles={},this._coveredTiles={},this._state=new fL,this._isRaster=this._source.type==="raster"||this._source.type==="raster-dem"||this._source.type==="custom"&&this._source._dataType==="raster"}onAdd(r){this.map=r,this._minTileCacheSize=this._minTileCacheSize===void 0&&r?r._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=this._maxTileCacheSize===void 0&&r?r._maxTileCacheSize:this._maxTileCacheSize}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(const r in this._tiles){const o=this._tiles[r];if(o.state!=="loaded"&&o.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const r=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,r&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(r,o){return r.isSymbolTile=this._onlySymbols,this._source.loadTile(r,o)}_unloadTile(r){if(this._source.unloadTile)return this._source.unloadTile(r,()=>{})}_abortTile(r){if(this._source.abortTile)return this._source.abortTile(r,()=>{})}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 o in this._tiles){const c=this._tiles[o];c.upload(r),c.prepare(this.map.style.imageManager)}}getIds(){return et(this._tiles).map(r=>r.tileID).sort(WI).map(r=>r.key)}getRenderableIds(r){const o=[];for(const c in this._tiles)this._isIdRenderable(+c,r)&&o.push(this._tiles[c]);return r?o.sort((c,p)=>{const m=c.tileID,y=p.tileID,x=new xe(m.canonical.x,m.canonical.y)._rotate(this.transform.angle),E=new xe(y.canonical.x,y.canonical.y)._rotate(this.transform.angle);return m.overscaledZ-y.overscaledZ||E.y-x.y||E.x-x.x}).map(c=>c.tileID.key):o.map(c=>c.tileID).sort(WI).map(c=>c.key)}hasRenderableParent(r){const o=this.findLoadedParent(r,0);return!!o&&this._isIdRenderable(o.tileID.key)}_isIdRenderable(r,o){return this._tiles[r]&&this._tiles[r].hasData()&&!this._coveredTiles[r]&&(o||!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,o){const c=this._tiles[r];c&&(c.state!=="loading"&&(c.state=o),this._loadTile(c,this._tileLoaded.bind(this,c,r,o)))}_tileLoaded(r,o,c,p){if(p)if(r.state="errored",p.status!==404)this._source.fire(new va(p,{tile:r}));else if(this._source.type==="raster-dem"&&this.usedForTerrain&&this.map.painter.terrain){const m=this.map.painter.terrain;this.update(this.transform,m.getScaledDemTileSize(),!0),m.resetTileLookupCache(this.id)}else this.update(this.transform);else r.timeAdded=_a.now(),c==="expired"&&(r.refreshedUponExpiration=!0),this._setTileReloadTimer(o,r),this._source.type==="raster-dem"&&r.dem&&this._backfillDEM(r),this._state.initializeTileState(r,this.map?this.map.painter:null),this._source.fire(new Ms("data",{dataType:"source",tile:r,coord:r.tileID,sourceCacheId:this.id}))}_backfillDEM(r){const o=this.getRenderableIds();for(let p=0;p1||(Math.abs(y)>1&&(Math.abs(y+E)===1?y+=E:Math.abs(y-E)===1&&(y-=E)),m.dem&&p.dem&&(p.dem.backfillBorder(m.dem,y,x),p.neighboringTiles&&p.neighboringTiles[S]&&(p.neighboringTiles[S].backfilled=!0)))}}getTile(r){return this.getTileByID(r.key)}getTileByID(r){return this._tiles[r]}_retainLoadedChildren(r,o,c,p){for(const m in this._tiles){let y=this._tiles[m];if(p[m]||!y.hasData()||y.tileID.overscaledZ<=o||y.tileID.overscaledZ>c)continue;let x=y.tileID;for(;y&&y.tileID.overscaledZ>o+1;){const S=y.tileID.scaledTo(y.tileID.overscaledZ-1);y=this._tiles[S.key],y&&y.hasData()&&(x=S)}let E=x;for(;E.overscaledZ>o;)if(E=E.scaledTo(E.overscaledZ-1),r[E.key]){p[x.key]=x;break}}}findLoadedParent(r,o){if(r.key in this._loadedParentTiles){const c=this._loadedParentTiles[r.key];return c&&c.tileID.overscaledZ>=o?c:null}for(let c=r.overscaledZ-1;c>=o;c--){const p=r.scaledTo(c),m=this._getLoadedTile(p);if(m)return m}}_getLoadedTile(r){const o=this._tiles[r.key];return o&&o.hasData()?o:this._cache.getByKey(this._source.reparseOverscaled?r.wrapped().key:r.canonical.key)}updateCacheSize(r,o){o=o||this._source.tileSize;const c=Math.ceil(r.width/o)+1,p=Math.ceil(r.height/o)+1,m=Math.floor(c*p*5),y=typeof this._minTileCacheSize=="number"?Math.max(this._minTileCacheSize,m):m,x=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,y):y;this._cache.setMaxSize(x)}handleWrapJump(r){const o=Math.round((r-(this._prevLng===void 0?r:this._prevLng))/360);if(this._prevLng=r,o){const c={};for(const p in this._tiles){const m=this._tiles[p];m.tileID=m.tileID.unwrapTo(m.tileID.wrap+o),c[m.tileID.key]=m}this._tiles=c;for(const p in this._timers)clearTimeout(this._timers[p]),delete this._timers[p];for(const p in this._tiles)this._setTileReloadTimer(+p,this._tiles[p])}}update(r,o,c){if(this.transform=r,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage||this.usedForTerrain&&!c)return;let p;this.updateCacheSize(r,o),this.transform.projection.name!=="globe"&&this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?p=r.getVisibleUnwrappedCoordinates(this._source.tileID).map(x=>new zi(x.canonical.z,x.wrap,x.canonical.z,x.canonical.x,x.canonical.y)):(p=r.coveringTiles({tileSize:o||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!c,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain}),this._source.hasTile&&(p=p.filter(x=>this._source.hasTile(x)))):p=[];const m=this._updateRetainedTiles(p);if(GI(this._source.type)&&p.length!==0){const x={},E={},S=Object.keys(m);for(const M of S){const O=m[M],$=this._tiles[M];if(!$||$.fadeEndTime&&$.fadeEndTime<=_a.now())continue;const G=this.findLoadedParent(O,Math.max(O.overscaledZ-hu.maxOverzooming,this._source.minzoom));G&&(this._addTile(G.tileID),x[G.tileID.key]=G.tileID),E[M]=O}const k=p[p.length-1].overscaledZ;for(const M in this._tiles){const O=this._tiles[M];if(m[M]||!O.hasData())continue;let $=O.tileID;for(;$.overscaledZ>k;){$=$.scaledTo($.overscaledZ-1);const G=this._tiles[$.key];if(G&&G.hasData()&&E[$.key]){m[M]=O.tileID;break}}}for(const M in x)m[M]||(this._coveredTiles[M]=!0,m[M]=x[M])}for(const x in m)this._tiles[x].clearFadeHold();const y=function(x,E){const S=[];for(const k in x)k in E||S.push(k);return S}(this._tiles,m);for(const x of y){const E=this._tiles[x];E.hasSymbolBuckets&&!E.holdingForFade()?E.setHoldDuration(this.map._fadeDuration):E.hasSymbolBuckets&&!E.symbolFadeFinished()||this._removeTile(+x)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const r in this._tiles)this._tiles[r].holdingForFade()&&this._removeTile(+r)}_updateRetainedTiles(r){const o={};if(r.length===0)return o;const c={},p=r.reduce((S,k)=>Math.min(S,k.overscaledZ),1/0),m=r[0].overscaledZ,y=Math.max(m-hu.maxOverzooming,this._source.minzoom),x=Math.max(m+hu.maxUnderzooming,this._source.minzoom),E={};for(const S of r){const k=this._addTile(S);o[S.key]=S,k.hasData()||p=this._source.maxzoom){const O=S.children(this._source.maxzoom)[0],$=this.getTile(O);if($&&$.hasData()){o[O.key]=O;continue}}else{const O=S.children(this._source.maxzoom);if(o[O[0].key]&&o[O[1].key]&&o[O[2].key]&&o[O[3].key])continue}let M=k.wasRequested();for(let O=S.overscaledZ-1;O>=y;--O){const $=S.scaledTo(O);if(c[$.key]||(c[$.key]=!0,k=this.getTile($),!k&&M&&(k=this._addTile($)),k&&(o[$.key]=$,M=k.wasRequested(),k.hasData())))break}}return o}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const r in this._tiles){const o=[];let c,p=this._tiles[r].tileID;for(;p.overscaledZ>0;){if(p.key in this._loadedParentTiles){c=this._loadedParentTiles[p.key];break}o.push(p.key);const m=p.scaledTo(p.overscaledZ-1);if(c=this._getLoadedTile(m),c)break;p=m}for(const m of o)this._loadedParentTiles[m]=c}}_addTile(r){let o=this._tiles[r.key];if(o)return o;o=this._cache.getAndRemove(r),o&&(this._setTileReloadTimer(r.key,o),o.tileID=r,this._state.initializeTileState(o,this.map?this.map.painter:null),this._cacheTimers[r.key]&&(clearTimeout(this._cacheTimers[r.key]),delete this._cacheTimers[r.key],this._setTileReloadTimer(r.key,o)));const c=!!o;if(!c){const p=this.map?this.map.painter:null;o=new d1(r,this._source.tileSize*r.overscaleFactor(),this.transform.tileZoom,p,this._isRaster),this._loadTile(o,this._tileLoaded.bind(this,o,r.key,o.state))}return o?(o.uses++,this._tiles[r.key]=o,c||this._source.fire(new Ms("dataloading",{tile:o,coord:o.tileID,dataType:"source"})),o):null}_setTileReloadTimer(r,o){r in this._timers&&(clearTimeout(this._timers[r]),delete this._timers[r]);const c=o.getExpiryTimeout();c&&(this._timers[r]=setTimeout(()=>{this._reloadTile(r,"expired"),delete this._timers[r]},c))}_removeTile(r){const o=this._tiles[r];o&&(o.uses--,delete this._tiles[r],this._timers[r]&&(clearTimeout(this._timers[r]),delete this._timers[r]),o.uses>0||(o.hasData()&&o.state!=="reloading"?this._cache.add(o.tileID,o,o.getExpiryTimeout()):(o.aborted=!0,this._abortTile(o),this._unloadTile(o))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const r in this._tiles)this._removeTile(+r);this._source._clear&&this._source._clear(),this._cache.reset(),this.map&&this.usedForTerrain&&this.map.painter.terrain&&this.map.painter.terrain.resetTileLookupCache(this.id)}tilesIn(r,o,c){const p=[],m=this.transform;if(!m)return p;const y=m.projection.name==="globe",x=os(m.center.lng);for(const E in this._tiles){const S=this._tiles[E];if(c&&S.clearQueryDebugViz(),S.holdingForFade())continue;let k;if(y){const M=S.tileID.canonical;if(M.z===0){const O=[Math.abs(qe(x,...xf(M,-1))-x),Math.abs(qe(x,...xf(M,1))-x)];k=[0,2*O.indexOf(Math.min(...O))-1]}else{const O=[Math.abs(qe(x,...xf(M,-1))-x),Math.abs(qe(x,...xf(M,0))-x),Math.abs(qe(x,...xf(M,1))-x)];k=[O.indexOf(Math.min(...O))-1]}}else k=[0];for(const M of k){const O=r.containsTile(S,m,o,M);O&&p.push(O)}}return p}getVisibleCoordinates(r){const o=this.getRenderableIds(r).map(c=>this._tiles[c].tileID);for(const c of o)c.projMatrix=this.transform.calculateProjMatrix(c.toUnwrapped());return o}hasTransition(){if(this._source.hasTransition())return!0;if(GI(this._source.type))for(const r in this._tiles){const o=this._tiles[r];if(o.fadeEndTime!==void 0&&o.fadeEndTime>=_a.now())return!0}return!1}setFeatureState(r,o,c){this._state.updateState(r=r||"_geojsonTileLayer",o,c)}removeFeatureState(r,o,c){this._state.removeFeatureState(r=r||"_geojsonTileLayer",o,c)}getFeatureState(r,o){return this._state.getState(r=r||"_geojsonTileLayer",o)}setDependencies(r,o,c){const p=this._tiles[r];p&&p.setDependencies(o,c)}reloadTilesForDependencies(r,o){for(const c in this._tiles)this._tiles[c].hasDependency(r,o)&&this._reloadTile(+c,"reloading");this._cache.filter(c=>!c.hasDependency(r,o))}_preloadTiles(r,o){if(!this._sourceLoaded){const x=()=>{this._sourceLoaded&&(this._source.off("data",x),this._preloadTiles(r,o))};return void this._source.on("data",x)}const c=new Map,p=Array.isArray(r)?r:[r],m=this.map.painter.terrain,y=this.usedForTerrain&&m?m.getScaledDemTileSize():this._source.tileSize;for(const x of p){const E=x.coveringTiles({tileSize:y,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(const S of E)c.set(S.key,S);this.usedForTerrain&&x.updateElevation(!1)}je(Array.from(c.values()),(x,E)=>{const S=new d1(x,this._source.tileSize*x.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster);this._loadTile(S,k=>{this._source.type==="raster-dem"&&S.dem&&this._backfillDEM(S),E(k,S)})},o)}}function WI(i,r){const o=Math.abs(2*i.wrap)-+(i.wrap<0),c=Math.abs(2*r.wrap)-+(r.wrap<0);return i.overscaledZ-r.overscaledZ||c-o||r.canonical.y-i.canonical.y||r.canonical.x-i.canonical.x}function GI(i){return i==="raster"||i==="image"||i==="video"||i==="custom"}function xf(i,r){const o=1<=0&&M[3]>=0&&E.insert(x,M[0],M[1],M[2],M[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new Xx(new ug(this.rawTileData)).layers,this.sourceLayerCoder=new DI(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={};for(const r in this.vtLayers)this.vtFeatures[r]=[]}return this.vtLayers}query(r,o,c,p){this.loadVTLayers();const m=r.params||{},y=ph(m.filter),x=r.tileResult,E=r.transform,S=x.bufferedTilespaceBounds,k=this.grid.query(S.min.x,S.min.y,S.max.x,S.max.y,(G,K,ee,le)=>y2(x.bufferedTilespaceGeometry,G,K,ee,le));k.sort(_L);let M=null;E.elevation&&k.length>0&&(M=Sg.create(E.elevation,this.tileID));const O={};let $;for(let G=0;G(le||(le=Hs(me,this.tileID.canonical,r.tileTransform)),ce.queryIntersectsFeature(x,me,pe,le,this.z,r.transform,r.pixelPosMatrix,M,_e)))}return O}loadMatchingFeature(r,o,c,p,m,y,x,E,S){const{featureIndex:k,bucketIndex:M,sourceLayerIndex:O,layoutVertexArrayOffset:$}=o,G=this.bucketLayerIDs[M];if(p&&!function(me,ce){for(let pe=0;pe=0)return!0;return!1}(p,G))return;const K=this.sourceLayerCoder.decode(O),ee=this.vtLayers[K].feature(k);if(c.needGeometry){const me=su(ee,!0);if(!c.filter(new D(this.tileID.overscaledZ),me,this.tileID.canonical))return}else if(!c.filter(new D(this.tileID.overscaledZ),ee))return;const le=this.getId(ee,K);for(let me=0;me{const x=r instanceof ae?r.get(y):null;return x&&x.evaluate?x.evaluate(o,c,p):x})}function _L(i,r){return r-i}At(HI,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});class ZI{constructor(r,o){this.width=r,this.height=o,this.nextRow=0,this.image=new qs({width:r,height:o}),this.positions={},this.uploaded=!1}getDash(r,o){const c=this.getKey(r,o);return this.positions[c]}trim(){const r=this.width,o=this.height=Pr(this.nextRow);this.image.resize({width:r,height:o})}getKey(r,o){return r.join(",")+o}getDashRanges(r,o,c){const p=[];let m=r.length%2==1?-r[r.length-1]*c:0,y=r[0]*c,x=!0;p.push({left:m,right:y,isDash:x,zeroLength:r[0]===0});let E=r[0];for(let S=1;S1&&(E=r[++x]);const k=Math.abs(S-E.left),M=Math.abs(S-E.right),O=Math.min(k,M);let $;const G=m/c*(p+1);if(E.isDash){const K=p-Math.abs(G);$=Math.sqrt(O*O+K*K)}else $=p-Math.sqrt(O*O+G*G);this.image.data[y+S]=Math.max(0,Math.min(255,$+128))}}}addRegularDash(r,o){for(let E=r.length-1;E>=0;--E){const S=r[E],k=r[E+1];S.zeroLength?r.splice(E,1):k&&k.isDash===S.isDash&&(k.left=S.left,r.splice(E,1))}const c=r[0],p=r[r.length-1];c.isDash===p.isDash&&(c.left=p.left-this.width,p.right=c.right+this.width);const m=this.width*this.nextRow;let y=0,x=r[y];for(let E=0;E1&&(x=r[++y]);const S=Math.abs(E-x.left),k=Math.abs(E-x.right),M=Math.min(S,k);this.image.data[m+E]=Math.max(0,Math.min(255,(x.isDash?M:-M)+o+128))}}addDash(r,o){const c=this.getKey(r,o);if(this.positions[c])return this.positions[c];const p=o==="round",m=p?7:0,y=2*m+1;if(this.nextRow+y>this.height)return Tr("LineAtlas out of space"),null;r.length===0&&r.push(1);let x=0;for(let k=0;k=Qe.maxzoom||Qe.visibility!=="none"&&(y1(Ue,this.zoom,c),(E[Qe.id]=Qe.createBucket({index:x.bucketLayerIDs.length,layers:Ue,zoom:this.zoom,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:He,sourceID:this.source,enableTerrain:this.enableTerrain,projection:this.projection.spec,availableImages:c})).populate(lt,k,this.tileID.canonical,this.tileTransform),x.bucketLayerIDs.push(Ue.map(Je=>Je.id)))}}let O,$,G,K;S.trim();const ee={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},le=()=>{if(O)return m(O);if($&&G&&K){const _e=new XI($),ye=new nI(G,K);for(const Oe in E){const Me=E[Oe];Me instanceof Ul?(y1(Me.layers,this.zoom,c),GF(Me,$,_e.positions,G,ye.iconPositions,this.showCollisionBoxes,c,this.tileID.canonical,this.tileZoom,this.projection)):Me.hasPattern&&(Me instanceof sg||Me instanceof rg||Me instanceof lf)&&(y1(Me.layers,this.zoom,c),Me.addFeatures(k,this.tileID.canonical,ye.patternPositions,c,this.tileTransform))}this.status="done",m(null,{buckets:et(E).filter(Oe=>!Oe.isEmpty()),featureIndex:x,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:_e.image,lineAtlas:S,imageAtlas:ye,glyphMap:this.returnDependencies?$:null,iconMap:this.returnDependencies?G:null,glyphPositions:this.returnDependencies?_e.positions:null})}},me=Vt(k.glyphDependencies,_e=>Object.keys(_e).map(Number));Object.keys(me).length?p.send("getGlyphs",{uid:this.uid,stacks:me},(_e,ye)=>{O||(O=_e,$=ye,le())},void 0,!1,ee):$={};const ce=Object.keys(k.iconDependencies);ce.length?p.send("getImages",{icons:ce,source:this.source,tileID:this.tileID,type:"icons"},(_e,ye)=>{O||(O=_e,G=ye,le())},void 0,!1,ee):G={};const pe=Object.keys(k.patternDependencies);pe.length?p.send("getImages",{icons:pe,source:this.source,tileID:this.tileID,type:"patterns"},(_e,ye)=>{O||(O=_e,K=ye,le())},void 0,!1,ee):K={},le()}}function y1(i,r,o){const c=new D(r);for(const p of i)p.recalculate(c,o)}class YI{constructor(r){this.entries={},this.scheduler=r}request(r,o,c,p){const m=this.entries[r]=this.entries[r]||{callbacks:[]};if(m.result){const[y,x]=m.result;return this.scheduler?this.scheduler.add(()=>{p(y,x)},o):p(y,x),()=>{}}return m.callbacks.push(p),m.cancel||(m.cancel=c((y,x)=>{m.result=[y,x];for(const E of m.callbacks)this.scheduler?this.scheduler.add(()=>{E(y,x)},o):E(y,x);setTimeout(()=>delete this.entries[r],3e3)})),()=>{m.result||(m.callbacks=m.callbacks.filter(y=>y!==p),m.callbacks.length||(m.cancel(),delete this.entries[r]))}}}function QI(i,r,o){const c=JSON.stringify(i.request);return i.data&&(this.deduped.entries[c]={result:[null,i.data]}),this.deduped.request(c,{type:"parseTile",isSymbolTile:i.isSymbolTile,zoom:i.tileZoom},p=>{const m=Ja(i.request,(y,x,E,S)=>{y?p(y):x&&p(null,{vectorTile:o?void 0:new Xx(new ug(x)),rawData:x,cacheControl:E,expires:S})});return()=>{m.cancel(),p()}},r)}const JI=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class _1{static from(r){if(!(r instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[o,c]=new Uint8Array(r,0,2);if(o!==219)throw new Error("Data does not appear to be in a KDBush format.");const p=c>>4;if(p!==1)throw new Error(`Got v${p} data when expected v1.`);const m=JI[15&c];if(!m)throw new Error("Unrecognized array type.");const[y]=new Uint16Array(r,2,1),[x]=new Uint32Array(r,4,1);return new _1(x,y,m,r)}constructor(r,o=64,c=Float64Array,p){if(isNaN(r)||r<0)throw new Error(`Unpexpected numItems value: ${r}.`);this.numItems=+r,this.nodeSize=Math.min(Math.max(+o,2),65535),this.ArrayType=c,this.IndexArrayType=r<65536?Uint16Array:Uint32Array;const m=JI.indexOf(this.ArrayType),y=2*r*this.ArrayType.BYTES_PER_ELEMENT,x=r*this.IndexArrayType.BYTES_PER_ELEMENT,E=(8-x%8)%8;if(m<0)throw new Error(`Unexpected typed array class: ${c}.`);p&&p instanceof ArrayBuffer?(this.data=p,this.ids=new this.IndexArrayType(this.data,8,r),this.coords=new this.ArrayType(this.data,8+x+E,2*r),this._pos=2*r,this._finished=!0):(this.data=new ArrayBuffer(8+y+x+E),this.ids=new this.IndexArrayType(this.data,8,r),this.coords=new this.ArrayType(this.data,8+x+E,2*r),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+m]),new Uint16Array(this.data,2,1)[0]=o,new Uint32Array(this.data,4,1)[0]=r)}add(r,o){const c=this._pos>>1;return this.ids[c]=c,this.coords[this._pos++]=r,this.coords[this._pos++]=o,c}finish(){const r=this._pos>>1;if(r!==this.numItems)throw new Error(`Added ${r} items when expected ${this.numItems}.`);return v1(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(r,o,c,p){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:m,coords:y,nodeSize:x}=this,E=[0,m.length-1,0],S=[];for(;E.length;){const k=E.pop()||0,M=E.pop()||0,O=E.pop()||0;if(M-O<=x){for(let ee=O;ee<=M;ee++){const le=y[2*ee],me=y[2*ee+1];le>=r&&le<=c&&me>=o&&me<=p&&S.push(m[ee])}continue}const $=O+M>>1,G=y[2*$],K=y[2*$+1];G>=r&&G<=c&&K>=o&&K<=p&&S.push(m[$]),(k===0?r<=G:o<=K)&&(E.push(O),E.push($-1),E.push(1-k)),(k===0?c>=G:p>=K)&&(E.push($+1),E.push(M),E.push(1-k))}return S}within(r,o,c){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:p,coords:m,nodeSize:y}=this,x=[0,p.length-1,0],E=[],S=c*c;for(;x.length;){const k=x.pop()||0,M=x.pop()||0,O=x.pop()||0;if(M-O<=y){for(let ee=O;ee<=M;ee++)tC(m[2*ee],m[2*ee+1],r,o)<=S&&E.push(p[ee]);continue}const $=O+M>>1,G=m[2*$],K=m[2*$+1];tC(G,K,r,o)<=S&&E.push(p[$]),(k===0?r-c<=G:o-c<=K)&&(x.push(O),x.push($-1),x.push(1-k)),(k===0?r+c>=G:o+c>=K)&&(x.push($+1),x.push(M),x.push(1-k))}return E}}function v1(i,r,o,c,p,m){if(p-c<=o)return;const y=c+p>>1;eC(i,r,y,c,p,m),v1(i,r,o,c,y-1,1-m),v1(i,r,o,y+1,p,1-m)}function eC(i,r,o,c,p,m){for(;p>c;){if(p-c>600){const S=p-c+1,k=o-c+1,M=Math.log(S),O=.5*Math.exp(2*M/3),$=.5*Math.sqrt(M*O*(S-O)/S)*(k-S/2<0?-1:1);eC(i,r,o,Math.max(c,Math.floor(o-k*O/S+$)),Math.min(p,Math.floor(o+(S-k)*O/S+$)),m)}const y=r[2*o+m];let x=c,E=p;for(bf(i,r,c,o),r[2*p+m]>y&&bf(i,r,c,p);xy;)E--}r[2*c+m]===y?bf(i,r,c,E):(E++,bf(i,r,E,p)),E<=o&&(c=E+1),o<=E&&(p=E-1)}}function bf(i,r,o,c){x1(i,o,c),x1(r,2*o,2*c),x1(r,2*o+1,2*c+1)}function x1(i,r,o){const c=i[r];i[r]=i[o],i[o]=c}function tC(i,r,o,c){const p=i-o,m=r-c;return p*p+m*m}l.ARRAY_TYPE=so,l.AUTH_ERR_MSG=ve,l.Aabb=Mi,l.Actor=class{constructor(i,r,o){this.target=i,this.parent=r,this.mapId=o,this.callbacks={},this.cancelCallbacks={},si(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.globalScope=yi()?i:w,this.scheduler=new dL}send(i,r,o,c,p=!1,m){const y=Math.round(1e18*Math.random()).toString(36).substring(0,10);o&&(o.metadata=m,this.callbacks[y]=o);const x=Nn(this.globalScope)?void 0:[];return this.target.postMessage({id:y,type:i,hasCallback:!!o,targetMapId:c,mustQueue:p,sourceMapId:this.mapId,data:Ml(r,x)},x),{cancel:()=>{o&&delete this.callbacks[y],this.target.postMessage({id:y,type:"",targetMapId:c,sourceMapId:this.mapId})}}}receive(i){const r=i.data,o=r.id;if(o&&(!r.targetMapId||this.mapId===r.targetMapId))if(r.type===""){const c=this.cancelCallbacks[o];delete this.cancelCallbacks[o],c&&c.cancel()}else if(r.mustQueue||yi()){const c=this.callbacks[o];this.cancelCallbacks[o]=this.scheduler.add(()=>this.processTask(o,r),c&&c.metadata||{type:"message"})}else this.processTask(o,r)}processTask(i,r){if(r.type===""){const o=this.callbacks[i];delete this.callbacks[i],o&&(r.error?o(Us(r.error)):o(null,Us(r.data)))}else{const o=Nn(this.globalScope)?void 0:[],c=r.hasCallback?(m,y)=>{delete this.cancelCallbacks[i],this.target.postMessage({id:i,type:"",sourceMapId:this.mapId,error:m?Ml(m):null,data:Ml(y,o)},o)}:m=>{},p=Us(r.data);if(this.parent[r.type])this.parent[r.type](r.sourceMapId,p,c);else if(this.parent.getWorkerSource){const m=r.type.split(".");this.parent.getWorkerSource(r.sourceMapId,m[0],p.source)[m[1]](p,c)}else c(new Error(`Could not find function ${r.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}},l.CanonicalTileID=ag,l.Color=fn,l.ColorMode=cs,l.CullFaceMode=Fa,l.DEMData=Eg,l.DataConstantProperty=Z,l.DedupedRequest=YI,l.DepthMode=Bh,l.EXTENT=Ot,l.Elevation=class{isDataAvailableAtPoint(i){const r=this._source();if(this.isUsingMockSource()||!r||i.y<0||i.y>1)return!1;const o=r.getSource().maxzoom,c=1<1)return r;const p=c.getSource().maxzoom,m=1<{const m=this.getAtTileOffset(i,p.x,p.y),y=c.upVector(i.canonical,p.x,p.y);return ko(y,y,m*c.upVectorScale(i.canonical,r,o).metersToTile),y}}getForTilePoints(i,r,o,c){if(this.isUsingMockSource())return!1;const p=Sg.create(this,i,c);return!!p&&(r.forEach(m=>{m[2]=this.exaggeration()*p.getElevationAt(m[0],m[1],o)}),!0)}getMinMaxForTile(i){if(this.isUsingMockSource())return null;const r=this.findDEMTileFor(i);if(!r||!r.dem)return null;const o=r.dem.tree,c=r.tileID,p=1<{let O=S===m-1?S-2:S===0?S:S-1;return O+=M?24575:0,[O,k]};for(let S=0;Sthis._skuTokenExpiresAt}transformRequest(i,r){return this._transformRequestFn&&this._transformRequestFn(i,r)||{url:i}}normalizeStyleURL(i,r){if(!Ae(i))return i;const o=mt(i);return o.path=`/styles/v1${o.path}`,this._makeAPIURL(o,this._customAccessToken||r)}normalizeGlyphsURL(i,r){if(!Ae(i))return i;const o=mt(i);return o.path=`/fonts/v1${o.path}`,this._makeAPIURL(o,this._customAccessToken||r)}normalizeSourceURL(i,r,o,c){if(!Ae(i))return i;const p=mt(i);return p.path=`/v4/${p.authority}.json`,p.params.push("secure"),o&&p.params.push(`language=${o}`),c&&p.params.push(`worldview=${c}`),this._makeAPIURL(p,this._customAccessToken||r)}normalizeSpriteURL(i,r,o,c){const p=mt(i);return Ae(i)?(p.path=`/styles/v1${p.path}/sprite${r}${o}`,this._makeAPIURL(p,this._customAccessToken||c)):(p.path+=`${r}${o}`,ct(p))}normalizeTileURL(i,r,o){if(this._isSkuTokenExpired()&&this._createSkuToken(),i&&!Ae(i))return i;const c=mt(i);c.path=c.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${r||o&&c.authority!=="raster"&&o===512?"@2x":""}${z.supported?".webp":"$1"}`),c.authority==="raster"?c.path=`/${P.RASTER_URL_PREFIX}${c.path}`:(c.path=c.path.replace(/^.+\/v4\//,"/"),c.path=`/${P.TILE_URL_VERSION}${c.path}`);const p=this._customAccessToken||function(m){for(const y of m){const x=y.match(/^access_token=(.*)$/);if(x)return x[1]}return null}(c.params)||P.ACCESS_TOKEN;return P.REQUIRE_ACCESS_TOKEN&&p&&this._skuToken&&c.params.push(`sku=${this._skuToken}`),this._makeAPIURL(c,p)}canonicalizeTileURL(i,r){const o=mt(i);if(!o.path.match(/^(\/v4\/|\/raster\/v1\/)/)||!o.path.match(/\.[\w]+$/))return i;let c="mapbox://";o.path.match(/^\/raster\/v1\//)?c+=`raster/${o.path.replace(`/${P.RASTER_URL_PREFIX}/`,"")}`:c+=`tiles/${o.path.replace(`/${P.TILE_URL_VERSION}/`,"")}`;let p=o.params;return r&&(p=p.filter(m=>!m.match(/^access_token=/))),p.length&&(c+=`?${p.join("&")}`),c}canonicalizeTileset(i,r){const o=!!r&&Ae(r),c=[];for(const p of i.tiles||[])Pe(p)?c.push(this.canonicalizeTileURL(p,o)):c.push(p);return c}_makeAPIURL(i,r){const o="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",c=mt(P.API_URL);if(i.protocol=c.protocol,i.authority=c.authority,i.protocol==="http"){const p=i.params.indexOf("secure");p>=0&&i.params.splice(p,1)}if(c.path!=="/"&&(i.path=`${c.path}${i.path}`),!P.REQUIRE_ACCESS_TOKEN)return ct(i);if(r=r||P.ACCESS_TOKEN,!this._silenceAuthErrors){if(!r)throw new Error(`An API access token is required to use Mapbox GL. ${o}`);if(r[0]==="s")throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${o}`)}return i.params=i.params.filter(p=>p.indexOf("access_token")===-1),i.params.push(`access_token=${r||""}`),ct(i)}},l.ResourceType=ga,l.SegmentVector=xn,l.SourceCache=hu,l.StencilMode=f1,l.StructArrayLayout1ui2=ao,l.StructArrayLayout2f1f2i16=Lt,l.StructArrayLayout2i4=st,l.StructArrayLayout2ui4=Gn,l.StructArrayLayout3f12=er,l.StructArrayLayout3ui6=Pt,l.StructArrayLayout4i8=Ke,l.StructArrayLayout5f20=Rr,l.Texture=vf,l.Tile=d1,l.Transitionable=q,l.Uniform1f=$0,l.Uniform1i=class extends $s{constructor(i){super(i),this.current=0}set(i,r,o){this.fetchUniformLocation(i,r)&&this.current!==o&&(this.current=o,this.gl.uniform1i(this.location,o))}},l.Uniform2f=class extends $s{constructor(i){super(i),this.current=[0,0]}set(i,r,o){this.fetchUniformLocation(i,r)&&(o[0]===this.current[0]&&o[1]===this.current[1]||(this.current=o,this.gl.uniform2f(this.location,o[0],o[1])))}},l.Uniform3f=class extends $s{constructor(i){super(i),this.current=[0,0,0]}set(i,r,o){this.fetchUniformLocation(i,r)&&(o[0]===this.current[0]&&o[1]===this.current[1]&&o[2]===this.current[2]||(this.current=o,this.gl.uniform3f(this.location,o[0],o[1],o[2])))}},l.Uniform4f=OA,l.UniformColor=FA,l.UniformMatrix2f=class extends $s{constructor(i){super(i),this.current=XO}set(i,r,o){if(this.fetchUniformLocation(i,r)){for(let c=0;c<4;c++)if(o[c]!==this.current[c]){this.current=o,this.gl.uniformMatrix2fv(this.location,!1,o);break}}}},l.UniformMatrix3f=class extends $s{constructor(i){super(i),this.current=KO}set(i,r,o){if(this.fetchUniformLocation(i,r)){for(let c=0;c<9;c++)if(o[c]!==this.current[c]){this.current=o,this.gl.uniformMatrix3fv(this.location,!1,o);break}}}},l.UniformMatrix4f=class extends $s{constructor(i){super(i),this.current=ZO}set(i,r,o){if(this.fetchUniformLocation(i,r)){if(o[12]!==this.current[12]||o[0]!==this.current[0])return this.current=o,void this.gl.uniformMatrix4fv(this.location,!1,o);for(let c=1;c<16;c++)if(o[c]!==this.current[c]){this.current=o,this.gl.uniformMatrix4fv(this.location,!1,o);break}}}},l.UnwrappedTileID=V2,l.ValidationError=Et,l.VectorTileFeature=ig,l.VectorTileWorkerSource=class extends Cc{constructor(i,r,o,c,p){super(),this.actor=i,this.layerIndex=r,this.availableImages=o,this.loadVectorData=p||QI,this.loading={},this.loaded={},this.deduped=new YI(i.scheduler),this.isSpriteLoaded=c,this.scheduler=i.scheduler}loadTile(i,r){const o=i.uid,c=i&&i.request,p=c&&c.collectResourceTiming,m=this.loading[o]=new vL(i);m.abort=this.loadVectorData(i,(y,x)=>{const E=!this.loading[o];if(delete this.loading[o],E||y||!x)return m.status="done",E||(this.loaded[o]=m),r(y);const S=x.rawData,k={};x.expires&&(k.expires=x.expires),x.cacheControl&&(k.cacheControl=x.cacheControl),m.vectorTile=x.vectorTile||new Xx(new ug(S));const M=()=>{m.parse(m.vectorTile,this.layerIndex,this.availableImages,this.actor,(O,$)=>{if(O||!$)return r(O);const G={};if(p){const K=qd(c);K.length>0&&(G.resourceTiming=JSON.parse(JSON.stringify(K)))}r(null,nt({rawTileData:S.slice(0)},$,k,G))})};this.isSpriteLoaded?M():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(M,{type:"parseTile",isSymbolTile:i.isSymbolTile,zoom:i.tileZoom}):M()}),this.loaded=this.loaded||{},this.loaded[o]=m})}reloadTile(i,r){const o=this.loaded,c=i.uid,p=this;if(o&&o[c]){const m=o[c];m.showCollisionBoxes=i.showCollisionBoxes,m.enableTerrain=!!i.enableTerrain,m.projection=i.projection,m.tileTransform=uu(i.tileID.canonical,i.projection);const y=(x,E)=>{const S=m.reloadCallback;S&&(delete m.reloadCallback,m.parse(m.vectorTile,p.layerIndex,this.availableImages,p.actor,S)),r(x,E)};m.status==="parsing"?m.reloadCallback=y:m.status==="done"&&(m.vectorTile?m.parse(m.vectorTile,this.layerIndex,this.availableImages,this.actor,y):y())}}abortTile(i,r){const o=i.uid,c=this.loading[o];c&&(c.abort&&c.abort(),delete this.loading[o]),r()}removeTile(i,r){const o=this.loaded,c=i.uid;o&&o[c]&&delete o[c],r()}},l.WritingMode=Do,l.ZoomDependentExpression=Hc,l.add=Gs,l.addDynamicAttributes=xg,l.adjoint=function(i,r){var o=r[0],c=r[1],p=r[2],m=r[3],y=r[4],x=r[5],E=r[6],S=r[7],k=r[8];return i[0]=y*k-x*S,i[1]=p*S-c*k,i[2]=c*x-p*y,i[3]=x*E-m*k,i[4]=o*k-p*E,i[5]=p*m-o*x,i[6]=m*S-y*E,i[7]=c*E-o*S,i[8]=o*y-c*m,i},l.asyncAll=je,l.bezier=Ut,l.bindAll=si,l.boundsAttributes=RI,l.bufferConvexPolygon=function(i,r){const o=[];for(let c=0;cEo&&(i.getActor().send("enforceCacheSizeLimit",Ps),So=0)},l.calculateGlobeLabelMatrix=function(i,r){const{x:o,y:c}=i.point,p=o2(o,c,i.worldSize/i._pixelsPerMercatorPixel,0,0);return ru(p,p,Dx(is(r)))},l.calculateGlobeMatrix=function(i){const{x:r,y:o}=i.point,{lng:c,lat:p}=i._center;return o2(r,o,i.worldSize,c,p)},l.calculateGlobeMercatorMatrix=function(i){const r=i.pixelsPerMeter,o=r/za(1,i.center.lat),c=Da(new Float64Array(16));return Wp(c,c,[i.point.x,i.point.y,0]),nu(c,c,[o,o,r]),Float32Array.from(c)},l.circumferenceAtLatitude=zx,l.clamp=qe,l.clearTileCache=function(i){if(!Qa())return;const r=w.caches.delete(wo);i&&r.catch(i).then(()=>i())},l.clipLine=gI,l.clone=function(i){var r=new so(16);return r[0]=i[0],r[1]=i[1],r[2]=i[2],r[3]=i[3],r[4]=i[4],r[5]=i[5],r[6]=i[6],r[7]=i[7],r[8]=i[8],r[9]=i[9],r[10]=i[10],r[11]=i[11],r[12]=i[12],r[13]=i[13],r[14]=i[14],r[15]=i[15],r},l.clone$1=qr,l.collisionCircleLayout=yF,l.config=P,l.conjugate=function(i,r){return i[0]=-r[0],i[1]=-r[1],i[2]=-r[2],i[3]=r[3],i},l.create=function(){var i=new so(16);return so!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=0,i[12]=0,i[13]=0,i[14]=0),i[0]=1,i[5]=1,i[10]=1,i[15]=1,i},l.create$1=NA,l.createExpression=kl,l.createLayout=Ie,l.createStyleLayer=function(i){return i.type==="custom"?new lL(i):new uL[i.type](i)},l.cross=Sx,l.degToRad=Fe,l.distance=function(i,r){return Math.hypot(r[0]-i[0],r[1]-i[1],r[2]-i[2])},l.div=function(i,r,o){return i[0]=r[0]/o[0],i[1]=r[1]/o[1],i[2]=r[2]/o[2],i},l.dot=ea,l.earthRadius=ef,l.ease=cr,l.easeCubicInOut=Dt,l.ecefToLatLng=function([i,r,o]){const c=Math.hypot(i,r,o),p=Math.atan2(i,o),m=.5*Math.PI-Math.acos(-r/c);return new Fr(Ve(p),Ve(m))},l.emitValidationErrors=L0,l.endsWith=mr,l.enforceCacheSizeLimit=function(i){Go(),jn&&jn.then(r=>{r.keys().then(o=>{for(let c=0;cm&&(c+=(i[p]-m)*(i[p]-m)),r[p]0){const G=180/c;UA($,$,[G/S+1,0,0,0,G/k+1,0,-.5*G/M,.5*G/O,1])}return $[2]=E,$[5]=i.x,$[8]=i.y,$},l.getImage=de,l.getJSON=function(i,r){return ya(nt(i,{type:"json"}),r)},l.getLatitudinalLod=function(i){const r=di-5;i=qe(i,-r,r)/r*90;const o=Math.pow(Math.abs(Math.sin(Fe(i))),3);return Math.round(o*(Yp.length-1))},l.getMapSessionAPI=Vn,l.getPerformanceMeasurement=qd,l.getProjection=kI,l.getRTLTextPluginStatus=b,l.getReferrer=Ho,l.getTilePoint=function(i,{x:r,y:o},c=0){return new xe(((r-c)*i.scale-i.x)*Ot,(o*i.scale-i.y)*Ot)},l.getTileVec3=function(i,r,o=0){return xh(((r.x-o)*i.scale-i.x)*Ot,(r.y*i.scale-i.y)*Ot,c2(r.z,r.y))},l.getVideo=function(i,r){const o=w.document.createElement("video");o.muted=!0,o.onloadstart=function(){r(null,o)};for(let c=0;c{}}},l.globeCenterToScreenPoint=function(i){const r=[0,0,0],o=Da(new Float64Array(16));return ru(o,i.pixelMatrix,i.globeMatrix),mn(r,r,o),new xe(r[0],r[1])},l.globeDenormalizeECEF=Dx,l.globeECEFOrigin=function(i,r){const o=[0,0,0];return mn(o,o,Jp(is(r.canonical))),mn(o,o,i),o},l.globeMetersToEcef=H0,l.globeNormalizeECEF=Jp,l.globePixelsToTileUnits=function(i,r){return Ot/(512*Math.pow(2,i))*Z0(is(r))},l.globePoleMatrixForTile=function(i,r,o){const c=Da(new Float64Array(16)),p=(r/(1<0;return c===0&&!p&&!y&&m},l.identity=Da,l.identity$1=KA,l.invert=xx,l.isFullscreen=function(){return!!w.document.fullscreenElement||!!w.document.webkitFullscreenElement},l.isLngLatBehindGlobe=Mx,l.isMapAuthenticated=function(i){return _i.has(i)},l.isMapboxURL=Ae,l.isSafariWithAntialiasingBug=function(i){const r=i.navigator?i.navigator.userAgent:null;return!!Nn(i)&&r&&(r.match("Version/15.4")||r.match("Version/15.5")||r.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/))},l.latFromMercatorY=hi,l.latLngToECEF=wh,l.len=o5,l.length=Gp,l.length$1=function(i){return Math.hypot(i[0],i[1],i[2],i[3])},l.lngFromMercatorX=Po,l.loadVectorTile=QI,l.makeRequest=ya,l.mapValue=function(i,r,o,c,p){return qe((i-r)/(o-r)*(p-c)+c,c,p)},l.mercatorScale=u2,l.mercatorXfromLng=os,l.mercatorYfromLat=as,l.mercatorZfromAltitude=za,l.mul=n5,l.mul$1=i5,l.multiply=ru,l.multiply$1=UA,l.multiply$2=WA,l.nextPowerOfTwo=Pr,l.normalize=Di,l.normalize$1=a5,l.normalize$2=qA,l.number=dr,l.ortho=function(i,r,o,c,p,m,y){var x=1/(r-o),E=1/(c-p),S=1/(m-y);return i[0]=-2*x,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=-2*E,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=2*S,i[11]=0,i[12]=(r+o)*x,i[13]=(p+c)*E,i[14]=(y+m)*S,i[15]=1,i},l.pbf=K2,l.perspective=function(i,r,o,c,p){var m,y=1/Math.tan(r/2);return i[0]=y/o,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=y,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=-1,i[12]=0,i[13]=0,i[15]=0,p!=null&&p!==1/0?(i[10]=(p+c)*(m=1/(c-p)),i[14]=2*p*c*m):(i[10]=-1,i[14]=-2*c),i},l.pick=function(i,r){const o={};for(let c=0;c0&&o[0]<=i.width&&o[1]>0&&o[1]<=i.height&&!Mx(i,new Fr(i.center.lat,90)),c[0]>0&&c[0]<=i.width&&c[1]>0&&c[1]<=i.height&&!Mx(i,new Fr(i.center.lat,-90))]},l.polygonContainsPoint=lu,l.polygonIntersectsBox=y2,l.polygonIntersectsPolygon=p2,l.polygonizeBounds=function(i,r,o=0,c=!0){const p=new xe(o,o),m=i.sub(p),y=r.add(p),x=[m,new xe(y.x,m.y),y,new xe(m.x,y.y)];return c&&x.push(m.clone()),x},l.posAttributes=Xp,l.postMapLoadEvent=yn,l.postPerformanceEvent=zn,l.postTurnstileEvent=or,l.potpack=e1,l.prevPowerOfTwo=function(i){return i<=1?1:Math.pow(2,Math.floor(Math.log(i)/Math.LN2))},l.radToDeg=Ve,l.refProperties=["type","source","source-layer","minzoom","maxzoom","filter","layout"],l.registerForPluginStateChange=function(i){return i({pluginStatus:f,pluginURL:s}),v.on("pluginStateChange",i),i},l.removeAuthState=function(i){_i.delete(i)},l.renderColorRamp=jx,l.resample=h2,l.rotateX=bx,l.rotateX$1=XA,l.rotateY=G0,l.rotateY$1=YA,l.rotateZ=function(i,r,o){var c=Math.sin(o),p=Math.cos(o),m=r[0],y=r[1],x=r[2],E=r[3],S=r[4],k=r[5],M=r[6],O=r[7];return r!==i&&(i[8]=r[8],i[9]=r[9],i[10]=r[10],i[11]=r[11],i[12]=r[12],i[13]=r[13],i[14]=r[14],i[15]=r[15]),i[0]=m*p+S*c,i[1]=y*p+k*c,i[2]=x*p+M*c,i[3]=E*p+O*c,i[4]=S*p-m*c,i[5]=k*p-y*c,i[6]=M*p-x*c,i[7]=O*p-E*c,i},l.rotateZ$1=function(i,r,o){o*=.5;var c=r[0],p=r[1],m=r[2],y=r[3],x=Math.sin(o),E=Math.cos(o);return i[0]=c*E+p*x,i[1]=p*E-c*x,i[2]=m*E+y*x,i[3]=y*E-m*x,i},l.scale=nu,l.scale$1=HA,l.scale$2=ko,l.scaleAndAdd=Zp,l.set=function(i,r,o,c){return i[0]=r,i[1]=o,i[2]=c,i},l.setCacheLimits=function(i,r){Ps=i,Eo=r},l.setColumn=function(i,r,o){i[4*r+0]=o[0],i[4*r+1]=o[1],i[4*r+2]=o[2],i[4*r+3]=o[3]},l.setRTLTextPlugin=function(i,r,o=!1){if(f===Np||f===Up||f===jp)throw new Error("setRTLTextPlugin cannot be called multiple times.");s=_a.resolveURL(i),f=Np,zl=r,g(),o||A()},l.smoothstep=Tt,l.spec=Ge,l.squaredLength=function(i){var r=i[0],o=i[1],c=i[2];return r*r+o*o+c*c},l.storeAuthState=function(i,r){r?_i.add(i):_i.delete(i)},l.sub=Ma,l.subtract=Ex,l.symbolSize=_F,l.tileAABB=function(i,r,o,c,p,m,y,x,E){if(E.name==="globe")return h5(i,r,new ag(o,c,p));const S=uu({z:o,x:c,y:p},E);return new Mi([(m+S.x/S.scale)*r,r*(S.y/S.scale),y],[(m+S.x2/S.scale)*r,r*(S.y2/S.scale),x])},l.tileCornersToBounds=q0,l.tileTransform=uu,l.transformMat3=function(i,r,o){var c=r[0],p=r[1],m=r[2];return i[0]=c*o[0]+p*o[3]+m*o[6],i[1]=c*o[1]+p*o[4]+m*o[7],i[2]=c*o[2]+p*o[5]+m*o[8],i},l.transformMat4=mn,l.transformMat4$1=iu,l.transformQuat=GA,l.transitionTileAABBinECEF=r2,l.translate=Wp,l.transpose=function(i,r){if(i===r){var o=r[1],c=r[2],p=r[5];i[1]=r[3],i[2]=r[6],i[3]=o,i[5]=r[7],i[6]=c,i[7]=p}else i[0]=r[0],i[1]=r[3],i[2]=r[6],i[3]=r[1],i[4]=r[4],i[5]=r[7],i[6]=r[2],i[7]=r[5],i[8]=r[8];return i},l.triggerPluginCompletionEvent=h,l.uniqueId=ur,l.updateGlobeVertexNormal=function(i,r,o,c,p){const m=5*r+2;i.float32[m+0]=o,i.float32[m+1]=c,i.float32[m+2]=p},l.validateCustomStyleLayer=function(i){const r=[],o=i.id;return o===void 0&&r.push({message:`layers.${o}: missing required property "id"`}),i.render===void 0&&r.push({message:`layers.${o}: missing required method "render"`}),i.renderingMode&&i.renderingMode!=="2d"&&i.renderingMode!=="3d"&&r.push({message:`layers.${o}: property "renderingMode" must be either "2d" or "3d"`}),r},l.validateFilter=i=>oo(Yc(i)),l.validateFog=i=>oo(R0(i)),l.validateLayer=i=>oo(P0(i)),l.validateLight=i=>oo(z0(i)),l.validateSource=i=>oo(M0(i)),l.validateStyle=F0,l.validateTerrain=i=>oo(Rp(i)),l.values=et,l.vectorTile=ng,l.version=T,l.warnOnce=Tr,l.window=w,l.wrap=gt}),d(["./shared"],function(l){function w(fe){if(typeof fe=="number"||typeof fe=="boolean"||typeof fe=="string"||fe==null)return JSON.stringify(fe);if(Array.isArray(fe)){let Y="[";for(const de of fe)Y+=`${w(de)},`;return`${Y}]`}let X="{";for(const Y of Object.keys(fe).sort())X+=`${Y}:${w(fe[Y])},`;return`${X}}`}function T(fe){let X="";for(const Y of l.refProperties)X+=`/${w(fe[Y])}`;return X}class C{constructor(X){this.keyCache={},X&&this.replace(X)}replace(X){this._layerConfigs={},this._layers={},this.update(X,[])}update(X,Y){for(const ve of X)this._layerConfigs[ve.id]=ve,(this._layers[ve.id]=l.createStyleLayer(ve)).compileFilter(),this.keyCache[ve.id]&&delete this.keyCache[ve.id];for(const ve of Y)delete this.keyCache[ve],delete this._layerConfigs[ve],delete this._layers[ve];this.familiesBySource={};const de=function(ve,Ae){const Pe={};for(let Te=0;Tethis._layers[mt.id]),Pe=Ae[0];if(Pe.visibility==="none")continue;const ke=Pe.source||"";let Te=this.familiesBySource[ke];Te||(Te=this.familiesBySource[ke]={});const Le=Pe.sourceLayer||"_geojsonTileLayer";let dt=Te[Le];dt||(dt=Te[Le]=[]),dt.push(Ae)}}}class P{loadTile(X,Y){const{uid:de,encoding:ve,rawImageData:Ae,padding:Pe,buildQuadTree:ke}=X,Te=l.window.ImageBitmap&&Ae instanceof l.window.ImageBitmap?this.getImageData(Ae,Pe):Ae;Y(null,new l.DEMData(de,Te,ve,Pe<1,ke))}getImageData(X,Y){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(X.width,X.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=X.width,this.offscreenCanvas.height=X.height,this.offscreenCanvasContext.drawImage(X,0,0,X.width,X.height);const de=this.offscreenCanvasContext.getImageData(-Y,-Y,X.width+2*Y,X.height+2*Y);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),de}}function z(fe,X){if(fe.length!==0){W(fe[0],X);for(var Y=1;Y=Math.abs(ke)?Y-Te+ke:ke-Te+Y,Y=Te}Y+de>=0!=!!X&&fe.reverse()}var U=l.getDefaultExportFromCjs(function fe(X,Y){var de,ve=X&&X.type;if(ve==="FeatureCollection")for(de=0;de>31}function kt(fe,X){for(var Y=fe.loadGeometry(),de=fe.type,ve=0,Ae=0,Pe=Y.length,ke=0;kefe},qe=Math.fround||(Tt=new Float32Array(1),fe=>(Tt[0]=+fe,Tt[0]));var Tt;const gt=3,je=5,et=6;class nt{constructor(X){this.options=Object.assign(Object.create(cr),X),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(X){const{log:Y,minZoom:de,maxZoom:ve}=this.options;Y&&console.time("total time");const Ae=`prepare ${X.length} points`;Y&&console.time(Ae),this.points=X;const Pe=[];for(let Te=0;Te=de;Te--){const Le=+Date.now();ke=this.trees[Te]=this._createTree(this._cluster(ke,Te)),Y&&console.log("z%d: %d clusters in %dms",Te,ke.numItems,+Date.now()-Le)}return Y&&console.timeEnd("total time"),this}getClusters(X,Y){let de=((X[0]+180)%360+360)%360-180;const ve=Math.max(-90,Math.min(90,X[1]));let Ae=X[2]===180?180:((X[2]+180)%360+360)%360-180;const Pe=Math.max(-90,Math.min(90,X[3]));if(X[2]-X[0]>=360)de=-180,Ae=180;else if(de>Ae){const mt=this.getClusters([de,ve,180,Pe],Y),ct=this.getClusters([-180,ve,Ae,Pe],Y);return mt.concat(ct)}const ke=this.trees[this._limitZoom(Y)],Te=ke.range(Xt(de),Pr(Pe),Xt(Ae),Pr(ve)),Le=ke.data,dt=[];for(const mt of Te){const ct=this.stride*mt;dt.push(Le[ct+je]>1?it(Le,ct,this.clusterProps):this.points[Le[ct+gt]])}return dt}getChildren(X){const Y=this._getOriginId(X),de=this._getOriginZoom(X),ve="No cluster with the specified id.",Ae=this.trees[de];if(!Ae)throw new Error(ve);const Pe=Ae.data;if(Y*this.stride>=Pe.length)throw new Error(ve);const ke=this.options.radius/(this.options.extent*Math.pow(2,de-1)),Te=Ae.within(Pe[Y*this.stride],Pe[Y*this.stride+1],ke),Le=[];for(const dt of Te){const mt=dt*this.stride;Pe[mt+4]===X&&Le.push(Pe[mt+je]>1?it(Pe,mt,this.clusterProps):this.points[Pe[mt+gt]])}if(Le.length===0)throw new Error(ve);return Le}getLeaves(X,Y,de){const ve=[];return this._appendLeaves(ve,X,Y=Y||10,de=de||0,0),ve}getTile(X,Y,de){const ve=this.trees[this._limitZoom(X)],Ae=Math.pow(2,X),{extent:Pe,radius:ke}=this.options,Te=ke/Pe,Le=(de-Te)/Ae,dt=(de+1+Te)/Ae,mt={features:[]};return this._addTileFeatures(ve.range((Y-Te)/Ae,Le,(Y+1+Te)/Ae,dt),ve.data,Y,de,Ae,mt),Y===0&&this._addTileFeatures(ve.range(1-Te/Ae,Le,1,dt),ve.data,Ae,de,Ae,mt),Y===Ae-1&&this._addTileFeatures(ve.range(0,Le,Te/Ae,dt),ve.data,-1,de,Ae,mt),mt.features.length?mt:null}getClusterExpansionZoom(X){let Y=this._getOriginZoom(X)-1;for(;Y<=this.options.maxZoom;){const de=this.getChildren(X);if(Y++,de.length!==1)break;X=de[0].properties.cluster_id}return Y}_appendLeaves(X,Y,de,ve,Ae){const Pe=this.getChildren(Y);for(const ke of Pe){const Te=ke.properties;if(Te&&Te.cluster?Ae+Te.point_count<=ve?Ae+=Te.point_count:Ae=this._appendLeaves(X,Te.cluster_id,de,ve,Ae):Ae1;let dt,mt,ct;if(Le)dt=ur(Y,Te,this.clusterProps),mt=Y[Te],ct=Y[Te+1];else{const Wt=this.points[Y[Te+gt]];dt=Wt.properties;const[Qt,or]=Wt.geometry.coordinates;mt=Xt(Qt),ct=Pr(or)}const Ft={type:1,geometry:[[Math.round(this.options.extent*(mt*Ae-de)),Math.round(this.options.extent*(ct*Ae-ve))]],tags:dt};let jt;jt=Le||this.options.generateId?Y[Te+gt]:this.points[Y[Te+gt]].id,jt!==void 0&&(Ft.id=jt),Pe.features.push(Ft)}}_limitZoom(X){return Math.max(this.options.minZoom,Math.min(Math.floor(+X),this.options.maxZoom+1))}_cluster(X,Y){const{radius:de,extent:ve,reduce:Ae,minPoints:Pe}=this.options,ke=de/(ve*Math.pow(2,Y)),Te=X.data,Le=[],dt=this.stride;for(let mt=0;mtY&&(Qt+=Te[en+je])}if(Qt>Wt&&Qt>=Pe){let or,en=ct*Wt,yn=Ft*Wt,li=-1;const zn=((mt/dt|0)<<5)+(Y+1)+this.points.length;for(const qo of jt){const Vn=qo*dt;if(Te[Vn+2]<=Y)continue;Te[Vn+2]=Y;const _i=Te[Vn+je];en+=Te[Vn]*_i,yn+=Te[Vn+1]*_i,Te[Vn+4]=zn,Ae&&(or||(or=this._map(Te,mt,!0),li=this.clusterProps.length,this.clusterProps.push(or)),Ae(or,this._map(Te,Vn)))}Te[mt+4]=zn,Le.push(en/Qt,yn/Qt,1/0,zn,-1,Qt),Ae&&Le.push(li)}else{for(let or=0;or1)for(const or of jt){const en=or*dt;if(!(Te[en+2]<=Y)){Te[en+2]=Y;for(let yn=0;yn>5}_getOriginZoom(X){return(X-this.points.length)%32}_map(X,Y,de){if(X[Y+je]>1){const Pe=this.clusterProps[X[Y+et]];return de?Object.assign({},Pe):Pe}const ve=this.points[X[Y+gt]].properties,Ae=this.options.map(ve);return de&&Ae===ve?Object.assign({},Ae):Ae}}function it(fe,X,Y){return{type:"Feature",id:fe[X+gt],properties:ur(fe,X,Y),geometry:{type:"Point",coordinates:[(de=fe[X],360*(de-.5)),Yt(fe[X+1])]}};var de}function ur(fe,X,Y){const de=fe[X+je],ve=de>=1e4?`${Math.round(de/1e3)}k`:de>=1e3?Math.round(de/100)/10+"k":de,Ae=fe[X+et],Pe=Ae===-1?{}:Object.assign({},Y[Ae]);return Object.assign(Pe,{cluster:!0,cluster_id:fe[X+gt],point_count:de,point_count_abbreviated:ve})}function Xt(fe){return fe/360+.5}function Pr(fe){const X=Math.sin(fe*Math.PI/180),Y=.5-.25*Math.log((1+X)/(1-X))/Math.PI;return Y<0?0:Y>1?1:Y}function Yt(fe){const X=(180-360*fe)*Math.PI/180;return 360*Math.atan(Math.exp(X))/Math.PI-90}function si(fe,X,Y,de){for(var ve,Ae=de,Pe=Y-X>>1,ke=Y-X,Te=fe[X],Le=fe[X+1],dt=fe[Y],mt=fe[Y+1],ct=X+3;ctAe)ve=ct,Ae=Ft;else if(Ft===Ae){var jt=Math.abs(ct-Pe);jtde&&(ve-X>3&&si(fe,X,ve,de),fe[ve+2]=Ae,Y-ve>3&&si(fe,ve,Y,de))}function mr(fe,X,Y,de,ve,Ae){var Pe=ve-Y,ke=Ae-de;if(Pe!==0||ke!==0){var Te=((fe-Y)*Pe+(X-de)*ke)/(Pe*Pe+ke*ke);Te>1?(Y=ve,de=Ae):Te>0&&(Y+=Pe*Te,de+=ke*Te)}return(Pe=fe-Y)*Pe+(ke=X-de)*ke}function Vt(fe,X,Y,de){var ve={id:fe===void 0?null:fe,type:X,geometry:Y,tags:de,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(Ae){var Pe=Ae.geometry,ke=Ae.type;if(ke==="Point"||ke==="MultiPoint"||ke==="LineString")Ii(Ae,Pe);else if(ke==="Polygon"||ke==="MultiLineString")for(var Te=0;Te0&&(Pe+=de?(ve*Le-Te*Ae)/2:Math.sqrt(Math.pow(Te-ve,2)+Math.pow(Le-Ae,2))),ve=Te,Ae=Le}var dt=X.length-3;X[2]=1,si(X,0,dt,Y),X[dt+2]=1,X.size=Math.abs(Pe),X.start=0,X.end=X.size}function Bn(fe,X,Y,de){for(var ve=0;ve1?1:Y}function Yn(fe,X,Y,de,ve,Ae,Pe,ke){if(de/=X,Ae>=(Y/=X)&&Pe=de)return null;for(var Te=[],Le=0;Le=Y&&jt=de)){var Wt=[];if(ct==="Point"||ct==="MultiPoint")bo(mt,Wt,Y,de,ve);else if(ct==="LineString")Nn(mt,Wt,Y,de,ve,!1,ke.lineMetrics);else if(ct==="MultiLineString")Qn(mt,Wt,Y,de,ve,!1);else if(ct==="Polygon")Qn(mt,Wt,Y,de,ve,!0);else if(ct==="MultiPolygon")for(var Qt=0;Qt=Y&&Pe<=de&&(X.push(fe[Ae]),X.push(fe[Ae+1]),X.push(fe[Ae+2]))}}function Nn(fe,X,Y,de,ve,Ae,Pe){for(var ke,Te,Le=Un(fe),dt=ve===0?Ps:Eo,mt=fe.start,ct=0;ctY&&(Te=dt(Le,Ft,jt,Qt,or,Y),Pe&&(Le.start=mt+ke*Te)):en>de?yn=Y&&(Te=dt(Le,Ft,jt,Qt,or,Y),li=!0),yn>de&&en<=de&&(Te=dt(Le,Ft,jt,Qt,or,de),li=!0),!Ae&&li&&(Pe&&(Le.end=mt+ke*Te),X.push(Le),Le=Un(fe)),Pe&&(mt+=ke)}var zn=fe.length-3;Ft=fe[zn],jt=fe[zn+1],Wt=fe[zn+2],(en=ve===0?Ft:jt)>=Y&&en<=de&&wo(Le,Ft,jt,Wt),zn=Le.length-3,Ae&&zn>=3&&(Le[zn]!==Le[0]||Le[zn+1]!==Le[1])&&wo(Le,Le[0],Le[1],Le[2]),Le.length&&X.push(Le)}function Un(fe){var X=[];return X.size=fe.size,X.start=fe.start,X.end=fe.end,X}function Qn(fe,X,Y,de,ve,Ae){for(var Pe=0;PePe.maxX&&(Pe.maxX=dt),mt>Pe.maxY&&(Pe.maxY=mt)}return Pe}function So(fe,X,Y,de){var ve=X.geometry,Ae=X.type,Pe=[];if(Ae==="Point"||Ae==="MultiPoint")for(var ke=0;ke0&&X.size<(ve?Pe:de))Y.numPoints+=X.length/3;else{for(var ke=[],Te=0;TePe)&&(Y.numSimplified++,ke.push(X[Te]),ke.push(X[Te+1])),Y.numPoints++;ve&&function(Le,dt){for(var mt=0,ct=0,Ft=Le.length,jt=Ft-2;ct0===dt)for(ct=0,Ft=Le.length;ct24)throw new Error("maxZoom should be in the 0-24 range");if(X.promoteId&&X.generateId)throw new Error("promoteId and generateId cannot be used together.");var de=function(ve,Ae){var Pe=[];if(ve.type==="FeatureCollection")for(var ke=0;ke1&&console.time("creation"),ct=this.tiles[mt]=Hi(fe,X,Y,de,Te),this.tileCoords.push({z:X,x:Y,y:de}),Le)){Le>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",X,Y,de,ct.numFeatures,ct.numPoints,ct.numSimplified),console.timeEnd("creation"));var Ft="z"+X;this.stats[Ft]=(this.stats[Ft]||0)+1,this.total++}if(ct.source=fe,ve){if(X===Te.maxZoom||X===ve)continue;var jt=1<1&&console.time("clipping");var Wt,Qt,or,en,yn,li,zn=.5*Te.buffer/Te.extent,qo=.5-zn,Vn=.5+zn,_i=1+zn;Wt=Qt=or=en=null,yn=Yn(fe,dt,Y-zn,Y+Vn,0,ct.minX,ct.maxX,Te),li=Yn(fe,dt,Y+qo,Y+_i,0,ct.minX,ct.maxX,Te),fe=null,yn&&(Wt=Yn(yn,dt,de-zn,de+Vn,1,ct.minY,ct.maxY,Te),Qt=Yn(yn,dt,de+qo,de+_i,1,ct.minY,ct.maxY,Te),yn=null),li&&(or=Yn(li,dt,de-zn,de+Vn,1,ct.minY,ct.maxY,Te),en=Yn(li,dt,de+qo,de+_i,1,ct.minY,ct.maxY,Te),li=null),Le>1&&console.timeEnd("clipping"),ke.push(Wt||[],X+1,2*Y,2*de),ke.push(Qt||[],X+1,2*Y,2*de+1),ke.push(or||[],X+1,2*Y+1,2*de),ke.push(en||[],X+1,2*Y+1,2*de+1)}}},To.prototype.getTile=function(fe,X,Y){var de=this.options,ve=de.extent,Ae=de.debug;if(fe<0||fe>24)return null;var Pe=1<1&&console.log("drilling down to z%d-%d-%d",fe,X,Y);for(var Te,Le=fe,dt=X,mt=Y;!Te&&Le>0;)Le--,dt=Math.floor(dt/2),mt=Math.floor(mt/2),Te=this.tiles[Ho(Le,dt,mt)];return Te&&Te.source?(Ae>1&&console.log("found parent tile z%d-%d-%d",Le,dt,mt),Ae>1&&console.time("drilling down"),this.splitTile(Te.source,Le,dt,mt,fe,X,Y),Ae>1&&console.timeEnd("drilling down"),this.tiles[ke]?Qa(this.tiles[ke],ve):null):null};class Ja extends l.VectorTileWorkerSource{constructor(X,Y,de,ve,Ae){super(X,Y,de,ve,ya),Ae&&(this.loadGeoJSON=Ae)}loadData(X,Y){const de=X&&X.request,ve=de&&de.collectResourceTiming;this.loadGeoJSON(X,(Ae,Pe)=>{if(Ae||!Pe)return Y(Ae);if(typeof Pe!="object")return Y(new Error(`Input data given to '${X.source}' is not a valid GeoJSON object.`));{U(Pe,!0);try{if(X.filter){const Te=l.createExpression(X.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(Te.result==="error")throw new Error(Te.value.map(dt=>`${dt.key}: ${dt.message}`).join(", "));Pe={type:"FeatureCollection",features:Pe.features.filter(dt=>Te.value.evaluate({zoom:0},dt))}}this._geoJSONIndex=X.cluster?new nt(function({superclusterOptions:Te,clusterProperties:Le}){if(!Le||!Te)return Te;const dt={},mt={},ct={accumulated:null,zoom:0},Ft={properties:null},jt=Object.keys(Le);for(const Wt of jt){const[Qt,or]=Le[Wt],en=l.createExpression(or),yn=l.createExpression(typeof Qt=="string"?[Qt,["accumulated"],["get",Wt]]:Qt);dt[Wt]=en.value,mt[Wt]=yn.value}return Te.map=Wt=>{Ft.properties=Wt;const Qt={};for(const or of jt)Qt[or]=dt[or].evaluate(ct,Ft);return Qt},Te.reduce=(Wt,Qt)=>{Ft.properties=Qt;for(const or of jt)ct.accumulated=Wt[or],Wt[or]=mt[or].evaluate(ct,Ft)},Te}(X)).load(Pe.features):function(Te,Le){return new To(Te,Le)}(Pe,X.geojsonVtOptions)}catch(Te){return Y(Te)}this.loaded={};const ke={};if(ve){const Te=l.getPerformanceMeasurement(de);Te&&(ke.resourceTiming={},ke.resourceTiming[X.source]=JSON.parse(JSON.stringify(Te)))}Y(null,ke)}})}reloadTile(X,Y){const de=this.loaded;return de&&de[X.uid]?super.reloadTile(X,Y):this.loadTile(X,Y)}loadGeoJSON(X,Y){if(X.request)l.getJSON(X.request,Y);else{if(typeof X.data!="string")return Y(new Error(`Input data given to '${X.source}' is not a valid GeoJSON object.`));try{return Y(null,JSON.parse(X.data))}catch{return Y(new Error(`Input data given to '${X.source}' is not a valid GeoJSON object.`))}}}getClusterExpansionZoom(X,Y){try{Y(null,this._geoJSONIndex.getClusterExpansionZoom(X.clusterId))}catch(de){Y(de)}}getClusterChildren(X,Y){try{Y(null,this._geoJSONIndex.getChildren(X.clusterId))}catch(de){Y(de)}}getClusterLeaves(X,Y){try{Y(null,this._geoJSONIndex.getLeaves(X.clusterId,X.limit,X.offset))}catch(de){Y(de)}}}class Ds{constructor(X){this.self=X,this.actor=new l.Actor(X,this),this.layerIndexes={},this.availableImages={},this.isSpriteLoaded={},this.projections={},this.defaultProjection=l.getProjection({name:"mercator"}),this.workerSourceTypes={vector:l.VectorTileWorkerSource,geojson:Ja},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(Y,de)=>{if(this.workerSourceTypes[Y])throw new Error(`Worker source with name "${Y}" already registered.`);this.workerSourceTypes[Y]=de},this.self.registerRTLTextPlugin=Y=>{if(l.plugin.isParsed())throw new Error("RTL text plugin already registered.");l.plugin.applyArabicShaping=Y.applyArabicShaping,l.plugin.processBidirectionalText=Y.processBidirectionalText,l.plugin.processStyledBidirectionalText=Y.processStyledBidirectionalText}}clearCaches(X,Y,de){delete this.layerIndexes[X],delete this.availableImages[X],delete this.workerSources[X],delete this.demWorkerSources[X],de()}checkIfReady(X,Y,de){de()}setReferrer(X,Y){this.referrer=Y}spriteLoaded(X,Y){this.isSpriteLoaded[X]=Y;for(const de in this.workerSources[X]){const ve=this.workerSources[X][de];for(const Ae in ve)ve[Ae]instanceof l.VectorTileWorkerSource&&(ve[Ae].isSpriteLoaded=Y,ve[Ae].fire(new l.Event("isSpriteLoaded")))}}setImages(X,Y,de){this.availableImages[X]=Y;for(const ve in this.workerSources[X]){const Ae=this.workerSources[X][ve];for(const Pe in Ae)Ae[Pe].availableImages=Y}de()}enableTerrain(X,Y,de){this.terrain=Y,de()}setProjection(X,Y){this.projections[X]=l.getProjection(Y)}setLayers(X,Y,de){this.getLayerIndex(X).replace(Y),de()}updateLayers(X,Y,de){this.getLayerIndex(X).update(Y.layers,Y.removedIds),de()}loadTile(X,Y,de){const ve=this.enableTerrain?l.extend({enableTerrain:this.terrain},Y):Y;ve.projection=this.projections[X]||this.defaultProjection,this.getWorkerSource(X,Y.type,Y.source).loadTile(ve,de)}loadDEMTile(X,Y,de){const ve=this.enableTerrain?l.extend({buildQuadTree:this.terrain},Y):Y;this.getDEMWorkerSource(X,Y.source).loadTile(ve,de)}reloadTile(X,Y,de){const ve=this.enableTerrain?l.extend({enableTerrain:this.terrain},Y):Y;ve.projection=this.projections[X]||this.defaultProjection,this.getWorkerSource(X,Y.type,Y.source).reloadTile(ve,de)}abortTile(X,Y,de){this.getWorkerSource(X,Y.type,Y.source).abortTile(Y,de)}removeTile(X,Y,de){this.getWorkerSource(X,Y.type,Y.source).removeTile(Y,de)}removeSource(X,Y,de){if(!this.workerSources[X]||!this.workerSources[X][Y.type]||!this.workerSources[X][Y.type][Y.source])return;const ve=this.workerSources[X][Y.type][Y.source];delete this.workerSources[X][Y.type][Y.source],ve.removeSource!==void 0?ve.removeSource(Y,de):de()}loadWorkerSource(X,Y,de){try{this.self.importScripts(Y.url),de()}catch(ve){de(ve.toString())}}syncRTLPluginState(X,Y,de){try{l.plugin.setState(Y);const ve=l.plugin.getPluginURL();if(l.plugin.isLoaded()&&!l.plugin.isParsed()&&ve!=null){this.self.importScripts(ve);const Ae=l.plugin.isParsed();de(Ae?void 0:new Error(`RTL Text Plugin failed to import scripts from ${ve}`),Ae)}}catch(ve){de(ve.toString())}}getAvailableImages(X){let Y=this.availableImages[X];return Y||(Y=[]),Y}getLayerIndex(X){let Y=this.layerIndexes[X];return Y||(Y=this.layerIndexes[X]=new C),Y}getWorkerSource(X,Y,de){if(this.workerSources[X]||(this.workerSources[X]={}),this.workerSources[X][Y]||(this.workerSources[X][Y]={}),!this.workerSources[X][Y][de]){const ve={send:(Ae,Pe,ke,Te,Le,dt)=>{this.actor.send(Ae,Pe,ke,X,Le,dt)},scheduler:this.actor.scheduler};this.workerSources[X][Y][de]=new this.workerSourceTypes[Y](ve,this.getLayerIndex(X),this.getAvailableImages(X),this.isSpriteLoaded[X])}return this.workerSources[X][Y][de]}getDEMWorkerSource(X,Y){return this.demWorkerSources[X]||(this.demWorkerSources[X]={}),this.demWorkerSources[X][Y]||(this.demWorkerSources[X][Y]=new P),this.demWorkerSources[X][Y]}enforceCacheSizeLimit(X,Y){l.enforceCacheSizeLimit(Y)}getWorkerPerformanceMetrics(X,Y,de){de(void 0,void 0)}}return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope&&(self.worker=new Ds(self)),Ds}),d(["./shared"],function(l){function w(f,s){if(Array.isArray(f)){if(!Array.isArray(s)||f.length!==s.length)return!1;for(let h=0;h"u"||typeof document>"u"?"not a browser":Array.prototype&&Array.prototype.every&&Array.prototype.filter&&Array.prototype.forEach&&Array.prototype.indexOf&&Array.prototype.lastIndexOf&&Array.prototype.map&&Array.prototype.some&&Array.prototype.reduce&&Array.prototype.reduceRight&&Array.isArray?Function.prototype&&Function.prototype.bind?Object.keys&&Object.create&&Object.getPrototypeOf&&Object.getOwnPropertyNames&&Object.isSealed&&Object.isFrozen&&Object.isExtensible&&Object.getOwnPropertyDescriptor&&Object.defineProperty&&Object.defineProperties&&Object.seal&&Object.freeze&&Object.preventExtensions?"JSON"in window&&"parse"in JSON&&"stringify"in JSON?function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var g,v,b=new Blob([""],{type:"text/javascript"}),A=URL.createObjectURL(b);try{v=new Worker(A),g=!0}catch{g=!1}return v&&v.terminate(),URL.revokeObjectURL(A),g}()?"Uint8ClampedArray"in window?ArrayBuffer.isView?function(){var g=document.createElement("canvas");g.width=g.height=1;var v=g.getContext("2d");if(!v)return!1;var b=v.getImageData(0,0,1,1);return b&&b.width===g.width}()?(P[h=s&&s.failIfMajorPerformanceCaveat]===void 0&&(P[h]=function(g){var v,b=function(A){var I=document.createElement("canvas"),D=Object.create(C.webGLContextAttributes);return D.failIfMajorPerformanceCaveat=A,I.getContext("webgl",D)||I.getContext("experimental-webgl",D)}(g);if(!b)return!1;try{v=b.createShader(b.VERTEX_SHADER)}catch{return!1}return!(!v||b.isContextLost())&&(b.shaderSource(v,"void main() {}"),b.compileShader(v),b.getShaderParameter(v,b.COMPILE_STATUS)===!0)}(h)),P[h]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL support"):"insufficient Canvas/getImageData support":"insufficient ArrayBuffer support":"insufficient Uint8ClampedArray support":"insufficient worker support":"insufficient JSON support":"insufficient Object support":"insufficient Function support":"insufficent Array support";var h}(f)}var P={};function z(f,s,h){const g=l.window.document.createElement(f);return s!==void 0&&(g.className=s),h&&h.appendChild(g),g}function W(f,s,h){const g=l.window.document.createElementNS("http://www.w3.org/2000/svg",f);for(const v of Object.keys(s))g.setAttributeNS(null,v,s[v]);return h&&h.appendChild(g),g}C.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0};const U=l.window.document&&l.window.document.documentElement.style,j=U&&U.userSelect!==void 0?"userSelect":"WebkitUserSelect";let L;function V(){U&&j&&(L=U[j],U[j]="none")}function R(){U&&j&&(U[j]=L)}function F(f){f.preventDefault(),f.stopPropagation(),l.window.removeEventListener("click",F,!0)}function H(){l.window.addEventListener("click",F,!0),l.window.setTimeout(()=>{l.window.removeEventListener("click",F,!0)},0)}function Q(f,s){const h=f.getBoundingClientRect();return ge(f,h,s)}function te(f,s){const h=f.getBoundingClientRect(),g=[];for(let v=0;v=0?0:f.button}function ge(f,s,h){const g=f.offsetWidth===s.width?1:f.offsetWidth/s.width;return new l.Point((h.clientX-s.left)*g,(h.clientY-s.top)*g)}function xe(f,s){var h=s[0],g=s[1],v=s[2],b=s[3],A=h*b-v*g;return A?(f[0]=b*(A=1/A),f[1]=-g*A,f[2]=-v*A,f[3]=h*A,f):null}function Ee(f){const{userImage:s}=f;return!!(s&&s.render&&s.render())&&(f.data.replace(new Uint8Array(s.data.buffer)),!0)}class Be extends l.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new l.RGBAImage({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(s){if(this.loaded!==s&&(this.loaded=s,s)){for(const{ids:h,callback:g}of this.requestors)this._notify(h,g);this.requestors=[]}}hasImage(s){return!!this.getImage(s)}getImage(s){return this.images[s]}addImage(s,h){this._validate(s,h)&&(this.images[s]=h)}_validate(s,h){let g=!0;return this._validateStretch(h.stretchX,h.data&&h.data.width)||(this.fire(new l.ErrorEvent(new Error(`Image "${s}" has invalid "stretchX" value`))),g=!1),this._validateStretch(h.stretchY,h.data&&h.data.height)||(this.fire(new l.ErrorEvent(new Error(`Image "${s}" has invalid "stretchY" value`))),g=!1),this._validateContent(h.content,h)||(this.fire(new l.ErrorEvent(new Error(`Image "${s}" has invalid "content" value`))),g=!1),g}_validateStretch(s,h){if(!s)return!0;let g=0;for(const v of s){if(v[0]{this.ready=!0})}broadcast(s,h,g){l.asyncAll(this.actors,(v,b)=>{v.send(s,h,b)},g=g||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(s=>{s.remove()}),this.actors=[],this.workerPool.release(this.id)}}function je(f,s,h){return s*(l.EXTENT/(f.tileSize*Math.pow(2,h-f.tileID.overscaledZ)))}gt.Actor=l.Actor;class et{constructor(s,h,g,v){this.screenBounds=s,this.cameraPoint=h,this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=g,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,v)}static createFromScreenPoints(s,h){let g,v;if(s instanceof l.Point||typeof s[0]=="number"){const b=l.Point.convert(s);g=[b],v=h.isPointAboveHorizon(b)}else{const b=l.Point.convert(s[0]),A=l.Point.convert(s[1]);g=[b,A],v=l.polygonizeBounds(b,A).every(I=>h.isPointAboveHorizon(I))}return new et(g,h.getCameraPoint(),v,h)}isPointQuery(){return this.screenBounds.length===1}bufferedScreenGeometry(s){return l.polygonizeBounds(this.screenBounds[0],this.screenBounds.length===1?this.screenBounds[0]:this.screenBounds[1],s)}bufferedCameraGeometry(s){const h=this.screenBounds[0],g=this.screenBounds.length===1?this.screenBounds[0].add(new l.Point(1,1)):this.screenBounds[1],v=l.polygonizeBounds(h,g,0,!1);return this.cameraPoint.y>g.y&&(this.cameraPoint.x>h.x&&this.cameraPoint.x=g.x?v[2]=this.cameraPoint:this.cameraPoint.x<=h.x&&(v[3]=this.cameraPoint)),l.bufferConvexPolygon(v,s)}bufferedCameraGeometryGlobe(s){const h=this.screenBounds[0],g=this.screenBounds.length===1?this.screenBounds[0].add(new l.Point(1,1)):this.screenBounds[1],v=l.polygonizeBounds(h,g,s),b=this.cameraPoint.clone();switch(3*((b.y>h.y)+(b.y>g.y))+((b.x>h.x)+(b.x>g.x))){case 0:v[0]=b,v[4]=b.clone();break;case 1:v.splice(1,0,b);break;case 2:v[1]=b;break;case 3:v.splice(4,0,b);break;case 5:v.splice(2,0,b);break;case 6:v[3]=b;break;case 7:v.splice(3,0,b);break;case 8:v[2]=b}return v}containsTile(s,h,g,v=0){const b=s.queryPadding/h._pixelsPerMercatorPixel+1,A=g?this._bufferedCameraMercator(b,h):this._bufferedScreenMercator(b,h);let I=s.tileID.wrap+(A.unwrapped?v:0);const D=A.polygon.map(ae=>l.getTilePoint(s.tileTransform,ae,I));if(!l.polygonIntersectsBox(D,0,0,l.EXTENT,l.EXTENT))return;I=s.tileID.wrap+(this.screenGeometryMercator.unwrapped?v:0);const N=this.screenGeometryMercator.polygon.map(ae=>l.getTileVec3(s.tileTransform,ae,I)),B=N.map(ae=>new l.Point(ae[0],ae[1])),q=h.getFreeCameraOptions().position||new l.MercatorCoordinate(0,0,0),J=l.getTileVec3(s.tileTransform,q,I),ne=N.map(ae=>{const Z=l.sub(ae,ae,J);return l.normalize(Z,Z),new l.Ray(J,Z)}),oe=je(s,1,h.zoom)*h._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:B,tilespaceRays:ne,bufferedTilespaceGeometry:D,bufferedTilespaceBounds:(ie=l.getBounds(D),ie.min.x=l.clamp(ie.min.x,0,l.EXTENT),ie.min.y=l.clamp(ie.min.y,0,l.EXTENT),ie.max.x=l.clamp(ie.max.x,0,l.EXTENT),ie.max.y=l.clamp(ie.max.y,0,l.EXTENT),ie),tile:s,tileID:s.tileID,pixelToTileUnitsFactor:oe};var ie}_bufferedScreenMercator(s,h){const g=ur(s);if(this._screenRaycastCache[g])return this._screenRaycastCache[g];{let v;return v=h.projection.name==="globe"?this._projectAndResample(this.bufferedScreenGeometry(s),h):{polygon:this.bufferedScreenGeometry(s).map(b=>h.pointCoordinate3D(b)),unwrapped:!0},this._screenRaycastCache[g]=v,v}}_bufferedCameraMercator(s,h){const g=ur(s);if(this._cameraRaycastCache[g])return this._cameraRaycastCache[g];{let v;return v=h.projection.name==="globe"?this._projectAndResample(this.bufferedCameraGeometryGlobe(s),h):{polygon:this.bufferedCameraGeometry(s).map(b=>h.pointCoordinate3D(b)),unwrapped:!0},this._cameraRaycastCache[g]=v,v}}_projectAndResample(s,h){const g=function(b,A){const I=l.multiply([],A.pixelMatrix,A.globeMatrix),D=[0,-l.GLOBE_RADIUS,0,1],N=[0,l.GLOBE_RADIUS,0,1],B=[0,0,0,1];l.transformMat4$1(D,D,I),l.transformMat4$1(N,N,I),l.transformMat4$1(B,B,I);const q=new l.Point(D[0]/D[3],D[1]/D[3]),J=new l.Point(N[0]/N[3],N[1]/N[3]),ne=l.polygonContainsPoint(b,q)&&D[3]1?nt(b.slice(0,ae),A):[],ue=aenew l.Point(it(we.x),we.y)),ue=ue.map(we=>new l.Point(it(we.x),we.y));const he=[...re];he.length===0&&he.push(ue[ue.length-1]);const be=l.number(he[he.length-1].y,(ue.length===0?re[0]:ue[0]).y,Z);let Se;return Se=ne?[new l.Point(0,be),new l.Point(0,0),new l.Point(1,0),new l.Point(1,be)]:[new l.Point(1,be),new l.Point(1,1),new l.Point(0,1),new l.Point(0,be)],he.push(...Se),ue.length===0?he.push(re[0]):he.push(...ue),{polygon:he.map(we=>new l.MercatorCoordinate(we.x,we.y)),unwrapped:!1}}(s,h);if(g)return g;const v=function(b,A){let I=!1,D=-1/0,N=0;for(let q=0;qD&&(D=b[q].x,N=q);for(let q=0;q.5&&(ne.x{q.x-=1}),{polygon:b,unwrapped:I}}(nt(s,h).map(b=>new l.Point(it(b.x),b.y)),h);return{polygon:v.polygon.map(b=>new l.MercatorCoordinate(b.x,b.y)),unwrapped:v.unwrapped}}}function nt(f,s){return l.resample(f,h=>{const g=s.pointCoordinate3D(h);h.x=g.x,h.y=g.y},1/256)}function it(f){return f<0?1+f%1:f%1}function ur(f){return 100*f|0}function Xt(f,s,h,g,v){const b=function(A,I){if(A)return v(A);if(I){f.url&&I.tiles&&f.tiles&&delete f.tiles;const D=l.pick(l.extend(I,f),["tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","scheme","tileSize","encoding"]);I.vector_layers&&(D.vectorLayers=I.vector_layers,D.vectorLayerIds=D.vectorLayers.map(N=>N.id)),D.tiles=s.canonicalizeTileset(D,f.url),v(null,D)}};return f.url?l.getJSON(s.transformRequest(s.normalizeSourceURL(f.url,null,h,g),l.ResourceType.Source),b):l.exported.frame(()=>b(null,f))}class Pr{constructor(s,h,g){this.bounds=l.LngLatBounds.convert(this.validateBounds(s)),this.minzoom=h||0,this.maxzoom=g||24}validateBounds(s){return Array.isArray(s)&&s.length===4?[Math.max(-180,s[0]),Math.max(-90,s[1]),Math.min(180,s[2]),Math.min(90,s[3])]:[-180,-90,180,90]}contains(s){const h=Math.pow(2,s.z),g=Math.floor(l.mercatorXfromLng(this.bounds.getWest())*h),v=Math.floor(l.mercatorYfromLat(this.bounds.getNorth())*h),b=Math.ceil(l.mercatorXfromLng(this.bounds.getEast())*h),A=Math.ceil(l.mercatorYfromLat(this.bounds.getSouth())*h);return s.x>=g&&s.x=v&&s.y{this._tileJSONRequest=null,this._loaded=!0,v?(h&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${h}`),g&&g.length!==2&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${g}`),this.fire(new l.ErrorEvent(v))):b&&(l.extend(this,b),b.bounds&&(this.tileBounds=new Pr(b.bounds,this.minzoom,this.maxzoom)),l.postTurnstileEvent(b.tiles,this.map._requestManager._customAccessToken),this.fire(new l.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new l.Event("data",{dataType:"source",sourceDataType:"content"}))),s&&s(v)})}loaded(){return this._loaded}hasTile(s){return!this.tileBounds||this.tileBounds.contains(s.canonical)}onAdd(s){this.map=s,this.load()}reload(){this.cancelTileJSONRequest(),this.load(()=>this.map.style._clearSource(this.id))}setTiles(s){return this._options.tiles=s,this.reload(),this}setUrl(s){return this.url=s,this._options.url=s,this.reload(),this}onRemove(){this.cancelTileJSONRequest()}serialize(){return l.extend({},this._options)}loadTile(s,h){const g=this.map._requestManager.normalizeTileURL(s.tileID.canonical.url(this.tiles,this.scheme)),v={request:this.map._requestManager.transformRequest(g,l.ResourceType.Tile),data:void 0,uid:s.uid,tileID:s.tileID,tileZoom:s.tileZoom,zoom:s.tileID.overscaledZ,tileSize:this.tileSize*s.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:l.exported.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:s.isSymbolTile};if(v.request.collectResourceTiming=this._collectResourceTiming,s.actor&&s.state!=="expired")s.state==="loading"?s.reloadCallback=h:s.request=s.actor.send("reloadTile",v,b.bind(this));else if(s.actor=this._tileWorkers[g]=this._tileWorkers[g]||this.dispatcher.getActor(),this.dispatcher.ready)s.request=s.actor.send("loadTile",v,b.bind(this),void 0,!0);else{const A=l.loadVectorTile.call({deduped:this._deduped},v,(I,D)=>{I||!D?b.call(this,I):(v.data={cacheControl:D.cacheControl,expires:D.expires,rawData:D.rawData.slice(0)},s.actor&&s.actor.send("loadTile",v,b.bind(this),void 0,!0))},!0);s.request={cancel:A}}function b(A,I){return delete s.request,s.aborted?h(null):A&&A.status!==404?h(A):(I&&I.resourceTiming&&(s.resourceTiming=I.resourceTiming),this.map._refreshExpiredTiles&&I&&s.setExpiryData(I),s.loadVectorData(I,this.map.painter),l.cacheEntryPossiblyAdded(this.dispatcher),h(null),void(s.reloadCallback&&(this.loadTile(s,s.reloadCallback),s.reloadCallback=null)))}}abortTile(s){s.request&&(s.request.cancel(),delete s.request),s.actor&&s.actor.send("abortTile",{uid:s.uid,type:this.type,source:this.id})}unloadTile(s){s.unloadVectorData(),s.actor&&s.actor.send("removeTile",{uid:s.uid,type:this.type,source:this.id})}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class ct extends l.Evented{constructor(s,h,g,v){super(),this.id=s,this.dispatcher=g,this.setEventedParent(v),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=l.extend({type:"raster"},h),l.extend(this,l.pick(h,["url","scheme","tileSize"]))}load(s){this._loaded=!1,this.fire(new l.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=Xt(this._options,this.map._requestManager,null,null,(h,g)=>{this._tileJSONRequest=null,this._loaded=!0,h?this.fire(new l.ErrorEvent(h)):g&&(l.extend(this,g),g.bounds&&(this.tileBounds=new Pr(g.bounds,this.minzoom,this.maxzoom)),l.postTurnstileEvent(g.tiles),this.fire(new l.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new l.Event("data",{dataType:"source",sourceDataType:"content"}))),s&&s(h)})}loaded(){return this._loaded}onAdd(s){this.map=s,this.load()}reload(){this.cancelTileJSONRequest(),this.load(()=>this.map.style._clearSource(this.id))}setTiles(s){return this._options.tiles=s,this.reload(),this}setUrl(s){return this.url=s,this._options.url=s,this.reload(),this}onRemove(){this.cancelTileJSONRequest()}serialize(){return l.extend({},this._options)}hasTile(s){return!this.tileBounds||this.tileBounds.contains(s.canonical)}loadTile(s,h){const g=l.exported.devicePixelRatio>=2,v=this.map._requestManager.normalizeTileURL(s.tileID.canonical.url(this.tiles,this.scheme),g,this.tileSize);s.request=l.getImage(this.map._requestManager.transformRequest(v,l.ResourceType.Tile),(b,A,I,D)=>(delete s.request,s.aborted?(s.state="unloaded",h(null)):b?(s.state="errored",h(b)):A?(this.map._refreshExpiredTiles&&s.setExpiryData({cacheControl:I,expires:D}),s.setTexture(A,this.map.painter),s.state="loaded",l.cacheEntryPossiblyAdded(this.dispatcher),void h(null)):h(null)))}static loadTileData(s,h,g){s.setTexture(h,g)}static unloadTileData(s,h){s.texture&&h.saveTileTexture(s.texture)}abortTile(s,h){s.request&&(s.request.cancel(),delete s.request),h()}unloadTile(s,h){s.texture&&this.map.painter.saveTileTexture(s.texture),h()}hasTransition(){return!1}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}function Ft(f,s,h,g,v,b,A,I){const D=[f,h,v,s,g,b,1,1,1],N=[A,I,1],B=l.adjoint([],D),[q,J,ne]=l.transformMat3(N,N,l.transpose(B,B));return l.multiply$1(D,[q,0,0,0,J,0,0,0,ne],D)}class jt extends l.Evented{constructor(s,h,g,v){super(),this.id=s,this.dispatcher=g,this.coordinates=h.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(v),this.options=h,this._dirty=!1}load(s,h){this._loaded=h||!1,this.fire(new l.Event("dataloading",{dataType:"source"})),this.url=this.options.url,this._imageRequest=l.getImage(this.map._requestManager.transformRequest(this.url,l.ResourceType.Image),(g,v)=>{if(this._imageRequest=null,this._loaded=!0,g)this.fire(new l.ErrorEvent(g));else if(v){const{HTMLImageElement:b}=l.window;this.image=v instanceof b?l.exported.getImageData(v):v,this._dirty=!0,this.width=this.image.width,this.height=this.image.height,s&&(this.coordinates=s),this._finishLoading()}})}loaded(){return this._loaded}updateImage(s){return this.image&&s.url?(this._imageRequest&&s.url!==this.options.url&&(this._imageRequest.cancel(),this._imageRequest=null),this.options.url=s.url,this.load(s.coordinates,this._loaded),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new l.Event("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(s){this.map=s,this.load()}onRemove(){this._imageRequest&&(this._imageRequest.cancel(),this._imageRequest=null),this.texture&&this.texture.destroy()}setCoordinates(s){this.coordinates=s,this._boundsArray=void 0;const h=s.map(l.MercatorCoordinate.fromLngLat);return this.tileID=function(g){let v=1/0,b=1/0,A=-1/0,I=-1/0;for(const q of g)v=Math.min(v,q.x),b=Math.min(b,q.y),A=Math.max(A,q.x),I=Math.max(I,q.y);const D=Math.max(A-v,I-b),N=Math.max(0,Math.floor(-Math.log(D)/Math.LN2)),B=Math.pow(2,N);return new l.CanonicalTileID(N,Math.floor((v+A)/2*B),Math.floor((b+I)/2*B))}(h),this.minzoom=this.maxzoom=this.tileID.z,this.fire(new l.Event("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){this._boundsArray=void 0}_prepareData(s){for(const D in this.tiles){const N=this.tiles[D];N.state!=="loaded"&&(N.state="loaded",N.texture=this.texture)}if(this._boundsArray)return;const h=l.tileTransform(this.tileID,this.map.transform.projection),[g,v,b,A]=this.coordinates.map(D=>{const N=h.projection.project(D[0],D[1]);return l.getTilePoint(h,N)._round()});this.perspectiveTransform=function(D,N,B,q,J,ne,oe,ie,ae,Z){const re=Ft(0,0,D,0,0,N,D,N),ue=Ft(B,q,J,ne,oe,ie,ae,Z);return l.multiply$1(ue,l.adjoint(re,re),ue),[ue[6]/ue[8]*D/l.EXTENT,ue[7]/ue[8]*N/l.EXTENT]}(this.width,this.height,g.x,g.y,v.x,v.y,A.x,A.y,b.x,b.y);const I=this._boundsArray=new l.StructArrayLayout4i8;I.emplaceBack(g.x,g.y,0,0),I.emplaceBack(v.x,v.y,l.EXTENT,0),I.emplaceBack(A.x,A.y,0,l.EXTENT),I.emplaceBack(b.x,b.y,l.EXTENT,l.EXTENT),this.boundsBuffer&&this.boundsBuffer.destroy(),this.boundsBuffer=s.createVertexBuffer(I,l.boundsAttributes.members),this.boundsSegments=l.SegmentVector.simpleSegment(0,0,4,2)}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const s=this.map.painter.context,h=s.gl;this._dirty&&(this.texture?this.texture.update(this.image):(this.texture=new l.Texture(s,this.image,h.RGBA),this.texture.bind(h.LINEAR,h.CLAMP_TO_EDGE)),this._dirty=!1),this._prepareData(s)}loadTile(s,h){this.tileID&&this.tileID.equals(s.tileID.canonical)?(this.tiles[String(s.tileID.wrap)]=s,s.buckets={},h(null)):(s.state="errored",h(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}const Wt={vector:mt,raster:ct,"raster-dem":class extends ct{constructor(f,s,h,g){super(f,s,h,g),this.type="raster-dem",this.maxzoom=22,this._options=l.extend({type:"raster-dem"},s),this.encoding=s.encoding||"mapbox"}loadTile(f,s){const h=this.map._requestManager.normalizeTileURL(f.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function g(v,b){v&&(f.state="errored",s(v)),b&&(f.dem=b,f.dem.onDeserialize(),f.needsHillshadePrepare=!0,f.needsDEMTextureUpload=!0,f.state="loaded",s(null))}f.request=l.getImage(this.map._requestManager.transformRequest(h,l.ResourceType.Tile),(function(v,b,A,I){if(delete f.request,f.aborted)f.state="unloaded",s(null);else if(v)f.state="errored",s(v);else if(b){this.map._refreshExpiredTiles&&f.setExpiryData({cacheControl:A,expires:I});const D=l.window.ImageBitmap&&b instanceof l.window.ImageBitmap&&(Hi==null&&(Hi=l.window.OffscreenCanvas&&new l.window.OffscreenCanvas(1,1).getContext("2d")&&typeof l.window.createImageBitmap=="function"),Hi),N=1-(b.width-l.prevPowerOfTwo(b.width))/2;N<1||f.neighboringTiles||(f.neighboringTiles=this._getNeighboringTiles(f.tileID));const B=D?b:l.exported.getImageData(b,N),q={uid:f.uid,coord:f.tileID,source:this.id,rawImageData:B,encoding:this.encoding,padding:N};f.actor&&f.state!=="expired"||(f.actor=this.dispatcher.getActor(),f.actor.send("loadDEMTile",q,g.bind(this),void 0,!0))}}).bind(this))}_getNeighboringTiles(f){const s=f.canonical,h=Math.pow(2,s.z),g=(s.x-1+h)%h,v=s.x===0?f.wrap-1:f.wrap,b=(s.x+1+h)%h,A=s.x+1===h?f.wrap+1:f.wrap,I={};return I[new l.OverscaledTileID(f.overscaledZ,v,s.z,g,s.y).key]={backfilled:!1},I[new l.OverscaledTileID(f.overscaledZ,A,s.z,b,s.y).key]={backfilled:!1},s.y>0&&(I[new l.OverscaledTileID(f.overscaledZ,v,s.z,g,s.y-1).key]={backfilled:!1},I[new l.OverscaledTileID(f.overscaledZ,f.wrap,s.z,s.x,s.y-1).key]={backfilled:!1},I[new l.OverscaledTileID(f.overscaledZ,A,s.z,b,s.y-1).key]={backfilled:!1}),s.y+1{if(this._loaded=!0,this._pendingLoad=null,h)this.fire(new l.ErrorEvent(h));else{const v={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&g&&g.resourceTiming&&g.resourceTiming[this.id]&&(v.resourceTiming=g.resourceTiming[this.id]),this.fire(new l.Event("data",v)),this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(),this._coalesce=!1)})}loaded(){return this._loaded}loadTile(f,s){const h=f.actor?"reloadTile":"loadTile";f.actor=this.actor,f.request=this.actor.send(h,{type:this.type,uid:f.uid,tileID:f.tileID,tileZoom:f.tileZoom,zoom:f.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:l.exported.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId},(g,v)=>(delete f.request,f.unloadVectorData(),f.aborted?s(null):g?s(g):(f.loadVectorData(v,this.map.painter,h==="reloadTile"),s(null))),void 0,h==="loadTile")}abortTile(f){f.request&&(f.request.cancel(),delete f.request),f.aborted=!0}unloadTile(f){f.unloadVectorData(),this.actor.send("removeTile",{uid:f.uid,type:this.type,source:this.id})}onRemove(){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return l.extend({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends jt{constructor(f,s,h,g){super(f,s,h,g),this.roundZoom=!0,this.type="video",this.options=s}load(){this._loaded=!1;const f=this.options;this.urls=[];for(const s of f.urls)this.urls.push(this.map._requestManager.transformRequest(s,l.ResourceType.Source).url);l.getVideo(this.urls,(s,h)=>{this._loaded=!0,s?this.fire(new l.ErrorEvent(s)):h&&(this.video=h,this.video.loop=!0,this.video.setAttribute("playsinline",""),this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(f){if(this.video){const s=this.video.seekable;fs.end(0)?this.fire(new l.ErrorEvent(new l.ValidationError(`sources.${this.id}`,null,`Playback for this video can be set only between the ${s.start(0)} and ${s.end(0)}-second mark.`))):this.video.currentTime=f}}getVideo(){return this.video}onAdd(f){this.map||(this.map=f,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 f=this.map.painter.context,s=f.gl;this.texture?this.video.paused||(this.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE),s.texSubImage2D(s.TEXTURE_2D,0,0,0,s.RGBA,s.UNSIGNED_BYTE,this.video)):(this.texture=new l.Texture(f,this.video,s.RGBA),this.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(f)}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:jt,canvas:class extends jt{constructor(f,s,h,g){super(f,s,h,g),s.coordinates?Array.isArray(s.coordinates)&&s.coordinates.length===4&&!s.coordinates.some(v=>!Array.isArray(v)||v.length!==2||v.some(b=>typeof b!="number"))||this.fire(new l.ErrorEvent(new l.ValidationError(`sources.${f}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new l.ErrorEvent(new l.ValidationError(`sources.${f}`,null,'missing required property "coordinates"'))),s.animate&&typeof s.animate!="boolean"&&this.fire(new l.ErrorEvent(new l.ValidationError(`sources.${f}`,null,'optional "animate" property must be a boolean value'))),s.canvas?typeof s.canvas=="string"||s.canvas instanceof l.window.HTMLCanvasElement||this.fire(new l.ErrorEvent(new l.ValidationError(`sources.${f}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new l.ErrorEvent(new l.ValidationError(`sources.${f}`,null,'missing required property "canvas"'))),this.options=s,this.animate=s.animate===void 0||s.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof l.window.HTMLCanvasElement?this.options.canvas:l.window.document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new l.ErrorEvent(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(f){this.map=f,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let f=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,f=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,f=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const s=this.map.painter.context;this.texture?(f||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new l.Texture(s,this.canvas,s.gl.RGBA,{premultiply:!0}),this._prepareData(s)}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const f of[this.canvas.width,this.canvas.height])if(isNaN(f)||f<=0)return!0;return!1}},custom:class extends l.Evented{constructor(f,s,h,g){super(),this.id=f,this.type="custom",this._dataType="raster",this._dispatcher=h,this._implementation=s,this.setEventedParent(g),this.scheme="xyz",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this._loaded=!1,this.roundZoom=!0,this._implementation||this.fire(new l.ErrorEvent(new Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new l.ErrorEvent(new Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new Pr(this._implementation.bounds,this.minzoom,this.maxzoom)),s.update=this._update.bind(this),s.clearTiles=this._clearTiles.bind(this),s.coveringTiles=this._coveringTiles.bind(this),l.extend(this,l.pick(s,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"]))}serialize(){return l.pick(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new l.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new l.Event("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(f){this._map=f,this._loaded=!1,this.fire(new l.Event("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(f),this.load()}onRemove(f){this._implementation.onRemove&&this._implementation.onRemove(f)}hasTile(f){if(this._implementation.hasTile){const{x:s,y:h,z:g}=f.canonical;return this._implementation.hasTile({x:s,y:h,z:g})}return!this.tileBounds||this.tileBounds.contains(f.canonical)}loadTile(f,s){const{x:h,y:g,z:v}=f.tileID.canonical,b=new l.window.AbortController;f.request=Promise.resolve(this._implementation.loadTile({x:h,y:g,z:v},{signal:b.signal})).then((function(A){return delete f.request,f.aborted?(f.state="unloaded",s(null)):A===void 0?(f.state="errored",s(null)):A===null?(this.loadTileData(f,{width:this.tileSize,height:this.tileSize,data:null}),f.state="loaded",s(null)):function(I){return I instanceof l.window.ImageData||I instanceof l.window.HTMLCanvasElement||I instanceof l.window.ImageBitmap||I instanceof l.window.HTMLImageElement}(A)?(this.loadTileData(f,A),f.state="loaded",void s(null)):(f.state="errored",s(new Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`)))}).bind(this)).catch(A=>{A.code!==20&&(f.state="errored",s(A))}),f.request.cancel=()=>b.abort()}loadTileData(f,s){ct.loadTileData(f,s,this._map.painter)}unloadTileData(f){ct.unloadTileData(f,this._map.painter)}unloadTile(f,s){if(this.unloadTileData(f),this._implementation.unloadTile){const{x:h,y:g,z:v}=f.tileID.canonical;this._implementation.unloadTile({x:h,y:g,z:v})}s()}abortTile(f,s){f.request&&f.request.cancel&&(f.request.cancel(),delete f.request),s()}hasTransition(){return!1}_coveringTiles(){return this._map.transform.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,roundZoom:this.roundZoom}).map(f=>({x:f.canonical.x,y:f.canonical.y,z:f.canonical.z}))}_clearTiles(){this._map.style._clearSource(this.id)}_update(){this.fire(new l.Event("data",{dataType:"source",sourceDataType:"content"}))}}},Qt=function(f,s,h,g){const v=new Wt[s.type](f,s,h,g);if(v.id!==f)throw new Error(`Expected Source id to be ${f} instead of ${v.id}`);return l.bindAll(["load","abort","unload","serialize","prepare"],v),v};function or(f,s){const h=l.identity([]);return l.scale(h,h,[.5*f.width,.5*-f.height,1]),l.translate(h,h,[1,-1,0]),l.multiply(h,h,f.calculateProjMatrix(s.toUnwrapped())),Float32Array.from(h)}function en(f,s,h,g,v,b,A,I=!1){const D=f.tilesIn(g,A,I);D.sort(li);const N=[];for(const q of D)N.push({wrappedTileID:q.tile.tileID.wrapped().key,queryResults:q.tile.queryRenderedFeatures(s,h,f._state,q,v,b,or(f.transform,q.tile.tileID),I)});const B=function(q){const J={},ne={};for(const oe of q){const ie=oe.queryResults,ae=oe.wrappedTileID,Z=ne[ae]=ne[ae]||{};for(const re in ie){const ue=ie[re],he=Z[re]=Z[re]||{},be=J[re]=J[re]||[];for(const Se of ue)he[Se.featureIndex]||(he[Se.featureIndex]=!0,be.push(Se))}}return J}(N);for(const q in B)B[q].forEach(J=>{const ne=J.feature,oe=ne.layer;oe&&oe.type!=="background"&&oe.type!=="sky"&&(ne.source=oe.source,oe["source-layer"]&&(ne.sourceLayer=oe["source-layer"]),ne.state=ne.id!==void 0?f.getFeatureState(oe["source-layer"],ne.id):{})});return B}function yn(f,s){const h=f.getRenderableIds().map(b=>f.getTileByID(b)),g=[],v={};for(let b=0;b{h.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[qo]}numActive(){return Object.keys(this.active).length}}let _i;function ml(){return _i||(_i=new Vn),_i}function Zv(f,s){const h={};for(const g in f)g!=="ref"&&(h[g]=f[g]);return l.refProperties.forEach(g=>{g in s&&(h[g]=s[g])}),h}function e0(f){f=f.slice();const s=Object.create(null);for(let h=0;h0?(v-A)/I:0;return this.points[b].mult(1-D).add(this.points[h].mult(D))}}class Ms{constructor(s,h,g){const v=this.boxCells=[],b=this.circleCells=[];this.xCellCount=Math.ceil(s/g),this.yCellCount=Math.ceil(h/g);for(let A=0;Athis.width||v<0||h>this.height)return!b&&[];const I=[];if(s<=0&&h<=0&&this.width<=g&&this.height<=v){if(b)return!0;for(let D=0;D0:I}_queryCircle(s,h,g,v,b){const A=s-g,I=s+g,D=h-g,N=h+g;if(I<0||A>this.width||N<0||D>this.height)return!v&&[];const B=[];return this._forEachCell(A,D,I,N,this._queryCellCircle,B,{hitTest:v,circle:{x:s,y:h,radius:g},seenUids:{box:{},circle:{}}},b),v?B.length>0:B}query(s,h,g,v,b){return this._query(s,h,g,v,!1,b)}hitTest(s,h,g,v,b){return this._query(s,h,g,v,!0,b)}hitTestCircle(s,h,g,v){return this._queryCircle(s,h,g,!0,v)}_queryCell(s,h,g,v,b,A,I,D){const N=I.seenUids,B=this.boxCells[b];if(B!==null){const J=this.bboxes;for(const ne of B)if(!N.box[ne]){N.box[ne]=!0;const oe=4*ne;if(s<=J[oe+2]&&h<=J[oe+3]&&g>=J[oe+0]&&v>=J[oe+1]&&(!D||D(this.boxKeys[ne]))){if(I.hitTest)return A.push(!0),!0;A.push({key:this.boxKeys[ne],x1:J[oe],y1:J[oe+1],x2:J[oe+2],y2:J[oe+3]})}}}const q=this.circleCells[b];if(q!==null){const J=this.circles;for(const ne of q)if(!N.circle[ne]){N.circle[ne]=!0;const oe=3*ne;if(this._circleAndRectCollide(J[oe],J[oe+1],J[oe+2],s,h,g,v)&&(!D||D(this.circleKeys[ne]))){if(I.hitTest)return A.push(!0),!0;{const ie=J[oe],ae=J[oe+1],Z=J[oe+2];A.push({key:this.circleKeys[ne],x1:ie-Z,y1:ae-Z,x2:ie+Z,y2:ae+Z})}}}}}_queryCellCircle(s,h,g,v,b,A,I,D){const N=I.circle,B=I.seenUids,q=this.boxCells[b];if(q!==null){const ne=this.bboxes;for(const oe of q)if(!B.box[oe]){B.box[oe]=!0;const ie=4*oe;if(this._circleAndRectCollide(N.x,N.y,N.radius,ne[ie+0],ne[ie+1],ne[ie+2],ne[ie+3])&&(!D||D(this.boxKeys[oe])))return A.push(!0),!0}}const J=this.circleCells[b];if(J!==null){const ne=this.circles;for(const oe of J)if(!B.circle[oe]){B.circle[oe]=!0;const ie=3*oe;if(this._circlesCollide(ne[ie],ne[ie+1],ne[ie+2],N.x,N.y,N.radius)&&(!D||D(this.circleKeys[oe])))return A.push(!0),!0}}}_forEachCell(s,h,g,v,b,A,I,D){const N=this._convertToXCellCoord(s),B=this._convertToYCellCoord(h),q=this._convertToXCellCoord(g),J=this._convertToYCellCoord(v);for(let ne=N;ne<=q;ne++)for(let oe=B;oe<=J;oe++)if(b.call(this,s,h,g,v,this.xCellCount*oe+ne,A,I,D))return}_convertToXCellCoord(s){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(s*this.xScale)))}_convertToYCellCoord(s){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(s*this.yScale)))}_circlesCollide(s,h,g,v,b,A){const I=v-s,D=b-h,N=g+A;return N*N>I*I+D*D}_circleAndRectCollide(s,h,g,v,b,A,I){const D=(A-v)/2,N=Math.abs(s-(v+D));if(N>D+g)return!1;const B=(I-b)/2,q=Math.abs(h-(b+B));if(q>B+g)return!1;if(N<=D||q<=B)return!0;const J=N-D,ne=q-B;return J*J+ne*ne<=g*g}}const va={unknown:0,flipRequired:1,flipNotRequired:2},Cc=Math.tan(85*Math.PI/180);function Ge(f,s,h,g,v,b,A){const I=l.create();if(h)if(b.name==="globe"){const D=l.calculateGlobeLabelMatrix(v,s);l.multiply(I,I,D)}else{const D=xe([],A);I[0]=D[0],I[1]=D[1],I[4]=D[2],I[5]=D[3],g||l.rotateZ(I,I,v.angle)}else l.multiply(I,v.labelPlaneMatrix,f);return I}function xa(f,s,h,g,v,b,A){const I=Ge(f,s,h,g,v,b,A);return b.name==="globe"&&h||(I[2]=I[6]=I[10]=I[14]=0),I}function _n(f,s,h,g,v,b,A){if(h){if(b.name==="globe"){const I=Ge(f,s,h,g,v,b,A);return l.invert(I,I),l.multiply(I,f,I),I}{const I=l.clone(f),D=l.identity([]);return D[0]=A[0],D[1]=A[1],D[4]=A[2],D[5]=A[3],l.multiply(I,I,D),g||l.rotateZ(I,I,-v.angle),I}}return v.glCoordMatrix}function $n(f,s,h,g){const v=[f,s,h,1];h?l.transformMat4$1(v,v,g):rr(v,v,g);const b=v[3];return v[0]/=b,v[1]/=b,v[2]/=b,v}function t0(f,s){return Math.min(.5+f/s*.5,1.5)}function Ko(f,s){const h=f[0]/f[3],g=f[1]/f[3];return h>=-s[0]&&h<=s[0]&&g>=-s[1]&&g<=s[1]}function Yd(f,s,h,g,v,b,A,I,D,N){const B=h.transform,q=g?f.textSizeData:f.iconSizeData,J=l.evaluateSizeForZoom(q,h.transform.zoom),ne=B.projection.name==="globe",oe=[256/h.width*2+1,256/h.height*2+1],ie=g?f.text.dynamicLayoutVertexArray:f.icon.dynamicLayoutVertexArray;ie.clear();let ae=null;ne&&(ae=g?f.text.globeExtVertexArray:f.icon.globeExtVertexArray);const Z=f.lineVertexArray,re=g?f.text.placedSymbolArray:f.icon.placedSymbolArray,ue=h.transform.width/h.transform.height;let he,be=!1;for(let Se=0;SeMath.abs(h)?{useVertical:!0}:f===l.WritingMode.vertical?g>0?{needsFlipping:!0}:null:s!==va.unknown&&function(v,b){return v===0||Math.abs(b/v)>Cc}(h,g)?s===va.flipRequired?{needsFlipping:!0}:null:h<0?{needsFlipping:!0}:null}function bt(f,s,h,g,v,b,A,I,D,N,B,q,J,ne,oe,ie,ae,Z,re){const ue=s/24,he=f.lineOffsetX*ue,be=f.lineOffsetY*ue,{lineStartIndex:Se,glyphStartIndex:we,numGlyphs:Ce,segment:Ie,writingMode:Re,flipState:st}=f,De=Se+f.lineLength,Ke=Ne=>{if(B){const[ut,tt,ht]=Ne.up,Mt=N.length;l.updateGlobeVertexNormal(B,Mt+0,ut,tt,ht),l.updateGlobeVertexNormal(B,Mt+1,ut,tt,ht),l.updateGlobeVertexNormal(B,Mt+2,ut,tt,ht),l.updateGlobeVertexNormal(B,Mt+3,ut,tt,ht)}const[at,ze,Ze]=Ne.point;l.addDynamicAttributes(N,at,ze,Ze,Ne.angle)};if(Ce>1){const Ne=r0(ue,I,he,be,h,q,J,f,D,b,ne,ie,!1,ae,Z,re);if(!Ne)return{notEnoughRoom:!0};if(g&&!h){let[at,ze,Ze]=Ne.first.point,[ut,tt,ht]=Ne.last.point;[at,ze]=$n(at,ze,Ze,A),[ut,tt]=$n(ut,tt,ht,A);const Mt=gl(Re,st,(ut-at)*oe,tt-ze);if(f.flipState=Mt&&Mt.needsFlipping?va.flipRequired:va.flipNotRequired,Mt)return Mt}Ke(Ne.first);for(let at=we+1;at0?ut:tr(J,Ze,at,1,v,void 0,ae,Z.canonical),ht=gl(Re,st,(tt[0]-at[0])*oe,tt[1]-at[1]);if(f.flipState=ht&&ht.needsFlipping?va.flipRequired:va.flipNotRequired,ht)return ht}const Ne=qi(ue*I.getoffsetX(we),he,be,h,q,J,Ie,Se,De,D,b,ne,ie,!1,!1,ae,Z,re);if(!Ne)return{notEnoughRoom:!0};Ke(Ne)}return{}}function ir(f,s,h,g,v){const{x:b,y:A,z:I}=g.projectTilePoint(f.x,f.y,s);if(!v)return $n(b,A,I,h);const[D,N,B]=v(f);return $n(b+D,A+N,I+B,h)}function tr(f,s,h,g,v,b,A,I){const D=ir(f.sub(s)._unit()._add(f),I,v,A,b);return l.sub(D,h,D),l.normalize(D,D),l.scaleAndAdd(D,h,D,g)}function qi(f,s,h,g,v,b,A,I,D,N,B,q,J,ne,oe,ie,ae,Z){const re=g?f-s:f+s;let ue=re>0?1:-1,he=0;g&&(ue*=-1,he=Math.PI),ue<0&&(he+=Math.PI);let be=I+A+(ue>0?0:1)|0,Se=v,we=v,Ce=0,Ie=0;const Re=Math.abs(re),st=[],De=[];let Ke=b,Ne=Ke;const at=()=>tr(Ne,Ke,we,Re-Ce+1,B,J,ie,ae.canonical);for(;Ce+Ie<=Re;){if(be+=ue,be=D)return null;if(we=Se,Ne=Ke,st.push(we),ne&&De.push(Ne),Ke=new l.Point(N.getx(be),N.gety(be)),Se=q[be],!Se){const Lt=ir(Ke,ae.canonical,B,ie,J);Se=Lt[3]>0?q[be]=Lt:at()}Ce+=Ie,Ie=l.distance(we,Se)}oe&&J&&(q[be]&&(Se=at(),Ie=l.distance(we,Se)),q[be]=Se);const ze=(Re-Ce)/Ie,Ze=Ke.sub(Ne)._mult(ze)._add(Ne),ut=l.sub([],Se,we),tt=l.scaleAndAdd([],we,ut,ze);let ht=[0,0,1],Mt=ut[0],$t=ut[1];if(Z&&(ht=ie.upVector(ae.canonical,Ze.x,Ze.y),ht[0]!==0||ht[1]!==0||ht[2]!==1)){const Lt=[ht[2],0,-ht[0]],nr=l.cross([],ht,Lt);l.normalize(Lt,Lt),l.normalize(nr,nr),Mt=l.dot(ut,Lt),$t=l.dot(ut,nr)}if(h){const Lt=l.cross([],ht,ut);l.normalize(Lt,Lt),l.scaleAndAdd(tt,tt,Lt,h*ue)}const It=he+Math.atan2($t,Mt);return st.push(tt),ne&&De.push(Ze),{point:tt,angle:It,path:st,tilePath:De,up:ht}}function Ao(f,s){const h=s.length,g=h+4*f;s.resize(g),s.float32.fill(-1/0,4*h,4*g)}function rr(f,s,h){const g=s[0],v=s[1];return f[0]=h[0]*g+h[4]*v+h[12],f[1]=h[1]*g+h[5]*v+h[13],f[3]=h[3]*g+h[7]*v+h[15],f}const Zi=100;class kc{constructor(s,h,g=new Ms(s.width+200,s.height+200,25),v=new Ms(s.width+200,s.height+200,25)){this.transform=s,this.grid=g,this.ignoredGrid=v,this.pitchfactor=Math.cos(s._pitch)*s.cameraToCenterDistance,this.screenRightBoundary=s.width+Zi,this.screenBottomBoundary=s.height+Zi,this.gridRightBoundary=s.width+200,this.gridBottomBoundary=s.height+200,this.fogState=h}placeCollisionBox(s,h,g,v,b,A,I,D){let N=g.projectedAnchorX,B=g.projectedAnchorY,q=g.projectedAnchorZ;const J=g.elevation,ne=g.tileID,oe=s.getProjection();if(J&&ne){const[Se,we,Ce]=oe.upVector(ne.canonical,g.tileAnchorX,g.tileAnchorY),Ie=oe.upVectorScale(ne.canonical,this.transform.center.lat,this.transform.worldSize).metersToTile;N+=Se*J*Ie,B+=we*J*Ie,q+=Ce*J*Ie}const ie=this.projectAndGetPerspectiveRatio(I,N,B,q,g.tileID,oe.name==="globe"||!!J||this.transform.pitch>0,oe),ae=A*ie.perspectiveRatio,Z=(g.x1*h+v.x-g.padding)*ae+ie.point.x,re=(g.y1*h+v.y-g.padding)*ae+ie.point.y,ue=(g.x2*h+v.x+g.padding)*ae+ie.point.x,he=(g.y2*h+v.y+g.padding)*ae+ie.point.y,be=ie.perspectiveRatio<=.55||ie.occluded;return!this.isInsideGrid(Z,re,ue,he)||!b&&this.grid.hitTest(Z,re,ue,he,D)||be?{box:[],offscreen:!1,occluded:ie.occluded}:{box:[Z,re,ue,he],offscreen:this.isOffscreen(Z,re,ue,he),occluded:!1}}placeCollisionCircles(s,h,g,v,b,A,I,D,N,B,q,J,ne,oe,ie){const ae=[],Z=this.transform.elevation,re=s.getProjection(),ue=Z?Z.getAtTileOffsetFunc(ie,this.transform.center.lat,this.transform.worldSize,re):null,he=new l.Point(g.tileAnchorX,g.tileAnchorY);let{x:be,y:Se,z:we}=re.projectTilePoint(he.x,he.y,ie.canonical);if(ue){const[Ze,ut,tt]=ue(he);be+=Ze,Se+=ut,we+=tt}const Ce=re.name==="globe",Ie=this.projectAndGetPerspectiveRatio(I,be,Se,we,ie,Ce||!!Z||this.transform.pitch>0,re),{perspectiveRatio:Re}=Ie,st=(q?A/Re:A*Re)/l.ONE_EM,De=$n(be,Se,we,D),Ke=Ie.signedDistanceFromCamera>0?r0(st,b,g.lineOffsetX*st,g.lineOffsetY*st,!1,De,he,g,v,D,{},Z&&!q?ue:null,q&&!!Z,re,ie,q):null;let Ne=!1,at=!1,ze=!0;if(Ke&&!Ie.occluded){const Ze=.5*ne*Re+oe,ut=new l.Point(-100,-100),tt=new l.Point(this.screenRightBoundary,this.screenBottomBoundary),ht=new Xd,{first:Mt,last:$t}=Ke,It=Mt.path.length;let Lt=[];for(let Pt=It-1;Pt>=1;Pt--)Lt.push(Mt.path[Pt]);for(let Pt=1;Pt<$t.path.length;Pt++)Lt.push($t.path[Pt]);const nr=2.5*Ze;N&&(Lt=Lt.map(([Pt,Ar,Mr],zr)=>(ue&&!Ce&&(Mr=ue(zrPt[3]<=0)&&(Lt=[]));let er=[];if(Lt.length>0){let Pt=1/0,Ar=-1/0,Mr=1/0,zr=-1/0;for(const Rr of Lt)Pt=Math.min(Pt,Rr[0]),Mr=Math.min(Mr,Rr[1]),Ar=Math.max(Ar,Rr[0]),zr=Math.max(zr,Rr[1]);Ar>=ut.x&&Pt<=tt.x&&zr>=ut.y&&Mr<=tt.y&&(er=[Lt.map(Rr=>new l.Point(Rr[0],Rr[1]))],(Pttt.x||Mrtt.y)&&(er=l.clipLine(er,ut.x,ut.y,tt.x,tt.y)))}for(const Pt of er){ht.reset(Pt,.25*Ze);let Ar=0;Ar=ht.length<=.5*Ze?1:Math.ceil(ht.paddedLength/nr)+1;for(let Mr=0;Mr0?(l.transformMat4$1(D,D,s),this.fogState&&b&&I.name!=="globe"&&(N=function(J,ne,oe,ie,ae,Z){const re=Z.calculateFogTileMatrix(ae),ue=[ne,oe,ie];return l.transformMat4(ue,ue,re),Ut(J,ue,Z.pitch,Z._fov)}(this.fogState,h,g,v,b.toUnwrapped(),this.transform)>.9)):rr(D,D,s);const B=D[3];return{point:new l.Point((D[0]/B+1)/2*this.transform.width+Zi,(-D[1]/B+1)/2*this.transform.height+Zi),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(I)/B*.5,1.5),signedDistanceFromCamera:B,occluded:A&&D[2]>B||N}}isOffscreen(s,h,g,v){return g=this.screenRightBoundary||vthis.screenBottomBoundary}isInsideGrid(s,h,g,v){return g>=0&&s=0&&hg.collisionGroupID===h}}return this.collisionGroups[s]}}function Mc(f,s,h,g,v){const{horizontalAlign:b,verticalAlign:A}=l.getAnchorAlignment(f),I=-(b-.5)*s,D=-(A-.5)*h,N=l.evaluateVariableOffset(f,g);return new l.Point(I+N[0]*v,D+N[1]*v)}function zc(f,s,h,g,v){const b=new l.Point(f,s);return h&&b._rotate(g?v:-v),b}class Wu{constructor(s,h,g,v,b){this.transform=s.clone(),this.projection=s.projection.name,this.collisionIndex=new kc(this.transform,b),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=h,this.retainedQueryData={},this.collisionGroups=new i0(g),this.collisionCircleArrays={},this.prevPlacement=v,v&&(v.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(s,h,g,v){const b=g.getBucket(h),A=g.latestFeatureIndex;if(!b||!A||h.id!==b.layerIds[0])return;const I=b.layers[0].layout,D=g.collisionBoxArray,N=Math.pow(2,this.transform.zoom-g.tileID.overscaledZ),B=g.tileSize/l.EXTENT,q=g.tileID.toUnwrapped();this.transform.setProjection(b.projection);const J=(ne=g.tileID,oe=b.getProjection(),ie=this.transform,oe.name===this.projection?ie.calculateProjMatrix(ne.toUnwrapped()):zs(ie,oe,ne));var ne,oe,ie;const ae=I.get("text-pitch-alignment")==="map",Z=I.get("text-rotation-alignment")==="map";h.compileFilter();const re=h.dynamicFilter(),ue=h.dynamicFilterNeedsFeature(),he=this.transform.calculatePixelsToTileUnitsMatrix(g),be=xa(J,g.tileID.canonical,ae,Z,this.transform,b.getProjection(),he);let Se=null;if(ae){const Ie=_n(J,g.tileID.canonical,ae,Z,this.transform,b.getProjection(),he);Se=l.multiply([],this.transform.labelPlaneMatrix,Ie)}let we=null;re&&g.latestFeatureIndex&&(we={unwrappedTileID:q,dynamicFilter:re,dynamicFilterNeedsFeature:ue,featureIndex:g.latestFeatureIndex}),this.retainedQueryData[b.bucketInstanceId]=new Qd(b.bucketInstanceId,A,b.sourceLayerIndex,b.index,g.tileID);const Ce={bucket:b,layout:I,posMatrix:J,textLabelPlaneMatrix:be,labelToScreenMatrix:Se,clippingData:we,scale:N,textPixelRatio:B,holdingForFade:g.holdingForFade(),collisionBoxArray:D,partiallyEvaluatedTextSize:l.evaluateSizeForZoom(b.textSizeData,this.transform.zoom),partiallyEvaluatedIconSize:l.evaluateSizeForZoom(b.iconSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(b.sourceID)};if(v)for(const Ie of b.sortKeyRanges){const{sortKey:Re,symbolInstanceStart:st,symbolInstanceEnd:De}=Ie;s.push({sortKey:Re,symbolInstanceStart:st,symbolInstanceEnd:De,parameters:Ce})}else s.push({symbolInstanceStart:0,symbolInstanceEnd:b.symbolInstances.length,parameters:Ce})}attemptAnchorPlacement(s,h,g,v,b,A,I,D,N,B,q,J,ne,oe,ie,ae,Z,re){const{textOffset0:ue,textOffset1:he,crossTileID:be}=J,Se=[ue,he],we=Mc(s,g,v,Se,b),Ce=this.collisionIndex.placeCollisionBox(oe,b,h,zc(we.x,we.y,A,I,this.transform.angle),q,D,N,B.predicate);if(ae){const Ie=oe.getSymbolInstanceIconSize(re,this.transform.zoom,J.placedIconSymbolIndex);if(this.collisionIndex.placeCollisionBox(oe,Ie,ae,zc(we.x,we.y,A,I,this.transform.angle),q,D,N,B.predicate).box.length===0)return}if(Ce.box.length>0){let Ie;return this.prevPlacement&&this.prevPlacement.variableOffsets[be]&&this.prevPlacement.placements[be]&&this.prevPlacement.placements[be].text&&(Ie=this.prevPlacement.variableOffsets[be].anchor),this.variableOffsets[be]={textOffset:Se,width:g,height:v,anchor:s,textScale:b,prevAnchor:Ie},this.markUsedJustification(oe,s,J,ie),oe.allowVerticalPlacement&&(this.markUsedOrientation(oe,ie,J),this.placedOrientations[be]=ie),{shift:we,placedGlyphBoxes:Ce}}}placeLayerBucketPart(s,h,g,v){const{bucket:b,layout:A,posMatrix:I,textLabelPlaneMatrix:D,labelToScreenMatrix:N,clippingData:B,textPixelRatio:q,holdingForFade:J,collisionBoxArray:ne,partiallyEvaluatedTextSize:oe,partiallyEvaluatedIconSize:ie,collisionGroup:ae}=s.parameters,Z=A.get("text-optional"),re=A.get("icon-optional"),ue=A.get("text-allow-overlap"),he=A.get("icon-allow-overlap"),be=A.get("text-rotation-alignment")==="map",Se=A.get("text-pitch-alignment")==="map",we=A.get("icon-text-fit")!=="none",Ce=A.get("symbol-z-order")==="viewport-y";this.transform.setProjection(b.projection);let Ie=ue&&(he||!b.hasIconData()||re),Re=he&&(ue||!b.hasTextData()||Z);!b.collisionArrays&&ne&&b.deserializeCollisionBoxes(ne),g&&v&&b.updateCollisionDebugBuffers(this.transform.zoom,ne);const st=(De,Ke,Ne)=>{const{crossTileID:at,numVerticalGlyphVertices:ze}=De;if(B){const Yr={zoom:this.transform.zoom,pitch:this.transform.pitch};let Or=null;if(B.dynamicFilterNeedsFeature){const gr=this.retainedQueryData[b.bucketInstanceId];Or=B.featureIndex.loadFeature({featureIndex:De.featureIndex,bucketIndex:gr.bucketIndex,sourceLayerIndex:gr.sourceLayerIndex,layoutVertexArrayOffset:0})}if(!(0,B.dynamicFilter)(Yr,Or,this.retainedQueryData[b.bucketInstanceId].tileID.canonical,new l.Point(De.tileAnchorX,De.tileAnchorY),this.transform.calculateDistanceTileData(B.unwrappedTileID)))return this.placements[at]=new Pc(!1,!1,!1,!0),void h.add(at)}if(h.has(at))return;if(J)return void(this.placements[at]=new Pc(!1,!1,!1));let Ze=!1,ut=!1,tt=!0,ht=!1,Mt=!1,$t=null,It={box:null,offscreen:null,occluded:null},Lt={box:null,offscreen:null,occluded:null},nr=null,er=null,Pt=null,Ar=0,Mr=0,zr=0;Ne.textFeatureIndex?Ar=Ne.textFeatureIndex:De.useRuntimeCollisionCircles&&(Ar=De.featureIndex),Ne.verticalTextFeatureIndex&&(Mr=Ne.verticalTextFeatureIndex);const Rr=Yr=>{Yr.tileID=this.retainedQueryData[b.bucketInstanceId].tileID;const Or=this.transform.elevation;(Or||Yr.elevation)&&(Yr.elevation=Or?Or.getAtTileOffset(Yr.tileID,Yr.tileAnchorX,Yr.tileAnchorY):0)},ui=Ne.textBox;if(ui){Rr(ui);const Yr=gr=>{let vn=l.WritingMode.horizontal;if(b.allowVerticalPlacement&&!gr&&this.prevPlacement){const vi=this.prevPlacement.placedOrientations[at];vi&&(this.placedOrientations[at]=vi,vn=vi,this.markUsedOrientation(b,vn,De))}return vn},Or=(gr,vn)=>{if(b.allowVerticalPlacement&&ze>0&&Ne.verticalTextBox){for(const vi of b.writingModes)if(vi===l.WritingMode.vertical?(It=vn(),Lt=It):It=gr(),It&&It.box&&It.box.length)break}else It=gr()};if(A.get("text-variable-anchor")){let gr=A.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[at]){const Zr=this.prevPlacement.variableOffsets[at];gr.indexOf(Zr.anchor)>0&&(gr=gr.filter(Pi=>Pi!==Zr.anchor),gr.unshift(Zr.anchor))}const vn=(Zr,Pi,yh)=>{const js=b.getSymbolInstanceTextSize(oe,De,this.transform.zoom,Ke),Jc=(Zr.x2-Zr.x1)*js+2*Zr.padding,Ca=(Zr.y2-Zr.y1)*js+2*Zr.padding,rs=we&&!he?Pi:null;rs&&Rr(rs);let Vs={box:[],offscreen:!1,occluded:!1};const _h=ue?2*gr.length:gr.length;for(let eu=0;eu<_h;++eu){const Vp=this.attemptAnchorPlacement(gr[eu%gr.length],Zr,Jc,Ca,js,be,Se,q,I,ae,eu>=gr.length,De,Ke,b,yh,rs,oe,ie);if(Vp&&(Vs=Vp.placedGlyphBoxes,Vs&&Vs.box&&Vs.box.length)){Ze=!0,$t=Vp.shift;break}}return Vs};Or(()=>vn(ui,Ne.iconBox,l.WritingMode.horizontal),()=>{const Zr=Ne.verticalTextBox;return Zr&&Rr(Zr),b.allowVerticalPlacement&&!(It&&It.box&&It.box.length)&&ze>0&&Zr?vn(Zr,Ne.verticalIconBox,l.WritingMode.vertical):{box:null,offscreen:null,occluded:null}}),It&&(Ze=It.box,tt=It.offscreen,ht=It.occluded);const vi=Yr(!(!It||!It.box));if(!Ze&&this.prevPlacement){const Zr=this.prevPlacement.variableOffsets[at];Zr&&(this.variableOffsets[at]=Zr,this.markUsedJustification(b,Zr.anchor,De,vi))}}else{const gr=(vn,vi)=>{const Zr=b.getSymbolInstanceTextSize(oe,De,this.transform.zoom,Ke),Pi=this.collisionIndex.placeCollisionBox(b,Zr,vn,new l.Point(0,0),ue,q,I,ae.predicate);return Pi&&Pi.box&&Pi.box.length&&(this.markUsedOrientation(b,vi,De),this.placedOrientations[at]=vi),Pi};Or(()=>gr(ui,l.WritingMode.horizontal),()=>{const vn=Ne.verticalTextBox;return b.allowVerticalPlacement&&ze>0&&vn?(Rr(vn),gr(vn,l.WritingMode.vertical)):{box:null,offscreen:null,occluded:null}}),Yr(!!(It&&It.box&&It.box.length))}}if(nr=It,Ze=nr&&nr.box&&nr.box.length>0,tt=nr&&nr.offscreen,ht=nr&&nr.occluded,De.useRuntimeCollisionCircles){const Yr=b.text.placedSymbolArray.get(De.centerJustifiedTextSymbolIndex>=0?De.centerJustifiedTextSymbolIndex:De.verticalPlacedTextSymbolIndex),Or=l.evaluateSizeForFeature(b.textSizeData,oe,Yr),gr=A.get("text-padding");er=this.collisionIndex.placeCollisionCircles(b,ue,Yr,b.lineVertexArray,b.glyphOffsetArray,Or,I,D,N,g,Se,ae.predicate,De.collisionCircleDiameter*Or/l.ONE_EM,gr,this.retainedQueryData[b.bucketInstanceId].tileID),Ze=ue||er.circles.length>0&&!er.collisionDetected,tt=tt&&er.offscreen,ht=er.occluded}if(Ne.iconFeatureIndex&&(zr=Ne.iconFeatureIndex),Ne.iconBox){const Yr=Or=>{Rr(Or);const gr=we&&$t?zc($t.x,$t.y,be,Se,this.transform.angle):new l.Point(0,0),vn=b.getSymbolInstanceIconSize(ie,this.transform.zoom,De.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(b,vn,Or,gr,he,q,I,ae.predicate)};Lt&&Lt.box&&Lt.box.length&&Ne.verticalIconBox?(Pt=Yr(Ne.verticalIconBox),ut=Pt.box.length>0):(Pt=Yr(Ne.iconBox),ut=Pt.box.length>0),tt=tt&&Pt.offscreen,Mt=Pt.occluded}const Gn=Z||De.numHorizontalGlyphVertices===0&&ze===0,ao=re||De.numIconVertices===0;if(Gn||ao?ao?Gn||(ut=ut&&Ze):Ze=ut&&Ze:ut=Ze=ut&&Ze,Ze&&nr&&nr.box&&this.collisionIndex.insertCollisionBox(nr.box,A.get("text-ignore-placement"),b.bucketInstanceId,Lt&&Lt.box&&Mr?Mr:Ar,ae.ID),ut&&Pt&&this.collisionIndex.insertCollisionBox(Pt.box,A.get("icon-ignore-placement"),b.bucketInstanceId,zr,ae.ID),er&&(Ze&&this.collisionIndex.insertCollisionCircles(er.circles,A.get("text-ignore-placement"),b.bucketInstanceId,Ar,ae.ID),g)){const Yr=b.bucketInstanceId;let Or=this.collisionCircleArrays[Yr];Or===void 0&&(Or=this.collisionCircleArrays[Yr]=new Dc);for(let gr=0;gr=0;--Ke){const Ne=De[Ke];st(b.symbolInstances.get(Ne),Ne,b.collisionArrays[Ne])}}else for(let De=s.symbolInstanceStart;De=0&&(s.text.placedSymbolArray.get(b).crossTileID=q>=0&&b!==q?0:N),A>=0&&(s.text.placedSymbolArray.get(A).crossTileID=q>=0&&A!==q?0:N),I>=0&&(s.text.placedSymbolArray.get(I).crossTileID=q>=0&&I!==q?0:N),D>=0&&(s.text.placedSymbolArray.get(D).crossTileID=q>=0&&D!==q?0:N)}markUsedOrientation(s,h,g){const v=h===l.WritingMode.horizontal||h===l.WritingMode.horizontalOnly?h:0,b=h===l.WritingMode.vertical?h:0,{leftJustifiedTextSymbolIndex:A,centerJustifiedTextSymbolIndex:I,rightJustifiedTextSymbolIndex:D,verticalPlacedTextSymbolIndex:N}=g,B=s.text.placedSymbolArray;A>=0&&(B.get(A).placedOrientation=v),I>=0&&(B.get(I).placedOrientation=v),D>=0&&(B.get(D).placedOrientation=v),N>=0&&(B.get(N).placedOrientation=b)}commit(s){this.commitTime=s,this.zoomAtLastRecencyCheck=this.transform.zoom;const h=this.prevPlacement;let g=!1;this.prevZoomAdjustment=h?h.zoomAdjustment(this.transform.zoom):0;const v=h?h.symbolFadeChange(s):1,b=h?h.opacities:{},A=h?h.variableOffsets:{},I=h?h.placedOrientations:{};for(const D in this.placements){const N=this.placements[D],B=b[D];B?(this.opacities[D]=new ba(B,v,N.text,N.icon,null,N.clipped),g=g||N.text!==B.text.placed||N.icon!==B.icon.placed):(this.opacities[D]=new ba(null,v,N.text,N.icon,N.skipFade,N.clipped),g=g||N.text||N.icon)}for(const D in b){const N=b[D];if(!this.opacities[D]){const B=new ba(N,v,!1,!1);B.isHidden()||(this.opacities[D]=B,g=g||N.text.placed||N.icon.placed)}}for(const D in A)this.variableOffsets[D]||!this.opacities[D]||this.opacities[D].isHidden()||(this.variableOffsets[D]=A[D]);for(const D in I)this.placedOrientations[D]||!this.opacities[D]||this.opacities[D].isHidden()||(this.placedOrientations[D]=I[D]);g?this.lastPlacementChangeTime=s:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=h?h.lastPlacementChangeTime:s)}updateLayerOpacities(s,h){const g=new Set;for(const v of h){const b=v.getBucket(s);b&&v.latestFeatureIndex&&s.id===b.layerIds[0]&&this.updateBucketOpacities(b,g,v.collisionBoxArray)}}updateBucketOpacities(s,h,g){s.hasTextData()&&s.text.opacityVertexArray.clear(),s.hasIconData()&&s.icon.opacityVertexArray.clear(),s.hasIconCollisionBoxData()&&s.iconCollisionBox.collisionVertexArray.clear(),s.hasTextCollisionBoxData()&&s.textCollisionBox.collisionVertexArray.clear();const v=s.layers[0].layout,b=!!s.layers[0].dynamicFilter(),A=new ba(null,0,!1,!1,!0),I=v.get("text-allow-overlap"),D=v.get("icon-allow-overlap"),N=v.get("text-variable-anchor"),B=v.get("text-rotation-alignment")==="map",q=v.get("text-pitch-alignment")==="map",J=v.get("icon-text-fit")!=="none",ne=new ba(null,0,I&&(D||!s.hasIconData()||v.get("icon-optional")),D&&(I||!s.hasTextData()||v.get("text-optional")),!0);!s.collisionArrays&&g&&(s.hasIconCollisionBoxData()||s.hasTextCollisionBoxData())&&s.deserializeCollisionBoxes(g);const oe=(ae,Z,re)=>{for(let ue=0;ue0||ue>0,Ie=be>0,Re=this.placedOrientations[he],st=Re===l.WritingMode.vertical,De=Re===l.WritingMode.horizontal||Re===l.WritingMode.horizontalOnly;if(!Ce&&!Ie||we.isHidden()||ie++,Ce){const Ke=Rc(we.text);oe(s.text,re,st?ln:Ke),oe(s.text,ue,De?ln:Ke);const Ne=we.text.isHidden(),{leftJustifiedTextSymbolIndex:at,centerJustifiedTextSymbolIndex:ze,rightJustifiedTextSymbolIndex:Ze,verticalPlacedTextSymbolIndex:ut}=Z,tt=s.text.placedSymbolArray,ht=Ne||st?1:0;at>=0&&(tt.get(at).hidden=ht),ze>=0&&(tt.get(ze).hidden=ht),Ze>=0&&(tt.get(Ze).hidden=ht),ut>=0&&(tt.get(ut).hidden=Ne||De?1:0);const Mt=this.variableOffsets[he];Mt&&this.markUsedJustification(s,Mt.anchor,Z,Re);const $t=this.placedOrientations[he];$t&&(this.markUsedJustification(s,"left",Z,$t),this.markUsedOrientation(s,$t,Z))}if(Ie){const Ke=Rc(we.icon),{placedIconSymbolIndex:Ne,verticalPlacedIconSymbolIndex:at}=Z,ze=s.icon.placedSymbolArray,Ze=we.icon.isHidden()?1:0;Ne>=0&&(oe(s.icon,be,st?ln:Ke),ze.get(Ne).hidden=Ze),at>=0&&(oe(s.icon,Z.numVerticalIconVertices,De?ln:Ke),ze.get(at).hidden=Ze)}if(s.hasIconCollisionBoxData()||s.hasTextCollisionBoxData()){const Ke=s.collisionArrays[ae];if(Ke){let Ne=new l.Point(0,0),at=!0;if(Ke.textBox||Ke.verticalTextBox){if(N){const Ze=this.variableOffsets[he];Ze?(Ne=Mc(Ze.anchor,Ze.width,Ze.height,Ze.textOffset,Ze.textScale),B&&Ne._rotate(q?this.transform.angle:-this.transform.angle)):at=!1}b&&(at=!we.clipped),Ke.textBox&&yl(s.textCollisionBox.collisionVertexArray,we.text.placed,!at||st,Ne.x,Ne.y),Ke.verticalTextBox&&yl(s.textCollisionBox.collisionVertexArray,we.text.placed,!at||De,Ne.x,Ne.y)}const ze=at&&!!(!De&&Ke.verticalIconBox);Ke.iconBox&&yl(s.iconCollisionBox.collisionVertexArray,we.icon.placed,ze,J?Ne.x:0,J?Ne.y:0),Ke.verticalIconBox&&yl(s.iconCollisionBox.collisionVertexArray,we.icon.placed,!ze,J?Ne.x:0,J?Ne.y:0)}}}if(s.fullyClipped=ie===0,s.sortFeatures(this.transform.angle),this.retainedQueryData[s.bucketInstanceId]&&(this.retainedQueryData[s.bucketInstanceId].featureSortOrder=s.featureSortOrder),s.hasTextData()&&s.text.opacityVertexBuffer&&s.text.opacityVertexBuffer.updateData(s.text.opacityVertexArray),s.hasIconData()&&s.icon.opacityVertexBuffer&&s.icon.opacityVertexBuffer.updateData(s.icon.opacityVertexArray),s.hasIconCollisionBoxData()&&s.iconCollisionBox.collisionVertexBuffer&&s.iconCollisionBox.collisionVertexBuffer.updateData(s.iconCollisionBox.collisionVertexArray),s.hasTextCollisionBoxData()&&s.textCollisionBox.collisionVertexBuffer&&s.textCollisionBox.collisionVertexBuffer.updateData(s.textCollisionBox.collisionVertexArray),s.bucketInstanceId in this.collisionCircleArrays){const ae=this.collisionCircleArrays[s.bucketInstanceId];s.placementInvProjMatrix=ae.invProjMatrix,s.placementViewportMatrix=ae.viewportMatrix,s.collisionCircleArray=ae.circles,delete this.collisionCircleArrays[s.bucketInstanceId]}}symbolFadeChange(s){return this.fadeDuration===0?1:(s-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(s){return Math.max(0,(this.transform.zoom-s)/1.5)}hasTransitions(s){return this.stale||s-this.lastPlacementChangeTimes}setStale(){this.stale=!0}}function yl(f,s,h,g,v){f.emplaceBack(s?1:0,h?1:0,g||0,v||0),f.emplaceBack(s?1:0,h?1:0,g||0,v||0),f.emplaceBack(s?1:0,h?1:0,g||0,v||0),f.emplaceBack(s?1:0,h?1:0,g||0,v||0)}const Ci=Math.pow(2,25),fn=Math.pow(2,24),Jd=Math.pow(2,17),ep=Math.pow(2,16),ki=Math.pow(2,9),no=Math.pow(2,8),o0=Math.pow(2,1);function Rc(f){if(f.opacity===0&&!f.placed)return 0;if(f.opacity===1&&f.placed)return 4294967295;const s=f.placed?1:0,h=Math.floor(127*f.opacity);return h*Ci+s*fn+h*Jd+s*ep+h*ki+s*no+h*o0+s}const ln=0;class Oc{constructor(s){this._sortAcrossTiles=s.layout.get("symbol-z-order")!=="viewport-y"&&s.layout.get("symbol-sort-key").constantOr(1)!==void 0,this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs=new Set,this._bucketParts=[]}continuePlacement(s,h,g,v,b){const A=this._bucketParts;for(;this._currentTileIndexI.sortKey-D.sortKey));this._currentPartIndex{const A=l.exported.now()-v;return!this._forceFullPlacement&&A>2};for(;this._currentPlacementIndex>=0;){const A=h[s[this._currentPlacementIndex]],I=this.placement.collisionIndex.transform.zoom;if(A.type==="symbol"&&(!A.minzoom||A.minzoom<=I)&&(!A.maxzoom||A.maxzoom>I)){if(this._inProgressLayer||(this._inProgressLayer=new Oc(A)),this._inProgressLayer.continuePlacement(g[A.source],this.placement,this._showCollisionBoxes,A,b))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(s){return this.placement.commit(s),this.placement}}const Rs=512/l.EXTENT/2;class Jn{constructor(s,h,g){this.tileID=s,this.bucketInstanceId=g,this.index=new l.KDBush(h.length,16,Int32Array),this.keys=[],this.crossTileIDs=[];const v=s.canonical.x*l.EXTENT,b=s.canonical.y*l.EXTENT;for(let A=0;As.overscaledZ)for(const I in A){const D=A[I];D.tileID.isChildOf(s)&&D.findMatches(h.symbolInstances,s,v)}else{const I=A[s.scaledTo(Number(b)).key];I&&I.findMatches(h.symbolInstances,s,v)}}for(let b=0;b{h[g]=!0});for(const g in this.layerIndexes)h[g]||delete this.layerIndexes[g]}}const es=(f,s)=>l.emitValidationErrors(f,s&&s.filter(h=>h.identifier!=="source.canvas")),Gu=l.pick(br,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setProjection"]),Kv=l.pick(br,["setCenter","setZoom","setBearing","setPitch"]),ip={version:8,layers:[],sources:{}},_l={fill:!0,line:!0,background:!0,hillshade:!0,raster:!0};class Xo extends l.Evented{constructor(s,h={}){super(),this.map=s,this.dispatcher=new gt(ml(),this),this.imageManager=new Be,this.imageManager.setEventedParent(this),this.glyphManager=new l.GlyphManager(s._requestManager,h.localFontFamily?l.LocalGlyphMode.all:h.localIdeographFontFamily?l.LocalGlyphMode.ideographs:l.LocalGlyphMode.none,h.localFontFamily||h.localIdeographFontFamily),this.crossTileSymbolIndex=new wa,this._layers={},this._num3DLayers=0,this._numSymbolLayers=0,this._numCircleLayers=0,this._serializedLayers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this._loaded=!1,this._availableImages=[],this._order=[],this._drapedFirstOrder=[],this._markersNeedUpdate=!1,this._resetUpdates(),this.dispatcher.broadcast("setReferrer",l.getReferrer());const g=this;this._rtlTextPluginCallback=Xo.registerForPluginStateChange(v=>{g.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:v.pluginStatus,pluginURL:v.pluginURL},(b,A)=>{if(l.triggerPluginCompletionEvent(b),A&&A.every(I=>I))for(const I in g._sourceCaches){const D=g._sourceCaches[I],N=D.getSource().type;N!=="vector"&&N!=="geojson"||D.reload()}})}),this.on("data",v=>{if(v.dataType!=="source"||v.sourceDataType!=="metadata")return;const b=this.getSource(v.sourceId);if(b&&b.vectorLayerIds)for(const A in this._layers){const I=this._layers[A];I.source===b.id&&this._validateLayer(I)}})}loadURL(s,h={}){this.fire(new l.Event("dataloading",{dataType:"style"}));const g=typeof h.validate=="boolean"?h.validate:!l.isMapboxURL(s);s=this.map._requestManager.normalizeStyleURL(s,h.accessToken);const v=this.map._requestManager.transformRequest(s,l.ResourceType.Style);this._request=l.getJSON(v,(b,A)=>{this._request=null,b?this.fire(new l.ErrorEvent(b)):A&&this._load(A,g)})}loadJSON(s,h={}){this.fire(new l.Event("dataloading",{dataType:"style"})),this._request=l.exported.frame(()=>{this._request=null,this._load(s,h.validate!==!1)})}loadEmpty(){this.fire(new l.Event("dataloading",{dataType:"style"})),this._load(ip,!1)}_updateLayerCount(s,h){const g=h?1:-1;s.is3D()&&(this._num3DLayers+=g),s.type==="circle"&&(this._numCircleLayers+=g),s.type==="symbol"&&(this._numSymbolLayers+=g)}_load(s,h){if(h&&es(this,l.validateStyle(s)))return;this._loaded=!0,this.stylesheet=l.clone$1(s),this._updateMapProjection();for(const v in s.sources)this.addSource(v,s.sources[v],{validate:!1});this._changed=!1,s.sprite?this._loadSprite(s.sprite):(this.imageManager.setLoaded(!0),this.dispatcher.broadcast("spriteLoaded",!0)),this.glyphManager.setURL(s.glyphs);const g=e0(this.stylesheet.layers);this._order=g.map(v=>v.id),this._layers={},this._serializedLayers={};for(const v of g){const b=l.createStyleLayer(v);b.setEventedParent(this,{layer:{id:b.id}}),this._layers[b.id]=b,this._serializedLayers[b.id]=b.serialize(),this._updateLayerCount(b,!0)}this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new Ve(this.stylesheet.light),this.stylesheet.terrain&&!this.terrainSetForDrapingOnly()&&this._createTerrain(this.stylesheet.terrain,1),this.stylesheet.fog&&this._createFog(this.stylesheet.fog),this._updateDrapeFirstLayers(),this.fire(new l.Event("data",{dataType:"style"})),this.fire(new l.Event("style.load"))}terrainSetForDrapingOnly(){return!!this.terrain&&this.terrain.drapeRenderMode===0}setProjection(s){s?this.stylesheet.projection=s:delete this.stylesheet.projection,this._updateMapProjection()}applyProjectionUpdate(){this._loaded&&(this.dispatcher.broadcast("setProjection",this.map.transform.projectionOptions),this.map.transform.projection.requiresDraping?this.getTerrain()||this.stylesheet.terrain||this.setTerrainForDraping():this.terrainSetForDrapingOnly()&&this.setTerrain(null))}_updateMapProjection(){this.map._useExplicitProjection?this.applyProjectionUpdate():this.map._prioritizeAndUpdateProjection(null,this.stylesheet.projection)}_loadSprite(s){this._spriteRequest=function(h,g,v){let b,A,I;const D=l.exported.devicePixelRatio>1?"@2x":"";let N=l.getJSON(g.transformRequest(g.normalizeSpriteURL(h,D,".json"),l.ResourceType.SpriteJSON),(J,ne)=>{N=null,I||(I=J,b=ne,q())}),B=l.getImage(g.transformRequest(g.normalizeSpriteURL(h,D,".png"),l.ResourceType.SpriteImage),(J,ne)=>{B=null,I||(I=J,A=ne,q())});function q(){if(I)v(I);else if(b&&A){const J=l.exported.getImageData(A),ne={};for(const oe in b){const{width:ie,height:ae,x:Z,y:re,sdf:ue,pixelRatio:he,stretchX:be,stretchY:Se,content:we}=b[oe],Ce=new l.RGBAImage({width:ie,height:ae});l.RGBAImage.copy(J,Ce,{x:Z,y:re},{x:0,y:0},{width:ie,height:ae}),ne[oe]={data:Ce,pixelRatio:he,sdf:ue,stretchX:be,stretchY:Se,content:we}}v(null,ne)}}return{cancel(){N&&(N.cancel(),N=null),B&&(B.cancel(),B=null)}}}(s,this.map._requestManager,(h,g)=>{if(this._spriteRequest=null,h)this.fire(new l.ErrorEvent(h));else if(g)for(const v in g)this.imageManager.addImage(v,g[v]);this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),this.dispatcher.broadcast("setImages",this._availableImages),this.dispatcher.broadcast("spriteLoaded",!0),this.fire(new l.Event("data",{dataType:"style"}))})}_validateLayer(s){const h=this.getSource(s.source);if(!h)return;const g=s.sourceLayer;g&&(h.type==="geojson"||h.vectorLayerIds&&h.vectorLayerIds.indexOf(g)===-1)&&this.fire(new l.ErrorEvent(new Error(`Source layer "${g}" does not exist on source "${h.id}" as specified by style layer "${s.id}"`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const s in this._sourceCaches)if(!this._sourceCaches[s].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeLayers(s){const h=[];for(const g of s){const v=this._layers[g];v.type!=="custom"&&h.push(v.serialize())}return h}hasTransitions(){if(this.light&&this.light.hasTransition()||this.fog&&this.fog.hasTransition())return!0;for(const s in this._sourceCaches)if(this._sourceCaches[s].hasTransition())return!0;for(const s in this._layers)if(this._layers[s].hasTransition())return!0;return!1}get order(){return this.map._optimizeForTerrain&&this.terrain?this._drapedFirstOrder:this._order}isLayerDraped(s){return!!this.terrain&&(typeof s.isLayerDraped=="function"?s.isLayerDraped():_l[s.type])}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading")}update(s){if(!this._loaded)return;const h=this._changed;if(this._changed){const v=Object.keys(this._updatedLayers),b=Object.keys(this._removedLayers);(v.length||b.length)&&this._updateWorkerLayers(v,b);for(const A in this._updatedSources){const I=this._updatedSources[A];I==="reload"?this._reloadSource(A):I==="clear"&&this._clearSource(A)}this._updateTilesForChangedImages();for(const A in this._updatedPaintProps)this._layers[A].updateTransitions(s);this.light.updateTransitions(s),this.fog&&this.fog.updateTransitions(s),this._resetUpdates()}const g={};for(const v in this._sourceCaches){const b=this._sourceCaches[v];g[v]=b.used,b.used=!1}for(const v of this._order){const b=this._layers[v];if(b.recalculate(s,this._availableImages),!b.isHidden(s.zoom)){const I=this._getLayerSourceCache(b);I&&(I.used=!0)}const A=this.map.painter;if(A){const I=b.getProgramIds();if(!I)continue;const D=b.getProgramConfiguration(s.zoom);for(const N of I)A.useProgram(N,D)}}for(const v in g){const b=this._sourceCaches[v];g[v]!==b.used&&b.getSource().fire(new l.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:b.getSource().id}))}this.light.recalculate(s),this.terrain&&this.terrain.recalculate(s),this.fog&&this.fog.recalculate(s),this.z=s.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),h&&this.fire(new l.Event("data",{dataType:"style"}))}_updateTilesForChangedImages(){const s=Object.keys(this._changedImages);if(s.length){for(const h in this._sourceCaches)this._sourceCaches[h].reloadTilesForDependencies(["icons","patterns"],s);this._changedImages={}}}_updateWorkerLayers(s,h){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(s),removedIds:h})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={}}setState(s){if(this._checkLoaded(),es(this,l.validateStyle(s)))return!1;(s=l.clone$1(s)).layers=e0(s.layers);const h=function(v,b){if(!v)return[{command:br.setStyle,args:[b]}];let A=[];try{if(!w(v.version,b.version))return[{command:br.setStyle,args:[b]}];w(v.center,b.center)||A.push({command:br.setCenter,args:[b.center]}),w(v.zoom,b.zoom)||A.push({command:br.setZoom,args:[b.zoom]}),w(v.bearing,b.bearing)||A.push({command:br.setBearing,args:[b.bearing]}),w(v.pitch,b.pitch)||A.push({command:br.setPitch,args:[b.pitch]}),w(v.sprite,b.sprite)||A.push({command:br.setSprite,args:[b.sprite]}),w(v.glyphs,b.glyphs)||A.push({command:br.setGlyphs,args:[b.glyphs]}),w(v.transition,b.transition)||A.push({command:br.setTransition,args:[b.transition]}),w(v.light,b.light)||A.push({command:br.setLight,args:[b.light]}),w(v.fog,b.fog)||A.push({command:br.setFog,args:[b.fog]}),w(v.projection,b.projection)||A.push({command:br.setProjection,args:[b.projection]});const I={},D=[];(function(q,J,ne,oe){let ie;for(ie in J=J||{},q=q||{})q.hasOwnProperty(ie)&&(J.hasOwnProperty(ie)||Ic(ie,ne,oe));for(ie in J){if(!J.hasOwnProperty(ie))continue;const ae=J[ie];q.hasOwnProperty(ie)?w(q[ie],ae)||(q[ie].type==="geojson"&&ae.type==="geojson"&&$u(q,J,ie)?ne.push({command:br.setGeoJSONSourceData,args:[ie,ae.data]}):Zd(ie,J,ne,oe)):qd(ie,J,ne)}})(v.sources,b.sources,D,I);const N=[];v.layers&&v.layers.forEach(q=>{q.source&&I[q.source]?A.push({command:br.removeLayer,args:[q.id]}):N.push(q)});let B=v.terrain;B&&I[B.source]&&(A.push({command:br.setTerrain,args:[void 0]}),B=void 0),A=A.concat(D),w(B,b.terrain)||A.push({command:br.setTerrain,args:[b.terrain]}),function(q,J,ne){J=J||[];const oe=(q=q||[]).map(_a),ie=J.map(_a),ae=q.reduce(Kd,{}),Z=J.reduce(Kd,{}),re=oe.slice(),ue=Object.create(null);let he,be,Se,we,Ce,Ie,Re;for(he=0,be=0;he!(v.command in Kv));if(h.length===0)return!1;const g=h.filter(v=>!(v.command in Gu));if(g.length>0)throw new Error(`Unimplemented: ${g.map(v=>v.command).join(", ")}.`);return h.forEach(v=>{v.command!=="setTransition"&&v.command!=="setProjection"&&this[v.command].apply(this,v.args)}),this.stylesheet=s,this._updateMapProjection(),!0}addImage(s,h){return this.getImage(s)?this.fire(new l.ErrorEvent(new Error("An image with this name already exists."))):(this.imageManager.addImage(s,h),this._afterImageUpdated(s),this)}updateImage(s,h){this.imageManager.updateImage(s,h)}getImage(s){return this.imageManager.getImage(s)}removeImage(s){return this.getImage(s)?(this.imageManager.removeImage(s),this._afterImageUpdated(s),this):this.fire(new l.ErrorEvent(new Error("No image with this name exists.")))}_afterImageUpdated(s){this._availableImages=this.imageManager.listImages(),this._changedImages[s]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new l.Event("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this._availableImages.slice()}addSource(s,h,g={}){if(this._checkLoaded(),this.getSource(s)!==void 0)throw new Error("There is already a source with this ID");if(!h.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(h).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(h.type)>=0&&this._validate(l.validateSource,`sources.${s}`,h,null,g))return;this.map&&this.map._collectResourceTiming&&(h.collectResourceTiming=!0);const v=Qt(s,h,this.dispatcher,this);v.setEventedParent(this,()=>({isSourceLoaded:this._isSourceCacheLoaded(s),source:v.serialize(),sourceId:s}));const b=A=>{const I=(A?"symbol:":"other:")+s,D=this._sourceCaches[I]=new l.SourceCache(I,v,A);(A?this._symbolSourceCaches:this._otherSourceCaches)[s]=D,D.style=this,D.onAdd(this.map)};b(!1),h.type!=="vector"&&h.type!=="geojson"||b(!0),v.onAdd&&v.onAdd(this.map),this._changed=!0}removeSource(s){this._checkLoaded();const h=this.getSource(s);if(!h)throw new Error("There is no source with this ID");for(const v in this._layers)if(this._layers[v].source===s)return this.fire(new l.ErrorEvent(new Error(`Source "${s}" cannot be removed while layer "${v}" is using it.`)));if(this.terrain&&this.terrain.get().source===s)return this.fire(new l.ErrorEvent(new Error(`Source "${s}" cannot be removed while terrain is using it.`)));const g=this._getSourceCaches(s);for(const v of g)delete this._sourceCaches[v.id],delete this._updatedSources[v.id],v.fire(new l.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:v.getSource().id})),v.setEventedParent(null),v.clearTiles();return delete this._otherSourceCaches[s],delete this._symbolSourceCaches[s],h.setEventedParent(null),h.onRemove&&h.onRemove(this.map),this._changed=!0,this}setGeoJSONSourceData(s,h){this._checkLoaded(),this.getSource(s).setData(h),this._changed=!0}getSource(s){const h=this._getSourceCache(s);return h&&h.getSource()}_getSources(){const s=[];for(const h in this._otherSourceCaches){const g=this._getSourceCache(h);g&&s.push(g.getSource())}return s}addLayer(s,h,g={}){this._checkLoaded();const v=s.id;if(this.getLayer(v))return void this.fire(new l.ErrorEvent(new Error(`Layer with id "${v}" already exists on this map`)));let b;if(s.type==="custom"){if(es(this,l.validateCustomStyleLayer(s)))return;b=l.createStyleLayer(s)}else{if(typeof s.source=="object"&&(this.addSource(v,s.source),s=l.clone$1(s),s=l.extend(s,{source:v})),this._validate(l.validateLayer,`layers.${v}`,s,{arrayIndex:-1},g))return;b=l.createStyleLayer(s),this._validateLayer(b),b.setEventedParent(this,{layer:{id:v}}),this._serializedLayers[b.id]=b.serialize(),this._updateLayerCount(b,!0)}const A=h?this._order.indexOf(h):this._order.length;if(h&&A===-1)return void this.fire(new l.ErrorEvent(new Error(`Layer with id "${h}" does not exist on this map.`)));this._order.splice(A,0,v),this._layerOrderChanged=!0,this._layers[v]=b;const I=this._getLayerSourceCache(b);if(this._removedLayers[v]&&b.source&&I&&b.type!=="custom"){const D=this._removedLayers[v];delete this._removedLayers[v],D.type!==b.type?this._updatedSources[b.source]="clear":(this._updatedSources[b.source]="reload",I.pause())}this._updateLayer(b),b.onAdd&&b.onAdd(this.map),this._updateDrapeFirstLayers()}moveLayer(s,h){if(this._checkLoaded(),this._changed=!0,!this._layers[s])return void this.fire(new l.ErrorEvent(new Error(`The layer '${s}' does not exist in the map's style and cannot be moved.`)));if(s===h)return;const g=this._order.indexOf(s);this._order.splice(g,1);const v=h?this._order.indexOf(h):this._order.length;h&&v===-1?this.fire(new l.ErrorEvent(new Error(`Layer with id "${h}" does not exist on this map.`))):(this._order.splice(v,0,s),this._layerOrderChanged=!0,this._updateDrapeFirstLayers())}removeLayer(s){this._checkLoaded();const h=this._layers[s];if(!h)return void this.fire(new l.ErrorEvent(new Error(`The layer '${s}' does not exist in the map's style and cannot be removed.`)));h.setEventedParent(null),this._updateLayerCount(h,!1);const g=this._order.indexOf(s);this._order.splice(g,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[s]=h,delete this._layers[s],delete this._serializedLayers[s],delete this._updatedLayers[s],delete this._updatedPaintProps[s],h.onRemove&&h.onRemove(this.map),this._updateDrapeFirstLayers()}getLayer(s){return this._layers[s]}hasLayer(s){return s in this._layers}hasLayerType(s){for(const h in this._layers)if(this._layers[h].type===s)return!0;return!1}setLayerZoomRange(s,h,g){this._checkLoaded();const v=this.getLayer(s);v?v.minzoom===h&&v.maxzoom===g||(h!=null&&(v.minzoom=h),g!=null&&(v.maxzoom=g),this._updateLayer(v)):this.fire(new l.ErrorEvent(new Error(`The layer '${s}' does not exist in the map's style and cannot have zoom extent.`)))}setFilter(s,h,g={}){this._checkLoaded();const v=this.getLayer(s);if(v){if(!w(v.filter,h))return h==null?(v.filter=void 0,void this._updateLayer(v)):void(this._validate(l.validateFilter,`layers.${v.id}.filter`,h,{layerType:v.type},g)||(v.filter=l.clone$1(h),this._updateLayer(v)))}else this.fire(new l.ErrorEvent(new Error(`The layer '${s}' does not exist in the map's style and cannot be filtered.`)))}getFilter(s){const h=this.getLayer(s);return h&&l.clone$1(h.filter)}setLayoutProperty(s,h,g,v={}){this._checkLoaded();const b=this.getLayer(s);b?w(b.getLayoutProperty(h),g)||(b.setLayoutProperty(h,g,v),this._updateLayer(b)):this.fire(new l.ErrorEvent(new Error(`The layer '${s}' does not exist in the map's style and cannot be styled.`)))}getLayoutProperty(s,h){const g=this.getLayer(s);if(g)return g.getLayoutProperty(h);this.fire(new l.ErrorEvent(new Error(`The layer '${s}' does not exist in the map's style.`)))}setPaintProperty(s,h,g,v={}){this._checkLoaded();const b=this.getLayer(s);b?w(b.getPaintProperty(h),g)||(b.setPaintProperty(h,g,v)&&this._updateLayer(b),this._changed=!0,this._updatedPaintProps[s]=!0):this.fire(new l.ErrorEvent(new Error(`The layer '${s}' does not exist in the map's style and cannot be styled.`)))}getPaintProperty(s,h){const g=this.getLayer(s);return g&&g.getPaintProperty(h)}setFeatureState(s,h){this._checkLoaded();const g=s.source,v=s.sourceLayer,b=this.getSource(g);if(!b)return void this.fire(new l.ErrorEvent(new Error(`The source '${g}' does not exist in the map's style.`)));const A=b.type;if(A==="geojson"&&v)return void this.fire(new l.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));if(A==="vector"&&!v)return void this.fire(new l.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));s.id===void 0&&this.fire(new l.ErrorEvent(new Error("The feature id parameter must be provided.")));const I=this._getSourceCaches(g);for(const D of I)D.setFeatureState(v,s.id,h)}removeFeatureState(s,h){this._checkLoaded();const g=s.source,v=this.getSource(g);if(!v)return void this.fire(new l.ErrorEvent(new Error(`The source '${g}' does not exist in the map's style.`)));const b=v.type,A=b==="vector"?s.sourceLayer:void 0;if(b==="vector"&&!A)return void this.fire(new l.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));if(h&&typeof s.id!="string"&&typeof s.id!="number")return void this.fire(new l.ErrorEvent(new Error("A feature id is required to remove its specific state property.")));const I=this._getSourceCaches(g);for(const D of I)D.removeFeatureState(A,s.id,h)}getFeatureState(s){this._checkLoaded();const h=s.source,g=s.sourceLayer,v=this.getSource(h);if(v){if(v.type!=="vector"||g)return s.id===void 0&&this.fire(new l.ErrorEvent(new Error("The feature id parameter must be provided."))),this._getSourceCaches(h)[0].getFeatureState(g,s.id);this.fire(new l.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new l.ErrorEvent(new Error(`The source '${h}' does not exist in the map's style.`)))}getTransition(){return l.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){const s={};for(const h in this._sourceCaches){const g=this._sourceCaches[h].getSource();s[g.id]||(s[g.id]=g.serialize())}return l.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,terrain:this.getTerrain()||void 0,fog:this.stylesheet.fog,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,projection:this.stylesheet.projection,sources:s,layers:this._serializeLayers(this._order)},h=>h!==void 0)}_updateLayer(s){this._updatedLayers[s.id]=!0;const h=this._getLayerSourceCache(s);s.source&&!this._updatedSources[s.source]&&h&&h.getSource().type!=="raster"&&(this._updatedSources[s.source]="reload",h.pause()),this._changed=!0,s.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(s){const h=A=>this._layers[A].type==="fill-extrusion",g={},v=[];for(let A=this._order.length-1;A>=0;A--){const I=this._order[A];if(h(I)){g[I]=A;for(const D of s){const N=D[I];if(N)for(const B of N)v.push(B)}}}v.sort((A,I)=>I.intersectionZ-A.intersectionZ);const b=[];for(let A=this._order.length-1;A>=0;A--){const I=this._order[A];if(h(I))for(let D=v.length-1;D>=0;D--){const N=v[D].feature;if(g[N.layer.id]{const N=this.getLayer(D);return N&&N.is3D()}):this.has3DLayers(),I=et.createFromScreenPoints(s,g);for(const D in this._sourceCaches){const N=this._sourceCaches[D].getSource().id;h.layers&&!v[N]||b.push(en(this._sourceCaches[D],this._layers,this._serializedLayers,I,h,g,A,!!this.map._showQueryGeometry))}return this.placement&&b.push(function(D,N,B,q,J,ne,oe){const ie={},ae=ne.queryRenderedSymbols(q),Z=[];for(const re of Object.keys(ae).map(Number))Z.push(oe[re]);Z.sort(li);for(const re of Z){const ue=re.featureIndex.lookupSymbolFeatures(ae[re.bucketInstanceId],N,re.bucketIndex,re.sourceLayerIndex,J.filter,J.layers,J.availableImages,D);for(const he in ue){const be=ie[he]=ie[he]||[],Se=ue[he];Se.sort((we,Ce)=>{const Ie=re.featureSortOrder;if(Ie){const Re=Ie.indexOf(we.featureIndex);return Ie.indexOf(Ce.featureIndex)-Re}return Ce.featureIndex-we.featureIndex});for(const we of Se)be.push(we)}}for(const re in ie)ie[re].forEach(ue=>{const he=ue.feature,be=B(D[re]);if(!be)return;const Se=be.getFeatureState(he.layer["source-layer"],he.id);he.source=he.layer.source,he.layer["source-layer"]&&(he.sourceLayer=he.layer["source-layer"]),he.state=Se});return ie}(this._layers,this._serializedLayers,this._getLayerSourceCache.bind(this),I.screenGeometry,h,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(b)}querySourceFeatures(s,h){h&&h.filter&&this._validate(l.validateFilter,"querySourceFeatures.filter",h.filter,null,h);const g=this._getSourceCaches(s);let v=[];for(const b of g)v=v.concat(yn(b,h));return v}addSourceType(s,h,g){return Xo.getSourceType(s)?g(new Error(`A source type called "${s}" already exists.`)):(Xo.setSourceType(s,h),h.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:s,url:h.workerSourceURL},g):g(null,null))}getLight(){return this.light.getLight()}setLight(s,h={}){this._checkLoaded();const g=this.light.getLight();let v=!1;for(const A in s)if(!w(s[A],g[A])){v=!0;break}if(!v)return;const b=this._setTransitionParameters({duration:300,delay:0});this.light.setLight(s,h),this.light.updateTransitions(b)}getTerrain(){return this.terrain&&this.terrain.drapeRenderMode===1?this.terrain.get():null}setTerrainForDraping(){this.setTerrain({source:"",exaggeration:0},0)}setTerrain(s,h=1){if(this._checkLoaded(),!s)return delete this.terrain,delete this.stylesheet.terrain,this.dispatcher.broadcast("enableTerrain",!1),this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);let g=s;if(h===1){if(typeof g.source=="object"){const v="terrain-dem-src";this.addSource(v,g.source),g=l.clone$1(g),g=l.extend(g,{source:v})}if(this._validate(l.validateTerrain,"terrain",g))return}if(!this.terrain||this.terrain&&h!==this.terrain.drapeRenderMode){if(!g)return;this._createTerrain(g,h)}else{const v=this.terrain,b=v.get();for(const A of Object.keys(l.spec.terrain))!g.hasOwnProperty(A)&&l.spec.terrain[A].default&&(g[A]=l.spec.terrain[A].default);for(const A in g)if(!w(g[A],b[A])){v.set(g),this.stylesheet.terrain=g;const I=this._setTransitionParameters({duration:0});v.updateTransitions(I);break}}this._updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(s){const h=this.fog=new Tt(s,this.map.transform);this.stylesheet.fog=s;const g=this._setTransitionParameters({duration:0});h.updateTransitions(g)}_updateMarkersOpacity(){this.map._markers.length!==0&&this.map._requestDomTask(()=>{for(const s of this.map._markers)s._evaluateOpacity()})}getFog(){return this.fog?this.fog.get():null}setFog(s){if(this._checkLoaded(),!s)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){const h=this.fog,g=h.get();Object.keys(s).length===0&&h.set(s);for(const v in s)if(!w(s[v],g[v])){h.set(s),this.stylesheet.fog=s;const b=this._setTransitionParameters({duration:0});h.updateTransitions(b);break}}else this._createFog(s);this._markersNeedUpdate=!0}_setTransitionParameters(s){return{now:l.exported.now(),transition:l.extend(s,this.stylesheet.transition)}}_updateDrapeFirstLayers(){if(!this.map._optimizeForTerrain||!this.terrain)return;const s=this._order.filter(g=>this.isLayerDraped(this._layers[g])),h=this._order.filter(g=>!this.isLayerDraped(this._layers[g]));this._drapedFirstOrder=[],this._drapedFirstOrder.push(...s),this._drapedFirstOrder.push(...h)}_createTerrain(s,h){const g=this.terrain=new Dt(s,h);this.stylesheet.terrain=s,this.dispatcher.broadcast("enableTerrain",!this.terrainSetForDrapingOnly()),this._force3DLayerUpdate();const v=this._setTransitionParameters({duration:0});g.updateTransitions(v)}_force3DLayerUpdate(){for(const s in this._layers){const h=this._layers[s];h.type==="fill-extrusion"&&this._updateLayer(h)}}_forceSymbolLayerUpdate(){for(const s in this._layers){const h=this._layers[s];h.type==="symbol"&&this._updateLayer(h)}}_validate(s,h,g,v,b={}){return(!b||b.validate!==!1)&&es(this,s.call(l.validateStyle,l.extend({key:h,style:this.serialize(),value:g,styleSpec:l.spec},v)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),l.evented.off("pluginStateChange",this._rtlTextPluginCallback);for(const s in this._layers)this._layers[s].setEventedParent(null);for(const s in this._sourceCaches)this._sourceCaches[s].clearTiles(),this._sourceCaches[s].setEventedParent(null);this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove()}_clearSource(s){const h=this._getSourceCaches(s);for(const g of h)g.clearTiles()}_reloadSource(s){const h=this._getSourceCaches(s);for(const g of h)g.resume(),g.reload()}_reloadSources(){for(const s of this._getSources())s.reload&&s.reload()}_updateSources(s){for(const h in this._sourceCaches)this._sourceCaches[h].update(s)}_generateCollisionBoxes(){for(const s in this._sourceCaches){const h=this._sourceCaches[s];h.resume(),h.reload()}}_updatePlacement(s,h,g,v,b=!1){let A=!1,I=!1;const D={};for(const N of this._order){const B=this._layers[N];if(B.type!=="symbol")continue;if(!D[B.source]){const J=this._getLayerSourceCache(B);if(!J)continue;D[B.source]=J.getRenderableIds(!0).map(ne=>J.getTileByID(ne)).sort((ne,oe)=>oe.tileID.overscaledZ-ne.tileID.overscaledZ||(ne.tileID.isLessThan(oe.tileID)?-1:1))}const q=this.crossTileSymbolIndex.addLayer(B,D[B.source],s.center.lng,s.projection);A=A||q}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),b=b||this._layerOrderChanged||g===0,this._layerOrderChanged&&this.fire(new l.Event("neworder")),(b||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(l.exported.now(),s.zoom))&&(this.pauseablePlacement=new tp(s,this._order,b,h,g,v,this.placement,this.fog&&s.projection.supportsFog?this.fog.state:null),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,D),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(l.exported.now()),I=!0),A&&this.pauseablePlacement.placement.setStale()),I||A)for(const N of this._order){const B=this._layers[N];B.type==="symbol"&&this.placement.updateLayerOpacities(B,D[B.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(l.exported.now())}_releaseSymbolFadeTiles(){for(const s in this._sourceCaches)this._sourceCaches[s].releaseSymbolFadeTiles()}getImages(s,h,g){this.imageManager.getImages(h.icons,g),this._updateTilesForChangedImages();const v=b=>{b&&b.setDependencies(h.tileID.key,h.type,h.icons)};v(this._otherSourceCaches[h.source]),v(this._symbolSourceCaches[h.source])}getGlyphs(s,h,g){this.glyphManager.getGlyphs(h.stacks,g)}getResource(s,h,g){return l.makeRequest(h,g)}_getSourceCache(s){return this._otherSourceCaches[s]}_getLayerSourceCache(s){return s.type==="symbol"?this._symbolSourceCaches[s.source]:this._otherSourceCaches[s.source]}_getSourceCaches(s){const h=[];return this._otherSourceCaches[s]&&h.push(this._otherSourceCaches[s]),this._symbolSourceCaches[s]&&h.push(this._symbolSourceCaches[s]),h}_isSourceCacheLoaded(s){const h=this._getSourceCaches(s);return h.length===0?(this.fire(new l.ErrorEvent(new Error(`There is no source with ID '${s}'`))),!1):h.every(g=>g.loaded())}has3DLayers(){return this._num3DLayers>0}hasSymbolLayers(){return this._numSymbolLayers>0}hasCircleLayers(){return this._numCircleLayers>0}_clearWorkerCaches(){this.dispatcher.broadcast("clearCaches")}destroy(){this._clearWorkerCaches(),this.terrainSetForDrapingOnly()&&(delete this.terrain,delete this.stylesheet.terrain)}}Xo.getSourceType=function(f){return Wt[f]},Xo.setSourceType=function(f,s){Wt[f]=s},Xo.registerForPluginStateChange=l.registerForPluginStateChange;var op=` +#define EPSILON 0.0000001 +#define PI 3.141592653589793 +#define EXTENT 8192.0 +#define HALF_PI PI/2.0 +#define QUARTER_PI PI/4.0 +#define RAD_TO_DEG 180.0/PI +#define DEG_TO_RAD PI/180.0 +#define GLOBE_RADIUS EXTENT/PI/2.0`,Os="attribute highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;varying highp vec3 v_uv;void main() {const mat3 half_neg_pi_around_x=mat3(1.0,0.0, 0.0,0.0,0.0,-1.0,0.0,1.0, 0.0);v_uv=half_neg_pi_around_x*a_pos_3f;vec4 pos=u_matrix*vec4(a_pos_3f,1.0);gl_Position=pos.xyww;}",Ea=` +#define ELEVATION_SCALE 7.0 +#define ELEVATION_OFFSET 450.0 +#ifdef PROJECTION_GLOBE_VIEW +uniform vec3 u_tile_tl_up;uniform vec3 u_tile_tr_up;uniform vec3 u_tile_br_up;uniform vec3 u_tile_bl_up;uniform float u_tile_up_scale;vec3 elevationVector(vec2 pos) {vec2 uv=pos/EXTENT;vec3 up=normalize(mix( +mix(u_tile_tl_up,u_tile_tr_up,uv.xxx),mix(u_tile_bl_up,u_tile_br_up,uv.xxx),uv.yyy));return up*u_tile_up_scale;} +#else +vec3 elevationVector(vec2 pos) { return vec3(0,0,1); } +#endif +const float skirtOffset=24575.0;vec3 decomposeToPosAndSkirt(vec2 posWithComposedSkirt) +{float skirt=float(posWithComposedSkirt.x >=skirtOffset);vec2 pos=posWithComposedSkirt-vec2(skirt*skirtOffset,0.0);return vec3(pos,skirt);} +#ifdef TERRAIN +#ifdef TERRAIN_DEM_FLOAT_FORMAT +uniform highp sampler2D u_dem;uniform highp sampler2D u_dem_prev; +#else +uniform sampler2D u_dem;uniform sampler2D u_dem_prev; +#endif +uniform vec4 u_dem_unpack;uniform vec2 u_dem_tl;uniform vec2 u_dem_tl_prev;uniform float u_dem_scale;uniform float u_dem_scale_prev;uniform float u_dem_size;uniform float u_dem_lerp;uniform float u_exaggeration;uniform float u_meter_to_dem;uniform mat4 u_label_plane_matrix_inv;uniform sampler2D u_depth;uniform vec2 u_depth_size_inv;vec4 tileUvToDemSample(vec2 uv,float dem_size,float dem_scale,vec2 dem_tl) {vec2 pos=dem_size*(uv*dem_scale+dem_tl)+1.0;vec2 f=fract(pos);return vec4((pos-f+0.5)/(dem_size+2.0),f);}float decodeElevation(vec4 v) {return dot(vec4(v.xyz*255.0,-1.0),u_dem_unpack);}float currentElevation(vec2 apos) { +#ifdef TERRAIN_DEM_FLOAT_FORMAT +vec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale+u_dem_tl)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture2D(u_dem,pos).a; +#else +float dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale,u_dem_tl);vec2 pos=r.xy;vec2 f=r.zw;float tl=decodeElevation(texture2D(u_dem,pos)); +#ifdef TERRAIN_DEM_NEAREST_FILTER +return u_exaggeration*tl; +#endif +float tr=decodeElevation(texture2D(u_dem,pos+vec2(dd,0.0)));float bl=decodeElevation(texture2D(u_dem,pos+vec2(0.0,dd)));float br=decodeElevation(texture2D(u_dem,pos+vec2(dd,dd)));return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y); +#endif +}float prevElevation(vec2 apos) { +#ifdef TERRAIN_DEM_FLOAT_FORMAT +vec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale_prev+u_dem_tl_prev)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture2D(u_dem_prev,pos).a; +#else +float dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale_prev,u_dem_tl_prev);vec2 pos=r.xy;vec2 f=r.zw;float tl=decodeElevation(texture2D(u_dem_prev,pos));float tr=decodeElevation(texture2D(u_dem_prev,pos+vec2(dd,0.0)));float bl=decodeElevation(texture2D(u_dem_prev,pos+vec2(0.0,dd)));float br=decodeElevation(texture2D(u_dem_prev,pos+vec2(dd,dd)));return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y); +#endif +} +#ifdef TERRAIN_VERTEX_MORPHING +float elevation(vec2 apos) { +#ifdef ZERO_EXAGGERATION +return 0.0; +#endif +float nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);} +#else +float elevation(vec2 apos) { +#ifdef ZERO_EXAGGERATION +return 0.0; +#endif +return currentElevation(apos);} +#endif +highp float unpack_depth(highp vec4 rgba_depth) +{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}bool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w;float depth=unpack_depth(texture2D(u_depth,(coord.xy+1.0)*0.5));return coord.z > depth+0.0005;}float occlusionFade(vec4 frag) {vec3 coord=frag.xyz/frag.w;vec3 df=vec3(5.0*u_depth_size_inv,0.0);vec2 uv=0.5*coord.xy+0.5;vec4 depth=vec4( +unpack_depth(texture2D(u_depth,uv-df.xz)),unpack_depth(texture2D(u_depth,uv+df.xz)),unpack_depth(texture2D(u_depth,uv-df.zy)),unpack_depth(texture2D(u_depth,uv+df.zy)) +);return dot(vec4(0.25),vec4(1.0)-clamp(300.0*(vec4(coord.z-0.001)-depth),0.0,1.0));}vec4 fourSample(vec2 pos,vec2 off) { +#ifdef TERRAIN_DEM_FLOAT_FORMAT +float tl=texture2D(u_dem,pos).a;float tr=texture2D(u_dem,pos+vec2(off.x,0.0)).a;float bl=texture2D(u_dem,pos+vec2(0.0,off.y)).a;float br=texture2D(u_dem,pos+off).a; +#else +vec4 demtl=vec4(texture2D(u_dem,pos).xyz*255.0,-1.0);float tl=dot(demtl,u_dem_unpack);vec4 demtr=vec4(texture2D(u_dem,pos+vec2(off.x,0.0)).xyz*255.0,-1.0);float tr=dot(demtr,u_dem_unpack);vec4 dembl=vec4(texture2D(u_dem,pos+vec2(0.0,off.y)).xyz*255.0,-1.0);float bl=dot(dembl,u_dem_unpack);vec4 dembr=vec4(texture2D(u_dem,pos+off).xyz*255.0,-1.0);float br=dot(dembr,u_dem_unpack); +#endif +return vec4(tl,tr,bl,br);}float flatElevation(vec2 pack) {vec2 apos=floor(pack/8.0);vec2 span=10.0*(pack-apos*8.0);vec2 uvTex=(apos-vec2(1.0,1.0))/8190.0;float size=u_dem_size+2.0;float dd=1.0/size;vec2 pos=u_dem_size*(uvTex*u_dem_scale+u_dem_tl)+1.0;vec2 f=fract(pos);pos=(pos-f+0.5)*dd;vec4 h=fourSample(pos,vec2(dd));float z=mix(mix(h.x,h.y,f.x),mix(h.z,h.w,f.x),f.y);vec2 w=floor(0.5*(span*u_meter_to_dem-1.0));vec2 d=dd*w;h=fourSample(pos-d,2.0*d+vec2(dd));vec4 diff=abs(h.xzxy-h.ywzw);vec2 slope=min(vec2(0.25),u_meter_to_dem*0.5*(diff.xz+diff.yw)/(2.0*w+vec2(1.0)));vec2 fix=slope*span;float base=z+max(fix.x,fix.y);return u_exaggeration*base;}float elevationFromUint16(float word) {return u_exaggeration*(word/ELEVATION_SCALE-ELEVATION_OFFSET);} +#else +float elevation(vec2 pos) { return 0.0; }bool isOccluded(vec4 frag) { return false; }float occlusionFade(vec4 frag) { return 1.0; } +#endif`,Fc=`#ifdef FOG +uniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump mat4 u_fog_matrix;varying vec3 v_fog_pos;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}vec3 fog_position(vec3 pos) {return (u_fog_matrix*vec4(pos,1.0)).xyz;}vec3 fog_position(vec2 pos) {return fog_position(vec3(pos,0.0));}float fog(vec3 pos) {float depth=length(pos);float opacity=fog_opacity(fog_range(depth));return opacity*fog_horizon_blending(pos/depth);} +#endif`,Sa=`#ifdef FOG +uniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump float u_fog_temporal_offset;varying vec3 v_fog_pos;uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform highp vec2 u_viewport;uniform float u_globe_transition;uniform int u_is_globe;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}float globe_glow_progress() {highp vec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix( +mix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float sdf=length(closest_point-u_globe_pos)/u_globe_radius;return sdf+PI*0.5;}float fog_opacity(vec3 pos) {float depth=length(pos);return fog_opacity(fog_range(depth));}vec3 fog_apply(vec3 color,vec3 pos) {float depth=length(pos);float opacity;if (u_is_globe==1) {float glow_progress=globe_glow_progress();float t=mix(glow_progress,depth,u_globe_transition);opacity=fog_opacity(fog_range(t));} else {opacity=fog_opacity(fog_range(depth));opacity*=fog_horizon_blending(pos/depth);}return mix(color,u_fog_color.rgb,opacity);}vec4 fog_apply_from_vert(vec4 color,float fog_opac) {float alpha=EPSILON+color.a;color.rgb=mix(color.rgb/alpha,u_fog_color.rgb,fog_opac)*alpha;return color;}vec3 fog_apply_sky_gradient(vec3 camera_ray,vec3 sky_color) {float horizon_blend=fog_horizon_blending(normalize(camera_ray));return mix(sky_color,u_fog_color.rgb,horizon_blend);}vec4 fog_apply_premultiplied(vec4 color,vec3 pos) {float alpha=EPSILON+color.a;color.rgb=fog_apply(color.rgb/alpha,pos)*alpha;return color;}vec3 fog_dither(vec3 color) {vec2 dither_seed=gl_FragCoord.xy+u_fog_temporal_offset;return dither(color,dither_seed);}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);} +#endif`;let Hu={},vl={};const Lc=[];xl(op,Lc),xl(Ea,Lc),xl(Fc,Lc),xl(Sa,Lc),Hu=wr("",Ea),vl=wr(Sa,Fc);const a0=wr(` +#if __VERSION__ >=300 +#define varying in +#define gl_FragColor glFragColor +#define texture2D texture +#define textureCube texture +out vec4 glFragColor; +#endif +highp vec3 hash(highp vec2 p) {highp vec3 p3=fract(p.xyx*vec3(443.8975,397.2973,491.1871));p3+=dot(p3,p3.yxz+19.19);return fract((p3.xxy+p3.yzz)*p3.zyx);}vec3 dither(vec3 color,highp vec2 seed) {vec3 rnd=hash(seed)+hash(seed+0.59374)-0.5;return color+rnd/255.0;}highp float unpack_depth(highp vec4 rgba_depth) +{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}highp vec4 pack_depth(highp float ndc_z) {highp float depth=ndc_z*0.5+0.5;const highp vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);const highp vec4 bit_mask =vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);highp vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;}`,` +#if __VERSION__ >=300 +#define attribute in +#define varying out +#define texture2D texture +#endif +float wrap(float n,float min,float max) {float d=max-min;float w=mod(mod(n-min,d)+d,d)+min;return (w==min) ? max : w;} +#ifdef PROJECTION_GLOBE_VIEW +vec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) { +#ifndef PROJECTED_POS_ON_VIEWPORT +float tiles=tile_id.z;vec2 mercator=(tile_anchor/EXTENT+tile_id.xy)/tiles;mercator-=mercator_center;mercator.x=wrap(mercator.x,-0.5,0.5);vec4 mercator_tile=vec4(mercator.xy*EXTENT,EXTENT/(2.0*PI),1.0);mercator_tile=matrix*mercator_tile;return mercator_tile.xyz; +#else +return vec3(0.0); +#endif +}vec3 mix_globe_mercator(vec3 globe,vec3 mercator,float t) {return mix(globe,mercator,t);}mat3 globe_mercator_surface_vectors(vec3 pos_normal,vec3 up_dir,float zoom_transition) {vec3 normal=zoom_transition==0.0 ? pos_normal : normalize(mix(pos_normal,up_dir,zoom_transition));vec3 xAxis=normalize(vec3(normal.z,0.0,-normal.x));vec3 yAxis=normalize(cross(normal,xAxis));return mat3(xAxis,yAxis,normal);} +#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;}const vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);//Normalized device coordinate that is not rendered.`),qu=op,ap=` +#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`;var sp={background:wr(`uniform vec4 u_color;uniform float u_opacity; +#ifdef LIGHTING_3D_MODE +varying vec4 v_color; +#endif +void main() {vec4 out_color; +#ifdef LIGHTING_3D_MODE +out_color=v_color; +#else +out_color=u_color; +#endif +#ifdef FOG +out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); +#endif +gl_FragColor=out_color*u_opacity; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`attribute vec2 a_pos;uniform mat4 u_matrix; +#ifdef LIGHTING_3D_MODE +uniform vec4 u_color;varying vec4 v_color; +#endif +void main() {gl_Position=u_matrix*vec4(a_pos,0,1); +#ifdef LIGHTING_3D_MODE +v_color=apply_lighting(u_color); +#endif +#ifdef FOG +v_fog_pos=fog_position(a_pos); +#endif +}`),backgroundPattern:wr(`uniform vec2 u_pattern_tl;uniform vec2 u_pattern_br;uniform vec2 u_texsize;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos;void main() {vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(u_pattern_tl/u_texsize,u_pattern_br/u_texsize,imagecoord);vec4 out_color=texture2D(u_image,pos); +#ifdef LIGHTING_3D_MODE +out_color=apply_lighting(out_color); +#endif +#ifdef FOG +out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); +#endif +gl_FragColor=out_color*u_opacity; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`uniform mat4 u_matrix;uniform vec2 u_pattern_size;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_pattern_size,u_tile_units_to_pixels,a_pos); +#ifdef FOG +v_fog_pos=fog_position(a_pos); +#endif +}`),circle:wr(`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);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep( +antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width) +);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t); +#ifdef LIGHTING_3D_MODE +out_color=apply_lighting(out_color); +#endif +#ifdef FOG +out_color=fog_apply_premultiplied(out_color,v_fog_pos); +#endif +gl_FragColor=out_color*(v_visibility*opacity_t); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`#define NUM_VISIBILITY_RINGS 2 +#define INV_SQRT2 0.70710678 +#define ELEVATION_BIAS 0.0001 +#define NUM_SAMPLES_PER_RING 16 +uniform mat4 u_matrix;uniform mat2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos; +#ifdef PROJECTION_GLOBE_VIEW +attribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir; +#endif +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 +vec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*view_scale;}float cantilevered_elevation(vec2 pos,float radius,float stroke_width,float view_scale) {vec2 c1=pos+calc_offset(vec2(-1,-1),radius,stroke_width,view_scale);vec2 c2=pos+calc_offset(vec2(1,-1),radius,stroke_width,view_scale);vec2 c3=pos+calc_offset(vec2(1,1),radius,stroke_width,view_scale);vec2 c4=pos+calc_offset(vec2(-1,1),radius,stroke_width,view_scale);float h1=elevation(c1)+ELEVATION_BIAS;float h2=elevation(c2)+ELEVATION_BIAS;float h3=elevation(c3)+ELEVATION_BIAS;float h4=elevation(c4)+ELEVATION_BIAS;return max(h4,max(h3,max(h1,h2)));}float circle_elevation(vec2 pos) { +#if defined(TERRAIN) +return elevation(pos)+ELEVATION_BIAS; +#else +return 0.0; +#endif +}vec4 project_vertex(vec2 extrusion,vec4 world_center,vec4 projected_center,float radius,float stroke_width, float view_scale,mat3 surface_vectors) {vec2 sample_offset=calc_offset(extrusion,radius,stroke_width,view_scale); +#ifdef PITCH_WITH_MAP +#ifdef PROJECTION_GLOBE_VIEW +return u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) ); +#else +return u_matrix*( world_center+vec4(sample_offset,0,0) ); +#endif +#else +return projected_center+vec4(sample_offset,0,0); +#endif +}float get_sample_step() { +#ifdef PITCH_WITH_MAP +return 2.0*PI/float(NUM_SAMPLES_PER_RING); +#else +return PI/float(NUM_SAMPLES_PER_RING); +#endif +}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);vec4 world_center;mat3 surface_vectors; +#ifdef PROJECTION_GLOBE_VIEW +vec3 pos_normal_3=a_pos_normal_3/16384.0;surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(circle_center)*circle_elevation(circle_center);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*circle_elevation(circle_center);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,circle_center,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);world_center=vec4(pos,1); +#else +surface_vectors=mat3(1.0);float height=circle_elevation(circle_center);world_center=vec4(circle_center,height,1); +#endif +vec4 projected_center=u_matrix*world_center;float view_scale=0.0; +#ifdef PITCH_WITH_MAP +#ifdef SCALE_WITH_MAP +view_scale=1.0; +#else +view_scale=projected_center.w/u_camera_to_center_distance; +#endif +#else +#ifdef SCALE_WITH_MAP +view_scale=u_camera_to_center_distance; +#else +view_scale=projected_center.w; +#endif +#endif +gl_Position=project_vertex(extrude,world_center,projected_center,radius,stroke_width,view_scale,surface_vectors);float visibility=0.0; +#ifdef TERRAIN +float step=get_sample_step();vec4 occlusion_world_center;vec4 occlusion_projected_center; +#ifdef PITCH_WITH_MAP +float cantilevered_height=cantilevered_elevation(circle_center,radius,stroke_width,view_scale);occlusion_world_center=vec4(circle_center,cantilevered_height,1);occlusion_projected_center=u_matrix*occlusion_world_center; +#else +occlusion_world_center=world_center;occlusion_projected_center=projected_center; +#endif +for(int ring=0; ring < NUM_VISIBILITY_RINGS; ring++) {float scale=(float(ring)+1.0)/float(NUM_VISIBILITY_RINGS);for(int i=0; i < NUM_SAMPLES_PER_RING; i++) {vec2 extrusion=vec2(cos(step*float(i)),-sin(step*float(i)))*scale;vec4 frag_pos=project_vertex(extrusion,occlusion_world_center,occlusion_projected_center,radius,stroke_width,view_scale,surface_vectors);visibility+=float(!isOccluded(frag_pos));}}visibility/=float(NUM_VISIBILITY_RINGS)*float(NUM_SAMPLES_PER_RING); +#else +visibility=1.0; +#endif +#ifdef PROJECTION_GLOBE_VIEW +visibility=1.0; +#endif +v_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur); +#ifdef FOG +v_fog_pos=fog_position(world_center.xyz); +#endif +}`),clippingMask:wr("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:wr(`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 FOG +if (u_is_globe==0) {gl_FragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);} +#endif +#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; +#ifdef PROJECTION_GLOBE_VIEW +attribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir; +#endif +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;vec2 tilePos=floor(a_pos*0.5);vec3 pos; +#ifdef PROJECTION_GLOBE_VIEW +vec3 pos_normal_3=a_pos_normal_3/16384.0;mat3 surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(tilePos)*elevation(tilePos);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*elevation(tilePos);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,tilePos,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition); +#else +pos=vec3(tilePos+extrude,elevation(tilePos)); +#endif +gl_Position=u_matrix*vec4(pos,1); +#ifdef FOG +v_fog_pos=fog_position(pos); +#endif +}`),heatmapTexture:wr(`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 +}`,"attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=a_pos*0.5+0.5;}"),collisionBox:wr("varying float v_placed;varying float v_notUsed;void main() {vec4 red =vec4(1.0,0.0,0.0,1.0);vec4 blue=vec4(0.0,0.0,1.0,0.5);gl_FragColor =mix(red,blue,step(0.5,v_placed))*0.5;gl_FragColor*=mix(1.0,0.1,step(0.5,v_notUsed));}",`attribute vec3 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;attribute float a_size_scale;attribute vec2 a_padding;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_pos+elevationVector(a_anchor_pos)*elevation(a_anchor_pos),1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp( +0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,1.5);gl_Position=projectedPoint;gl_Position.xy+=(a_extrude*a_size_scale+a_shift+a_padding)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}`),collisionCircle:wr("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_2f;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_2f;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:wr("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; +#ifdef PROJECTION_GLOBE_VIEW +attribute vec3 a_pos_3; +#endif +varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {float h=elevation(a_pos);v_uv=a_pos/8192.0; +#ifdef PROJECTION_GLOBE_VIEW +gl_Position=u_matrix*vec4(a_pos_3+elevationVector(a_pos)*h,1); +#else +gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1); +#endif +}`),fill:wr(`#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 +vec4 out_color=color; +#ifdef LIGHTING_3D_MODE +out_color=apply_lighting(out_color); +#endif +#ifdef FOG +out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); +#endif +gl_FragColor=out_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); +#ifdef FOG +v_fog_pos=fog_position(a_pos); +#endif +}`),fillOutline:wr(`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);vec4 out_color=outline_color; +#ifdef LIGHTING_3D_MODE +out_color=apply_lighting(out_color); +#endif +#ifdef FOG +out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); +#endif +gl_FragColor=out_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; +#ifdef FOG +v_fog_pos=fog_position(a_pos); +#endif +}`),fillOutlinePattern:wr(`uniform vec2 u_texsize;uniform sampler2D u_image;varying vec2 v_pos;varying vec2 v_pos_world; +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp vec4 pattern +void main() { +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump vec4 pattern +vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);float dist=length(v_pos_world-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=texture2D(u_image,pos); +#ifdef LIGHTING_3D_MODE +out_color=apply_lighting(out_color); +#endif +#ifdef FOG +out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); +#endif +gl_FragColor=out_color*(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 float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos;varying vec2 v_pos_world; +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp vec4 pattern +#pragma mapbox: define lowp float pixel_ratio +void main() { +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump vec4 pattern +#pragma mapbox: initialize lowp float pixel_ratio +vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);v_pos_world=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world; +#ifdef FOG +v_fog_pos=fog_position(a_pos); +#endif +}`),fillPattern:wr(`uniform vec2 u_texsize;uniform sampler2D u_image;varying vec2 v_pos; +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp vec4 pattern +void main() { +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump vec4 pattern +vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);vec4 out_color=texture2D(u_image,pos); +#ifdef LIGHTING_3D_MODE +out_color=apply_lighting(out_color); +#endif +#ifdef FOG +out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); +#endif +gl_FragColor=out_color*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 float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos; +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp vec4 pattern +#pragma mapbox: define lowp float pixel_ratio +void main() { +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize mediump vec4 pattern +#pragma mapbox: initialize lowp float pixel_ratio +vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos); +#ifdef FOG +v_fog_pos=fog_position(a_pos); +#endif +}`),fillExtrusion:wr(`varying vec4 v_color; +#ifdef RENDER_SHADOWS +varying highp vec4 v_pos_light_view_0;varying highp vec4 v_pos_light_view_1;varying float v_depth; +#endif +#ifdef FAUX_AO +uniform lowp vec2 u_ao;varying vec3 v_ao; +#endif +#ifdef ZERO_ROOF_RADIUS +varying vec4 v_roof_color; +#endif +#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) +varying highp vec3 v_normal; +#endif +void main() { +#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) +vec3 normal=v_normal; +#endif +float z;vec4 color; +#ifdef ZERO_ROOF_RADIUS +z=float(normal.z > 0.00001);color=mix(v_color,v_roof_color,z); +#else +color=v_color; +#endif +#ifdef FAUX_AO +float intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x; +#ifdef ZERO_ROOF_RADIUS +concave*=(1.0-z); +#endif +float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);color.rgb=color.rgb*shade; +#endif +#ifdef RENDER_SHADOWS +#ifdef ZERO_ROOF_RADIUS +normal=mix(normal,vec3(0.0,0.0,1.0),z); +#endif +color.xyz=shadowed_color_normal(color.xyz,normalize(normal),v_pos_light_view_0,v_pos_light_view_1,v_depth); +#endif +#ifdef FOG +color=fog_dither(fog_apply_premultiplied(color,v_fog_pos)); +#endif +gl_FragColor=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;uniform float u_edge_radius;attribute vec4 a_pos_normal_ed;attribute vec2 a_centroid_pos; +#ifdef PROJECTION_GLOBE_VIEW +attribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift; +#endif +varying vec4 v_color; +#ifdef RENDER_SHADOWS +uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;varying highp vec4 v_pos_light_view_0;varying highp vec4 v_pos_light_view_1;varying float v_depth; +#endif +#ifdef ZERO_ROOF_RADIUS +varying vec4 v_roof_color; +#endif +#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) +varying highp vec3 v_normal; +#endif +#ifdef FAUX_AO +uniform lowp vec2 u_ao;varying vec3 v_ao; +#endif +#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 +vec4 pos_nx=floor(a_pos_normal_ed*0.5);vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0)); +#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) +v_normal=normal; +#endif +base=max(0.0,base);height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0); +#if defined(HAS_CENTROID) || defined(TERRAIN) +centroid_pos=a_centroid_pos; +#endif +float ele=0.0;float h=0.0;float c_ele;vec3 pos; +#ifdef TERRAIN +bool flat_roof=centroid_pos.x !=0.0 && t > 0.0;ele=elevation(pos_nx.xy);c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);pos=vec3(pos_nx.xy,h); +#else +h=t > 0.0 ? height : base;pos=vec3(pos_nx.xy,h); +#endif +#ifdef PROJECTION_GLOBE_VIEW +float lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*h);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,pos.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*pos.z;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition); +#endif +float hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden); +#ifdef RENDER_SHADOWS +v_pos_light_view_0=u_light_matrix_0*vec4(pos,1);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1);v_depth=gl_Position.w; +#endif +float NdotL=0.0;float colorvalue=0.0; +#ifdef LIGHTING_3D_MODE +NdotL=calculate_NdotL(normal); +#else +colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),NdotL); +#endif +if (normal.y !=0.0) {float r=0.84; +#ifndef LIGHTING_3D_MODE +r=mix(0.7,0.98,1.0-u_lightintensity); +#endif +NdotL*=( +(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}v_color=vec4(0.0,0.0,0.0,1.0); +#ifdef FAUX_AO +float concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height; +#ifdef TERRAIN +top_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height); +#endif +v_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]); +#ifdef PROJECTION_GLOBE_VIEW +top_height+=u_height_lift; +#endif +gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w; +#endif +#ifdef LIGHTING_3D_MODE +v_color=apply_lighting(color,NdotL); +#else +v_color.rgb+=clamp(color.rgb*NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0)); +#endif +v_color*=u_opacity; +#ifdef ZERO_ROOF_RADIUS +v_roof_color=vec4(0.0,0.0,0.0,1.0); +#ifdef LIGHTING_3D_MODE +v_roof_color=apply_lighting(color,calculate_NdotL(vec3(0.0,0.0,1.0))); +#else +float roofNdotL=clamp(u_lightpos.z,0.0,1.0);roofNdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),roofNdotL);v_roof_color.rgb+=clamp(color.rgb*roofNdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0)); +#endif +v_roof_color*=u_opacity; +#endif +#ifdef FOG +v_fog_pos=fog_position(pos); +#endif +}`),fillExtrusionPattern:wr(`uniform vec2 u_texsize;uniform sampler2D u_image; +#ifdef FAUX_AO +uniform lowp vec2 u_ao;varying vec3 v_ao; +#endif +#ifdef LIGHTING_3D_MODE +varying float v_NdotL; +#endif +varying vec2 v_pos;varying vec4 v_lighting;uniform lowp float u_opacity; +#pragma mapbox: define lowp float base +#pragma mapbox: define lowp float height +#pragma mapbox: define lowp vec4 pattern +#pragma mapbox: define lowp float pixel_ratio +void main() { +#pragma mapbox: initialize lowp float base +#pragma mapbox: initialize lowp float height +#pragma mapbox: initialize mediump vec4 pattern +#pragma mapbox: initialize lowp float pixel_ratio +vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);vec4 out_color=texture2D(u_image,pos); +#ifdef LIGHTING_3D_MODE +out_color=apply_lighting(out_color,v_NdotL)*u_opacity; +#else +out_color=out_color*v_lighting; +#endif +#ifdef FAUX_AO +float intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);out_color.rgb=out_color.rgb*shade; +#endif +#ifdef FOG +out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); +#endif +gl_FragColor=out_color; +#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 float u_tile_units_to_pixels;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 vec4 a_pos_normal_ed;attribute vec2 a_centroid_pos; +#ifdef PROJECTION_GLOBE_VIEW +attribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift; +#endif +varying vec2 v_pos;varying vec4 v_lighting; +#ifdef FAUX_AO +uniform lowp vec2 u_ao;varying vec3 v_ao; +#endif +#ifdef LIGHTING_3D_MODE +varying float v_NdotL; +#endif +#pragma mapbox: define lowp float base +#pragma mapbox: define lowp float height +#pragma mapbox: define lowp vec4 pattern +#pragma mapbox: define lowp float pixel_ratio +void main() { +#pragma mapbox: initialize lowp float base +#pragma mapbox: initialize lowp float height +#pragma mapbox: initialize mediump vec4 pattern +#pragma mapbox: initialize lowp float pixel_ratio +vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec4 pos_nx=floor(a_pos_normal_ed*0.5);mediump vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;mediump vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));float edgedistance=a_pos_normal_ed.w;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;base=max(0.0,base);height=max(0.0,height);float t=top_up_ny.x;float z=t > 0.0 ? height : base;vec2 centroid_pos=vec2(0.0); +#if defined(HAS_CENTROID) || defined(TERRAIN) +centroid_pos=a_centroid_pos; +#endif +float ele=0.0;float h=z;vec3 p;float c_ele; +#ifdef TERRAIN +bool flat_roof=centroid_pos.x !=0.0 && t > 0.0;ele=elevation(pos_nx.xy);c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);p=vec3(pos_nx.xy,h); +#else +p=vec3(pos_nx.xy,z); +#endif +#ifdef PROJECTION_GLOBE_VIEW +float lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*(p.z+lift));vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,p.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*p.z;p=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition); +#endif +float hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);gl_Position=mix(u_matrix*vec4(p,1),AWAY,hidden);vec2 pos=normal.z==1.0 +? pos_nx.xy +: vec2(edgedistance,z*u_height_factor);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float NdotL=0.0; +#ifdef LIGHTING_3D_MODE +NdotL=calculate_NdotL(normal); +#else +NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),NdotL); +#endif +if (normal.y !=0.0) {float r=0.84; +#ifndef LIGHTING_3D_MODE +r=mix(0.7,0.98,1.0-u_lightintensity); +#endif +NdotL*=( +(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));} +#ifdef FAUX_AO +float concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height; +#ifdef TERRAIN +top_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height); +#endif +v_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]); +#ifdef PROJECTION_GLOBE_VIEW +top_height+=u_height_lift; +#endif +gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w; +#endif +#ifdef LIGHTING_3D_MODE +v_NdotL=NdotL; +#else +v_lighting.rgb+=clamp(NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity; +#endif +#ifdef FOG +v_fog_pos=fog_position(p); +#endif +}`),hillshadePrepare:wr(`#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) { +#ifdef TERRAIN_DEM_FLOAT_FORMAT +return texture2D(u_image,coord).a/4.0; +#else +vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0; +#endif +}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y));float b=getElevation(v_pos+vec2(0,-epsilon.y));float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y));float d=getElevation(v_pos+vec2(-epsilon.x,0));float e=getElevation(v_pos+vec2(epsilon.x,0));float f=getElevation(v_pos+vec2(-epsilon.x,epsilon.y));float g=getElevation(v_pos+vec2(0,epsilon.y));float h=getElevation(v_pos+vec2(epsilon.x,epsilon.y));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+e+e+h)-(a+d+d+f),(f+g+g+h)-(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:wr(`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;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 LIGHTING_3D_MODE +gl_FragColor=apply_lighting(gl_FragColor); +#endif +#ifdef FOG +gl_FragColor=fog_dither(fog_apply_premultiplied(gl_FragColor,v_fog_pos)); +#endif +#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; +#ifdef FOG +v_fog_pos=fog_position(a_pos); +#endif +}`),line:wr(`uniform lowp float u_device_pixel_ratio;uniform float u_alpha_discard_threshold;uniform highp vec2 u_trim_offset;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec4 v_uv; +#ifdef RENDER_LINE_DASH +uniform sampler2D u_dash_image;varying vec2 v_tex; +#endif +#ifdef RENDER_LINE_GRADIENT +uniform sampler2D u_gradient_image; +#endif +uniform float u_border_width;uniform vec4 u_border_color;float luminance(vec3 c) {return (c.r+c.r+c.b+c.g+c.g+c.g)*0.1667;} +#pragma mapbox: define highp vec4 color +#pragma mapbox: define lowp float floorwidth +#pragma mapbox: define lowp vec4 dash +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +float linearstep(float edge0,float edge1,float x) {return clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main() { +#pragma mapbox: initialize highp vec4 color +#pragma mapbox: initialize lowp float floorwidth +#pragma mapbox: initialize lowp vec4 dash +#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); +#ifdef RENDER_LINE_DASH +float sdfdist=texture2D(u_dash_image,v_tex).a;float sdfgamma=1.0/(2.0*u_device_pixel_ratio)/dash.z;alpha*=linearstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist); +#endif +highp vec4 out_color; +#ifdef RENDER_LINE_GRADIENT +out_color=texture2D(u_gradient_image,v_uv.xy); +#else +out_color=color; +#endif +float trimmed=1.0; +#ifdef RENDER_LINE_TRIM_OFFSET +highp float start=v_uv[2];highp float end=v_uv[3];highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=(start+(v_uv.x)*(end-start));if (trim_end > trim_start) {if (line_progress <=trim_end && line_progress >=trim_start) {out_color=vec4(0,0,0,0);trimmed=0.0;}} +#endif +#ifdef LIGHTING_3D_MODE +out_color=apply_lighting(out_color); +#endif +#ifdef FOG +out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); +#endif +#ifdef RENDER_LINE_ALPHA_DISCARD +if (alpha < u_alpha_discard_threshold) {discard;} +#endif +#ifdef RENDER_LINE_BORDER +float edgeBlur=(u_border_width+1.0/u_device_pixel_ratio);float alpha2=clamp(min(dist-(v_width2.t-edgeBlur),v_width2.s-dist)/edgeBlur,0.0,1.0);if (alpha2 < 1.) {float smoothAlpha=smoothstep(0.6,1.0,alpha2); +#ifdef RENDER_LINE_BORDER_AUTO +float Y=(out_color.a > 0.01) ? luminance(out_color.rgb/out_color.a) : 1.;float adjustment=(Y > 0.) ? 0.5/Y : 0.45;if (out_color.a > 0.25 && Y < 0.25) {vec3 borderColor=(Y > 0.) ? out_color.rgb : vec3(1,1,1)*out_color.a;out_color.rgb=out_color.rgb+borderColor*(adjustment*(1.0-smoothAlpha));} else {out_color.rgb*=(0.6 +0.4*smoothAlpha);} +#else +out_color.rgb=mix(u_border_color.rgb*u_border_color.a*trimmed,out_color.rgb,smoothAlpha); +#endif +} +#endif +gl_FragColor=out_color*(alpha*opacity); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,` +#define EXTRUDE_SCALE 0.015873016 +attribute vec2 a_pos_normal;attribute vec4 a_data; +#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) +attribute highp vec4 a_packed; +#endif +#ifdef RENDER_LINE_DASH +attribute float a_linesofar; +#endif +uniform mat4 u_matrix;uniform mat2 u_pixels_to_tile_units;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 vec4 v_uv; +#ifdef RENDER_LINE_DASH +uniform vec2 u_texsize;uniform float u_tile_units_to_pixels;varying vec2 v_tex; +#endif +#ifdef RENDER_LINE_GRADIENT +uniform float u_image_height; +#endif +#pragma mapbox: define highp vec4 color +#pragma mapbox: define lowp float floorwidth +#pragma mapbox: define lowp vec4 dash +#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 floorwidth +#pragma mapbox: initialize lowp vec4 dash +#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;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*EXTRUDE_SCALE;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*EXTRUDE_SCALE*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist*u_pixels_to_tile_units,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude; +#ifndef RENDER_TO_TEXTURE +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; +#else +v_gamma_scale=1.0; +#endif +#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) +float a_uv_x=a_packed[0];float a_split_index=a_packed[1];highp float a_clip_start=a_packed[2];highp float a_clip_end=a_packed[3]; +#ifdef RENDER_LINE_GRADIENT +highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec4(a_uv_x,a_split_index*texel_height-half_texel_height,a_clip_start,a_clip_end); +#else +v_uv=vec4(a_uv_x,0.0,a_clip_start,a_clip_end); +#endif +#endif +#ifdef RENDER_LINE_DASH +float scale=dash.z==0.0 ? 0.0 : u_tile_units_to_pixels/dash.z;float height=dash.y;v_tex=vec2(a_linesofar*scale/floorwidth,(-normal.y*height+dash.x+0.5)/u_texsize.y); +#endif +v_width2=vec2(outset,inset); +#ifdef FOG +v_fog_pos=fog_position(pos); +#endif +}`),linePattern:wr(`uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_tile_units_to_pixels;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 +#pragma mapbox: define lowp float pixel_ratio +#pragma mapbox: define lowp float blur +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize mediump vec4 pattern +#pragma mapbox: initialize lowp float pixel_ratio +#pragma mapbox: initialize lowp float blur +#pragma mapbox: initialize lowp float opacity +vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;vec2 pattern_size=vec2(display_size.x/u_tile_units_to_pixels,display_size.y);float aspect=display_size.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=mod(v_linesofar/pattern_size.x*aspect,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(x,y));vec4 color=texture2D(u_image,pos); +#ifdef LIGHTING_3D_MODE +color=apply_lighting(color); +#endif +#ifdef FOG +color=fog_dither(fog_apply_premultiplied(color,v_fog_pos)); +#endif +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_linesofar;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mat2 u_pixels_to_tile_units;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 +#pragma mapbox: define lowp float pixel_ratio +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 +#pragma mapbox: initialize lowp float pixel_ratio +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;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_pixels_to_tile_units,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude; +#ifndef RENDER_TO_TEXTURE +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; +#else +v_gamma_scale=1.0; +#endif +v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth; +#ifdef FOG +v_fog_pos=fog_position(pos); +#endif +}`),raster:wr(`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);vec3 out_color=mix(u_high_vec,u_low_vec,rgb); +#ifdef LIGHTING_3D_MODE +out_color=apply_lighting(out_color); +#endif +#ifdef FOG +out_color=fog_dither(fog_apply(out_color,v_fog_pos)); +#endif +gl_FragColor=vec4(out_color*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 vec2 u_perspective_transform;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {float w=1.0+dot(a_texture_pos,u_perspective_transform);gl_Position=u_matrix*vec4(a_pos*w,0,w);v_pos0=a_texture_pos/8192.0;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent; +#ifdef FOG +v_fog_pos=fog_position(a_pos); +#endif +}`),symbolIcon:wr(`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_tex_size;attribute vec4 a_pixeloffset;attribute vec4 a_projected_pos;attribute float a_fade_opacity; +#ifdef PROJECTION_GLOBE_VIEW +attribute vec3 a_globe_anchor;attribute vec3 a_globe_normal; +#endif +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 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 vec3 u_up_vector; +#ifdef PROJECTION_GLOBE_VIEW +uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix; +#endif +varying vec2 v_tex;varying float v_fade_opacity; +#pragma mapbox: define lowp float opacity +void main() { +#pragma mapbox: initialize lowp float opacity +vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_min_font_scale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[3];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 tile_anchor=a_pos;vec3 h=elevationVector(tile_anchor)*elevation(tile_anchor);float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos; +#ifdef PROJECTION_GLOBE_VIEW +mercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos=mix_globe_mercator(a_globe_anchor+h,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0; +#else +world_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0; +#endif +vec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.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,1.5);size*=perspective_ratio;float font_scale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjected_point; +#ifdef PROJECTION_GLOBE_VIEW +vec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetProjected_point=u_matrix*vec4(a_globe_anchor+displacement,1); +#else +offsetProjected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1); +#endif +vec2 a=projected_point.xy/projected_point.w;vec2 b=offsetProjected_point.xy/offsetProjected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos; +#ifdef PROJECTION_GLOBE_VIEW +vec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0); +#else +projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0); +#endif +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);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*max(a_min_font_scale,font_scale)+a_pxoffset/16.0); +#ifdef TERRAIN +#ifdef PITCH_WITH_MAP_TERRAIN +vec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy); +#endif +#endif +float occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade; +#ifdef PROJECTION_GLOBE_VIEW +vec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0)); +#else +gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0)); +#endif +float projection_transition_fade=1.0; +#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW) +projection_transition_fade=1.0-step(EPSILON,u_zoom_transition); +#endif +v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;v_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change))*projection_transition_fade;}`),symbolSDF:wr(`#define SDF_PX 8.0 +uniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1; +#pragma mapbox: define highp vec4 fill_color +#pragma mapbox: define highp vec4 halo_color +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp float halo_width +#pragma mapbox: define lowp float halo_blur +void main() { +#pragma mapbox: initialize highp vec4 fill_color +#pragma mapbox: initialize highp vec4 halo_color +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize lowp float halo_width +#pragma mapbox: initialize lowp float halo_blur +float EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`attribute vec4 a_pos_offset;attribute vec4 a_tex_size;attribute vec4 a_pixeloffset;attribute vec4 a_projected_pos;attribute float a_fade_opacity; +#ifdef PROJECTION_GLOBE_VIEW +attribute vec3 a_globe_anchor;attribute vec3 a_globe_normal; +#endif +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_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 vec3 u_up_vector; +#ifdef PROJECTION_GLOBE_VIEW +uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix; +#endif +varying vec2 v_data0;varying vec3 v_data1; +#pragma mapbox: define highp vec4 fill_color +#pragma mapbox: define highp vec4 halo_color +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp float halo_width +#pragma mapbox: define lowp float halo_blur +void main() { +#pragma mapbox: initialize highp vec4 fill_color +#pragma mapbox: initialize highp vec4 halo_color +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize lowp float halo_width +#pragma mapbox: initialize lowp float halo_blur +vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;highp float segment_angle=-a_projected_pos[3];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 tile_anchor=a_pos;vec3 h=elevationVector(tile_anchor)*elevation(tile_anchor);float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos; +#ifdef PROJECTION_GLOBE_VIEW +mercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos=mix_globe_mercator(a_globe_anchor+h,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0; +#else +world_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0; +#endif +vec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.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,1.5);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetprojected_point; +#ifdef PROJECTION_GLOBE_VIEW +vec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetprojected_point=u_matrix*vec4(a_globe_anchor+displacement,1); +#else +offsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1); +#endif +vec2 a=projected_point.xy/projected_point.w;vec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos; +#ifdef PROJECTION_GLOBE_VIEW +vec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0); +#else +projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0); +#endif +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);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset); +#ifdef TERRAIN +#ifdef PITCH_WITH_MAP_TERRAIN +vec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy); +#endif +#endif +float occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade; +#ifdef PROJECTION_GLOBE_VIEW +vec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0)); +#else +gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0)); +#endif +float gamma_scale=gl_Position.w;float projection_transition_fade=1.0; +#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW) +projection_transition_fade=1.0-step(EPSILON,u_zoom_transition); +#endif +vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity*projection_transition_fade);}`),symbolTextAndIcon:wr(`#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_tex_size;attribute vec4 a_projected_pos;attribute float a_fade_opacity; +#ifdef PROJECTION_GLOBE_VIEW +attribute vec3 a_globe_anchor;attribute vec3 a_globe_normal; +#endif +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_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 vec3 u_up_vector;uniform vec2 u_texsize_icon; +#ifdef PROJECTION_GLOBE_VIEW +uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix; +#endif +varying vec4 v_data0;varying vec4 v_data1; +#pragma mapbox: define highp vec4 fill_color +#pragma mapbox: define highp vec4 halo_color +#pragma mapbox: define lowp float opacity +#pragma mapbox: define lowp float halo_width +#pragma mapbox: define lowp float halo_blur +void main() { +#pragma mapbox: initialize highp vec4 fill_color +#pragma mapbox: initialize highp vec4 halo_color +#pragma mapbox: initialize lowp float opacity +#pragma mapbox: initialize lowp float halo_width +#pragma mapbox: initialize lowp float halo_blur +vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;highp float segment_angle=-a_projected_pos[3];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 tile_anchor=a_pos;vec3 h=elevationVector(tile_anchor)*elevation(tile_anchor);float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos; +#ifdef PROJECTION_GLOBE_VIEW +mercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos=mix_globe_mercator(a_globe_anchor+h,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0; +#else +world_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0; +#endif +vec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.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,1.5);size*=perspective_ratio;float font_scale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offset_projected_point=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projected_point.xy/projected_point.w;vec2 b=offset_projected_point.xy/offset_projected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos; +#ifdef PROJECTION_GLOBE_VIEW +vec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0); +#else +projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0); +#endif +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);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*font_scale); +#ifdef TERRAIN +#ifdef PITCH_WITH_MAP_TERRAIN +vec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy); +#endif +#endif +float occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade; +#ifdef PROJECTION_GLOBE_VIEW +vec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0)); +#else +gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0)); +#endif +float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));float projection_transition_fade=1.0; +#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW) +projection_transition_fade=1.0-step(EPSILON,u_zoom_transition); +#endif +v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity*projection_transition_fade,is_sdf);}`),terrainRaster:wr(`uniform sampler2D u_image0;varying vec2 v_pos0; +#ifdef FOG +varying float v_fog_opacity; +#endif +#ifdef RENDER_SHADOWS +varying vec4 v_pos_light_view_0;varying vec4 v_pos_light_view_1;varying float v_depth; +#endif +void main() {vec4 color=texture2D(u_image0,v_pos0); +#ifdef RENDER_SHADOWS +color.xyz=shadowed_color(color.xyz,v_pos_light_view_0,v_pos_light_view_1,v_depth); +#endif +#ifdef FOG +#ifdef ZERO_EXAGGERATION +color=fog_dither(fog_apply_premultiplied(color,v_fog_pos)); +#else +color=fog_dither(fog_apply_from_vert(color,v_fog_opacity)); +#endif +#endif +gl_FragColor=color; +#ifdef TERRAIN_WIREFRAME +gl_FragColor=vec4(1.0,0.0,0.0,0.8); +#endif +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`uniform mat4 u_matrix;uniform float u_skirt_height;attribute vec2 a_pos;varying vec2 v_pos0; +#ifdef FOG +varying float v_fog_opacity; +#endif +#ifdef RENDER_SHADOWS +uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;varying vec4 v_pos_light_view_0;varying vec4 v_pos_light_view_1;varying float v_depth; +#endif +const float wireframeOffset=0.00015;void main() {vec3 decomposedPosAndSkirt=decomposeToPosAndSkirt(a_pos);float skirt=decomposedPosAndSkirt.z;vec2 decodedPos=decomposedPosAndSkirt.xy;float elevation=elevation(decodedPos)-skirt*u_skirt_height; +#ifdef TERRAIN_WIREFRAME +elevation+=wireframeOffset; +#endif +v_pos0=decodedPos/8192.0;gl_Position=u_matrix*vec4(decodedPos,elevation,1.0); +#ifdef FOG +#ifdef ZERO_EXAGGERATION +v_fog_pos=fog_position(decodedPos); +#else +v_fog_opacity=fog(fog_position(vec3(decodedPos,elevation))); +#endif +#endif +#ifdef RENDER_SHADOWS +vec3 pos=vec3(decodedPos,elevation);v_pos_light_view_0=u_light_matrix_0*vec4(pos,1.);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1.);v_depth=gl_Position.w; +#endif +}`),terrainDepth:wr(`#ifdef GL_ES +precision highp float; +#endif +varying float v_depth;void main() {gl_FragColor=pack_depth(v_depth);}`,"uniform mat4 u_matrix;attribute vec2 a_pos;varying float v_depth;void main() {float elevation=elevation(a_pos);gl_Position=u_matrix*vec4(a_pos,elevation,1.0);v_depth=gl_Position.z/gl_Position.w;}"),skybox:wr(` +varying lowp vec3 v_uv;uniform lowp samplerCube u_cubemap;uniform lowp float u_opacity;uniform highp float u_temporal_offset;uniform highp vec3 u_sun_direction;float sun_disk(highp vec3 ray_direction,highp vec3 sun_direction) {highp float cos_angle=dot(normalize(ray_direction),sun_direction);const highp float cos_sun_angular_diameter=0.99996192306;const highp float smoothstep_delta=1e-5;return smoothstep( +cos_sun_angular_diameter-smoothstep_delta,cos_sun_angular_diameter+smoothstep_delta,cos_angle);}float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec3 uv=v_uv;const float y_bias=0.015;uv.y+=y_bias;uv.y=pow(abs(uv.y),1.0/5.0);uv.y=map(uv.y,0.0,1.0,-1.0,1.0);vec3 sky_color=textureCube(u_cubemap,uv).rgb; +#ifdef FOG +sky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color); +#endif +sky_color.rgb=dither(sky_color.rgb,gl_FragCoord.xy+u_temporal_offset);sky_color+=0.1*sun_disk(v_uv,u_sun_direction);gl_FragColor=vec4(sky_color*u_opacity,u_opacity); +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,Os),skyboxGradient:wr(`varying highp vec3 v_uv;uniform lowp sampler2D u_color_ramp;uniform highp vec3 u_center_direction;uniform lowp float u_radius;uniform lowp float u_opacity;uniform highp float u_temporal_offset;void main() {float progress=acos(dot(normalize(v_uv),u_center_direction))/u_radius;vec4 color=texture2D(u_color_ramp,vec2(progress,0.5)); +#ifdef FOG +color.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a; +#endif +color*=u_opacity;color.rgb=dither(color.rgb,gl_FragCoord.xy+u_temporal_offset);gl_FragColor=color; +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,Os),skyboxCapture:wr(` +varying highp vec3 v_position;uniform highp float u_sun_intensity;uniform highp float u_luminance;uniform lowp vec3 u_sun_direction;uniform highp vec4 u_color_tint_r;uniform highp vec4 u_color_tint_m; +#ifdef GL_ES +precision highp float; +#endif +#define BETA_R vec3(5.5e-6,13.0e-6,22.4e-6) +#define BETA_M vec3(21e-6,21e-6,21e-6) +#define MIE_G 0.76 +#define DENSITY_HEIGHT_SCALE_R 8000.0 +#define DENSITY_HEIGHT_SCALE_M 1200.0 +#define PLANET_RADIUS 6360e3 +#define ATMOSPHERE_RADIUS 6420e3 +#define SAMPLE_STEPS 10 +#define DENSITY_STEPS 4 +float ray_sphere_exit(vec3 orig,vec3 dir,float radius) {float a=dot(dir,dir);float b=2.0*dot(dir,orig);float c=dot(orig,orig)-radius*radius;float d=sqrt(b*b-4.0*a*c);return (-b+d)/(2.0*a);}vec3 extinction(vec2 density) {return exp(-vec3(BETA_R*u_color_tint_r.a*density.x+BETA_M*u_color_tint_m.a*density.y));}vec2 local_density(vec3 point) {float height=max(length(point)-PLANET_RADIUS,0.0);float exp_r=exp(-height/DENSITY_HEIGHT_SCALE_R);float exp_m=exp(-height/DENSITY_HEIGHT_SCALE_M);return vec2(exp_r,exp_m);}float phase_ray(float cos_angle) {return (3.0/(16.0*PI))*(1.0+cos_angle*cos_angle);}float phase_mie(float cos_angle) {return (3.0/(8.0*PI))*((1.0-MIE_G*MIE_G)*(1.0+cos_angle*cos_angle))/((2.0+MIE_G*MIE_G)*pow(1.0+MIE_G*MIE_G-2.0*MIE_G*cos_angle,1.5));}vec2 density_to_atmosphere(vec3 point,vec3 light_dir) {float ray_len=ray_sphere_exit(point,light_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(DENSITY_STEPS);vec2 density_point_to_atmosphere=vec2(0.0);for (int i=0; i < DENSITY_STEPS;++i) {vec3 point_on_ray=point+light_dir*((float(i)+0.5)*step_len);density_point_to_atmosphere+=local_density(point_on_ray)*step_len;;}return density_point_to_atmosphere;}vec3 atmosphere(vec3 ray_dir,vec3 sun_direction,float sun_intensity) {vec2 density_orig_to_point=vec2(0.0);vec3 scatter_r=vec3(0.0);vec3 scatter_m=vec3(0.0);vec3 origin=vec3(0.0,PLANET_RADIUS,0.0);float ray_len=ray_sphere_exit(origin,ray_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(SAMPLE_STEPS);for (int i=0; i < SAMPLE_STEPS;++i) {vec3 point_on_ray=origin+ray_dir*((float(i)+0.5)*step_len);vec2 density=local_density(point_on_ray)*step_len;density_orig_to_point+=density;vec2 density_point_to_atmosphere=density_to_atmosphere(point_on_ray,sun_direction);vec2 density_orig_to_atmosphere=density_orig_to_point+density_point_to_atmosphere;vec3 extinction=extinction(density_orig_to_atmosphere);scatter_r+=density.x*extinction;scatter_m+=density.y*extinction;}float cos_angle=dot(ray_dir,sun_direction);float phase_r=phase_ray(cos_angle);float phase_m=phase_mie(cos_angle);vec3 beta_r=BETA_R*u_color_tint_r.rgb*u_color_tint_r.a;vec3 beta_m=BETA_M*u_color_tint_m.rgb*u_color_tint_m.a;return (scatter_r*phase_r*beta_r+scatter_m*phase_m*beta_m)*sun_intensity;}const float A=0.15;const float B=0.50;const float C=0.10;const float D=0.20;const float E=0.02;const float F=0.30;vec3 uncharted2_tonemap(vec3 x) {return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;}void main() {vec3 ray_direction=v_position;ray_direction.y=pow(ray_direction.y,5.0);const float y_bias=0.015;ray_direction.y+=y_bias;vec3 color=atmosphere(normalize(ray_direction),u_sun_direction,u_sun_intensity);float white_scale=1.0748724675633854;color=uncharted2_tonemap((log2(2.0/pow(u_luminance,4.0)))*color)*white_scale;gl_FragColor=vec4(color,1.0);}`,"attribute highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;varying highp vec3 v_position;float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec4 pos=vec4(u_matrix_3f*a_pos_3f,1.0);v_position=pos.xyz;v_position.y*=-1.0;v_position.y=map(v_position.y,-1.0,1.0,0.0,1.0);gl_Position=vec4(a_pos_3f.xy,0.0,1.0);}"),globeRaster:wr(`uniform sampler2D u_image0;varying vec2 v_pos0; +#ifndef FOG +uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform vec2 u_viewport; +#endif +void main() {vec4 color; +#ifdef CUSTOM_ANTIALIASING +vec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix( +mix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);vec3 dir=normalize(ray_dir);vec3 closest_point=dot(u_globe_pos,dir)*dir;float norm_dist_from_center=1.0-length(closest_point-u_globe_pos)/u_globe_radius;const float antialias_pixel=2.0;float antialias_factor=antialias_pixel*fwidth(norm_dist_from_center);float antialias=smoothstep(0.0,antialias_factor,norm_dist_from_center);vec4 raster=texture2D(u_image0,v_pos0);color=vec4(raster.rgb*antialias,raster.a*antialias); +#else +color=texture2D(u_image0,v_pos0); +#endif +#ifdef FOG +color=fog_dither(fog_apply_premultiplied(color,v_fog_pos)); +#endif +gl_FragColor=color; +#ifdef TERRAIN_WIREFRAME +gl_FragColor=vec4(1.0,0.0,0.0,0.8); +#endif +#ifdef OVERDRAW_INSPECTOR +gl_FragColor=vec4(1.0); +#endif +}`,`uniform mat4 u_proj_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform float u_zoom_transition;uniform vec2 u_merc_center;uniform mat3 u_grid_matrix;uniform float u_skirt_height; +#ifdef GLOBE_POLES +attribute vec3 a_globe_pos;attribute vec2 a_uv; +#else +attribute vec2 a_pos; +#endif +varying vec2 v_pos0;const float wireframeOffset=1e3;float mercatorXfromLng(float lng) {return (180.0+lng)/360.0;}float mercatorYfromLat(float lat) {return (180.0-(RAD_TO_DEG*log(tan(QUARTER_PI+lat/2.0*DEG_TO_RAD))))/360.0;}vec3 latLngToECEF(vec2 latLng) {latLng=DEG_TO_RAD*latLng;float cosLat=cos(latLng[0]);float sinLat=sin(latLng[0]);float cosLng=cos(latLng[1]);float sinLng=sin(latLng[1]);float sx=cosLat*sinLng*GLOBE_RADIUS;float sy=-sinLat*GLOBE_RADIUS;float sz=cosLat*cosLng*GLOBE_RADIUS;return vec3(sx,sy,sz);}void main() { +#ifdef GLOBE_POLES +vec3 globe_pos=a_globe_pos;vec2 uv=a_uv; +#else +float tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float uvY=mercatorY*tiles-idy;float mercatorX=mercatorXfromLng(latLng[1]);float uvX=mercatorX*tiles-idx;vec3 globe_pos=latLngToECEF(latLng.xy);vec2 merc_pos=vec2(mercatorX,mercatorY);vec2 uv=vec2(uvX,uvY); +#endif +v_pos0=uv;vec2 tile_pos=uv*EXTENT;vec3 globe_derived_up_vector=normalize(globe_pos)*u_tile_up_scale; +#ifdef GLOBE_POLES +vec3 up_vector=globe_derived_up_vector; +#else +vec3 up_vector=elevationVector(tile_pos); +#endif +float height=elevation(tile_pos); +#ifdef TERRAIN_WIREFRAME +height+=wireframeOffset; +#endif +globe_pos+=up_vector*height; +#ifndef GLOBE_POLES +globe_pos-=globe_derived_up_vector*u_skirt_height*decomposed_pos_and_skirt.z; +#endif +#ifdef GLOBE_POLES +vec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0); +#else +vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {merc_world_pos=vec4(merc_pos,height-u_skirt_height*decomposed_pos_and_skirt.z,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition),1.0); +#endif +gl_Position=u_proj_matrix*interpolated_pos; +#ifdef FOG +v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz); +#endif +}`),globeAtmosphere:wr(`uniform float u_transition;uniform highp float u_fadeout_range;uniform highp float u_temporal_offset;uniform vec3 u_start_color;uniform vec4 u_color;uniform vec4 u_space_color;uniform vec4 u_high_color;uniform float u_star_intensity;uniform float u_star_size;uniform float u_star_density;uniform float u_horizon_angle;uniform mat4 u_rotation_matrix;varying highp vec3 v_ray_dir;varying highp vec3 v_horizon_dir;highp float random(highp vec3 p) {p=fract(p*vec3(23.2342,97.1231,91.2342));p+=dot(p.zxy,p.yxz+123.1234);return fract(p.x*p.y);}float stars(vec3 p,float scale,vec2 offset) {vec2 uv_scale=(u_viewport/u_star_size)*scale;vec3 position=vec3(p.xy*uv_scale+offset*u_viewport,p.z);vec3 q=fract(position)-0.5;vec3 id=floor(position);float random_visibility=step(random(id),u_star_density);float circle=smoothstep(0.5+u_star_intensity,0.5,length(q));return circle*random_visibility;}void main() {highp vec3 dir=normalize(v_ray_dir);float globe_pos_dot_dir; +#ifdef PROJECTION_GLOBE_VIEW +globe_pos_dot_dir=dot(u_globe_pos,dir);highp vec3 closest_point_forward=abs(globe_pos_dot_dir)*dir;float norm_dist_from_center=length(closest_point_forward-u_globe_pos)/u_globe_radius;if (norm_dist_from_center < 0.98) {discard;return;} +#endif +highp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ? +0.0 : max(acos(dot(dir,horizon_dir)),0.0);float horizon_angle; +#ifdef PROJECTION_GLOBE_VIEW +highp vec3 closest_point=globe_pos_dot_dir*dir;float closest_point_to_center=length(closest_point-u_globe_pos);float theta=asin(clamp(closest_point_to_center/length(u_globe_pos),-1.0,1.0));horizon_angle=globe_pos_dot_dir < 0.0 ? +PI-theta-u_horizon_angle : theta-u_horizon_angle;float angle_t=pow(u_transition,10.0);horizon_angle=mix(horizon_angle,horizon_angle_mercator,angle_t); +#else +horizon_angle=horizon_angle_mercator; +#endif +horizon_angle/=PI;float t=exp(-horizon_angle/u_fadeout_range);float alpha_0=u_color.a;float alpha_1=u_high_color.a;float alpha_2=u_space_color.a;vec3 color_stop_0=u_color.rgb;vec3 color_stop_1=u_high_color.rgb;vec3 color_stop_2=u_space_color.rgb;vec3 c0=mix(color_stop_2,color_stop_1,alpha_1);vec3 c1=mix(c0,color_stop_0,alpha_0);vec3 c2=mix(c0,c1,t);vec3 c =mix(color_stop_2,c2,t);float a0=mix(alpha_2,1.0,alpha_1);float a1=mix(a0,1.0,alpha_0);float a2=mix(a0,a1,t);float a =mix(alpha_2,a2,t);vec2 uv=gl_FragCoord.xy/u_viewport-0.5;float aspect_ratio=u_viewport.x/u_viewport.y;vec4 uv_dir=vec4(normalize(vec3(uv.x*aspect_ratio,uv.y,1.0)),1.0);uv_dir=u_rotation_matrix*uv_dir;vec3 n=abs(uv_dir.xyz);vec2 uv_remap=(n.x > n.y && n.x > n.z) ? uv_dir.yz/uv_dir.x: +(n.y > n.x && n.y > n.z) ? uv_dir.zx/uv_dir.y: +uv_dir.xy/uv_dir.z;uv_remap.x/=aspect_ratio;vec3 D=vec3(uv_remap,1.0);highp float star_field=0.0;if (u_star_intensity > 0.0) {star_field+=stars(D,1.2,vec2(0.0,0.0));star_field+=stars(D,1.0,vec2(1.0,0.0));star_field+=stars(D,0.8,vec2(0.0,1.0));star_field+=stars(D,0.6,vec2(1.0,1.0));star_field*=(1.0-pow(t,0.25+(1.0-u_high_color.a)*0.75));c+=star_field*alpha_2;}c=dither(c,gl_FragCoord.xy+u_temporal_offset);gl_FragColor=vec4(c,a);}`,`attribute vec3 a_pos;attribute vec2 a_uv;uniform vec3 u_frustum_tl;uniform vec3 u_frustum_tr;uniform vec3 u_frustum_br;uniform vec3 u_frustum_bl;uniform float u_horizon;varying highp vec3 v_ray_dir;varying highp vec3 v_horizon_dir;void main() {v_ray_dir=mix( +mix(u_frustum_tl,u_frustum_tr,a_uv.x),mix(u_frustum_bl,u_frustum_br,a_uv.x),a_uv.y);v_horizon_dir=mix( +mix(u_frustum_tl,u_frustum_bl,u_horizon),mix(u_frustum_tr,u_frustum_br,u_horizon),a_uv.x);gl_Position=vec4(a_pos,1.0);}`)};function xl(f,s){const h=f.replace(/\s*\/\/[^\n]*\n/g,` +`).split(` +`);for(let g of h)if(g=g.trim(),g[0]==="#"&&g.includes("if")&&!g.includes("endif")){g=g.replace("#","").replace(/ifdef|ifndef|elif|if/g,"").replace(/!|defined|\(|\)|\|\||&&/g,"").replace(/\s+/g," ").trim();const v=g.split(" ");for(const b of v)s.includes(b)||s.push(b)}}function wr(f,s){const h=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,g=s.match(/attribute (highp |mediump |lowp )?([\w]+) ([\w]+)/g),v={},b=[...Lc];return xl(f,b),xl(s,b),{fragmentSource:f=f.replace(h,(A,I,D,N,B)=>(v[B]=!0,I==="define"?` +#ifndef HAS_UNIFORM_u_${B} +varying ${D} ${N} ${B}; +#else +uniform ${D} ${N} u_${B}; +#endif +`:` +#ifdef HAS_UNIFORM_u_${B} + ${D} ${N} ${B} = u_${B}; +#endif +`)),vertexSource:s=s.replace(h,(A,I,D,N,B)=>{const q=N==="float"?"vec2":"vec4",J=B.match(/color/)?"color":q;return v[B]?I==="define"?` +#ifndef HAS_UNIFORM_u_${B} +uniform lowp float u_${B}_t; +attribute ${D} ${q} a_${B}; +varying ${D} ${N} ${B}; +#else +uniform ${D} ${N} u_${B}; +#endif +`:J==="vec4"?` +#ifndef HAS_UNIFORM_u_${B} + ${B} = a_${B}; +#else + ${D} ${N} ${B} = u_${B}; +#endif +`:` +#ifndef HAS_UNIFORM_u_${B} + ${B} = unpack_mix_${J}(a_${B}, u_${B}_t); +#else + ${D} ${N} ${B} = u_${B}; +#endif +`:I==="define"?` +#ifndef HAS_UNIFORM_u_${B} +uniform lowp float u_${B}_t; +attribute ${D} ${q} a_${B}; +#else +uniform ${D} ${N} u_${B}; +#endif +`:J==="vec4"?` +#ifndef HAS_UNIFORM_u_${B} + ${D} ${N} ${B} = a_${B}; +#else + ${D} ${N} ${B} = u_${B}; +#endif +`:` +#ifndef HAS_UNIFORM_u_${B} + ${D} ${N} ${B} = unpack_mix_${J}(a_${B}, u_${B}_t); +#else + ${D} ${N} ${B} = u_${B}; +#endif +`}),staticAttributes:g,usedDefines:b}}class Xv{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}bind(s,h,g,v,b,A,I){this.context=s;let D=this.boundPaintVertexBuffers.length!==v.length;for(let B=0;!D&&B{const ue=Z.paint.get("hillshade-shadow-color"),he=Z.paint.get("hillshade-highlight-color"),be=Z.paint.get("hillshade-accent-color");let Se=Z.paint.get("hillshade-illumination-direction")*(Math.PI/180);Z.paint.get("hillshade-illumination-anchor")==="viewport"&&(Se-=ie.transform.angle);const we=!ie.options.moving;return{u_matrix:re||ie.transform.calculateProjMatrix(ae.tileID.toUnwrapped(),we),u_image:0,u_latrange:lp(0,ae.tileID),u_light:[Z.paint.get("hillshade-exaggeration"),Se],u_shadow:ue,u_highlight:he,u_accent:be}})(f,h,g,f.terrain?s.projMatrix:null);f.prepareDrawProgram(I,B,s.toUnwrapped());const{tileBoundsBuffer:J,tileBoundsIndexBuffer:ne,tileBoundsSegments:oe}=f.getTileBoundsBuffers(h);B.draw(I,D.TRIANGLES,v,b,A,l.CullFaceMode.disabled,q,g.id,J,ne,oe)}function cp(f,s,h){if(!s.needsDEMTextureUpload)return;const g=f.context,v=g.gl;g.pixelStoreUnpackPremultiplyAlpha.set(!1),s.demTexture=s.demTexture||f.getTileTexture(h.stride);const b=h.getPixels();s.demTexture?s.demTexture.update(b,{premultiply:!1}):s.demTexture=new l.Texture(g,b,v.RGBA,{premultiply:!1}),s.needsDEMTextureUpload=!1}function l0(f,s,h,g,v,b){const A=f.context,I=A.gl;if(!s.dem)return;const D=s.dem;if(A.activeTexture.set(I.TEXTURE1),cp(f,s,D),!s.demTexture)return;s.demTexture.bind(I.NEAREST,I.CLAMP_TO_EDGE);const N=D.dim;A.activeTexture.set(I.TEXTURE0);let B=s.fbo;if(!B){const oe=new l.Texture(A,{width:N,height:N,data:null},I.RGBA);oe.bind(I.LINEAR,I.CLAMP_TO_EDGE),B=s.fbo=A.createFramebuffer(N,N,!0),B.colorAttachment.set(oe.texture)}A.bindFramebuffer.set(B.framebuffer),A.viewport.set([0,0,N,N]);const{tileBoundsBuffer:q,tileBoundsIndexBuffer:J,tileBoundsSegments:ne}=f.getMercatorTileBoundsBuffers();f.useProgram("hillshadePrepare").draw(A,I.TRIANGLES,g,v,b,l.CullFaceMode.disabled,((oe,ie)=>{const ae=ie.stride,Z=l.create();return l.ortho(Z,0,l.EXTENT,-l.EXTENT,0,0,1),l.translate(Z,Z,[0,-l.EXTENT,0]),{u_matrix:Z,u_image:1,u_dimension:[ae,ae],u_zoom:oe.overscaledZ,u_unpack:ie.unpackVector}})(s.tileID,D),h.id,q,J,ne),s.needsHillshadePrepare=!1}const up=f=>({u_matrix:new l.UniformMatrix4f(f),u_image0:new l.Uniform1i(f),u_skirt_height:new l.Uniform1f(f)}),bl=(f,s)=>({u_matrix:f,u_image0:0,u_skirt_height:s}),Zu=(f,s,h,g,v,b,A,I,D,N,B,q,J,ne,oe)=>({u_proj_matrix:Float32Array.from(f),u_globe_matrix:s,u_normalize_matrix:Float32Array.from(g),u_merc_matrix:h,u_zoom_transition:v,u_merc_center:b,u_image0:0,u_frustum_tl:A,u_frustum_tr:I,u_frustum_br:D,u_frustum_bl:N,u_globe_pos:B,u_globe_radius:q,u_viewport:J,u_grid_matrix:oe?Float32Array.from(oe):new Float32Array(9),u_skirt_height:ne});function wl(f,s){return f!=null&&s!=null&&!(!f.hasData()||!s.hasData())&&f.demTexture!=null&&s.demTexture!=null&&f.tileID.key!==s.tileID.key}const Ta=new class{constructor(){this.operations={}}newMorphing(f,s,h,g,v){if(f in this.operations){const b=this.operations[f];b.to.tileID.key!==h.tileID.key&&(b.queued=h)}else this.operations[f]={startTime:g,phase:0,duration:v,from:s,to:h,queued:null}}getMorphValuesForProxy(f){if(!(f in this.operations))return null;const s=this.operations[f];return{from:s.from,to:s.to,phase:s.phase}}update(f){for(const s in this.operations){const h=this.operations[s];for(h.phase=(f-h.startTime)/h.duration;h.phase>=1||!this._validOp(h);)if(!this._nextOp(h,f)){delete this.operations[s];break}}}_nextOp(f,s){return!!f.queued&&(f.from=f.to,f.to=f.queued,f.queued=null,f.phase=0,f.startTime=s,!0)}_validOp(f){return f.from.hasData()&&f.to.hasData()}},Fs={0:null,1:"TERRAIN_VERTEX_MORPHING",2:"TERRAIN_WIREFRAME"};function Ku(f){return 6*Math.pow(1.5,22-f)}function c0(f,s){const h=1<({u_matrix:f});function hp(f,s,h,g,v){if(v>0){const b=l.exported.now(),A=(b-f.timeAdded)/v,I=s?(b-s.timeAdded)/v:-1,D=h.getSource(),N=g.coveringZoomLevel({tileSize:D.tileSize,roundZoom:D.roundZoom}),B=!s||Math.abs(s.tileID.overscaledZ-N)>Math.abs(f.tileID.overscaledZ-N),q=B&&f.refreshedUponExpiration?1:l.clamp(B?A:1-I,0,1);return f.refreshedUponExpiration&&A>=1&&(f.refreshedUponExpiration=!1),s?{opacity:1,mix:1-q}:{opacity:q,mix:0}}return{opacity:1,mix:0}}class dp extends l.SourceCache{constructor(s){const h={type:"raster-dem",maxzoom:s.transform.maxZoom},g=new gt(ml(),null),v=Qt("mock-dem",h,g,s.style);super("mock-dem",v,!1),v.setEventedParent(this),this._sourceLoaded=!0}_loadTile(s,h){s.state="loaded",h(null)}}class Xu extends l.SourceCache{constructor(s){const h=Qt("proxy",{type:"geojson",maxzoom:s.transform.maxZoom},new gt(ml(),null),s.style);super("proxy",h,!1),h.setEventedParent(this),this.map=this.getSource().map=s,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(s,h,g){if(s.freezeTileCoverage)return;this.transform=s;const v=s.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce((b,A)=>{if(b[A.key]="",!this._tiles[A.key]){const I=new l.Tile(A,this._source.tileSize*A.overscaleFactor(),s.tileZoom);I.state="loaded",this._tiles[A.key]=I}return b},{});for(const b in this._tiles)b in v||(this.freeFBO(b),this._tiles[b].unloadVectorData(),delete this._tiles[b])}freeFBO(s){const h=this.proxyCachedFBO[s];if(h!==void 0){const g=Object.values(h);this.renderCachePool.push(...g),delete this.proxyCachedFBO[s]}}deallocRenderCache(){this.renderCache.forEach(s=>s.fb.destroy()),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class Yu extends l.OverscaledTileID{constructor(s,h,g){super(s.overscaledZ,s.wrap,s.canonical.z,s.canonical.x,s.canonical.y),this.proxyTileKey=h,this.projMatrix=g}}class pp extends l.Elevation{constructor(s,h){super(),this.painter=s,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[g,v,b]=function(D){const N=new l.StructArrayLayout2i4,B=new l.StructArrayLayout3ui6,q=131;N.reserve(17161),B.reserve(33800);const J=l.EXTENT/128,ne=l.EXTENT+J/2,oe=ne+J;for(let ae=-J;aene||ae<0||ae>ne?24575:0,ue=l.clamp(Math.round(Z),0,l.EXTENT),he=l.clamp(Math.round(ae),0,l.EXTENT);N.emplaceBack(ue+re,he)}const ie=(ae,Z)=>{const re=Z*q+ae;B.emplaceBack(re+1,re,re+q),B.emplaceBack(re+q,re+q+1,re+1)};for(let ae=1;ae<129;ae++)for(let Z=1;Z<129;Z++)ie(Z,ae);return[0,129].forEach(ae=>{for(let Z=0;Z<130;Z++)ie(Z,ae),ie(ae,Z)}),[N,B,32768]}(),A=s.context;this.gridBuffer=A.createVertexBuffer(g,l.posAttributes.members),this.gridIndexBuffer=A.createIndexBuffer(v),this.gridSegments=l.SegmentVector.simpleSegment(0,0,g.length,v.length),this.gridNoSkirtSegments=l.SegmentVector.simpleSegment(0,0,g.length,b),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new Xu(h.map),this.orthoMatrix=l.create(),l.ortho(this.orthoMatrix,this.painter.transform.projection.name==="globe"?.015:0,l.EXTENT,0,l.EXTENT,0,1);const I=A.gl;this._overlapStencilMode=new l.StencilMode({func:I.GEQUAL,mask:255},0,255,I.KEEP,I.KEEP,I.REPLACE),this._previousZoom=s.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=h,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new dp(h.map)}set style(s){s.on("data",this._onStyleDataEvent.bind(this)),s.on("neworder",this._checkRenderCacheEfficiency.bind(this)),this._style=s,this._checkRenderCacheEfficiency(),this._style.map.on("moveend",()=>{this._clearLineLayersFromRenderCache()})}update(s,h,g){if(s&&s.terrain){this._style!==s&&(this.style=s),this.enabled=!0;const v=s.terrain.properties;this.sourceCache=s.terrain.drapeRenderMode===0?this._mockSourceCache:s._getSourceCache(v.get("source")),this._exaggeration=v.get("exaggeration");const b=()=>{this.sourceCache.used&&l.warnOnce(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source. +This leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);const A=this.getScaledDemTileSize();this.sourceCache.update(h,A,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,b(),this._initializing=!0),b(),h.updateElevation(!0,g),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(h),this._emptyDEMTextureDirty=!0}else this._disable()}resetTileLookupCache(s){this._findCoveringTileCache[s]={}}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_checkRenderCacheEfficiency(){const s=this.renderCacheEfficiency(this._style);this._style.map._optimizeForTerrain||s.efficiency!==100&&l.warnOnce(`Terrain render cache efficiency is not optimal (${s.efficiency}%) and performance + may be affected negatively, consider placing all background, fill and line layers before layer + with id '${s.firstUndrapedLayer}' or create a map using optimizeForTerrain: true option.`)}_onStyleDataEvent(s){s.coord&&s.dataType==="source"?this._clearRenderCacheForTile(s.sourceCacheId,s.coord):s.dataType==="style"&&(this._invalidateRenderCache=!0)}_disable(){if(this.enabled&&(this.enabled=!1,this._sharedDepthStencil=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(const s in this._style._sourceCaches)this._style._sourceCaches[s].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this._emptyDepthBufferTexture&&this._emptyDepthBufferTexture.destroy(),this.pool.forEach(s=>s.fb.destroy()),this.pool=[],this._depthFBO&&(this._depthFBO.destroy(),this._depthFBO=void 0,this._depthTexture=void 0)}_source(){return this.enabled?this.sourceCache:null}isUsingMockSource(){return this.sourceCache===this._mockSourceCache}exaggeration(){return this._exaggeration}get visibleDemTiles(){return this._visibleDemTiles}get drapeBufferSize(){const s=2*this.proxySourceCache.getSource().tileSize;return[s,s]}set useVertexMorphing(s){this._useVertexMorphing=s}updateTileBinding(s){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const h=this.proxySourceCache,g=this.painter.transform;this._initializing&&(this._initializing=g._centerAltitude===0&&this.getAtPointOrZero(l.MercatorCoordinate.fromLngLat(g.center),-1)===-1,this._emptyDEMTextureDirty=!this._initializing);const v=this.proxyCoords=h.getIds().map(D=>{const N=h.getTileByID(D).tileID;return N.projMatrix=g.calculateProjMatrix(N.toUnwrapped()),N});(function(D,N){const B=N.transform.pointCoordinate(N.transform.getCameraPoint()),q=new l.Point(B.x,B.y);D.sort((J,ne)=>{if(ne.overscaledZ-J.overscaledZ)return ne.overscaledZ-J.overscaledZ;const oe=new l.Point(J.canonical.x+(1<{this.proxyToSource[D.key]={}}),this.terrainTileForTile={};const A=this._style._sourceCaches;for(const D in A){const N=A[D];if(!N.used||(N!==this.sourceCache&&this.resetTileLookupCache(N.id),this._setupProxiedCoordsForOrtho(N,s[D],b),N.usedForTerrain))continue;const B=s[D];N.getSource().reparseOverscaled&&this._assignTerrainTiles(B)}this.proxiedCoords[h.id]=v.map(D=>new Yu(D,D.key,this.orthoMatrix)),this._assignTerrainTiles(v),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(b),this.renderingToTexture=!1,this._updateTimestamp=l.exported.now();const I={};this._visibleDemTiles=[];for(const D of this.proxyCoords){const N=this.terrainTileForTile[D.key];if(!N)continue;const B=N.tileID.key;B in I||(this._visibleDemTiles.push(N),I[B]=B)}}_assignTerrainTiles(s){this._initializing||s.forEach(h=>{if(this.terrainTileForTile[h.key])return;const g=this._findTileCoveringTileID(h,this.sourceCache);g&&(this.terrainTileForTile[h.key]=g)})}_prepareDEMTextures(){const s=this.painter.context,h=s.gl;for(const g in this.terrainTileForTile){const v=this.terrainTileForTile[g],b=v.dem;!b||v.demTexture&&!v.needsDEMTextureUpload||(s.activeTexture.set(h.TEXTURE1),cp(this.painter,v,b))}}_prepareDemTileUniforms(s,h,g,v){if(!h||h.demTexture==null)return!1;const b=s.tileID.canonical,A=Math.pow(2,h.tileID.canonical.z-b.z),I=v||"";return g[`u_dem_tl${I}`]=[b.x*A%1,b.y*A%1],g[`u_dem_scale${I}`]=A,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}get emptyDepthBufferTexture(){const s=this.painter.context,h=s.gl;if(!this._emptyDepthBufferTexture){const g=new l.RGBAImage({width:1,height:1},Uint8Array.of(255,255,255,255));this._emptyDepthBufferTexture=new l.Texture(s,g,h.RGBA,{premultiply:!1})}return this._emptyDepthBufferTexture}_getLoadedAreaMinimum(){let s=0;const h=this._visibleDemTiles.reduce((g,v)=>{if(!v.dem)return g;const b=v.dem.tree.minimums[0];return b>0&&s++,g+b},0);return s?h/s:0}_updateEmptyDEMTexture(){const s=this.painter.context,h=s.gl;s.activeTexture.set(h.TEXTURE2);const g=this._getLoadedAreaMinimum(),v=new l.RGBAImage({width:1,height:1},new Uint8Array(l.DEMData.pack(g,this.sourceCache.getSource().encoding)));this._emptyDEMTextureDirty=!1;let b=this._emptyDEMTexture;return b?b.update(v,{premultiply:!1}):b=this._emptyDEMTexture=new l.Texture(s,v,h.RGBA,{premultiply:!1}),b}setupElevationDraw(s,h,g){const v=this.painter.context,b=v.gl,A=(I=this.sourceCache.getSource().encoding,{u_dem:2,u_dem_prev:4,u_dem_unpack:l.DEMData.getUnpackVector(I),u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_exaggeration:0});var I;A.u_dem_size=this.sourceCache.getSource().tileSize,A.u_exaggeration=this.exaggeration();let D=null,N=null,B=1;if(g&&g.morphing&&this._useVertexMorphing){const q=g.morphing.srcDemTile,J=g.morphing.dstDemTile;B=g.morphing.phase,q&&J&&(this._prepareDemTileUniforms(s,q,A,"_prev")&&(N=q),this._prepareDemTileUniforms(s,J,A)&&(D=J))}if(N&&D?(v.activeTexture.set(b.TEXTURE2),D.demTexture.bind(b.NEAREST,b.CLAMP_TO_EDGE,b.NEAREST),v.activeTexture.set(b.TEXTURE4),N.demTexture.bind(b.NEAREST,b.CLAMP_TO_EDGE,b.NEAREST),A.u_dem_lerp=B):(D=this.terrainTileForTile[s.tileID.key],v.activeTexture.set(b.TEXTURE2),(this._prepareDemTileUniforms(s,D,A)?D.demTexture:this.emptyDEMTexture).bind(b.NEAREST,b.CLAMP_TO_EDGE)),v.activeTexture.set(b.TEXTURE3),g&&g.useDepthForOcclusion?(this._depthTexture&&this._depthTexture.bind(b.NEAREST,b.CLAMP_TO_EDGE),this._depthFBO&&(A.u_depth_size_inv=[1/this._depthFBO.width,1/this._depthFBO.height])):(this.emptyDepthBufferTexture.bind(b.NEAREST,b.CLAMP_TO_EDGE),A.u_depth_size_inv=[1,1]),g&&g.useMeterToDem&&D){const q=(1<{if(Z===at)return;const Ze=[Fs[at],"PROJECTION_GLOBE_VIEW"];he&&Ze.push("CUSTOM_ANTIALIASING"),ze&&Ze.push(Fs[re]),ae=N.useProgram("globeRaster",null,Ze),Z=at},Se=N.colorModeForRenderPass(),we=new l.DepthMode(ie.LEQUAL,l.DepthMode.ReadWrite,N.depthRangeFor3D);Ta.update(ne);const Ce=l.calculateGlobeMercatorMatrix(ue),Ie=[l.mercatorXfromLng(ue.center.lng),l.mercatorYfromLat(ue.center.lat)],Re=re?[!1,!0]:[!1],st=N.globeSharedBuffers,De=[ue.width*l.exported.devicePixelRatio,ue.height*l.exported.devicePixelRatio],Ke=Float32Array.from(ue.globeMatrix),Ne={useDenormalizedUpVectorScale:!0};if(Re.forEach(at=>{const ze=N.transform,Ze=Ku(ze.zoom)*B.exaggeration();Z=-1;const ut=at?ie.LINES:ie.TRIANGLES;for(const tt of J){const ht=q.getTile(tt),Mt=l.StencilMode.disabled,$t=B.prevTerrainTileForTile[tt.key],It=B.terrainTileForTile[tt.key];wl($t,It)&&Ta.newMorphing(tt.key,$t,It,ne,250),oe.activeTexture.set(ie.TEXTURE0),ht.texture.bind(ie.LINEAR,ie.CLAMP_TO_EDGE);const Lt=Ta.getMorphValuesForProxy(tt.key),nr=Lt?1:0;Lt&&l.extend$1(Ne,{morphing:{srcDemTile:Lt.from,dstDemTile:Lt.to,phase:l.easeCubicInOut(Lt.phase)}});const er=l.tileCornersToBounds(tt.canonical),Pt=l.getLatitudinalLod(er.getCenter().lat),Ar=l.getGridMatrix(tt.canonical,er,Pt,ze.worldSize/ze._pixelsPerMercatorPixel),Mr=l.globeNormalizeECEF(l.globeTileBounds(tt.canonical)),zr=Zu(ze.projMatrix,Ke,Ce,Mr,l.globeToMercatorTransition(ze.zoom),Ie,ze.frustumCorners.TL,ze.frustumCorners.TR,ze.frustumCorners.BR,ze.frustumCorners.BL,ze.globeCenterInViewSpace,ze.globeRadius,De,Ze,Ar);if(be(nr,at),B.setupElevationDraw(ht,ae,Ne),N.prepareDrawProgram(oe,ae,tt.toUnwrapped()),st){const[Rr,ui,Gn]=at?st.getWirefameBuffers(N.context,Pt):st.getGridBuffers(Pt,Ze!==0);ae.draw(oe,ut,we,Mt,Se,l.CullFaceMode.backCCW,zr,"globe_raster",Rr,ui,Gn)}}}),st){const at=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];he&&at.push("CUSTOM_ANTIALIASING"),ae=N.useProgram("globeRaster",null,at);for(const ze of J){const{x:Ze,y:ut,z:tt}=ze.canonical,ht=ut===0,Mt=ut===(1<zr.draw(oe,ie.TRIANGLES,we,l.StencilMode.disabled,Se,l.CullFaceMode.disabled,Zu(ue.projMatrix,Pt,Pt,Ar,0,Ie,ue.frustumCorners.TL,ue.frustumCorners.TR,ue.frustumCorners.BR,ue.frustumCorners.BL,ue.globeCenterInViewSpace,ue.globeRadius,De,0),"globe_pole_raster",Rr,Lt,nr);B.setupElevationDraw(er,ae,Ne),N.prepareDrawProgram(oe,ae,ze.toUnwrapped()),ht&&Mr(ae,$t),Mt&&(Pt=l.scale(l.create(),Pt,[1,-1,1]),Mr(ae,It))}}}})(v,b,A,I,D);else{const N=v.context,B=N.gl;let q,J;const ne=v.options.showTerrainWireframe?2:0,oe=(ue,he)=>{if(J===ue)return;const be=[Fs[ue]];he&&be.push(Fs[ne]),q=v.useProgram("terrainRaster",null,be),J=ue},ie=v.colorModeForRenderPass(),ae=new l.DepthMode(B.LEQUAL,l.DepthMode.ReadWrite,v.depthRangeFor3D);Ta.update(D);const Z=v.transform,re=Ku(Z.zoom)*b.exaggeration();(ne?[!1,!0]:[!1]).forEach(ue=>{J=-1;const he=ue?B.LINES:B.TRIANGLES,[be,Se]=ue?b.getWirefameBuffer():[b.gridIndexBuffer,b.gridSegments];for(const we of I){const Ce=A.getTile(we),Ie=l.StencilMode.disabled,Re=b.prevTerrainTileForTile[we.key],st=b.terrainTileForTile[we.key];wl(Re,st)&&Ta.newMorphing(we.key,Re,st,D,250),N.activeTexture.set(B.TEXTURE0),Ce.texture.bind(B.LINEAR,B.CLAMP_TO_EDGE,B.LINEAR_MIPMAP_NEAREST);const De=Ta.getMorphValuesForProxy(we.key),Ke=De?1:0;let Ne;De&&(Ne={morphing:{srcDemTile:De.from,dstDemTile:De.to,phase:l.easeCubicInOut(De.phase)}});const at=bl(we.projMatrix,c0(we.canonical,Z.renderWorldCopies)?re/10:re);oe(Ke,ue),b.setupElevationDraw(Ce,q,Ne),v.prepareDrawProgram(N,q,we.toUnwrapped()),q.draw(N,he,ae,Ie,ie,l.CullFaceMode.backCCW,at,"terrain_raster",b.gridBuffer,be,Se)}})}}(h,this,this.proxySourceCache,s,this._updateTimestamp),this.renderingToTexture=!0,h.gpuTimingDeferredRenderEnd(),s.splice(0,s.length))}renderBatch(s){if(this._drapedRenderBatches.length===0)return s+1;this.renderingToTexture=!0;const h=this.painter,g=this.painter.context,v=this.proxySourceCache,b=this.proxiedCoords[v.id],A=this._drapedRenderBatches.shift(),I=[],D=h.style.order;let N=0;for(const B of b){const q=v.getTileByID(B.proxyTileKey),J=v.proxyCachedFBO[B.key]?v.proxyCachedFBO[B.key][s]:void 0,ne=J!==void 0?v.renderCache[J]:this.pool[N++],oe=J!==void 0;if(q.texture=ne.tex,oe&&!ne.dirty){I.push(q.tileID);continue}let ie;g.bindFramebuffer.set(ne.fb.framebuffer),this.renderedToTile=!1,ne.dirty&&(g.clear({color:l.Color.transparent,stencil:0}),ne.dirty=!1);for(let ae=A.start;ae<=A.end;++ae){const Z=h.style._layers[D[ae]];if(Z.isHidden(h.transform.zoom))continue;const re=h.style._getLayerSourceCache(Z),ue=re?this.proxyToSource[B.key][re.id]:[B];if(!ue)continue;const he=ue;g.viewport.set([0,0,ne.fb.width,ne.fb.height]),ie!==(re?re.id:null)&&(this._setupStencil(ne,ue,Z,re),ie=re?re.id:null),h.renderLayer(h,re,Z,he)}this.renderedToTile?(ne.dirty=!0,I.push(q.tileID)):oe||--N,N===5&&(N=0,this.renderToBackBuffer(I))}return this.renderToBackBuffer(I),this.renderingToTexture=!1,g.bindFramebuffer.set(null),g.viewport.set([0,0,h.width,h.height]),A.end+1}postRender(){}renderCacheEfficiency(s){const h=s.order.length;if(h===0)return{efficiency:100};let g,v=0,b=0,A=!1;for(let I=0;Ih.dem).forEach(h=>{s=Math.min(s,h.dem.tree.minimums[0])}),s===0?s:(s-30)*this._exaggeration}raycast(s,h,g){if(!this._visibleDemTiles)return null;const v=this._visibleDemTiles.filter(b=>b.dem).map(b=>{const A=b.tileID,I=1<(b.t!==null?b.t:Number.MAX_VALUE)-(A.t!==null?A.t:Number.MAX_VALUE));for(const b of v){if(b.t==null)return null;const A=b.tile.dem.tree.raycast(b.minx,b.miny,b.maxx,b.maxy,s,h,g);if(A!=null)return A}return null}_createFBO(){const s=this.painter.context,h=s.gl,g=this.drapeBufferSize;s.activeTexture.set(h.TEXTURE0);const v=new l.Texture(s,{width:g[0],height:g[1],data:null},h.RGBA);v.bind(h.LINEAR,h.CLAMP_TO_EDGE);const b=s.createFramebuffer(g[0],g[1],!1);return b.colorAttachment.set(v.texture),b.depthAttachment=new Te(s,b.framebuffer),this._sharedDepthStencil===void 0?(this._sharedDepthStencil=s.createRenderbuffer(s.gl.DEPTH_STENCIL,g[0],g[1]),this._stencilRef=0,b.depthAttachment.set(this._sharedDepthStencil),s.clear({stencil:0})):b.depthAttachment.set(this._sharedDepthStencil),s.extTextureFilterAnisotropic&&!s.extTextureFilterAnisotropicForceOff&&h.texParameterf(h.TEXTURE_2D,s.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,s.extTextureFilterAnisotropicMax),{fb:b,tex:v,dirty:!1}}_initFBOPool(){for(;this.pool.length{const h=this._style._layers[s],g=h.isHidden(this.painter.transform.zoom);return h.type==="custom"?!g&&h.shouldRedrape():!g&&h.hasTransition()})}_clearLineLayersFromRenderCache(){let s=!1;for(const g of this._style._getSources())if(g instanceof mt){s=!0;break}if(!s)return;const h={};for(let g=0;gh.renderCachePool.length){const A=Object.values(h.proxyCachedFBO);h.proxyCachedFBO={};for(let I=0;I=0;A--){const I=g[A];if(h.getTileByID(I.key),h.proxyCachedFBO[I.key]!==void 0){const D=s[I.key],N=this.proxyToSource[I.key];let B=0;for(const q in N){const J=N[q],ne=D[q];if(!ne||ne.length!==J.length||J.some((oe,ie)=>oe!==ne[ie]||v[q]&&v[q].hasOwnProperty(oe.key))){B=-1;break}++B}for(const q in h.proxyCachedFBO[I.key])h.renderCache[h.proxyCachedFBO[I.key][q]].dirty=B<0||B!==Object.values(D).length}}const b=[...this._drapedRenderBatches];b.sort((A,I)=>I.end-I.start-(A.end-A.start));for(const A of b)for(const I of g){if(h.proxyCachedFBO[I.key])continue;let D=h.renderCachePool.pop();D===void 0&&h.renderCache.length<50&&(D=h.renderCache.length,h.renderCache.push(this._createFBO())),D!==void 0&&(h.proxyCachedFBO[I.key]={},h.proxyCachedFBO[I.key][A.start]=D,h.renderCache[D].dirty=!0)}this._tilesDirty={}}_setupStencil(s,h,g,v){if(!v||!this._sourceTilesOverlap[v.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const b=this.painter.context,A=b.gl;if(h.length<=1)return void(this._overlapStencilType=!1);let I;if(g.isTileClipped())I=h.length,this._overlapStencilMode.test={func:A.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(h[0].overscaledZ>h[h.length-1].overscaledZ))return void(this._overlapStencilType=!1);I=1,this._overlapStencilMode.test={func:A.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+I>255&&(b.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=I,this._overlapStencilMode.ref=this._stencilRef,g.isTileClipped()&&this._renderTileClippingMasks(h,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return this._overlapStencilType==="Clip"||this._overlapStencilType==="Mask"}stencilModeForRTTOverlap(s){return this.renderingToTexture&&this._overlapStencilType?(this._overlapStencilType==="Clip"&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[s.key]),this._overlapStencilMode):l.StencilMode.disabled}_renderTileClippingMasks(s,h){const g=this.painter,v=this.painter.context,b=v.gl;g._tileClippingMaskIDs={},v.setColorMode(l.ColorMode.disabled),v.setDepthMode(l.DepthMode.disabled);const A=g.useProgram("clippingMask");for(const I of s){const D=g._tileClippingMaskIDs[I.key]=--h;A.draw(v,b.TRIANGLES,l.DepthMode.disabled,new l.StencilMode({func:b.ALWAYS,mask:0},D,255,b.KEEP,b.KEEP,b.REPLACE),l.ColorMode.disabled,l.CullFaceMode.disabled,Bc(I.projMatrix),"$clipping",g.tileExtentBuffer,g.quadTriangleIndexBuffer,g.tileExtentSegments)}}pointCoordinate(s){const h=this.painter.transform;if(s.x<0||s.x>h.width||s.y<0||s.y>h.height)return null;const g=[s.x,s.y,1,1];l.transformMat4$1(g,g,h.pixelMatrixInverse),l.scale$1(g,g,1/g[3]),g[0]/=h.worldSize,g[1]/=h.worldSize;const v=h._camera.position,b=l.mercatorZfromAltitude(1,h.center.lat),A=[v[0],v[1],v[2]/b,0],I=l.subtract([],g.slice(0,3),A);l.normalize(I,I);const D=this.raycast(A,I,this._exaggeration);return D!==null&&D?(l.scaleAndAdd(A,A,I,D),A[3]=A[2],A[2]*=b,A):null}drawDepth(){const s=this.painter,h=s.context,g=this.proxySourceCache,v=Math.ceil(s.width),b=Math.ceil(s.height);if(!this._depthFBO||this._depthFBO.width===v&&this._depthFBO.height===b||(this._depthFBO.destroy(),this._depthFBO=void 0,this._depthTexture=void 0),!this._depthFBO){const A=h.gl,I=h.createFramebuffer(v,b,!0);h.activeTexture.set(A.TEXTURE0);const D=new l.Texture(h,{width:v,height:b,data:null},A.RGBA);D.bind(A.NEAREST,A.CLAMP_TO_EDGE),I.colorAttachment.set(D.texture);const N=h.createRenderbuffer(h.gl.DEPTH_COMPONENT16,v,b);I.depthAttachment.set(N),this._depthFBO=I,this._depthTexture=D}h.bindFramebuffer.set(this._depthFBO.framebuffer),h.viewport.set([0,0,v,b]),function(A,I,D,N){if(A.transform.projection.name==="globe")return;const B=A.context,q=B.gl;B.clear({depth:1});const J=A.useProgram("terrainDepth"),ne=new l.DepthMode(q.LESS,l.DepthMode.ReadWrite,A.depthRangeFor3D);for(const oe of N){const ie=D.getTile(oe),ae=bl(oe.projMatrix,0);I.setupElevationDraw(ie,J),J.draw(B,q.TRIANGLES,ne,l.StencilMode.disabled,l.ColorMode.unblended,l.CullFaceMode.backCCW,ae,"terrain_depth",I.gridBuffer,I.gridIndexBuffer,I.gridNoSkirtSegments)}}(s,this,g,this.proxyCoords)}_setupProxiedCoordsForOrtho(s,h,g){if(s.getSource()instanceof jt)return this._setupProxiedCoordsForImageSource(s,h,g);this._findCoveringTileCache[s.id]=this._findCoveringTileCache[s.id]||{};const v=this.proxiedCoords[s.id]=[],b=this.proxyCoords;for(let I=0;I(B.min.x=Math.min(B.min.x,q.x-I.x),B.min.y=Math.min(B.min.y,q.y-I.y),B.max.x=Math.max(B.max.x,q.x-I.x),B.max.y=Math.max(B.max.y,q.y-I.y),B),{min:new l.Point(Number.MAX_VALUE,Number.MAX_VALUE),max:new l.Point(-Number.MAX_VALUE,-Number.MAX_VALUE)}),N=(B,q)=>{const J=B.wrap+B.canonical.x/(1<ie+D.max.x||ne+oeae+D.max.y};for(let B=0;BA.key===h.tileID.key);if(b)return b}if(h.tileID.key!==s.key){const b=s.canonical.z-h.tileID.canonical.z;let A,I,D;v=l.create();const N=h.tileID.wrap-s.wrap<0?(A=l.EXTENT>>b,I=A*((h.tileID.canonical.x<=q){const J=s.canonical.z-q;h.getSource().reparseOverscaled?(I=Math.max(s.canonical.z+2,h.transform.tileZoom),A=new l.OverscaledTileID(I,s.wrap,q,s.canonical.x>>J,s.canonical.y>>J)):J!==0&&(I=q,A=new l.OverscaledTileID(I,s.wrap,q,s.canonical.x>>J,s.canonical.y>>J))}A.key!==s.key&&(N.push(A.key),g=h.getTile(A))}const B=q=>{N.forEach(J=>{v[J]=q}),N.length=0};for(I-=1;I>=D&&(!g||!g.hasData());I--){g&&B(g.tileID.key);const q=A.calculateScaledKey(I);if(g=h.getTileByID(q),g&&g.hasData())break;const J=v[q];if(J===null)break;J===void 0?N.push(q):g=h.getTileByID(J)}return B(g?g.tileID.key:null),g&&g.hasData()?g:null}findDEMTileFor(s){return this.enabled?this._findTileCoveringTileID(s,this.sourceCache):null}prepareDrawTile(){this.renderedToTile=!0}_clearRenderCacheForTile(s,h){let g=this._tilesDirty[s];g||(g=this._tilesDirty[s]={}),g[h.key]=!0}getWirefameBuffer(){if(!this.wireframeSegments){const s=function(h){let g=0;const v=new l.StructArrayLayout2ui4,b=131;for(let A=1;A<129;A++){for(let I=1;I<129;I++)g=A*b+I,v.emplaceBack(g,g+1),v.emplaceBack(g,g+b),v.emplaceBack(g+1,g+b),A===128&&v.emplaceBack(g+b,g+b+1);v.emplaceBack(g+1,g+1+b)}return v}();this.wireframeIndexBuffer=this.painter.context.createIndexBuffer(s),this.wireframeSegments=l.SegmentVector.simpleSegment(0,0,this.gridBuffer.length,s.length)}return[this.wireframeIndexBuffer,this.wireframeSegments]}}class dr{static cacheKey(s,h,g,v){let b=`${h}${v?v.cacheKey:""}`;for(const A of g)s.usedDefines.includes(A)&&(b+=`/${A}`);return b}constructor(s,h,g,v,b,A){const I=s.gl;this.program=I.createProgram();const D=function(Z){const re=[];for(let ue=0;ue`#define ${Z}`));const J=s.isWebGL2?`#version 300 es +`:"",ne=J+q.concat(s.extStandardDerivatives&&J.length===0?`#extension GL_OES_standard_derivatives : enable +`.concat(ap):ap,ap,qu,a0.fragmentSource,vl.fragmentSource,g.fragmentSource).join(` +`),oe=J+q.concat(` +#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`,qu,a0.vertexSource,vl.vertexSource,Hu.vertexSource,g.vertexSource).join(` +`),ie=I.createShader(I.FRAGMENT_SHADER);if(I.isContextLost())return void(this.failedToCreate=!0);I.shaderSource(ie,ne),I.compileShader(ie),I.attachShader(this.program,ie);const ae=I.createShader(I.VERTEX_SHADER);if(I.isContextLost())this.failedToCreate=!0;else{I.shaderSource(ae,oe),I.compileShader(ae),I.attachShader(this.program,ae),this.attributes={},this.numAttributes=B.length;for(let Z=0;Z({u_dem:new l.Uniform1i(Z),u_dem_prev:new l.Uniform1i(Z),u_dem_unpack:new l.Uniform4f(Z),u_dem_tl:new l.Uniform2f(Z),u_dem_scale:new l.Uniform1f(Z),u_dem_tl_prev:new l.Uniform2f(Z),u_dem_scale_prev:new l.Uniform1f(Z),u_dem_size:new l.Uniform1f(Z),u_dem_lerp:new l.Uniform1f(Z),u_exaggeration:new l.Uniform1f(Z),u_depth:new l.Uniform1i(Z),u_depth_size_inv:new l.Uniform2f(Z),u_meter_to_dem:new l.Uniform1f(Z),u_label_plane_matrix_inv:new l.UniformMatrix4f(Z)}))(s)),A.includes("GLOBE")&&(this.globeUniforms=(Z=>({u_tile_tl_up:new l.Uniform3f(Z),u_tile_tr_up:new l.Uniform3f(Z),u_tile_br_up:new l.Uniform3f(Z),u_tile_bl_up:new l.Uniform3f(Z),u_tile_up_scale:new l.Uniform1f(Z)}))(s)),A.includes("FOG")&&(this.fogUniforms=(Z=>({u_fog_matrix:new l.UniformMatrix4f(Z),u_fog_range:new l.Uniform2f(Z),u_fog_color:new l.Uniform4f(Z),u_fog_horizon_blend:new l.Uniform1f(Z),u_fog_temporal_offset:new l.Uniform1f(Z),u_frustum_tl:new l.Uniform3f(Z),u_frustum_tr:new l.Uniform3f(Z),u_frustum_br:new l.Uniform3f(Z),u_frustum_bl:new l.Uniform3f(Z),u_globe_pos:new l.Uniform3f(Z),u_globe_radius:new l.Uniform1f(Z),u_globe_transition:new l.Uniform1f(Z),u_is_globe:new l.Uniform1i(Z),u_viewport:new l.Uniform2f(Z)}))(s))}}setTerrainUniformValues(s,h){if(!this.terrainUniforms)return;const g=this.terrainUniforms;if(!this.failedToCreate){s.program.set(this.program);for(const v in h)g[v]&&g[v].set(this.program,v,h[v])}}setGlobeUniformValues(s,h){if(!this.globeUniforms)return;const g=this.globeUniforms;if(!this.failedToCreate){s.program.set(this.program);for(const v in h)g[v]&&g[v].set(this.program,v,h[v])}}setFogUniformValues(s,h){if(!this.fogUniforms)return;const g=this.fogUniforms;if(!this.failedToCreate){s.program.set(this.program);for(const v in h)g[v].set(this.program,v,h[v])}}draw(s,h,g,v,b,A,I,D,N,B,q,J,ne,oe,ie){const ae=s.gl;if(this.failedToCreate)return;s.program.set(this.program),s.setDepthMode(g),s.setStencilMode(v),s.setColorMode(b),s.setCullFace(A);for(const re of Object.keys(this.fixedUniforms))this.fixedUniforms[re].set(this.program,re,I[re]);oe&&oe.setUniforms(this.program,s,this.binderUniforms,J,{zoom:ne});const Z={[ae.LINES]:2,[ae.TRIANGLES]:3,[ae.LINE_STRIP]:1}[h];for(const re of q.get()){const ue=re.vaos||(re.vaos={});(ue[D]||(ue[D]=new Xv)).bind(s,this,N,oe?oe.getPaintVertexBuffers():[],B,re.vertexOffset,ie||[]),ae.drawElements(h,re.primitiveLength*Z,ae.UNSIGNED_SHORT,re.primitiveOffset*Z*2)}}}function Nc(f,s){const h=Math.pow(2,s.tileID.overscaledZ),g=s.tileSize*Math.pow(2,f.transform.tileZoom)/h,v=g*(s.tileID.canonical.x+s.tileID.wrap*h),b=g*s.tileID.canonical.y;return{u_image:0,u_texsize:s.imageAtlasTexture.size,u_tile_units_to_pixels:1/je(s,1,f.transform.tileZoom),u_pixel_coord_upper:[v>>16,b>>16],u_pixel_coord_lower:[65535&v,65535&b]}}const u0=l.create(),fp=(f,s,h,g,v,b,A,I,D,N,B)=>{const q=s.style.light,J=q.properties.get("position"),ne=[J.x,J.y,J.z],oe=l.create$1();q.properties.get("anchor")==="viewport"&&(l.fromRotation(oe,-s.transform.angle),l.transformMat3(ne,ne,oe));const ie=q.properties.get("color"),ae=s.transform,Z={u_matrix:f,u_lightpos:ne,u_lightintensity:q.properties.get("intensity"),u_lightcolor:[ie.r,ie.g,ie.b],u_vertical_gradient:+h,u_opacity:g,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:u0,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_ao:v,u_edge_radius:b};return ae.projection.name==="globe"&&(Z.u_tile_id=[A.canonical.x,A.canonical.y,1<{const J=fp(f,s,h,g,v,b,A,D,N,B,q),ne={u_height_factor:-Math.pow(2,A.overscaledZ)/I.tileSize/8};return l.extend(J,Nc(s,I),ne)},Ls=f=>({u_matrix:f}),mp=(f,s,h)=>l.extend(Ls(f),Nc(s,h)),Yv=(f,s)=>({u_matrix:f,u_world:s}),Qv=(f,s,h,g)=>l.extend(mp(f,s,h),{u_world:g}),Jv=l.create(),gp=(f,s,h,g,v,b)=>{const A=f.transform,I=A.projection.name==="globe";let D;if(b.paint.get("circle-pitch-alignment")==="map")if(I){const B=l.globePixelsToTileUnits(A.zoom,s.canonical)*A._pixelsPerMercatorPixel;D=Float32Array.from([B,0,0,B])}else D=A.calculatePixelsToTileUnitsMatrix(h);else D=new Float32Array([A.pixelsToGLUnits[0],0,0,A.pixelsToGLUnits[1]]);const N={u_camera_to_center_distance:A.cameraToCenterDistance,u_matrix:f.translatePosMatrix(s.projMatrix,h,b.paint.get("circle-translate"),b.paint.get("circle-translate-anchor")),u_device_pixel_ratio:l.exported.devicePixelRatio,u_extrude_scale:D,u_inv_rot_matrix:Jv,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(I){N.u_inv_rot_matrix=g,N.u_merc_center=v,N.u_tile_id=[s.canonical.x,s.canonical.y,1<{const s=[];return f.paint.get("circle-pitch-alignment")==="map"&&s.push("PITCH_WITH_MAP"),f.paint.get("circle-pitch-scale")==="map"&&s.push("SCALE_WITH_MAP"),s},_p=(f,s,h,g)=>{const v=l.EXTENT/h.tileSize;return{u_matrix:f,u_camera_to_center_distance:s.getCameraToCenterDistance(g),u_extrude_scale:[s.pixelsToGLUnits[0]/v,s.pixelsToGLUnits[1]/v]}},Qu=(f,s,h=1)=>({u_matrix:f,u_color:s,u_overlay:0,u_overlay_scale:h}),d0=l.create(),p0=(f,s,h,g,v,b,A)=>{const I=f.transform,D=I.projection.name==="globe",N=D?l.globePixelsToTileUnits(I.zoom,s.canonical)*I._pixelsPerMercatorPixel:je(h,1,b),B={u_matrix:s.projMatrix,u_extrude_scale:N,u_intensity:A,u_inv_rot_matrix:d0,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(D){B.u_inv_rot_matrix=g,B.u_merc_center=v,B.u_tile_id=[s.canonical.x,s.canonical.y,1<{const I=f.transform,D=I.calculatePixelsToTileUnitsMatrix(s);return{u_matrix:vp(f,s,h,g),u_pixels_to_tile_units:D,u_device_pixel_ratio:b,u_units_to_pixels:[1/I.pixelsToGLUnits[0],1/I.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:v,u_texsize:jc(h)?s.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:El(s,f.transform),u_alpha_discard_threshold:0,u_trim_offset:A}},Uc=(f,s,h,g,v)=>{const b=f.transform;return{u_matrix:vp(f,s,h,g),u_texsize:s.imageAtlasTexture.size,u_pixels_to_tile_units:b.calculatePixelsToTileUnitsMatrix(s),u_device_pixel_ratio:v,u_image:0,u_tile_units_to_pixels:El(s,b),u_units_to_pixels:[1/b.pixelsToGLUnits[0],1/b.pixelsToGLUnits[1]],u_alpha_discard_threshold:0}};function El(f,s){return 1/je(f,1,s.tileZoom)}function vp(f,s,h,g){return f.translatePosMatrix(g||s.tileID.projMatrix,s,h.paint.get("line-translate"),h.paint.get("line-translate-anchor"))}function jc(f){const s=f.paint.get("line-dasharray").value;return s.value||s.kind!=="constant"}const xp=(f,s,h,g,v,b)=>{return{u_matrix:f,u_tl_parent:s,u_scale_parent:h,u_fade_t:g.mix,u_opacity:g.opacity*v.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:v.paint.get("raster-brightness-min"),u_brightness_high:v.paint.get("raster-brightness-max"),u_saturation_factor:(I=v.paint.get("raster-saturation"),I>0?1-1/(1.001-I):-I),u_contrast_factor:(A=v.paint.get("raster-contrast"),A>0?1/(1-A):1+A),u_spin_weights:Yo(v.paint.get("raster-hue-rotate")),u_perspective_transform:b};var A,I};function Yo(f){f*=Math.PI/180;const s=Math.sin(f),h=Math.cos(f);return[(2*h+1)/3,(-Math.sqrt(3)*s-h+1)/3,(Math.sqrt(3)*s-h+1)/3]}const Ju=l.create(),bp=(f,s,h,g,v,b,A,I,D,N,B,q,J,ne,oe,ie)=>{const ae=v.transform,Z={u_is_size_zoom_constant:+(f==="constant"||f==="source"),u_is_size_feature_constant:+(f==="constant"||f==="camera"),u_size_t:s?s.uSizeT:0,u_size:s?s.uSize:0,u_camera_to_center_distance:ae.cameraToCenterDistance,u_rotate_symbol:+h,u_aspect_ratio:ae.width/ae.height,u_fade_change:v.options.fadeDuration?v.symbolFadeChange:1,u_matrix:b,u_label_plane_matrix:A,u_coord_matrix:I,u_is_text:+D,u_pitch_with_map:+g,u_texsize:N,u_texture:0,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:Ju,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:Ju,u_up_vector:[0,-1,0]};return ie.name==="globe"&&(Z.u_tile_id=[B.canonical.x,B.canonical.y,1<l.extend(bp(f,s,h,g,v,b,A,I,D,N,q,J,ne,oe,ie,ae),{u_gamma_scale:g?v.transform.cameraToCenterDistance*Math.cos(v.terrain?0:v.transform._pitch):1,u_device_pixel_ratio:l.exported.devicePixelRatio,u_is_halo:+B}),f0=(f,s,h,g,v,b,A,I,D,N,B,q,J,ne,oe,ie)=>l.extend(eh(f,s,h,g,v,b,A,I,!0,D,!0,B,q,J,ne,oe,ie),{u_texsize_icon:N,u_texture_icon:1}),wp=(f,s,h)=>({u_matrix:f,u_opacity:s,u_color:h}),tx=(f,s,h,g,v)=>l.extend(function(b,A,I){const D=A.imageManager.getPattern(b.toString()),{width:N,height:B}=A.imageManager.getPixelSize(),q=Math.pow(2,I.tileID.overscaledZ),J=I.tileSize*Math.pow(2,A.transform.tileZoom)/q,ne=J*(I.tileID.canonical.x+I.tileID.wrap*q),oe=J*I.tileID.canonical.y;return{u_image:0,u_pattern_tl:D.tl,u_pattern_br:D.br,u_texsize:[N,B],u_pattern_size:D.displaySize,u_tile_units_to_pixels:1/je(I,1,A.transform.tileZoom),u_pixel_coord_upper:[ne>>16,oe>>16],u_pixel_coord_lower:[65535&ne,65535&oe]}}(g,h,v),{u_matrix:f,u_opacity:s}),Ep={fillExtrusion:f=>({u_matrix:new l.UniformMatrix4f(f),u_lightpos:new l.Uniform3f(f),u_lightintensity:new l.Uniform1f(f),u_lightcolor:new l.Uniform3f(f),u_vertical_gradient:new l.Uniform1f(f),u_opacity:new l.Uniform1f(f),u_edge_radius:new l.Uniform1f(f),u_ao:new l.Uniform2f(f),u_tile_id:new l.Uniform3f(f),u_zoom_transition:new l.Uniform1f(f),u_inv_rot_matrix:new l.UniformMatrix4f(f),u_merc_center:new l.Uniform2f(f),u_up_dir:new l.Uniform3f(f),u_height_lift:new l.Uniform1f(f)}),fillExtrusionPattern:f=>({u_matrix:new l.UniformMatrix4f(f),u_lightpos:new l.Uniform3f(f),u_lightintensity:new l.Uniform1f(f),u_lightcolor:new l.Uniform3f(f),u_vertical_gradient:new l.Uniform1f(f),u_height_factor:new l.Uniform1f(f),u_edge_radius:new l.Uniform1f(f),u_ao:new l.Uniform2f(f),u_tile_id:new l.Uniform3f(f),u_zoom_transition:new l.Uniform1f(f),u_inv_rot_matrix:new l.UniformMatrix4f(f),u_merc_center:new l.Uniform2f(f),u_up_dir:new l.Uniform3f(f),u_height_lift:new l.Uniform1f(f),u_image:new l.Uniform1i(f),u_texsize:new l.Uniform2f(f),u_pixel_coord_upper:new l.Uniform2f(f),u_pixel_coord_lower:new l.Uniform2f(f),u_tile_units_to_pixels:new l.Uniform1f(f),u_opacity:new l.Uniform1f(f)}),fill:f=>({u_matrix:new l.UniformMatrix4f(f)}),fillPattern:f=>({u_matrix:new l.UniformMatrix4f(f),u_image:new l.Uniform1i(f),u_texsize:new l.Uniform2f(f),u_pixel_coord_upper:new l.Uniform2f(f),u_pixel_coord_lower:new l.Uniform2f(f),u_tile_units_to_pixels:new l.Uniform1f(f)}),fillOutline:f=>({u_matrix:new l.UniformMatrix4f(f),u_world:new l.Uniform2f(f)}),fillOutlinePattern:f=>({u_matrix:new l.UniformMatrix4f(f),u_world:new l.Uniform2f(f),u_image:new l.Uniform1i(f),u_texsize:new l.Uniform2f(f),u_pixel_coord_upper:new l.Uniform2f(f),u_pixel_coord_lower:new l.Uniform2f(f),u_tile_units_to_pixels:new l.Uniform1f(f)}),circle:f=>({u_camera_to_center_distance:new l.Uniform1f(f),u_extrude_scale:new l.UniformMatrix2f(f),u_device_pixel_ratio:new l.Uniform1f(f),u_matrix:new l.UniformMatrix4f(f),u_inv_rot_matrix:new l.UniformMatrix4f(f),u_merc_center:new l.Uniform2f(f),u_tile_id:new l.Uniform3f(f),u_zoom_transition:new l.Uniform1f(f),u_up_dir:new l.Uniform3f(f)}),collisionBox:f=>({u_matrix:new l.UniformMatrix4f(f),u_camera_to_center_distance:new l.Uniform1f(f),u_extrude_scale:new l.Uniform2f(f)}),collisionCircle:f=>({u_matrix:new l.UniformMatrix4f(f),u_inv_matrix:new l.UniformMatrix4f(f),u_camera_to_center_distance:new l.Uniform1f(f),u_viewport_size:new l.Uniform2f(f)}),debug:f=>({u_color:new l.UniformColor(f),u_matrix:new l.UniformMatrix4f(f),u_overlay:new l.Uniform1i(f),u_overlay_scale:new l.Uniform1f(f)}),clippingMask:f=>({u_matrix:new l.UniformMatrix4f(f)}),heatmap:f=>({u_extrude_scale:new l.Uniform1f(f),u_intensity:new l.Uniform1f(f),u_matrix:new l.UniformMatrix4f(f),u_inv_rot_matrix:new l.UniformMatrix4f(f),u_merc_center:new l.Uniform2f(f),u_tile_id:new l.Uniform3f(f),u_zoom_transition:new l.Uniform1f(f),u_up_dir:new l.Uniform3f(f)}),heatmapTexture:f=>({u_image:new l.Uniform1i(f),u_color_ramp:new l.Uniform1i(f),u_opacity:new l.Uniform1f(f)}),hillshade:f=>({u_matrix:new l.UniformMatrix4f(f),u_image:new l.Uniform1i(f),u_latrange:new l.Uniform2f(f),u_light:new l.Uniform2f(f),u_shadow:new l.UniformColor(f),u_highlight:new l.UniformColor(f),u_accent:new l.UniformColor(f)}),hillshadePrepare:f=>({u_matrix:new l.UniformMatrix4f(f),u_image:new l.Uniform1i(f),u_dimension:new l.Uniform2f(f),u_zoom:new l.Uniform1f(f),u_unpack:new l.Uniform4f(f)}),line:f=>({u_matrix:new l.UniformMatrix4f(f),u_pixels_to_tile_units:new l.UniformMatrix2f(f),u_device_pixel_ratio:new l.Uniform1f(f),u_units_to_pixels:new l.Uniform2f(f),u_dash_image:new l.Uniform1i(f),u_gradient_image:new l.Uniform1i(f),u_image_height:new l.Uniform1f(f),u_texsize:new l.Uniform2f(f),u_tile_units_to_pixels:new l.Uniform1f(f),u_alpha_discard_threshold:new l.Uniform1f(f),u_trim_offset:new l.Uniform2f(f)}),linePattern:f=>({u_matrix:new l.UniformMatrix4f(f),u_texsize:new l.Uniform2f(f),u_pixels_to_tile_units:new l.UniformMatrix2f(f),u_device_pixel_ratio:new l.Uniform1f(f),u_image:new l.Uniform1i(f),u_units_to_pixels:new l.Uniform2f(f),u_tile_units_to_pixels:new l.Uniform1f(f),u_alpha_discard_threshold:new l.Uniform1f(f)}),raster:f=>({u_matrix:new l.UniformMatrix4f(f),u_tl_parent:new l.Uniform2f(f),u_scale_parent:new l.Uniform1f(f),u_fade_t:new l.Uniform1f(f),u_opacity:new l.Uniform1f(f),u_image0:new l.Uniform1i(f),u_image1:new l.Uniform1i(f),u_brightness_low:new l.Uniform1f(f),u_brightness_high:new l.Uniform1f(f),u_saturation_factor:new l.Uniform1f(f),u_contrast_factor:new l.Uniform1f(f),u_spin_weights:new l.Uniform3f(f),u_perspective_transform:new l.Uniform2f(f)}),symbolIcon:f=>({u_is_size_zoom_constant:new l.Uniform1i(f),u_is_size_feature_constant:new l.Uniform1i(f),u_size_t:new l.Uniform1f(f),u_size:new l.Uniform1f(f),u_camera_to_center_distance:new l.Uniform1f(f),u_rotate_symbol:new l.Uniform1i(f),u_aspect_ratio:new l.Uniform1f(f),u_fade_change:new l.Uniform1f(f),u_matrix:new l.UniformMatrix4f(f),u_label_plane_matrix:new l.UniformMatrix4f(f),u_coord_matrix:new l.UniformMatrix4f(f),u_is_text:new l.Uniform1i(f),u_pitch_with_map:new l.Uniform1i(f),u_texsize:new l.Uniform2f(f),u_tile_id:new l.Uniform3f(f),u_zoom_transition:new l.Uniform1f(f),u_inv_rot_matrix:new l.UniformMatrix4f(f),u_merc_center:new l.Uniform2f(f),u_camera_forward:new l.Uniform3f(f),u_tile_matrix:new l.UniformMatrix4f(f),u_up_vector:new l.Uniform3f(f),u_ecef_origin:new l.Uniform3f(f),u_texture:new l.Uniform1i(f)}),symbolSDF:f=>({u_is_size_zoom_constant:new l.Uniform1i(f),u_is_size_feature_constant:new l.Uniform1i(f),u_size_t:new l.Uniform1f(f),u_size:new l.Uniform1f(f),u_camera_to_center_distance:new l.Uniform1f(f),u_rotate_symbol:new l.Uniform1i(f),u_aspect_ratio:new l.Uniform1f(f),u_fade_change:new l.Uniform1f(f),u_matrix:new l.UniformMatrix4f(f),u_label_plane_matrix:new l.UniformMatrix4f(f),u_coord_matrix:new l.UniformMatrix4f(f),u_is_text:new l.Uniform1i(f),u_pitch_with_map:new l.Uniform1i(f),u_texsize:new l.Uniform2f(f),u_texture:new l.Uniform1i(f),u_gamma_scale:new l.Uniform1f(f),u_device_pixel_ratio:new l.Uniform1f(f),u_tile_id:new l.Uniform3f(f),u_zoom_transition:new l.Uniform1f(f),u_inv_rot_matrix:new l.UniformMatrix4f(f),u_merc_center:new l.Uniform2f(f),u_camera_forward:new l.Uniform3f(f),u_tile_matrix:new l.UniformMatrix4f(f),u_up_vector:new l.Uniform3f(f),u_ecef_origin:new l.Uniform3f(f),u_is_halo:new l.Uniform1i(f)}),symbolTextAndIcon:f=>({u_is_size_zoom_constant:new l.Uniform1i(f),u_is_size_feature_constant:new l.Uniform1i(f),u_size_t:new l.Uniform1f(f),u_size:new l.Uniform1f(f),u_camera_to_center_distance:new l.Uniform1f(f),u_rotate_symbol:new l.Uniform1i(f),u_aspect_ratio:new l.Uniform1f(f),u_fade_change:new l.Uniform1f(f),u_matrix:new l.UniformMatrix4f(f),u_label_plane_matrix:new l.UniformMatrix4f(f),u_coord_matrix:new l.UniformMatrix4f(f),u_is_text:new l.Uniform1i(f),u_pitch_with_map:new l.Uniform1i(f),u_texsize:new l.Uniform2f(f),u_texsize_icon:new l.Uniform2f(f),u_texture:new l.Uniform1i(f),u_texture_icon:new l.Uniform1i(f),u_gamma_scale:new l.Uniform1f(f),u_device_pixel_ratio:new l.Uniform1f(f),u_is_halo:new l.Uniform1i(f)}),background:f=>({u_matrix:new l.UniformMatrix4f(f),u_opacity:new l.Uniform1f(f),u_color:new l.UniformColor(f)}),backgroundPattern:f=>({u_matrix:new l.UniformMatrix4f(f),u_opacity:new l.Uniform1f(f),u_image:new l.Uniform1i(f),u_pattern_tl:new l.Uniform2f(f),u_pattern_br:new l.Uniform2f(f),u_texsize:new l.Uniform2f(f),u_pattern_size:new l.Uniform2f(f),u_pixel_coord_upper:new l.Uniform2f(f),u_pixel_coord_lower:new l.Uniform2f(f),u_tile_units_to_pixels:new l.Uniform1f(f)}),terrainRaster:up,terrainDepth:up,skybox:f=>({u_matrix:new l.UniformMatrix4f(f),u_sun_direction:new l.Uniform3f(f),u_cubemap:new l.Uniform1i(f),u_opacity:new l.Uniform1f(f),u_temporal_offset:new l.Uniform1f(f)}),skyboxGradient:f=>({u_matrix:new l.UniformMatrix4f(f),u_color_ramp:new l.Uniform1i(f),u_center_direction:new l.Uniform3f(f),u_radius:new l.Uniform1f(f),u_opacity:new l.Uniform1f(f),u_temporal_offset:new l.Uniform1f(f)}),skyboxCapture:f=>({u_matrix_3f:new l.UniformMatrix3f(f),u_sun_direction:new l.Uniform3f(f),u_sun_intensity:new l.Uniform1f(f),u_color_tint_r:new l.Uniform4f(f),u_color_tint_m:new l.Uniform4f(f),u_luminance:new l.Uniform1f(f)}),globeRaster:f=>({u_proj_matrix:new l.UniformMatrix4f(f),u_globe_matrix:new l.UniformMatrix4f(f),u_normalize_matrix:new l.UniformMatrix4f(f),u_merc_matrix:new l.UniformMatrix4f(f),u_zoom_transition:new l.Uniform1f(f),u_merc_center:new l.Uniform2f(f),u_image0:new l.Uniform1i(f),u_grid_matrix:new l.UniformMatrix3f(f),u_skirt_height:new l.Uniform1f(f),u_frustum_tl:new l.Uniform3f(f),u_frustum_tr:new l.Uniform3f(f),u_frustum_br:new l.Uniform3f(f),u_frustum_bl:new l.Uniform3f(f),u_globe_pos:new l.Uniform3f(f),u_globe_radius:new l.Uniform1f(f),u_viewport:new l.Uniform2f(f)}),globeAtmosphere:f=>({u_frustum_tl:new l.Uniform3f(f),u_frustum_tr:new l.Uniform3f(f),u_frustum_br:new l.Uniform3f(f),u_frustum_bl:new l.Uniform3f(f),u_horizon:new l.Uniform1f(f),u_transition:new l.Uniform1f(f),u_fadeout_range:new l.Uniform1f(f),u_color:new l.Uniform4f(f),u_high_color:new l.Uniform4f(f),u_space_color:new l.Uniform4f(f),u_star_intensity:new l.Uniform1f(f),u_star_density:new l.Uniform1f(f),u_star_size:new l.Uniform1f(f),u_temporal_offset:new l.Uniform1f(f),u_horizon_angle:new l.Uniform1f(f),u_rotation_matrix:new l.UniformMatrix4f(f)})};let th;function Vc(f,s,h,g,v,b,A){const I=f.context,D=I.gl,N=f.transform,B=f.useProgram("collisionBox"),q=[];let J=0,ne=0;for(let he=0;he0){const De=l.create(),Ke=Ie;l.mul(De,we.placementInvProjMatrix,N.glCoordMatrix),l.mul(De,De,we.placementViewportMatrix),q.push({circleArray:st,circleOffset:ne,transform:Ke,invTransform:De,projection:we.getProjection()}),J+=st.length/4,ne=J}Re&&(f.terrain&&f.terrain.setupElevationDraw(Se,B),B.draw(I,D.LINES,l.DepthMode.disabled,l.StencilMode.disabled,f.colorModeForRenderPass(),l.CullFaceMode.disabled,_p(Ie,N,Se,we.getProjection()),h.id,Re.layoutVertexBuffer,Re.indexBuffer,Re.segments,null,N.zoom,null,[Re.collisionVertexBuffer,Re.collisionVertexBufferExt]))}if(!A||!q.length)return;const oe=f.useProgram("collisionCircle"),ie=new l.StructArrayLayout2f1f2i16;ie.resize(4*J),ie._trim();let ae=0;for(const he of q)for(let be=0;be=0&&(oe[he.associatedIconIndex]={x:De,y:Ke,z:Ne,angle:tt})}else Ao(we,J)}if(B){ne.clear();const ue=f.icon.placedSymbolArray;for(let he=0;heDe.sortKey-Ke.sortKey);for(const De of Ie){const Ke=De.state;if(f.terrain&&f.terrain.setupElevationDraw(Ke.tile,Ke.program,{useDepthForOcclusion:!Ce,labelPlaneMatrixInv:Ke.labelPlaneMatrixInv}),J.activeTexture.set(ne.TEXTURE0),Ke.atlasTexture.bind(Ke.atlasInterpolation,ne.CLAMP_TO_EDGE),Ke.atlasTextureIcon&&(J.activeTexture.set(ne.TEXTURE1),Ke.atlasTextureIcon&&Ke.atlasTextureIcon.bind(Ke.atlasInterpolationIcon,ne.CLAMP_TO_EDGE)),Ke.isSDF){const Ne=Ke.uniformValues;Ke.hasHalo&&(Ne.u_is_halo=1,$c(Ke.buffers,De.segments,h,f,Ke.program,be,B,q,Ne)),Ne.u_is_halo=0}$c(Ke.buffers,De.segments,h,f,Ke.program,be,B,q,Ke.uniformValues)}}function $c(f,s,h,g,v,b,A,I,D){const N=g.context,B=[f.dynamicLayoutVertexBuffer,f.opacityVertexBuffer,f.globeExtVertexBuffer];v.draw(N,N.gl.TRIANGLES,b,A,I,l.CullFaceMode.disabled,D,h.id,f.layoutVertexBuffer,f.indexBuffer,s,h.paint,g.transform.zoom,f.programConfigurations.get(h.id),B)}function y0(f,s,h,g,v,b,A){const I=f.context.gl,D=h.paint.get("fill-pattern"),N=D&&D.constantOr(1);let B,q,J,ne,oe;A?(q=N&&!h.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",B=I.LINES):(q=N?"fillPattern":"fill",B=I.TRIANGLES);for(const ie of g){const ae=s.getTile(ie);if(N&&!ae.patternsLoaded())continue;const Z=ae.getBucket(h);if(!Z)continue;f.prepareDrawTile();const re=Z.programConfigurations.get(h.id),ue=f.useProgram(q,re);N&&(f.context.activeTexture.set(I.TEXTURE0),ae.imageAtlasTexture.bind(I.LINEAR,I.CLAMP_TO_EDGE),re.updatePaintBuffers());const he=D.constantOr(null);if(he&&ae.imageAtlas){const Se=ae.imageAtlas.patternPositions[he.toString()];Se&&re.setConstantPatternPositions(Se)}const be=f.translatePosMatrix(ie.projMatrix,ae,h.paint.get("fill-translate"),h.paint.get("fill-translate-anchor"));if(A){ne=Z.indexBuffer2,oe=Z.segments2;const Se=f.terrain&&f.terrain.renderingToTexture?f.terrain.drapeBufferSize:[I.drawingBufferWidth,I.drawingBufferHeight];J=q==="fillOutlinePattern"&&N?Qv(be,f,ae,Se):Yv(be,Se)}else ne=Z.indexBuffer,oe=Z.segments,J=N?mp(be,f,ae):Ls(be);f.prepareDrawProgram(f.context,ue,ie.toUnwrapped()),ue.draw(f.context,B,v,f.stencilModeForClipping(ie),b,l.CullFaceMode.disabled,J,h.id,Z.layoutVertexBuffer,ne,oe,h.paint,f.transform.zoom,re)}}function rh(f,s,h,g,v,b,A){const I=f.context,D=I.gl,N=f.transform,B=h.paint.get("fill-extrusion-pattern"),q=B.constantOr(1),J=h.paint.get("fill-extrusion-opacity"),ne=[h.paint.get("fill-extrusion-ambient-occlusion-intensity"),h.paint.get("fill-extrusion-ambient-occlusion-radius")],oe=h.layout.get("fill-extrusion-edge-radius"),ie=oe>0&&!h.paint.get("fill-extrusion-rounded-roof"),ae=ie?0:oe,Z=N.projection.name==="globe"?l.fillExtrusionHeightLift():0,re=N.projection.name==="globe",ue=re?l.globeToMercatorTransition(N.zoom):0,he=[l.mercatorXfromLng(N.center.lng),l.mercatorYfromLat(N.center.lat)],be=[];re&&be.push("PROJECTION_GLOBE_VIEW"),ne[0]>0&&be.push("FAUX_AO"),ie&&be.push("ZERO_ROOF_RADIUS");for(const Se of g){const we=s.getTile(Se),Ce=we.getBucket(h);if(!Ce||Ce.projection.name!==N.projection.name)continue;const Ie=Ce.programConfigurations.get(h.id),Re=f.useProgram(q?"fillExtrusionPattern":"fillExtrusion",Ie,be);if(f.terrain){const Ze=f.terrain;if(f.style.terrainSetForDrapingOnly())Ze.setupElevationDraw(we,Re,{useMeterToDem:!0});else{if(!Ce.enableTerrain)continue;if(Ze.setupElevationDraw(we,Re,{useMeterToDem:!0}),_0(I,s,Se,Ce,h,Ze),!Ce.centroidVertexBuffer){const ut=Re.attributes.a_centroid_pos;ut!==void 0&&D.vertexAttrib2f(ut,0,0)}}}q&&(f.context.activeTexture.set(D.TEXTURE0),we.imageAtlasTexture.bind(D.LINEAR,D.CLAMP_TO_EDGE),Ie.updatePaintBuffers());const st=B.constantOr(null);if(st&&we.imageAtlas){const Ze=we.imageAtlas.patternPositions[st.toString()];Ze&&Ie.setConstantPatternPositions(Ze)}const De=f.translatePosMatrix(Se.projMatrix,we,h.paint.get("fill-extrusion-translate"),h.paint.get("fill-extrusion-translate-anchor")),Ke=N.projection.createInversionMatrix(N,Se.canonical),Ne=h.paint.get("fill-extrusion-vertical-gradient"),at=q?h0(De,f,Ne,J,ne,ae,Se,we,Z,ue,he,Ke):fp(De,f,Ne,J,ne,ae,Se,Z,ue,he,Ke);f.prepareDrawProgram(I,Re,Se.toUnwrapped());const ze=[];f.terrain&&ze.push(Ce.centroidVertexBuffer),re&&ze.push(Ce.layoutVertexExtBuffer),Re.draw(I,I.gl.TRIANGLES,v,b,A,l.CullFaceMode.backCCW,at,h.id,Ce.layoutVertexBuffer,Ce.indexBuffer,Ce.segments,h.paint,f.transform.zoom,Ie,ze)}}function _0(f,s,h,g,v,b){const A=[Z=>{let re=Z.canonical.x-1,ue=Z.wrap;return re<0&&(re=(1<{let re=Z.canonical.x+1,ue=Z.wrap;return re===1<new l.OverscaledTileID(Z.overscaledZ,Z.wrap,Z.canonical.z,Z.canonical.x,(Z.canonical.y===0?1<new l.OverscaledTileID(Z.overscaledZ,Z.wrap,Z.canonical.z,Z.canonical.x,Z.canonical.y===(1<{const re=s.getSource().minzoom,ue=be=>{const Se=s.getTileByID(be);if(Se&&Se.hasData())return Se.getBucket(v)},he=[0,-1,1];for(const be of he){if(Z.overscaledZ+be(D[0]=Math.min(Z.min.y,re.min.y),D[1]=Math.max(Z.max.y,re.max.y),D[2]=l.EXTENT-re.min.x>Z.max.x?re.min.x-l.EXTENT:Z.max.x,D),B=(Z,re)=>(D[0]=Math.min(Z.min.x,re.min.x),D[1]=Math.max(Z.max.x,re.max.x),D[2]=l.EXTENT-re.min.y>Z.max.y?re.min.y-l.EXTENT:Z.max.y,D),q=[(Z,re)=>N(Z,re),(Z,re)=>N(re,Z),(Z,re)=>B(Z,re),(Z,re)=>B(re,Z)],J=new l.Point(0,0);let ne,oe,ie;const ae=(Z,re,ue,he,be)=>{const Se=[[he?ue:Z,he?Z:ue,0],[he?ue:re,he?re:ue,0]],we=be<0?l.EXTENT+be:be,Ce=[he?we:(Z+re)/2,he?(Z+re)/2:we,0];return ue===0&&be<0||ue!==0&&be>0?b.getForTilePoints(ie,[Ce],!0,oe):Se.push(Ce),b.getForTilePoints(h,Se,!0,ne),Math.max(Se[0][2],Se[1][2],Ce[2])/b.exaggeration()};for(let Z=0;Z<4;Z++){const re=(Z<2?1:5)-Z,ue=g.borders[Z];if(ue.length===0)continue;const he=ie=A[Z](h),be=I(he);if(!(be&&be instanceof l.FillExtrusionBucket&&be.enableTerrain)||g.borderDoneWithNeighborZ[Z]===be.canonical.z&&be.borderDoneWithNeighborZ[re]===g.canonical.z||(oe=b.findDEMTileFor(he),!oe||!oe.dem))continue;if(!ne){const Ie=b.findDEMTileFor(h);if(!Ie||!Ie.dem)return;ne=Ie}const Se=be.borders[re];let we=0;const Ce=be.borderDoneWithNeighborZ[re]!==g.canonical.z;if(g.canonical.z===be.canonical.z){for(let Ie=0;Iest[0]+3));)Ce&&be.encodeCentroid(void 0,De,!1),we++;if(De&&west[1]-3)&&(Ne++,++we!==Se.length);)De=be.featuresOnBorder[Se[we]];if(De=be.featuresOnBorder[Se[Ke]],Re.intersectsCount()>1||De.intersectsCount()>1||Ne!==1){Ne!==1&&(we=Ke),g.encodeCentroid(void 0,Re,!1),Ce&&be.encodeCentroid(void 0,De,!1);continue}const at=q[Z](Re,De),ze=Z%2?l.EXTENT-1:0;J.x=ae(at[0],Math.min(l.EXTENT-1,at[1]),ze,Z<2,at[2]),J.y=0,g.encodeCentroid(J,Re,!1),Ce&&be.encodeCentroid(J,De,!1)}else g.encodeCentroid(void 0,Re,!1)}g.borderDoneWithNeighborZ[Z]=be.canonical.z,g.needsCentroidUpdate=!0,Ce&&(be.borderDoneWithNeighborZ[re]=g.canonical.z,be.needsCentroidUpdate=!0)}else{for(const Ie of ue)g.encodeCentroid(void 0,g.featuresOnBorder[Ie],!1);if(Ce){for(const Ie of Se)be.encodeCentroid(void 0,be.featuresOnBorder[Ie],!1);be.borderDoneWithNeighborZ[re]=g.canonical.z,be.needsCentroidUpdate=!0}g.borderDoneWithNeighborZ[Z]=be.canonical.z,g.needsCentroidUpdate=!0}}(g.needsCentroidUpdate||!g.centroidVertexBuffer&&g.centroidVertexArray.length!==0)&&g.uploadCentroid(f)}const Sl=new l.Color(1,0,0,1),nx=new l.Color(0,1,0,1),ix=new l.Color(0,0,1,1),ox=new l.Color(1,0,1,1),ax=new l.Color(0,1,1,1);function sx(f,s,h){const g=f.context,v=f.transform,b=g.gl,A=v.projection.name==="globe",I=A?["PROJECTION_GLOBE_VIEW"]:null;let D=h.projMatrix;if(A&&l.globeToMercatorTransition(v.zoom)>0){const Re=l.transitionTileAABBinECEF(h.canonical,v),st=l.globeDenormalizeECEF(Re);D=l.multiply(new Float32Array(16),v.globeMatrix,st),l.multiply(D,v.projMatrix,D)}const N=f.useProgram("debug",null,I),B=s.getTileByID(h.key);f.terrain&&f.terrain.setupElevationDraw(B,N);const q=l.DepthMode.disabled,J=l.StencilMode.disabled,ne=f.colorModeForRenderPass(),oe="$debug";g.activeTexture.set(b.TEXTURE0),f.emptyTexture.bind(b.LINEAR,b.CLAMP_TO_EDGE),A?B._makeGlobeTileDebugBuffers(f.context,v):B._makeDebugTileBoundsBuffers(f.context,v.projection);const ie=B._tileDebugBuffer||f.debugBuffer,ae=B._tileDebugIndexBuffer||f.debugIndexBuffer,Z=B._tileDebugSegments||f.debugSegments;N.draw(g,b.LINE_STRIP,q,J,ne,l.CullFaceMode.disabled,Qu(D,l.Color.red),oe,ie,ae,Z,null,null,null,[B._globeTileDebugBorderBuffer]);const re=B.latestRawTileData,ue=Math.floor((re&&re.byteLength||0)/1024),he=s.getTile(h).tileSize,be=512/Math.min(he,512)*(h.overscaledZ/v.zoom)*.5;let Se=h.canonical.toString();h.overscaledZ!==h.canonical.z&&(Se+=` => ${h.overscaledZ}`),Se+=` ${ue}kb`,function(Re,st){Re.initDebugOverlayCanvas();const De=Re.debugOverlayCanvas,Ke=Re.context.gl,Ne=Re.debugOverlayCanvas.getContext("2d");Ne.clearRect(0,0,De.width,De.height),Ne.shadowColor="white",Ne.shadowBlur=2,Ne.lineWidth=1.5,Ne.strokeStyle="white",Ne.textBaseline="top",Ne.font="bold 36px Open Sans, sans-serif",Ne.fillText(st,5,5),Ne.strokeText(st,5,5),Re.debugOverlayTexture.update(De),Re.debugOverlayTexture.bind(Ke.LINEAR,Ke.CLAMP_TO_EDGE)}(f,Se);const we=B._tileDebugTextBuffer||f.debugBuffer,Ce=B._tileDebugTextIndexBuffer||f.quadTriangleIndexBuffer,Ie=B._tileDebugTextSegments||f.debugSegments;N.draw(g,b.TRIANGLES,q,J,l.ColorMode.alphaBlended,l.CullFaceMode.disabled,Qu(D,l.Color.transparent,be),oe,we,Ce,Ie,null,null,null,[B._globeTileDebugTextBuffer])}function v0(f,s,h,g){Tl(f,0,s+h/2,f.transform.width,h,g)}function nh(f,s,h,g){Tl(f,s-h/2,0,h,f.transform.height,g)}function Tl(f,s,h,g,v,b){const A=f.context,I=A.gl;I.enable(I.SCISSOR_TEST),I.scissor(s*l.exported.devicePixelRatio,h*l.exported.devicePixelRatio,g*l.exported.devicePixelRatio,v*l.exported.devicePixelRatio),A.clear({color:b}),I.disable(I.SCISSOR_TEST)}const x0=l.createLayout([{name:"a_pos_3f",components:3,type:"Float32"}]),{members:b0}=x0;function Aa(f,s,h,g){f.emplaceBack(s,h,g)}class ih{constructor(s){this.vertexArray=new l.StructArrayLayout3f12,this.indices=new l.StructArrayLayout3ui6,Aa(this.vertexArray,-1,-1,1),Aa(this.vertexArray,1,-1,1),Aa(this.vertexArray,-1,1,1),Aa(this.vertexArray,1,1,1),Aa(this.vertexArray,-1,-1,-1),Aa(this.vertexArray,1,-1,-1),Aa(this.vertexArray,-1,1,-1),Aa(this.vertexArray,1,1,-1),this.indices.emplaceBack(5,1,3),this.indices.emplaceBack(3,7,5),this.indices.emplaceBack(6,2,0),this.indices.emplaceBack(0,4,6),this.indices.emplaceBack(2,6,7),this.indices.emplaceBack(7,3,2),this.indices.emplaceBack(5,4,0),this.indices.emplaceBack(0,1,5),this.indices.emplaceBack(0,2,3),this.indices.emplaceBack(3,1,0),this.indices.emplaceBack(7,6,4),this.indices.emplaceBack(4,5,7),this.vertexBuffer=s.createVertexBuffer(this.vertexArray,b0),this.indexBuffer=s.createIndexBuffer(this.indices),this.segment=l.SegmentVector.simpleSegment(0,0,36,12)}}function io(f,s,h,g,v,b){const A=f.gl,I=s.paint.get("sky-atmosphere-color"),D=s.paint.get("sky-atmosphere-halo-color"),N=s.paint.get("sky-atmosphere-sun-intensity"),B=((q,J,ne,oe,ie)=>({u_matrix_3f:q,u_sun_direction:J,u_sun_intensity:ne,u_color_tint_r:[oe.r,oe.g,oe.b,oe.a],u_color_tint_m:[ie.r,ie.g,ie.b,ie.a],u_luminance:5e-5}))(l.fromMat4(l.create$1(),g),v,N,I,D);A.framebufferTexture2D(A.FRAMEBUFFER,A.COLOR_ATTACHMENT0,A.TEXTURE_CUBE_MAP_POSITIVE_X+b,s.skyboxTexture,0),h.draw(f,A.TRIANGLES,l.DepthMode.disabled,l.StencilMode.disabled,l.ColorMode.unblended,l.CullFaceMode.frontCW,B,"skyboxCapture",s.skyboxGeometry.vertexBuffer,s.skyboxGeometry.indexBuffer,s.skyboxGeometry.segment)}const Wc=l.createLayout([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class w0{constructor(s){const h=new l.StructArrayLayout5f20;h.emplaceBack(-1,1,1,0,0),h.emplaceBack(1,1,1,1,0),h.emplaceBack(1,-1,1,1,1),h.emplaceBack(-1,-1,1,0,1);const g=new l.StructArrayLayout3ui6;g.emplaceBack(0,1,2),g.emplaceBack(2,3,0),this.vertexBuffer=s.createVertexBuffer(h,Wc.members),this.indexBuffer=s.createIndexBuffer(g),this.segments=l.SegmentVector.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}const Bs={symbol:function(f,s,h,g,v){if(f.renderPass!=="translucent")return;const b=l.StencilMode.disabled,A=f.colorModeForRenderPass();h.layout.get("text-variable-anchor")&&function(I,D,N,B,q,J,ne){const oe=D.transform,ie=q==="map",ae=J==="map";for(const Z of I){const re=B.getTile(Z),ue=re.getBucket(N);if(!ue||!ue.text||!ue.text.segments.get().length)continue;const he=l.evaluateSizeForZoom(ue.textSizeData,oe.zoom),be=Xr(Z,ue.getProjection(),oe),Se=oe.calculatePixelsToTileUnitsMatrix(re),we=Ge(be,re.tileID.canonical,ae,ie,oe,ue.getProjection(),Se),Ce=N.layout.get("icon-text-fit")!=="none"&&ue.hasIconData();if(he){const Ie=Math.pow(2,oe.zoom-re.tileID.overscaledZ);rx(ue,ie,ae,ne,l.symbolSize,oe,we,Z,Ie,he,Ce)}}}(g,f,h,s,h.layout.get("text-rotation-alignment"),h.layout.get("text-pitch-alignment"),v),h.paint.get("icon-opacity").constantOr(1)!==0&&g0(f,s,h,g,!1,h.paint.get("icon-translate"),h.paint.get("icon-translate-anchor"),h.layout.get("icon-rotation-alignment"),h.layout.get("icon-pitch-alignment"),h.layout.get("icon-keep-upright"),b,A),h.paint.get("text-opacity").constantOr(1)!==0&&g0(f,s,h,g,!0,h.paint.get("text-translate"),h.paint.get("text-translate-anchor"),h.layout.get("text-rotation-alignment"),h.layout.get("text-pitch-alignment"),h.layout.get("text-keep-upright"),b,A),s.map.showCollisionBoxes&&(Vc(f,s,h,g,h.paint.get("text-translate"),h.paint.get("text-translate-anchor"),!0),Vc(f,s,h,g,h.paint.get("icon-translate"),h.paint.get("icon-translate-anchor"),!1))},circle:function(f,s,h,g){if(f.renderPass!=="translucent")return;const v=h.paint.get("circle-opacity"),b=h.paint.get("circle-stroke-width"),A=h.paint.get("circle-stroke-opacity"),I=h.layout.get("circle-sort-key").constantOr(1)!==void 0;if(v.constantOr(1)===0&&(b.constantOr(1)===0||A.constantOr(1)===0))return;const D=f.context,N=D.gl,B=f.transform,q=f.depthModeForSublayer(0,l.DepthMode.ReadOnly),J=l.StencilMode.disabled,ne=f.colorModeForRenderPass(),oe=B.projection.name==="globe",ie=[l.mercatorXfromLng(B.center.lng),l.mercatorYfromLat(B.center.lat)],ae=[];for(let re=0;rere.sortKey-ue.sortKey);const Z={useDepthForOcclusion:!oe};for(const re of ae){const{programConfiguration:ue,program:he,layoutVertexBuffer:be,globeExtVertexBuffer:Se,indexBuffer:we,uniformValues:Ce,tile:Ie}=re.state,Re=re.segments;f.terrain&&f.terrain.setupElevationDraw(Ie,he,Z),f.prepareDrawProgram(D,he,Ie.tileID.toUnwrapped()),he.draw(D,N.TRIANGLES,q,J,ne,l.CullFaceMode.disabled,Ce,h.id,be,we,Re,h.paint,B.zoom,ue,[Se])}},heatmap:function(f,s,h,g){if(h.paint.get("heatmap-opacity")!==0)if(f.renderPass==="offscreen"){const v=f.context,b=v.gl,A=l.StencilMode.disabled,I=new l.ColorMode([b.ONE,b.ONE],l.Color.transparent,[!0,!0,!0,!0]);(function(ne,oe,ie,ae){const Z=ne.gl,re=oe.width*ae,ue=oe.height*ae;ne.activeTexture.set(Z.TEXTURE1),ne.viewport.set([0,0,re,ue]);let he=ie.heatmapFbo;if(!he||he&&(he.width!==re||he.height!==ue)){he&&he.destroy();const be=Z.createTexture();Z.bindTexture(Z.TEXTURE_2D,be),Z.texParameteri(Z.TEXTURE_2D,Z.TEXTURE_WRAP_S,Z.CLAMP_TO_EDGE),Z.texParameteri(Z.TEXTURE_2D,Z.TEXTURE_WRAP_T,Z.CLAMP_TO_EDGE),Z.texParameteri(Z.TEXTURE_2D,Z.TEXTURE_MIN_FILTER,Z.LINEAR),Z.texParameteri(Z.TEXTURE_2D,Z.TEXTURE_MAG_FILTER,Z.LINEAR),he=ie.heatmapFbo=ne.createFramebuffer(re,ue,!1),function(Se,we,Ce,Ie,Re,st){const De=Se.gl;De.texImage2D(De.TEXTURE_2D,0,Se.isWebGL2&&Se.extRenderToTextureHalfFloat?De.RGBA16F:De.RGBA,Re,st,0,De.RGBA,Se.extRenderToTextureHalfFloat?Se.isWebGL2?De.HALF_FLOAT:Se.extTextureHalfFloat.HALF_FLOAT_OES:De.UNSIGNED_BYTE,null),Ie.colorAttachment.set(Ce)}(ne,0,be,he,re,ue)}else Z.bindTexture(Z.TEXTURE_2D,he.colorAttachment.get()),ne.bindFramebuffer.set(he.framebuffer)})(v,f,h,f.transform.projection.name==="globe"?.5:.25),v.clear({color:l.Color.transparent});const D=f.transform,N=D.projection.name==="globe",B=N?["PROJECTION_GLOBE_VIEW"]:null,q=N?l.CullFaceMode.frontCCW:l.CullFaceMode.disabled,J=[l.mercatorXfromLng(D.center.lng),l.mercatorYfromLat(D.center.lat)];for(let ne=0;ne({u_image:0,u_color_ramp:1,u_opacity:q.paint.get("heatmap-opacity")}))(0,b),b.id,v.viewportBuffer,v.quadTriangleIndexBuffer,v.viewportSegments,b.paint,v.transform.zoom)}(f,h))},line:function(f,s,h,g){if(f.renderPass!=="translucent")return;const v=h.paint.get("line-opacity"),b=h.paint.get("line-width");if(v.constantOr(1)===0||b.constantOr(1)===0)return;const A=f.depthModeForSublayer(0,l.DepthMode.ReadOnly),I=f.colorModeForRenderPass(),D=f.terrain&&f.terrain.renderingToTexture?1:l.exported.devicePixelRatio,N=h.paint.get("line-dasharray"),B=N.constantOr(1),q=h.layout.get("line-cap"),J=h.paint.get("line-pattern"),ne=J.constantOr(1),oe=h.paint.get("line-gradient"),ie=ne?"linePattern":"line",ae=f.context,Z=ae.gl,re=(he=>{const be=[];jc(he)&&be.push("RENDER_LINE_DASH"),he.paint.get("line-gradient")&&be.push("RENDER_LINE_GRADIENT");const Se=he.paint.get("line-trim-offset");Se[0]===0&&Se[1]===0||be.push("RENDER_LINE_TRIM_OFFSET");const we=he.paint.get("line-pattern").constantOr(1),Ce=he.paint.get("line-opacity").constantOr(1)!==1;return!we&&Ce&&be.push("RENDER_LINE_ALPHA_DISCARD"),be})(h);let ue=re.includes("RENDER_LINE_ALPHA_DISCARD");f.terrain&&f.terrain.clipOrMaskOverlapStencilType()&&(ue=!1);for(const he of g){const be=s.getTile(he);if(ne&&!be.patternsLoaded())continue;const Se=be.getBucket(h);if(!Se)continue;f.prepareDrawTile();const we=Se.programConfigurations.get(h.id),Ce=f.useProgram(ie,we,re),Ie=J.constantOr(null);if(Ie&&be.imageAtlas){const Ze=be.imageAtlas.patternPositions[Ie.toString()];Ze&&we.setConstantPatternPositions(Ze)}const Re=N.constantOr(null),st=q.constantOr(null);if(!ne&&Re&&st&&be.lineAtlas){const Ze=be.lineAtlas.getDash(Re,st);Ze&&we.setConstantPatternPositions(Ze)}let[De,Ke]=h.paint.get("line-trim-offset");(st==="round"||st==="square")&&De!==Ke&&(De===0&&(De-=1),Ke===1&&(Ke+=1));const Ne=f.terrain?he.projMatrix:null,at=ne?Uc(f,be,h,Ne,D):ex(f,be,h,Ne,Se.lineClipsArray.length,D,[De,Ke]);if(oe){const Ze=Se.gradients[h.id];let ut=Ze.texture;if(h.gradientVersion!==Ze.version){let tt=256;if(h.stepInterpolant){const ht=s.getSource().maxzoom,Mt=he.canonical.z===ht?Math.ceil(1<{Ce.draw(ae,Z.TRIANGLES,A,Ze,I,l.CullFaceMode.disabled,at,h.id,Se.layoutVertexBuffer,Se.indexBuffer,Se.segments,h.paint,f.transform.zoom,we,[Se.layoutVertexBuffer2])};if(ue){const Ze=f.stencilModeForClipping(he).ref;Ze===0&&f.terrain&&ae.clear({stencil:0});const ut={func:Z.EQUAL,mask:255};at.u_alpha_discard_threshold=.8,ze(new l.StencilMode(ut,Ze,255,Z.KEEP,Z.KEEP,Z.INVERT)),at.u_alpha_discard_threshold=0,ze(new l.StencilMode(ut,Ze,255,Z.KEEP,Z.KEEP,Z.KEEP))}else ze(f.stencilModeForClipping(he))}ue&&(f.resetStencilClippingMasks(),f.terrain&&ae.clear({stencil:0}))},fill:function(f,s,h,g){const v=h.paint.get("fill-color"),b=h.paint.get("fill-opacity");if(b.constantOr(1)===0)return;const A=f.colorModeForRenderPass(),I=h.paint.get("fill-pattern"),D=f.opaquePassEnabledForLayer()&&!I.constantOr(1)&&v.constantOr(l.Color.transparent).a===1&&b.constantOr(0)===1?"opaque":"translucent";if(f.renderPass===D){const N=f.depthModeForSublayer(1,f.renderPass==="opaque"?l.DepthMode.ReadWrite:l.DepthMode.ReadOnly);y0(f,s,h,g,N,A,!1)}if(f.renderPass==="translucent"&&h.paint.get("fill-antialias")){const N=f.depthModeForSublayer(h.getPaintProperty("fill-outline-color")?2:0,l.DepthMode.ReadOnly);y0(f,s,h,g,N,A,!0)}},"fill-extrusion":function(f,s,h,g){const v=h.paint.get("fill-extrusion-opacity");if(v!==0&&f.renderPass==="translucent"){const b=new l.DepthMode(f.context.gl.LEQUAL,l.DepthMode.ReadWrite,f.depthRangeFor3D);if(v!==1||h.paint.get("fill-extrusion-pattern").constantOr(1))rh(f,s,h,g,b,l.StencilMode.disabled,l.ColorMode.disabled),rh(f,s,h,g,b,f.stencilModeFor3D(),f.colorModeForRenderPass()),f.resetStencilClippingMasks();else{const A=f.colorModeForRenderPass();rh(f,s,h,g,b,l.StencilMode.disabled,A)}}},hillshade:function(f,s,h,g){if(f.renderPass!=="offscreen"&&f.renderPass!=="translucent")return;const v=f.context,b=f.depthModeForSublayer(0,l.DepthMode.ReadOnly),A=f.colorModeForRenderPass(),I=f.terrain&&f.terrain.renderingToTexture,[D,N]=f.renderPass!=="translucent"||I?[{},g]:f.stencilConfigForOverlap(g);for(const B of N){const q=s.getTile(B);if(q.needsHillshadePrepare&&f.renderPass==="offscreen")l0(f,q,h,b,l.StencilMode.disabled,A);else if(f.renderPass==="translucent"){const J=I&&f.terrain?f.terrain.stencilModeForRTTOverlap(B):D[B.overscaledZ];s0(f,B,q,h,b,J,A)}}v.viewport.set([0,0,f.width,f.height]),f.resetStencilClippingMasks()},raster:function(f,s,h,g,v,b){if(f.renderPass!=="translucent"||h.paint.get("raster-opacity")===0||!g.length)return;const A=f.context,I=A.gl,D=s.getSource(),N=f.useProgram("raster"),B=f.colorModeForRenderPass(),q=f.terrain&&f.terrain.renderingToTexture,[J,ne]=D instanceof jt||q?[{},g]:f.stencilConfigForOverlap(g),oe=ne[ne.length-1].overscaledZ,ie=!f.options.moving;for(const ae of ne){const Z=q?l.DepthMode.disabled:f.depthModeForSublayer(ae.overscaledZ-oe,h.paint.get("raster-opacity")===1?l.DepthMode.ReadWrite:l.DepthMode.ReadOnly,I.LESS),re=ae.toUnwrapped(),ue=s.getTile(ae);if(q&&(!ue||!ue.hasData()))continue;const he=q?ae.projMatrix:f.transform.calculateProjMatrix(re,ie),be=f.terrain&&q?f.terrain.stencilModeForRTTOverlap(ae):J[ae.overscaledZ],Se=b?0:h.paint.get("raster-fade-duration");ue.registerFadeDuration(Se);const we=s.findLoadedParent(ae,0),Ce=hp(ue,we,s,f.transform,Se);let Ie,Re;f.terrain&&f.terrain.prepareDrawTile();const st=h.paint.get("raster-resampling")==="nearest"?I.NEAREST:I.LINEAR;A.activeTexture.set(I.TEXTURE0),ue.texture.bind(st,I.CLAMP_TO_EDGE),A.activeTexture.set(I.TEXTURE1),we?(we.texture.bind(st,I.CLAMP_TO_EDGE),Ie=Math.pow(2,we.tileID.overscaledZ-ue.tileID.overscaledZ),Re=[ue.tileID.canonical.x*Ie%1,ue.tileID.canonical.y*Ie%1]):ue.texture.bind(st,I.CLAMP_TO_EDGE),ue.texture.useMipmap&&A.extTextureFilterAnisotropic&&f.transform.pitch>20&&I.texParameterf(I.TEXTURE_2D,A.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,A.extTextureFilterAnisotropicMax);const De=xp(he,Re||[0,0],Ie||1,Ce,h,D instanceof jt?D.perspectiveTransform:[0,0]);if(f.prepareDrawProgram(A,N,re),D instanceof jt)D.boundsBuffer&&D.boundsSegments&&N.draw(A,I.TRIANGLES,Z,l.StencilMode.disabled,B,l.CullFaceMode.disabled,De,h.id,D.boundsBuffer,f.quadTriangleIndexBuffer,D.boundsSegments);else{const{tileBoundsBuffer:Ke,tileBoundsIndexBuffer:Ne,tileBoundsSegments:at}=f.getTileBoundsBuffers(ue);N.draw(A,I.TRIANGLES,Z,be,B,l.CullFaceMode.disabled,De,h.id,Ke,Ne,at)}}f.resetStencilClippingMasks()},background:function(f,s,h,g){const v=h.paint.get("background-color"),b=h.paint.get("background-opacity");if(b===0)return;const A=f.context,I=A.gl,D=f.transform,N=D.tileSize,B=h.paint.get("background-pattern");if(f.isPatternMissing(B))return;const q=!B&&v.a===1&&b===1&&f.opaquePassEnabledForLayer()?"opaque":"translucent";if(f.renderPass!==q)return;const J=l.StencilMode.disabled,ne=f.depthModeForSublayer(0,q==="opaque"?l.DepthMode.ReadWrite:l.DepthMode.ReadOnly),oe=f.colorModeForRenderPass(),ie=f.useProgram(B?"backgroundPattern":"background");let ae,Z=g;Z||(ae=f.getBackgroundTiles(),Z=Object.values(ae).map(re=>re.tileID)),B&&(A.activeTexture.set(I.TEXTURE0),f.imageManager.bind(f.context));for(const re of Z){const ue=re.toUnwrapped(),he=g?re.projMatrix:f.transform.calculateProjMatrix(ue);f.prepareDrawTile();const be=s?s.getTile(re):ae?ae[re.key]:new l.Tile(re,N,D.zoom,f),Se=B?tx(he,b,f,B,{tileID:re,tileSize:N}):wp(he,b,v);f.prepareDrawProgram(A,ie,ue);const{tileBoundsBuffer:we,tileBoundsIndexBuffer:Ce,tileBoundsSegments:Ie}=f.getTileBoundsBuffers(be);ie.draw(A,I.TRIANGLES,ne,J,oe,l.CullFaceMode.disabled,Se,h.id,we,Ce,Ie)}},sky:function(f,s,h){const g=f.transform,v=g.projection.name==="mercator"||g.projection.name==="globe"?1:l.smoothstep(7,8,g.zoom),b=h.paint.get("sky-opacity")*v;if(b===0)return;const A=f.context,I=h.paint.get("sky-type"),D=new l.DepthMode(A.gl.LEQUAL,l.DepthMode.ReadOnly,[0,1]),N=f.frameCounter/1e3%1;I==="atmosphere"?f.renderPass==="offscreen"?h.needsSkyboxCapture(f)&&(function(B,q,J,ne){const oe=B.context,ie=oe.gl;let ae=q.skyboxFbo;if(!ae){ae=q.skyboxFbo=oe.createFramebuffer(32,32,!1),q.skyboxGeometry=new ih(oe),q.skyboxTexture=oe.gl.createTexture(),ie.bindTexture(ie.TEXTURE_CUBE_MAP,q.skyboxTexture),ie.texParameteri(ie.TEXTURE_CUBE_MAP,ie.TEXTURE_WRAP_S,ie.CLAMP_TO_EDGE),ie.texParameteri(ie.TEXTURE_CUBE_MAP,ie.TEXTURE_WRAP_T,ie.CLAMP_TO_EDGE),ie.texParameteri(ie.TEXTURE_CUBE_MAP,ie.TEXTURE_MIN_FILTER,ie.LINEAR),ie.texParameteri(ie.TEXTURE_CUBE_MAP,ie.TEXTURE_MAG_FILTER,ie.LINEAR);for(let he=0;he<6;++he)ie.texImage2D(ie.TEXTURE_CUBE_MAP_POSITIVE_X+he,0,ie.RGBA,32,32,0,ie.RGBA,ie.UNSIGNED_BYTE,null)}oe.bindFramebuffer.set(ae.framebuffer),oe.viewport.set([0,0,32,32]);const Z=q.getCenter(B,!0),re=B.useProgram("skyboxCapture"),ue=new Float64Array(16);l.identity(ue),l.rotateY(ue,ue,.5*-Math.PI),io(oe,q,re,ue,Z,0),l.identity(ue),l.rotateY(ue,ue,.5*Math.PI),io(oe,q,re,ue,Z,1),l.identity(ue),l.rotateX(ue,ue,.5*-Math.PI),io(oe,q,re,ue,Z,2),l.identity(ue),l.rotateX(ue,ue,.5*Math.PI),io(oe,q,re,ue,Z,3),l.identity(ue),io(oe,q,re,ue,Z,4),l.identity(ue),l.rotateY(ue,ue,Math.PI),io(oe,q,re,ue,Z,5),oe.viewport.set([0,0,B.width,B.height])}(f,h),h.markSkyboxValid(f)):f.renderPass==="sky"&&function(B,q,J,ne,oe){const ie=B.context,ae=ie.gl,Z=B.transform,re=B.useProgram("skybox");ie.activeTexture.set(ae.TEXTURE0),ae.bindTexture(ae.TEXTURE_CUBE_MAP,q.skyboxTexture);const ue=((he,be,Se,we,Ce)=>({u_matrix:he,u_sun_direction:be,u_cubemap:0,u_opacity:we,u_temporal_offset:Ce}))(Z.skyboxMatrix,q.getCenter(B,!1),0,ne,oe);B.prepareDrawProgram(ie,re),re.draw(ie,ae.TRIANGLES,J,l.StencilMode.disabled,B.colorModeForRenderPass(),l.CullFaceMode.backCW,ue,"skybox",q.skyboxGeometry.vertexBuffer,q.skyboxGeometry.indexBuffer,q.skyboxGeometry.segment)}(f,h,D,b,N):I==="gradient"&&f.renderPass==="sky"&&function(B,q,J,ne,oe){const ie=B.context,ae=ie.gl,Z=B.transform,re=B.useProgram("skyboxGradient");q.skyboxGeometry||(q.skyboxGeometry=new ih(ie)),ie.activeTexture.set(ae.TEXTURE0);let ue=q.colorRampTexture;ue||(ue=q.colorRampTexture=new l.Texture(ie,q.colorRamp,ae.RGBA)),ue.bind(ae.LINEAR,ae.CLAMP_TO_EDGE);const he=((be,Se,we,Ce,Ie)=>({u_matrix:be,u_color_ramp:0,u_center_direction:Se,u_radius:l.degToRad(we),u_opacity:Ce,u_temporal_offset:Ie}))(Z.skyboxMatrix,q.getCenter(B,!1),q.paint.get("sky-gradient-radius"),ne,oe);B.prepareDrawProgram(ie,re),re.draw(ie,ae.TRIANGLES,J,l.StencilMode.disabled,B.colorModeForRenderPass(),l.CullFaceMode.backCW,he,"skyboxGradient",q.skyboxGeometry.vertexBuffer,q.skyboxGeometry.indexBuffer,q.skyboxGeometry.segment)}(f,h,D,b,N)},debug:function(f,s,h){for(let g=0;gv)return void(this.transform.fogCullDistSq=null);const b=g+.78*(v-g);this.transform.fogCullDistSq=b*b}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled?this._terrain:null}resize(s,h){if(this.width=s*l.exported.devicePixelRatio,this.height=h*l.exported.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const g of this.style.order)this.style._layers[g].resize()}setup(){const s=this.context,h=new l.StructArrayLayout2i4;h.emplaceBack(0,0),h.emplaceBack(l.EXTENT,0),h.emplaceBack(0,l.EXTENT),h.emplaceBack(l.EXTENT,l.EXTENT),this.tileExtentBuffer=s.createVertexBuffer(h,l.posAttributes.members),this.tileExtentSegments=l.SegmentVector.simpleSegment(0,0,4,2);const g=new l.StructArrayLayout2i4;g.emplaceBack(0,0),g.emplaceBack(l.EXTENT,0),g.emplaceBack(0,l.EXTENT),g.emplaceBack(l.EXTENT,l.EXTENT),this.debugBuffer=s.createVertexBuffer(g,l.posAttributes.members),this.debugSegments=l.SegmentVector.simpleSegment(0,0,4,5);const v=new l.StructArrayLayout2i4;v.emplaceBack(-1,-1),v.emplaceBack(1,-1),v.emplaceBack(-1,1),v.emplaceBack(1,1),this.viewportBuffer=s.createVertexBuffer(v,l.posAttributes.members),this.viewportSegments=l.SegmentVector.simpleSegment(0,0,4,2);const b=new l.StructArrayLayout4i8;b.emplaceBack(0,0,0,0),b.emplaceBack(l.EXTENT,0,l.EXTENT,0),b.emplaceBack(0,l.EXTENT,0,l.EXTENT),b.emplaceBack(l.EXTENT,l.EXTENT,l.EXTENT,l.EXTENT),this.mercatorBoundsBuffer=s.createVertexBuffer(b,l.boundsAttributes.members),this.mercatorBoundsSegments=l.SegmentVector.simpleSegment(0,0,4,2);const A=new l.StructArrayLayout3ui6;A.emplaceBack(0,1,2),A.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=s.createIndexBuffer(A);const I=new l.StructArrayLayout1ui2;for(const N of[0,1,3,2,0])I.emplaceBack(N);this.debugIndexBuffer=s.createIndexBuffer(I),this.emptyTexture=new l.Texture(s,new l.RGBAImage({width:1,height:1},Uint8Array.of(0,0,0,0)),s.gl.RGBA),this.identityMat=l.create();const D=this.context.gl;this.stencilClearMode=new l.StencilMode({func:D.ALWAYS,mask:0},0,255,D.ZERO,D.ZERO,D.ZERO),this.loadTimeStamps.push(l.window.performance.now()),this.atmosphereBuffer=new w0(this.context)}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(s){return s._makeTileBoundsBuffers(this.context,this.transform.projection),s._tileBoundsBuffer?{tileBoundsBuffer:s._tileBoundsBuffer,tileBoundsIndexBuffer:s._tileBoundsIndexBuffer,tileBoundsSegments:s._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){const s=this.context,h=s.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.useProgram("clippingMask").draw(s,h.TRIANGLES,l.DepthMode.disabled,this.stencilClearMode,l.ColorMode.disabled,l.CullFaceMode.disabled,Bc(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(s,h,g){if(!h||this.currentStencilSource===h.id||!s.isTileClipped()||!g||g.length===0)return;if(this._tileClippingMaskIDs&&!this.terrain){let I=!1;for(const D of g)if(this._tileClippingMaskIDs[D.key]===void 0){I=!0;break}if(!I)return}this.currentStencilSource=h.id;const v=this.context,b=v.gl;this.nextStencilID+g.length>256&&this.clearStencil(),v.setColorMode(l.ColorMode.disabled),v.setDepthMode(l.DepthMode.disabled);const A=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const I of g){const D=h.getTile(I),N=this._tileClippingMaskIDs[I.key]=this.nextStencilID++,{tileBoundsBuffer:B,tileBoundsIndexBuffer:q,tileBoundsSegments:J}=this.getTileBoundsBuffers(D);A.draw(v,b.TRIANGLES,l.DepthMode.disabled,new l.StencilMode({func:b.ALWAYS,mask:0},N,255,b.KEEP,b.KEEP,b.REPLACE),l.ColorMode.disabled,l.CullFaceMode.disabled,Bc(I.projMatrix),"$clipping",B,q,J)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const s=this.nextStencilID++,h=this.context.gl;return new l.StencilMode({func:h.NOTEQUAL,mask:255},s,255,h.KEEP,h.KEEP,h.REPLACE)}stencilModeForClipping(s){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(s);const h=this.context.gl;return new l.StencilMode({func:h.EQUAL,mask:255},this._tileClippingMaskIDs[s.key],0,h.KEEP,h.KEEP,h.REPLACE)}stencilConfigForOverlap(s){const h=this.context.gl,g=s.sort((A,I)=>I.overscaledZ-A.overscaledZ),v=g[g.length-1].overscaledZ,b=g[0].overscaledZ-v+1;if(b>1){this.currentStencilSource=void 0,this.nextStencilID+b>256&&this.clearStencil();const A={};for(let I=0;I=0;this.currentLayer--){const N=this.style._layers[g[this.currentLayer]],B=s._getLayerSourceCache(N);if(N.isSky())continue;const q=B?A[B.id]:void 0;this._renderTileClippingMasks(N,B,q),this.renderLayer(this,B,N,q)}if(this.style.fog&&this.transform.projection.supportsFog&&function(N,B){const q=N.context,J=q.gl,ne=N.transform,oe=new l.DepthMode(J.LEQUAL,l.DepthMode.ReadOnly,[0,1]),ie=N.useProgram("globeAtmosphere",null,ne.projection.name==="globe"?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"]),ae=l.globeToMercatorTransition(ne.zoom),Z=B.properties.get("color").toArray01(),re=B.properties.get("high-color").toArray01(),ue=B.properties.get("space-color").toArray01PremultipliedAlpha(),he=l.identity$1([]);l.rotateY$1(he,he,-l.degToRad(ne._center.lng)),l.rotateX$1(he,he,l.degToRad(ne._center.lat)),l.rotateZ$1(he,he,ne.angle),l.rotateX$1(he,he,-ne._pitch);const be=l.fromQuat(new Float32Array(16),he),Se=l.mapValue(B.properties.get("star-intensity"),0,1,0,.25),we=5e-4,Ce=l.mapValue(B.properties.get("horizon-blend"),0,1,we,.25),Ie=l.globeUseCustomAntiAliasing(N,q,ne)&&Ce===we?ne.worldSize/(2*Math.PI*1.025)-1:ne.globeRadius,Re=N.frameCounter/1e3%1,st=l.length(ne.globeCenterInViewSpace),De=Math.sqrt(Math.pow(st,2)-Math.pow(Ie,2)),Ke=Math.acos(De/st),Ne=((ze,Ze,ut,tt,ht,Mt,$t,It,Lt,nr,er,Pt,Ar,Mr)=>({u_frustum_tl:ze,u_frustum_tr:Ze,u_frustum_br:ut,u_frustum_bl:tt,u_horizon:ht,u_transition:Mt,u_fadeout_range:$t,u_color:It,u_high_color:Lt,u_space_color:nr,u_star_intensity:er,u_star_size:5*l.exported.devicePixelRatio,u_star_density:0,u_temporal_offset:Pt,u_horizon_angle:Ar,u_rotation_matrix:Mr}))(ne.frustumCorners.TL,ne.frustumCorners.TR,ne.frustumCorners.BR,ne.frustumCorners.BL,ne.frustumCorners.horizon,ae,Ce,Z,re,ue,Se,Re,Ke,be);N.prepareDrawProgram(q,ie);const at=N.atmosphereBuffer;at&&ie.draw(q,J.TRIANGLES,oe,l.StencilMode.disabled,l.ColorMode.alphaBlended,l.CullFaceMode.backCW,Ne,"skybox",at.vertexBuffer,at.indexBuffer,at.segments)}(this,this.style.fog),this.renderPass="sky",(l.globeToMercatorTransition(this.transform.zoom)>0||this.transform.projection.name!=="globe")&&this.transform.isHorizonVisible())for(this.currentLayer=0;this.currentLayer{const q=s._getLayerSourceCache(B);q&&!B.isHidden(this.transform.zoom)&&(!N||N.getSource().maxzoom0?h.pop():null}isPatternMissing(s){return s===null||s!==void 0&&!this.imageManager.getPattern(s.toString())}terrainRenderModeElevated(){return this.style&&!!this.style.getTerrain()&&!!this.terrain&&!this.terrain.renderingToTexture}currentGlobalDefines(){const s=this.terrain&&this.terrain.renderingToTexture,h=this.terrain&&this.terrain.exaggeration()===0,g=this.style&&this.style.fog,v=[];return this.terrainRenderModeElevated()&&v.push("TERRAIN"),this.transform.projection.name==="globe"&&v.push("GLOBE"),h&&v.push("ZERO_EXAGGERATION"),g&&!s&&g.getOpacity(this.transform.pitch)!==0&&v.push("FOG"),s&&v.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&v.push("OVERDRAW_INSPECTOR"),v}useProgram(s,h,g){this.cache=this.cache||{};const v=g||[],b=this.currentGlobalDefines().concat(v),A=dr.cacheKey(sp[s],s,b,h);return this.cache[A]||(this.cache[A]=new dr(this.context,s,sp[s],h,Ep[s],b)),this.cache[A]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.frontFace.setDefault(),this.context.cullFaceSide.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const s=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(s.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=l.window.document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new l.Texture(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this._terrain&&this._terrain.destroy(),this.globeSharedBuffers&&this.globeSharedBuffers.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this.atmosphereBuffer&&this.atmosphereBuffer.destroy()}prepareDrawTile(){this.terrain&&this.terrain.prepareDrawTile()}prepareDrawProgram(s,h,g){if(this.terrain&&this.terrain.renderingToTexture)return;const v=this.style.fog;if(v){const b=v.getOpacity(this.transform.pitch),A=((I,D,N,B,q,J,ne,oe,ie,ae,Z)=>{const re=I.transform,ue=D.properties.get("color").toArray01();ue[3]=B;const he=I.frameCounter/1e3%1;return{u_fog_matrix:N?re.calculateFogTileMatrix(N):I.identityMat,u_fog_range:D.getFovAdjustedRange(re._fov),u_fog_color:ue,u_fog_horizon_blend:D.properties.get("horizon-blend"),u_fog_temporal_offset:he,u_frustum_tl:q,u_frustum_tr:J,u_frustum_br:ne,u_frustum_bl:oe,u_globe_pos:ie,u_globe_radius:ae,u_viewport:Z,u_globe_transition:l.globeToMercatorTransition(re.zoom),u_is_globe:+(re.projection.name==="globe")}})(this,v,g,b,this.transform.frustumCorners.TL,this.transform.frustumCorners.TR,this.transform.frustumCorners.BR,this.transform.frustumCorners.BL,this.transform.globeCenterInViewSpace,this.transform.globeRadius,[this.transform.width*l.exported.devicePixelRatio,this.transform.height*l.exported.devicePixelRatio]);h.setFogUniformValues(s,A)}}setTileLoadedFlag(s){this.tileLoaded=s}saveCanvasCopy(){const s=this.canvasCopy();s&&(this.frameCopies.push(s),this.tileLoaded=!1)}canvasCopy(){const s=this.context.gl,h=s.createTexture();return s.bindTexture(s.TEXTURE_2D,h),s.copyTexImage2D(s.TEXTURE_2D,0,s.RGBA,0,0,s.drawingBufferWidth,s.drawingBufferHeight,0),h}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;const s=this.style&&this.style.fog;return!!s&&s.getOpacity(this.transform.pitch)!==0}getBackgroundTiles(){const s=this._backgroundTiles,h=this._backgroundTiles={},g=this.transform.coveringTiles({tileSize:512});for(const v of g)h[v.key]=s[v.key]||new l.Tile(v,512,this.transform.tileZoom,this);return h}clearBackgroundTiles(){this._backgroundTiles={}}}class oh{constructor(s=0,h=0,g=0,v=0){if(isNaN(s)||s<0||isNaN(h)||h<0||isNaN(g)||g<0||isNaN(v)||v<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=s,this.bottom=h,this.left=g,this.right=v}interpolate(s,h,g){return h.top!=null&&s.top!=null&&(this.top=l.number(s.top,h.top,g)),h.bottom!=null&&s.bottom!=null&&(this.bottom=l.number(s.bottom,h.bottom,g)),h.left!=null&&s.left!=null&&(this.left=l.number(s.left,h.left,g)),h.right!=null&&s.right!=null&&(this.right=l.number(s.right,h.right,g)),this}getCenter(s,h){const g=l.clamp((this.left+s-this.right)/2,0,s),v=l.clamp((this.top+h-this.bottom)/2,0,h);return new l.Point(g,v)}equals(s){return this.top===s.top&&this.bottom===s.bottom&&this.left===s.left&&this.right===s.right}clone(){return new oh(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function ah(f,s){const h=l.getColumn(f,3);l.fromQuat(f,s),l.setColumn(f,3,h)}function pr(f,s){const h=l.identity$1([]);return l.rotateZ$1(h,h,-s),l.rotateX$1(h,h,-f),h}function Gc(f,s){const h=[f[0],f[1],0],g=[s[0],s[1],0];if(l.length(h)>=1e-15){const A=l.normalize([],h);l.scale$2(g,A,l.dot(g,A)),s[0]=g[0],s[1]=g[1]}const v=l.cross([],s,f);if(l.len(v)<1e-15)return null;const b=Math.atan2(-v[1],v[0]);return pr(Math.atan2(Math.sqrt(f[0]*f[0]+f[1]*f[1]),-f[2]),b)}class E0{constructor(s,h){this.position=s,this.orientation=h}get position(){return this._position}set position(s){if(s){const h=s instanceof l.MercatorCoordinate?s:new l.MercatorCoordinate(s[0],s[1],s[2]);this._renderWorldCopies&&(h.x=l.wrap(h.x,0,1)),this._position=h}else this._position=null}lookAtPoint(s,h){if(this.orientation=null,!this.position)return;const g=this.position,v=this._elevation?this._elevation.getAtPointOrZero(l.MercatorCoordinate.fromLngLat(s)):0,b=l.MercatorCoordinate.fromLngLat(s,v),A=[b.x-g.x,b.y-g.y,b.z-g.z];h||(h=[0,0,1]),h[2]=Math.abs(h[2]),this.orientation=Gc(A,h)}setPitchBearing(s,h){this.orientation=pr(l.degToRad(s),l.degToRad(-h))}}class sh{constructor(s,h){this._transform=l.identity([]),this.orientation=h,this.position=s}get mercatorPosition(){const s=this.position;return new l.MercatorCoordinate(s[0],s[1],s[2])}get position(){const s=l.getColumn(this._transform,3);return[s[0],s[1],s[2]]}set position(s){var h;s&&l.setColumn(this._transform,3,[(h=s)[0],h[1],h[2],1])}get orientation(){return this._orientation}set orientation(s){this._orientation=s||l.identity$1([]),s&&ah(this._transform,this._orientation)}getPitchBearing(){const s=this.forward(),h=this.right();return{bearing:Math.atan2(-h[1],h[0]),pitch:Math.atan2(Math.sqrt(s[0]*s[0]+s[1]*s[1]),-s[2])}}setPitchBearing(s,h){this._orientation=pr(s,h),ah(this._transform,this._orientation)}forward(){const s=l.getColumn(this._transform,2);return[-s[0],-s[1],-s[2]]}up(){const s=l.getColumn(this._transform,1);return[-s[0],-s[1],-s[2]]}right(){const s=l.getColumn(this._transform,0);return[s[0],s[1],s[2]]}getCameraToWorld(s,h){const g=new Float64Array(16);return l.invert(g,this.getWorldToCamera(s,h)),g}getWorldToCameraPosition(s,h,g){const v=this.position;l.scale$2(v,v,-s);const b=new Float64Array(16);return l.fromScaling(b,[g,g,g]),l.translate(b,b,v),b[10]*=h,b}getWorldToCamera(s,h){const g=new Float64Array(16),v=new Float64Array(4),b=this.position;return l.conjugate(v,this._orientation),l.scale$2(b,b,-s),l.fromQuat(g,v),l.translate(g,g,b),g[1]*=-1,g[5]*=-1,g[9]*=-1,g[13]*=-1,g[8]*=h,g[9]*=h,g[10]*=h,g[11]*=h,g}getCameraToClipPerspective(s,h,g,v){const b=new Float64Array(16);return l.perspective(b,s,h,g,v),b}getDistanceToElevation(s,h=!1){const g=s===0?0:l.mercatorZfromAltitude(s,h?l.latFromMercatorY(this.position[1]):this.position[1]),v=this.forward();return(g-this.position[2])/v[2]}clone(){return new sh([...this.position],[...this.orientation])}}function Il(f,s){const h=lh(f.projection,f.zoom,f.width,f.height),g=function(b,A,I,D,N){const B=new l.LngLat(I.lng-180*Ia,I.lat),q=new l.LngLat(I.lng+180*Ia,I.lat),J=b.project(B.lng,B.lat),ne=b.project(q.lng,q.lat),oe=-Math.atan2(ne.y-J.y,ne.x-J.x),ie=l.MercatorCoordinate.fromLngLat(I);ie.y=l.clamp(ie.y,-1+Ia,1-Ia);const ae=ie.toLngLat(),Z=b.project(ae.lng,ae.lat),re=l.MercatorCoordinate.fromLngLat(ae);re.x+=Ia;const ue=re.toLngLat(),he=b.project(ue.lng,ue.lat),be=ch(he.x-Z.x,he.y-Z.y,oe),Se=l.MercatorCoordinate.fromLngLat(ae);Se.y+=Ia;const we=Se.toLngLat(),Ce=b.project(we.lng,we.lat),Ie=ch(Ce.x-Z.x,Ce.y-Z.y,oe),Re=Math.abs(be.x)/Math.abs(Ie.y),st=l.identity([]);l.rotateZ(st,st,-oe*(1-(N?0:D)));const De=l.identity([]);return l.scale(De,De,[1,1-(1-Re)*D,1]),De[4]=-Ie.x/Ie.y*D,l.rotateZ(De,De,oe),l.multiply(De,st,De),De}(f.projection,0,f.center,h,s),v=S0(f);return l.scale(g,g,[v,v,1]),g}function S0(f){const s=f.projection,h=lh(f.projection,f.zoom,f.width,f.height),g=T0(s,f.center),v=T0(s,l.LngLat.convert(s.center));return Math.pow(2,g*h+(1-h)*v)}function lh(f,s,h,g,v=1/0){const b=f.range;if(!b)return 0;const A=Math.min(v,Math.max(h,g)),I=Math.log(A/1024)/Math.LN2;return l.smoothstep(b[0]+I,b[1]+I,s)}const Ia=1/4e4;function T0(f,s){const h=l.clamp(s.lat,-l.MAX_MERCATOR_LATITUDE,l.MAX_MERCATOR_LATITUDE),g=new l.LngLat(s.lng-180*Ia,h),v=new l.LngLat(s.lng+180*Ia,h),b=f.project(g.lng,h),A=f.project(v.lng,h),I=l.MercatorCoordinate.fromLngLat(g),D=l.MercatorCoordinate.fromLngLat(v),N=A.x-b.x,B=A.y-b.y,q=D.x-I.x,J=D.y-I.y,ne=Math.sqrt((q*q+J*J)/(N*N+B*B));return Math.log(ne)/Math.LN2}function ch(f,s,h){const g=Math.cos(h),v=Math.sin(h);return{x:f*g-s*v,y:f*v+s*g}}class Cl{constructor(s,h,g,v,b,A,I){this.tileSize=512,this._renderWorldCopies=b===void 0||b,this._minZoom=s||0,this._maxZoom=h||22,this._minPitch=g??0,this._maxPitch=v??60,this.setProjection(A),this.setMaxBounds(I),this.width=0,this.height=0,this._center=new l.LngLat(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._nearZ=0,this._farZ=0,this._unmodified=!0,this._edgeInsets=new oh,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._distanceTileDataCache={},this._camera=new sh,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._pixelsPerMercatorPixel=1,this.globeRadius=0,this.globeCenterInViewSpace=[0,0,0],this._horizonShift=.1}clone(){const s=new Cl(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection());return s._elevation=this._elevation,s._centerAltitude=this._centerAltitude,s._centerAltitudeValidForExaggeration=this._centerAltitudeValidForExaggeration,s.tileSize=this.tileSize,s.mercatorFromTransition=this.mercatorFromTransition,s.width=this.width,s.height=this.height,s.cameraElevationReference=this.cameraElevationReference,s._center=this._center,s._setZoom(this.zoom),s._seaLevelZoom=this._seaLevelZoom,s.angle=this.angle,s._fov=this._fov,s._pitch=this._pitch,s._nearZ=this._nearZ,s._farZ=this._farZ,s._averageElevation=this._averageElevation,s._unmodified=this._unmodified,s._edgeInsets=this._edgeInsets.clone(),s._camera=this._camera.clone(),s._calcMatrices(),s.freezeTileCoverage=this.freezeTileCoverage,s.frustumCorners=this.frustumCorners,s}get elevation(){return this._elevation}set elevation(s){this._elevation!==s&&(this._elevation=s,this._updateCameraOnTerrain(),this._calcMatrices())}updateElevation(s,h=!1){const g=this._elevation&&this._elevation.exaggeration()!==this._centerAltitudeValidForExaggeration;(this._seaLevelZoom==null||g)&&this._updateCameraOnTerrain(),(s||g)&&this._constrainCamera(h),this._calcMatrices()}getProjection(){return l.pick(this.projection,["name","center","parallels"])}setProjection(s){this.projectionOptions=s||{name:"mercator"};const h=this.projection?this.getProjection():void 0;this.projection=l.getProjection(this.projectionOptions);const g=!w(h,this.getProjection());return g&&this._calcMatrices(),this.mercatorFromTransition=!1,g}setMercatorFromTransition(){const s=this.projection.name;this.mercatorFromTransition=!0,this.projectionOptions={name:"mercator"},this.projection=l.getProjection({name:"mercator"});const h=s!==this.projection.name;return h&&this._calcMatrices(),h}get minZoom(){return this._minZoom}set minZoom(s){this._minZoom!==s&&(this._minZoom=s,this.zoom=Math.max(this.zoom,s))}get maxZoom(){return this._maxZoom}set maxZoom(s){this._maxZoom!==s&&(this._maxZoom=s,this.zoom=Math.min(this.zoom,s))}get minPitch(){return this._minPitch}set minPitch(s){this._minPitch!==s&&(this._minPitch=s,this.pitch=Math.max(this.pitch,s))}get maxPitch(){return this._maxPitch}set maxPitch(s){this._maxPitch!==s&&(this._maxPitch=s,this.pitch=Math.min(this.pitch,s))}get renderWorldCopies(){return this._renderWorldCopies&&this.projection.supportsWorldCopies===!0}set renderWorldCopies(s){s===void 0?s=!0:s===null&&(s=!1),this._renderWorldCopies=s}get worldSize(){return this.tileSize*this.scale}get cameraWorldSizeForFog(){const s=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(s))}get cameraWorldSize(){const s=Math.max(this._camera.getDistanceToElevation(this._averageElevation,!0),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(s))}get pixelsPerMeter(){return this.projection.pixelsPerMeter(this.center.lat,this.worldSize)}get cameraPixelsPerMeter(){return l.mercatorZfromAltitude(this.center.lat,this.cameraWorldSizeForFog)}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new l.Point(this.width,this.height)}get bearing(){return l.wrap(this.rotation,-180,180)}set bearing(s){this.rotation=s}get rotation(){return-this.angle/Math.PI*180}set rotation(s){const h=-s*Math.PI/180;var g;this.angle!==h&&(this._unmodified=!1,this.angle=h,this._calcMatrices(),this.rotationMatrix=(g=new l.ARRAY_TYPE(4),l.ARRAY_TYPE!=Float32Array&&(g[1]=0,g[2]=0),g[0]=1,g[3]=1,g),function(v,b,A){var I=b[0],D=b[1],N=b[2],B=b[3],q=Math.sin(A),J=Math.cos(A);v[0]=I*J+N*q,v[1]=D*J+B*q,v[2]=I*-q+N*J,v[3]=D*-q+B*J}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(s){const h=l.clamp(s,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==h&&(this._unmodified=!1,this._pitch=h,this._calcMatrices())}get aspect(){return this.width/this.height}get fov(){return this._fov/Math.PI*180}get fovX(){return this._fov}get fovY(){const s=1/Math.tan(.5*this.fovX);return 2*Math.atan(1/this.aspect/s)}set fov(s){s=Math.max(.01,Math.min(60,s)),this._fov!==s&&(this._unmodified=!1,this._fov=l.degToRad(s),this._calcMatrices())}get averageElevation(){return this._averageElevation}set averageElevation(s){this._averageElevation=s,this._calcFogMatrices(),this._distanceTileDataCache={}}get zoom(){return this._zoom}set zoom(s){const h=Math.min(Math.max(s,this.minZoom),this.maxZoom);this._zoom!==h&&(this._unmodified=!1,this._setZoom(h),this._updateSeaLevelZoom(),this._constrain(),this._calcMatrices())}_setZoom(s){this._zoom=s,this.scale=this.zoomScale(s),this.tileZoom=Math.floor(s),this.zoomFraction=s-this.tileZoom}_updateCameraOnTerrain(){if(!this._elevation||!this._elevation.isDataAvailableAtPoint(this.locationCoordinate(this.center)))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForExaggeration=void 0);const s=this._elevation;this._centerAltitude=s.getAtPointOrZero(this.locationCoordinate(this.center)),this._centerAltitudeValidForExaggeration=s.exaggeration(),this._updateSeaLevelZoom()}_updateSeaLevelZoom(){this._centerAltitudeValidForExaggeration!==void 0&&(this._seaLevelZoom=this._zoomFromMercatorZ((this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize))}sampleAverageElevation(){if(!this._elevation)return 0;const s=this._elevation,h=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],g=this.horizonLineFromTop();let v=0,b=0;for(let A=0;As.maxzoom&&(h=s.maxzoom);const A=this.locationCoordinate(this.center),I=this.center.lat,D=1<{const ut=new l.MercatorCoordinate(ze.x+25e-6,ze.y,ze.z),tt=new l.MercatorCoordinate(ze.x,ze.y+25e-6,ze.z),ht=ze.toLngLat(),Mt=ut.toLngLat(),$t=tt.toLngLat(),It=this.locationCoordinate(ht),Lt=this.locationCoordinate(Mt),nr=this.locationCoordinate($t),er=Math.hypot(Lt.x-It.x,Lt.y-It.y),Pt=Math.hypot(nr.x-It.x,nr.y-It.y);return Math.sqrt(er*Pt)*be/25e-6},we=ze=>{const Ze=ue,ut=he;return{aabb:l.tileAABB(this,D,0,0,0,ze,ut,Ze,this.projection),zoom:0,x:0,y:0,minZ:ut,maxZ:Ze,wrap:ze,fullyVisible:!1}},Ce=[];let Ie=[];const Re=h,st=s.reparseOverscaled?g:h,De=ze=>ze*ze,Ke=De((ie-this._centerAltitude)*oe),Ne=ze=>{if(!this._elevation||!ze.tileID||!b)return;const Ze=this._elevation.getMinMaxForTile(ze.tileID),ut=ze.aabb;Ze?(ut.min[2]=Ze.min,ut.max[2]=Ze.max,ut.center[2]=(ut.min[2]+ut.max[2])/2):(ze.shouldSplit=at(ze),ze.shouldSplit||(ut.min[2]=ut.max[2]=ut.center[2]=this._centerAltitude))},at=ze=>{if(ze.zoom=.9)return!0}else if(v&&(tt=De(ze.aabb.distanceZ(ae)*oe)),this.projection.isReprojectedInTileSpace&&g<=5){const It=Math.pow(2,ze.zoom),Lt=Se(new l.MercatorCoordinate((ze.x+.5)/It,(ze.y+.5)/It));ht=Lt>.85?1:Lt}const Mt=Ze*Ze+ut*ut+tt,$t=De((1<{if(Lt*De(.707)0;){const ze=Ce.pop(),Ze=ze.x,ut=ze.y;let tt=ze.fullyVisible;if(!tt){const ht=ze.aabb.intersects(J);if(ht===0)continue;tt=ht===2}if(ze.zoom!==Re&&at(ze))for(let ht=0;ht<4;ht++){const Mt=(Ze<<1)+ht%2,$t=(ut<<1)+(ht>>1),It={aabb:b?ze.aabb.quadrant(ht):l.tileAABB(this,D,ze.zoom+1,Mt,$t,ze.wrap,ze.minZ,ze.maxZ,this.projection),zoom:ze.zoom+1,x:Mt,y:$t,wrap:ze.wrap,fullyVisible:tt,tileID:void 0,shouldSplit:void 0,minZ:ze.minZ,maxZ:ze.maxZ};v&&!B&&(It.tileID=new l.OverscaledTileID(ze.zoom+1===Re?st:ze.zoom+1,ze.wrap,ze.zoom+1,Mt,$t),Ne(It)),Ce.push(It)}else{const ht=ze.zoom===Re?st:ze.zoom;if(s.minzoom&&s.minzoom>ht)continue;const Mt=N[0]-(.5+Ze+(ze.wrap<{const tt=[0,0,0,1],ht=[l.EXTENT,l.EXTENT,0,1],Mt=this.calculateFogTileMatrix(ut.tileID.toUnwrapped());l.transformMat4$1(tt,tt,Mt),l.transformMat4$1(ht,ht,Mt);const $t=l.getAABBPointSquareDist(tt,ht);if($t===0)return!0;let It=!1;const Lt=this._elevation;if(Lt&&$t>ze&&Ze!==0){const nr=this.calculateProjMatrix(ut.tileID.toUnwrapped());let er;s.isTerrainDEM||(er=Lt.getMinMaxForTile(ut.tileID)),er||(er={min:he,max:ue});const Pt=l.furthestTileCorner(this.rotation),Ar=[Pt[0]*l.EXTENT,Pt[1]*l.EXTENT,er.max];l.transformMat4(Ar,Ar,nr),It=(1-Ar[1])*this.height*.5ze.distanceSq-Ze.distanceSq).map(ze=>ze.tileID)}resize(s,h){this.width=s,this.height=h,this.pixelsToGLUnits=[2/s,-2/h],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(s){return Math.pow(2,s)}scaleZoom(s){return Math.log(s)/Math.LN2}project(s){const h=l.clamp(s.lat,-l.MAX_MERCATOR_LATITUDE,l.MAX_MERCATOR_LATITUDE),g=this.projection.project(s.lng,h);return new l.Point(g.x*this.worldSize,g.y*this.worldSize)}unproject(s){return this.projection.unproject(s.x/this.worldSize,s.y/this.worldSize)}get point(){return this.project(this.center)}get pointMerc(){return this.point._div(this.worldSize)}get pixelsPerMeterRatio(){return this.pixelsPerMeter/l.mercatorZfromAltitude(1,this.center.lat)/this.worldSize}setLocationAtPoint(s,h){let g,v;const b=this.centerPoint;if(this.projection.name==="globe"){const I=this.worldSize;g=(h.x-b.x)/I,v=(h.y-b.y)/I}else{const I=this.pointCoordinate(h),D=this.pointCoordinate(b);g=I.x-D.x,v=I.y-D.y}const A=this.locationCoordinate(s);this.setLocation(new l.MercatorCoordinate(A.x-g,A.y-v))}setLocation(s){this.center=this.coordinateLocation(s),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(s){return this.projection.locationPoint(this,s)}locationPoint3D(s){return this.projection.locationPoint(this,s,!0)}pointLocation(s){return this.coordinateLocation(this.pointCoordinate(s))}pointLocation3D(s){return this.coordinateLocation(this.pointCoordinate3D(s))}locationCoordinate(s,h){const g=h?l.mercatorZfromAltitude(h,s.lat):void 0,v=this.projection.project(s.lng,s.lat);return new l.MercatorCoordinate(v.x,v.y,g)}coordinateLocation(s){return this.projection.unproject(s.x,s.y)}pointRayIntersection(s,h){const g=h??this._centerAltitude,v=[s.x,s.y,0,1],b=[s.x,s.y,1,1];l.transformMat4$1(v,v,this.pixelMatrixInverse),l.transformMat4$1(b,b,this.pixelMatrixInverse);const A=b[3];l.scale$1(v,v,1/v[3]),l.scale$1(b,b,1/A);const I=v[2],D=b[2];return{p0:v,p1:b,t:I===D?0:(g-I)/(D-I)}}screenPointToMercatorRay(s){const h=[s.x,s.y,0,1],g=[s.x,s.y,1,1];return l.transformMat4$1(h,h,this.pixelMatrixInverse),l.transformMat4$1(g,g,this.pixelMatrixInverse),l.scale$1(h,h,1/h[3]),l.scale$1(g,g,1/g[3]),h[2]=l.mercatorZfromAltitude(h[2],this._center.lat)*this.worldSize,g[2]=l.mercatorZfromAltitude(g[2],this._center.lat)*this.worldSize,l.scale$1(h,h,1/this.worldSize),l.scale$1(g,g,1/this.worldSize),new l.Ray([h[0],h[1],h[2]],l.normalize([],l.sub([],g,h)))}rayIntersectionCoordinate(s){const{p0:h,p1:g,t:v}=s,b=l.mercatorZfromAltitude(h[2],this._center.lat),A=l.mercatorZfromAltitude(g[2],this._center.lat);return new l.MercatorCoordinate(l.number(h[0],g[0],v)/this.worldSize,l.number(h[1],g[1],v)/this.worldSize,l.number(b,A,v))}pointCoordinate(s,h=this._centerAltitude){return this.projection.pointCoordinate(this,s.x,s.y,h)}pointCoordinate3D(s){if(!this.elevation)return this.pointCoordinate(s);let h=this.projection.pointCoordinate3D(this,s.x,s.y);if(h)return new l.MercatorCoordinate(h[0],h[1],h[2]);let g=0,v=this.horizonLineFromTop();if(s.y>v)return this.pointCoordinate(s);const b=.02*v,A=s.clone();for(let I=0;I<10&&v-g>b;I++){A.y=l.number(g,v,.66);const D=this.projection.pointCoordinate3D(this,A.x,A.y);D?(v=A.y,h=D):g=A.y}return h?new l.MercatorCoordinate(h[0],h[1],h[2]):this.pointCoordinate(s)}isPointAboveHorizon(s){return this.projection.isPointAboveHorizon(this,s)}isPointOnSurface(s){if(s.y<0||s.y>this.height||s.x<0||s.x>this.width)return!1;if(this.elevation||this.zoom>=l.GLOBE_ZOOM_THRESHOLD_MAX)return!this.isPointAboveHorizon(s);const h=this.pointCoordinate(s);return h.y>=0&&h.y<=1}_coordinatePoint(s,h){const g=h&&this.elevation?this.elevation.getAtPointOrZero(s,this._centerAltitude):this._centerAltitude,v=[s.x*this.worldSize,s.y*this.worldSize,g+s.toAltitude(),1];return l.transformMat4$1(v,v,this.pixelMatrix),v[3]>0?new l.Point(v[0]/v[3],v[1]/v[3]):new l.Point(Number.MAX_VALUE,Number.MAX_VALUE)}_getBoundsNonRectangular(){const{top:s,left:h}=this._edgeInsets,g=this.height-this._edgeInsets.bottom,v=this.width-this._edgeInsets.right,b=this.pointLocation3D(new l.Point(h,s)),A=this.pointLocation3D(new l.Point(v,s)),I=this.pointLocation3D(new l.Point(v,g)),D=this.pointLocation3D(new l.Point(h,g));let N=Math.min(b.lng,A.lng,I.lng,D.lng),B=Math.max(b.lng,A.lng,I.lng,D.lng),q=Math.min(b.lat,A.lat,I.lat,D.lat),J=Math.max(b.lat,A.lat,I.lat,D.lat);const ne=Math.pow(2,-this.zoom)/16*270,oe=this.projection.name==="globe"?1:4,ie=(ae,Z,re,ue,he)=>{const be=(ae+re)/2,Se=(Z+ue)/2,we=new l.Point(be,Se),{lng:Ce,lat:Ie}=this.pointLocation3D(we),Re=Math.max(0,N-Ce,q-Ie,Ce-B,Ie-J);N=Math.min(N,Ce),B=Math.max(B,Ce),q=Math.min(q,Ie),J=Math.max(J,Ie),(hene)&&(ie(ae,Z,be,Se,he+1),ie(be,Se,re,ue,he+1))};if(ie(h,s,v,s,1),ie(v,s,v,g,1),ie(v,g,h,g,1),ie(h,g,h,s,1),this.projection.name==="globe"){const[ae,Z]=l.polesInViewport(this);ae?(J=90,B=180,N=-180):Z&&(q=-90,B=180,N=-180)}return new l.LngLatBounds(new l.LngLat(N,q),new l.LngLat(B,J))}_getBoundsRectangular(s,h){const{top:g,left:v}=this._edgeInsets,b=this.height-this._edgeInsets.bottom,A=this.width-this._edgeInsets.right,I=new l.Point(v,g),D=new l.Point(A,g),N=new l.Point(A,b),B=new l.Point(v,b);let q=this.pointCoordinate(I,s),J=this.pointCoordinate(D,s);const ne=this.pointCoordinate(N,h),oe=this.pointCoordinate(B,h),ie=(ae,Z)=>(Z.y-ae.y)/(Z.x-ae.x);return q.y>1&&J.y>=0?q=new l.MercatorCoordinate((1-oe.y)/ie(oe,q)+oe.x,1):q.y<0&&J.y<=1&&(q=new l.MercatorCoordinate(-oe.y/ie(oe,q)+oe.x,0)),J.y>1&&q.y>=0?J=new l.MercatorCoordinate((1-ne.y)/ie(ne,J)+ne.x,1):J.y<0&&q.y<=1&&(J=new l.MercatorCoordinate(-ne.y/ie(ne,J)+ne.x,0)),new l.LngLatBounds().extend(this.coordinateLocation(q)).extend(this.coordinateLocation(J)).extend(this.coordinateLocation(oe)).extend(this.coordinateLocation(ne))}_getBoundsRectangularTerrain(){const s=this.elevation;if(!s.visibleDemTiles.length||s.isUsingMockSource())return this._getBoundsRectangular(0,0);const h=s.visibleDemTiles.reduce((g,v)=>{if(v.dem){const b=v.dem.tree;g.min=Math.min(g.min,b.minimums[0]),g.max=Math.max(g.max,b.maximums[0])}return g},{min:Number.MAX_VALUE,max:0});return this._getBoundsRectangular(h.min*s.exaggeration(),h.max*s.exaggeration())}getBounds(){return this.projection.name==="mercator"||this.projection.name==="equirectangular"?this._terrainEnabled()?this._getBoundsRectangularTerrain():this._getBoundsRectangular(0,0):this._getBoundsNonRectangular()}horizonLineFromTop(s=!0){const h=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))+this.centerOffset.y,g=this.height/2-h*(1-this._horizonShift);return s?Math.max(0,g):g}getMaxBounds(){return this.maxBounds}setMaxBounds(s){this.maxBounds=s,this.minLat=-l.MAX_MERCATOR_LATITUDE,this.maxLat=l.MAX_MERCATOR_LATITUDE,this.minLng=-180,this.maxLng=180,s&&(this.minLat=s.getSouth(),this.maxLat=s.getNorth(),this.minLng=s.getWest(),this.maxLng=s.getEast(),this.maxLngq&&(I=q-N),q-Bne&&(A=ne-D),ne-J.5?ue-1:ue,he>.5?he-1:he,0]),this.alignedProjMatrix=be,I=l.create(),l.scale(I,I,[this.width/2,-this.height/2,1]),l.translate(I,I,[1,-1,0]),this.labelPlaneMatrix=I,I=l.create(),l.scale(I,I,[1,-1,1]),l.translate(I,I,[-1,-1,0]),l.scale(I,I,[2/this.width,2/this.height,1]),this.glCoordMatrix=I,this.pixelMatrix=l.multiply(new Float64Array(16),this.labelPlaneMatrix,this.projMatrix),this._calcFogMatrices(),this._distanceTileDataCache={},I=l.invert(new Float64Array(16),this.pixelMatrix),!I)throw new Error("failed to invert matrix");if(this.pixelMatrixInverse=I,this.projection.name==="globe"||this.mercatorFromTransition){this.globeMatrix=l.calculateGlobeMatrix(this);const Se=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=l.transformMat4(Se,Se,b),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=I;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};const s=this.cameraWorldSizeForFog,h=this.cameraPixelsPerMeter,g=this._camera.position,v=1/this.height/this._pixelsPerMercatorPixel,b=[s,s,h];l.scale$2(b,b,v),l.scale$2(g,g,-1),l.multiply$2(g,g,b);const A=l.create();l.translate(A,A,g),l.scale(A,A,b),this.mercatorFogMatrix=A,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(s,h,v)}_computeCameraPosition(s){const h=(s=s||this.pixelsPerMeter)/this.pixelsPerMeter,g=this._camera.forward(),v=this.point,b=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*h-s/this.worldSize*this._centerAltitude;return[v.x/this.worldSize-g[0]*b,v.y/this.worldSize-g[1]*b,s/this.worldSize*this._centerAltitude-g[2]*b]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(s){const h=this._maxCameraBoundsDistance()*Math.cos(this._pitch),g=this._camera.position[2],v=s[2];let b=1;this.projection.wrap&&(this.center=this.center.wrap()),v>0&&(b=Math.min((h-g)/v,1)),this._camera.position=l.scaleAndAdd([],this._camera.position,s,b),this._updateStateFromCamera()}_updateStateFromCamera(){const s=this._camera.position,h=this._camera.forward(),{pitch:g,bearing:v}=this._camera.getPitchBearing(),b=l.mercatorZfromAltitude(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,A=this._mercatorZfromZoom(this._maxZoom)*Math.cos(l.degToRad(this._maxPitch)),I=Math.max((s[2]-b)/Math.cos(g),A),D=this._zoomFromMercatorZ(I);l.scaleAndAdd(s,s,h,I),this._pitch=l.clamp(g,l.degToRad(this.minPitch),l.degToRad(this.maxPitch)),this.angle=l.wrap(v,-Math.PI,Math.PI),this._setZoom(l.clamp(D,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new l.MercatorCoordinate(s[0],s[1],s[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(s){return Math.pow(2,s)*this.tileSize}_mercatorZfromZoom(s){return this.cameraToCenterDistance/this._worldSizeFromZoom(s)}_minimumHeightOverTerrain(){const s=Math.min((this._seaLevelZoom!=null?this._seaLevelZoom:this._zoom)+4,this._maxZoom);return this._mercatorZfromZoom(s)}_zoomFromMercatorZ(s){return this.scaleZoom(this.cameraToCenterDistance/(s*this.tileSize))}zoomFromMercatorZAdjusted(s){let h=0,g=l.GLOBE_ZOOM_THRESHOLD_MAX,v=0,b=1/0;for(;g-h>1e-6&&g>h;){const A=h+.5*(g-h),I=this.tileSize*Math.pow(2,A),D=this.getCameraToCenterDistance(this.projection,A,I),N=this.scaleZoom(D/(s*this.tileSize)),B=Math.abs(A-N);BN||J.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+l.radToDeg(this.fovAboveCenter)>88||this.anyCornerOffEdge(new l.Point(0,0),new l.Point(this.width,this.height))}zoomDeltaToMovement(s,h){const g=l.length(l.sub([],this._camera.position,s)),v=this._zoomFromMercatorZ(g)+h;return g-this._mercatorZfromZoom(v)}getCameraPoint(){if(this.projection.name==="globe"){const s=function([h,g,v],b){const A=[h,g,v,1];l.transformMat4$1(A,A,b);const I=A[3]=Math.max(A[3],1e-6);return A[0]/=I,A[1]/=I,A[2]/=I,A}([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new l.Point(s[0],s[1])}{const s=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new l.Point(0,s))}}getCameraToCenterDistance(s,h=this.zoom,g=this.worldSize){const v=lh(s,h,this.width,this.height,1024),b=s.pixelSpaceConversion(this.center.lat,g,v);return .5/Math.tan(.5*this._fov)*this.height*b}getWorldToCameraMatrix(){const s=this._camera.getWorldToCamera(this.worldSize,this.projection.zAxisUnit==="meters"?this.pixelsPerMeter:1);return this.projection.name==="globe"&&l.multiply(s,s,this.globeMatrix),s}}function kl(f,s){let h=!1,g=null;const v=()=>{g=null,h&&(f(),g=setTimeout(v,s),h=!1)};return()=>(h=!0,g||v(),g)}class Ap{constructor(s){this._hashName=s&&encodeURIComponent(s),l.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=kl(this._updateHashUnthrottled.bind(this),300)}addTo(s){return this._map=s,l.window.addEventListener("hashchange",this._onHashChange,!1),s.on("moveend",this._updateHash),this}remove(){return this._map?(this._map.off("moveend",this._updateHash),l.window.removeEventListener("hashchange",this._onHashChange,!1),clearTimeout(this._updateHash()),this._map=void 0,this):this}getHashString(){const s=this._map;if(!s)return"";const h=Hc(s);if(this._hashName){const g=this._hashName;let v=!1;const b=l.window.location.hash.slice(1).split("&").map(A=>{const I=A.split("=")[0];return I===g?(v=!0,`${I}=${h}`):A}).filter(A=>A);return v||b.push(`${g}=${h}`),`#${b.join("&")}`}return`#${h}`}_getCurrentHash(){const s=l.window.location.hash.replace("#","");if(this._hashName){let h;return s.split("&").map(g=>g.split("=")).forEach(g=>{g[0]===this._hashName&&(h=g)}),(h&&h[1]||"").split("/")}return s.split("/")}_onHashChange(){const s=this._map;if(!s)return!1;const h=this._getCurrentHash();if(h.length>=3&&!h.some(g=>isNaN(g))){const g=s.dragRotate.isEnabled()&&s.touchZoomRotate.isEnabled()?+(h[3]||0):s.getBearing();return s.jumpTo({center:[+h[2],+h[1]],zoom:+h[0],bearing:g,pitch:+(h[4]||0)}),!0}return!1}_updateHashUnthrottled(){const s=l.window.location.href.replace(/(#.+)?$/,this.getHashString());l.window.history.replaceState(l.window.history.state,null,s)}}function Hc(f,s){const h=f.getCenter(),g=Math.round(100*f.getZoom())/100,v=Math.ceil((g*Math.LN2+Math.log(512/360/.5))/Math.LN10),b=Math.pow(10,v),A=Math.round(h.lng*b)/b,I=Math.round(h.lat*b)/b,D=f.getBearing(),N=f.getPitch();let B=s?`/${A}/${I}/${g}`:`${g}/${I}/${A}`;return(D||N)&&(B+="/"+Math.round(10*D)/10),N&&(B+=`/${Math.round(N)}`),B}const qc={linearity:.3,easing:l.bezier(0,0,.3,1)},uh=l.extend({deceleration:2500,maxSpeed:1400},qc),hh=l.extend({deceleration:20,maxSpeed:1400},qc),Et=l.extend({deceleration:1e3,maxSpeed:360},qc),Io=l.extend({deceleration:1e3,maxSpeed:90},qc);class A0{constructor(s){this._map=s,this.clear()}clear(){this._inertiaBuffer=[]}record(s){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:l.exported.now(),settings:s})}_drainInertiaBuffer(){const s=this._inertiaBuffer,h=l.exported.now();for(;s.length>0&&h-s[0].time>160;)s.shift()}_onMoveEnd(s){if(this._map._prefersReducedMotion()||(this._drainInertiaBuffer(),this._inertiaBuffer.length<2))return;const h={zoom:0,bearing:0,pitch:0,pan:new l.Point(0,0),pinchAround:void 0,around:void 0};for(const{settings:b}of this._inertiaBuffer)h.zoom+=b.zoomDelta||0,h.bearing+=b.bearingDelta||0,h.pitch+=b.pitchDelta||0,b.panDelta&&h.pan._add(b.panDelta),b.around&&(h.around=b.around),b.pinchAround&&(h.pinchAround=b.pinchAround);const g=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,v={};if(h.pan.mag()){const b=Kc(h.pan.mag(),g,l.extend({},uh,s||{}));v.offset=h.pan.mult(b.amount/h.pan.mag()),v.center=this._map.transform.center,Zc(v,b)}if(h.zoom){const b=Kc(h.zoom,g,hh);v.zoom=this._map.transform.zoom+b.amount,Zc(v,b)}if(h.bearing){const b=Kc(h.bearing,g,Et);v.bearing=this._map.transform.bearing+l.clamp(b.amount,-179,179),Zc(v,b)}if(h.pitch){const b=Kc(h.pitch,g,Io);v.pitch=this._map.transform.pitch+b.amount,Zc(v,b)}if(v.zoom||v.bearing){const b=h.pinchAround===void 0?h.around:h.pinchAround;v.around=b?this._map.unproject(b):this._map.getCenter()}return this.clear(),v.noMoveStart=!0,v}}function Zc(f,s){(!f.duration||f.durationh.unproject(D)),I=b.reduce((D,N,B,q)=>D.add(N.div(q.length)),new l.Point(0,0));super(s,{points:b,point:I,lngLats:A,lngLat:h.unproject(I),originalEvent:g}),this._defaultPrevented=!1}}class dh extends l.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(s,h,g){super(s,{originalEvent:g}),this._defaultPrevented=!1}}class Ip{constructor(s,h){this._map=s,this._clickTolerance=h.clickTolerance}reset(){this._mousedownPos=void 0}wheel(s){return this._firePreventable(new dh(s.type,this._map,s))}mousedown(s,h){return this._mousedownPos=h,this._firePreventable(new Wn(s.type,this._map,s))}mouseup(s){this._map.fire(new Wn(s.type,this._map,s))}preclick(s){const h=l.extend({},s);h.type="preclick",this._map.fire(new Wn(h.type,this._map,h))}click(s,h){this._mousedownPos&&this._mousedownPos.dist(h)>=this._clickTolerance||(this.preclick(s),this._map.fire(new Wn(s.type,this._map,s)))}dblclick(s){return this._firePreventable(new Wn(s.type,this._map,s))}mouseover(s){this._map.fire(new Wn(s.type,this._map,s))}mouseout(s){this._map.fire(new Wn(s.type,this._map,s))}touchstart(s){return this._firePreventable(new Xc(s.type,this._map,s))}touchmove(s){this._map.fire(new Xc(s.type,this._map,s))}touchend(s){this._map.fire(new Xc(s.type,this._map,s))}touchcancel(s){this._map.fire(new Xc(s.type,this._map,s))}_firePreventable(s){if(this._map.fire(s),s.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class ph{constructor(s){this._map=s}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(s){this._map.fire(new Wn(s.type,this._map,s))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Wn("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(s){this._delayContextMenu?this._contextMenuEvent=s:this._map.fire(new Wn(s.type,this._map,s)),this._map.listens("contextmenu")&&s.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class I0{constructor(s,h){this._map=s,this._el=s.getCanvasContainer(),this._container=s.getContainer(),this._clickTolerance=h.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(s,h){this.isEnabled()&&s.shiftKey&&s.button===0&&(V(),this._startPos=this._lastPos=h,this._active=!0)}mousemoveWindow(s,h){if(!this._active)return;const g=h,v=this._startPos,b=this._lastPos;if(!v||!b||b.equals(g)||!this._box&&g.dist(v){this._box&&(this._box.style.transform=`translate(${A}px,${D}px)`,this._box.style.width=I-A+"px",this._box.style.height=N-D+"px")})}mouseupWindow(s,h){if(!this._active)return;const g=this._startPos,v=h;if(g&&s.button===0){if(this.reset(),H(),g.x!==v.x||g.y!==v.y)return this._map.fire(new l.Event("boxzoomend",{originalEvent:s})),{cameraAnimation:b=>b.fitScreenCoordinates(g,v,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",s)}}keydown(s){this._active&&s.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",s))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),R(),delete this._startPos,delete this._lastPos}_fireEvent(s,h){return this._map.fire(new l.Event(s,{originalEvent:h}))}}function fh(f,s){const h={};for(let g=0;gthis.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===0&&(this.startTime=s.timeStamp),g.length===this.numTouches&&(this.centroid=function(v){const b=new l.Point(0,0);for(const A of v)b._add(A);return b.div(v.length)}(h),this.touches=fh(g,h)))}touchmove(s,h,g){if(this.aborted||!this.centroid)return;const v=fh(g,h);for(const b in this.touches){const A=v[b];(!A||A.dist(this.touches[b])>30)&&(this.aborted=!0)}}touchend(s,h,g){if((!this.centroid||s.timeStamp-this.startTime>500)&&(this.aborted=!0),g.length===0){const v=!this.aborted&&this.centroid;if(this.reset(),v)return v}}}class Cp{constructor(s){this.singleTap=new Pl(s),this.numTaps=s.numTaps,this.reset()}reset(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}touchstart(s,h,g){this.singleTap.touchstart(s,h,g)}touchmove(s,h,g){this.singleTap.touchmove(s,h,g)}touchend(s,h,g){const v=this.singleTap.touchend(s,h,g);if(v){const b=s.timeStamp-this.lastTime<500,A=!this.lastTap||this.lastTap.dist(v)<30;if(b&&A||this.reset(),this.count++,this.lastTime=s.timeStamp,this.lastTap=v,this.count===this.numTaps)return this.reset(),v}}}class lx{constructor(){this._zoomIn=new Cp({numTouches:1,numTaps:2}),this._zoomOut=new Cp({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(s,h,g){this._zoomIn.touchstart(s,h,g),this._zoomOut.touchstart(s,h,g)}touchmove(s,h,g){this._zoomIn.touchmove(s,h,g),this._zoomOut.touchmove(s,h,g)}touchend(s,h,g){const v=this._zoomIn.touchend(s,h,g),b=this._zoomOut.touchend(s,h,g);return v?(this._active=!0,s.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:A=>A.easeTo({duration:300,zoom:A.getZoom()+1,around:A.unproject(v)},{originalEvent:s})}):b?(this._active=!0,s.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:A=>A.easeTo({duration:300,zoom:A.getZoom()-1,around:A.unproject(b)},{originalEvent:s})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const C0={0:1,2:2};class Dl{constructor(s){this.reset(),this._clickTolerance=s.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,this._lastPoint=void 0,this._eventButton=void 0}_correctButton(s,h){return!1}_move(s,h){return{}}mousedown(s,h){if(this._lastPoint)return;const g=se(s);this._correctButton(s,g)&&(this._lastPoint=h,this._eventButton=g)}mousemoveWindow(s,h){const g=this._lastPoint;if(g){if(s.preventDefault(),this._eventButton!=null&&function(v,b){const A=C0[b];return v.buttons===void 0||(v.buttons&A)!==A}(s,this._eventButton))this.reset();else if(this._moved||!(h.dist(g)0&&(this._active=!0);const v=fh(g,h),b=new l.Point(0,0),A=new l.Point(0,0);let I=0;for(const N in v){const B=v[N],q=this._touches[N];q&&(b._add(B),A._add(B.sub(q)),I++,v[N]=B)}if(this._touches=v,I{this._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show"),this._alertContainer.setAttribute("role","null")},500)}}class Yc{constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(s){}_move(s,h,g){return{}}touchstart(s,h,g){this._firstTwoTouches||g.length<2||(this._firstTwoTouches=[g[0].identifier,g[1].identifier],this._start([h[0],h[1]]))}touchmove(s,h,g){const v=this._firstTwoTouches;if(!v)return;s.preventDefault();const[b,A]=v,I=Qc(g,h,b),D=Qc(g,h,A);if(!I||!D)return;const N=this._aroundCenter?null:I.add(D).div(2);return this._move([I,D],N,s)}touchend(s,h,g){if(!this._firstTwoTouches)return;const[v,b]=this._firstTwoTouches,A=Qc(g,h,v),I=Qc(g,h,b);A&&I||(this._active&&H(),this.reset())}touchcancel(){this.reset()}enable(s){this._enabled=!0,this._aroundCenter=!!s&&s.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function Qc(f,s,h){for(let g=0;gMath.abs(f.x)}class D0 extends Yc{constructor(s){super(),this._map=s}reset(){super.reset(),this._valid=void 0,this._firstMove=void 0,this._lastPoints=void 0}_start(s){this._lastPoints=s,ts(s[0].sub(s[1]))&&(this._valid=!1)}_move(s,h,g){const v=this._lastPoints;if(!v)return;const b=s[0].sub(v[0]),A=s[1].sub(v[1]);return this._map._cooperativeGestures&&!l.isFullscreen()&&g.touches.length<3||(this._valid=this.gestureBeginsVertically(b,A,g.timeStamp),!this._valid)?void 0:(this._lastPoints=s,this._active=!0,{pitchDelta:(b.y+A.y)/2*-.5})}gestureBeginsVertically(s,h,g){if(this._valid!==void 0)return this._valid;const v=s.mag()>=2,b=h.mag()>=2;if(!v&&!b)return;if(!v||!b)return this._firstMove==null&&(this._firstMove=g),g-this._firstMove<100&&void 0;const A=s.y>0==h.y>0;return ts(s)&&ts(h)&&A}}const M0={panStep:100,bearingStep:15,pitchStep:10};class cx{constructor(){const s=M0;this._panStep=s.panStep,this._bearingStep=s.bearingStep,this._pitchStep=s.pitchStep,this._rotationDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(s){if(s.altKey||s.ctrlKey||s.metaKey)return;let h=0,g=0,v=0,b=0,A=0;switch(s.keyCode){case 61:case 107:case 171:case 187:h=1;break;case 189:case 109:case 173:h=-1;break;case 37:s.shiftKey?g=-1:(s.preventDefault(),b=-1);break;case 39:s.shiftKey?g=1:(s.preventDefault(),b=1);break;case 38:s.shiftKey?v=1:(s.preventDefault(),A=-1);break;case 40:s.shiftKey?v=-1:(s.preventDefault(),A=1);break;default:return}return this._rotationDisabled&&(g=0,v=0),{cameraAnimation:I=>{const D=I.getZoom();I.easeTo({duration:300,easeId:"keyboardHandler",easing:z0,zoom:h?Math.round(D)+h*(s.shiftKey?2:1):D,bearing:I.getBearing()+g*this._bearingStep,pitch:I.getPitch()+v*this._pitchStep,offset:[-b*this._panStep,-A*this._panStep],center:I.getCenter()},{originalEvent:s})}}}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 z0(f){return f*(2-f)}const Rp=4.000244140625;class R0{constructor(s,h){this._map=s,this._el=s.getCanvasContainer(),this._handler=h,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,l.bindAll(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert"],this)}setZoomRate(s){this._defaultZoomRate=s}setWheelZoomRate(s){this._wheelZoomRate=s}isEnabled(){return!!this._enabled}isActive(){return this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(s){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!s&&s.around==="center",this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(s){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(s.ctrlKey||s.metaKey||this.isZooming()||l.isFullscreen()))return void this._showBlockerAlert();this._alertContainer.style.visibility!=="hidden"&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let h=s.deltaMode===l.window.WheelEvent.DOM_DELTA_LINE?40*s.deltaY:s.deltaY;const g=l.exported.now(),v=g-(this._lastWheelEventTime||0);this._lastWheelEventTime=g,h!==0&&h%Rp==0?this._type="wheel":h!==0&&Math.abs(h)<4?this._type="trackpad":v>400?(this._type=null,this._lastValue=h,this._timeout=setTimeout(this._onTimeout,40,s)):this._type||(this._type=Math.abs(v*h)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,h+=this._lastValue)),s.shiftKey&&h&&(h/=4),this._type&&(this._lastWheelEvent=s,this._delta-=h,this._active||this._start(s)),s.preventDefault()}_onTimeout(s){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(s)}_start(s){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 h=Q(this._el,s);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:h,this._aroundCoord=this._map.transform.pointCoordinate3D(this._aroundPoint),this._targetZoom=void 0,this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const s=this._map.transform;this._type==="wheel"&&s.projection.wrap&&(s._center.lng>=180||s._center.lng<=-180)&&(this._prevEase=null,this._easing=null,this._lastWheelEvent=null,this._lastWheelEventTime=0);const h=()=>s._terrainEnabled()&&this._aroundCoord?s.computeZoomRelativeTo(this._aroundCoord):s.zoom;if(this._delta!==0){const D=this._type==="wheel"&&Math.abs(this._delta)>Rp?this._wheelZoomRate:this._defaultZoomRate;let N=2/(1+Math.exp(-Math.abs(this._delta*D)));this._delta<0&&N!==0&&(N=1/N);const B=h(),q=Math.pow(2,B),J=typeof this._targetZoom=="number"?s.zoomScale(this._targetZoom):q;this._targetZoom=Math.min(s.maxZoom,Math.max(s.minZoom,s.scaleZoom(J*N))),this._type==="wheel"&&(this._startZoom=B,this._easing=this._smoothOutEasing(200)),this._delta=0}const g=typeof this._targetZoom=="number"?this._targetZoom:h(),v=this._startZoom,b=this._easing;let A,I=!1;if(this._type==="wheel"&&v&&b){const D=Math.min((l.exported.now()-this._lastWheelEventTime)/200,1),N=b(D);A=l.number(v,g,N),D<1?this._frameId||(this._frameId=!0):I=!0}else A=g,I=!0;return this._active=!0,I&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!I,zoomDelta:A-h(),around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(s){let h=l.ease;if(this._prevEase){const g=this._prevEase,v=(l.exported.now()-g.start)/g.duration,b=g.easing(v+.01)-g.easing(v),A=.27/Math.sqrt(b*b+1e-4)*.01,I=Math.sqrt(.0729-A*A);h=l.bezier(A,I,.25,1)}return this._prevEase={start:l.exported.now(),duration:s,easing:h},h}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=z("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=/(Mac|iPad)/i.test(l.window.navigator.userAgent)?this._map._getUIString("ScrollZoomBlocker.CmdMessage"):this._map._getUIString("ScrollZoomBlocker.CtrlMessage"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=setTimeout(()=>{this._alertContainer.classList.remove("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.setAttribute("role","null")},200)}}class O0{constructor(s,h){this._clickZoom=s,this._tapZoom=h}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 ci{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(s,h){return s.preventDefault(),{cameraAnimation:g=>{g.easeTo({duration:300,zoom:g.getZoom()+(s.shiftKey?-1:1),around:g.unproject(h)},{originalEvent:s})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ux{constructor(){this._tap=new Cp({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,this._swipePoint=void 0,this._swipeTouch=0,this._tapTime=0,this._tap.reset()}touchstart(s,h,g){this._swipePoint||(this._tapTime&&s.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?g.length>0&&(this._swipePoint=h[0],this._swipeTouch=g[0].identifier):this._tap.touchstart(s,h,g))}touchmove(s,h,g){if(this._tapTime){if(this._swipePoint){if(g[0].identifier!==this._swipeTouch)return;const v=h[0],b=v.y-this._swipePoint.y;return this._swipePoint=v,s.preventDefault(),this._active=!0,{zoomDelta:b/128}}}else this._tap.touchmove(s,h,g)}touchend(s,h,g){this._tapTime?this._swipePoint&&g.length===0&&this.reset():this._tap.touchend(s,h,g)&&(this._tapTime=s.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class F0{constructor(s,h,g){this._el=s,this._mousePan=h,this._touchPan=g}enable(s){this._inertiaOptions=s||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class hx{constructor(s,h,g){this._pitchWithRotate=s.pitchWithRotate,this._mouseRotate=h,this._mousePitch=g}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 dx{constructor(s,h,g,v){this._el=s,this._touchZoom=h,this._touchRotate=g,this._tapDragZoom=v,this._rotationDisabled=!1,this._enabled=!0}enable(s){this._touchZoom.enable(s),this._rotationDisabled||this._touchRotate.enable(s),this._tapDragZoom.enable(),this._el.classList.add("mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const oo=f=>f.zoom||f.drag||f.pitch||f.rotate;class L0 extends l.Event{}class px{constructor(){this.constants=[1,1,.01],this.radius=0}setup(s,h){const g=l.sub([],h,s);this.radius=l.length(g[2]<0?l.div([],g,this.constants):[g[0],g[1],0])}projectRay(s){l.div(s,s,this.constants),l.normalize(s,s),l.mul$1(s,s,this.constants);const h=l.scale$2([],s,this.radius);if(h[2]>0){const g=l.scale$2([],[0,0,1],l.dot(h,[0,0,1])),v=l.scale$2([],l.normalize([],[h[0],h[1],0]),this.radius),b=l.add([],h,l.scale$2([],l.sub([],l.add([],v,g),h),2));h[0]=b[0],h[1]=b[1]}return h}}function Co(f){return f.panDelta&&f.panDelta.mag()||f.zoomDelta||f.bearingDelta||f.pitchDelta}class Qo{constructor(s,h){this._map=s,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new A0(s),this._bearingSnap=h.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new px,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(h),l.bindAll(["handleEvent","handleWindowEvent"],this);const g=this._el;this._listeners=[[g,"touchstart",{passive:!0}],[g,"touchmove",{passive:!1}],[g,"touchend",void 0],[g,"touchcancel",void 0],[g,"mousedown",void 0],[g,"mousemove",void 0],[g,"mouseup",void 0],[l.window.document,"mousemove",{capture:!0}],[l.window.document,"mouseup",void 0],[g,"mouseover",void 0],[g,"mouseout",void 0],[g,"dblclick",void 0],[g,"click",void 0],[g,"keydown",{capture:!1}],[g,"keyup",void 0],[g,"wheel",{passive:!1}],[g,"contextmenu",void 0],[l.window,"blur",void 0]];for(const[v,b,A]of this._listeners)v.addEventListener(b,v===l.window.document?this.handleWindowEvent:this.handleEvent,A)}destroy(){for(const[s,h,g]of this._listeners)s.removeEventListener(h,s===l.window.document?this.handleWindowEvent:this.handleEvent,g)}_addDefaultHandlers(s){const h=this._map,g=h.getCanvasContainer();this._add("mapEvent",new Ip(h,s));const v=h.boxZoom=new I0(h,s);this._add("boxZoom",v);const b=new lx,A=new ci;h.doubleClickZoom=new O0(A,b),this._add("tapZoom",b),this._add("clickZoom",A);const I=new ux;this._add("tapDragZoom",I);const D=h.touchPitch=new D0(h);this._add("touchPitch",D);const N=new Pp(s),B=new Dp(s);h.dragRotate=new hx(s,N,B),this._add("mouseRotate",N,["mousePitch"]),this._add("mousePitch",B,["mouseRotate"]);const q=new kp(s),J=new mh(h,s);h.dragPan=new F0(g,q,J),this._add("mousePan",q),this._add("touchPan",J,["touchZoom","touchRotate"]);const ne=new P0,oe=new k0;h.touchZoomRotate=new dx(g,oe,ne,I),this._add("touchRotate",ne,["touchPan","touchZoom"]),this._add("touchZoom",oe,["touchPan","touchRotate"]),this._add("blockableMapEvent",new ph(h));const ie=h.scrollZoom=new R0(h,this);this._add("scrollZoom",ie,["mousePan"]);const ae=h.keyboard=new cx;this._add("keyboard",ae);for(const Z of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])s.interactive&&s[Z]&&h[Z].enable(s[Z])}_add(s,h,g){this._handlers.push({handlerName:s,handler:h,allowed:g}),this._handlersById[s]=h}stop(s){if(!this._updatingCamera){for(const{handler:h}of this._handlers)h.reset();this._inertia.clear(),this._fireEvents({},{},s),this._changes=[]}}isActive(){for(const{handler:s}of this._handlers)if(s.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!oo(this._eventsInProgress)||this.isZooming()}_isDragging(){return!!this._eventsInProgress.drag}_blockedByActive(s,h,g){for(const v in s)if(v!==g&&(!h||h.indexOf(v)<0))return!0;return!1}handleWindowEvent(s){this.handleEvent(s,`${s.type}Window`)}_getMapTouches(s){const h=[];for(const g of s)this._el.contains(g.target)&&h.push(g);return h}handleEvent(s,h){this._updatingCamera=!0;const g=s.type==="renderFrame",v=g?void 0:s,b={needsRenderFrame:!1},A={},I={},D=s.touches?this._getMapTouches(s.touches):void 0,N=D?te(this._el,D):g?void 0:Q(this._el,s);for(const{handlerName:J,handler:ne,allowed:oe}of this._handlers){if(!ne.isEnabled())continue;let ie;this._blockedByActive(I,oe,J)?ne.reset():ne[h||s.type]&&(ie=ne[h||s.type](s,N,D),this.mergeHandlerResult(b,A,ie,J,v),ie&&ie.needsRenderFrame&&this._triggerRenderFrame()),(ie||ne.isActive())&&(I[J]=ne)}const B={};for(const J in this._previousActiveHandlers)I[J]||(B[J]=v);this._previousActiveHandlers=I,(Object.keys(B).length||Co(b))&&(this._changes.push([b,A,B]),this._triggerRenderFrame()),(Object.keys(I).length||Co(b))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:q}=b;q&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],q(this._map))}mergeHandlerResult(s,h,g,v,b){if(!g)return;l.extend(s,g);const A={handlerName:v,originalEvent:g.originalEvent||b};g.zoomDelta!==void 0&&(h.zoom=A),g.panDelta!==void 0&&(h.drag=A),g.pitchDelta!==void 0&&(h.pitch=A),g.bearingDelta!==void 0&&(h.rotate=A)}_applyChanges(){const s={},h={},g={};for(const[v,b,A]of this._changes)v.panDelta&&(s.panDelta=(s.panDelta||new l.Point(0,0))._add(v.panDelta)),v.zoomDelta&&(s.zoomDelta=(s.zoomDelta||0)+v.zoomDelta),v.bearingDelta&&(s.bearingDelta=(s.bearingDelta||0)+v.bearingDelta),v.pitchDelta&&(s.pitchDelta=(s.pitchDelta||0)+v.pitchDelta),v.around!==void 0&&(s.around=v.around),v.aroundCoord!==void 0&&(s.aroundCoord=v.aroundCoord),v.pinchAround!==void 0&&(s.pinchAround=v.pinchAround),v.noInertia&&(s.noInertia=v.noInertia),l.extend(h,b),l.extend(g,A);this._updateMapTransform(s,h,g),this._changes=[]}_updateMapTransform(s,h,g){const v=this._map,b=v.transform,A=re=>[re.x,re.y,re.z];if((re=>{const ue=this._eventsInProgress.drag;return ue&&!this._handlersById[ue.handlerName].isActive()})()&&!Co(s)){const re=b.zoom;b.cameraElevationReference="sea",b.recenterOnTerrain(),b.cameraElevationReference="ground",re!==b.zoom&&this._map._update(!0)}if(b._isCameraConstrained&&v._stop(!0),!Co(s))return void this._fireEvents(h,g,!0);let{panDelta:I,zoomDelta:D,bearingDelta:N,pitchDelta:B,around:q,aroundCoord:J,pinchAround:ne}=s;b._isCameraConstrained&&(D>0&&(D=0),b._isCameraConstrained=!1),ne!==void 0&&(q=ne),(D||(re=>h[re]&&!this._eventsInProgress[re])("drag"))&&q&&(this._dragOrigin=A(b.pointCoordinate3D(q)),this._trackingEllipsoid.setup(b._camera.position,this._dragOrigin)),b.cameraElevationReference="sea",v._stop(!0),q=q||v.transform.centerPoint,N&&(b.bearing+=N),B&&(b.pitch+=B),b._updateCameraState();const oe=[0,0,0];if(I)if(b.projection.name==="mercator"){const re=this._trackingEllipsoid.projectRay(b.screenPointToMercatorRay(q).dir),ue=this._trackingEllipsoid.projectRay(b.screenPointToMercatorRay(q.sub(I)).dir);oe[0]=ue[0]-re[0],oe[1]=ue[1]-re[1]}else{const re=b.pointCoordinate(q);if(b.projection.name==="globe"){I=I.rotate(-b.angle);const ue=b._pixelsPerMercatorPixel/b.worldSize;oe[0]=-I.x*l.mercatorScale(l.latFromMercatorY(re.y))*ue,oe[1]=-I.y*l.mercatorScale(b.center.lat)*ue}else{const ue=b.pointCoordinate(q.sub(I));re&&ue&&(oe[0]=ue.x-re.x,oe[1]=ue.y-re.y)}}const ie=b.zoom,ae=[0,0,0];if(D){const re=A(J||b.pointCoordinate3D(q)),ue={dir:l.normalize([],l.sub([],re,b._camera.position))};if(ue.dir[2]<0){const he=b.zoomDeltaToMovement(re,D);l.scale$2(ae,ue.dir,he)}}const Z=l.add(oe,oe,ae);b._translateCameraConstrained(Z),D&&Math.abs(b.zoom-ie)>1e-4&&b.recenterOnTerrain(),b.cameraElevationReference="ground",this._map._update(),s.noInertia||this._inertia.record(s),this._fireEvents(h,g,!0)}_fireEvents(s,h,g){const v=oo(this._eventsInProgress),b=oo(s),A={};for(const B in s){const{originalEvent:q}=s[B];this._eventsInProgress[B]||(A[`${B}start`]=q),this._eventsInProgress[B]=s[B]}!v&&b&&this._fireEvent("movestart",b.originalEvent);for(const B in A)this._fireEvent(B,A[B]);b&&this._fireEvent("move",b.originalEvent);for(const B in s){const{originalEvent:q}=s[B];this._fireEvent(B,q)}const I={};let D;for(const B in this._eventsInProgress){const{handlerName:q,originalEvent:J}=this._eventsInProgress[B];this._handlersById[q].isActive()||(delete this._eventsInProgress[B],D=h[q]||J,I[`${B}end`]=D)}for(const B in I)this._fireEvent(B,I[B]);const N=oo(this._eventsInProgress);if(g&&(v||b)&&!N){this._updatingCamera=!0;const B=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),q=J=>J!==0&&-this._bearingSnap{this._frameId=void 0,this.handleEvent(new L0("renderFrame",{timeStamp:s})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const Ns="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class gh extends l.Evented{constructor(s,h){super(),this._moving=!1,this._zooming=!1,this.transform=s,this._bearingSnap=h.bearingSnap,this._respectPrefersReducedMotion=h.respectPrefersReducedMotion!==!1,l.bindAll(["_renderFrameCallback"],this)}getCenter(){return new l.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(s,h){return this.jumpTo({center:s},h)}panBy(s,h,g){return s=l.Point.convert(s).mult(-1),this.panTo(this.transform.center,l.extend({offset:s},h),g)}panTo(s,h,g){return this.easeTo(l.extend({center:s},h),g)}getZoom(){return this.transform.zoom}setZoom(s,h){return this.jumpTo({zoom:s},h),this}zoomTo(s,h,g){return this.easeTo(l.extend({zoom:s},h),g)}zoomIn(s,h){return this.zoomTo(this.getZoom()+1,s,h),this}zoomOut(s,h){return this.zoomTo(this.getZoom()-1,s,h),this}getBearing(){return this.transform.bearing}setBearing(s,h){return this.jumpTo({bearing:s},h),this}getPadding(){return this.transform.padding}setPadding(s,h){return this.jumpTo({padding:s},h),this}rotateTo(s,h,g){return this.easeTo(l.extend({bearing:s},h),g)}resetNorth(s,h){return this.rotateTo(0,l.extend({duration:1e3},s),h),this}resetNorthPitch(s,h){return this.easeTo(l.extend({bearing:0,pitch:0,duration:1e3},s),h),this}snapToNorth(s,h){return Math.abs(this.getBearing())s.aspect?g/(2*Math.tan(.5*s.fovX)*s.aspect):v/(2*Math.tan(.5*s.fovY)*s.aspect)}_cameraForBoundsOnGlobe(s,h,g,v,b,A){const I=s.clone(),D=this._extendCameraOptions(A);I.bearing=v,I.pitch=b;const N=l.LngLat.convert(h),B=l.LngLat.convert(g),q=.5*(N.lat+B.lat),J=.5*(N.lng+B.lng),ne=l.latLngToECEF(q,J),oe=l.normalize([],ne),ie=l.normalize([],l.cross([],oe,[0,1,0])),ae=l.cross([],ie,oe),Z=[ie[0],ie[1],ie[2],0,ae[0],ae[1],ae[2],0,oe[0],oe[1],oe[2],0,0,0,0,1],re=[ne,l.latLngToECEF(N.lat,N.lng),l.latLngToECEF(B.lat,N.lng),l.latLngToECEF(B.lat,B.lng),l.latLngToECEF(N.lat,B.lng),l.latLngToECEF(q,N.lng),l.latLngToECEF(q,B.lng),l.latLngToECEF(N.lat,J),l.latLngToECEF(B.lat,J)];let ue=l.Aabb.fromPoints(re.map(tt=>[l.dot(ie,tt),l.dot(ae,tt),l.dot(oe,tt)]));const he=l.transformMat4([],ue.center,Z);l.squaredLength(he)===0&&l.set(he,0,0,1),l.normalize(he,he),l.scale$2(he,he,l.GLOBE_RADIUS),I.center=l.ecefToLatLng(he);const be=I.getWorldToCameraMatrix(),Se=l.invert(new Float64Array(16),be);ue=l.Aabb.applyTransform(ue,l.multiply([],be,Z)),l.transformMat4(he,he,be);const we=.5*(ue.max[2]-ue.min[2]),Ce=this._minimumAABBFrustumDistance(I,ue),Ie=l.scale$2([],[0,0,1],we),Re=l.add(Ie,he,Ie),st=Ce+(I.pitch===0?0:l.distance(he,Re)),De=I.globeCenterInViewSpace,Ke=l.sub([],he,[De[0],De[1],De[2]]);l.normalize(Ke,Ke),l.scale$2(Ke,Ke,st);const Ne=l.add([],he,Ke);l.transformMat4(Ne,Ne,Se);const at=l.earthRadius/l.GLOBE_RADIUS,ze=l.length(Ne),Ze=l.mercatorZfromAltitude(Math.max(ze*at-l.earthRadius,Number.EPSILON),0),ut=Math.min(I.zoomFromMercatorZAdjusted(Ze),D.maxZoom);return ut>.5*(l.GLOBE_ZOOM_THRESHOLD_MIN+l.GLOBE_ZOOM_THRESHOLD_MAX)?(I.setProjection({name:"mercator"}),I.zoom=ut,this._cameraForBounds(I,h,g,v,b,A)):{center:I.center,zoom:ut,bearing:v,pitch:b}}queryTerrainElevation(s,h){const g=this.transform.elevation;return g?(h=l.extend({},{exaggerated:!0},h),g.getAtPoint(l.MercatorCoordinate.fromLngLat(s),null,h.exaggerated)):null}_cameraForBounds(s,h,g,v,b,A){if(s.projection.name==="globe")return this._cameraForBoundsOnGlobe(s,h,g,v,b,A);const I=s.clone(),D=this._extendCameraOptions(A),N=I.padding;I.bearing=v,I.pitch=b;const B=l.LngLat.convert(h),q=l.LngLat.convert(g),J=new l.LngLat(B.lng,q.lat),ne=new l.LngLat(q.lng,B.lat),oe=I.project(B),ie=I.project(q),ae=this.queryTerrainElevation(B),Z=this.queryTerrainElevation(q),re=this.queryTerrainElevation(J),ue=this.queryTerrainElevation(ne),he=[[oe.x,oe.y,Math.min(ae||0,Z||0,re||0,ue||0)],[ie.x,ie.y,Math.max(ae||0,Z||0,re||0,ue||0)]];let be=l.Aabb.fromPoints(he);const Se=I.getWorldToCameraMatrix(),we=l.invert(new Float64Array(16),Se);be=l.Aabb.applyTransform(be,Se);const Ce=l.sub([],be.max,be.min),Ie=N.left||0,Re=N.right||0,st=N.bottom||0,De=N.top||0,{left:Ke,right:Ne,top:at,bottom:ze}=D.padding,Ze=.5*(Ie+Re),ut=.5*(De+st),tt=Math.min(I.scaleZoom(I.scale*Math.min((I.width-(Ie+Re+Ke+Ne))/Ce[0],(I.height-(st+De+ze+at))/Ce[1])),D.maxZoom),ht=I.scale/I.zoomScale(tt);be=new l.Aabb([be.min[0]-(Ke+Ze)*ht,be.min[1]-(ze+ut)*ht,be.min[2]],[be.max[0]+(Ne+Ze)*ht,be.max[1]+(at+ut)*ht,be.max[2]]);const Mt=.5*Ce[2],$t=this._minimumAABBFrustumDistance(I,be),It=[0,0,1,0];l.transformMat4$1(It,It,Se),l.normalize$2(It,It);const Lt=l.scale$2([],It,$t+Mt),nr=l.add([],be.center,Lt),er=(typeof D.offset.x=="number"&&typeof D.offset.y=="number"?new l.Point(D.offset.x,D.offset.y):l.Point.convert(D.offset)).rotate(-l.degToRad(v));be.center[0]-=er.x*ht,be.center[1]+=er.y*ht,l.transformMat4(be.center,be.center,we),l.transformMat4(nr,nr,we);const Pt=[be.center[0],be.center[1],nr[2]*I.pixelsPerMeter];l.scale$2(Pt,Pt,1/I.worldSize);const Ar=l.lngFromMercatorX(Pt[0]),Mr=l.latFromMercatorY(Pt[1]),zr=Math.min(I._zoomFromMercatorZ(Pt[2]),D.maxZoom),Rr=new l.LngLat(Ar,Mr);return I.mercatorFromTransition&&zr<.5*(l.GLOBE_ZOOM_THRESHOLD_MIN+l.GLOBE_ZOOM_THRESHOLD_MAX)?(I.setProjection({name:"globe"}),I.zoom=zr,this._cameraForBounds(I,h,g,v,b,A)):{center:Rr,zoom:zr,bearing:v,pitch:b}}fitBounds(s,h,g){const v=this.cameraForBounds(s,h);return this._fitInternal(v,h,g)}fitScreenCoordinates(s,h,g,v,b){const A=l.Point.convert(s),I=l.Point.convert(h),D=new l.Point(Math.min(A.x,I.x),Math.min(A.y,I.y)),N=new l.Point(Math.max(A.x,I.x),Math.max(A.y,I.y));if(this.transform.projection.name==="mercator"&&this.transform.anyCornerOffEdge(A,I))return this;const B=this.transform.pointLocation3D(D),q=this.transform.pointLocation3D(N),J=this.transform.pointLocation3D(new l.Point(D.x,N.y)),ne=this.transform.pointLocation3D(new l.Point(N.x,D.y)),oe=[Math.min(B.lng,q.lng,J.lng,ne.lng),Math.min(B.lat,q.lat,J.lat,ne.lat)],ie=[Math.max(B.lng,q.lng,J.lng,ne.lng),Math.max(B.lat,q.lat,J.lat,ne.lat)],ae=v&&v.pitch?v.pitch:this.getPitch(),Z=this._cameraForBounds(this.transform,oe,ie,g,ae,v);return this._fitInternal(Z,v,b)}_fitInternal(s,h,g){return s?(delete(h=l.extend(s,h)).padding,h.linear?this.easeTo(h,g):this.flyTo(h,g)):this}jumpTo(s,h){this.stop();const g=s.preloadOnly?this.transform.clone():this.transform;let v=!1,b=!1,A=!1;return"zoom"in s&&g.zoom!==+s.zoom&&(v=!0,g.zoom=+s.zoom),s.center!==void 0&&(g.center=l.LngLat.convert(s.center)),"bearing"in s&&g.bearing!==+s.bearing&&(b=!0,g.bearing=+s.bearing),"pitch"in s&&g.pitch!==+s.pitch&&(A=!0,g.pitch=+s.pitch),s.padding==null||g.isPaddingEqual(s.padding)||(g.padding=s.padding),s.preloadOnly?(this._preloadTiles(g),this):(this.fire(new l.Event("movestart",h)).fire(new l.Event("move",h)),v&&this.fire(new l.Event("zoomstart",h)).fire(new l.Event("zoom",h)).fire(new l.Event("zoomend",h)),b&&this.fire(new l.Event("rotatestart",h)).fire(new l.Event("rotate",h)).fire(new l.Event("rotateend",h)),A&&this.fire(new l.Event("pitchstart",h)).fire(new l.Event("pitch",h)).fire(new l.Event("pitchend",h)),this.fire(new l.Event("moveend",h)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||l.warnOnce(Ns),this.transform.getFreeCameraOptions()}setFreeCameraOptions(s,h){const g=this.transform;if(!g.projection.supportsFreeCamera)return l.warnOnce(Ns),this;this.stop();const v=g.zoom,b=g.pitch,A=g.bearing;g.setFreeCameraOptions(s);const I=v!==g.zoom,D=b!==g.pitch,N=A!==g.bearing;return this.fire(new l.Event("movestart",h)).fire(new l.Event("move",h)),I&&this.fire(new l.Event("zoomstart",h)).fire(new l.Event("zoom",h)).fire(new l.Event("zoomend",h)),N&&this.fire(new l.Event("rotatestart",h)).fire(new l.Event("rotate",h)).fire(new l.Event("rotateend",h)),D&&this.fire(new l.Event("pitchstart",h)).fire(new l.Event("pitch",h)).fire(new l.Event("pitchend",h)),this.fire(new l.Event("moveend",h)),this}easeTo(s,h){this._stop(!1,s.easeId),((s=l.extend({offset:[0,0],duration:500,easing:l.ease},s)).animate===!1||this._prefersReducedMotion(s))&&(s.duration=0);const g=this.transform,v=this.getZoom(),b=this.getBearing(),A=this.getPitch(),I=this.getPadding(),D="zoom"in s?+s.zoom:v,N="bearing"in s?this._normalizeBearing(s.bearing,b):b,B="pitch"in s?+s.pitch:A,q="padding"in s?s.padding:g.padding,J=l.Point.convert(s.offset);let ne,oe,ie;if(g.projection.name==="globe"){const Ie=l.MercatorCoordinate.fromLngLat(g.center),Re=J.rotate(-g.angle);Ie.x+=Re.x/g.worldSize,Ie.y+=Re.y/g.worldSize;const st=Ie.toLngLat(),De=l.LngLat.convert(s.center||st);this._normalizeCenter(De),ne=g.centerPoint.add(Re),oe=new l.Point(Ie.x,Ie.y).mult(g.worldSize),ie=new l.Point(l.mercatorXfromLng(De.lng),l.mercatorYfromLat(De.lat)).mult(g.worldSize).sub(oe)}else{ne=g.centerPoint.add(J);const Ie=g.pointLocation(ne),Re=l.LngLat.convert(s.center||Ie);this._normalizeCenter(Re),oe=g.project(Ie),ie=g.project(Re).sub(oe)}const ae=g.zoomScale(D-v);let Z,re;s.around&&(Z=l.LngLat.convert(s.around),re=g.locationPoint(Z));const ue=this._zooming||D!==v,he=this._rotating||b!==N,be=this._pitching||B!==A,Se=!g.isPaddingEqual(q),we=Ie=>Re=>{if(ue&&(Ie.zoom=l.number(v,D,Re)),he&&(Ie.bearing=l.number(b,N,Re)),be&&(Ie.pitch=l.number(A,B,Re)),Se&&(Ie.interpolatePadding(I,q,Re),ne=Ie.centerPoint.add(J)),Z)Ie.setLocationAtPoint(Z,re);else{const st=Ie.zoomScale(Ie.zoom-v),De=D>v?Math.min(2,ae):Math.max(.5,ae),Ke=Math.pow(De,1-Re),Ne=Ie.unproject(oe.add(ie.mult(Re*Ke)).mult(st));Ie.setLocationAtPoint(Ie.renderWorldCopies?Ne.wrap():Ne,ne)}return s.preloadOnly||this._fireMoveEvents(h),Ie};if(s.preloadOnly){const Ie=this._emulate(we,s.duration,g);return this._preloadTiles(Ie),this}const Ce={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=ue,this._rotating=he,this._pitching=be,this._padding=Se,this._easeId=s.easeId,this._prepareEase(h,s.noMoveStart,Ce),this._ease(we(g),Ie=>{g.recenterOnTerrain(),this._afterEase(h,Ie)},s),this}_prepareEase(s,h,g={}){this._moving=!0,this.transform.cameraElevationReference="sea",h||g.moving||this.fire(new l.Event("movestart",s)),this._zooming&&!g.zooming&&this.fire(new l.Event("zoomstart",s)),this._rotating&&!g.rotating&&this.fire(new l.Event("rotatestart",s)),this._pitching&&!g.pitching&&this.fire(new l.Event("pitchstart",s))}_fireMoveEvents(s){this.fire(new l.Event("move",s)),this._zooming&&this.fire(new l.Event("zoom",s)),this._rotating&&this.fire(new l.Event("rotate",s)),this._pitching&&this.fire(new l.Event("pitch",s))}_afterEase(s,h){if(this._easeId&&h&&this._easeId===h)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";const g=this._zooming,v=this._rotating,b=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,g&&this.fire(new l.Event("zoomend",s)),v&&this.fire(new l.Event("rotateend",s)),b&&this.fire(new l.Event("pitchend",s)),this.fire(new l.Event("moveend",s))}flyTo(s,h){if(this._prefersReducedMotion(s)){const tt=l.pick(s,["center","zoom","bearing","pitch","around"]);return this.jumpTo(tt,h)}this.stop(),s=l.extend({offset:[0,0],speed:1.2,curve:1.42,easing:l.ease},s);const g=this.transform,v=this.getZoom(),b=this.getBearing(),A=this.getPitch(),I=this.getPadding(),D="zoom"in s?l.clamp(+s.zoom,g.minZoom,g.maxZoom):v,N="bearing"in s?this._normalizeBearing(s.bearing,b):b,B="pitch"in s?+s.pitch:A,q="padding"in s?s.padding:g.padding,J=g.zoomScale(D-v),ne=l.Point.convert(s.offset);let oe=g.centerPoint.add(ne);const ie=g.pointLocation(oe),ae=l.LngLat.convert(s.center||ie);this._normalizeCenter(ae);const Z=g.project(ie),re=g.project(ae).sub(Z);let ue=s.curve;const he=Math.max(g.width,g.height),be=he/J,Se=re.mag();if("minZoom"in s){const tt=l.clamp(Math.min(s.minZoom,v,D),g.minZoom,g.maxZoom),ht=he/g.zoomScale(tt-v);ue=Math.sqrt(ht/Se*2)}const we=ue*ue;function Ce(tt){const ht=(be*be-he*he+(tt?-1:1)*we*we*Se*Se)/(2*(tt?be:he)*we*Se);return Math.log(Math.sqrt(ht*ht+1)-ht)}function Ie(tt){return(Math.exp(tt)-Math.exp(-tt))/2}function Re(tt){return(Math.exp(tt)+Math.exp(-tt))/2}const st=Ce(0);let De=function(tt){return Re(st)/Re(st+ue*tt)},Ke=function(tt){return he*((Re(st)*(Ie(ht=st+ue*tt)/Re(ht))-Ie(st))/we)/Se;var ht},Ne=(Ce(1)-st)/ue;if(Math.abs(Se)<1e-6||!isFinite(Ne)){if(Math.abs(he-be)<1e-6)return this.easeTo(s,h);const tt=bes.maxDuration&&(s.duration=0);const at=b!==N,ze=B!==A,Ze=!g.isPaddingEqual(q),ut=tt=>ht=>{const Mt=ht*Ne,$t=1/De(Mt);tt.zoom=ht===1?D:v+tt.scaleZoom($t),at&&(tt.bearing=l.number(b,N,ht)),ze&&(tt.pitch=l.number(A,B,ht)),Ze&&(tt.interpolatePadding(I,q,ht),oe=tt.centerPoint.add(ne));const It=ht===1?ae:tt.unproject(Z.add(re.mult(Ke(Mt))).mult($t));return tt.setLocationAtPoint(tt.renderWorldCopies?It.wrap():It,oe),tt._updateCameraOnTerrain(),s.preloadOnly||this._fireMoveEvents(h),tt};if(s.preloadOnly){const tt=this._emulate(ut,s.duration,g);return this._preloadTiles(tt),this}return this._zooming=!0,this._rotating=at,this._pitching=ze,this._padding=Ze,this._prepareEase(h,!1),this._ease(ut(g),()=>this._afterEase(h),s),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(s,h){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){const g=this._onEaseEnd;this._onEaseEnd=void 0,g.call(this,h)}if(!s){const g=this.handlers;g&&g.stop(!1)}return this}_ease(s,h,g){g.animate===!1||g.duration===0?(s(1),h()):(this._easeStart=l.exported.now(),this._easeOptions=g,this._onEaseFrame=s,this._onEaseEnd=h,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const s=Math.min((l.exported.now()-this._easeStart)/this._easeOptions.duration,1),h=this._onEaseFrame;h&&h(this._easeOptions.easing(s)),s<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(s,h){s=l.wrap(s,-180,180);const g=Math.abs(s-h);return Math.abs(s-360-h)180?-360:g<-180?360:0}_prefersReducedMotion(s){return this._respectPrefersReducedMotion&&l.exported.prefersReducedMotion&&!(s&&s.essential)}_emulate(s,h,g){const v=Math.ceil(15*h/1e3),b=[],A=s(g.clone());for(let I=0;I<=v;I++){const D=A(I/v);b.push(D.clone())}return b}}class At{constructor(s={}){this.options=s,l.bindAll(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(s){const h=this.options&&this.options.compact;return this._map=s,this._container=z("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=z("button","mapboxgl-ctrl-attrib-button",this._container),z("span","mapboxgl-ctrl-icon",this._compactButton).setAttribute("aria-hidden","true"),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=z("div","mapboxgl-ctrl-attrib-inner",this._container),this._innerContainer.setAttribute("role","list"),h&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),h===void 0&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0}_setElementTitle(s,h){const g=this._map._getUIString(`AttributionControl.${h}`);s.setAttribute("aria-label",g),s.removeAttribute("title"),s.firstElementChild&&s.firstElementChild.setAttribute("title",g)}_toggleAttribution(){this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","false")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","true"))}_updateEditLink(){let s=this._editLink;s||(s=this._editLink=this._container.querySelector(".mapbox-improve-map"));const h=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||l.config.ACCESS_TOKEN}];if(s){const g=h.reduce((v,b,A)=>(b.value&&(v+=`${b.key}=${b.value}${Av.length-b.length),s=s.filter((v,b)=>{for(let A=b+1;A=0)return!1;return!0}),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?s=[...this.options.customAttribution,...s]:s.unshift(this.options.customAttribution));const g=s.join(" | ");g!==this._attribHTML&&(this._attribHTML=g,s.length?(this._innerContainer.innerHTML=g,this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact","mapboxgl-compact-show")}}class Op{constructor(){l.bindAll(["_updateLogo","_updateCompact"],this)}onAdd(s){this._map=s,this._container=z("div","mapboxgl-ctrl");const h=z("a","mapboxgl-ctrl-logo");return h.target="_blank",h.rel="noopener nofollow",h.href="https://www.mapbox.com/",h.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),h.setAttribute("rel","noopener nofollow"),this._container.appendChild(h),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)}getDefaultPosition(){return"bottom-left"}_updateLogo(s){s&&s.sourceDataType!=="metadata"||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;const s=this._map.style._sourceCaches;if(Object.entries(s).length===0)return!0;for(const h in s){const g=s[h].getSource();if(g.hasOwnProperty("mapbox_logo")&&!g.mapbox_logo)return!1}return!0}_updateCompact(){const s=this._container.children;if(s.length){const h=s[0];this._map.getCanvasContainer().offsetWidth<250?h.classList.add("mapboxgl-compact"):h.classList.remove("mapboxgl-compact")}}}class Fp{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(s){const h=++this._id;return this._queue.push({callback:s,id:h,cancelled:!1}),h}remove(s){const h=this._currentlyRunning,g=h?this._queue.concat(h):this._queue;for(const v of g)if(v.id===s)return void(v.cancelled=!0)}run(s=0){const h=this._currentlyRunning=this._queue;this._queue=[];for(const g of h)if(!g.cancelled&&(g.callback(s),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}function Ml(f,s,h){if(f=new l.LngLat(f.lng,f.lat),s){const g=new l.LngLat(f.lng-360,f.lat),v=new l.LngLat(f.lng+360,f.lat),b=360*Math.ceil(Math.abs(f.lng-h.center.lng)/360),A=h.locationPoint(f).distSqr(s),I=s.x<0||s.y<0||s.x>h.width||s.y>h.height;h.locationPoint(g).distSqr(s)180;){const g=h.locationPoint(f);if(g.x>=0&&g.y>=0&&g.x<=h.width&&g.y<=h.height)break;f.lng>h.center.lng?f.lng-=360:f.lng+=360}return f}const Us={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%)"};class xt extends l.Evented{constructor(s,h){if(super(),(s instanceof l.window.HTMLElement||h)&&(s=l.extend({element:s},h)),l.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this),this._anchor=s&&s.anchor||"center",this._color=s&&s.color||"#3FB1CE",this._scale=s&&s.scale||1,this._draggable=s&&s.draggable||!1,this._clickTolerance=s&&s.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=s&&s.rotation||0,this._rotationAlignment=s&&s.rotationAlignment||"auto",this._pitchAlignment=s&&s.pitchAlignment&&s.pitchAlignment||"auto",this._updateMoving=()=>this._update(!0),this._occludedOpacity=s&&s.occludedOpacity||.2,s&&s.element)this._element=s.element,this._offset=l.Point.convert(s&&s.offset||[0,0]);else{this._defaultMarker=!0,this._element=z("div");const v=41,b=27,A=W("svg",{display:"block",height:v*this._scale+"px",width:b*this._scale+"px",viewBox:`0 0 ${b} ${v}`},this._element),I=W("radialGradient",{id:"shadowGradient"},W("defs",{},A));W("stop",{offset:"10%","stop-opacity":.4},I),W("stop",{offset:"100%","stop-opacity":.05},I),W("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},A),W("path",{fill:this._color,d:"M27,13.5C27,19.07 20.25,27 14.75,34.5C14.02,35.5 12.98,35.5 12.25,34.5C6.75,27 0,19.22 0,13.5C0,6.04 6.04,0 13.5,0C20.96,0 27,6.04 27,13.5Z"},A),W("path",{opacity:.25,d:"M13.5,0C6.04,0 0,6.04 0,13.5C0,19.22 6.75,27 12.25,34.5C13,35.52 14.02,35.5 14.75,34.5C20.25,27 27,19.07 27,13.5C27,6.04 20.96,0 13.5,0ZM13.5,1C20.42,1 26,6.58 26,13.5C26,15.9 24.5,19.18 22.22,22.74C19.95,26.3 16.71,30.14 13.94,33.91C13.74,34.18 13.61,34.32 13.5,34.44C13.39,34.32 13.26,34.18 13.06,33.91C10.28,30.13 7.41,26.31 5.02,22.77C2.62,19.23 1,15.95 1,13.5C1,6.58 6.58,1 13.5,1Z"},A),W("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},A),this._offset=l.Point.convert(s&&s.offset||[0,-14])}this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label","Map marker"),this._element.classList.add("mapboxgl-marker"),this._element.addEventListener("dragstart",v=>{v.preventDefault()}),this._element.addEventListener("mousedown",v=>{v.preventDefault()});const g=this._element.classList;for(const v in Us)g.remove(`mapboxgl-marker-anchor-${v}`);g.add(`mapboxgl-marker-anchor-${this._anchor}`),this._popup=null}addTo(s){return s===this._map||(this.remove(),this._map=s,s.getCanvasContainer().appendChild(this._element),s.on("move",this._updateMoving),s.on("moveend",this._update),s.on("remove",this._clearFadeTimer),s._addMarker(this),this.setDraggable(this._draggable),this._update(),s.on("click",this._onMapClick)),this}remove(){const s=this._map;return s&&(s.off("click",this._onMapClick),s.off("move",this._updateMoving),s.off("moveend",this._update),s.off("mousedown",this._addDragHandler),s.off("touchstart",this._addDragHandler),s.off("mouseup",this._onUp),s.off("touchend",this._onUp),s.off("mousemove",this._onMove),s.off("touchmove",this._onMove),s.off("remove",this._clearFadeTimer),s._removeMarker(this),this._map=void 0),this._clearFadeTimer(),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(s){return this._lngLat=l.LngLat.convert(s),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}getElement(){return this._element}setPopup(s){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeAttribute("role"),this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),s){if(!("offset"in s.options)){const v=Math.sqrt(Math.pow(13.5,2)/2);s.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[v,-1*(38.1-13.5+v)],"bottom-right":[-v,-1*(38.1-13.5+v)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=s,s._marker=this,this._lngLat&&this._popup.setLngLat(this._lngLat),this._element.setAttribute("role","button"),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress),this._element.setAttribute("aria-expanded","false")}return this}_onKeyPress(s){const h=s.code,g=s.charCode||s.keyCode;h!=="Space"&&h!=="Enter"&&g!==32&&g!==13||this.togglePopup()}_onMapClick(s){const h=s.originalEvent.target,g=this._element;this._popup&&(h===g||g.contains(h))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const s=this._popup;return s?(s.isOpen()?(s.remove(),this._element.setAttribute("aria-expanded","false")):this._map&&(s.addTo(this._map),this._element.setAttribute("aria-expanded","true")),this):this}_behindTerrain(){const s=this._map,h=this._pos;if(!s||!h)return!1;const g=s.unproject(h),v=s.getFreeCameraOptions();if(!v.position)return!1;const b=v.position.toLngLat();return b.distanceTo(g)<.9*b.distanceTo(this._lngLat)}_evaluateOpacity(){const s=this._map;if(!s)return;const h=this._pos;if(!h||h.x<0||h.x>s.transform.width||h.y<0||h.y>s.transform.height)return void this._clearFadeTimer();const g=s.unproject(h);let v;s._showingGlobe()&&l.isLngLatBehindGlobe(s.transform,this._lngLat)?v=0:(v=1-s._queryFogOpacity(g),s.transform._terrainEnabled()&&s.getTerrain()&&this._behindTerrain()&&(v*=this._occludedOpacity)),this._element.style.opacity=`${v}`,this._element.style.pointerEvents=v>0?"auto":"none",this._popup&&this._popup._setOpacity(v),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_updateDOM(){const s=this._pos;if(!s||!this._map)return;const h=this._offset.mult(this._scale);this._element.style.transform=` + translate(${s.x}px,${s.y}px) + ${Us[this._anchor]} + ${this._calculateXYTransform()} ${this._calculateZTransform()} + translate(${h.x}px,${h.y}px) + `}_calculateXYTransform(){const s=this._pos,h=this._map,g=this.getPitchAlignment();if(!h||!s||g!=="map")return"";if(!h._showingGlobe()){const D=h.getPitch();return D?`rotateX(${D}deg)`:""}const v=l.radToDeg(l.globeTiltAtLngLat(h.transform,this._lngLat)),b=s.sub(l.globeCenterToScreenPoint(h.transform)),A=Math.abs(b.x)+Math.abs(b.y);if(A===0)return"";const I=v/A;return`rotateX(${-b.y*I}deg) rotateY(${b.x*I}deg)`}_calculateZTransform(){const s=this._pos,h=this._map;if(!h||!s)return"";let g=0;const v=this.getRotationAlignment();if(v==="map")if(h._showingGlobe()){const b=h.project(new l.LngLat(this._lngLat.lng,this._lngLat.lat+.001)),A=h.project(new l.LngLat(this._lngLat.lng,this._lngLat.lat-.001)).sub(b);g=l.radToDeg(Math.atan2(A.y,A.x))-90}else g=-h.getBearing();else if(v==="horizon"){const b=l.smoothstep(4,6,h.getZoom()),A=l.globeCenterToScreenPoint(h.transform);A.y+=b*h.transform.height;const I=s.sub(A),D=l.radToDeg(Math.atan2(I.y,I.x));g=(D>90?D-270:D+90)*(1-b)}return g+=this._rotation,g?`rotateZ(${g}deg)`:""}_update(s){l.window.cancelAnimationFrame(this._updateFrameId);const h=this._map;h&&(h.transform.renderWorldCopies&&(this._lngLat=Ml(this._lngLat,this._pos,h.transform)),this._pos=h.project(this._lngLat),s===!0?this._updateFrameId=l.window.requestAnimationFrame(()=>{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())}):this._pos=this._pos.round(),h._requestDomTask(()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(h._showingGlobe()||h.getTerrain()||h.getFog())&&!this._fadeTimer&&(this._fadeTimer=setTimeout(this._evaluateOpacity.bind(this),60)))}))}getOffset(){return this._offset}setOffset(s){return this._offset=l.Point.convert(s),this._update(),this}_onMove(s){const h=this._map;if(!h)return;const g=this._pointerdownPos,v=this._positionDelta;if(g&&v){if(!this._isDragging){const b=this._clickTolerance||h._clickTolerance;if(s.point.dist(g)=this._endTime)return this._end;const h=l.easeCubicInOut((s-this._startTime)/(this._endTime-this._startTime));return this._start*(1-h)+this._end*h}isEasing(s){return s>=this._startTime&&s<=this._endTime}jumpTo(s){this._startTime=-1/0,this._endTime=-1/0,this._start=s,this._end=s}easeTo(s,h,g){this._start=this.getValue(h),this._end=s,this._startTime=h,this._endTime=h+g}}const N0={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","Map.Title":"Map","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScrollZoomBlocker.CtrlMessage":"Use ctrl + scroll to zoom the map","ScrollZoomBlocker.CmdMessage":"Use ⌘ + scroll to zoom the map","TouchPanBlocker.Message":"Use two fingers to move the map"},U0={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:85,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,performanceMetricsCollection:!0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,optimizeForTerrain:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,minTileCacheSize:null,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",localFontFamily:null,transformRequest:null,accessToken:null,fadeDuration:300,respectPrefersReducedMotion:!0,crossSourceCollisions:!0},mx={showCompass:!0,showZoom:!0,visualizePitch:!1};class gx{constructor(s,h,g=!1){this._clickTolerance=10,this.element=h,this.mouseRotate=new Pp({clickTolerance:s.dragRotate._mouseRotate._clickTolerance}),this.map=s,g&&(this.mousePitch=new Dp({clickTolerance:s.dragRotate._mousePitch._clickTolerance})),l.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),h.addEventListener("mousedown",this.mousedown),h.addEventListener("touchstart",this.touchstart,{passive:!1}),h.addEventListener("touchmove",this.touchmove),h.addEventListener("touchend",this.touchend),h.addEventListener("touchcancel",this.reset)}down(s,h){this.mouseRotate.mousedown(s,h),this.mousePitch&&this.mousePitch.mousedown(s,h),V()}move(s,h){const g=this.map,v=this.mouseRotate.mousemoveWindow(s,h),b=v&&v.bearingDelta;if(b&&g.setBearing(g.getBearing()+b),this.mousePitch){const A=this.mousePitch.mousemoveWindow(s,h),I=A&&A.pitchDelta;I&&g.setPitch(g.getPitch()+I)}}off(){const s=this.element;s.removeEventListener("mousedown",this.mousedown),s.removeEventListener("touchstart",this.touchstart,{passive:!1}),s.removeEventListener("touchmove",this.touchmove),s.removeEventListener("touchend",this.touchend),s.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){R(),l.window.removeEventListener("mousemove",this.mousemove),l.window.removeEventListener("mouseup",this.mouseup)}mousedown(s){this.down(l.extend({},s,{ctrlKey:!0,preventDefault:()=>s.preventDefault()}),Q(this.element,s)),l.window.addEventListener("mousemove",this.mousemove),l.window.addEventListener("mouseup",this.mouseup)}mousemove(s){this.move(s,Q(this.element,s))}mouseup(s){this.mouseRotate.mouseupWindow(s),this.mousePitch&&this.mousePitch.mouseupWindow(s),this.offTemp()}touchstart(s){s.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=te(this.element,s.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>s.preventDefault()},this._startPos))}touchmove(s){s.targetTouches.length!==1?this.reset():(this._lastPos=te(this.element,s.targetTouches)[0],this.move({preventDefault:()=>s.preventDefault()},this._lastPos))}touchend(s){s.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)f.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(f.minPitch!=null&&f.maxPitch!=null&&f.minPitch>f.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(f.minPitch!=null&&f.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(f.maxPitch!=null&&f.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(f.antialias&&l.isSafariWithAntialiasingBug(l.window)&&(f.antialias=!1,l.warnOnce("Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609")),super(new Cl(f.minZoom,f.maxZoom,f.minPitch,f.maxPitch,f.renderWorldCopies),f),this._interactive=f.interactive,this._minTileCacheSize=f.minTileCacheSize,this._maxTileCacheSize=f.maxTileCacheSize,this._failIfMajorPerformanceCaveat=f.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=f.preserveDrawingBuffer,this._antialias=f.antialias,this._useWebGL2=f.useWebGL2,this._trackResize=f.trackResize,this._bearingSnap=f.bearingSnap,this._refreshExpiredTiles=f.refreshExpiredTiles,this._fadeDuration=f.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=f.crossSourceCollisions,this._collectResourceTiming=f.collectResourceTiming,this._optimizeForTerrain=f.optimizeForTerrain,this._language=this._parseLanguage(f.language),this._worldview=f.worldview,this._renderTaskQueue=new Fp,this._domRenderTaskQueue=new Fp,this._controls=[],this._markers=[],this._popups=[],this._mapId=l.uniqueId(),this._locale=l.extend({},N0,f.locale),this._clickTolerance=f.clickTolerance,this._cooperativeGestures=f.cooperativeGestures,this._performanceMetricsCollection=f.performanceMetricsCollection,this._containerWidth=0,this._containerHeight=0,this._averageElevationLastSampledAt=-1/0,this._averageElevationExaggeration=0,this._averageElevation=new Bp(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._requestManager=new l.RequestManager(f.transformRequest,f.accessToken,f.testMode),this._silenceAuthErrors=!!f.testMode,typeof f.container=="string"){if(this._container=l.window.document.getElementById(f.container),!this._container)throw new Error(`Container '${f.container}' not found.`)}else{if(!(f.container instanceof l.window.HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=f.container}if(this._container.childNodes.length>0&&l.warnOnce("The map container element should be empty, otherwise the map's interactivity will be negatively impacted. If you want to display a message when WebGL is not supported, use the Mapbox GL Supported plugin instead."),f.maxBounds&&this.setMaxBounds(f.maxBounds),l.bindAll(["_onWindowOnline","_onWindowResize","_onVisibilityChange","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),this.painter===void 0)throw new Error("Failed to initialize WebGL.");this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),l.window!==void 0&&(l.window.addEventListener("online",this._onWindowOnline,!1),l.window.addEventListener("resize",this._onWindowResize,!1),l.window.addEventListener("orientationchange",this._onWindowResize,!1),l.window.addEventListener("webkitfullscreenchange",this._onWindowResize,!1),l.window.addEventListener("visibilitychange",this._onVisibilityChange,!1)),this.handlers=new Qo(this,f),this._localFontFamily=f.localFontFamily,this._localIdeographFontFamily=f.localIdeographFontFamily,f.style&&this.setStyle(f.style,{localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),f.projection&&this.setProjection(f.projection),this._hash=f.hash&&new Ap(typeof f.hash=="string"&&f.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:f.center,zoom:f.zoom,bearing:f.bearing,pitch:f.pitch}),f.bounds&&(this.resize(),this.fitBounds(f.bounds,l.extend({},f.fitBoundsOptions,{duration:0})))),this.resize(),f.attributionControl&&this.addControl(new At({customAttribution:f.customAttribution})),this._logoControl=new Op,this.addControl(this._logoControl,f.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",s=>{this._update(s.dataType==="style"),this.fire(new l.Event(`${s.dataType}data`,s))}),this.on("dataloading",s=>{this.fire(new l.Event(`${s.dataType}dataloading`,s))})}_getMapId(){return this._mapId}addControl(f,s){if(s===void 0&&(s=f.getDefaultPosition?f.getDefaultPosition():"top-right"),!f||!f.onAdd)return this.fire(new l.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const h=f.onAdd(this);this._controls.push(f);const g=this._controlPositions[s];return s.indexOf("bottom")!==-1?g.insertBefore(h,g.firstChild):g.appendChild(h),this}removeControl(f){if(!f||!f.onRemove)return this.fire(new l.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const s=this._controls.indexOf(f);return s>-1&&this._controls.splice(s,1),f.onRemove(this),this}hasControl(f){return this._controls.indexOf(f)>-1}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(f){if(this._updateContainerDimensions(),this._containerWidth===this.transform.width&&this._containerHeight===this.transform.height)return this;this._resizeCanvas(this._containerWidth,this._containerHeight),this.transform.resize(this._containerWidth,this._containerHeight),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight));const s=!this._moving;return s&&this.fire(new l.Event("movestart",f)).fire(new l.Event("move",f)),this.fire(new l.Event("resize",f)),s&&this.fire(new l.Event("moveend",f)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(f){return this.transform.setMaxBounds(l.LngLatBounds.convert(f)),this._update()}setMinZoom(f){if((f=f??-2)>=-2&&f<=this.transform.maxZoom)return this.transform.minZoom=f,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=f,this._update(),this.getZoom()>f?this.setZoom(f):this.fire(new l.Event("zoomstart")).fire(new l.Event("zoom")).fire(new l.Event("zoomend")),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(f){if((f=f??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(f>=0&&f<=this.transform.maxPitch)return this.transform.minPitch=f,this._update(),this.getPitch()85)throw new Error("maxPitch must be less than or equal to 85");if(f>=this.transform.minPitch)return this.transform.maxPitch=f,this._update(),this.getPitch()>f?this.setPitch(f):this.fire(new l.Event("pitchstart")).fire(new l.Event("pitch")).fire(new l.Event("pitchend")),this;throw new Error("maxPitch must be greater than or equal to minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(f){return this.transform.renderWorldCopies=f,this.transform.renderWorldCopies||this._forceMarkerAndPopupUpdate(!0),this._update()}getLanguage(){return this._language}_parseLanguage(f){return f==="auto"?l.window.navigator.language:Array.isArray(f)?f.length===0?void 0:f.map(s=>s==="auto"?l.window.navigator.language:s):f}setLanguage(f){const s=this._parseLanguage(f);if(!this.style||s===this._language)return this;this._language=s,this.style._reloadSources();for(const h of this._controls)h._setLanguage&&h._setLanguage(this._language);return this}getWorldview(){return this._worldview}setWorldview(f){return this.style&&f!==this._worldview?(this._worldview=f,this.style._reloadSources(),this):this}getProjection(){return this.transform.mercatorFromTransition?{name:"globe",center:[0,0]}:this.transform.getProjection()}_showingGlobe(){return this.transform.projection.name==="globe"}setProjection(f){return this._lazyInitEmptyStyle(),f?typeof f=="string"&&(f={name:f}):f=null,this._useExplicitProjection=!!f,this._prioritizeAndUpdateProjection(f,this.style.stylesheet?this.style.stylesheet.projection:null)}_updateProjectionTransition(){if(this.getProjection().name!=="globe")return;const f=this.transform,s=f.projection.name;let h;s==="globe"&&f.zoom>=l.GLOBE_ZOOM_THRESHOLD_MAX?(f.setMercatorFromTransition(),h=!0):s==="mercator"&&f.zoom=l.GLOBE_ZOOM_THRESHOLD_MAX?this.transform.setMercatorFromTransition():this.transform.setProjection(f),this.style.applyProjectionUpdate(),s){this.painter.clearBackgroundTiles();for(const h in this.style._sourceCaches)this.style._sourceCaches[h].clearTiles();this._update(!0),this._forceMarkerAndPopupUpdate(!0)}return this}project(f){return this.transform.locationPoint3D(l.LngLat.convert(f))}unproject(f){return this.transform.pointLocation3D(l.Point.convert(f))}isMoving(){return this._moving||this.handlers&&this.handlers.isMoving()||!1}isZooming(){return this._zooming||this.handlers&&this.handlers.isZooming()||!1}isRotating(){return this._rotating||this.handlers&&this.handlers.isRotating()||!1}_isDragging(){return this.handlers&&this.handlers._isDragging()||!1}_createDelegatedListener(f,s,h){if(f==="mouseenter"||f==="mouseover"){let g=!1;const v=A=>{const I=s.filter(N=>this.getLayer(N)),D=I.length?this.queryRenderedFeatures(A.point,{layers:I}):[];D.length?g||(g=!0,h.call(this,new Wn(f,this,A.originalEvent,{features:D}))):g=!1},b=()=>{g=!1};return{layers:new Set(s),listener:h,delegates:{mousemove:v,mouseout:b}}}if(f==="mouseleave"||f==="mouseout"){let g=!1;const v=A=>{const I=s.filter(D=>this.getLayer(D));(I.length?this.queryRenderedFeatures(A.point,{layers:I}):[]).length?g=!0:g&&(g=!1,h.call(this,new Wn(f,this,A.originalEvent)))},b=A=>{g&&(g=!1,h.call(this,new Wn(f,this,A.originalEvent)))};return{layers:new Set(s),listener:h,delegates:{mousemove:v,mouseout:b}}}{const g=v=>{const b=s.filter(I=>this.getLayer(I)),A=b.length?this.queryRenderedFeatures(v.point,{layers:b}):[];A.length&&(v.features=A,h.call(this,v),delete v.features)};return{layers:new Set(s),listener:h,delegates:{[f]:g}}}}on(f,s,h){if(h===void 0)return super.on(f,s);Array.isArray(s)||(s=[s]);const g=this._createDelegatedListener(f,s,h);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[f]=this._delegatedListeners[f]||[],this._delegatedListeners[f].push(g);for(const v in g.delegates)this.on(v,g.delegates[v]);return this}once(f,s,h){if(h===void 0)return super.once(f,s);Array.isArray(s)||(s=[s]);const g=this._createDelegatedListener(f,s,h);for(const v in g.delegates)this.once(v,g.delegates[v]);return this}off(f,s,h){if(h===void 0)return super.off(f,s);s=new Set(Array.isArray(s)?s:[s]);const g=(b,A)=>{if(b.size!==A.size)return!1;for(const I of b)if(!A.has(I))return!1;return!0},v=this._delegatedListeners?this._delegatedListeners[f]:void 0;return v&&(b=>{for(let A=0;A{v?this.fire(new l.ErrorEvent(v)):b&&this._updateDiff(b,s)})}else typeof f=="object"&&this._updateDiff(f,s)}_updateDiff(f,s){try{this.style.setState(f)&&this._update(!0)}catch(h){l.warnOnce(`Unable to perform style diff: ${h.message||h.error||h}. Rebuilding the style from scratch.`),this._updateStyle(f,s)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():(l.warnOnce("There is no style added to the map."),!1)}addSource(f,s){return this._lazyInitEmptyStyle(),this.style.addSource(f,s),this._update(!0)}isSourceLoaded(f){return!!this.style&&this.style._isSourceCacheLoaded(f)}areTilesLoaded(){const f=this.style&&this.style._sourceCaches;for(const s in f){const h=f[s]._tiles;for(const g in h){const v=h[g];if(v.state!=="loaded"&&v.state!=="errored")return!1}}return!0}addSourceType(f,s,h){this._lazyInitEmptyStyle(),this.style.addSourceType(f,s,h)}removeSource(f){return this.style.removeSource(f),this._updateTerrain(),this._update(!0)}getSource(f){return this.style.getSource(f)}addImage(f,s,{pixelRatio:h=1,sdf:g=!1,stretchX:v,stretchY:b,content:A}={}){if(this._lazyInitEmptyStyle(),s instanceof l.window.HTMLImageElement||l.window.ImageBitmap&&s instanceof l.window.ImageBitmap){const{width:I,height:D,data:N}=l.exported.getImageData(s);this.style.addImage(f,{data:new l.RGBAImage({width:I,height:D},N),pixelRatio:h,stretchX:v,stretchY:b,content:A,sdf:g,version:0})}else if(s.width===void 0||s.height===void 0)this.fire(new l.ErrorEvent(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));else{const{width:I,height:D}=s,N=s;this.style.addImage(f,{data:new l.RGBAImage({width:I,height:D},new Uint8Array(N.data)),pixelRatio:h,stretchX:v,stretchY:b,content:A,sdf:g,version:0,userImage:N}),N.onAdd&&N.onAdd(this,f)}}updateImage(f,s){const h=this.style.getImage(f);if(!h)return void this.fire(new l.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const g=s instanceof l.window.HTMLImageElement||l.window.ImageBitmap&&s instanceof l.window.ImageBitmap?l.exported.getImageData(s):s,{width:v,height:b}=g;v!==void 0&&b!==void 0?v===h.data.width&&b===h.data.height?(h.data.replace(g.data,!(s instanceof l.window.HTMLImageElement||l.window.ImageBitmap&&s instanceof l.window.ImageBitmap)),this.style.updateImage(f,h)):this.fire(new l.ErrorEvent(new Error(`The width and height of the updated image (${v}, ${b}) + must be that same as the previous version of the image + (${h.data.width}, ${h.data.height})`))):this.fire(new l.ErrorEvent(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")))}hasImage(f){return f?!!this.style.getImage(f):(this.fire(new l.ErrorEvent(new Error("Missing required image id"))),!1)}removeImage(f){this.style.removeImage(f)}loadImage(f,s){l.getImage(this._requestManager.transformRequest(f,l.ResourceType.Image),(h,g)=>{s(h,g instanceof l.window.HTMLImageElement?l.exported.getImageData(g):g)})}listImages(){return this.style.listImages()}addLayer(f,s){return this._lazyInitEmptyStyle(),this.style.addLayer(f,s),this._update(!0)}moveLayer(f,s){return this.style.moveLayer(f,s),this._update(!0)}removeLayer(f){return this.style.removeLayer(f),this._update(!0)}getLayer(f){return this.style.getLayer(f)}setLayerZoomRange(f,s,h){return this.style.setLayerZoomRange(f,s,h),this._update(!0)}setFilter(f,s,h={}){return this.style.setFilter(f,s,h),this._update(!0)}getFilter(f){return this.style.getFilter(f)}setPaintProperty(f,s,h,g={}){return this.style.setPaintProperty(f,s,h,g),this._update(!0)}getPaintProperty(f,s){return this.style.getPaintProperty(f,s)}setLayoutProperty(f,s,h,g={}){return this.style.setLayoutProperty(f,s,h,g),this._update(!0)}getLayoutProperty(f,s){return this.style.getLayoutProperty(f,s)}setLight(f,s={}){return this._lazyInitEmptyStyle(),this.style.setLight(f,s),this._update(!0)}getLight(){return this.style.getLight()}setTerrain(f){return this._lazyInitEmptyStyle(),!f&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(f),this._averageElevationLastSampledAt=-1/0,this._update(!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(f){return this._lazyInitEmptyStyle(),this.style.setFog(f),this._update(!0)}getFog(){return this.style?this.style.getFog():null}_queryFogOpacity(f){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(l.LngLat.convert(f),this.transform):0}setFeatureState(f,s){return this.style.setFeatureState(f,s),this._update()}removeFeatureState(f,s){return this.style.removeFeatureState(f,s),this._update()}getFeatureState(f){return this.style.getFeatureState(f)}_updateContainerDimensions(){if(!this._container)return;const f=this._container.getBoundingClientRect().width||400,s=this._container.getBoundingClientRect().height||300;let h,g,v,b=this._container;for(;b&&(!g||!v);){const A=l.window.getComputedStyle(b).transform;A&&A!=="none"&&(h=A.match(/matrix.*\((.+)\)/)[1].split(", "),h[0]&&h[0]!=="0"&&h[0]!=="1"&&(g=h[0]),h[3]&&h[3]!=="0"&&h[3]!=="1"&&(v=h[3])),b=b.parentElement}this._containerWidth=g?Math.abs(f/g):f,this._containerHeight=v?Math.abs(s/v):s}_detectMissingCSS(){l.window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")!=="rgb(250, 128, 114)"&&l.warnOnce("This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described in https://www.mapbox.com/mapbox-gl-js/api/.")}_setupContainer(){const f=this._container;f.classList.add("mapboxgl-map"),(this._missingCSSCanary=z("div","mapboxgl-canary",f)).style.visibility="hidden",this._detectMissingCSS();const s=this._canvasContainer=z("div","mapboxgl-canvas-container",f);this._interactive&&s.classList.add("mapboxgl-interactive"),this._canvas=z("canvas","mapboxgl-canvas",s),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region"),this._updateContainerDimensions(),this._resizeCanvas(this._containerWidth,this._containerHeight);const h=this._controlContainer=z("div","mapboxgl-control-container",f),g=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(v=>{g[v]=z("div",`mapboxgl-ctrl-${v}`,h)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(f,s){const h=l.exported.devicePixelRatio||1;this._canvas.width=h*Math.ceil(f),this._canvas.height=h*Math.ceil(s),this._canvas.style.width=`${f}px`,this._canvas.style.height=`${s}px`}_addMarker(f){this._markers.push(f)}_removeMarker(f){const s=this._markers.indexOf(f);s!==-1&&this._markers.splice(s,1)}_addPopup(f){this._popups.push(f)}_removePopup(f){const s=this._popups.indexOf(f);s!==-1&&this._popups.splice(s,1)}_setupPainter(){const f=l.extend({},T.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),s=this._useWebGL2&&this._canvas.getContext("webgl2",f),h=s||this._canvas.getContext("webgl",f)||this._canvas.getContext("experimental-webgl",f);h?(this._useWebGL2&&!s&&l.warnOnce("Failed to create WebGL 2 context. Using WebGL 1."),l.storeAuthState(h,!0),this.painter=new Al(h,this.transform,!!s),this.on("data",g=>{g.dataType==="source"&&this.painter.setTileLoadedFlag(!0)}),l.exported$1.testSupport(h)):this.fire(new l.ErrorEvent(new Error("Failed to initialize WebGL")))}_contextLost(f){f.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new l.Event("webglcontextlost",{originalEvent:f}))}_contextRestored(f){this._setupPainter(),this.resize(),this._update(),this.fire(new l.Event("webglcontextrestored",{originalEvent:f}))}_onMapScroll(f){if(f.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(f){return this.style?(this._styleDirty=this._styleDirty||f,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(f){return this._update(),this._renderTaskQueue.add(f)}_cancelRenderFrame(f){this._renderTaskQueue.remove(f)}_requestDomTask(f){!this.loaded()||this.loaded()&&!this.isMoving()?f():this._domRenderTaskQueue.add(f)}_render(f){let s;const h=this.painter.context.extTimerQuery,g=l.exported.now();if(this.listens("gpu-timing-frame")&&(s=h.createQueryEXT(),h.beginQueryEXT(h.TIME_ELAPSED_EXT,s)),this.painter.context.setDirty(),this.painter.setBaseState(),(this.isMoving()||this.isRotating()||this.isZooming())&&(this._interactionRange[0]=Math.min(this._interactionRange[0],l.window.performance.now()),this._interactionRange[1]=Math.max(this._interactionRange[1],l.window.performance.now())),this._renderTaskQueue.run(f),this._domRenderTaskQueue.run(f),this._removed)return;this._updateProjectionTransition();const v=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const I=this.transform.zoom,D=this.transform.pitch,N=l.exported.now(),B=new l.EvaluationParameters(I,{now:N,fadeDuration:v,pitch:D,transition:this.style.getTransition()});this.style.update(B)}this.style&&this.style.fog&&this.style.fog.hasTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0);let b=!1;if(this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),b=this._updateAverageElevation(g),this.style._updateSources(this.transform),this._forceMarkerAndPopupUpdate()):b=this._updateAverageElevation(g),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,v,this._crossSourceCollisions),this.style&&this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showTerrainWireframe:this.showTerrainWireframe,showOverdrawInspector:this._showOverdrawInspector,showQueryGeometry:!!this._showQueryGeometry,showTileAABBs:this.showTileAABBs,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:v,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),gpuTimingDeferredRender:!!this.listens("gpu-timing-deferred-render"),speedIndexTiming:this.speedIndexTiming}),this.fire(new l.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new l.Event("load"))),this.style&&this.style.hasTransitions()&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),s){const I=l.exported.now()-g;h.endQueryEXT(h.TIME_ELAPSED_EXT,s),setTimeout(()=>{const D=h.getQueryObjectEXT(s,h.QUERY_RESULT_EXT)/1e6;h.deleteQueryEXT(s),this.fire(new l.Event("gpu-timing-frame",{cpuTime:I,gpuTime:D})),l.window.performance.mark("frame-gpu",{startTime:g,detail:{gpuTime:D}})},50)}if(this.listens("gpu-timing-layer")){const I=this.painter.collectGpuTimers();setTimeout(()=>{const D=this.painter.queryGpuTimers(I);this.fire(new l.Event("gpu-timing-layer",{layerTimes:D}))},50)}if(this.listens("gpu-timing-deferred-render")){const I=this.painter.collectDeferredRenderGpuQueries();setTimeout(()=>{const D=this.painter.queryGpuTimeDeferredRender(I);this.fire(new l.Event("gpu-timing-deferred-render",{gpuTime:D}))},50)}const A=this._sourcesDirty||this._styleDirty||this._placementDirty||b;if(A||this._repaint)this.triggerRepaint();else{const I=!this.isMoving()&&this.loaded();if(I&&(b=this._updateAverageElevation(g,!0)),b)this.triggerRepaint();else if(this._triggerFrame(!1),I&&(this.fire(new l.Event("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const D=this._calculateSpeedIndex();this.fire(new l.Event("speedindexcompleted",{speedIndex:D})),this.speedIndexTiming=!1}}!this._loaded||this._fullyLoaded||A||(this._fullyLoaded=!0,l.LivePerformanceUtils.mark(l.PerformanceMarkers.fullLoad),this._performanceMetricsCollection&&l.postPerformanceEvent(this._requestManager._customAccessToken,{width:this.painter.width,height:this.painter.height,interactionRange:this._interactionRange,visibilityHidden:this._visibilityHidden,terrainEnabled:!!this.painter.style.getTerrain(),fogEnabled:!!this.painter.style.getFog(),projection:this.getProjection().name,zoom:this.transform.zoom,renderer:this.painter.context.renderer,vendor:this.painter.context.vendor}),this._authenticate())}_forceMarkerAndPopupUpdate(f){for(const s of this._markers)f&&!this.getRenderWorldCopies()&&(s._lngLat=s._lngLat.wrap()),s._update();for(const s of this._popups)!f||this.getRenderWorldCopies()||s._trackPointer||(s._lngLat=s._lngLat.wrap()),s._update()}_updateAverageElevation(f,s=!1){const h=g=>(this.transform.averageElevation=g,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return this.transform.averageElevation!==0&&h(0);if((s||f-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(f)){const g=this.transform.averageElevation;let v=this.transform.sampleAverageElevation(),b=!1;this.transform.elevation&&(b=this.transform.elevation.exaggeration()!==this._averageElevationExaggeration,this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(v)?v=0:this._averageElevationLastSampledAt=f;const A=Math.abs(g-v);if(A>1){if(this._isInitialLoad||b)return this._averageElevation.jumpTo(v),h(v);this._averageElevation.easeTo(v,f,300)}else if(A>1e-4)return this._averageElevation.jumpTo(v),h(v)}return!!this._averageElevation.isEasing(f)&&h(this._averageElevation.getValue(f))}_authenticate(){l.getMapSessionAPI(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,f=>{if(f&&(f.message===l.AUTH_ERR_MSG||f.status===401)){const s=this.painter.context.gl;l.storeAuthState(s,!1),this._logoControl instanceof Op&&this._logoControl._updateLogo(),s&&s.clear(s.DEPTH_BUFFER_BIT|s.COLOR_BUFFER_BIT|s.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new l.ErrorEvent(new Error("A valid Mapbox access token is required to use Mapbox GL JS. To create an account or a new access token, visit https://account.mapbox.com/")))}}),l.postMapLoadEvent(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=>{})}_updateTerrain(){const f=this._isDragging();this.painter.updateTerrain(this.style,f)}_calculateSpeedIndex(){const f=this.painter.canvasCopy(),s=this.painter.getCanvasCopiesAndTimestamps();s.timeStamps.push(performance.now());const h=this.painter.context.gl,g=h.createFramebuffer();function v(b){h.framebufferTexture2D(h.FRAMEBUFFER,h.COLOR_ATTACHMENT0,h.TEXTURE_2D,b,0);const A=new Uint8Array(h.drawingBufferWidth*h.drawingBufferHeight*4);return h.readPixels(0,0,h.drawingBufferWidth,h.drawingBufferHeight,h.RGBA,h.UNSIGNED_BYTE,A),A}return h.bindFramebuffer(h.FRAMEBUFFER,g),this._canvasPixelComparison(v(f),s.canvasCopies.map(v),s.timeStamps)}_canvasPixelComparison(f,s,h){let g=h[1]-h[0];const v=f.length/4;for(let b=0;b{const h=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,h&&this._render(s)}))}_preloadTiles(f){const s=this.style?Object.values(this.style._sourceCaches):[];return l.asyncAll(s,(h,g)=>h._preloadTiles(f,g),()=>{this.triggerRepaint()}),this}_onWindowOnline(){this._update()}_onWindowResize(f){this._trackResize&&this.resize({originalEvent:f})._update()}_onVisibilityChange(){l.window.document.visibilityState==="hidden"&&this._visibilityHidden++}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(f){this._showTileBoundaries!==f&&(this._showTileBoundaries=f,this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(f){this._showTerrainWireframe!==f&&(this._showTerrainWireframe=f,this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(f){this._speedIndexTiming!==f&&(this._speedIndexTiming=f,this._update())}get showPadding(){return!!this._showPadding}set showPadding(f){this._showPadding!==f&&(this._showPadding=f,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(f){this._showCollisionBoxes!==f&&(this._showCollisionBoxes=f,f?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(f){this._showOverdrawInspector!==f&&(this._showOverdrawInspector=f,this._update())}get repaint(){return!!this._repaint}set repaint(f){this._repaint!==f&&(this._repaint=f,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(f){this._vertices=f,this._update()}get showTileAABBs(){return!!this._showTileAABBs}set showTileAABBs(f){this._showTileAABBs!==f&&(this._showTileAABBs=f,f&&this._update())}_setCacheLimits(f,s){l.setCacheLimits(f,s)}get version(){return l.version}},NavigationControl:class{constructor(f){this.options=l.extend({},mx,f),this._container=z("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",s=>s.preventDefault()),this.options.showZoom&&(l.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",s=>{this._map&&this._map.zoomIn({},{originalEvent:s})}),z("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",s=>{this._map&&this._map.zoomOut({},{originalEvent:s})}),z("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(l.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",s=>{const h=this._map;h&&(this.options.visualizePitch?h.resetNorthPitch({},{originalEvent:s}):h.resetNorth({},{originalEvent:s}))}),this._compassIcon=z("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const f=this._map;if(!f)return;const s=f.getZoom(),h=s===f.getMaxZoom(),g=s===f.getMinZoom();this._zoomInButton.disabled=h,this._zoomOutButton.disabled=g,this._zoomInButton.setAttribute("aria-disabled",h.toString()),this._zoomOutButton.setAttribute("aria-disabled",g.toString())}_rotateCompassArrow(){const f=this._map;if(!f)return;const s=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(f.transform.pitch*(Math.PI/180)),.5)}) rotateX(${f.transform.pitch}deg) rotateZ(${f.transform.angle*(180/Math.PI)}deg)`:`rotate(${f.transform.angle*(180/Math.PI)}deg)`;f._requestDomTask(()=>{this._compassIcon&&(this._compassIcon.style.transform=s)})}onAdd(f){return this._map=f,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),f.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&f.on("pitch",this._rotateCompassArrow),f.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new gx(f,this._compass,this.options.visualizePitch)),this._container}onRemove(){const f=this._map;f&&(this._container.remove(),this.options.showZoom&&f.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&f.off("pitch",this._rotateCompassArrow),f.off("rotate",this._rotateCompassArrow),this._handler&&this._handler.off(),this._handler=void 0),this._map=void 0)}_createButton(f,s){const h=z("button",f,this._container);return h.type="button",h.addEventListener("click",s),h}_setButtonTitle(f,s){if(!this._map)return;const h=this._map._getUIString(`NavigationControl.${s}`);f.setAttribute("aria-label",h),f.firstElementChild&&f.firstElementChild.setAttribute("title",h)}},GeolocateControl:class extends l.Evented{constructor(f){super(),this.options=l.extend({geolocation:l.window.navigator.geolocation},Np,f),l.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=kl(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(f){return this._map=f,this._container=z("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkGeolocationSupport(this._setupUI),this._container}onRemove(){this._geolocationWatchID!==void 0&&(this.options.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("zoom",this._onZoom),this._map=void 0,this._numberOfWatches=0,this._noTimeout=!1}_checkGeolocationSupport(f){const s=(h=!!this.options.geolocation)=>{this._supportsGeolocation=h,f(h)};this._supportsGeolocation!==void 0?f(this._supportsGeolocation):l.window.navigator.permissions!==void 0?l.window.navigator.permissions.query({name:"geolocation"}).then(h=>s(h.state!=="denied")).catch(()=>s()):s()}_isOutOfMapMaxBounds(f){const s=this._map.getMaxBounds(),h=f.coords;return!!s&&(h.longitudes.getEast()||h.latitudes.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting")}}_onSuccess(f){if(this._map){if(this._isOutOfMapMaxBounds(f))return this._setErrorState(),this.fire(new l.Event("outofmaxbounds",f)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=f,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(f),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(f),this.options.showUserLocation&&this._dotElement.classList.remove("mapboxgl-user-location-dot-stale"),this.fire(new l.Event("geolocate",f)),this._finish()}}_updateCamera(f){const s=new l.LngLat(f.coords.longitude,f.coords.latitude),h=f.coords.accuracy,g=this._map.getBearing(),v=l.extend({bearing:g},this.options.fitBoundsOptions);this._map.fitBounds(s.toBounds(h),v,{geolocateSource:!0})}_updateMarker(f){if(f){const s=new l.LngLat(f.coords.longitude,f.coords.latitude);this._accuracyCircleMarker.setLngLat(s).addTo(this._map),this._userLocationDotMarker.setLngLat(s).addTo(this._map),this._accuracy=f.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const f=this._map.transform,s=l.mercatorZfromAltitude(1,f._center.lat)*f.worldSize,h=Math.ceil(2*this._accuracy*s);this._circleElement.style.width=`${h}px`,this._circleElement.style.height=`${h}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_updateMarkerRotation(){this._userLocationDotMarker&&typeof this._heading=="number"?(this._userLocationDotMarker.setRotation(this._heading),this._dotElement.classList.add("mapboxgl-user-location-show-heading")):(this._dotElement.classList.remove("mapboxgl-user-location-show-heading"),this._userLocationDotMarker.setRotation(0))}_onError(f){if(this._map){if(this.options.trackUserLocation)if(f.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const s=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",s),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",s),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(f.code===3&&this._noTimeout)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("mapboxgl-user-location-dot-stale"),this.fire(new l.Event("error",f)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(f){if(this._map!==void 0){if(this._container.addEventListener("contextmenu",s=>s.preventDefault()),this._geolocateButton=z("button","mapboxgl-ctrl-geolocate",this._container),z("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",f===!1){l.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");const s=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",s),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",s)}else{const s=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",s),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",s)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=z("div","mapboxgl-user-location"),this._dotElement.appendChild(z("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(z("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new xt({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=z("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new xt({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",s=>{s.geolocateSource||this._watchState!=="ACTIVE_LOCK"||s.originalEvent&&s.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this.fire(new l.Event("trackuserlocationend")))})}}_onDeviceOrientation(f){this._userLocationDotMarker&&(f.webkitCompassHeading?this._heading=f.webkitCompassHeading:f.absolute===!0&&(this._heading=-1*f.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return l.warnOnce("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new l.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":this._numberOfWatches--,this._noTimeout=!1,this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire(new l.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new l.Event("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let f;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._numberOfWatches++,this._numberOfWatches>1?(f={maximumAge:6e5,timeout:0},this._noTimeout=!0):(f=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,f),this.options.showUserHeading&&this._addDeviceOrientationListener()}}else this.options.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_addDeviceOrientationListener(){const f=()=>{l.window.addEventListener("ondeviceorientationabsolute"in l.window?"deviceorientationabsolute":"deviceorientation",this._onDeviceOrientation)};l.window.DeviceMotionEvent!==void 0&&typeof l.window.DeviceMotionEvent.requestPermission=="function"?DeviceOrientationEvent.requestPermission().then(s=>{s==="granted"&&f()}).catch(console.error):f()}_clearWatch(){this.options.geolocation.clearWatch(this._geolocationWatchID),l.window.removeEventListener("deviceorientation",this._onDeviceOrientation),l.window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientation),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:At,ScaleControl:class{constructor(f){this.options=l.extend({},Up,f),this._isNumberFormatSupported=function(){try{return new Intl.NumberFormat("en",{style:"unit",unitDisplay:"short",unit:"meter"}),!0}catch{return!1}}(),l.bindAll(["_update","_setScale","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_update(){const f=this.options.maxWidth||100,s=this._map,h=s._containerHeight/2,g=s._containerWidth/2-f/2,v=s.unproject([g,h]),b=s.unproject([g+f,h]),A=v.distanceTo(b);if(this.options.unit==="imperial"){const I=3.2808*A;I>5280?this._setScale(f,I/5280,"mile"):this._setScale(f,I,"foot")}else this.options.unit==="nautical"?this._setScale(f,A/1852,"nautical-mile"):A>=1e3?this._setScale(f,A/1e3,"kilometer"):this._setScale(f,A,"meter")}_setScale(f,s,h){this._map._requestDomTask(()=>{const g=function(b){const A=Math.pow(10,`${Math.floor(b)}`.length-1);let I=b/A;return I=I>=10?10:I>=5?5:I>=3?3:I>=2?2:I>=1?1:function(D){const N=Math.pow(10,Math.ceil(-Math.log(D)/Math.LN10));return Math.round(D*N)/N}(I),A*I}(s),v=g/s;this._container.innerHTML=this._isNumberFormatSupported&&h!=="nautical-mile"?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"short",unit:h}).format(g):`${g} ${jp[h]}`,this._container.style.width=f*v+"px"})}onAdd(f){return this._map=f,this._language=f.getLanguage(),this._container=z("div","mapboxgl-ctrl mapboxgl-ctrl-scale",f.getContainer()),this._container.dir="auto",this._map.on("move",this._update),this._update(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._update),this._map=void 0}_setLanguage(f){this._language=f,this._update()}setUnit(f){this.options.unit=f,this._update()}},FullscreenControl:class{constructor(f){this._fullscreen=!1,f&&f.container&&(f.container instanceof l.window.HTMLElement?this._container=f.container:l.warnOnce("Full screen control 'container' must be a DOM element.")),l.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in l.window.document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in l.window.document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(f){return this._map=f,this._container||(this._container=this._map.getContainer()),this._controlContainer=z("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",l.warnOnce("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,l.window.document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!(!l.window.document.fullscreenEnabled&&!l.window.document.webkitFullscreenEnabled)}_setupUI(){const f=this._fullscreenButton=z("button","mapboxgl-ctrl-fullscreen",this._controlContainer);z("span","mapboxgl-ctrl-icon",f).setAttribute("aria-hidden","true"),f.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),l.window.document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const f=this._getTitle();this._fullscreenButton.setAttribute("aria-label",f),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",f)}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(l.window.document.fullscreenElement||l.window.document.webkitFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?l.window.document.exitFullscreen?l.window.document.exitFullscreen():l.window.document.webkitCancelFullScreen&&l.window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},Popup:class extends l.Evented{constructor(f){super(),this.options=l.extend(Object.create(Lp),f),l.bindAll(["_update","_onClose","remove","_onMouseEvent"],this),this._classList=new Set(f&&f.className?f.className.trim().split(/\s+/):[])}addTo(f){return this._map&&this.remove(),this._map=f,this.options.closeOnClick&&f.on("preclick",this._onClose),this.options.closeOnMove&&f.on("move",this._onClose),f.on("remove",this.remove),this._update(),f._addPopup(this),this._focusFirstElement(),this._trackPointer?(f.on("mousemove",this._onMouseEvent),f.on("mouseup",this._onMouseEvent),f._canvasContainer.classList.add("mapboxgl-track-pointer")):f.on("move",this._update),this.fire(new l.Event("open")),this}isOpen(){return!!this._map}remove(){this._content&&this._content.remove(),this._container&&(this._container.remove(),this._container=void 0);const f=this._map;return f&&(f.off("move",this._update),f.off("move",this._onClose),f.off("preclick",this._onClose),f.off("click",this._onClose),f.off("remove",this.remove),f.off("mousemove",this._onMouseEvent),f.off("mouseup",this._onMouseEvent),f.off("drag",this._onMouseEvent),f._canvasContainer&&f._canvasContainer.classList.remove("mapboxgl-track-pointer"),f._removePopup(this),this._map=void 0),this.fire(new l.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(f){this._lngLat=l.LngLat.convert(f),this._pos=null,this._trackPointer=!1,this._update();const s=this._map;return s&&(s.on("move",this._update),s.off("mousemove",this._onMouseEvent),s._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}trackPointer(){this._trackPointer=!0,this._pos=null,this._update();const f=this._map;return f&&(f.off("move",this._update),f.on("mousemove",this._onMouseEvent),f.on("drag",this._onMouseEvent),f._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(f){return this.setDOMContent(l.window.document.createTextNode(f))}setHTML(f){const s=l.window.document.createDocumentFragment(),h=l.window.document.createElement("body");let g;for(h.innerHTML=f;g=h.firstChild,g;)s.appendChild(g);return this.setDOMContent(s)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(f){return this.options.maxWidth=f,this._update(),this}setDOMContent(f){let s=this._content;if(s)for(;s.hasChildNodes();)s.firstChild&&s.removeChild(s.firstChild);else s=this._content=z("div","mapboxgl-popup-content",this._container||void 0);if(s.appendChild(f),this.options.closeButton){const h=this._closeButton=z("button","mapboxgl-popup-close-button",s);h.type="button",h.setAttribute("aria-label","Close popup"),h.setAttribute("aria-hidden","true"),h.innerHTML="×",h.addEventListener("click",this._onClose)}return this._update(),this._focusFirstElement(),this}addClassName(f){return this._classList.add(f),this._updateClassList(),this}removeClassName(f){return this._classList.delete(f),this._updateClassList(),this}setOffset(f){return this.options.offset=f,this._update(),this}toggleClassName(f){let s;return this._classList.delete(f)?s=!1:(this._classList.add(f),s=!0),this._updateClassList(),s}_onMouseEvent(f){this._update(f.point)}_getAnchor(f){if(this.options.anchor)return this.options.anchor;const s=this._map,h=this._container,g=this._pos;if(!s||!h||!g)return"bottom";const v=h.offsetWidth,b=h.offsetHeight,A=g.xs.transform.width-v/2;if(g.y+fs.transform.height-b){if(A)return"bottom-left";if(I)return"bottom-right"}return A?"left":I?"right":"bottom"}_updateClassList(){const f=this._container;if(!f)return;const s=[...this._classList];s.push("mapboxgl-popup"),this._anchor&&s.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&s.push("mapboxgl-popup-track-pointer"),f.className=s.join(" ")}_update(f){const s=this._map,h=this._content;if(!s||!this._lngLat&&!this._trackPointer||!h)return;let g=this._container;if(g||(g=this._container=z("div","mapboxgl-popup",s.getContainer()),this._tip=z("div","mapboxgl-popup-tip",g),g.appendChild(h)),this.options.maxWidth&&g.style.maxWidth!==this.options.maxWidth&&(g.style.maxWidth=this.options.maxWidth),s.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=Ml(this._lngLat,this._pos,s.transform)),!this._trackPointer||f){const v=this._pos=this._trackPointer&&f?f:s.project(this._lngLat),b=B0(this.options.offset),A=this._anchor=this._getAnchor(b.y),I=B0(this.options.offset,A),D=v.add(I).round();s._requestDomTask(()=>{this._container&&A&&(this._container.style.transform=`${Us[A]} translate(${D.x}px,${D.y}px)`)})}if(!this._marker&&s._showingGlobe()){const v=l.isLngLatBehindGlobe(s.transform,this._lngLat)?0:1;this._setOpacity(v)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const f=this._container.querySelector(fx);f&&f.focus()}_onClose(){this.remove()}_setOpacity(f){this._container&&(this._container.style.opacity=`${f}`),this._content&&(this._content.style.pointerEvents=f?"auto":"none")}},Marker:xt,Style:Xo,LngLat:l.LngLat,LngLatBounds:l.LngLatBounds,Point:l.Point,MercatorCoordinate:l.MercatorCoordinate,FreeCameraOptions:E0,Evented:l.Evented,config:l.config,prewarm:function(){ml().acquire(qo)},clearPrewarmedResources:function(){const f=_i;f&&(f.isPreloaded()&&f.numActive()===1?(f.release(qo),_i=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},get accessToken(){return l.config.ACCESS_TOKEN},set accessToken(f){l.config.ACCESS_TOKEN=f},get baseApiUrl(){return l.config.API_URL},set baseApiUrl(f){l.config.API_URL=f},get workerCount(){return Vn.workerCount},set workerCount(f){Vn.workerCount=f},get maxParallelImageRequests(){return l.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(f){l.config.MAX_PARALLEL_IMAGE_REQUESTS=f},clearStorage(f){l.clearTileCache(f)},workerUrl:"",workerClass:null,setNow:l.exported.setNow,restoreNow:l.exported.restoreNow};return zl});var _=u;return _})})(I3);var hT=I3.exports;const y$=XE(hT),_$=bL({__proto__:null,default:y$},[hT]);var Jt={},Nt={},k3={},P3={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.Origin="origin",e.ShowEmbed="show-embed",e.ShowPin="show-pin",e.ShowSave="show-save",e.ShowShare="show-share"}(t.AskDataAttributes||(t.AskDataAttributes={}))})(P3);var dT={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.CSV="csv",e.Excel="xlsx"}(t.CrosstabFileFormat||(t.CrosstabFileFormat={})),function(e){e.Default="default",e.Desktop="desktop",e.Tablet="tablet",e.Phone="phone"}(t.DeviceType||(t.DeviceType={})),function(e){e.AuthFailed="auth-failed",e.BrowserNotCapable="browser-not-capable",e.DownloadWorkbookNotAllowed="download-workbook-not-allowed",e.FilterCannotBePerformed="filter-cannot-be-performed",e.IndexOutOfRange="index-out-of-range",e.InternalError="internal-error",e.InvalidCustomViewName="invalid-custom-view-name",e.InvalidDateParameter="invalid-date-parameter",e.invalidFilterFieldNameOrValue="invalid-filter-field-name",e.InvalidParameter="invalid-parameter",e.InvalidSize="invalid-size",e.InvalidSheetType="invalid-sheet-type",e.InvalidSizeBehavior="invalid-size-behavior",e.InvalidSizeBehaviorOnWorksheet="invalid-size-behavior-on-worksheet",e.InvalidUrl="invalid-url",e.MissingMaxSize="missing-max-size",e.MissingMinSize="missing-min-size",e.MissingMinMaxSize="missing-min-max-size",e.MissingParameter="missing-parameter",e.MissingRangeNForRelativeDateFilters="missing-range-n-for-relative-date-filters",e.NoUrlForHiddenWorksheet="no-url-for-hidden-worksheet",e.NoUrlOrParentElementNotFound="no-url-or-parent-element-not-found",e.NotActiveSheet="not-active-sheet",e.NullOrEmptyParameter="null-or-empty-parameter",e.SheetNotInWorkbook="sheet-not-in-workbook",e.StaleDataReference="stale-data-reference",e.UnknownAuthError="unknown-auth-error",e.UnsupportedEventName="unsupported-event-name",e.VizAlreadyInManager="viz-already-in-manager",e.ImplementationError="wrong-implementation",e.NotImplemented="not-implemented",e.EventInitializationError="event-initialization-error",e.IncompatibleVersionError="incompatible-version-error",e.UnknownDialogType="unknown-dialog-type",e.FilterMissingOrNotImplemented="filter-missing-not-implemented",e.StoryPointIdMismatch="storypoint-id-mismatch"}(t.EmbeddingErrorCodes||(t.EmbeddingErrorCodes={})),function(e){e.PDF="pdf",e.PNG="png"}(t.FileFormats||(t.FileFormats={})),function(e){e.Portrait="portrait",e.Landscape="landscape"}(t.PrintOrientation||(t.PrintOrientation={})),function(e){e.Letter="letter",e.Legal="legal",e.Note="note",e.Folio="folio",e.Tabloid="tabloid",e.Ledger="ledger",e.Statement="statement",e.Executive="executive",e.A3="A3",e.A4="A4",e.A5="A5",e.B4="B4",e.B5="B5",e.Quarto="quarto",e.Unspecified="unspecified"}(t.PrintPageSize||(t.PrintPageSize={})),function(e){e.Automatic="automatic",e.Perc25="25%",e.Perc50="50%",e.Perc60="60%",e.Perc75="75%",e.Perc80="80%",e.Perc90="90%",e.Perc100="100%",e.Perc200="200%",e.Perc400="400%",e.AtMost1PageHigh="at-most-1-page-high",e.AtMost2PagesHigh="at-most-2-pages-high",e.AtMost1PageWide="at-most-1-page-wide",e.AtMost2PagesWide="at-most-2-pages-wide"}(t.PrintScaling||(t.PrintScaling={})),function(e){e.All="all",e.Axes="axes",e.Filters="filters",e.Sorts="sorts",e.Shelves="shelves"}(t.RevertVizSelection||(t.RevertVizSelection={})),function(e){e.Alerts="alerts",e.AskData="askData",e.CustomViews="customViews",e.DataDetails="dataDetails",e.Share="share",e.Subscribe="subscribe"}(t.ToolbarButtons||(t.ToolbarButtons={})),function(e){e.Top="top",e.Bottom="bottom",e.Hidden="hidden"}(t.Toolbar||(t.Toolbar={})),function(e){e.Automatic="automatic",e.Exactly="exactly",e.Range="range",e.AtLeast="atleast",e.AtMost="atmost"}(t.SheetSizeBehavior||(t.SheetSizeBehavior={})),function(e){e.Default="default",e.Card="card",e.Ban="ban"}(t.PulseLayout||(t.PulseLayout={})),function(e){e.CustomViewLoaded="customviewloaded",e.CustomViewRemoved="customviewremoved",e.CustomViewSaved="customviewsaved",e.CustomViewSetDefault="customviewsetdefault",e.EditButtonClicked="editbuttonclicked",e.EditInDesktopButtonClicked="editindesktopbuttonclicked",e.FilterChanged="filterchanged",e.FirstVizSizeKnown="firstvizsizeknown",e.FirstInteractive="firstinteractive",e.CustomMarkContextMenuEvent="custommarkcontextmenu",e.MarkSelectionChanged="markselectionchanged",e.ParameterChanged="parameterchanged",e.ToolbarStateChanged="toolbarstatechanged",e.WorkbookReadyToClose="workbookreadytoclose",e.WorkbookPublished="workbookpublished",e.WorkbookPublishedAs="workbookpublishedas",e.UrlAction="urlaction",e.TabSwitched="tabswitched",e.StoryPointSwitched="storypointswitched",e.VizLoadError="vizloaderror",e.IframeSrcUpdated="iframesrcupdated",e.SummaryDataChanged="summarydatachanged",e.ReadyToReceiveAuthToken="readytoreceiveauthtoken"}(t.TableauEventType||(t.TableauEventType={})),function(e){e.Ubertip="ubertip"}(t.ApiMenuType||(t.ApiMenuType={})),function(e){e.ExportPDF="export-pdf",e.ExportPowerPoint="export-powerpoint",e.ExportData="export-data",e.ExportCrossTab="export-cross-tab",e.ExportWorkbook="export-workbook",e.Share="share"}(t.TableauDialogType||(t.TableauDialogType={}))})(dT);var D3={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.DisableExploreFilter="disable-explore-filter",e.Layout="layout"}(t.PulseAttributes||(t.PulseAttributes={})),function(e){e.IframeStyle="iframe-style"}(t.PulseChildElements||(t.PulseChildElements={}))})(D3);var M3={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.TouchOptimize="touch-optimize",e.HideEditInDesktopButton="hide-edit-in-desktop-button",e.SuppressDefaultEditBehavior="suppress-default-edit-behavior",e.DisableVersionCheck="disable-version-check",e.OnEditInDesktopButtonClicked="onEditInDesktopButtonClicked",e.OnFirstVizSizeKnown="onFirstVizSizeKnown",e.OnFirstInteractive="onFirstInteractive"}(t.VizSharedAttributes||(t.VizSharedAttributes={})),function(e){e.DisableUrlActionsPopups="disable-url-actions",e.HideTabs="hide-tabs",e.Toolbar="toolbar",e.InstanceIdToClone="instance-id-to-clone",e.Device="device",e.HideEditButton="hide-edit-button",e.OnEditButtonClicked="onEditButtonClicked",e.OnFilterChanged="onFilterChanged",e.OnCustomMarkContextMenuEvent="onCustomMarkContextMenuEvent",e.OnMarkSelectionChanged="onMarkSelectionChanged",e.OnParameterChanged="onParameterChanged",e.OnToolbarStateChanged="onToolbarStateChanged",e.OnUrlAction="onUrlAction",e.OnTabSwitched="onTabSwitched",e.OnCustomViewLoaded="onCustomViewLoaded",e.OnCustomViewRemoved="onCustomViewRemoved",e.OnCustomViewSaved="onCustomViewSaved",e.OnCustomViewSetDefault="onCustomViewSetDefault",e.OnStoryPointSwitched="onStoryPointSwitched",e.OnSummaryDataChanged="onSummaryDataChanged",e.OnReadyToReceiveAuthToken="onReadyToReceiveAuthToken"}(t.VizAttributes||(t.VizAttributes={})),function(e){e.OnWorkbookPublished="onWorkbookPublished",e.OnWorkbookPublishedAs="onWorkbookPublishedAs",e.OnWorkbookReadyToClose="onWorkbookReadyToClose",e.HideCloseButton="hide-close-button"}(t.VizAuthoringAttributes||(t.VizAuthoringAttributes={})),function(e){e.VizFilter="viz-filter",e.VizParameter="viz-parameter",e.CustomParameter="custom-parameter",e.IframeStyle="iframe-style"}(t.VizChildElements||(t.VizChildElements={})),function(e){e.Field="field",e.Value="value",e.Name="name"}(t.VizChildElementAttributes||(t.VizChildElementAttributes={}))})(M3);var z3={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.Src="src",e.Width="width",e.Height="height",e.Token="token",e.Debug="debug",e.IframeAuth="iframe-auth",e.OnVizLoadError="onvizloaderror",e.ForceTokenSync="force-token-sync"}(t.WebComponentAttributes||(t.WebComponentAttributes={})),function(e){e.Loading="iframe-attr-loading",e.Style="iframe-attr-style",e.Class="iframe-attr-class"}(t.EmbeddedIframeAttributes||(t.EmbeddedIframeAttributes={})),function(e){e.CustomParameter="custom-parameter",e.IframeStyle="iframe-style"}(t.WebComponentChildElements||(t.WebComponentChildElements={})),function(e){e.Field="field",e.Value="value",e.Name="name"}(t.WebComponentChildElementAttributes||(t.WebComponentChildElementAttributes={}))})(z3);var pT={},R3={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.CrosstabCreationError="crosstab-creation-error",e.DataCreationError="data-creation-error",e.InvalidAggregationFieldName="invalid-aggregation-field-name",e.InvalidFilterFieldName="invalid-filter-name",e.InvalidFilterFieldValue="invalid-filter-fieldValue",e.InvalidSelectionDate="invalid-selection-date",e.InvalidSelectionFieldName="invalid-selection-fieldName",e.InvalidSelectionValue="invalid-selection-value",e.InvalidSelectionSheet="invalid-selection-sheet",e.InternalError="internal-error",e.InvalidParameter="invalid-parameter",e.PDFCreationError="pdf-creation-error",e.PowerPointCreationError="powerpoint-creation-error",e.NotActiveSheet="not-active-sheet",e.ImplementationError="wrong-implementation",e.ApiExecutionError="api-execution-error",e.ServerError="server-error",e.Timeout="timeout"}(t.SharedErrorCodes||(t.SharedErrorCodes={}))})(R3);var UE=$e&&$e.__assign||function(){return UE=Object.assign||function(t){for(var e,n=1,a=arguments.length;n"u"&&fb!==void 0?function(t){return typeof t=="function"||t===fb}:function(t){return typeof t=="function"},W$=ks,Ud=function(t){return typeof t=="object"?t!==null:W$(t)},mb=Xa,G$=ks,H$=function(t){return G$(t)?t:void 0},H3=function(t,e){return arguments.length<2?H$(mb[t]):mb[t]&&mb[t][e]},q$=Cs,Z$=q$({}.isPrototypeOf),K$=typeof navigator<"u"&&String(navigator.userAgent)||"",q3=Xa,gb=K$,EP=q3.process,SP=q3.Deno,TP=EP&&EP.versions||SP&&SP.version,AP=TP&&TP.v8,$a,M_;AP&&($a=AP.split("."),M_=$a[0]>0&&$a[0]<4?1:+($a[0]+$a[1]));!M_&&gb&&($a=gb.match(/Edge\/(\d+)/),(!$a||$a[1]>=74)&&($a=gb.match(/Chrome\/(\d+)/),$a&&(M_=+$a[1])));var X$=M_,IP=X$,Y$=dl,Q$=Xa,J$=Q$.String,Z3=!!Object.getOwnPropertySymbols&&!Y$(function(){var t=Symbol("symbol detection");return!J$(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&IP&&IP<41}),eW=Z3,K3=eW&&!Symbol.sham&&typeof Symbol.iterator=="symbol",tW=H3,rW=ks,nW=Z$,iW=K3,oW=Object,X3=iW?function(t){return typeof t=="symbol"}:function(t){var e=tW("Symbol");return rW(e)&&nW(e.prototype,oW(t))},aW=String,sW=function(t){try{return aW(t)}catch{return"Object"}},lW=ks,cW=sW,uW=TypeError,hW=function(t){if(lW(t))return t;throw new uW(cW(t)+" is not a function")},dW=hW,pW=W3,fW=function(t,e){var n=t[e];return pW(n)?void 0:dW(n)},yb=uv,_b=ks,vb=Ud,mW=TypeError,gW=function(t,e){var n,a;if(e==="string"&&_b(n=t.toString)&&!vb(a=yb(n,t))||_b(n=t.valueOf)&&!vb(a=yb(n,t))||e!=="string"&&_b(n=t.toString)&&!vb(a=yb(n,t)))return a;throw new mW("Can't convert object to primitive value")},Y3={exports:{}},CP=Xa,yW=Object.defineProperty,vT=function(t,e){try{yW(CP,t,{value:e,configurable:!0,writable:!0})}catch{CP[t]=e}return e},_W=Xa,vW=vT,kP="__core-js_shared__",PP=Y3.exports=_W[kP]||vW(kP,{});(PP.versions||(PP.versions=[])).push({version:"3.37.1",mode:"global",copyright:"© 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.37.1/LICENSE",source:"https://github.com/zloirock/core-js"});var xT=Y3.exports,DP=xT,Q3=function(t,e){return DP[t]||(DP[t]=e||{})},xW=G3,bW=Object,J3=function(t){return bW(xW(t))},wW=Cs,EW=J3,SW=wW({}.hasOwnProperty),Bu=Object.hasOwn||function(e,n){return SW(EW(e),n)},TW=Cs,AW=0,IW=Math.random(),CW=TW(1 .toString),eO=function(t){return"Symbol("+(t===void 0?"":t)+")_"+CW(++AW+IW,36)},kW=Xa,PW=Q3,MP=Bu,DW=eO,MW=Z3,zW=K3,pd=kW.Symbol,xb=PW("wks"),RW=zW?pd.for||pd:pd&&pd.withoutSetter||DW,OW=function(t){return MP(xb,t)||(xb[t]=MW&&MP(pd,t)?pd[t]:RW("Symbol."+t)),xb[t]},FW=uv,zP=Ud,RP=X3,LW=fW,BW=gW,NW=OW,UW=TypeError,jW=NW("toPrimitive"),VW=function(t,e){if(!zP(t)||RP(t))return t;var n=LW(t,jW),a;if(n){if(e===void 0&&(e="default"),a=FW(n,t,e),!zP(a)||RP(a))return a;throw new UW("Can't convert object to primitive value")}return e===void 0&&(e="number"),BW(t,e)},$W=VW,WW=X3,tO=function(t){var e=$W(t,"string");return WW(e)?e:e+""},GW=Xa,OP=Ud,WE=GW.document,HW=OP(WE)&&OP(WE.createElement),qW=function(t){return HW?WE.createElement(t):{}},ZW=Ec,KW=dl,XW=qW,rO=!ZW&&!KW(function(){return Object.defineProperty(XW("div"),"a",{get:function(){return 7}}).a!==7}),YW=Ec,QW=uv,JW=yT,eG=N3,tG=_T,rG=tO,nG=Bu,iG=rO,FP=Object.getOwnPropertyDescriptor;gT.f=YW?FP:function(e,n){if(e=tG(e),n=rG(n),iG)try{return FP(e,n)}catch{}if(nG(e,n))return eG(!QW(JW.f,e,n),e[n])};var hv={},oG=Ec,aG=dl,sG=oG&&aG(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42}),lG=Ud,cG=String,uG=TypeError,nO=function(t){if(lG(t))return t;throw new uG(cG(t)+" is not an object")},hG=Ec,dG=rO,pG=sG,Xg=nO,LP=tO,fG=TypeError,bb=Object.defineProperty,mG=Object.getOwnPropertyDescriptor,wb="enumerable",Eb="configurable",Sb="writable";hv.f=hG?pG?function(e,n,a){if(Xg(e),n=LP(n),Xg(a),typeof e=="function"&&n==="prototype"&&"value"in a&&Sb in a&&!a[Sb]){var u=mG(e,n);u&&u[Sb]&&(e[n]=a.value,a={configurable:Eb in a?a[Eb]:u[Eb],enumerable:wb in a?a[wb]:u[wb],writable:!1})}return bb(e,n,a)}:bb:function(e,n,a){if(Xg(e),n=LP(n),Xg(a),dG)try{return bb(e,n,a)}catch{}if("get"in a||"set"in a)throw new fG("Accessors not supported");return"value"in a&&(e[n]=a.value),e};var gG=Ec,yG=hv,_G=N3,iO=gG?function(t,e,n){return yG.f(t,e,_G(1,n))}:function(t,e,n){return t[e]=n,t},oO={exports:{}},GE=Ec,vG=Bu,aO=Function.prototype,xG=GE&&Object.getOwnPropertyDescriptor,bT=vG(aO,"name"),bG=bT&&(function(){}).name==="something",wG=bT&&(!GE||GE&&xG(aO,"name").configurable),EG={EXISTS:bT,PROPER:bG,CONFIGURABLE:wG},SG=Cs,TG=ks,HE=xT,AG=SG(Function.toString);TG(HE.inspectSource)||(HE.inspectSource=function(t){return AG(t)});var IG=HE.inspectSource,CG=Xa,kG=ks,BP=CG.WeakMap,PG=kG(BP)&&/native code/.test(String(BP)),DG=Q3,MG=eO,NP=DG("keys"),zG=function(t){return NP[t]||(NP[t]=MG(t))},sO={},RG=PG,lO=Xa,OG=Ud,FG=iO,Tb=Bu,Ab=xT,LG=zG,BG=sO,UP="Object already initialized",qE=lO.TypeError,NG=lO.WeakMap,z_,zm,R_,UG=function(t){return R_(t)?zm(t):z_(t,{})},jG=function(t){return function(e){var n;if(!OG(e)||(n=zm(e)).type!==t)throw new qE("Incompatible receiver, "+t+" required");return n}};if(RG||Ab.state){var fs=Ab.state||(Ab.state=new NG);fs.get=fs.get,fs.has=fs.has,fs.set=fs.set,z_=function(t,e){if(fs.has(t))throw new qE(UP);return e.facade=t,fs.set(t,e),e},zm=function(t){return fs.get(t)||{}},R_=function(t){return fs.has(t)}}else{var jh=LG("state");BG[jh]=!0,z_=function(t,e){if(Tb(t,jh))throw new qE(UP);return e.facade=t,FG(t,jh,e),e},zm=function(t){return Tb(t,jh)?t[jh]:{}},R_=function(t){return Tb(t,jh)}}var VG={set:z_,get:zm,has:R_,enforce:UG,getterFor:jG},wT=Cs,$G=dl,WG=ks,Yg=Bu,ZE=Ec,GG=EG.CONFIGURABLE,HG=IG,cO=VG,qG=cO.enforce,ZG=cO.get,jP=String,Yy=Object.defineProperty,KG=wT("".slice),XG=wT("".replace),YG=wT([].join),QG=ZE&&!$G(function(){return Yy(function(){},"length",{value:8}).length!==8}),JG=String(String).split("String"),eH=oO.exports=function(t,e,n){KG(jP(e),0,7)==="Symbol("&&(e="["+XG(jP(e),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),n&&n.getter&&(e="get "+e),n&&n.setter&&(e="set "+e),(!Yg(t,"name")||GG&&t.name!==e)&&(ZE?Yy(t,"name",{value:e,configurable:!0}):t.name=e),QG&&n&&Yg(n,"arity")&&t.length!==n.arity&&Yy(t,"length",{value:n.arity});try{n&&Yg(n,"constructor")&&n.constructor?ZE&&Yy(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch{}var a=qG(t);return Yg(a,"source")||(a.source=YG(JG,typeof e=="string"?e:"")),t};Function.prototype.toString=eH(function(){return WG(this)&&ZG(this).source||HG(this)},"toString");var tH=oO.exports,rH=ks,nH=hv,iH=tH,oH=vT,aH=function(t,e,n,a){a||(a={});var u=a.enumerable,d=a.name!==void 0?a.name:e;if(rH(n)&&iH(n,d,a),a.global)u?t[e]=n:oH(e,n);else{try{a.unsafe?t[e]&&(u=!0):delete t[e]}catch{}u?t[e]=n:nH.f(t,e,{value:n,enumerable:!1,configurable:!a.nonConfigurable,writable:!a.nonWritable})}return t},uO={},sH=Math.ceil,lH=Math.floor,cH=Math.trunc||function(e){var n=+e;return(n>0?lH:sH)(n)},uH=cH,hO=function(t){var e=+t;return e!==e||e===0?0:uH(e)},hH=hO,dH=Math.max,pH=Math.min,fH=function(t,e){var n=hH(t);return n<0?dH(n+e,0):pH(n,e)},mH=hO,gH=Math.min,yH=function(t){var e=mH(t);return e>0?gH(e,9007199254740991):0},_H=yH,vH=function(t){return _H(t.length)},xH=_T,bH=fH,wH=vH,VP=function(t){return function(e,n,a){var u=xH(e),d=wH(u);if(d===0)return!t&&-1;var _=bH(a,d),l;if(t&&n!==n){for(;d>_;)if(l=u[_++],l!==l)return!0}else for(;d>_;_++)if((t||_ in u)&&u[_]===n)return t||_||0;return!t&&-1}},EH={includes:VP(!0),indexOf:VP(!1)},SH=Cs,Ib=Bu,TH=_T,AH=EH.indexOf,IH=sO,$P=SH([].push),dO=function(t,e){var n=TH(t),a=0,u=[],d;for(d in n)!Ib(IH,d)&&Ib(n,d)&&$P(u,d);for(;e.length>a;)Ib(n,d=e[a++])&&(~AH(u,d)||$P(u,d));return u},pO=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],CH=dO,kH=pO,PH=kH.concat("length","prototype");uO.f=Object.getOwnPropertyNames||function(e){return CH(e,PH)};var ET={};ET.f=Object.getOwnPropertySymbols;var DH=H3,MH=Cs,zH=uO,RH=ET,OH=nO,FH=MH([].concat),LH=DH("Reflect","ownKeys")||function(e){var n=zH.f(OH(e)),a=RH.f;return a?FH(n,a(e)):n},WP=Bu,BH=LH,NH=gT,UH=hv,jH=function(t,e,n){for(var a=BH(e),u=UH.f,d=NH.f,_=0;_d;)for(var w=xq(arguments[d++]),T=_?bq(Cb(w),_(w)):Cb(w),C=T.length,P=0,z;C>P;)z=T[P++],(!GP||mq(l,w,z))&&(a[z]=w[z]);return a}:Vh,Eq=ST,qP=wq;Eq({target:"Object",stat:!0,arity:2,forced:Object.assign!==qP},{assign:qP});var Sq=TT;Sq.Object.assign;const Tq=1,Aq=162,Iq=0,Cq={major:Tq,minor:Aq,fix:Iq};var AT={},IT={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.Desktop="desktop",e.Server="server",e.Unknown="unknown"}(t.ExtensionContext||(t.ExtensionContext={})),function(e){e.Authoring="authoring",e.Viewing="viewing",e.Unknown="unknown"}(t.ExtensionMode||(t.ExtensionMode={})),function(e){e.Mark="mark",e.Point="point",e.Area="area"}(t.AnnotateEnum||(t.AnnotateEnum={})),function(e){e.Discrete="discrete",e.Continuous="continuous",e.Unknown="unknown"}(t.ColumnType||(t.ColumnType={})),function(e){e.Blank="blank",e.Worksheet="worksheet",e.QuickFilter="quick-filter",e.ParameterControl="parameter-control",e.PageFilter="page-filter",e.Legend="legend",e.Title="title",e.Text="text",e.Image="image",e.WebPage="web-page",e.Extension="extension"}(t.DashboardObjectType||(t.DashboardObjectType={})),function(e){e.String="string",e.Int="int",e.Float="float",e.Bool="bool",e.Date="date",e.DateTime="date-time",e.Spatial="spatial",e.Unknown="unknown"}(t.DataType||(t.DataType={})),function(e){e.Window="window",e.Modal="modal",e.Modeless="modeless"}(t.DialogStyle||(t.DialogStyle={})),function(e){e.Number="number",e.String="string",e.Date="date",e.Boolean="boolean"}(t.EncodedDataType||(t.EncodedDataType={})),function(e){e.INITIALIZATION_ERROR="initialization-error",e.INTERNAL_ERROR="internal-error",e.MISSING_ENUM_MAPPING="missing-enum-mapping",e.MISSING_PARAMETER="missing-parameter",e.PERMISSION_DENIED="permission-denied",e.PRES_MODEL_PARSING_ERROR="pres-model-parsing-error",e.VERSION_NOT_CONFIGURED="version-not-configured",e.VISIBILITY_ERROR="visibility-error",e.UNKNOWN_VERB_ID="unknown-verb-id"}(t.ErrorCodes||(t.ErrorCodes={})),function(e){e.Sum="sum",e.Avg="avg",e.Min="min",e.Max="max",e.Stdev="stdev",e.Stdevp="stdevp",e.Var="var",e.Varp="varp",e.Collect="collect",e.Count="count",e.Countd="countd",e.Median="median",e.Attr="attr",e.None="none",e.Year="year",e.Qtr="qtr",e.Month="month",e.Day="day",e.Hour="hour",e.Minute="minute",e.Second="second",e.Week="week",e.Weekday="weekday",e.MonthYear="month-year",e.Mdy="mdy",e.End="end",e.TruncYear="trunc-year",e.TruncQtr="trunc-qtr",e.TruncMonth="trunc-month",e.TruncWeek="trunc-week",e.TruncDay="trunc-day",e.TruncHour="trunc-hour",e.TruncMinute="trunc-minute",e.TruncSecond="trunc-second",e.Quart1="quart1",e.Quart3="quart3",e.Skewness="skewness",e.Kurtosis="kurtosis",e.InOut="in-out",e.User="user"}(t.FieldAggregationType||(t.FieldAggregationType={})),function(e){e.Dimension="dimension",e.Measure="measure",e.Unknown="unknown"}(t.FieldRoleType||(t.FieldRoleType={})),function(e){e.Add="add",e.All="all",e.Replace="replace",e.Remove="remove"}(t.FilterUpdateType||(t.FilterUpdateType={})),function(e){e.Dashboard="dashboard",e.Story="story",e.Worksheet="worksheet"}(t.SheetType||(t.SheetType={})),function(e){e.All="all",e.List="list",e.Range="range"}(t.DomainRestrictionType||(t.DomainRestrictionType={})),function(e){e.Years="years",e.Quarters="quarters",e.Months="months",e.Weeks="weeks",e.Days="days",e.Hours="hours",e.Minutes="minutes",e.Seconds="seconds"}(t.DateStepPeriod||(t.DateStepPeriod={})),function(e){e.NullValues="nullvalues",e.NonNullValues="nonnullvalues",e.AllValues="allvalues"}(t.FilterNullOption||(t.FilterNullOption={})),function(e){e.Relevant="relevant",e.Database="database"}(t.FilterDomainType||(t.FilterDomainType={})),function(e){e.Replace="select-replace",e.Add="select-add",e.Remove="select-remove"}(t.SelectionUpdateType||(t.SelectionUpdateType={})),function(e){e.Simple="select-options-simple",e.Toggle="select-options-toggle",e.Menu="select-options-menu",e.Range="select-options-range",e.Search="select-options-search"}(t.SelectOptions||(t.SelectOptions={})),function(e){e.IncludeNull="include-null",e.IncludeNonNull="include-non-null",e.IncludeAll="include-all"}(t.QuantitativeIncludedValues||(t.QuantitativeIncludedValues={})),function(e){e.AllSelected="all-selected",e.NoneSelected="none-selected",e.SomeSelected="some-selected",e.UnknownSelected="unknown-selected"}(t.HierarchicalLevelSelectionState||(t.HierarchicalLevelSelectionState={})),function(e){e.Bar="bar",e.Line="line",e.Area="area",e.Square="square",e.Circle="circle",e.Shape="shape",e.Text="text",e.Map="map",e.Pie="pie",e.GanttBar="gantt-bar",e.Polygon="polygon",e.Heatmap="heatmap",e.VizExtension="viz-extension"}(t.MarkType||(t.MarkType={})),function(e){e.Categorical="categorical",e.Range="range",e.RelativeDate="relativeDate",e.Hierarchical="hierarchical"}(t.FilterType||(t.FilterType={})),function(e){e.Last="last",e.LastN="lastN",e.Next="next",e.NextN="nextN",e.Current="current",e.ToDate="toDate"}(t.DateRangeType||(t.DateRangeType={})),function(e){e.DialogAlreadyOpen="dialog-already-open",e.InvalidDomain="invalid-domain",e.Success="success"}(t.ExtensionDialogResult||(t.ExtensionDialogResult={})),function(e){e.SingleTableId="single-table-id-sentinel",e.SingleTableCaption="Single table id sentinel"}(t.ApiShowDataTableSentinel||(t.ApiShowDataTableSentinel={})),function(e){e.NativeValuesOnly="native-values-only",e.FormattedValuesOnly="formatted-values-only",e.NativeAndFormattedValues="native-and-formatted-values"}(t.ApiShowDataTableFormat||(t.ApiShowDataTableFormat={})),function(e){e.Letter="letter",e.Legal="legal",e.Note="note",e.Folio="folio",e.Tabloid="tabloid",e.Ledger="ledger",e.Statement="statement",e.Executive="executive",e.A3="a3",e.A4="a4",e.A5="a5",e.B4="b4",e.B5="b5",e.Quarto="quarto",e.Unspecified="unspecified"}(t.PageSizeOption||(t.PageSizeOption={})),function(e){e.Printer="printer",e.Portrait="portrait",e.Landscape="landscape"}(t.PageOrientation||(t.PageOrientation={})),function(e){e.ScaleAuto="auto",e.ScalePercentage="percent",e.ScaleFitPages="fit-pages"}(t.ScaleMode||(t.ScaleMode={})),function(e){e.ScalePctAuto="auto",e.ScalePct400="pct400",e.ScalePct200="pct200",e.ScalePct100="pct100",e.ScalePct90="pct90",e.ScalePct80="pct80",e.ScalePct75="pct75",e.ScalePct60="pct60",e.ScalePct50="pct50",e.ScalePct25="pct25"}(t.PageScalingOption||(t.PageScalingOption={})),function(e){e.FitOneHigh="fit0x1",e.FitTwoHigh="fit0x2",e.FitOneWide="fit1x0",e.FitTwoWide="fit2x0"}(t.FitPages||(t.FitPages={})),function(e){e.Color="color",e.Size="size",e.Label="label",e.Detail="detail",e.Tooltip="tooltip",e.Shape="shape",e.Path="path",e.Angle="angle",e.Geometry="geometry",e.Custom="custom"}(t.EncodingType||(t.EncodingType={}))})(IT);Object.defineProperty(AT,"__esModule",{value:!0});var ho=IT,kq=function(){function t(){}return t.isSpecial=function(e){return e.length>2&&e[0]==="%"&&e[e.length-1]==="%"},t.parseBoolean=function(e){var n=e.toLowerCase();return n!=="true"&&n!=="false"?this.specialValueIndicator:n==="true"},t.parseNumber=function(e){var n=Number(e);return isNaN(n)?this.specialValueIndicator:n},t.parseDate=function(e){var n=new Date(e);return Number.isNaN(n.getTime())?null:n},t.parseDateTime=function(e){var n=e.replace(" ","T").concat("Z"),a=new Date(n);return Number.isNaN(a.getTime())?null:a},t.convertValueAsStringToValue=function(e,n){if(e!=null){if(this.isSpecial(e))return e;switch(n){case ho.DataType.Bool:return this.parseBoolean(e);case ho.DataType.Int:case ho.DataType.Float:return this.parseNumber(e);case ho.DataType.Date:return this.parseDate(e)===null?this.specialValueIndicator:e;case ho.DataType.DateTime:return this.parseDateTime(e)===null?this.specialValueIndicator:e;case ho.DataType.Spatial:case ho.DataType.String:default:return e}}},t.convertValueToNativeValue=function(e,n){if(e==null)return null;switch(n){case ho.DataType.Bool:return typeof e=="string"?null:e;case ho.DataType.Int:case ho.DataType.Float:return typeof e=="string"?null:e;case ho.DataType.Date:return this.parseDate(e);case ho.DataType.DateTime:return this.parseDateTime(e);case ho.DataType.String:return this.isSpecial(e)?null:e;case ho.DataType.Spatial:default:return e}},t.convertStringValueToNativeValue=function(e,n){return this.convertValueToNativeValue(this.convertValueAsStringToValue(e,n),n)},t.specialValueIndicator="%null%",t}();AT.DataTypeConverter=kq;var dv={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.CustomMarkContextMenuClicked="custom-mark-context-menu-clicked",e.ContextMenuClick="context-menu-click",e.CustomViewRemoved="custom-view-removed",e.CustomViewSaved="custom-view-saved",e.CustomViewSetDefault="custom-view-set-default",e.CustomViewsLoaded="custom-views-loaded",e.DashboardLayoutChanged="dashboard-layout-changed",e.EditButtonClicked="edit-button-clicked",e.EditInDesktopButtonClicked="edit-in-desktop-button-clicked",e.ExtensionDialogUpdate="extension-dialog-update",e.FilterChanged="filter-changed",e.FirstVizSizeKnown="first-viz-size-known",e.ParameterChanged="parameter-changed",e.SelectedMarksChanged="selected-marks-changed",e.SettingsChanged="settings-changed",e.SummaryDataChanged="summary-data-changed",e.TestConversionNotification="test-conversion-notification",e.ToolbarStateChanged="toolbar-state-changed",e.VizInteractive="viz-interactive",e.AskDataInteractive="ask-data-interactive",e.WorkbookReadyToClose="workbook-ready-to-close",e.WorkbookFormattingChanged="workbook-formatting-changed",e.WorkbookPublished="workbook-published",e.WorkbookPublishedAs="workbook-published-as",e.UrlAction="url-action",e.TabSwitched="tab-switched",e.StoryPointSwitched="story-point-switched",e.ReadyToReceiveAuthToken="ready-to-receive-auth-token"}(t.NotificationId||(t.NotificationId={}))})(dv);var fO={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.ActiveTablesInfo="active-tables-info",e.AnchorDate="anchor-date",e.AnnotateEnum="annotate-enum",e.AnnotationList="annotation-list",e.CategoricalDomain="categorical-domain",e.ClickThroughEnabled="click-through-enabled",e.ColumnsToInclude="columns-to-include",e.ColumnsToIncludeById="columns-to-include-by-id",e.ConnectionDescriptionSummaries="connection-description-summaries",e.CurrentSheetType="current-sheet-type",e.CustomView="custom-view",e.CustomViewIsDefault="custom-view-is-default",e.CustomViewIsPublic="custom-view-is-public",e.CustomViewLuid="custom-view-luid",e.CustomViewName="custom-view-name",e.CustomViews="custom-views",e.Dashboard="dashboard",e.DashboardFilters="dashboard-filters",e.DashboardName="dashboard",e.DashboardObjectPositionAndSizeUpdate="dashboard-object-position-and-size-update",e.DashboardObjectPositionAndSizeUpdateList="dashboard-object-position-and-size-update-list",e.DataRowIndex="data-row-index",e.DataSchema="data-schema",e.DataSource="data-source",e.DataSourceDataTable="data-source-data-table",e.DataSourceId="data-source-id",e.DataSourceName="data-source-name",e.DataTable="data-table",e.DataTableReader="data-table-reader",e.DateRangeType="date-range-type",e.DeltaTimeMs="delta-time-ms",e.DimValSelectionModels="dimensionValueSelectionModels",e.DomainType="domain-type",e.EmbeddingAbstractQuery="embedding-abstract-query",e.EmbeddingBootstrapInfo="embedding-bootstrap-info",e.ExportCrosstabSheetMap="export-crosstab-sheet-map",e.ExportFile="export-file",e.ExportOriginUrl="export-origin-url",e.ExportPdfOptions="export-pdf-options",e.ExtensionBootstrapInfo="extension-bootstrap-info",e.ExtensionContextMenuIds="extension-context-menu-ids",e.ExtensionDialogH="extension-dialog-height",e.ExtensionDialogPayload="extension-dialog-payload",e.ExtensionDialogResult="extension-dialog-result",e.ExtensionDialogStyle="extension-dialog-style",e.ExtensionDialogUrl="extension-dialog-url",e.ExtensionDialogW="extension-dialog-width",e.ExtensionLocator="extension-locator",e.ExtensionSettingsInfo="extension-settings-info",e.ExtensionZoneId="extension-zone-id",e.ExternalMenuDescription="external-menu-description",e.ExternalMenuHeader="external-menu-header",e.ExternalMenuItemDisplayName="external-menu-item-display-name",e.ExternalMenuItemId="external-menu-item-id",e.Field="field",e.FieldId="field-id",e.FieldName="field-name",e.FilterLevels="filter-levels",e.FilterRangeMax="filter-range-max",e.FilterRangeMin="filter-range-min",e.FilterRangeNullOption="filter-range-null-option",e.FilterUpdateType="filter-update-type",e.FilterValues="filter-values",e.FontNameListItems="font-name-list-items",e.FormattedText="formatted-text",e.FunctionName="function-name",e.HierValSelectionModels="hierarchicalValueSelectionModels",e.HighlightedData="highlighted-data",e.HoverTupleInteraction="hover-tuple-interaction",e.IgnoreAliases="ignore-aliases",e.IgnoreSelection="ignore-selection",e.IncludeAllColumns="include-all-columns",e.InvalidAggFieldName="invalid-agg-field-name",e.InvalidDates="invalid-dates",e.InvalidFieldCaption="invalid-field-caption",e.InvalidFields="invalid-fields",e.InvalidValues="invalid-values",e.IsExcludeMode="is-exclude",e.IsExtensionDialog="is-extension-dialog",e.JoinDescription="join-description",e.LogicalTableId="logical-table-id",e.LogicalTableInfoList="logical-table-info-list",e.MaxHeight="max-height",e.MaxRows="max-rows",e.MaxWidth="max-width",e.MinHeight="min-height",e.MinWidth="min-width",e.PageRowCount="page-row-count",e.ParameterCaption="paremeter-caption",e.ParameterError="parameter-error",e.ParameterFieldName="parameter-field-name",e.ParameterInfo="parameter-info",e.ParameterInfos="parameter-infos",e.ParameterValue="parameter-value",e.PeriodType="period-type",e.QuantitativeDomain="quantitative-dmain",e.QuantRangeSelectionModels="quantativeRangeSelectionModels",e.RangeN="range-n",e.ReplaySpeed="replay-speed",e.SelectedData="selected-data",e.SelectedSheetNames="selected-sheet-names",e.Selection="selection",e.SelectionList="selection-list",e.SelectionUpdateType="selectionUpdateType",e.SelectTuplesInteraction="select-tuples-interaction",e.SendNotifications="send-notifications",e.SettingsValues="settings-values",e.SharedFilterSheets="shared-filter-sheets",e.SharedFiltersInfo="shared-filters-info",e.SheetIdentifier="sheet-identifier",e.SheetName="sheet-name",e.SheetPath="sheet-path",e.ShouldRefreshDS="should-refresh-ds",e.ShowDataTableFormat="show-data-table-format",e.State="state",e.StoryPointIndex="story-point-index",e.StoryPointInfo="story-point-info",e.SwitchToSheetName="switch-to-sheet-name",e.TargetPoint="target-point",e.TestConversionParameter="test-conversion-parameter",e.Text="formatted-text",e.TooltipContext="tooltip-context",e.TooltipTextRequest="tooltip-text-request",e.TooltipText="tooltip-text",e.UnderlyingDataTable="underlying-data-table",e.UnderlyingSummaryDataTable="underlying-summary-data-table",e.Url="url",e.UseTabDelimiters="use-tab-delimiters",e.ViewDataTableCacheId="view-data-table-cache-id",e.ViewDataTableId="view-data-table-id",e.VisualId="visual-id",e.VisualSpecification="visual-specification",e.VizAPIInputJson="vizapi-input-json",e.VizAPIStateWithDataModel="vizapi-state-with-data-model",e.VizAPIStateWarningMsg="vizapi-state-warning-msg",e.VizAPISVG="vizapi-svg",e.WorksheetName="worksheet-name",e.WorksheetFilters="worksheet-filters",e.ZoneIdsVisibilityMap="zone-ids-visibility-map"}(t.ParameterId||(t.ParameterId={}))})(fO);var mO={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.ActivateNextStoryPoint="activate-next-story-point",e.ActivatePreviousStoryPoint="activate-previous-story-point",e.ActivateSheet="activateSheet",e.ActivateStoryPoint="activate-story-point",e.AppendExternalMenuItem="append-external-menu-item",e.ApplyCategoricalFilter="categorical-filter",e.ApplyRangeFilter="range-filter",e.ApplyRelativeDateFilter="apply-relative-date-Filter",e.Authenticate="authenticate",e.BlockExtension="block-extension",e.ChangeParameterValue="change-parameter-value",e.ChangeSharedFilter="change-shared-filter",e.ClearFilter="clear-filter",e.ClearSelectedMarks="clear-selected-marks",e.CloseDialog="close-dialog",e.CreateAnnotation="create-annotation",e.DashboardCategoricalFilter="dashboard-categorical-filter",e.DisplayDialog="display-dialog",e.DownloadWorkbook="download-workbook",e.ExecuteExternalMenuItem="execute-external-menu-item",e.ExportCrosstab="export-crosstab",e.ExportCrosstabCsvDownload="export-crosstab-csv-download",e.ExportCrosstabExcelDownload="export-crosstab-excel-download",e.ExportData="export-data",e.ExportDataDownload="export-data-download",e.ExportImage="export-image",e.ExportPdf="export-pdf",e.ExportPdfDownload="export-pdf-download",e.ExportPowerpoint="export-powerpoint",e.ExportPowerpointDownload="export-powerpoint-download",e.FindParameter="find-parameter",e.GetActiveTables="get-active-tables",e.GetAllDataSources="get-all-data-sources",e.GetAnnotations="get-annotations",e.GetCategoricalDomain="get-categorical-domain",e.GetConnectionDescriptionSummaries="get-connection-description-summaries",e.GetCurrentSrc="get-current-src",e.GetCustomViews="get-custom-views",e.GetDashboardFilters="get-dashboard-filters",e.GetDataSource="get-datasource",e.GetDataSourceData="get-datasource-data",e.GetDataSources="get-data-sources",e.GetDataSummaryData="get-summary-data",e.GetDataSummaryDataReader="get-summary-data-reader",e.GetDataTableReaderPage="get-data-table-reader-page",e.GetEmbeddingAbstractQueryWithDataModel="get-embedding-abstract-query-with-data-model",e.GetEmbeddingClientInfo="get-embedding-client-info",e.GetVizStateWithDataModel="get-viz-state-with-data-model",e.GetExportCrosstabSheetMap="get-export-crosstab-sheet-map",e.GetExportPdfOptions="get-export-pdf-options",e.GetField="get-field",e.GetFieldAndDataSource="get-field-and-datasource",e.GetVisualSpecification="get-visual-specification",e.GetFilters="get-filters",e.GetFonts="get-fonts",e.GetHighlightedMarks="get-highlighted-marks",e.GetJoinDescription="get-join-description",e.GetLogicalTableData="get-logical-table-data",e.GetLogicalTableDataReader="get-logical-table-data-reader",e.GetLogicalTables="get-logical-tables",e.GetParametersForSheet="get-parameters-for-sheet",e.GetRangeDomain="get-range-domain",e.GetSelectedMarks="get-selected-marks",e.GetSharedFilter="get-shared-filter",e.GetTooltipText="get-tooltip-text",e.GetUnderlyingData="get-underlying-data",e.GetUnderlyingTableData="get-underlying-table-data",e.GetUnderlyingTableDataReader="get-underlying-table-data-reader",e.GetUnderlyingTables="get-underlying-tables",e.HierarchicalFilter="hierachical-filter",e.InitializeExtension="initialize-extension",e.MoveAndResizeZones="move-and-resize-zones",e.RaiseLeaveMarkNavNotification="raise-leave-mark-nav-notification",e.RaiseHoverTupleNotification="raise-hover-tuple-notification",e.RaiseSelectTuplesNotification="raise-select-tuples-notification",e.Redo="redo",e.RefreshDataSource="refresh-data-source",e.ReleaseDataTableReader="release-data-table-reader",e.RemoveAnnotation="remove-annotation",e.RemoveCustomView="remove-custom-view",e.RemoveExternalMenuItem="remove-external-menu-item",e.RenameExternalMenu="rename-external-menu",e.ReplayAnimation="replay-animation",e.RevertStoryPoint="revert-story-point",e.RevertWorkbook="revert-workbook",e.SaveExtensionSettings="save-extension-settings",e.SaveWorkbookAsCustomView="save-workbook-as-custom-view",e.SelectByValue="select-by-value",e.SetActiveCustomViewAsDefault="set-active-custom-view-as-default",e.SetAutoUpdate="set-auto-update",e.SetClickThrough="set-click-through",e.SetVizStateWithDataModel="set-viz-state-with-data-model",e.SetSheetSize="set-sheet-size",e.SetZoneVisibility="set-zone-visibility",e.Share="share",e.ShowCustomView="show-custom-view",e.TestConversionVerb="test-conversion-verb",e.Undo="undo",e.UpdateCustomView="update-custom-view",e.VizAPI="viz-api"}(t.VerbId||(t.VerbId={}))})(mO);var gO={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.token="token",e.origin="origin",e.showEmbed="showEmbed",e.showPin="showPin",e.showSave="showSave",e.showShare="showShare",e.debug=":jsdebug",e.ApiID=":apiID",e.ApiExternalVersion=":apiExternalVersion",e.ApiInternalVersion=":apiInternalVersion",e.AskDataWebComponent=":askDataWebComponent"}(t.AskDataOptionNames||(t.AskDataOptionNames={}))})(gO);var yO={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.embed="embed",e.token="token",e.disableExploreFilter="disableExploreFilter",e.layout="embed_layout",e.ApiExternalVersion=":apiExternalVersion",e.ApiInternalVersion=":apiInternalVersion",e.PulseWebComponent=":pulseWebComponent"}(t.PulseOptionNames||(t.PulseOptionNames={}))})(yO);var _O={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});var e;(function(a){a.ONE="1",a.ALERTS=":alerts",a.ALIAS="alias",a.ALLOW_DEFERRED_BOOTSTRAP=":allowDeferredBootstrap",a.ALLOW_AUTOGEN_WORKSHEET_PHONE_LAYOUTS="allowAutogenWorksheetPhoneLayouts",a.API_ID=":apiID",a.APP=":app",a.ATTACHMENT="attachment",a.IS_IPAD_APP="app",a.ANIMATE_TRANSITION=":animate_transition",a.ASCENDING="ascending",a.AUTHENTICATION="authentication",a.ATTRIBUTES="attributes",a.AUTHORING_SHEET=":authSheet",a.AXIS="axis",a.BOOTSTRAP_WHEN_NOTIFIED=":bootstrapWhenNotified",a.BROWSER_BACK_BUTTON_UNDO=":browserBackButtonUndo",a.BROWSER_RENDERING_ON="isBrowserRendering",a.BROWSER_RENDERING_THRESHOLD="browserRenderingThreshold",a.CHARSET="charset",a.CLIENT_DIMENSION="clientDimension",a.CLIENT_IP="client_ip",a.CLIENT_NUM="clientNum",a.COLON_EMBEDDED=":embedded",a.COLON_MOBILE=":mobile",a.COLON_DEEP_LINKING_DISABLED=":deepLinkingDisabled",a.COLON_WATERMARK=":watermark",a.COMMENTS=":comments",a.COMMENTING_ENABLED=":commentingEnabled",a.COMMENTING_MENTIONS_ENABLED=":commentingMentions",a.CONNECTION="connection",a.CREATED_BY_FEATURE="createdByFeature",a.CRYPTED_PASSWORD="crypted",a.CSSDEBUG=":cssdebug",a.CSV="csv",a.CUSTOM_VIEWS=":customViews",a.CV=":cv",a.CV_ID="cvId",a.DASHBOARD_PORT_SIZE="dashboardPortSize",a.DATA_DETAILS=":dataDetails",a.DATASOURCE="datasource",a.DEBUG=":debug",a.DELAY=":delay",a.DEPTH="depth",a.DEVICE_TYPE=":device",a.DEVICE_PIXEL_RATIO="devicePixelRatio",a.DEVICE_PREVIEW_MODE=":devicepreviewmode",a.DIMENSIONS=":dimensions",a.DISABLE_SHARED_SESSIONS=":disable_shared_sessions",a.DISABLE_URL_ACTIONS_POPUPS=":disableUrlActionsPopups",a.DIRECTION="direction",a.DISPLAY_OVERLAY=":display_overlay",a.DISPLAY_SHARE=":display_share",a.DISPLAY_SPINNER=":display_spinner",a.DISPLAY_STATIC_IMAGE=":display_static_image",a.DISPLAY_TABS="display_tabs",a.DISPLAY_VIEW_COUNT=":display_count",a.IGNORE_STICKY_SESSION=":ignore_sticky_session",a.INCREMENT_VIEW_COUNT=":increment_view_count",a.DOCMODE="docmode",a.DOMAIN="domain",a.DO_WORK="do_work",a.DX="dx",a.DY="dy",a.EDIT_DATA_ALERT=":editDataAlert",a.EMBED=":embed",a.EMBEDDED="embedded",a.ENCRYPTED="encrypted",a.API_EXTERNAL_VERSION=":apiExternalVersion",a.API_INTERNAL_VERSION=":apiInternalVersion",a.EXCLUDE="exclude",a.EXPORT_FORMAT=":export_format",a.FIELDNAME="fieldname",a.FIELD_NAME="field_name",a.FIELD_SEP="field_sep",a.FILE="file",a.FILTER_TILE_SIZE="filterTileSize",a.FN="fn",a.FOCUS="focus",a.FORCE_CACHE="force_cache",a.FORMAT="format",a.FORMAT_DATA_VALUE_LOCALLY="formatDataValueLocally",a.FROM_WG=":from_wg",a.GRAPHQL_DATABASE_ID=":graphQLDatabaseId",a.GRAPHQL_TABLE_ID=":graphQLTableId",a.GUID=":guid",a.H="h",a.HIDDEN="hidden",a.HIDE_CLOSE_BUTTON=":hideCloseButton",a.HIDE_EDIT_BUTTON=":hideEditButton",a.HIDE_EDIT_IN_DESKTOP_BUTTON=":hideEditInDesktopButton",a.HIGH_DPI=":highdpi",a.IMAGE_SIZE_LIMIT="imageSizeLimit",a.TRANSPARENT_LINE_MARKS_LIMIT="transparentLineMarkLimit",a.CLIENT_RENDER_PIXEL_LIMIT="clientRenderPixelLimit",a.IN="in",a.INSTANCE_ID=":iid",a.IS_GUEST_REDIRECT_FROM_VIZPORTAL=":isGuestRedirectFromVizportal",a.IS_MARK_ANIMATION_ENABLED="isMarkAnimationEnabled",a.IS_VIZPORTAL=":isVizPortal",a.INPUT_="input_string",a.JSDEBUG=":jsdebug",a.JSON="json",a.JSON_ONLY=":jsonOnly",a.KEEPFILE="keepfile",a.KEY="key",a.LANGUAGE="language",a.LANGUAGE_REQUESTED=":language",a.LINKTARGET=":linktarget",a.LOAD_ORDER_ID=":loadOrderID",a.LOAD_NEWEST_REVISION=":loadNewestRevision",a.LOCAL_PATHS=":localPaths",a.LOCALE="locale",a.LOCATION_ID="locationid",a.LOCATION_TYPE="locationtype",a.WORKBOOK_LOCALE="workbookLocale",a.MAXROWS="maxrows",a.MAX_AGE="maxAge",a.MAX_ROWS="maxRows",a.METHOD="method",a.MOBILE="mobile",a.MODIFIER="modifier",a.NAME="name",a.NAV_TYPE="navType",a.NAV_SRC="navSrc",a.NOATTACHMENT="no-attachment",a.NO_OVERWRITE="no_overwrite",a.OPEN_AUTHORING_IN_TOP_WINDOW=":openAuthoringInTopWindow",a.OPENID_HD=":openid_hd",a.OPENID_LOGIN_HINT=":openid_login_hint",a.OAUTHREQUEST="oauthrequest",a.OAUTH_CREDENTIAL_IDS="oauth_credential_ids",a.OFFLINE_MODE=":offlinemode",a.ORIGIN=":origin",a.OVERLAY=":overlay",a.P="p",a.PATH="path",a.PANE_RESOLVER_X="paneResolverX",a.PANE_RESOLVER_Y="paneResolverY",a.PARAM="param",a.PARENT_ID="parent_id",a.PASSWORD="password",a.PATTERN="pattern",a.PIXEL_RATIO=":pixelratio",a.PREFIX=":prefix",a.PREVIEW=":preview",a.PRIMARY_CONTENT_URL="primary_content_url",a.PROJECT="project",a.PROTOCOL="protocol",a.PSEUDO=":pseudo",a.QUERY="query",a.R="r",a.RANGE_TYPE="range_type",a.RECORD_SEP="record_sep",a.RECORD_CLIENT_PERFORMANCE=":record_client_performance",a.RECORD_PERFORMANCE=":record_performance",a.RECOVER_OLD_SESSION_ID=":recover_old_session_id",a.RECOVER_SESSION_STATE_TICKETS=":recover_session_state_tickets",a.REFRESH=":refresh",a.REFRESHUNMODIFIED=":refreshunmodified",a.REGION="region",a.RELOAD_ON_CUSTOM_VIEW_SAVE=":reloadOnCustomViewSave",a.RENDER=":render",a.RENDER_MAPS_CLIENT_SIDE="renderMapsClientSide",a.RETRY=":retry",a.REUSE="reuse",a.REUSE_FOREVER="reuse_forever",a.REVERT=":revert",a.SAVE_DB_PASSWORDS="save_db_passwords",a.SELECT_X="select_x",a.SELECT_Y="select_y",a.SESSION_FEATURE_PREFIX=":ff_",a.SESSION_FLAGS=":session_feature_flags",a.SHARE_BUTTON="share_button",a.SHEET_ID="sheet_id",a.SHARED="shared",a.SHOWALL="showall",a.SHOW_APP_BANNER=":showAppBanner",a.SHOW_ASK_DATA=":showAskData",a.SHOW_PARAMS="showParams",a.SHOW_SHARE_OPTIONS=":showShareOptions",a.SIZE=":size",a.SOURCE="source",a.STATE="state",a.STICKY_SESSION_KEY="stickySessionKey",a.SUBSCRIPTIONS=":subscriptions",a.SUMMARY="summary",a.SUPPRESS_DEFAULT_EDIT_BEHAVIOR=":suppressDefaultEditBehavior",a.SYNC_SESSION=":sync_session",a.SYNC_SESSION_STATE="sync_session_state",a.TABS=":tabs",a.TARGET="target",a.TARGET_SITE="target_site",a.TOOLBAR=":toolbar",a.TOOLTIP=":tooltip",a.TS="ts",a.UNDERLYING_TABLE_ID="underlying_table_id",a.UNDERLYING_TABLE_CAPTION="underlying_table_caption",a.UPDATE_TYPE="update_type",a.USE_GUEST=":useGuest",a.USE_INLINE_IMAGES="use_inline_images",a.USERAGENT="useragent",a.USERNAME="username",a.VALUE="value",a.VERBOSE_MODE="verboseMode",a.VIEW_ID="views_id",a.VIZ_SNAPSHOT_ID="viz_snapshot_id",a.VW=":vw",a.W="w",a.WORKSHEET_PORT_SIZE="worksheetPortSize",a.WATERMARK="watermark",a.WATERMARK_MARGIN=":watermark_margin",a.WB=":wb",a.WHICH="which",a.X="x",a.Y="y",a.ZID="zid",a.ZONE_ID="zone_id",a.KEYCHAIN_VERSION="keychain_version",a.DATASOURCE_ID="datasource_id",a.DATASOURCE_NAME="datasource_name",a.LENS_ID="lens_id",a.WIDTH="width",a.HEIGHT="height",a.LAYOUT_VIEWS="views",a.LAYOUT_MENUS="menus",a.LAYOUT_GEOMETRY="geometry",a.LAYOUT_PAGES="pages",a.LAYOUT_CACHEURL="cacheurl",a.LAYOUT_SHEET="sheet",a.LAYOUT_DEPTH="depth"})(e||(e={}));var n;(function(a){a.SHOW_VIZ_HOME=":showVizHome"})(n||(n={})),function(a){a.Size=":size",a.Embed=":embed",a.ApiInternalVersion=":apiInternalVersion",a.ApiExternalVersion=":apiExternalVersion",a.ShowVizHome=":showVizHome",a.Jsdebug=":jsdebug",a.BootstrapWhenNotified=":bootstrapWhenNotified",a.NavType="navType",a.NavSrc="navSrc",a.debug=":jsdebug",a.ApiID=":apiID",a.disableUrlActionsPopups=":disableUrlActionsPopups",a.hideTabs=":tabs",a.toolbar=":toolbar",a.device=":device",a.instanceIdToClone=":iid",a.touchOptimize="mobile",a.hideEditButton=":hideEditButton",a.hideEditInDesktopButton=":hideEditInDesktopButton",a.suppressDefaultEditBehavior=":suppressDefaultEditBehavior",a.hideCloseButton=":hideCloseButton"}(t.VizOptionNames||(t.VizOptionNames={}))})(_O);var Jg={},vO={exports:{}};(function(t){(function(){var e=new RegExp("^[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}$","i");function n(u){for(var d="",_=0;_this._platformMajorVersion)throw new Error("Cannot convert between external version "+this._externalMajorVersion+" and "+this._platformMajorVersion)}return t.fromData=function(e,n,a,u,d){return new this(e.major,n.major,a,u,d)},t.prototype.upgradeExecuteCall=function(e,n){for(var a={verb:e,parameters:n},u=0,d=this._upgradeExecuteTranslations;uP.major?!1:C.majorV)throw new Error(`External version must be less than or equal to platform version. + externalMajorVersion=`+j+" platformMajorVersion="+V);if(d(C,P))return new e.IdentityVersionConverter;var R=w(j,V,L,z),F=w(j,V,L,W),H=w(j,V,L,U);return F.reverse(),H.reverse(),n.StackingVersionConverter.fromData(C,P,R,F,H)}t.CreateVersionConverterWithTranslators=l;function w(C,P,z,W){for(var U=[],j=C;j<=P;j++)if(j in W)for(var L=j===C?z:0,V=T(Object.keys(W[j])),R=L;R<=V;R++)R in W[j]&&U.push.apply(U,W[j][R]);return U}function T(C){return C.map(function(P){return Number(P)}).reduce(function(P,z){return P>z?P:z})}t.GetMaximumMinorIndex=T})(kT);var mv={};Object.defineProperty(mv,"__esModule",{value:!0});var $q=function(){function t(){}return t.prototype.downgradeExecuteCall=function(e,n){return{verb:e,parameters:n}},t.prototype.upgradeExecuteReturn=function(e,n,a){return e},t.prototype.upgradeNotification=function(e){return e},t}();mv.ExternalIdentityVersionConverter=$q;var kb={},MT={};Object.defineProperty(MT,"__esModule",{value:!0});var Wq=function(){function t(e,n,a,u,d){if(this._externalVersion=e,this._platformVersion=n,this._downgradeExecuteCallTranslations=a,this._upgradeExecuteReturnTranslations=u,this._upgradeNotificationTranslations=d,this._externalVersion.major>this._platformVersion.major)throw new Error("Cannot convert between external version "+this._externalVersion.major+` + and `+this._platformVersion.major)}return t.prototype.downgradeExecuteCall=function(e,n){for(var a={verb:e,parameters:n},u=0,d=this._downgradeExecuteCallTranslations;u0&&zU)throw new Error(`External version must be less than or equal to platform version. + externalMajorVersion=`+W+" platformMajorVersion="+U);if(W0)return{behavior:_s.SheetSizeBehavior.Exactly,minSize:{width:n,height:a},maxSize:{width:n,height:a}};var _=n===0&&u===0;return{behavior:_s.SheetSizeBehavior.Range,minSize:{width:n,height:a},maxSize:{width:_?2147483647:u,height:d}}},t.createAutomaticSize=function(){var e=_s.SheetSizeBehavior.Automatic,n={width:0,height:0},a={width:0,height:0};return{behavior:e,minSize:n,maxSize:a}},t.getPublishedSheetInfoByName=function(e,n){var a=n.find(function(u){return u.name===e});return a},t.getSheetTypeEnum=function(e){var n;switch(e){case Pb.SheetType.Worksheet:{n=_s.SheetType.Worksheet;break}case Pb.SheetType.Dashboard:{n=_s.SheetType.Dashboard;break}case Pb.SheetType.Story:{n=_s.SheetType.Story;break}default:throw new sZ.TableauError(_s.SharedErrorCodes.ServerError,"Invalid SheetType")}return n},t.isValidSheetSize=function(e){return e.behavior!==void 0},t}();Wm.SheetUtils=lZ;Object.defineProperty($d,"__esModule",{value:!0});var un=Nt,sy=pa,xi=Mn,iD=$o(),qh=Vd(),oD=Wm,cZ=function(){function t(e,n){this._sheetInfoImpl=e,this._registryId=n}return Object.defineProperty(t.prototype,"name",{get:function(){return this._sheetInfoImpl.name},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"sheetType",{get:function(){return this._sheetInfoImpl.sheetType},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"sheetPath",{get:function(){return this._sheetInfoImpl.sheetPath},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){return this._sheetInfoImpl.sheetSize},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"hidden",{get:function(){if(this._sheetInfoImpl.isHidden!==void 0)return this._sheetInfoImpl.isHidden;throw new xi.TableauError(un.EmbeddingErrorCodes.ImplementationError,"isHidden not implemented")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"active",{get:function(){if(this._sheetInfoImpl.isActive!==void 0)return this._sheetInfoImpl.isActive;throw new xi.TableauError(un.EmbeddingErrorCodes.ImplementationError,"active not implemented")},set:function(e){this._sheetInfoImpl.isActive!==void 0&&(this._sheetInfoImpl.active=e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"index",{get:function(){if(this._sheetInfoImpl.index!==void 0)return this._sheetInfoImpl.index;throw new xi.TableauError(un.EmbeddingErrorCodes.ImplementationError,"index not implemented")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"url",{get:function(){if(this._sheetInfoImpl.url!==void 0)return this._sheetInfoImpl.url;throw new xi.TableauError(un.EmbeddingErrorCodes.ImplementationError,"url not implemented")},enumerable:!0,configurable:!0}),t.prototype.getSheetSize=function(){if(!oD.SheetUtils.isValidSheetSize(this.size))throw new xi.TableauError(un.EmbeddingErrorCodes.InternalError,"size is not of type SheetSize");return this.size},t.prototype.findParameterAsync=function(e){iD.ErrorHelpers.verifyParameter(e,"parameterName");var n=sy.ApiServiceRegistry.get(this._registryId).getService("parameters-service");return n.findParameterByNameAsync(e)},t.prototype.getParametersAsync=function(){var e=sy.ApiServiceRegistry.get(this._registryId).getService("parameters-service");return e.getParametersForSheetAsync(this.sheetPath)},t.prototype.changeSizeAsync=function(e){var n=this,a=new xi.TableauError(un.EmbeddingErrorCodes.InvalidSize,"Invalid sheet size parameter");if(!e||!e.behavior)throw a;var u=this.normalizeSheetSize(e),d=u.behavior===un.SheetSizeBehavior.Automatic;if(!d&&!u.minSize&&!u.maxSize)throw a;if(!d&&this.sheetType===un.SheetType.Worksheet)throw new xi.TableauError(un.EmbeddingErrorCodes.InvalidSizeBehaviorOnWorksheet,"Only SheetSizeBehavior.Automatic is allowed on Worksheets");if(d&&this.getSheetSize().behavior===u.behavior)return Promise.resolve(e);var _=this.processNewSize(u),l=sy.ApiServiceRegistry.get(this._registryId).getService("size-service");return l.changeSizeAsync(this.name,_).then(function(){var w=sy.ApiServiceRegistry.get(n._registryId).getService("client-info-service");return w.getClientInfoAsync().then(function(T){var C=T.publishedSheets.find(function(z){return z.name===n.name});if(!C)throw new xi.TableauError(un.SharedErrorCodes.InternalError,"Can't find sheet with name "+n.name);var P=oD.SheetUtils.getSheetSizeFromSizeConstraints(C.sizeConstraint);return n._sheetInfoImpl.sheetSize=P,P})})},t.prototype.normalizeSheetSize=function(e){var n=e.behavior;iD.ErrorHelpers.verifyEnumValue(n,un.SheetSizeBehavior,"SheetSizeBehavior");var a=t.parseDimensions(e.minSize),u=t.parseDimensions(e.maxSize);return{behavior:n,minSize:a,maxSize:u}},t.prototype.processNewSize=function(e){var n,a,u,d,_=e.behavior,l=e.minSize,w=e.maxSize,T=!qh.Param.isNullOrUndefined((n=l)===null||n===void 0?void 0:n.width),C=!qh.Param.isNullOrUndefined((a=l)===null||a===void 0?void 0:a.height),P=!qh.Param.isNullOrUndefined((u=w)===null||u===void 0?void 0:u.width),z=!qh.Param.isNullOrUndefined((d=w)===null||d===void 0?void 0:d.height),W=T&&C,U=P&&z;switch(_){case un.SheetSizeBehavior.Automatic:return{behavior:_};case un.SheetSizeBehavior.AtMost:{if(!w||!U)throw new xi.TableauError(un.EmbeddingErrorCodes.MissingMaxSize,"Missing maxSize for SheetSizeBehavior.AtMost");var j={width:w.width,height:w.height};if(j.width<0||j.height<0)throw new xi.TableauError(un.EmbeddingErrorCodes.InvalidSize,"Size value cannot be less than zero");return{behavior:_,maxSize:j}}case un.SheetSizeBehavior.AtLeast:{if(!l||!W)throw new xi.TableauError(un.EmbeddingErrorCodes.MissingMinSize,"Missing minSize for SheetSizeBehavior.AtLeast");var L={width:l.width,height:l.height};if(L.width<0||L.height<0)throw new xi.TableauError(un.EmbeddingErrorCodes.InvalidSize,"Size value cannot be less than zero");return{behavior:_,minSize:L}}case un.SheetSizeBehavior.Range:{if(!l||!w||!W||!U)throw new xi.TableauError(un.EmbeddingErrorCodes.MissingMinMaxSize,"Missing minSize or maxSize for SheetSizeBehavior.Range");var L={width:l.width,height:l.height},j={width:w.width,height:w.height};if(L.width<0||L.height<0||j.width<0||j.height<0||L.width>j.width||L.height>j.height)throw new xi.TableauError(un.EmbeddingErrorCodes.InvalidSize,"Missing minSize or maxSize for SheetSizeBehavior.Range");return{behavior:_,minSize:L,maxSize:j}}case un.SheetSizeBehavior.Exactly:{if(l&&w){if(W&&U){var L={width:l.width,height:l.height},j={width:w.width,height:w.height};if(L.width!==j.width||L.height!==j.height)throw new xi.TableauError(un.EmbeddingErrorCodes.InvalidSize,"Conflicting size values for SheetSizeBehavior.Exactly");return{behavior:_,minSize:L,maxSize:j}}if(W){var L={width:l.width,height:l.height};return{behavior:_,minSize:L,maxSize:L}}if(U){var j={width:w.width,height:w.height};return{behavior:_,minSize:j,maxSize:j}}}throw new xi.TableauError(un.EmbeddingErrorCodes.InvalidSize,"Invalid sheet size parameter")}default:throw new xi.TableauError(un.SharedErrorCodes.InternalError,"Unsupported sheet size behavior: "+_)}},t.parseDimensions=function(e){var n={width:void 0,height:void 0};if(!e)return n;var a=qh.Param.tryParseNumber(e.width),u=a.success,d=a.parsed,_=qh.Param.tryParseNumber(e.height),l=_.success,w=_.parsed;return u&&l?{width:d,height:w}:u?{width:d}:l?{height:w}:n},t}();$d.SheetImpl=cZ;var Gm={};Object.defineProperty(Gm,"__esModule",{value:!0});var uZ=Nt,hZ=function(){function t(e,n,a,u,d,_,l){this._name=e,this._sheetType=n,this._sheetSize=a,this._index=u,this._isActive=d,this._isHidden=_,this._url=l}return Object.defineProperty(t.prototype,"name",{get:function(){return this._name},set:function(e){this._name=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"sheetSize",{get:function(){return this._sheetSize},set:function(e){this._sheetSize=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"sheetType",{get:function(){return this._sheetType},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"sheetPath",{get:function(){return{sheetName:this.name,isDashboard:this.sheetType===uZ.SheetType.Dashboard}},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"index",{get:function(){return this._index},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isActive",{get:function(){return this._isActive},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"active",{set:function(e){this._isActive=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isHidden",{get:function(){return this._isHidden},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"url",{get:function(){return this._url},enumerable:!0,configurable:!0}),t}();Gm.SheetInfoImpl=hZ;var Hm={},bv={};Object.defineProperty(bv,"__esModule",{value:!0});var dZ=function(){function t(e){this._logicalTable=e}return Object.defineProperty(t.prototype,"id",{get:function(){return this._logicalTable.id},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"caption",{get:function(){return this._logicalTable.caption},enumerable:!0,configurable:!0}),t}();bv.LogicalTable=dZ;var RT={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.Summary="summary",e.Underlying="underlying"}(t.GetDataType||(t.GetDataType={}))})(RT);var qm={},OT={};Object.defineProperty(OT,"__esModule",{value:!0});var pZ=function(){function t(e){this._connectionInfo=e}return Object.defineProperty(t.prototype,"name",{get:function(){return this._connectionInfo.name},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"id",{get:function(){return this._connectionInfo.id},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"serverURI",{get:function(){return this._connectionInfo.serverURI},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"type",{get:function(){return this._connectionInfo.type},enumerable:!0,configurable:!0}),t}();OT.ConnectionSummary=pZ;var FT={};Object.defineProperty(FT,"__esModule",{value:!0});var fZ=function(){function t(e){this._tableInfo=e}return Object.defineProperty(t.prototype,"name",{get:function(){return this._tableInfo.name},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"id",{get:function(){return this._tableInfo.id},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"connectionId",{get:function(){return this._tableInfo.connectionId},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"customSQL",{get:function(){return this._tableInfo.customSQL},enumerable:!0,configurable:!0}),t}();FT.TableSummary=fZ;var wv={};Object.defineProperty(wv,"__esModule",{value:!0});var mZ=Nt,gZ=hr(),Db=fl,yZ=function(){function t(e,n){this._fieldInfo=e,this._parentDataSource=n}return Object.defineProperty(t.prototype,"name",{get:function(){return this._fieldInfo.name},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"id",{get:function(){return this._fieldInfo.id},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"description",{get:function(){return this._fieldInfo.description},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dataType",{get:function(){var e;return e=this._fieldInfo.dataType,e??mZ.DataType.Unknown},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"aggregation",{get:function(){return Db.InternalToExternalEnumMappings.fieldAggregationType.convert(this._fieldInfo.aggregation)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dataSource",{get:function(){if(!this._parentDataSource)throw new Error("Data source information is not available for this field. Please use getFieldAsync method to get field's data source information");return this._parentDataSource},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"role",{get:function(){return Db.InternalToExternalEnumMappings.fieldRoleType.convert(this._fieldInfo.role)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"columnType",{get:function(){var e=this._fieldInfo.columnType||gZ.ColumnType.Unknown;return Db.InternalToExternalEnumMappings.columnType.convert(e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isCalculatedField",{get:function(){return this._fieldInfo.isCalculatedField},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isCombinedField",{get:function(){return this._fieldInfo.isCombinedField},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isGenerated",{get:function(){return this._fieldInfo.isGenerated},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isGeospatial",{get:function(){return this._fieldInfo.isGeospatial},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isHidden",{get:function(){return this._fieldInfo.isHidden},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isPresentOnPublishedDatasource",{get:function(){return this._fieldInfo.isPresentOnPublishedDatasource},enumerable:!0,configurable:!0}),t}();wv.FieldImpl=yZ;Object.defineProperty(qm,"__esModule",{value:!0});var Mb=Nt,_Z=OT,aD=$m,vZ=bv,gu=pa,xZ=FT,bZ=$o(),sD=wv,wZ=function(){function t(e,n){var a=this;this._dataSourceInfo=e,this._registryId=n,this._fields=e.fields.map(function(u){var d=new sD.FieldImpl(u,a);return new aD.Field(d)})}return Object.defineProperty(t.prototype,"name",{get:function(){return this._dataSourceInfo.name},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"id",{get:function(){return this._dataSourceInfo.id},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"extractUpdateTime",{get:function(){return this._dataSourceInfo.extractUpdateTime},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"fields",{get:function(){return this._fields},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isExtract",{get:function(){return this._dataSourceInfo.isExtract},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isPublished",{get:function(){return this._dataSourceInfo.isPublished},enumerable:!0,configurable:!0}),t.prototype.publishedUrl=function(){return this._dataSourceInfo.publishedUrl},t.prototype.getMaxPageRowLimit=function(){return 1e4},t.prototype.refreshAsync=function(){var e=gu.ApiServiceRegistry.get(this._registryId).getService("data-source-service");return e.refreshAsync(this._dataSourceInfo.id)},t.prototype.getConnectionSummariesAsync=function(){var e=gu.ApiServiceRegistry.get(this._registryId).getService("data-source-service");return e.getConnectionSummariesAsync(this._dataSourceInfo.id).then(function(n){return n.map(function(a){return new _Z.ConnectionSummary(a)})})},t.prototype.getActiveTablesAsync=function(){var e=gu.ApiServiceRegistry.get(this._registryId).getService("data-source-service");return e.getActiveTablesAsync(this._dataSourceInfo.id).then(function(n){return n.map(function(a){return new xZ.TableSummary(a)})})},t.prototype.getUnderlyingDataAsync=function(e){var n=gu.ApiServiceRegistry.get(this._registryId).getService("get-data-service");return e=e||{},n.getDataSourceDataAsync(this.id,!!e.ignoreAliases,e.maxRows||0,e.columnsToInclude||[],e.columnsToIncludeById||[],e.includeDataValuesOption||Mb.IncludeDataValuesOption.AllValues)},t.prototype.getLogicalTableDataAsync=function(e,n){var a=gu.ApiServiceRegistry.get(this._registryId).getService("get-data-service");return n=n||{},a.getLogicalTableDataAsync(this.id,e,!!n.ignoreAliases,n.maxRows||0,n.columnsToInclude||[],n.columnsToIncludeById||[],n.includeDataValuesOption||Mb.IncludeDataValuesOption.AllValues)},t.prototype.getLogicalTableDataReaderAsync=function(e,n,a){var u=gu.ApiServiceRegistry.get(this._registryId).getService("get-data-service");return a=a||{},u.getLogicalTableDataReaderAsync(this.id,e,n||this.getMaxPageRowLimit(),!!a.ignoreAliases,a.columnsToIncludeById||[],a.includeDataValuesOption||Mb.IncludeDataValuesOption.AllValues)},t.prototype.initializeWithPublicInterfaces=function(e){bZ.ErrorHelpers.verifyInternalValue(e,"dataSource"),this._fields=this._dataSourceInfo.fields.map(function(n){var a=new sD.FieldImpl(n,e);return new aD.Field(a)})},t.prototype.getLogicalTablesAsync=function(){var e=gu.ApiServiceRegistry.get(this._registryId).getService("data-source-service");return e.getLogicalTablesAsync(this.id).then(function(n){return n.map(function(a){return new vZ.LogicalTable(a)})})},t}();qm.DataSourceImpl=wZ;var EZ=$e&&$e.__extends||function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,u){a.__proto__=u}||function(a,u){for(var d in u)u.hasOwnProperty(d)&&(a[d]=u[d])},t(e,n)};return function(e,n){t(e,n);function a(){this.constructor=e}e.prototype=n===null?Object.create(n):(a.prototype=n.prototype,new a)}}();Object.defineProperty(Hm,"__esModule",{value:!0});var Zh=Nt,oa=Nt,SZ=Vm,TZ=bv,lD=RT,Gr=pa,Kh=Mn,ri=$o(),AZ=qm,IZ=$d,CZ=function(t){EZ(e,t);function e(n,a,u,d,_){var l=t.call(this,n,a)||this;return l._visualId=u,l._parentDashboardImpl=d,l._parentStoryPointImpl=_,l}return Object.defineProperty(e.prototype,"parentDashboard",{get:function(){return this._parentDashboardImpl},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"parentStoryPoint",{get:function(){return this._parentStoryPointImpl},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"visualId",{get:function(){return this._visualId},enumerable:!0,configurable:!0}),e.prototype.getMaxPageRowLimit=function(){return 1e4},e.prototype.applyFilterAsync=function(n,a,u,d){ri.ErrorHelpers.verifyEnumValue(u,Zh.FilterUpdateType,"Contract.FilterUpdateType"),this.verifyActiveSheet();var _=Gr.ApiServiceRegistry.get(this._registryId).getService("filter-service");return _.applyFilterAsync(this.visualId,n,a,u,d)},e.prototype.applyRangeFilterAsync=function(n,a){ri.ErrorHelpers.verifyParameter(n,"fieldName"),ri.ErrorHelpers.verifyParameter(a,"filterOptions"),a.nullOption?ri.ErrorHelpers.verifyEnumValue(a.nullOption,oa.FilterNullOption,"FilterNullOption"):ri.ErrorHelpers.verifyRangeParamType(a.min,a.max),this.verifyActiveSheet();var u=Gr.ApiServiceRegistry.get(this._registryId).getService("filter-service");return u.applyRangeFilterAsync(this.visualId,n,a)},e.prototype.applyHierarchicalFilterAsync=function(n,a,u,d){if(ri.ErrorHelpers.verifyParameter(n,"fieldName"),ri.ErrorHelpers.verifyParameter(a,"values"),ri.ErrorHelpers.verifyEnumValue(u,Zh.FilterUpdateType,"Contract.FilterUpdateType"),!Array.isArray(a)&&!a.levels)throw new Kh.TableauError(oa.ErrorCodes.InvalidParameter,"values parameter for applyHierarchicalFilterAsync must be an array or contain a levels key");this.verifyActiveSheet();var _=Gr.ApiServiceRegistry.get(this._registryId).getService("filter-service");return _.applyHierarchicalFilterAsync(this.visualId,n,a,u,d)},e.prototype.clearFilterAsync=function(n){ri.ErrorHelpers.verifyParameter(n,"fieldName"),this.verifyActiveSheet();var a=Gr.ApiServiceRegistry.get(this._registryId).getService("filter-service");return a.clearFilterAsync(this.visualId,n)},e.prototype.applyRelativeDateFilterAsync=function(n,a){ri.ErrorHelpers.verifyStringParameter(n,"fieldName"),ri.ErrorHelpers.verifyParameter(a,"options"),ri.ErrorHelpers.verifyEnumValue(a.periodType,oa.PeriodType,"PeriodType"),ri.ErrorHelpers.verifyEnumValue(a.rangeType,oa.DateRangeType,"DateRangeType"),this.verifyActiveSheet();var u=Gr.ApiServiceRegistry.get(this._registryId).getService("filter-service");return u.applyRelativeDateFilterAsync(this.visualId,n,a)},e.prototype.getDataSourcesAsync=function(){var n=this;this.verifyActiveSheet();var a=Gr.ApiServiceRegistry.get(this._registryId).getService("data-source-service");return a.getDataSourcesAsync(this.visualId).then(function(u){var d=u,_=d.worksheetDataSchemaMap[n.name],l=[],w=_.primaryDataSource;l.push(n.createDataSourceFromInfo(d.dataSources[w]));for(var T=0,C=_.referencedDataSourceList;Tthis._handlers.length},t.prototype.triggerEvent=function(e){for(var n=0,a=this._handlers;n=this._storyPointInfoImpls.length)throw new Bb.TableauError(Lb.EmbeddingErrorCodes.IndexOutOfRange,"The index passed to this command is out of range.");if(n===this._activeStoryPointImpl.index)return Promise.resolve(this._activeStoryPointImpl);var a=this._deferred.getNewPromiseOrThrowIfBusy(),u=uy.ApiServiceRegistry.get(this._registryId).getService("story-activation-service");return u.activateStoryPointAsync(n),a},e.prototype.revertStoryPointAsync=function(n){var a=this;if(hy.ErrorHelpers.verifyParameter(n,"index"),hy.ErrorHelpers.verifyParameterType(n,"number","index"),n<0||n>=this._storyPointInfoImpls.length)throw new Bb.TableauError(Lb.EmbeddingErrorCodes.IndexOutOfRange,"The index passed to this command is out of range.");var u=uy.ApiServiceRegistry.get(this._registryId).getService("story-activation-service");return u.revertStoryPointAsync(n).then(function(d){a.updateStoryInfo(d.index,d);var _=new yD.StoryPointInfoImpl(d.caption,d.index,d.storyPointId,!1,d.updated,a);return _})},e.prototype.clearPendingPromises=function(){this._deferred&&this._deferred.reject("All pending promises cleared")},e}(iK.SheetImpl);BT.StoryImpl=oK;var UT={};Object.defineProperty(UT,"__esModule",{value:!0});var aK=function(){function t(){}return t}();UT.WorkbookImpl=aK;var dy={},jT={},VT={};Object.defineProperty(VT,"__esModule",{value:!0});var sK=function(){function t(e,n){this.visualIdPresModel=e,this.tupleId=n}return t}();VT.TooltipTextRequestModel=sK;var ai={};Object.defineProperty(ai,"__esModule",{value:!0});var lK=fl,cK=Mn,uK=yv,hK=function(){function t(e,n){this._dispatcher=e,this._registryId=n}return t.prototype.execute=function(e,n){return this._dispatcher.execute(e,n).catch(function(a){var u=a,d=lK.InternalToExternalEnumMappings.errorCode.convert(u.errorCode,uK.ShouldThrow.No);throw new cK.TableauError(d,u.message)})},t}();ai.ServiceImplBase=hK;var dK=$e&&$e.__extends||function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,u){a.__proto__=u}||function(a,u){for(var d in u)u.hasOwnProperty(d)&&(a[d]=u[d])},t(e,n)};return function(e,n){t(e,n);function a(){this.constructor=e}e.prototype=n===null?Object.create(n):(a.prototype=n.prototype,new a)}}();Object.defineProperty(jT,"__esModule",{value:!0});var Xh=hr(),pK=VT,fK=ai,mK=function(t){dK(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return Object.defineProperty(e.prototype,"serviceName",{get:function(){return"accessibility"},enumerable:!0,configurable:!0}),e.prototype.getTooltipTextAsync=function(n,a){var u,d=new pK.TooltipTextRequestModel(n,a),_=(u={},u[Xh.ParameterId.FunctionName]="getTooltipTextAsync",u[Xh.ParameterId.TooltipTextRequest]=d,u);return this.execute(Xh.VerbId.GetTooltipText,_).then(function(l){return l.result})},e.prototype.leaveMarkNavigationAsync=function(n){var a,u=(a={},a[Xh.ParameterId.FunctionName]="leaveMarkNavigationAsync",a[Xh.ParameterId.VisualId]=n,a);return this.execute(Xh.VerbId.RaiseLeaveMarkNavNotification,u).then(function(d){})},e}(fK.ServiceImplBase);jT.AccessibilityServiceImpl=mK;var $T={},gK=$e&&$e.__extends||function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,u){a.__proto__=u}||function(a,u){for(var d in u)u.hasOwnProperty(d)&&(a[d]=u[d])},t(e,n)};return function(e,n){t(e,n);function a(){this.constructor=e}e.prototype=n===null?Object.create(n):(a.prototype=n.prototype,new a)}}();Object.defineProperty($T,"__esModule",{value:!0});var yK=Nt,Nb=hr(),_K=Sc,vK=$o(),xK=ai,bK=function(t){gK(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return Object.defineProperty(e.prototype,"serviceName",{get:function(){return"animation-service"},enumerable:!0,configurable:!0}),e.prototype.replayAsync=function(n){var a,u=(a={},a[Nb.ParameterId.ReplaySpeed]=1,a);return vK.ErrorHelpers.verifyEnumValue(n,yK.ReplaySpeedType,"ReplaySpeedType"),u[Nb.ParameterId.ReplaySpeed]=_K.ExternalToInternalEnumMappings.setReplaySpeedType.convert(n),this.execute(Nb.VerbId.ReplayAnimation,u).then(function(d){})},e}(xK.ServiceImplBase);$T.AnimationServiceImpl=bK;var WT={},fa={},Av=$e&&$e.__extends||function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,u){a.__proto__=u}||function(a,u){for(var d in u)u.hasOwnProperty(d)&&(a[d]=u[d])},t(e,n)};return function(e,n){t(e,n);function a(){this.constructor=e}e.prototype=n===null?Object.create(n):(a.prototype=n.prototype,new a)}}();Object.defineProperty(fa,"__esModule",{value:!0});var GT=function(){function t(){}return t}();fa.SelectionModel=GT;var HT=function(t){Av(e,t);function e(){var n=t!==null&&t.apply(this,arguments)||this;return n.selectValues=[],n}return e}(GT);fa.ValueSelectionModel=HT;var wK=function(t){Av(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(HT);fa.HierarchicalSelectionModel=wK;var EK=function(t){Av(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(GT);fa.RangeSelectionModel=EK;var SK=function(t){Av(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(HT);fa.DimensionSelectionModel=SK;var TK=function(){function t(){this.objectIds=[]}return t}();fa.TupleSelectionModel=TK;var AK=function(){function t(){this.hierModelArr=[],this.dimModelArr=[],this.quantModelArr=[]}return t}();fa.SelectionModelsContainer=AK;var IK=function(){function t(e,n,a,u){n===void 0&&(n=[]),this.visualIdPresModel=e,this.tupleIds=n,this.selectOptions=a,this.tooltipContext=u}return t}();fa.SelectTuplesInteractionModel=IK;var CK=function(){function t(e,n,a,u){this.visualIdPresModel=e,this.tupleId=n,this.tooltipContext=a,this.allowHoverActions=u}return t}();fa.HoverTupleInteractionModel=CK;var kK=$e&&$e.__extends||function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,u){a.__proto__=u}||function(a,u){for(var d in u)u.hasOwnProperty(d)&&(a[d]=u[d])},t(e,n)};return function(e,n){t(e,n);function a(){this.constructor=e}e.prototype=n===null?Object.create(n):(a.prototype=n.prototype,new a)}}();Object.defineProperty(WT,"__esModule",{value:!0});var _D=Nt,Yi=hr(),PK=fl,py=fa,vD=Mn,DK=ai,MK=function(t){kK(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return Object.defineProperty(e.prototype,"serviceName",{get:function(){return"annotation-service"},enumerable:!0,configurable:!0}),e.prototype.annotateMarkAsync=function(n,a,u){var d,_=this.parseMarkSelectionIds([a]),l={x:0,y:0},w=""+u+"",T=(d={},d[Yi.ParameterId.FunctionName]="annotateMarkAsync",d[Yi.ParameterId.VisualId]=n,d[Yi.ParameterId.AnnotateEnum]=Yi.AnnotateEnum.Mark,d[Yi.ParameterId.TargetPoint]=l,d[Yi.ParameterId.SelectionList]=[_.selection],d[Yi.ParameterId.FormattedText]=w,d);return this.execute(Yi.VerbId.CreateAnnotation,T).then(function(C){})},e.prototype.getAnnotationsAsync=function(n){var a,u=this,d=(a={},a[Yi.ParameterId.FunctionName]="getAnnotationsAsync",a[Yi.ParameterId.VisualId]=n,a);return this.execute(Yi.VerbId.GetAnnotations,d).then(function(_){var l=_.result;return u.annotationFilterMap(l)})},e.prototype.removeAnnotationAsync=function(n,a){var u,d=this.parseAnnotationSelectionIds([a]),_=(u={},u[Yi.ParameterId.FunctionName]="removeAnnotationAsync",u[Yi.ParameterId.VisualId]=n,u[Yi.ParameterId.SelectionList]=[d.selection],u);return this.execute(Yi.VerbId.RemoveAnnotation,_).then(function(l){})},e.prototype.parseMarkSelectionIds=function(n){var a=[],u=new py.SelectionModelsContainer;if(n.forEach(function(_){var l=_.tupleId;if(l!=null&&l>0)a.push(l.toString());else throw new vD.TableauError(_D.ErrorCodes.InternalError,"invalid tupleId")}),a.length!==0){var d=new py.TupleSelectionModel;d.selectionType="tuples",d.objectIds=a,u.selection=d}return u},e.prototype.parseAnnotationSelectionIds=function(n){var a=[],u=new py.SelectionModelsContainer;if(n.forEach(function(_){var l=_.annotationId;if(l!=null&&l>=0)a.push(l.toString());else throw new vD.TableauError(_D.ErrorCodes.InternalError,"invalid annotationId")}),a.length!==0){var d=new py.TupleSelectionModel;d.selectionType="annotations",d.objectIds=a,u.selection=d}return u},e.prototype.mapAnnotation=function(n){return{annotationHTML:n.annotationText,annotationId:n.annotationId,annotationText:n.annotationPlainText,annotationType:PK.InternalToExternalEnumMappings.annotationType.convert(n.annotateEnum),tupleId:n.tupleId}},e.prototype.annotationFilterMap=function(n){var a=this,u=n.map(function(d){return a.mapAnnotation(d)});return u},e}(DK.ServiceImplBase);WT.AnnotationServiceImpl=MK;var TO={};(function(t){var e=$e&&$e.__extends||function(){var W=function(U,j){return W=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(L,V){L.__proto__=V}||function(L,V){for(var R in V)V.hasOwnProperty(R)&&(L[R]=V[R])},W(U,j)};return function(U,j){W(U,j);function L(){this.constructor=U}U.prototype=j===null?Object.create(j):(L.prototype=j.prototype,new L)}}();Object.defineProperty(t,"__esModule",{value:!0});var n=Nt,a=hr(),u=hr(),d=Vm,_=$m,l=qm,w=wv,T=Mn,C=ai;t.SENTINEL_LOGICAL_TABLE_INFO={id:a.ApiShowDataTableSentinel.SingleTableId,caption:a.ApiShowDataTableSentinel.SingleTableCaption};var P={major:1,minor:20,fix:1},z=function(W){e(U,W);function U(j,L,V){V===void 0&&(V=P);var R=W.call(this,j,L)||this;return R._platformVersion=V,R}return Object.defineProperty(U.prototype,"serviceName",{get:function(){return"data-source-service"},enumerable:!0,configurable:!0}),U.prototype.refreshAsync=function(j){var L,V=(L={},L[u.ParameterId.FunctionName]="refreshAsync",L[u.ParameterId.DeltaTimeMs]=0,L[u.ParameterId.ShouldRefreshDS]=!0,L);return j&&(V[u.ParameterId.DataSourceId]=j),this.execute(u.VerbId.RefreshDataSource,V).then(function(R){})},U.prototype.getActiveTablesAsync=function(j){var L,V=(L={},L[u.ParameterId.FunctionName]="getActiveTablesAsync",L[u.ParameterId.DataSourceId]=j,L);return this.execute(u.VerbId.GetActiveTables,V).then(function(R){var F=R.result;if(F.tables.length===0)throw new T.TableauError(n.ErrorCodes.UnsupportedMethodForDataSourceType,"getActiveTables is not supported for: "+j);return F.tables})},U.prototype.getDataSourcesAsync=function(j){var L,V=(L={},L[u.ParameterId.FunctionName]="getDataSourcesAsync",L[u.ParameterId.VisualId]=j,L);return this.execute(u.VerbId.GetDataSources,V).then(function(R){var F=R.result;return F})},U.prototype.getAllDataSourcesAsync=function(){var j,L=(j={},j[u.ParameterId.FunctionName]="getAllDataSourcesAsync",j);return this.execute(u.VerbId.GetAllDataSources,L).then(function(V){var R=V.result;return R})},U.prototype.getConnectionSummariesAsync=function(j){var L,V=(L={},L[u.ParameterId.FunctionName]="getConnectionSummariesAsync",L[u.ParameterId.DataSourceId]=j,L);return this.execute(u.VerbId.GetConnectionDescriptionSummaries,V).then(function(R){var F=R.result;return F})},U.prototype.getFieldAsync=function(j){var L,V=this,R=u.VerbId.GetFieldAndDataSource,F=(L={},L[u.ParameterId.FunctionName]="getFieldAsync",L[u.ParameterId.FieldId]=j,L);return this.execute(R,F).then(function(H){var Q=H.result[u.ParameterId.DataSource],te=H.result[u.ParameterId.Field];return V.convertField(te,V.convertDataSource(Q))})},U.prototype.getLogicalTablesAsync=function(j){var L;if(!this.isObjectModelSupportedByPlatform())return new Promise(function(R){return R([t.SENTINEL_LOGICAL_TABLE_INFO])});var V=(L={},L[u.ParameterId.FunctionName]="getLogicalTablesAsync",L[u.ParameterId.DataSourceId]=j,L);return this.execute(u.VerbId.GetLogicalTables,V).then(function(R){return R.result})},U.prototype.getUnderlyingTablesAsync=function(j){var L;if(!this.isObjectModelSupportedByPlatform())return new Promise(function(R){return R([t.SENTINEL_LOGICAL_TABLE_INFO])});var V=(L={},L[u.ParameterId.FunctionName]="getUnderlyingTablesAsync",L[u.ParameterId.VisualId]=j,L);return this.execute(u.VerbId.GetUnderlyingTables,V).then(function(R){return R.result})},U.prototype.convertField=function(j,L){return new _.Field(new w.FieldImpl(j,L))},U.prototype.convertDataSource=function(j){return new d.DataSource(new l.DataSourceImpl(j,this._registryId))},U.prototype.isObjectModelSupportedByPlatform=function(){var j={major:1,minor:13,fix:0};return a.VersionLessThan(j,this._platformVersion)},U}(C.ServiceImplBase);t.DataSourceServiceImpl=z})(TO);var qT={},Iv={};Object.defineProperty(Iv,"__esModule",{value:!0});var Er=hr(),vr=Nt,Ub=Mn,zK=function(){function t(){}return t.updateInternalExportPDFOptions=function(e,n,a){e.currentSheet=a[0],this.updateExportLayoutOptions(e,n),this.updateSheetOptions(e,a)},t.updateExportLayoutOptions=function(e,n){var a=e.exportLayoutOptions;switch(a.imageHeight=this.DefaultLayoutOptions.imageHeight,a.imageWidth=this.DefaultLayoutOptions.imageWidth,n.orientation){case vr.PrintOrientation.Landscape:a.pageOrientationOption=Er.PageOrientation.Landscape;break;case vr.PrintOrientation.Portrait:a.pageOrientationOption=Er.PageOrientation.Portrait;break;default:throw new Ub.TableauError(vr.SharedErrorCodes.InternalError,"invalid orientation for ExportPDFOption")}switch(n.pageSize){case vr.PrintPageSize.A3:a.pageSizeOption=Er.PageSizeOption.A3;break;case vr.PrintPageSize.A4:a.pageSizeOption=Er.PageSizeOption.A4;break;case vr.PrintPageSize.A5:a.pageSizeOption=Er.PageSizeOption.A5;break;case vr.PrintPageSize.B4:a.pageSizeOption=Er.PageSizeOption.B4;break;case vr.PrintPageSize.B5:a.pageSizeOption=Er.PageSizeOption.B5;break;case vr.PrintPageSize.Executive:a.pageSizeOption=Er.PageSizeOption.Executive;break;case vr.PrintPageSize.Folio:a.pageSizeOption=Er.PageSizeOption.Folio;break;case vr.PrintPageSize.Ledger:a.pageSizeOption=Er.PageSizeOption.Ledger;break;case vr.PrintPageSize.Legal:a.pageSizeOption=Er.PageSizeOption.Legal;break;case vr.PrintPageSize.Letter:a.pageSizeOption=Er.PageSizeOption.Letter;break;case vr.PrintPageSize.Note:a.pageSizeOption=Er.PageSizeOption.Note;break;case vr.PrintPageSize.Quarto:a.pageSizeOption=Er.PageSizeOption.Quarto;break;case vr.PrintPageSize.Statement:a.pageSizeOption=Er.PageSizeOption.Statement;break;case vr.PrintPageSize.Tabloid:a.pageSizeOption=Er.PageSizeOption.Tabloid;break;case vr.PrintPageSize.Unspecified:a.pageSizeOption=Er.PageSizeOption.Unspecified;break;default:throw new Ub.TableauError(vr.SharedErrorCodes.InternalError,"invalid pageSize for ExportPDFOption")}switch(n.scaling){case vr.PrintScaling.AtMost1PageHigh:this.setFitAndScaleValues(a,Er.FitPages.FitOneHigh);break;case vr.PrintScaling.AtMost1PageWide:this.setFitAndScaleValues(a,Er.FitPages.FitOneWide);break;case vr.PrintScaling.AtMost2PagesHigh:this.setFitAndScaleValues(a,Er.FitPages.FitTwoHigh);break;case vr.PrintScaling.AtMost2PagesWide:this.setFitAndScaleValues(a,Er.FitPages.FitTwoWide);break;case vr.PrintScaling.Automatic:this.setFitAndScaleValues(a,Er.PageScalingOption.ScalePctAuto);break;case vr.PrintScaling.Perc100:this.setFitAndScaleValues(a,Er.PageScalingOption.ScalePct100);break;case vr.PrintScaling.Perc200:this.setFitAndScaleValues(a,Er.PageScalingOption.ScalePct200);break;case vr.PrintScaling.Perc25:this.setFitAndScaleValues(a,Er.PageScalingOption.ScalePct25);break;case vr.PrintScaling.Perc400:this.setFitAndScaleValues(a,Er.PageScalingOption.ScalePct400);break;case vr.PrintScaling.Perc50:this.setFitAndScaleValues(a,Er.PageScalingOption.ScalePct50);break;case vr.PrintScaling.Perc60:this.setFitAndScaleValues(a,Er.PageScalingOption.ScalePct60);break;case vr.PrintScaling.Perc75:this.setFitAndScaleValues(a,Er.PageScalingOption.ScalePct75);break;case vr.PrintScaling.Perc80:this.setFitAndScaleValues(a,Er.PageScalingOption.ScalePct80);break;case vr.PrintScaling.Perc90:this.setFitAndScaleValues(a,Er.PageScalingOption.ScalePct90);break;default:throw new Ub.TableauError(vr.SharedErrorCodes.InternalError,"invalid scaling for ExportPDFOption")}},t.updateSheetOptions=function(e,n){for(var a=e.exportLayoutOptions,u=e.sheetOptions,d=0,_=u;d<_.length;d++){var l=_[d];l.exportLayoutOptions=a,l.isSelected=n.includes(l.sheet)}},t.setFitAndScaleValues=function(e,n){var a,u=this.DefaultLayoutOptions,d=u.pageFitHorizontal,_=u.pageFitVertical,l=u.pageScaleMode,w=u.pageScalePercent,T=this.fitRegex.exec(n),C=this.pctRegex.exec(n);T?(a=T.slice(1).map(function(P){return Number(P)}),d=a[0],_=a[1],l=Er.ScaleMode.ScaleFitPages):C&&(w=C.slice(1).map(function(P){return Number(P)})[0],l=Er.ScaleMode.ScalePercentage),e.pageFitHorizontal=d,e.pageFitVertical=_,e.pageScaleMode=l,e.pageScalePercent=w},t.DefaultDataOptions={ignoreAliases:!1,columnsToIncludeById:[]},t.DefaultPDFOptions={scaling:vr.PrintScaling.Automatic,pageSize:vr.PrintPageSize.Letter,orientation:vr.PrintOrientation.Portrait},t.DefaultLayoutOptions={imageHeight:0,imageWidth:0,pageFitHorizontal:1,pageFitVertical:1,pageOrientationOption:Er.PageOrientation.Portrait,pageScaleMode:Er.ScaleMode.ScaleAuto,pageScalePercent:100,pageSizeOption:Er.PageSizeOption.Letter},t.fitRegex=new RegExp("fit([0-9]+)x([0-9]+)"),t.pctRegex=new RegExp("pct([0-9]+)"),t}();Iv.ExportHelpers=zK;var RK=$e&&$e.__extends||function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,u){a.__proto__=u}||function(a,u){for(var d in u)u.hasOwnProperty(d)&&(a[d]=u[d])},t(e,n)};return function(e,n){t(e,n);function a(){this.constructor=e}e.prototype=n===null?Object.create(n):(a.prototype=n.prototype,new a)}}(),xD=$e&&$e.__awaiter||function(t,e,n,a){function u(d){return d instanceof n?d:new n(function(_){_(d)})}return new(n||(n=Promise))(function(d,_){function l(C){try{T(a.next(C))}catch(P){_(P)}}function w(C){try{T(a.throw(C))}catch(P){_(P)}}function T(C){C.done?d(C.value):u(C.value).then(l,w)}T((a=a.apply(t,e||[])).next())})},bD=$e&&$e.__generator||function(t,e){var n={label:0,sent:function(){if(d[0]&1)throw d[1];return d[1]},trys:[],ops:[]},a,u,d,_;return _={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(_[Symbol.iterator]=function(){return this}),_;function l(T){return function(C){return w([T,C])}}function w(T){if(a)throw new TypeError("Generator is already executing.");for(;n;)try{if(a=1,u&&(d=T[0]&2?u.return:T[0]?u.throw||((d=u.return)&&d.call(u),0):u.next)&&!(d=d.call(u,T[1])).done)return d;switch(u=0,d&&(T=[T[0]&2,d.value]),T[0]){case 0:case 1:d=T;break;case 4:return n.label++,{value:T[1],done:!1};case 5:n.label++,u=T[1],T=[0];continue;case 7:T=n.ops.pop(),n.trys.pop();continue;default:if(d=n.trys,!(d=d.length>0&&d[d.length-1])&&(T[0]===6||T[0]===2)){n=0;continue}if(T[0]===3&&(!d||T[1]>d[0]&&T[1]0&&F[F.length-1])&&(se[0]===6||se[0]===2)){L=0;continue}if(se[0]===3&&(!F||se[1]>F[0]&&se[1]0?se[d.ParameterId.FilterLevels]=ge:R.length>0?se[d.ParameterId.FilterValues]=R:se[d.ParameterId.FilterLevels]=[],se[d.ParameterId.FilterUpdateType]=l.ExternalToInternalEnumMappings.filterUpdateType.convert(F),se[d.ParameterId.IsExcludeMode]=H&&!!H.isExcludeMode,this.execute(te,se).then(function(xe){return V})},j.prototype.clearFilterAsync=function(L,V){var R,F=d.VerbId.ClearFilter,H=(R={},R[d.ParameterId.FunctionName]="clearFilterAsync",R);return H[d.ParameterId.VisualId]=L,H[d.ParameterId.FieldName]=V,this.execute(F,H).then(function(Q){return V})},j.prototype.applyRelativeDateFilterAsync=function(L,V,R){var F,H=d.VerbId.ApplyRelativeDateFilter,Q=(F={},F[d.ParameterId.FunctionName]="applyRelativeDateFilterAsync",F);if(Q[d.ParameterId.VisualId]=L,Q[d.ParameterId.FieldName]=V,Q[d.ParameterId.PeriodType]=l.ExternalToInternalEnumMappings.periodType.convert(R.periodType),Q[d.ParameterId.DateRangeType]=l.ExternalToInternalEnumMappings.dateRangeType.convert(R.rangeType),R.rangeType===a.DateRangeType.LastN||R.rangeType===a.DateRangeType.NextN){if(R.rangeN===void 0||R.rangeN===null)throw new _.TableauError(a.EmbeddingErrorCodes.MissingRangeNForRelativeDateFilters,"Missing rangeN field for a relative date filter of LASTN or NEXTN.");Q[d.ParameterId.RangeN]=R.rangeN}return R.anchorDate!==void 0&&R.anchorDate!==null&&(Q[d.ParameterId.AnchorDate]=this.convertAnchorDate(R.anchorDate)),this.execute(H,Q).then(function(te){return te.result})},j.prototype.getFiltersAsync=function(L){var V,R=this,F=d.VerbId.GetFilters,H=(V={},V[d.ParameterId.FunctionName]="getFiltersAsync",V);return H[d.ParameterId.VisualId]=L,this.execute(F,H).then(function(Q){var te=Q.result;return R.convertDomainFilters(te)})},j.prototype.getCategoricalDomainAsync=function(L,V,R){var F,H=this,Q=d.VerbId.GetCategoricalDomain,te=(F={},F[d.ParameterId.FunctionName]="getCategoricalDomainAsync",F);return te[d.ParameterId.VisualId]={worksheet:L},te[d.ParameterId.FieldId]=V,te[d.ParameterId.DomainType]=l.ExternalToInternalEnumMappings.filterDomainType.convert(R),this.execute(Q,te).then(function(se){var ge=se.result;return H.convertCategoricalDomain(ge,R)})},j.prototype.getRangeDomainAsync=function(L,V,R){var F,H=this,Q=d.VerbId.GetRangeDomain,te=(F={},F[d.ParameterId.FunctionName]="getRangeDomainAsync",F);return te[d.ParameterId.VisualId]={worksheet:L},te[d.ParameterId.FieldId]=V,te[d.ParameterId.DomainType]=l.ExternalToInternalEnumMappings.filterDomainType.convert(R),this.execute(Q,te).then(function(se){var ge=se.result;return H.convertRangeDomain(ge,R)})},j.prototype.getDashboardFiltersAsync=function(){var L,V=this,R=d.VerbId.GetDashboardFilters,F=(L={},L[d.ParameterId.FunctionName]="getDashboardFiltersAsync",L);return this.execute(R,F).then(function(H){var Q=H.result;return V.convertDomainFilters(Q)})},j.prototype.applyDashboardFilterAsync=function(L,V,R,F){var H,Q=d.VerbId.DashboardCategoricalFilter,te=(H={},H[d.ParameterId.FunctionName]="applyDashboardFilterAsync",H);return te[d.ParameterId.FieldName]=L,te[d.ParameterId.FilterValues]=V,te[d.ParameterId.FilterUpdateType]=l.ExternalToInternalEnumMappings.filterUpdateType.convert(R),te[d.ParameterId.IsExcludeMode]=F&&!!F.isExcludeMode,this.execute(Q,te).then(function(se){return se.result})},j.prototype.getAppliedWorksheetsAsync=function(L,V){var R;return e(this,void 0,void 0,function(){var F,H;return n(this,function(Q){switch(Q.label){case 0:return[4,this.executeGetAppliedWorksheets(L,V,"getAppliedWorksheetsAsync")];case 1:return F=Q.sent(),H=[],(R=F.worksheets)===null||R===void 0||R.map(function(te){te.isSelected&&H.push(te.worksheetName)}),[2,H]}})})},j.prototype.setAppliedWorksheetsAsync=function(L,V,R,F){return e(this,void 0,void 0,function(){var H,Q,te,se,ge;return n(this,function(xe){switch(xe.label){case 0:return[4,this.executeGetAppliedWorksheets(L,R,"getAppliedWorksheetsAsyncInternal")];case 1:if(H=xe.sent(),!H||!H.worksheets)throw new _.TableauError(a.SharedErrorCodes.InternalError,"This filter does not apply to multiple worksheets");if(Q=[],te="",H.worksheets.forEach(function(Ee){Ee.isActive&&(te=Ee.worksheetName),(Ee.isSelected||Ee.isEnabled)&&Q.push(Ee.worksheetName)}),te==="")throw new _.TableauError(a.SharedErrorCodes.InternalError,"No active worksheet");if(!F.includes(te))throw new _.TableauError(a.SharedErrorCodes.InternalError,te+" must be included in the applied worksheets");return F.forEach(function(Ee){if(!Q.includes(Ee))throw new _.TableauError(a.SharedErrorCodes.InternalError,"The field "+V+" isn't applicable to the worksheet "+Ee)}),se=d.VerbId.ChangeSharedFilter,ge={},ge[d.ParameterId.FunctionName]="setAppliedWorksheetsAsync",ge[d.ParameterId.VisualId]={worksheet:L},ge[d.ParameterId.FieldId]=R,ge[d.ParameterId.SharedFilterSheets]=F,[2,this.execute(se,ge).then(function(Ee){return F})]}})})},j.prototype.executeGetAppliedWorksheets=function(L,V,R){var F=d.VerbId.GetSharedFilter,H={};return H[d.ParameterId.FunctionName]=R,H[d.ParameterId.VisualId]={worksheet:L},H[d.ParameterId.FieldId]=V,this.execute(F,H).then(function(Q){var te=Q.result;return te})},j.prototype.convertDomainFilters=function(L){var V=this,R=[];return L.forEach(function(F){switch(F.filterType){case d.FilterType.Categorical:{var H=F;if(H)R.push(V.convertCategoricalFilter(H));else throw new Error("Invalid Categorical Filter");break}case d.FilterType.Hierarchical:{var H=F;if(H)R.push(V.convertHierarchicalFilter(H));else throw new Error("Invalid Hierarchical Filter");break}case d.FilterType.Range:{var H=F;if(H)R.push(V.convertRangeFilter(H));else throw new Error("Invalid Range Filter");break}case d.FilterType.RelativeDate:{var H=F;if(H)R.push(V.convertRelativeDateFilter(H));else throw new Error("Invalid Relative Date Filter");break}}}),R},j.prototype.convertCategoricalFilter=function(L){var V=L.values.map(function(R){return C.DataValueFactory.MakeFilterDataValue(R)});return new T.CategoricalFilter(L.visualId.worksheet,L.fieldCaption,L.fieldName,d.FilterType.Categorical,this._registryId,V,L.isExclude,L.isAllSelected)},j.prototype.convertHierarchicalFilter=function(L){var V=L.values.map(function(F){return new T.HierarchicalDataValue(C.DataValueFactory.MakeFilterDataValue(F.value),F.hierarchicalPath,F.level)}),R=L.levelInfo.map(function(F){return new T.HierarchicalLevelDetail(F.name,w.InternalToExternalEnumMappings.hierarchicalLevelSelectionState.convert(F.levelSelectionState))});return new T.HierarchicalFilter(L.visualId.worksheet,L.fieldCaption,L.fieldName,d.FilterType.Hierarchical,this._registryId,L.dimensionName,L.hierarchyCaption,L.levels,R,V,L.isAllSelected)},j.prototype.convertRangeFilter=function(L){var V=C.DataValueFactory.MakeFilterDataValue(L.min),R=C.DataValueFactory.MakeFilterDataValue(L.max);return new T.RangeFilter(L.visualId.worksheet,L.fieldCaption,L.fieldName,d.FilterType.Range,this._registryId,V,R,L.includeNullValues)},j.prototype.convertRelativeDateFilter=function(L){var V=C.DataValueFactory.MakeFilterDataValue(L.anchorDate);return new T.RelativeDateFilter(L.visualId.worksheet,L.fieldCaption,L.fieldName,a.FilterType.RelativeDate,this._registryId,V,w.InternalToExternalEnumMappings.dateStepPeriod.convert(L.periodType),w.InternalToExternalEnumMappings.dateRangeType.convert(L.rangeType),L.rangeN)},j.prototype.convertCategoricalDomain=function(L,V){var R=L.values.map(function(F){return C.DataValueFactory.MakeFilterDataValue(F)});return new T.CategoricalDomain(R,V)},j.prototype.convertRangeDomain=function(L,V){var R=C.DataValueFactory.MakeFilterDataValue(L.min),F=C.DataValueFactory.MakeFilterDataValue(L.max);return new T.RangeDomain(R,F,V)},j.prototype.convertAnchorDate=function(L){var V=L.getUTCFullYear(),R=L.getUTCMonth()+1,F=L.getUTCDate(),H=L.getUTCHours(),Q=L.getUTCMinutes(),te=L.getUTCSeconds();if(isNaN(V)||isNaN(R)||isNaN(F)||isNaN(H)||isNaN(Q)||isNaN(te))throw new _.TableauError(a.EmbeddingErrorCodes.InvalidDateParameter,"Invalid date parameter: anchorDate");var se=V+"-"+R+"-"+F+" "+H+":"+Q+":"+te;return se},j.prototype.apiFilterHandlerCheckForCommandError=function(L){if(L[u.ParameterId.ParameterError])throw L[u.ParameterId.InvalidFieldCaption]?new _.TableauError(a.SharedErrorCodes.InvalidFilterFieldName,L[u.ParameterId.InvalidFieldCaption]):L[u.ParameterId.InvalidValues]?new _.TableauError(a.SharedErrorCodes.InvalidFilterFieldValue,L[u.ParameterId.InvalidValues]):L[u.ParameterId.InvalidAggFieldName]?new _.TableauError(a.SharedErrorCodes.InvalidAggregationFieldName,L[u.ParameterId.InvalidAggFieldName]):new _.TableauError(a.SharedErrorCodes.ServerError,"Server Error")},j}(z.ServiceImplBase);return fy.FilterServiceImpl=W,fy}var my={},gy,YK=new Uint8Array(16);function AO(){if(!gy&&(gy=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!gy))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return gy(YK)}const QK=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function kv(t){return typeof t=="string"&&QK.test(t)}var wi=[];for(var jb=0;jb<256;++jb)wi.push((jb+256).toString(16).substr(1));function Pv(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=(wi[t[e+0]]+wi[t[e+1]]+wi[t[e+2]]+wi[t[e+3]]+"-"+wi[t[e+4]]+wi[t[e+5]]+"-"+wi[t[e+6]]+wi[t[e+7]]+"-"+wi[t[e+8]]+wi[t[e+9]]+"-"+wi[t[e+10]]+wi[t[e+11]]+wi[t[e+12]]+wi[t[e+13]]+wi[t[e+14]]+wi[t[e+15]]).toLowerCase();if(!kv(n))throw TypeError("Stringified UUID is invalid");return n}var ED,Vb,$b=0,Wb=0;function JK(t,e,n){var a=e&&n||0,u=e||new Array(16);t=t||{};var d=t.node||ED,_=t.clockseq!==void 0?t.clockseq:Vb;if(d==null||_==null){var l=t.random||(t.rng||AO)();d==null&&(d=ED=[l[0]|1,l[1],l[2],l[3],l[4],l[5]]),_==null&&(_=Vb=(l[6]<<8|l[7])&16383)}var w=t.msecs!==void 0?t.msecs:Date.now(),T=t.nsecs!==void 0?t.nsecs:Wb+1,C=w-$b+(T-Wb)/1e4;if(C<0&&t.clockseq===void 0&&(_=_+1&16383),(C<0||w>$b)&&t.nsecs===void 0&&(T=0),T>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");$b=w,Wb=T,Vb=_,w+=122192928e5;var P=((w&268435455)*1e4+T)%4294967296;u[a++]=P>>>24&255,u[a++]=P>>>16&255,u[a++]=P>>>8&255,u[a++]=P&255;var z=w/4294967296*1e4&268435455;u[a++]=z>>>8&255,u[a++]=z&255,u[a++]=z>>>24&15|16,u[a++]=z>>>16&255,u[a++]=_>>>8|128,u[a++]=_&255;for(var W=0;W<6;++W)u[a+W]=d[W];return e||Pv(u)}function IO(t){if(!kv(t))throw TypeError("Invalid UUID");var e,n=new Uint8Array(16);return n[0]=(e=parseInt(t.slice(0,8),16))>>>24,n[1]=e>>>16&255,n[2]=e>>>8&255,n[3]=e&255,n[4]=(e=parseInt(t.slice(9,13),16))>>>8,n[5]=e&255,n[6]=(e=parseInt(t.slice(14,18),16))>>>8,n[7]=e&255,n[8]=(e=parseInt(t.slice(19,23),16))>>>8,n[9]=e&255,n[10]=(e=parseInt(t.slice(24,36),16))/1099511627776&255,n[11]=e/4294967296&255,n[12]=e>>>24&255,n[13]=e>>>16&255,n[14]=e>>>8&255,n[15]=e&255,n}function eX(t){t=unescape(encodeURIComponent(t));for(var e=[],n=0;n>5]>>>u%32&255,_=parseInt(a.charAt(d>>>4&15)+a.charAt(d&15),16);e.push(_)}return e}function kO(t){return(t+64>>>9<<4)+14+1}function oX(t,e){t[e>>5]|=128<>5]|=(t[a/8]&255)<>16)+(e>>16)+(n>>16);return a<<16|n&65535}function sX(t,e){return t<>>32-e}function Dv(t,e,n,a,u,d){return ac(sX(ac(ac(e,t),ac(a,d)),u),n)}function Bi(t,e,n,a,u,d,_){return Dv(e&n|~e&a,t,e,u,d,_)}function Ni(t,e,n,a,u,d,_){return Dv(e&a|n&~a,t,e,u,d,_)}function Ui(t,e,n,a,u,d,_){return Dv(e^n^a,t,e,u,d,_)}function ji(t,e,n,a,u,d,_){return Dv(n^(e|~a),t,e,u,d,_)}var lX=CO("v3",48,nX);const cX=lX;function uX(t,e,n){t=t||{};var a=t.random||(t.rng||AO)();if(a[6]=a[6]&15|64,a[8]=a[8]&63|128,e){n=n||0;for(var u=0;u<16;++u)e[n+u]=a[u];return e}return Pv(a)}function hX(t,e,n,a){switch(t){case 0:return e&n^~e&a;case 1:return e^n^a;case 2:return e&n^e&a^n&a;case 3:return e^n^a}}function Gb(t,e){return t<>>32-e}function dX(t){var e=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof t=="string"){var a=unescape(encodeURIComponent(t));t=[];for(var u=0;u>>0;F=R,R=V,V=Gb(L,30)>>>0,L=j,j=te}n[0]=n[0]+j>>>0,n[1]=n[1]+L>>>0,n[2]=n[2]+V>>>0,n[3]=n[3]+R>>>0,n[4]=n[4]+F>>>0}return[n[0]>>24&255,n[0]>>16&255,n[0]>>8&255,n[0]&255,n[1]>>24&255,n[1]>>16&255,n[1]>>8&255,n[1]&255,n[2]>>24&255,n[2]>>16&255,n[2]>>8&255,n[2]&255,n[3]>>24&255,n[3]>>16&255,n[3]>>8&255,n[3]&255,n[4]>>24&255,n[4]>>16&255,n[4]>>8&255,n[4]&255]}var pX=CO("v5",80,dX);const fX=pX,mX="00000000-0000-0000-0000-000000000000";function gX(t){if(!kv(t))throw TypeError("Invalid UUID");return parseInt(t.substr(14,1),16)}const yX=Object.freeze(Object.defineProperty({__proto__:null,NIL:mX,parse:IO,stringify:Pv,v1:JK,v3:cX,v4:uX,v5:fX,validate:kv,version:gX},Symbol.toStringTag,{value:"Module"})),_X=WM(yX);var XT={},vX=$e&&$e.__awaiter||function(t,e,n,a){function u(d){return d instanceof n?d:new n(function(_){_(d)})}return new(n||(n=Promise))(function(d,_){function l(C){try{T(a.next(C))}catch(P){_(P)}}function w(C){try{T(a.throw(C))}catch(P){_(P)}}function T(C){C.done?d(C.value):u(C.value).then(l,w)}T((a=a.apply(t,e||[])).next())})},xX=$e&&$e.__generator||function(t,e){var n={label:0,sent:function(){if(d[0]&1)throw d[1];return d[1]},trys:[],ops:[]},a,u,d,_;return _={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(_[Symbol.iterator]=function(){return this}),_;function l(T){return function(C){return w([T,C])}}function w(T){if(a)throw new TypeError("Generator is already executing.");for(;n;)try{if(a=1,u&&(d=T[0]&2?u.return:T[0]?u.throw||((d=u.return)&&d.call(u),0):u.next)&&!(d=d.call(u,T[1])).done)return d;switch(u=0,d&&(T=[T[0]&2,d.value]),T[0]){case 0:case 1:d=T;break;case 4:return n.label++,{value:T[1],done:!1};case 5:n.label++,u=T[1],T=[0];continue;case 7:T=n.ops.pop(),n.trys.pop();continue;default:if(d=n.trys,!(d=d.length>0&&d[d.length-1])&&(T[0]===6||T[0]===2)){n=0;continue}if(T[0]===3&&(!d||T[1]>d[0]&&T[1]0&&U0?n:0},e}(RX.ServiceImplBase);QT.SelectionServiceImpl=OX;var zv={},FX=$e&&$e.__extends||function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,u){a.__proto__=u}||function(a,u){for(var d in u)u.hasOwnProperty(d)&&(a[d]=u[d])},t(e,n)};return function(e,n){t(e,n);function a(){this.constructor=e}e.prototype=n===null?Object.create(n):(a.prototype=n.prototype,new a)}}();Object.defineProperty(zv,"__esModule",{value:!0});var vu=hr(),LX=ai,BX=function(t){FX(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return Object.defineProperty(e.prototype,"serviceName",{get:function(){return"size-service"},enumerable:!0,configurable:!0}),e.prototype.changeSizeAsync=function(n,a){var u,d,_,l,w,T=(u={},u[vu.ParameterId.FunctionName]="changeSizeAsync",u[vu.ParameterId.SheetName]=n,u[vu.ParameterId.MinHeight]=((d=a.minSize)===null||d===void 0?void 0:d.height)||0,u[vu.ParameterId.MinWidth]=((_=a.minSize)===null||_===void 0?void 0:_.width)||0,u[vu.ParameterId.MaxHeight]=((l=a.maxSize)===null||l===void 0?void 0:l.height)||0,u[vu.ParameterId.MaxWidth]=((w=a.maxSize)===null||w===void 0?void 0:w.width)||0,u);return this.execute(vu.VerbId.SetSheetSize,T).then(function(C){})},e}(LX.ServiceImplBase);zv.SizeServiceImpl=BX;var JT={},NX=$e&&$e.__extends||function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,u){a.__proto__=u}||function(a,u){for(var d in u)u.hasOwnProperty(d)&&(a[d]=u[d])},t(e,n)};return function(e,n){t(e,n);function a(){this.constructor=e}e.prototype=n===null?Object.create(n):(a.prototype=n.prototype,new a)}}();Object.defineProperty(JT,"__esModule",{value:!0});var Hb=hr(),UX=ai,jX=function(t){NX(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return Object.defineProperty(e.prototype,"serviceName",{get:function(){return"visual-model-service"},enumerable:!0,configurable:!0}),e.prototype.getVisualSpecificationAsync=function(n){var a,u=(a={},a[Hb.ParameterId.FunctionName]="getVisualSpecificationAsync",a[Hb.ParameterId.WorksheetName]=n.worksheet,a);return this.execute(Hb.VerbId.GetVisualSpecification,u).then(function(d){var _=d.result;return _})},e}(UX.ServiceImplBase);JT.VisualModelServiceImpl=jX;var _y={},ID;function VX(){if(ID)return _y;ID=1;var t=$e&&$e.__extends||function(){var d=function(_,l){return d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(w,T){w.__proto__=T}||function(w,T){for(var C in T)T.hasOwnProperty(C)&&(w[C]=T[C])},d(_,l)};return function(_,l){d(_,l);function w(){this.constructor=_}_.prototype=l===null?Object.create(l):(w.prototype=l.prototype,new w)}}();Object.defineProperty(_y,"__esModule",{value:!0});var e=hr(),n=wO(),a=ai,u=function(d){t(_,d);function _(){return d!==null&&d.apply(this,arguments)||this}return Object.defineProperty(_.prototype,"serviceName",{get:function(){return"viz-service"},enumerable:!0,configurable:!0}),_.prototype.createVizImageAsync=function(l){var w,T=(w={},w[e.ParameterId.FunctionName]="createVizImageAsync",w[e.ParameterId.VizAPIInputJson]=JSON.stringify(l),w);return this.execute(e.VerbId.VizAPI,T).then(function(C){var P=C.result;return P})},_.prototype.activateSheetAsync=function(l){var w,T=(w={},w[e.ParameterId.FunctionName]="activateSheetAsync",w[e.ParameterId.SwitchToSheetName]=l,w);return this.execute(e.VerbId.ActivateSheet,T).then(function(){})},_.prototype.getCustomViewsAsync=function(){var l,w=this,T=(l={},l[e.ParameterId.FunctionName]="getCustomViewsAsync",l);return this.execute(e.VerbId.GetCustomViews,T).then(function(C){var P=C.result;return P.map(function(z){return new n.CustomViewImpl(z,w._registryId)})})},_.prototype.showCustomViewAsync=function(l){var w,T=this,C=(w={},w[e.ParameterId.FunctionName]="showCustomViewAsync",w[e.ParameterId.CustomViewName]=l||"",w);return this.execute(e.VerbId.ShowCustomView,C).then(function(P){var z,W=P.result;return!((z=W)===null||z===void 0)&&z.luid?new n.CustomViewImpl(W,T._registryId):void 0})},_.prototype.removeCustomViewAsync=function(l){var w,T=this,C=(w={},w[e.ParameterId.FunctionName]="removeCustomViewAsync",w[e.ParameterId.CustomViewName]=l,w);return this.execute(e.VerbId.RemoveCustomView,C).then(function(P){var z=P.result;return new n.CustomViewImpl(z,T._registryId)})},_.prototype.saveCustomViewAsync=function(l){var w,T=this,C=(w={},w[e.ParameterId.FunctionName]="saveCustomViewAsync",w[e.ParameterId.CustomViewName]=l,w[e.ParameterId.CustomViewIsDefault]=!1,w);return this.execute(e.VerbId.SaveWorkbookAsCustomView,C).then(function(P){var z=P.result;return new n.CustomViewImpl(z,T._registryId)})},_.prototype.setActiveCustomViewAsDefaultAsync=function(){var l,w=(l={},l[e.ParameterId.FunctionName]="setActiveCustomViewAsDefaultAsync",l);return this.execute(e.VerbId.SetActiveCustomViewAsDefault,w).then(function(){})},_.prototype.saveAsync=function(l){var w,T=this,C=(w={},w[e.ParameterId.FunctionName]="saveAsync",w[e.ParameterId.CustomViewLuid]=l.luid,w[e.ParameterId.CustomViewName]=l.name,w[e.ParameterId.CustomViewIsDefault]=l.isDefault,w[e.ParameterId.CustomViewIsPublic]=l.shared,w);return this.execute(e.VerbId.UpdateCustomView,C).then(function(P){var z=P.result;return new n.CustomViewImpl(z,T._registryId)})},_.prototype.getCurrentSrcAsync=function(){var l,w=(l={},l[e.ParameterId.FunctionName]="getCurrentSrcAsync",l);return this.execute(e.VerbId.GetCurrentSrc,w).then(function(T){return T.result})},_}(a.ServiceImplBase);return _y.VizServiceImpl=u,_y}var eA={},$X=$e&&$e.__extends||function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,u){a.__proto__=u}||function(a,u){for(var d in u)u.hasOwnProperty(d)&&(a[d]=u[d])},t(e,n)};return function(e,n){t(e,n);function a(){this.constructor=e}e.prototype=n===null?Object.create(n):(a.prototype=n.prototype,new a)}}();Object.defineProperty(eA,"__esModule",{value:!0});var WX=Nt,Xl=hr(),GX=Sc,vy=$o(),HX=Vd(),qX=ai,ZX=function(t){$X(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return Object.defineProperty(e.prototype,"serviceName",{get:function(){return"zone-service"},enumerable:!0,configurable:!0}),e.prototype.setVisibilityAsync=function(n,a,u){var d,_=(d={},d[Xl.ParameterId.FunctionName]="setVisibilityAsync",d[Xl.ParameterId.Dashboard]=n,d[Xl.ParameterId.ZoneIdsVisibilityMap]={},d),l=HX.Param.convertParameterToMap(u,"zoneVisibilityMap");return l.forEach(function(w,T){vy.ErrorHelpers.verifyZoneIsValid(a,Number.parseInt(T,10)),vy.ErrorHelpers.verifyEnumValue(w,WX.DashboardObjectVisibilityType,"DashboardObjectVisibilityType"),_[Xl.ParameterId.ZoneIdsVisibilityMap][T]=GX.ExternalToInternalEnumMappings.setVisibilityType.convert(w)}),this.execute(Xl.VerbId.SetZoneVisibility,_).then(function(w){})},e.prototype.moveAndResizeAsync=function(n,a,u){var d,_=(d={},d[Xl.ParameterId.Dashboard]=n,d[Xl.ParameterId.DashboardObjectPositionAndSizeUpdateList]=u,d);return u.forEach(function(l){vy.ErrorHelpers.verifyZoneIsValidAndFloating(a,l.dashboardObjectID),vy.ErrorHelpers.verifyWidthAndHeightOfDashboardObjectPositionAndSizeUpdate(l)}),this.execute(Xl.VerbId.MoveAndResizeZones,_).then(function(l){})},e}(qX.ServiceImplBase);eA.ZoneServiceImpl=ZX;var CD;function KX(){if(CD)return dy;CD=1,Object.defineProperty(dy,"__esModule",{value:!0});var t=pa,e=jT,n=$T,a=WT,u=TO,d=qT,_=ZT,l=XK(),w=EX(),T=Mv,C=YT,P=QT,z=zv,W=JT,U=VX(),j=eA;function L(V,R,F){t.ApiServiceRegistry.get(R).registerService(new n.AnimationServiceImpl(V,R)),t.ApiServiceRegistry.get(R).registerService(new u.DataSourceServiceImpl(V,R,F)),t.ApiServiceRegistry.get(R).registerService(new d.ExportServiceImpl(V,R)),t.ApiServiceRegistry.get(R).registerService(new w.GetDataServiceImpl(V,R)),t.ApiServiceRegistry.get(R).registerService(new l.FilterServiceImpl(V,R)),t.ApiServiceRegistry.get(R).registerService(new T.NotificationServiceImpl(V)),t.ApiServiceRegistry.get(R).registerService(new C.ParametersServiceImpl(V,R)),t.ApiServiceRegistry.get(R).registerService(new P.SelectionServiceImpl(V,R)),t.ApiServiceRegistry.get(R).registerService(new a.AnnotationServiceImpl(V,R)),t.ApiServiceRegistry.get(R).registerService(new j.ZoneServiceImpl(V,R)),t.ApiServiceRegistry.get(R).registerService(new z.SizeServiceImpl(V,R)),t.ApiServiceRegistry.get(R).registerService(new W.VisualModelServiceImpl(V,R)),t.ApiServiceRegistry.get(R).registerService(new U.VizServiceImpl(V,R)),t.ApiServiceRegistry.get(R).registerService(new _.ExternalContextMenuServiceImpl(V,R)),t.ApiServiceRegistry.get(R).registerService(new e.AccessibilityServiceImpl(V,R))}return dy.registerAllSharedServices=L,dy}var tA={},XX=$e&&$e.__extends||function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,u){a.__proto__=u}||function(a,u){for(var d in u)u.hasOwnProperty(d)&&(a[d]=u[d])},t(e,n)};return function(e,n){t(e,n);function a(){this.constructor=e}e.prototype=n===null?Object.create(n):(a.prototype=n.prototype,new a)}}();Object.defineProperty(tA,"__esModule",{value:!0});var kD=hr(),YX=ai,QX=function(t){XX(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return Object.defineProperty(e.prototype,"serviceName",{get:function(){return"client-info-service"},enumerable:!0,configurable:!0}),e.prototype.getClientInfoAsync=function(){var n,a=kD.VerbId.GetEmbeddingClientInfo,u=(n={},n[kD.ParameterId.FunctionName]="getClientInfoAsync",n);return this.execute(a,u).then(function(d){var _=d.result;return _})},e}(YX.ServiceImplBase);tA.ClientInfoServiceImpl=QX;var rA={},JX=$e&&$e.__extends||function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,u){a.__proto__=u}||function(a,u){for(var d in u)u.hasOwnProperty(d)&&(a[d]=u[d])},t(e,n)};return function(e,n){t(e,n);function a(){this.constructor=e}e.prototype=n===null?Object.create(n):(a.prototype=n.prototype,new a)}}();Object.defineProperty(rA,"__esModule",{value:!0});var vs=hr(),eY=ai,tY=function(t){JX(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return Object.defineProperty(e.prototype,"serviceName",{get:function(){return"story-activation-service"},enumerable:!0,configurable:!0}),e.prototype.activateNextStoryPointAsync=function(){var n,a=vs.VerbId.ActivateNextStoryPoint,u=(n={},n[vs.ParameterId.FunctionName]="activateNextStoryPointAsync",n);return this.execute(a,u).then(function(d){})},e.prototype.activatePreviousStoryPointAsync=function(){var n,a=vs.VerbId.ActivatePreviousStoryPoint,u=(n={},n[vs.ParameterId.FunctionName]="activatePreviousStoryPointAsync",n);return this.execute(a,u).then(function(d){})},e.prototype.activateStoryPointAsync=function(n){var a,u=vs.VerbId.ActivateStoryPoint,d=(a={},a[vs.ParameterId.FunctionName]="activateStoryPointAsync",a);return d[vs.ParameterId.StoryPointIndex]=n,this.execute(u,d).then(function(_){})},e.prototype.revertStoryPointAsync=function(n){var a,u=vs.VerbId.RevertStoryPoint,d=(a={},a[vs.ParameterId.FunctionName]="revertStoryPointAsync",a);return d[vs.ParameterId.StoryPointIndex]=n,this.execute(u,d).then(function(_){return _.result})},e}(eY.ServiceImplBase);rA.StoryActivationServiceImpl=tY;var nA={};Object.defineProperty(nA,"__esModule",{value:!0});var xy=hr(),rY=function(){function t(e,n){var a=this;this._apiDelegateDispatcher=e,this._versionConverter=xy.CreateExternalCompatibleVersionConverter(xy.INTERNAL_CONTRACT_VERSION,n),this._notificationHandlers=[],e.registerNotificationHandler(function(u){if(a._notificationHandlers.length!==0){var d=a._versionConverter.upgradeNotification(u);a._notificationHandlers.forEach(function(_){_(d)})}})}return t.needsVersionConverter=function(e){return xy.VersionLessThan(e,xy.INTERNAL_CONTRACT_VERSION)},t.prototype.execute=function(e,n){var a=this;try{var u=this._versionConverter.downgradeExecuteCall(e,n);return this._apiDelegateDispatcher.execute(u.verb,u.parameters).then(function(d){var _=a._versionConverter.upgradeExecuteReturn(d,e,n);return _})}catch(d){return Promise.reject(d)}},t.prototype.registerNotificationHandler=function(e){this._notificationHandlers.push(e)},t.prototype.unregisterNotificationHandler=function(e){this._notificationHandlers=this._notificationHandlers.filter(function(n){return n!==e})},t}();nA.VersionedExternalApiDispatcher=rY;var PD;function sn(){return PD||(PD=1,function(t){function e(gt){for(var je in gt)t.hasOwnProperty(je)||(t[je]=gt[je])}Object.defineProperty(t,"__esModule",{value:!0});var n=fT;t.ApiVersion=n.ApiVersion,e(mT);var a=gv;t.CrossFrameDispatcher=a.CrossFrameDispatcher;var u=Vm;t.DataSource=u.DataSource;var d=Sc;t.ExternalToInternalEnumMappings=d.ExternalToInternalEnumMappings;var _=fl;t.InternalToExternalEnumMappings=_.InternalToExternalEnumMappings;var l=zT;t.EventListenerManager=l.EventListenerManager;var w=$m;t.Field=w.Field;var T=wO();t.CustomViewImpl=T.CustomViewImpl;var C=_v;t.DashboardImpl=C.DashboardImpl;var P=xv;t.DashboardObjectImpl=P.DashboardObjectImpl;var z=qm;t.DataSourceImpl=z.DataSourceImpl;var W=Ev;t.ParameterImpl=W.ParameterImpl;var U=$d;t.SheetImpl=U.SheetImpl;var j=Gm;t.SheetInfoImpl=j.SheetInfoImpl;var L=LT;t.SingleEventManagerImpl=L.SingleEventManagerImpl;var V=BT;t.StoryImpl=V.StoryImpl;var R=Sv;t.StoryPointImpl=R.StoryPointImpl;var F=Tv;t.StoryPointInfoImpl=F.StoryPointInfoImpl;var H=UT;t.WorkbookImpl=H.WorkbookImpl;var Q=Hm;t.WorksheetImpl=Q.WorksheetImpl;var te=vv;t.Point=te.Point,e(KX()),e(pa);var se=tA;t.ClientInfoServiceImpl=se.ClientInfoServiceImpl;var ge=Mv;t.NotificationServiceImpl=ge.NotificationServiceImpl;var xe=Ym;t.NotificationServiceImplBase=xe.NotificationServiceImplBase,t.Registration=xe.Registration;var Ee=ai;t.ServiceImplBase=Ee.ServiceImplBase;var Be=zv;t.SizeServiceImpl=Be.SizeServiceImpl;var Fe=rA;t.StoryActivationServiceImpl=Fe.StoryActivationServiceImpl;var Ve=Mn;t.TableauError=Ve.TableauError;var kt=Km;t.Deferred=kt.Deferred;var Dt=$o();t.ErrorHelpers=Dt.ErrorHelpers;var Ut=Iv;t.ExportHelpers=Ut.ExportHelpers;var cr=Wm;t.SheetUtils=cr.SheetUtils;var qe=cv;t.VersionNumber=qe.VersionNumber;var Tt=nA;t.VersionedExternalApiDispatcher=Tt.VersionedExternalApiDispatcher}(hb)),hb}var Rv={},Ov={},Tc={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.SANITIZED_VALUES={YES_VALUE:"y",NO_VALUE:"n"};const e=new Set(["https:","http:"]);class n{build(){return this._url}appendDefaultParameters(T){for(const C of T.keys()){const P=T.get(C);P&&!this._url.searchParams.has(C)&&this._url.searchParams.append(C,P)}return this}appendUserOptions(T){for(const C of Object.keys(T)){if(T[C]===null||T[C]===void 0)continue;const P=this._optionNames[C];if(!P)continue;const z=this.sanitizeParameterValue(P,T[C]);this._url.searchParams.append(P,z)}return this}appendCustomParams(T){for(const C of T)this._url.searchParams.set(C.name,C.value);return this}setToken(T){if(this._token)throw new Error(`The token has already been set to ${this._token}`);if(!T)return this;this._token=T;const C=this._url.toString().substring(this._url.origin.length);return this._url=new URL(`${this._url.origin}/vizportal/api/web/v1/auth/embed/target`),this._url.searchParams.append("token",T),this._url.searchParams.append("target",C),this}sanitizeValue(T){const C=String(T);switch(C){case"true":return t.SANITIZED_VALUES.YES_VALUE;case"false":return t.SANITIZED_VALUES.NO_VALUE;default:return C}}}t.EmbeddingUrlBuilder=n;function a(w){u(w)}t.validateUrl=a;function u(w){const T=w.protocol;if(!e.has(T))throw new Error(`Invalid protocol in URL '${w}'. The protocols supported are ${Array.from(e).join(", ")}.`)}function d(w){const C=l(new URL(w.toString())).pathname.split("/").filter(P=>P);return C.length===0?"":C[0]==="site"?C[1]:C[0]==="pulse"&&C[1]==="site"?C[2]:""}t.getSiteIdForPulse=d;function _(w){const C=l(new URL(w.toString())).pathname.split("/").filter(P=>P);return C.length===0||C[0]!=="t"||C.length<2?"":C[1]}t.getSiteId=_;function l(w){let T=w.toString();return T=T.replace("/#/site/","/t/").replace("/#/","/"),new URL(T)}t.canonicalizeVizPortalRoutingHashes=l})(Tc);Object.defineProperty(Ov,"__esModule",{value:!0});const nY=Nt,Ql=hr(),DO=sn(),MO=Tc;function iY(t,e,n,a){const u=t.split("?")[0];let d;try{d=new URL(u),MO.validateUrl(d)}catch(w){throw new DO.TableauError(nY.EmbeddingErrorCodes.InvalidUrl,w.message)}const _=oY(d,n),l=new zO(d).appendDefaultParameters(_).appendUserOptions(e).appendCustomParams(a);return e.iframeAuth&&l.setToken(e.token),l.build()}Ov.createAskDataUrl=iY;function oY(t,e){const n=new Map,a=`${Ql.INTERNAL_CONTRACT_VERSION.major}.${Ql.INTERNAL_CONTRACT_VERSION.minor}.${Ql.INTERNAL_CONTRACT_VERSION.fix}`;n.set(Ql.AskDataOptionNames.ApiInternalVersion,a);const u=DO.ApiVersion.Instance.formattedValue;return n.set(Ql.AskDataOptionNames.ApiExternalVersion,u),n.set(Ql.AskDataOptionNames.ApiID,`embhost${e}`),n.set(Ql.AskDataOptionNames.AskDataWebComponent,"true"),n}class zO extends MO.EmbeddingUrlBuilder{constructor(e){super(),this._url=e,this._optionNames=Ql.AskDataOptionNames}sanitizeParameterValue(e,n){return this.sanitizeValue(n)}}Ov.EmbeddingAskDataUrlBuilder=zO;var Uu={},iA={},aY=$e&&$e.__awaiter||function(t,e,n,a){function u(d){return d instanceof n?d:new n(function(_){_(d)})}return new(n||(n=Promise))(function(d,_){function l(C){try{T(a.next(C))}catch(P){_(P)}}function w(C){try{T(a.throw(C))}catch(P){_(P)}}function T(C){C.done?d(C.value):u(C.value).then(l,w)}T((a=a.apply(t,e||[])).next())})};Object.defineProperty(iA,"__esModule",{value:!0});class sY{constructor(){this.queue=[],this.pending=0,this.concurrency=1}add(e){return new Promise((a,u)=>{this.queue.push(()=>aY(this,void 0,void 0,function*(){try{const d=yield e();a(d)}catch(d){u(d)}finally{this.pending--,this.poll()}}))})}poll(){if(this.pending0){const e=this.queue.shift();this.pending++,e()}}size(){return this.queue.length}}iA.PromiseQueue=sY;Object.defineProperty(Uu,"__esModule",{value:!0});const lY=iA;class Qm{static authRequired(e,n){if(!n)return!0;try{const a=new URL(e);if(this.signedInOrigins.has(a.origin))return!1}catch{return!0}return!0}static updateSignedInOrigin(e,n){if(n)try{const a=new URL(e);this.signedInOrigins.add(a.origin)}catch{return}}static clearOrigin(e,n){if(n&&e)try{const a=new URL(e);this.signedInOrigins.delete(a.origin)}catch{return}}static registerWebComponent(e){const n=this.embeddingIndex;return this.webComponents.set(n,e),this.embeddingIndex++,n}static unregisterWebComponent(e){this.webComponents.delete(e)}static getWebComponents(){const e=new Map;return this.webComponents.forEach((n,a)=>{e.set(a,n)}),e}static synchronizeRender(e){const n=this.queue.add(e);return this.queue.poll(),n}static clear(){this.webComponents.clear()}}Uu.WebComponentManager=Qm;Qm.embeddingIndex=0;Qm.webComponents=new Map;Qm.queue=new lY.PromiseQueue;Qm.signedInOrigins=new Set;var Jm={},oA={};Object.defineProperty(oA,"__esModule",{value:!0});class cY{constructor(e,n){this._errorCode=e,this._message=n}get message(){return this._message}get errorCode(){return this._errorCode}}oA.VizLoadErrorEvent=cY;var Fv={};Object.defineProperty(Fv,"__esModule",{value:!0});class RO{}Fv.HtmlElementHelpers=RO;RO.getContentSize=t=>{const e=window.getComputedStyle(t),n=parseInt(e.paddingLeft,10)||0,a=parseInt(e.paddingTop,10)||0,u=parseInt(e.paddingRight,10)||0,d=parseInt(e.paddingBottom,10)||0,_=t.clientWidth-Math.round(n+u),l=t.clientHeight-Math.round(a+d);return{width:_,height:l}};(function(t){var e=$e&&$e.__awaiter||function(C,P,z,W){function U(j){return j instanceof z?j:new z(function(L){L(j)})}return new(z||(z=Promise))(function(j,L){function V(H){try{F(W.next(H))}catch(Q){L(Q)}}function R(H){try{F(W.throw(H))}catch(Q){L(Q)}}function F(H){H.done?j(H.value):U(H.value).then(V,R)}F((W=W.apply(C,P||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0});const n=Nt,a=sn(),u=oA,d=Fv,_=Uu;var l;(function(C){C.Skip="skip",C.Success="success",C.Failure="failure"})(l=t.TableauAuthResponse||(t.TableauAuthResponse={}));const w={allowTransparency:"allowTransparency",allowFullScreen:"allowFullScreen",style:"style",class:"class",loading:"loading"};t.getLocalizedTitle=C=>{const P={en:"Data Visualization","en-GB":"Data Visualisation",fr:"Visualisation de données",es:"Visualización de datos",it:"Visualizzazione dati",pt:"Visualização de dados",ja:"データ ビジュアライゼーション",de:"Datenvisualisierung",ko:"데이터 비주얼리제이션","zh-CN":"数据可视化","zh-TW":"資料可視化"};return P[C]||P[C.substr(0,2)]||P.en};class T extends HTMLElement{constructor(){super(),this._initialized=!1,this._embeddingIdCounter=0,this._fixedSize=!1,this.attachShadow({mode:"open"})}disconnectedCallback(){var P,z;this._iframe&&((P=this.shadowRoot)===null||P===void 0||P.removeChild(this._iframe)),this._iframeStyle&&((z=this.shadowRoot)===null||z===void 0||z.removeChild(this._iframeStyle)),_.WebComponentManager.clearOrigin(this.src,this.forceTokenSync),_.WebComponentManager.unregisterWebComponent(this._embeddingIdCounter),this._initialized=!1}connectedCallback(){document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{this.initialize()}):this.initialize()}attributeChangedCallback(P,z,W){if(!(!z&&z===W)){if(P===n.WebComponentAttributes.Width||P===n.WebComponentAttributes.Height){this.setFrameSize();return}P===n.WebComponentAttributes.Token&&z&&z!==W&&_.WebComponentManager.clearOrigin(this.src,this.forceTokenSync),_.WebComponentManager.synchronizeRender(this.updateRenderingIfInitialized.bind(this,this.src))}}static get observedAttributes(){return Object.values(n.WebComponentAttributes)}initialize(){this._initialized||(this.style.display="flex",this.setupFrame(),this.registerAttributeAuthErrorEvent(),_.WebComponentManager.synchronizeRender(this.updateRendering.bind(this,this.src)))}get fixedSize(){return this._fixedSize}readCustomParamsFromChildren(){const P=[];return Array.from(this.children).forEach(z=>{z.localName===n.WebComponentChildElements.CustomParameter&&z.getAttribute(n.WebComponentChildElementAttributes.Name)&&z.getAttribute(n.WebComponentChildElementAttributes.Value)&&P.push({name:z.getAttribute(n.WebComponentChildElementAttributes.Name),value:z.getAttribute(n.WebComponentChildElementAttributes.Value)})}),P}getIframeStyleChild(){let P;for(const z of Array.from(this.children))if(z.localName===n.WebComponentChildElements.IframeStyle){if(P)throw new a.TableauError(n.EmbeddingErrorCodes.InternalError,`Only one ${n.WebComponentChildElements.IframeStyle} child element is supported. Please combine your styles.`);P=z}return P}setupFrame(){var P;this._iframe=document.createElement("iframe");const z=navigator.language,W=t.getLocalizedTitle(z);if(this._iframe.setAttribute("title",W),this._iframe.setAttribute(w.allowTransparency,"true"),this._iframe.setAttribute(w.allowFullScreen,"true"),this.iframeAttributeLoading&&this._iframe.setAttribute("loading",this.iframeAttributeLoading),this._iframe.style.margin="0px",this._iframe.style.padding="0px",this._iframe.style.border="none",this._iframe.style.position="relative",this._iframe.id=this.id,this._iframe.name=this.id,this.setFrameSize(),this.iframeAttributeStyle){const U=this._iframe.getAttribute(w.style);this._iframe.setAttribute(w.style,`${U} ${this.iframeAttributeStyle}`)}if(this.iframeAttributeClass&&this._iframe.setAttribute(w.class,this.iframeAttributeClass),this.shadowRoot){const U=this.getIframeStyleChild();if(U){U.style.display="none";const j=(P=U.textContent)===null||P===void 0?void 0:P.trim();j&&(this._iframeStyle=document.createElement("style"),this._iframeStyle.textContent=j,this.shadowRoot.appendChild(this._iframeStyle))}this.shadowRoot.appendChild(this._iframe)}}setFrameSize(){this._iframe&&(this._iframe.style.height=this.height,this._iframe.style.width=this.width)}computeElementSize(){const P=this.getPixelAttribute(n.WebComponentAttributes.Height),z=this.getPixelAttribute(n.WebComponentAttributes.Width);if(P&&z)return this._fixedSize=!0,{height:P,width:z};if(this.parentElement){const{height:W,width:U}=d.HtmlElementHelpers.getContentSize(this.parentElement);if(W&&U)return this._fixedSize=!0,{height:`${W}px`,width:`${U}px`}}return this._fixedSize=!1,{height:T.AttributeDefaults.height,width:T.AttributeDefaults.width}}get src(){return this.getAttribute(n.WebComponentAttributes.Src)}set src(P){P&&this.setAttribute(n.WebComponentAttributes.Src,P)}get forceTokenSync(){return this.hasAttribute(n.WebComponentAttributes.ForceTokenSync)}set forceTokenSync(P){P?this.setAttribute(n.WebComponentAttributes.ForceTokenSync,""):this.removeAttribute(n.WebComponentAttributes.ForceTokenSync)}get width(){return this.computeElementSize().width}set width(P){this.setAttribute(n.WebComponentAttributes.Width,P)}get height(){return this.computeElementSize().height}set height(P){this.setAttribute(n.WebComponentAttributes.Height,P)}get debug(){return this.hasAttribute(n.WebComponentAttributes.Debug)}set debug(P){P?this.setAttribute(n.WebComponentAttributes.Debug,""):this.removeAttribute(n.WebComponentAttributes.Debug)}get token(){const P=this.getAttribute(n.WebComponentAttributes.Token);if(P)return P}set token(P){P?this.setAttribute(n.WebComponentAttributes.Token,P):this.removeAttribute(n.WebComponentAttributes.Token)}get iframeAuth(){return this.hasAttribute(n.WebComponentAttributes.IframeAuth)}set iframeAuth(P){P?this.setAttribute(n.WebComponentAttributes.IframeAuth,""):this.removeAttribute(n.WebComponentAttributes.IframeAuth)}get iframeAttributeLoading(){const P=this.getAttribute(n.EmbeddedIframeAttributes.Loading);if(P)return P}set iframeAttributeLoading(P){var z,W;P?(this.setAttribute(n.EmbeddedIframeAttributes.Loading,P),(z=this._iframe)===null||z===void 0||z.setAttribute(w.loading,P)):(this.removeAttribute(n.EmbeddedIframeAttributes.Loading),(W=this._iframe)===null||W===void 0||W.removeAttribute(w.loading))}get iframeAttributeStyle(){const P=this.getAttribute(n.EmbeddedIframeAttributes.Style);if(P)return P}set iframeAttributeStyle(P){var z,W;P?(this.setAttribute(n.EmbeddedIframeAttributes.Style,P),(z=this._iframe)===null||z===void 0||z.setAttribute(w.style,P)):(this.removeAttribute(n.EmbeddedIframeAttributes.Style),(W=this._iframe)===null||W===void 0||W.removeAttribute(w.style))}get iframeAttributeClass(){const P=this.getAttribute(n.EmbeddedIframeAttributes.Class);if(P)return P}set iframeAttributeClass(P){var z,W;P?(this.setAttribute(n.EmbeddedIframeAttributes.Class,P),(z=this._iframe)===null||z===void 0||z.setAttribute(w.class,P)):(this.removeAttribute(n.EmbeddedIframeAttributes.Class),(W=this._iframe)===null||W===void 0||W.removeAttribute(w.class))}getPixelAttribute(P){const z=this.getAttribute(P);return z&&z!==""?isNaN(Number(z))?z:`${Math.round(Number(z))}px`:""}get iframe(){return this._iframe}registerAttributeAuthErrorEvent(){this.getWebComponentAttributeEvents().forEach(P=>{const[z,W]=P;this.registerCallback(z,W)})}getWebComponentAttributeEvents(){return[[n.WebComponentAttributes.OnVizLoadError,n.EmbeddingTableauEventType.VizLoadError]]}registerCallback(P,z){const W=this.getAttribute(P);W&&/^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(W)&&window[W]&&this.addEventListener(z,window[W])}auth(P){return e(this,void 0,void 0,function*(){try{if(!this.src||!this.token||this.iframeAuth||!_.WebComponentManager.authRequired(this.src,this.forceTokenSync))return l.Skip;const U=`${new URL(this.src).origin.toString()}/vizportal/api/web/v1/auth/embed/signin`,j={siteName:P,jwt:this.token},L={method:"POST",credentials:"include",headers:{"content-type":"application/json"},body:JSON.stringify(j)},V=yield fetch(U,L);if(V.ok)return _.WebComponentManager.updateSignedInOrigin(this.src,this.forceTokenSync),l.Success;const F=yield V.text(),H={statusCode:V.status,errorMessage:F};return this.isFallbackToRedirectAuthNeeded(H)?(this.iframeAuth=!0,console.debug("Auth Fallback trigger"),l.Failure):(this.raiseVizLoadErrorNotification(n.EmbeddingErrorCodes.AuthFailed,H),l.Failure)}catch(z){return this.raiseVizLoadErrorNotification(n.EmbeddingErrorCodes.UnknownAuthError,z),l.Failure}})}isFallbackToRedirectAuthNeeded(P){try{if(P.statusCode===404)return!0;if(P.statusCode===401){let z=JSON.parse(P.errorMessage).result.errors;if(z&&z.length>0&&z[0].code===67)return!0}return!1}catch(z){return console.error("Parsing error: "+z),!1}}raiseIframeSrcUpdatedNotification(){this.dispatchEvent(new CustomEvent(n.EmbeddingTableauEventType.IframeSrcUpdated))}raiseVizLoadErrorNotification(P,z){try{console.error(z);const W=new u.VizLoadErrorEvent(P,JSON.stringify(z));this.dispatchEvent(new CustomEvent(n.EmbeddingTableauEventType.VizLoadError,{detail:W}))}catch{const U=new u.VizLoadErrorEvent(n.EmbeddingErrorCodes.UnknownAuthError,"");this.dispatchEvent(new CustomEvent(n.EmbeddingTableauEventType.VizLoadError,{detail:U}))}}}t.TableauWebComponent=T,T.AttributeDefaults={width:"800px",height:"600px"}})(Jm);var DD=$e&&$e.__awaiter||function(t,e,n,a){function u(d){return d instanceof n?d:new n(function(_){_(d)})}return new(n||(n=Promise))(function(d,_){function l(C){try{T(a.next(C))}catch(P){_(P)}}function w(C){try{T(a.throw(C))}catch(P){_(P)}}function T(C){C.done?d(C.value):u(C.value).then(l,w)}T((a=a.apply(t,e||[])).next())})};Object.defineProperty(Rv,"__esModule",{value:!0});const Vi=Nt,uY=Ov,hY=Tc,MD=Uu,zD=Jm;class dY extends zD.TableauWebComponent{constructor(){super()}static get observedAttributes(){return[...super.observedAttributes,...Object.values(Vi.AskDataAttributes)]}updateRenderingIfInitialized(e){return DD(this,void 0,void 0,function*(){if(this._initialized)return MD.WebComponentManager.unregisterWebComponent(this._embeddingIdCounter),this.updateRendering(e)})}updateRendering(e){return DD(this,void 0,void 0,function*(){try{if(this._initialized=!0,!e){console.debug(`A src needs to be set on the ${this.tagName.toLowerCase()} element. Skipping rendering.`);return}if((yield this.auth(hY.getSiteId(e)))===zD.TableauAuthResponse.Failure){console.debug("Authentication failed.");return}if(!this.src){console.debug(`A src needs to be set on the ${this.tagName.toLowerCase()} element. Skipping rendering.`);return}if(!this.iframe){console.debug("No iframe available to update the src.");return}const a=this.readCustomParamsFromChildren();this._embeddingIdCounter=MD.WebComponentManager.registerWebComponent(this);const u=uY.createAskDataUrl(this.src,this.constructOptions(),this._embeddingIdCounter,a).toString();this.iframe.src=u,this.raiseIframeSrcUpdatedNotification();return}catch(n){console.warn(n)}})}constructOptions(){return{origin:this.origin,showEmbed:this.showEmbed,showPin:this.showPin,showSave:this.showSave,showShare:this.showShare,token:this.token,iframeAuth:this.iframeAuth,debug:this.debug}}get origin(){const e=this.getAttribute(Vi.AskDataAttributes.Origin);return e||void 0}set origin(e){e?this.setAttribute(Vi.AskDataAttributes.Origin,e):this.removeAttribute(Vi.AskDataAttributes.Origin)}get showEmbed(){return this.hasAttribute(Vi.AskDataAttributes.ShowEmbed)}set showEmbed(e){e?this.setAttribute(Vi.AskDataAttributes.ShowEmbed,""):this.removeAttribute(Vi.AskDataAttributes.ShowEmbed)}get showPin(){return this.hasAttribute(Vi.AskDataAttributes.ShowPin)}set showPin(e){e?this.setAttribute(Vi.AskDataAttributes.ShowPin,""):this.removeAttribute(Vi.AskDataAttributes.ShowPin)}get showShare(){return this.hasAttribute(Vi.AskDataAttributes.ShowShare)}set showShare(e){e?this.setAttribute(Vi.AskDataAttributes.ShowShare,""):this.removeAttribute(Vi.AskDataAttributes.ShowShare)}get showSave(){return this.hasAttribute(Vi.AskDataAttributes.ShowSave)}set showSave(e){e?this.setAttribute(Vi.AskDataAttributes.ShowSave,""):this.removeAttribute(Vi.AskDataAttributes.ShowSave)}}Rv.TableauAskData=dY;var Lv={},aA={},sA={};Object.defineProperty(sA,"__esModule",{value:!0});const qb=sn();class pY{constructor(e){this._registryId=e}getAbstractQueryWithDataModel(){return qb.ApiServiceRegistry.get(this._registryId).getService("EmbeddingVizApiService").getEmbeddingAbstractQueryAsync()}getVizStateWithDataModel(){return qb.ApiServiceRegistry.get(this._registryId).getService("EmbeddingVizApiService").getEmbeddingVizStateWithDataModelAsync()}setVizStateWithDataModel(e){return qb.ApiServiceRegistry.get(this._registryId).getService("EmbeddingVizApiService").setEmbeddingVizStateWithDataModelAsync(e)}}sA.AuthoringWorksheetImpl=pY;var lA={};Object.defineProperty(lA,"__esModule",{value:!0});class fY{constructor(e){this._authoringWorksheetImpl=e}getAbstractQueryWithDataModelAsync(){return this._authoringWorksheetImpl.getAbstractQueryWithDataModel()}getVizStateWithDataModelAsync(){return this._authoringWorksheetImpl.getVizStateWithDataModel()}setVizStateWithDataModelAsync(e){return this._authoringWorksheetImpl.setVizStateWithDataModel(e)}}lA.AuthoringWorksheet=fY;var mY=$e&&$e.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(aA,"__esModule",{value:!0});const RD=mY(Nt),gY=sn(),yY=sA,_Y=lA;class vY{constructor(e,n){this._workbookImpl=e,this._registryId=n}get activeSheet(){if(this._workbookImpl.activeSheet.sheetType===RD.SheetType.Worksheet){const e=new yY.AuthoringWorksheetImpl(this._registryId);return new _Y.AuthoringWorksheet(e)}throw new gY.TableauError(RD.EmbeddingErrorCodes.InvalidSheetType,"Worksheet type not yet supported in Authoring")}}aA.AuthoringWorkbook=vY;var cA={},OO={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Tc;t.VizUrlMode={Viewing:"views",Authoring:"authoring"};class n{constructor(u,d){this._url=u,this._segments=d}get mode(){return this._segments.mode}get siteId(){return this._segments.siteId}get workbookId(){return this._segments.workbookId}get sheetId(){return this._segments.sheetId}get customView(){return this._segments.customView}static create(u){const d=e.canonicalizeVizPortalRoutingHashes(new URL(u.toString())),_=n._parsePathName(d.pathname);return d.pathname=n._buildPathName(_),new n(d,_)}toURL(){return new URL(this.toString())}toString(){return this._url.toString()}withMode(u){if(this._segments.mode===u)return this;const d=this._getSegmentsForMode(u);return this._makeVizUrlFromPathSegments(d)}withCustomView(u){var d;if(u.luid===((d=this.customView)===null||d===void 0?void 0:d.luid)&&u.name===this.customView.name)return this;const _=this._getSegmentsForMode(this.mode);return _.customView=u,this._makeVizUrlFromPathSegments(_)}withSheetId(u){if(this.sheetId===u)return this;const d=Object.assign(Object.assign({},this._segments),{sheetId:u});return this._makeVizUrlFromPathSegments(d)}withWorkbookId(u){if(this.workbookId===u)return this;const d=Object.assign(Object.assign({},this._segments),{workbookId:u});return this._makeVizUrlFromPathSegments(d)}_getSegmentsForMode(u){return u===t.VizUrlMode.Authoring&&(this._segments.customView=void 0),Object.assign(Object.assign({},this._segments),{mode:u})}_makeVizUrlFromPathSegments(u){const d=n._buildPathName(u),_=new URL(this._url.toString());return _.pathname=d,new n(_,u)}static _parsePathName(u){var d,_,l;const w=u.split("/").filter(j=>j);if(w.length===0)throw new Error("Invalid path name");let T;if(w[0]==="t"){if(w.length<2)throw new Error(`Invalid site in path '${u}'`);T=w[1],w.splice(0,2)}const C=w.shift();if(!C)throw new Error(`Missing mode in path '${u}'`);const P=C;if(!Object.values(t.VizUrlMode).includes(P))throw new Error(`Invalid Viz Url Mode '${C}' in path '${u}'`);if(w.length===0)throw new Error(`Missing workbook/sheet name in path '${u}'`);const z=(d=w.shift(),d??""),W=w.shift();if(w.length!==0&&w.length!==2)throw new Error(`Invalid path name: unknown parts after sheet id: '${u}'`);let U;if(w.length===2){const j=(_=w.shift(),_??""),L=(l=w.shift(),l??"");U={luid:j,name:L}}return{mode:P,siteId:T,workbookId:z,sheetId:W,customView:U}}static _buildPathName(u){const d=[];return u.siteId&&(d.push("t"),d.push(u.siteId)),d.push(u.mode),u.workbookId&&d.push(u.workbookId),u.sheetId&&d.push(u.sheetId),u.customView&&u.mode===t.VizUrlMode.Viewing&&(d.push(u.customView.luid),d.push(u.customView.name)),d.join("/")}}t.VizUrl=n})(OO);(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Nt,n=hr(),a=sn(),u=Tc,d=OO;var _;(function(P){P[P.Viewing=0]="Viewing",P[P.Authoring=1]="Authoring"})(_=t.EmbeddingUrlMode||(t.EmbeddingUrlMode={}));const l=new Map([[_.Viewing,d.VizUrlMode.Viewing],[_.Authoring,d.VizUrlMode.Authoring]]);class w extends u.EmbeddingUrlBuilder{constructor(z){super(),this._url=z,this._optionNames=n.VizOptionNames}appendFilters(z){for(const W of z)this._url.searchParams.append(W.field,W.value);return this}appendParams(z){for(const W of z)this._url.searchParams.append(W.name,W.value);return this}sanitizeParameterValue(z,W){let U;switch(z){case n.VizOptionNames.hideTabs:U=this.sanitizeValue(!W);break;case n.VizOptionNames.toolbar:U=this.sanitizeValue(W===e.Toolbar.Hidden?!1:W);break;default:U=this.sanitizeValue(W);break}return U}}t.EmbeddingVizUrlBuilder=w;function T(P,z,W,U,j,L,V){if(!P)throw new a.TableauError(e.EmbeddingErrorCodes.InternalError,"We should not have attempted to render the component without a src");const R=l.get(z);if(!R)throw new a.TableauError(e.EmbeddingErrorCodes.InternalError,`'${z}' is not yet supported.`);const F=P.split("?")[0];let H;try{H=new URL(F),u.validateUrl(H)}catch(se){throw new a.TableauError(e.EmbeddingErrorCodes.InvalidUrl,se.message)}try{H=d.VizUrl.create(F).withMode(R).toURL()}catch{}const Q=C(H,U),te=new w(H).appendDefaultParameters(Q).appendUserOptions(W).appendFilters(j).appendParams(L).appendCustomParams(V);return W.iframeAuth&&te.setToken(W.token),te.build()}t.createVizUrl=T;function C(P,z){const W=new Map;W.set(n.VizOptionNames.Embed,u.SANITIZED_VALUES.YES_VALUE),W.set(n.VizOptionNames.ApiID,`embhost${z}`),P.hostname==="public.tableau.com"&&W.set(n.VizOptionNames.ShowVizHome,u.SANITIZED_VALUES.NO_VALUE);const U=`${n.INTERNAL_CONTRACT_VERSION.major}.${n.INTERNAL_CONTRACT_VERSION.minor}.${n.INTERNAL_CONTRACT_VERSION.fix}`;W.set(n.VizOptionNames.ApiInternalVersion,U);const j=a.ApiVersion.Instance.formattedValue;return W.set(n.VizOptionNames.ApiExternalVersion,j),W.set(n.VizOptionNames.NavType,"0"),W.set(n.VizOptionNames.NavSrc,"Opt"),W}})(cA);var Wd={},uA={},hA={};Object.defineProperty(hA,"__esModule",{value:!0});class xY{constructor(e){this._vizSize=e}get vizSize(){return this._vizSize}}hA.FirstVizSizeKnownEvent=xY;var dA={};Object.defineProperty(dA,"__esModule",{value:!0});class bY{constructor(e,n){this._oldSheetName=e,this._newSheetName=n}get oldSheetName(){return this._oldSheetName}get newSheetName(){return this._newSheetName}}dA.TabSwitchedEvent=bY;var pA={};Object.defineProperty(pA,"__esModule",{value:!0});class wY{constructor(e,n){this._canRedo=e,this._canUndo=n}get canRedo(){return this._canRedo}get canUndo(){return this._canUndo}}pA.ToolbarStateChangedEvent=wY;var fA={},EY=$e&&$e.__awaiter||function(t,e,n,a){function u(d){return d instanceof n?d:new n(function(_){_(d)})}return new(n||(n=Promise))(function(d,_){function l(C){try{T(a.next(C))}catch(P){_(P)}}function w(C){try{T(a.throw(C))}catch(P){_(P)}}function T(C){C.done?d(C.value):u(C.value).then(l,w)}T((a=a.apply(t,e||[])).next())})},SY=$e&&$e.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(fA,"__esModule",{value:!0});const Qs=SY(Nt),by=hr(),rn=sn();class TY extends rn.WorkbookImpl{constructor(e,n){super(),this._registryId=n,this._publishedSheetsInfo=[],this._customViews=new Map,this._name=e.workbookName,this._canDownloadWorkbook=e.canDownloadWorkbook,this.initializeWorkbook(e)}get activeSheet(){return this._activeSheetImpl}get publishedSheetsInfo(){return this._publishedSheetsInfo}get name(){return this._name}get canDownloadWorkbook(){return this._canDownloadWorkbook}get pendingTabSwitchPromise(){return this._pendingTabSwitchPromise}get pendingShowCustomViewPromise(){return this._pendingShowCustomViewPromise}clearPendingShowCustomViewPromise(){this._pendingShowCustomViewPromise=void 0}get activeCustomView(){return this._currentCustomView}activateSheetAsync(e){rn.ErrorHelpers.verifyParameter(e,"sheetNameOrIndex");let n=this.convertSheetIndexToSheetName(e);return rn.ErrorHelpers.verifyParameterType(n,"string","sheetNameOrIndex"),this.validatePublishedSheet(n)||this.verifyDashboardSheets(n),this._activeSheetImpl&&n===this._activeSheetImpl.name?new Promise((d,_)=>{d(this)}):(rn.ApiServiceRegistry.get(this._registryId).getService("viz-service").activateSheetAsync(n),new Promise((d,_)=>{this._pendingTabSwitchPromise={resolve:d,reject:_}}))}getParametersAsync(){return rn.ApiServiceRegistry.get(this._registryId).getService("parameters-service").getAllParametersAsync()}changeParameterValueAsync(e,n){return EY(this,void 0,void 0,function*(){rn.ErrorHelpers.verifyParameter(e,"parameterName");const u=yield rn.ApiServiceRegistry.get(this._registryId).getService("parameters-service").findParameterByNameAsync(e);if(u)return u.changeValueAsync(n).then(()=>u)})}updateExistingActiveSheetReferences(e){if(this._activeSheetImpl){if(this._activeSheetImpl.name===e)return;this._activeSheetImpl.active=!1,this._publishedSheetsInfo.forEach((n,a)=>{n.name===this._activeSheetImpl.name&&(n.active=!1)})}}processCustomViews(e,n){var a;const u=(a=n.currentView)===null||a===void 0?void 0:a.luid;let d=[];switch(e){case by.NotificationId.CustomViewsLoaded:case by.NotificationId.CustomViewSaved:{if(this.refreshCustomViewCache(n),u){const _=this._customViews.get(u);_&&d.push(_)}break}case by.NotificationId.CustomViewRemoved:{let _=new Map(this._customViews);this._customViews.clear(),n.customViewsList.map(l=>{this._customViews.set(l.luid,new rn.CustomViewImpl(l,this._registryId)),_.delete(l.luid)});for(let l of _.values())d.push(l);break}case by.NotificationId.CustomViewSetDefault:{this.refreshCustomViewCache(n);const _=n.customViewsList.find(l=>l.isDefault);_&&d.push(new rn.CustomViewImpl(_,this._registryId));break}}return this._currentCustomView=u?this._customViews.get(u):void 0,d}refreshCustomViewCache(e){this._customViews.clear(),e.customViewsList.map(n=>{this._customViews.set(n.luid,new rn.CustomViewImpl(n,this._registryId))})}revertAllAsync(){return rn.ApiServiceRegistry.get(this._registryId).getService("ToolbarService").revertAllAsync()}getCustomViewsAsync(){return rn.ApiServiceRegistry.get(this._registryId).getService("viz-service").getCustomViewsAsync()}showCustomViewAsync(e){return rn.ApiServiceRegistry.get(this._registryId).getService("viz-service").showCustomViewAsync(e),new Promise((u,d)=>{this._pendingShowCustomViewPromise={resolve:u,reject:d}})}removeCustomViewAsync(e){return rn.ApiServiceRegistry.get(this._registryId).getService("viz-service").removeCustomViewAsync(e)}saveCustomViewAsync(e){return rn.ApiServiceRegistry.get(this._registryId).getService("viz-service").saveCustomViewAsync(e)}setActiveCustomViewAsDefaultAsync(){return rn.ApiServiceRegistry.get(this._registryId).getService("viz-service").setActiveCustomViewAsDefaultAsync()}initializeWorkbook(e){e.publishedSheets.forEach((n,a)=>{const u=rn.SheetUtils.getSheetSizeFromSizeConstraints(n.sizeConstraint),d=n.name===e.currWorksheetName,_=!1,l=rn.SheetUtils.getSheetTypeEnum(n.sheetType),w=new rn.SheetInfoImpl(n.name,l,u,a,d,_,n.url);if(this._publishedSheetsInfo.push(w),d)switch(w.sheetType){case Qs.SheetType.Worksheet:{const T={worksheet:w.name};this._activeSheetImpl=new rn.WorksheetImpl(w,this._registryId,T,null,null);break}case Qs.SheetType.Dashboard:{const T={sheetName:w.name,isDashboard:!0};this._activeSheetImpl=new rn.DashboardImpl(w,e.dashboardZones,T,this._registryId,null);break}case Qs.SheetType.Story:{if(!e.story)throw new rn.TableauError(Qs.SharedErrorCodes.ServerError,"Unable to receive story information from Tableau");this._activeSheetImpl=new rn.StoryImpl(w,e.story,e.publishedSheets,this._registryId);break}default:throw new rn.TableauError(Qs.SharedErrorCodes.ServerError,"Invalid SheetType")}})}convertSheetIndexToSheetName(e){if(typeof e=="number"){const n=e;if(this.publishedSheetsInfo[n])return this.publishedSheetsInfo[n].name;throw new rn.TableauError(Qs.EmbeddingErrorCodes.IndexOutOfRange,`Index ${n} is out of range.`)}return e}validatePublishedSheet(e){return this.publishedSheetsInfo.find(a=>a.name===e)!==void 0}verifyDashboardSheets(e){if(this._activeSheetImpl.sheetType===Qs.SheetType.Dashboard){let n=this._activeSheetImpl,a=n.worksheetsImpl.findIndex(u=>u.name===e);if(a!==-1){if(n.worksheetsImpl[a].hidden)throw new rn.TableauError(Qs.SharedErrorCodes.ServerError,"Cannot activate hidden sheet");return}}throw new rn.TableauError(Qs.EmbeddingErrorCodes.SheetNotInWorkbook,"Sheet is not found in Workbook")}}fA.EmbeddingWorkbookImpl=TY;var wy={},Ey={},Sy={},Ty={},Ay={},Iy={},OD;function mA(){if(OD)return Iy;OD=1;var t=$e&&$e.__importStar||function(d){if(d&&d.__esModule)return d;var _={};if(d!=null)for(var l in d)Object.hasOwnProperty.call(d,l)&&(_[l]=d[l]);return _.default=d,_};Object.defineProperty(Iy,"__esModule",{value:!0});const e=t(Nt),n=sn(),a=Vv();let u=class{constructor(_,l){this._sheetImpl=_,this._workbookImpl=l}get isHidden(){return this._sheetImpl.hidden}get isActive(){return this._sheetImpl.active}get name(){return this._sheetImpl.name}get sheetType(){return this._sheetImpl.sheetType}get size(){if(n.SheetUtils.isValidSheetSize(this._sheetImpl.size))return this._sheetImpl.size;throw new n.TableauError(e.EmbeddingErrorCodes.NotImplemented,"Not implemented")}get url(){if(this.isHidden)throw new n.TableauError(e.EmbeddingErrorCodes.NoUrlForHiddenWorksheet,"No URL for hidden worksheet");return this._sheetImpl.url}get index(){return this._sheetImpl.index}get workbook(){return new a.Workbook(this._workbookImpl)}changeSizeAsync(_){return this._sheetImpl.changeSizeAsync(_)}};return Iy.Sheet=u,Iy}var Cy={},ky={},Py={},FD;function FO(){if(FD)return Py;FD=1,Object.defineProperty(Py,"__esModule",{value:!0});const t=gA();let e=class{constructor(a,u){this._storyPointInfoImpl=a,this._workbookImpl=u}get index(){return this._storyPointInfoImpl.index}get caption(){return this._storyPointInfoImpl.caption}get active(){return this._storyPointInfoImpl.active}get updated(){return this._storyPointInfoImpl.updated}get parentStory(){return new t.Story(this._storyPointInfoImpl.parentStory,this._workbookImpl)}};return Py.StoryPointInfo=e,Py}var LD;function gA(){if(LD)return ky;LD=1;var t=$e&&$e.__importStar||function(l){if(l&&l.__esModule)return l;var w={};if(l!=null)for(var T in l)Object.hasOwnProperty.call(l,T)&&(w[T]=l[T]);return w.default=l,w};Object.defineProperty(ky,"__esModule",{value:!0});const e=t(Nt),n=sn(),a=mA(),u=Bv(),d=FO();let _=class extends a.Sheet{constructor(w,T){super(w,T),this._storyImpl=w}get activeStoryPoint(){if(!this._storyImpl.activeStoryPoint)throw new n.TableauError(e.EmbeddingErrorCodes.ImplementationError,"Active story point has not been initialized");return new u.StoryPoint(this._storyImpl.activeStoryPoint,this._workbookImpl)}get storyPointsInfo(){return this._storyImpl.storyPointsInfo.map(w=>new d.StoryPointInfo(w,this._workbookImpl))}activateNextStoryPointAsync(){return this._storyImpl.activateNextStoryPointAsync().then(w=>new u.StoryPoint(w,this._workbookImpl))}activatePreviousStoryPointAsync(){return this._storyImpl.activatePreviousStoryPointAsync().then(w=>new u.StoryPoint(w,this._workbookImpl))}activateStoryPointAsync(w){return this._storyImpl.activateStoryPointAsync(w).then(T=>new u.StoryPoint(T,this._workbookImpl))}revertStoryPointAsync(w){return this._storyImpl.revertStoryPointAsync(w).then(T=>new d.StoryPointInfo(T,this._workbookImpl))}};return ky.Story=_,ky}var BD;function Bv(){if(BD)return Cy;BD=1;var t=$e&&$e.__importStar||function(l){if(l&&l.__esModule)return l;var w={};if(l!=null)for(var T in l)Object.hasOwnProperty.call(l,T)&&(w[T]=l[T]);return w.default=l,w};Object.defineProperty(Cy,"__esModule",{value:!0});const e=t(Nt),n=sn(),a=Uv(),u=gA(),d=Nv();let _=class{constructor(w,T){this._storyPointImpl=w,this._workbookImpl=T}get index(){return this._storyPointImpl.index}get caption(){return this._storyPointImpl.caption}get active(){return this._storyPointImpl.active}get updated(){return this._storyPointImpl.updated}get containedSheet(){const w=this._storyPointImpl.containedSheet;if(w)switch(w.sheetType){case e.SheetType.Worksheet:return new d.Worksheet(w,this._workbookImpl);case e.SheetType.Dashboard:return new a.Dashboard(w,this._workbookImpl);case e.SheetType.Story:throw new n.TableauError(e.EmbeddingErrorCodes.ImplementationError,"A story cannot contain another story");default:throw new n.TableauError(e.EmbeddingErrorCodes.ImplementationError,"Unable to initialize contained sheet")}}get parentStory(){return new u.Story(this._storyPointImpl.parentStory,this._workbookImpl)}};return Cy.StoryPoint=_,Cy}var ND;function Nv(){if(ND)return Ay;ND=1,Object.defineProperty(Ay,"__esModule",{value:!0});const t=Uv(),e=mA(),n=Bv();let a=class extends e.Sheet{constructor(d,_){super(d,_),this._worksheetImpl=d}get parentDashboard(){return this._worksheetImpl.parentDashboard==null?null:new t.Dashboard(this._worksheetImpl.parentDashboard,this._workbookImpl)}get parentStoryPoint(){return this._worksheetImpl.parentStoryPoint==null?null:new n.StoryPoint(this._worksheetImpl.parentStoryPoint,this._workbookImpl)}getDataSourcesAsync(){return this._worksheetImpl.getDataSourcesAsync()}getSummaryDataAsync(d){return this._worksheetImpl.getSummaryDataAsync(d)}getSummaryDataReaderAsync(d,_){return this._worksheetImpl.getSummaryDataReaderAsync(d,_)}getSummaryColumnsInfoAsync(){return this._worksheetImpl.getSummaryColumnsInfoAsync()}getUnderlyingDataAsync(d){return console.warn("Worksheet.getUnderlyingDataAsync is deprecated. Please use Worksheet.getUnderlyingTablesAsync and Worksheet.getUnderlyingTableDataAsync"),this._worksheetImpl.getUnderlyingDataAsync(d)}getUnderlyingTablesAsync(){return this._worksheetImpl.getUnderlyingTablesAsync()}getUnderlyingTableDataAsync(d,_){return this._worksheetImpl.getUnderlyingTableDataAsync(d,_)}getUnderlyingTableDataReaderAsync(d,_,l){return this._worksheetImpl.getUnderlyingTableDataReaderAsync(d,_,l)}getFiltersAsync(){return this._worksheetImpl.getFiltersAsync()}applyFilterAsync(d,_,l,w){return this._worksheetImpl.applyFilterAsync(d,_,l,w)}applyRangeFilterAsync(d,_){return this._worksheetImpl.applyRangeFilterAsync(d,_)}clearFilterAsync(d){return this._worksheetImpl.clearFilterAsync(d)}applyRelativeDateFilterAsync(d,_){return this._worksheetImpl.applyRelativeDateFilterAsync(d,_)}applyHierarchicalFilterAsync(d,_,l,w){return this._worksheetImpl.applyHierarchicalFilterAsync(d,_,l,w)}clearSelectedMarksAsync(){return this._worksheetImpl.clearSelectedMarksAsync()}getSelectedMarksAsync(){return this._worksheetImpl.getSelectedMarksAsync()}annotateMarkAsync(d,_){return this._worksheetImpl.annotateMarkAsync(d,_)}getAnnotationsAsync(){return this._worksheetImpl.getAnnotationsAsync()}removeAnnotationAsync(d){return this._worksheetImpl.removeAnnotationAsync(d)}selectMarksByValueAsync(d,_){return this._worksheetImpl.selectMarksByValueAsync(d,_)}appendContextMenuAsync(d,_){return this._worksheetImpl.appendContextMenuAsync(d,_)}removeContextMenuAsync(d,_){return this._worksheetImpl.removeContextMenuAsync(d,_)}executeContextMenuAsync(d,_){return this._worksheetImpl.executeContextMenuAsync(d,_)}renameContextMenuAsync(d,_,l){return this._worksheetImpl.renameContextMenuAsync(d,_,l)}getVisualSpecificationAsync(){return this._worksheetImpl.getVisualSpecificationAsync()}};return Ay.Worksheet=a,Ay}var UD;function AY(){if(UD)return Ty;UD=1,Object.defineProperty(Ty,"__esModule",{value:!0});const t=Uv(),e=Nv();let n=class{constructor(u,d){this._dashboardObjectImpl=u,this._workbookImpl=d}get dashboard(){return new t.Dashboard(this._dashboardObjectImpl.dashboardImpl,this._workbookImpl)}get type(){return this._dashboardObjectImpl.type}get position(){return this._dashboardObjectImpl.position}get size(){return this._dashboardObjectImpl.size}get worksheet(){if(this._dashboardObjectImpl.worksheetImpl)return new e.Worksheet(this._dashboardObjectImpl.worksheetImpl,this._workbookImpl)}get name(){return this._dashboardObjectImpl.name}get isFloating(){return this._dashboardObjectImpl.isFloating}get isVisible(){return this._dashboardObjectImpl.isVisible}get id(){return this._dashboardObjectImpl.id}};return Ty.DashboardObject=n,Ty}var jD;function Uv(){if(jD)return Sy;jD=1,Object.defineProperty(Sy,"__esModule",{value:!0});const t=AY(),e=mA(),n=Bv(),a=Nv();let u=class extends e.Sheet{constructor(_,l){super(_,l),this._dashboardImpl=_,_.initializeWithPublicInterfaces()}get objects(){return this._dashboardImpl.objects.map(_=>new t.DashboardObject(_,this._workbookImpl))}get worksheets(){return this._dashboardImpl.worksheetsImpl.map(_=>new a.Worksheet(_,this._workbookImpl))}get parentStoryPoint(){return this._dashboardImpl.parentStoryPoint==null?null:new n.StoryPoint(this._dashboardImpl.parentStoryPoint,this._workbookImpl)}getFiltersAsync(){return this._dashboardImpl.getFiltersAsync()}applyFilterAsync(_,l,w,T){return this._dashboardImpl.applyFilterAsync(_,l,w,T)}};return Sy.Dashboard=u,Sy}var jv={};Object.defineProperty(jv,"__esModule",{value:!0});class IY{constructor(e){this.parameterImpl=e}get name(){return this.parameterImpl.name}get currentValue(){return this.parameterImpl.currentValue}get dataType(){return this.parameterImpl.dataType}get allowableValues(){return this.parameterImpl.allowableValues}get id(){return this.parameterImpl.id}changeValueAsync(e){return this.parameterImpl.changeValueAsync(e)}}jv.Parameter=IY;var Dy={},VD;function CY(){if(VD)return Dy;VD=1;var t=$e&&$e.__importStar||function(d){if(d&&d.__esModule)return d;var _={};if(d!=null)for(var l in d)Object.hasOwnProperty.call(d,l)&&(_[l]=d[l]);return _.default=d,_};Object.defineProperty(Dy,"__esModule",{value:!0});const e=t(Nt),n=sn(),a=Vv();let u=class{constructor(_,l){this._sheetInfoImpl=_,this._workbookImpl=l}get name(){return this._sheetInfoImpl.name}get sheetType(){return this._sheetInfoImpl.sheetType}get index(){if(this._sheetInfoImpl.index!==void 0)return this._sheetInfoImpl.index;throw new n.TableauError(e.EmbeddingErrorCodes.ImplementationError,"index not implemented")}get isActive(){return this._sheetInfoImpl.isActive?this._sheetInfoImpl.isActive:!1}get isHidden(){return this._sheetInfoImpl.isHidden?this._sheetInfoImpl.isHidden:!1}get workbook(){return new a.Workbook(this._workbookImpl)}get url(){return this._sheetInfoImpl.url?this._sheetInfoImpl.url:""}get size(){if(n.SheetUtils.isValidSheetSize(this._sheetInfoImpl.sheetSize))return this._sheetInfoImpl.sheetSize;throw new n.TableauError(e.EmbeddingErrorCodes.NotImplemented,"Not implemented")}};return Dy.SheetInfo=u,Dy}var $D;function Vv(){if($D)return Ey;$D=1;var t=$e&&$e.__importStar||function(C){if(C&&C.__esModule)return C;var P={};if(C!=null)for(var z in C)Object.hasOwnProperty.call(C,z)&&(P[z]=C[z]);return P.default=C,P};Object.defineProperty(Ey,"__esModule",{value:!0});const e=t(Nt),n=sn(),a=BO(),u=Uv(),d=jv,_=CY(),l=gA(),w=Nv();let T=class{constructor(P){this._workbookImpl=P}get activeSheet(){switch(this._workbookImpl.activeSheet.sheetType){case e.SheetType.Worksheet:return new w.Worksheet(this._workbookImpl.activeSheet,this._workbookImpl);case e.SheetType.Dashboard:return new u.Dashboard(this._workbookImpl.activeSheet,this._workbookImpl);case e.SheetType.Story:return new l.Story(this._workbookImpl.activeSheet,this._workbookImpl);default:throw new n.TableauError(e.EmbeddingErrorCodes.ImplementationError,"Unable to initialize ActiveSheet")}}get publishedSheetsInfo(){return this._workbookImpl.publishedSheetsInfo.map(P=>new _.SheetInfo(P,this._workbookImpl))}get name(){return this._workbookImpl.name}get activeCustomView(){if(this._workbookImpl.activeCustomView)return new a.CustomView(this._workbookImpl.activeCustomView,this._workbookImpl)}activateSheetAsync(P){return this._workbookImpl.activateSheetAsync(P).then(z=>(this._workbookImpl!==z&&(this._workbookImpl=z),this.activeSheet))}revertAllAsync(){return this._workbookImpl.revertAllAsync()}getCustomViewsAsync(){return this._workbookImpl.getCustomViewsAsync().then(P=>P.map(z=>new a.CustomView(z,this._workbookImpl)))}showCustomViewAsync(P){return this._workbookImpl.showCustomViewAsync(P).then(z=>z?new a.CustomView(z,this._workbookImpl):void 0)}removeCustomViewAsync(P){return this._workbookImpl.removeCustomViewAsync(P).then(z=>new a.CustomView(z,this._workbookImpl))}saveCustomViewAsync(P){return this._workbookImpl.saveCustomViewAsync(P).then(z=>new a.CustomView(z,this._workbookImpl))}setActiveCustomViewAsDefaultAsync(){return this._workbookImpl.setActiveCustomViewAsDefaultAsync()}getParametersAsync(){return this._workbookImpl.getParametersAsync().then(P=>P.map(z=>new d.Parameter(z)))}changeParameterValueAsync(P,z){return this._workbookImpl.changeParameterValueAsync(P,z).then(W=>{if(W)return new d.Parameter(W);throw new n.TableauError(e.EmbeddingErrorCodes.InvalidParameter,`Invalid parameter: ${P}`)})}};return Ey.Workbook=T,Ey}var WD;function BO(){if(WD)return wy;WD=1,Object.defineProperty(wy,"__esModule",{value:!0});const t=Vv();let e=class LO{constructor(a,u){this._customViewImpl=a,this._workbookImpl=u}get name(){return this._customViewImpl.name}set name(a){this._customViewImpl.name=a}get shared(){return this._customViewImpl.shared}set shared(a){this._customViewImpl.shared=a}get default(){return this._customViewImpl.isDefault}set default(a){this._customViewImpl.isDefault=a}get ownerName(){return this._customViewImpl.ownerName}get url(){return this._customViewImpl.url}get workbook(){return new t.Workbook(this._workbookImpl)}saveAsync(){return this._customViewImpl.saveAsync().then(a=>new LO(a,this._workbookImpl))}};return wy.CustomView=e,wy}var yA={};Object.defineProperty(yA,"__esModule",{value:!0});class kY{constructor(e,n){this._sheetSize=e,this._chromeHeight=n}get sheetSize(){return this._sheetSize}get chromeHeight(){return this._chromeHeight}}yA.VizSize=kY;var $v={},Gd={},_A={};Object.defineProperty(_A,"__esModule",{value:!0});const PY=hr(),DY=sn();class MY extends DY.ServiceImplBase{get serviceName(){return"authentication"}setAuthToken(e){const n={authToken:e};return this.execute(PY.VerbId.Authenticate,n).then(a=>{})}}_A.AuthServiceImpl=MY;var vA={};Object.defineProperty(vA,"__esModule",{value:!0});const GD=Nt,xs=hr(),Zb=sn();class zY extends Zb.ServiceImplBase{get serviceName(){return"EmbeddingVizApiService"}getEmbeddingVizStateWithDataModelAsync(){const e=xs.VerbId.GetVizStateWithDataModel,n={[xs.ParameterId.FunctionName]:"getVizStateWithDataModel"};return this.execute(e,n).then(a=>{const u=a.result;return this.checkForErrorParameter(u),{vizStateWithDataModel:u[xs.ParameterId.VizAPIStateWithDataModel]}})}checkForErrorParameter(e){if(e[xs.ParameterId.VizAPIStateWarningMsg])throw new Zb.TableauError(GD.ErrorCodes.InternalError,e[xs.ParameterId.VizAPIStateWarningMsg])}setEmbeddingVizStateWithDataModelAsync(e){const n=xs.VerbId.SetVizStateWithDataModel,a={[xs.ParameterId.FunctionName]:"setVizStateWithDataModel",[xs.ParameterId.VizAPIStateWithDataModel]:e.vizStateWithDataModel};return this.execute(n,a).then(u=>{if(Object.keys(u.result).length!==0){const d=u.result;throw new Zb.TableauError(GD.ErrorCodes.InternalError,d)}})}getEmbeddingAbstractQueryAsync(){const e=xs.VerbId.GetEmbeddingAbstractQueryWithDataModel,n={[xs.ParameterId.FunctionName]:"getEmbeddingAbstractQuery"};return this.execute(e,n).then(a=>a.result)}}vA.EmbeddingVizApiServiceImpl=zY;var xA={};Object.defineProperty(xA,"__esModule",{value:!0});const RY=sn();class OY extends RY.NotificationServiceImplBase{get serviceName(){return"initialization-service"}}xA.InitializationServiceImpl=OY;var bA={};Object.defineProperty(bA,"__esModule",{value:!0});const In=hr(),FY=sn();class LY extends FY.ServiceImplBase{get serviceName(){return"ToolbarService"}revertAllAsync(){const e=In.VerbId.RevertWorkbook,n={[In.ParameterId.FunctionName]:"revertAllAsync"};return this.execute(e,n).then(a=>{})}redoAsync(){const e=In.VerbId.Redo,n={[In.ParameterId.FunctionName]:"redoAsync"};return this.execute(e,n).then(a=>{})}undoAsync(){const e=In.VerbId.Undo,n={[In.ParameterId.FunctionName]:"undoAsync"};return this.execute(e,n).then(a=>{})}exportImageAsync(){const e=In.VerbId.ExportImage,n={[In.ParameterId.FunctionName]:"exportImageAsync"};return this.execute(e,n).then(a=>{})}setAutoUpdateAsync(e){const n=In.VerbId.SetAutoUpdate,a={[In.ParameterId.FunctionName]:"setAutoUpdateAsync",[In.ParameterId.State]:e};return this.execute(n,a).then(()=>{})}displayDownloadWorkbookDialogAsync(){const e=In.VerbId.DownloadWorkbook,n={[In.ParameterId.FunctionName]:"displayDialogAsync(Workbook)"};return this.execute(e,n).then(a=>{})}displayExportPdfDialogAsync(){const e=In.VerbId.ExportPdf,n={[In.ParameterId.FunctionName]:"displayDialogAsync(ExportPDF)"};return this.execute(e,n).then(a=>{})}displayExportPowerpointDialogAsync(){const e=In.VerbId.ExportPowerpoint,n={[In.ParameterId.FunctionName]:"displayDialogAsync(ExportPowerPoint)"};return this.execute(e,n).then(a=>{})}displayExportDataDialogAsync(){const e=In.VerbId.ExportData,n={[In.ParameterId.FunctionName]:"displayDialogAsync(ExportData)"};return this.execute(e,n).then(a=>{})}displayExportCrosstabDialogAsync(){const e=In.VerbId.ExportCrosstab,n={[In.ParameterId.FunctionName]:"displayDialogAsync(ExportCrossTab)"};return this.execute(e,n).then(a=>{})}displayShareDialogAsync(){const e=In.VerbId.Share,n={[In.ParameterId.FunctionName]:"displayDialogAsync(Share)"};return this.execute(e,n).then(a=>{})}}bA.ToolbarServiceImpl=LY;Object.defineProperty(Gd,"__esModule",{value:!0});const fd=sn(),BY=_A,NY=vA,UY=xA,jY=bA;function VY(t,e){const n=fd.ApiServiceRegistry.get(e);n.registerService(new fd.ClientInfoServiceImpl(t,e)),n.registerService(new NY.EmbeddingVizApiServiceImpl(t,e)),n.registerService(new fd.SizeServiceImpl(t,e)),n.registerService(new fd.StoryActivationServiceImpl(t,e)),n.registerService(new jY.ToolbarServiceImpl(t,e))}Gd.registerAllEmbeddingServices=VY;function $Y(t,e){fd.ApiServiceRegistry.get(e).registerService(new UY.InitializationServiceImpl(t))}Gd.registerInitializationEmbeddingServices=$Y;function WY(t,e){fd.ApiServiceRegistry.get(e).registerService(new BY.AuthServiceImpl(t,e))}Gd.registerAuthServices=WY;Object.defineProperty($v,"__esModule",{value:!0});var NO=Gd;$v.registerAllEmbeddingServices=NO.registerAllEmbeddingServices;$v.registerInitializationEmbeddingServices=NO.registerInitializationEmbeddingServices;var Kb=$e&&$e.__awaiter||function(t,e,n,a){function u(d){return d instanceof n?d:new n(function(_){_(d)})}return new(n||(n=Promise))(function(d,_){function l(C){try{T(a.next(C))}catch(P){_(P)}}function w(C){try{T(a.throw(C))}catch(P){_(P)}}function T(C){C.done?d(C.value):u(C.value).then(l,w)}T((a=a.apply(t,e||[])).next())})},GY=$e&&$e.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(uA,"__esModule",{value:!0});const Ir=GY(Nt),Jh=dT,ni=hr(),Qr=sn(),HY=Jm,qY=hA,ZY=dA,KY=pA,HD=fA,XY=BO(),YY=yA,qD=$v,QY=Gd,JY=Fv;class eQ{constructor(e,n,a,u){if(this._viz=e,this._iframe=n,this._frameUrl=a,this._embeddingId=u,this._automaticUpdatesArePaused=!1,this._resizeEventType="resize",!this._iframe)throw new Qr.TableauError(Ir.EmbeddingErrorCodes.InternalError,"Iframe has not been created yet")}get workbookImpl(){return this._workbookImpl}get iframe(){return this._iframe}get embeddingId(){return this._embeddingId}get exportScenariosForPdfAndPowerPoint(){return{currentSheetName:this._workbookImpl.activeSheet.name,exportableSheetNamesFromDashboard:this.exportableSheetNamesFromDashboard,exportableSheetNamesFromWorkbook:this.exportableSheetNamesFromWorkbook}}get exportableSheetNamesFromDashboard(){const e=this._workbookImpl.activeSheet;return e&&e.sheetType===Ir.SheetType.Dashboard?e.getWorksheetNamesFromZones():[]}get exportableSheetNamesFromWorkbook(){const e=[];if(this._workbookImpl)for(const n of this._workbookImpl.publishedSheetsInfo)e.push(n.name);return e}get automaticUpdatesArePaused(){return this._automaticUpdatesArePaused}set automaticUpdatesArePaused(e){this._automaticUpdatesArePaused=e}getVisualIdForSheetName(e){var n,a,u;const d=this._workbookImpl.activeSheet;switch(d.sheetType){case Ir.SheetType.Worksheet:if(d.name===e)return d.visualId;break;case Ir.SheetType.Dashboard:{const _=d;for(const l of _.getWorksheetNamesFromZones())if(l===e)return{worksheet:l,dashboard:_.name};break}case Ir.SheetType.Story:{const _=d,l=(n=_.activeStoryPoint)===null||n===void 0?void 0:n.containedSheet;if(l&&l.sheetType===Ir.SheetType.Worksheet&&l.name===e){const w=Object.assign({},l.visualId);return w.dashboard=w.worksheet,w.storyboard=_.name,w.storyPointID=(a=_.activeStoryPoint)===null||a===void 0?void 0:a.storyPointId,w}else if(l&&l.sheetType===Ir.SheetType.Dashboard){const w=l;for(const T of w.getWorksheetNamesFromZones())if(T===e)return{worksheet:T,dashboard:w.name,storyboard:_.name,storyPointID:(u=_.activeStoryPoint)===null||u===void 0?void 0:u.storyPointId}}break}default:throw new Qr.TableauError(Ir.SharedErrorCodes.ServerError,"Invalid SheetType")}throw new Qr.TableauError(Ir.SharedErrorCodes.InvalidParameter,"sheetName parameter must belong to a worksheet within the current view")}get exportableWorksheetNames(){var e;const n=this._workbookImpl.activeSheet;switch(n.sheetType){case Ir.SheetType.Worksheet:return[n.name];case Ir.SheetType.Dashboard:return n.getWorksheetNamesFromZones();case Ir.SheetType.Story:{const a=(e=n.activeStoryPoint)===null||e===void 0?void 0:e.containedSheet;if(a&&a.sheetType===Ir.SheetType.Worksheet)return[a.name];if(a&&a.sheetType===Ir.SheetType.Dashboard)return a.getWorksheetNamesFromZones();break}}return[]}initializeViz(){const e=this._iframe.contentWindow;if(!e)throw new Qr.TableauError(Ir.EmbeddingErrorCodes.InternalError,"Iframe has not been created yet");try{this._messenger=new ni.CrossFrameMessenger(window,e,this._frameUrl.origin),this._dispatcher=new Qr.CrossFrameDispatcher(this._messenger),qD.registerInitializationEmbeddingServices(this._dispatcher,this.embeddingId),QY.registerAuthServices(this._dispatcher,this.embeddingId);const n=Qr.ApiServiceRegistry.get(this.embeddingId).getService("initialization-service"),a=n.registerHandler(ni.NotificationId.FirstVizSizeKnown,()=>!0,d=>{this.handleVizSizeKnownEvent(d),a()}),u=n.registerHandler(ni.NotificationId.VizInteractive,()=>!0,d=>{this.handleVizInteractiveEvent(d),u()});n.registerHandler(ni.NotificationId.ReadyToReceiveAuthToken,()=>!0,()=>{this._viz.dispatchEvent(new CustomEvent(Ir.EmbeddingTableauEventType.ReadyToReceiveAuthToken,{}))}),n.registerHandler(ni.NotificationId.ToolbarStateChanged,()=>!0,d=>this.handleToolbarStateEvent(d)),n.registerHandler(ni.NotificationId.TabSwitched,()=>!0,d=>this.handleTabSwitch(d)),n.registerHandler(ni.NotificationId.CustomViewsLoaded,()=>!0,d=>this.handleCustomViews(d)),n.registerHandler(ni.NotificationId.CustomViewRemoved,()=>!0,d=>this.handleCustomViewRemoved(d)),n.registerHandler(ni.NotificationId.CustomViewSaved,()=>!0,d=>this.handleCustomViewSaved(d)),n.registerHandler(ni.NotificationId.CustomViewSetDefault,()=>!0,d=>this.handleCustomViewSetDefault(d)),this._messenger.startListening()}catch{throw new Qr.TableauError(Ir.EmbeddingErrorCodes.InternalError,"Unexpected error during initialization.")}}dispose(){this._messenger&&this._messenger.stopListening(),this.removeWindowResizeHandler()}getCurrentSrcAsync(){return Qr.ApiServiceRegistry.get(this.embeddingId).getService("viz-service").getCurrentSrcAsync()}revertAllAsync(){return Qr.ApiServiceRegistry.get(this.embeddingId).getService("ToolbarService").revertAllAsync()}redoAsync(){return Qr.ApiServiceRegistry.get(this.embeddingId).getService("ToolbarService").redoAsync()}undoAsync(){return Qr.ApiServiceRegistry.get(this.embeddingId).getService("ToolbarService").undoAsync()}refreshDataAsync(){return Qr.ApiServiceRegistry.get(this.embeddingId).getService("data-source-service").refreshAsync()}pauseAutomaticUpdatesAsync(){return this._automaticUpdatesArePaused?Promise.resolve():this.setAutoUpdateAsync(!1)}resumeAutomaticUpdatesAsync(){return this._automaticUpdatesArePaused?this.setAutoUpdateAsync(!0):Promise.resolve()}toggleAutomaticUpdatesAsync(){return this.setAutoUpdateAsync(this._automaticUpdatesArePaused)}exportImageAsync(){return Qr.ApiServiceRegistry.get(this.embeddingId).getService("ToolbarService").exportImageAsync()}exportCrosstabAsync(e,n){return Kb(this,void 0,void 0,function*(){yield Qr.ApiServiceRegistry.get(this.embeddingId).getService("export-service").exportCrosstabAsync(e,n,this.exportableWorksheetNames,this._workbookImpl.activeSheet.sheetType)})}exportDataAsync(e,n=Qr.ExportHelpers.DefaultDataOptions){return Qr.ApiServiceRegistry.get(this.embeddingId).getService("export-service").exportDataAsync(this.getVisualIdForSheetName(e),n)}exportPowerPointAsync(e=[]){return Kb(this,void 0,void 0,function*(){const n=Qr.ApiServiceRegistry.get(this.embeddingId).getService("export-service"),a=this.exportScenariosForPdfAndPowerPoint;e.length===0&&e.push(a.currentSheetName),yield n.exportPowerPointAsync(e,a)})}exportPDFAsync(e=[],n=Qr.ExportHelpers.DefaultPDFOptions){return Kb(this,void 0,void 0,function*(){const a=Qr.ApiServiceRegistry.get(this.embeddingId).getService("export-service"),u=this.exportScenariosForPdfAndPowerPoint;e.length===0&&e.push(u.currentSheetName),yield a.exportPDFAsync(e,n,u)})}displayDialogAsync(e){const n=Qr.ApiServiceRegistry.get(this.embeddingId).getService("ToolbarService");switch(e){case Jh.TableauDialogType.ExportWorkbook:if(!this.workbookImpl.canDownloadWorkbook)throw new Qr.TableauError(Ir.EmbeddingErrorCodes.DownloadWorkbookNotAllowed,"Download workbook is not allowed");return n.displayDownloadWorkbookDialogAsync();case Jh.TableauDialogType.ExportPDF:return n.displayExportPdfDialogAsync();case Jh.TableauDialogType.ExportPowerPoint:return n.displayExportPowerpointDialogAsync();case Jh.TableauDialogType.ExportData:return n.displayExportDataDialogAsync();case Jh.TableauDialogType.ExportCrossTab:return n.displayExportCrosstabDialogAsync();case Jh.TableauDialogType.Share:return n.displayShareDialogAsync();default:throw new Qr.TableauError(Ir.EmbeddingErrorCodes.UnknownDialogType,"Unknown dialog type")}}setAuthToken(e){Qr.ApiServiceRegistry.get(this.embeddingId).getService("authentication").setAuthToken(e)}setAutoUpdateAsync(e){return Qr.ApiServiceRegistry.get(this.embeddingId).getService("ToolbarService").setAutoUpdateAsync(e).then(()=>{this._automaticUpdatesArePaused=!e})}isVersionCompatible(e){return e?ni.VersionLessThan(ni.INTERNAL_CONTRACT_VERSION,e)||ni.VersionEqualTo(ni.INTERNAL_CONTRACT_VERSION,e):!1}updateIframeTitle(e){this._iframe.setAttribute("title",HY.getLocalizedTitle(navigator.language)+": "+e.workbookName+": "+e.currWorksheetName)}handleVizInteractiveEvent(e){if(!this._viz.disableVersionCheck&&!this.isVersionCompatible(e.platformVersion))throw this._messenger.stopListening(),new Qr.TableauError(Ir.EmbeddingErrorCodes.IncompatibleVersionError,"The version of the Embedding library is not compatible with the version of Tableau. The visualization will load, but the Embedding API methods and events are not available.");this.updateIframeTitle(e),Qr.registerAllSharedServices(this._dispatcher,this.embeddingId),qD.registerAllEmbeddingServices(this._dispatcher,this.embeddingId),this._viz.initializeEvents(),this._workbookImpl=new HD.EmbeddingWorkbookImpl(e,this.embeddingId);let n=[];this._customViewsTemp&&(n=this._workbookImpl.processCustomViews(ni.NotificationId.CustomViewsLoaded,this._customViewsTemp)),this._viz.dispatchEvent(new CustomEvent(Ir.EmbeddingTableauEventType.FirstInteractive)),this._customViewsTemp&&(this.sendCustomViewEvents(Ir.EmbeddingTableauEventType.CustomViewLoaded,n),this._customViewsTemp=null)}handleVizSizeKnownEvent(e){const n=Qr.SheetUtils.getSheetSizeFromSizeConstraints(e.sheetSize);this._vizSize=new YY.VizSize(n,e.chromeHeight);const a=new qY.FirstVizSizeKnownEvent(this._vizSize);this._viz.dispatchEvent(new CustomEvent(Ir.EmbeddingTableauEventType.FirstVizSizeKnown,{detail:a})),!this._viz.fixedSize&&(this.resize(),this.addWindowResizeHandler())}resize(){const{height:e,width:n}=this.calculateLayoutSize();e!==this._vizSize.chromeHeight&&(this._iframe.style.height=e+"px",this._iframe.style.width=n+"px")}calculateLayoutSize(){const e=this._viz.parentElement?JY.HtmlElementHelpers.getContentSize(this._viz.parentElement):{height:0,width:0},{chromeHeight:n,sheetSize:a}=this._vizSize;let u=0,d=0;const _=a.minSize||{height:0,width:0},l=a.maxSize||{height:0,width:0};if(a.behavior===Ir.SheetSizeBehavior.Exactly)u=l.width,d=l.height+n;else{let w,T,C,P;switch(a.behavior){case Ir.SheetSizeBehavior.Range:w=_.width,T=l.width,C=_.height+n,P=l.height+n,u=Math.max(w,Math.min(T,e.width)),d=Math.max(C,Math.min(P,e.height));break;case Ir.SheetSizeBehavior.AtLeast:w=_.width,C=_.height+n,u=Math.max(w,e.width),d=Math.max(C,e.height);break;case Ir.SheetSizeBehavior.AtMost:T=l.width,P=l.height+n,u=Math.min(T,e.width),d=Math.min(P,e.height);break;case Ir.SheetSizeBehavior.Automatic:u=e.width,d=Math.max(e.height,n);break;default:throw new Qr.TableauError(Ir.EmbeddingErrorCodes.InvalidSizeBehavior,"Unknown SheetSizeBehavior for viz: "+a.behavior)}}return{height:d,width:u}}removeWindowResizeHandler(){this._windowResizeHandler&&window.removeEventListener(this._resizeEventType,this._windowResizeHandler)}addWindowResizeHandler(){this._windowResizeHandler||(this._windowResizeHandler=this.resize.bind(this),window.addEventListener(this._resizeEventType,this._windowResizeHandler))}handleToolbarStateEvent(e){const n=new KY.ToolbarStateChangedEvent(e.toolbarState.canRedo,e.toolbarState.canUndo);this._viz.dispatchEvent(new CustomEvent(Ir.EmbeddingTableauEventType.ToolbarStateChanged,{detail:n}))}handleTabSwitch(e){if(!this._workbookImpl||!e.oldSheetName)return;this.updateIframeTitle(e);const n=this._workbookImpl.pendingTabSwitchPromise;this._workbookImpl.updateExistingActiveSheetReferences(e.currWorksheetName),this._workbookImpl=new HD.EmbeddingWorkbookImpl(e,this.embeddingId),n&&n.resolve(this._workbookImpl);const a=new ZY.TabSwitchedEvent(e.oldSheetName,e.currWorksheetName);this._viz.dispatchEvent(new CustomEvent(Ir.EmbeddingTableauEventType.TabSwitched,{detail:a}))}handleCustomViews(e){if(!this._workbookImpl)this._customViewsTemp=e;else{const n=this._workbookImpl.processCustomViews(ni.NotificationId.CustomViewsLoaded,e),a=this._workbookImpl.pendingShowCustomViewPromise;if(a){const u=n[0];a.resolve(u),this._workbookImpl.clearPendingShowCustomViewPromise()}this.sendCustomViewEvents(Ir.EmbeddingTableauEventType.CustomViewLoaded,n)}}handleCustomViewRemoved(e){const n=this._workbookImpl.processCustomViews(ni.NotificationId.CustomViewRemoved,e);this.sendCustomViewEvents(Ir.EmbeddingTableauEventType.CustomViewRemoved,n)}handleCustomViewSaved(e){const n=this._workbookImpl.processCustomViews(ni.NotificationId.CustomViewSaved,e);this.sendCustomViewEvents(Ir.EmbeddingTableauEventType.CustomViewSaved,n)}handleCustomViewSetDefault(e){const n=this._workbookImpl.processCustomViews(ni.NotificationId.CustomViewSetDefault,e);this.sendCustomViewEvents(Ir.EmbeddingTableauEventType.CustomViewSetDefault,n)}sendCustomViewEvents(e,n){for(let a of n){const u={customView:new XY.CustomView(a,this._workbookImpl)};this._viz.dispatchEvent(new CustomEvent(e,{detail:u}))}}}uA.VizImpl=eQ;var ZD=$e&&$e.__awaiter||function(t,e,n,a){function u(d){return d instanceof n?d:new n(function(_){_(d)})}return new(n||(n=Promise))(function(d,_){function l(C){try{T(a.next(C))}catch(P){_(P)}}function w(C){try{T(a.throw(C))}catch(P){_(P)}}function T(C){C.done?d(C.value):u(C.value).then(l,w)}T((a=a.apply(t,e||[])).next())})},tQ=$e&&$e.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(Wd,"__esModule",{value:!0});const Ei=tQ(Nt),rQ=hr(),KD=sn(),nQ=uA,iQ=Tc,XD=Uu,YD=Jm;class UO extends YD.TableauWebComponent{disconnectedCallback(){super.disconnectedCallback(),this._vizImpl&&this._vizImpl.dispose()}static get observedAttributes(){return[...super.observedAttributes,...Object.values(Ei.VizSharedAttributes)]}updateRenderingIfInitialized(e){return ZD(this,void 0,void 0,function*(){if(this._initialized)return this._vizImpl&&this._vizImpl.dispose(),XD.WebComponentManager.unregisterWebComponent(this._embeddingIdCounter),this.updateRendering(e)})}updateRendering(e){return ZD(this,void 0,void 0,function*(){try{if(this._initialized=!0,!e){console.debug(`A src needs to be set on the ${this.tagName.toLowerCase()} element. Skipping rendering.`);return}if((yield this.auth(iQ.getSiteId(e)))===YD.TableauAuthResponse.Failure){console.debug("Authentication failed.");return}if(!this.src){console.debug(`A src needs to be set on the ${this.tagName.toLowerCase()} element. Skipping rendering.`);return}if(!this.iframe){console.debug("No iframe available to update the src.");return}this._embeddingIdCounter=XD.WebComponentManager.registerWebComponent(this),this.registerAttributeEvents();const a=this.createFrameUrlWithParams();this._vizImpl=this.createAndInitializeVizImpl(a),this.iframe.src=a.toString(),this.raiseIframeSrcUpdatedNotification();return}catch(n){console.debug(n)}})}createAndInitializeVizImpl(e){const n=new nQ.VizImpl(this,this.iframe,e,this._embeddingIdCounter);return n.initializeViz(),n}registerAttributeEvents(){this.getAttributeEvents().forEach(e=>{const[n,a]=e;this.registerCallback(n,a)})}initializeEvents(){let e;try{e=KD.ApiServiceRegistry.get(this.vizImpl.embeddingId).getService("notification-service")}catch{throw new KD.TableauError(Ei.EmbeddingErrorCodes.EventInitializationError,"Event initialization failed")}const n=this.getRegisteredEvents();for(const[a,u,d]of n)e.registerHandler(a,u,d)}getRegisteredEvents(){return[[rQ.NotificationId.EditInDesktopButtonClicked,()=>!0,()=>this.dispatchEvent(new CustomEvent(Ei.EmbeddingTableauEventType.EditInDesktopButtonClicked))]]}get touchOptimize(){return this.hasAttribute(Ei.VizSharedAttributes.TouchOptimize)}set touchOptimize(e){e?this.setAttribute(Ei.VizSharedAttributes.TouchOptimize,""):this.removeAttribute(Ei.VizSharedAttributes.TouchOptimize)}get vizImpl(){return this._vizImpl}get hideEditInDesktopButton(){return this.hasAttribute(Ei.VizSharedAttributes.HideEditInDesktopButton)}set hideEditInDesktopButton(e){e?this.setAttribute(Ei.VizSharedAttributes.HideEditInDesktopButton,""):this.removeAttribute(Ei.VizSharedAttributes.HideEditInDesktopButton)}get suppressDefaultEditBehavior(){return this.hasAttribute(Ei.VizSharedAttributes.SuppressDefaultEditBehavior)}set suppressDefaultEditBehavior(e){e?this.setAttribute(Ei.VizSharedAttributes.SuppressDefaultEditBehavior,""):this.removeAttribute(Ei.VizSharedAttributes.SuppressDefaultEditBehavior)}get disableVersionCheck(){return this.hasAttribute(Ei.VizSharedAttributes.DisableVersionCheck)}set disableVersionCheck(e){e?this.setAttribute(Ei.VizSharedAttributes.DisableVersionCheck,""):this.removeAttribute(Ei.VizSharedAttributes.DisableVersionCheck)}getCurrentSrcAsync(){return this.vizImpl.getCurrentSrcAsync()}resize(){this.vizImpl.resize()}}Wd.TableauVizBase=UO;UO.VizAttributeDefaults={device:Ei.DeviceType.Default,toolbar:Ei.Toolbar.Bottom};function oQ(t){if(!t||t.length<1)return"";const e=t.toLowerCase();return e[0].toUpperCase()+e.substring(1)}Wd.attributeToEnumKey=oQ;var aQ=$e&&$e.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(Lv,"__esModule",{value:!0});const Fn=aQ(Nt),Xb=hr(),sQ=aA,QD=cA,lQ=Wd;class cQ extends lQ.TableauVizBase{static get observedAttributes(){return[...super.observedAttributes,...Object.values(Fn.VizAuthoringAttributes)]}getAttributeEvents(){return[[Fn.VizSharedAttributes.OnEditInDesktopButtonClicked,Fn.EmbeddingTableauEventType.EditInDesktopButtonClicked],[Fn.VizSharedAttributes.OnFirstInteractive,Fn.EmbeddingTableauEventType.FirstInteractive],[Fn.VizSharedAttributes.OnFirstVizSizeKnown,Fn.EmbeddingTableauEventType.FirstVizSizeKnown],[Fn.VizAuthoringAttributes.OnWorkbookPublished,Fn.EmbeddingTableauEventType.WorkbookPublished],[Fn.VizAuthoringAttributes.OnWorkbookPublishedAs,Fn.EmbeddingTableauEventType.WorkbookPublishedAs],[Fn.VizAuthoringAttributes.OnWorkbookReadyToClose,Fn.EmbeddingTableauEventType.WorkbookReadyToClose],[Fn.VizAttributes.OnReadyToReceiveAuthToken,Fn.EmbeddingTableauEventType.ReadyToReceiveAuthToken]]}createFrameUrlWithParams(){const e=this.constructVizqlOptions(),n=this.readCustomParamsFromChildren();return QD.createVizUrl(this.src,QD.EmbeddingUrlMode.Authoring,e,this._embeddingIdCounter,[],[],n)}constructVizqlOptions(){return{token:this.token,touchOptimize:this.touchOptimize,hideEditInDesktopButton:this.hideEditInDesktopButton,suppressDefaultEditBehavior:this.suppressDefaultEditBehavior,hideCloseButton:this.hideCloseButton,debug:this.debug,iframeAuth:this.iframeAuth}}getRegisteredEvents(){return super.getRegisteredEvents().concat([[Xb.NotificationId.WorkbookPublished,()=>!0,()=>this.dispatchEvent(new CustomEvent(Fn.EmbeddingTableauEventType.WorkbookPublished))],[Xb.NotificationId.WorkbookPublishedAs,()=>!0,e=>this.handleWorkbookPublishedAsEvent(e)],[Xb.NotificationId.WorkbookReadyToClose,()=>!0,()=>this.dispatchEvent(new CustomEvent(Fn.EmbeddingTableauEventType.WorkbookReadyToClose))]])}handleWorkbookPublishedAsEvent(e){const n={newUrl:e.newUrl};this.dispatchEvent(new CustomEvent(Fn.EmbeddingTableauEventType.WorkbookPublishedAs,{detail:n}))}set hideCloseButton(e){e?this.setAttribute(Fn.VizAuthoringAttributes.HideCloseButton,""):this.removeAttribute(Fn.VizAuthoringAttributes.HideCloseButton)}get hideCloseButton(){return this.hasAttribute(Fn.VizAuthoringAttributes.HideCloseButton)}get workbook(){return new sQ.AuthoringWorkbook(this.vizImpl.workbookImpl,this.vizImpl.embeddingId)}setAuthToken(e){this.vizImpl.setAuthToken(e)}}Lv.TableauAuthoringViz=cQ;var Wv={},Gv={};Object.defineProperty(Gv,"__esModule",{value:!0});const uQ=Nt,Jl=hr(),jO=sn(),VO=Tc;function hQ(t,e,n){const a=t.split("?")[0];let u;try{u=new URL(a),VO.validateUrl(u)}catch(l){throw new jO.TableauError(uQ.EmbeddingErrorCodes.InvalidUrl,l.message)}const d=dQ();return new $O(u).appendDefaultParameters(d).appendUserOptions(e).appendCustomParams(n).build()}Gv.createPulseUrl=hQ;function dQ(t){const e=new Map,n=`${Jl.INTERNAL_CONTRACT_VERSION.major}.${Jl.INTERNAL_CONTRACT_VERSION.minor}.${Jl.INTERNAL_CONTRACT_VERSION.fix}`;e.set(Jl.PulseOptionNames.ApiInternalVersion,n),e.set(Jl.PulseOptionNames.embed,"y");const a=jO.ApiVersion.Instance.formattedValue;return e.set(Jl.PulseOptionNames.ApiExternalVersion,a),e.set(Jl.PulseOptionNames.PulseWebComponent,"true"),e}class $O extends VO.EmbeddingUrlBuilder{constructor(e){super(),this._url=e,this._optionNames=Jl.PulseOptionNames}sanitizeParameterValue(e,n){return this.sanitizeValue(n)}}Gv.EmbeddingPulseUrlBuilder=$O;var JD=$e&&$e.__awaiter||function(t,e,n,a){function u(d){return d instanceof n?d:new n(function(_){_(d)})}return new(n||(n=Promise))(function(d,_){function l(C){try{T(a.next(C))}catch(P){_(P)}}function w(C){try{T(a.throw(C))}catch(P){_(P)}}function T(C){C.done?d(C.value):u(C.value).then(l,w)}T((a=a.apply(t,e||[])).next())})};Object.defineProperty(Wv,"__esModule",{value:!0});const bs=Nt,pQ=Gv,fQ=Tc,eM=Uu,mQ=Wd,tM=Jm;class gQ extends tM.TableauWebComponent{constructor(){super()}static get observedAttributes(){return[...super.observedAttributes,...Object.values(bs.PulseAttributes)]}updateRenderingIfInitialized(e){return JD(this,void 0,void 0,function*(){if(this._initialized)return eM.WebComponentManager.unregisterWebComponent(this._embeddingIdCounter),this.updateRendering(e)})}updateRendering(e){return JD(this,void 0,void 0,function*(){try{if(this._initialized=!0,!e){console.debug(`A src needs to be set on the ${this.tagName.toLowerCase()} element. Skipping rendering.`);return}if(!this.token){console.debug(`A token needs to be set on the ${this.tagName.toLowerCase()} element. Skipping rendering.`);return}if((yield this.auth(fQ.getSiteIdForPulse(e)))===tM.TableauAuthResponse.Failure){console.debug("Authentication failed.");return}if(!this.src){console.debug(`A src needs to be set on the ${this.tagName.toLowerCase()} element. Skipping rendering.`);return}if(!this.iframe){console.debug("No iframe available to update the src.");return}const a=this.readCustomParamsFromChildren();this._embeddingIdCounter=eM.WebComponentManager.registerWebComponent(this);const u=pQ.createPulseUrl(this.src,this.constructOptions(),a).toString();this.iframe.src=u,this.raiseIframeSrcUpdatedNotification();return}catch(n){console.warn(n)}})}constructOptions(){const e={token:this.token};return this.disableExploreFilter&&(e.disableExploreFilter=this.disableExploreFilter),this.layout&&this.layout!==bs.PulseLayout.Default&&(e.layout=this.layout),e}get disableExploreFilter(){return this.hasAttribute(bs.PulseAttributes.DisableExploreFilter)}set disableExploreFilter(e){e?this.setAttribute(bs.PulseAttributes.DisableExploreFilter,""):this.removeAttribute(bs.PulseAttributes.DisableExploreFilter)}get layout(){const e=mQ.attributeToEnumKey(this.getAttribute(bs.PulseAttributes.Layout)),n=bs.PulseLayout[e];return n||bs.PulseLayout.Default}set layout(e){e?this.setAttribute(bs.PulseAttributes.Layout,e):this.removeAttribute(bs.PulseAttributes.Layout)}}Wv.TableauPulse=gQ;var Hv={},wA={},Hd={},EA={};Object.defineProperty(EA,"__esModule",{value:!0});class yQ{constructor(e,n){this._sheet=n}get sheet(){return this._sheet}}EA.TableauSheetEvent=yQ;Object.defineProperty(Hd,"__esModule",{value:!0});const _Q=EA;class vQ extends _Q.TableauSheetEvent{constructor(e,n){super(e,n),this._worksheet=n}get worksheet(){return this._worksheet}}Hd.TableauWorksheetEvent=vQ;Object.defineProperty(wA,"__esModule",{value:!0});const xQ=Nt,bQ=Hd;class wQ extends bQ.TableauWorksheetEvent{constructor(e,n){super(xQ.EmbeddingTableauEventType.CustomMarkContextMenuEvent,e),this._contextMenuId=n}getContextMenuId(){return this._contextMenuId}getSelectedMarksAsync(){return this.worksheet.getSelectedMarksAsync()}}wA.CustomMarkContextMenuEvent=wQ;var SA={};Object.defineProperty(SA,"__esModule",{value:!0});const rM=Nt,EQ=sn(),SQ=Hd;class TQ extends SQ.TableauWorksheetEvent{constructor(e,n,a){super(rM.EmbeddingTableauEventType.FilterChanged,e),this._fieldName=n,this._fieldId=a}get fieldName(){return this._fieldName}get fieldId(){return this._fieldId}getFilterAsync(){return this.worksheet.getFiltersAsync().then(e=>{const n=this.fieldId?e.find(a=>a.fieldId===this.fieldId,this):e.find(a=>a.fieldName===this.fieldName,this);if(!n)throw new EQ.TableauError(rM.EmbeddingErrorCodes.FilterMissingOrNotImplemented,`Cannot find filter: ${this._fieldName}.`);return n})}}SA.FilterChangedEvent=TQ;var TA={};Object.defineProperty(TA,"__esModule",{value:!0});const AQ=Nt,IQ=Hd;class CQ extends IQ.TableauWorksheetEvent{constructor(e){super(AQ.EmbeddingTableauEventType.MarkSelectionChanged,e)}getMarksAsync(){return this.worksheet.getSelectedMarksAsync()}}TA.MarksSelectedEvent=CQ;var AA={};Object.defineProperty(AA,"__esModule",{value:!0});const kQ=Nt,nM=sn(),PQ=jv;class DQ{constructor(e,n){this._globalFieldName=e,this._embeddingId=n}getParameterAsync(){return nM.ApiServiceRegistry.get(this._embeddingId).getService("parameters-service").findParameterByGlobalFieldNameAsync(this._globalFieldName).then(n=>{if(n===void 0)throw new nM.TableauError(kQ.EmbeddingErrorCodes.MissingParameter,`Cannot find parameter: ${this._globalFieldName}`);return new PQ.Parameter(n)})}}AA.ParameterChangedEvent=DQ;var IA={};Object.defineProperty(IA,"__esModule",{value:!0});const MQ=Bv(),zQ=FO();class RQ{constructor(e,n,a){this._oldStoryPointInfoImpl=e,this._currStoryPointImpl=n,this._workbookImpl=a}get oldStoryPointInfo(){return new zQ.StoryPointInfo(this._oldStoryPointInfoImpl,this._workbookImpl)}get newStoryPoint(){return new MQ.StoryPoint(this._currStoryPointImpl,this._workbookImpl)}}IA.StoryPointSwitchedEvent=RQ;var CA={};Object.defineProperty(CA,"__esModule",{value:!0});const OQ=Nt,FQ=Hd;class LQ extends FQ.TableauWorksheetEvent{constructor(e){super(OQ.EmbeddingTableauEventType.SummaryDataChanged,e)}}CA.SummaryDataChangedEvent=LQ;var kA={};Object.defineProperty(kA,"__esModule",{value:!0});class BQ{constructor(e,n){this._url=e,this._target=n}get url(){return this._url}get target(){return this._target}}kA.UrlActionEvent=BQ;var NQ=$e&&$e.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(Hv,"__esModule",{value:!0});const wt=NQ(Nt),Yl=hr(),Zf=sn(),UQ=wA,jQ=SA,VQ=TA,$Q=AA,WQ=IA,GQ=CA,HQ=kA,iM=cA,qQ=Vv(),ZQ=Uu,Kf=Wd;let KQ=class extends Kf.TableauVizBase{constructor(){super(...arguments),this.preInitFilters=[]}readFiltersFromChild(){const e=[];return[].forEach.call(this.children,n=>{n.localName===wt.VizChildElements.VizFilter&&n.getAttribute(wt.VizChildElementAttributes.Field)&&n.getAttribute(wt.VizChildElementAttributes.Value)!==void 0&&e.push({field:n.getAttribute(wt.VizChildElementAttributes.Field),value:n.getAttribute(wt.VizChildElementAttributes.Value)})}),e}readParametersFromChild(){const e=[];return[].forEach.call(this.children,n=>{n.localName===wt.VizChildElements.VizParameter&&n.getAttribute(wt.VizChildElementAttributes.Name)&&n.getAttribute(wt.VizChildElementAttributes.Value)&&e.push({name:n.getAttribute(wt.VizChildElementAttributes.Name),value:n.getAttribute(wt.VizChildElementAttributes.Value)})}),e}static get observedAttributes(){return[...super.observedAttributes,...Object.values(wt.VizAttributes)]}disconnectedCallback(){this.preInitFilters=[],super.disconnectedCallback()}createFrameUrlWithParams(){const e=this.constructVizqlOptions(),n=this.readFiltersFromChild().concat(this.preInitFilters),a=this.readParametersFromChild(),u=this.readCustomParamsFromChildren();return iM.createVizUrl(this.src,iM.EmbeddingUrlMode.Viewing,e,this._embeddingIdCounter,n,a,u)}constructVizqlOptions(){return{disableUrlActionsPopups:this.disableUrlActionsPopups,hideTabs:this.hideTabs,toolbar:this.toolbar,instanceIdToClone:this.instanceIdToClone,device:this.device,token:this.token,touchOptimize:this.touchOptimize,hideEditButton:this.hideEditButton,hideEditInDesktopButton:this.hideEditInDesktopButton,suppressDefaultEditBehavior:this.suppressDefaultEditBehavior,debug:this.debug,iframeAuth:this.iframeAuth}}getAttributeEvents(){return[[wt.VizAttributes.OnCustomMarkContextMenuEvent,wt.EmbeddingTableauEventType.CustomMarkContextMenuEvent],[wt.VizAttributes.OnEditButtonClicked,wt.EmbeddingTableauEventType.EditButtonClicked],[wt.VizSharedAttributes.OnEditInDesktopButtonClicked,wt.EmbeddingTableauEventType.EditInDesktopButtonClicked],[wt.VizAttributes.OnFilterChanged,wt.EmbeddingTableauEventType.FilterChanged],[wt.VizSharedAttributes.OnFirstInteractive,wt.EmbeddingTableauEventType.FirstInteractive],[wt.VizSharedAttributes.OnFirstVizSizeKnown,wt.EmbeddingTableauEventType.FirstVizSizeKnown],[wt.VizAttributes.OnMarkSelectionChanged,wt.EmbeddingTableauEventType.MarkSelectionChanged],[wt.VizAttributes.OnParameterChanged,wt.EmbeddingTableauEventType.ParameterChanged],[wt.VizAttributes.OnTabSwitched,wt.EmbeddingTableauEventType.TabSwitched],[wt.VizAttributes.OnToolbarStateChanged,wt.EmbeddingTableauEventType.ToolbarStateChanged],[wt.VizAttributes.OnUrlAction,wt.EmbeddingTableauEventType.UrlAction],[wt.VizAttributes.OnCustomViewLoaded,wt.EmbeddingTableauEventType.CustomViewLoaded],[wt.VizAttributes.OnCustomViewRemoved,wt.EmbeddingTableauEventType.CustomViewRemoved],[wt.VizAttributes.OnCustomViewSaved,wt.EmbeddingTableauEventType.CustomViewSaved],[wt.VizAttributes.OnCustomViewSetDefault,wt.EmbeddingTableauEventType.CustomViewSetDefault],[wt.VizAttributes.OnStoryPointSwitched,wt.EmbeddingTableauEventType.StoryPointSwitched],[wt.VizAttributes.OnSummaryDataChanged,wt.EmbeddingTableauEventType.SummaryDataChanged],[wt.VizAttributes.OnReadyToReceiveAuthToken,wt.EmbeddingTableauEventType.ReadyToReceiveAuthToken]]}getRegisteredEvents(){return super.getRegisteredEvents().concat([[Yl.NotificationId.SelectedMarksChanged,e=>this.shouldNotifyEvent(e),e=>this.handleSelectedMarksChangedEvent(e)],[Yl.NotificationId.FilterChanged,e=>this.shouldNotifyEvent(e.visualId),e=>this.handleFilterChangedEvent(e)],[Yl.NotificationId.EditButtonClicked,()=>!0,()=>this.handleEditButtonClicked()],[Yl.NotificationId.CustomMarkContextMenuClicked,e=>this.shouldNotifyEvent(e.visualId),e=>this.handleCustomMarkClickedContextMenuEvent(e)],[Yl.NotificationId.ParameterChanged,()=>!0,e=>this.handleParameterChangedEvent(e)],[Yl.NotificationId.UrlAction,()=>!0,e=>this.handleUrlAction(e)],[Yl.NotificationId.StoryPointSwitched,()=>!0,e=>this.handleStoryPointSwitch(e)],[Yl.NotificationId.SummaryDataChanged,e=>this.shouldNotifyEvent(e.visualId),e=>this.handleSummaryDataChangedEvent(e)]])}shouldNotifyEvent(e){switch(this.workbook.activeSheet.sheetType){case wt.SheetType.Worksheet:return this.workbook.activeSheet.name===e.worksheet;case wt.SheetType.Dashboard:return this.workbook.activeSheet.worksheets.filter(u=>u.name===e.worksheet).length===1;case wt.SheetType.Story:{const a=this.workbook.activeSheet.activeStoryPoint.containedSheet;return a?a.sheetType===wt.SheetType.Worksheet?a.name===e.worksheet:a.sheetType===wt.SheetType.Dashboard?a.worksheets.filter(_=>_.name===e.worksheet).length===1:!1:!1}default:return!1}}handleSelectedMarksChangedEvent(e){const n=new VQ.MarksSelectedEvent(this.getWorksheetForNotificationHandler(e));this.dispatchEvent(new CustomEvent(wt.EmbeddingTableauEventType.MarkSelectionChanged,{detail:n}))}handleFilterChangedEvent(e){const n=new jQ.FilterChangedEvent(this.getWorksheetForNotificationHandler(e.visualId),e.fieldName,e.fieldId);this.dispatchEvent(new CustomEvent(wt.EmbeddingTableauEventType.FilterChanged,{detail:n}))}handleSummaryDataChangedEvent(e){const n=new GQ.SummaryDataChangedEvent(this.getWorksheetForNotificationHandler(e.visualId));this.dispatchEvent(new CustomEvent(wt.EmbeddingTableauEventType.SummaryDataChanged,{detail:n}))}handleEditButtonClicked(){this.dispatchEvent(new CustomEvent(wt.EmbeddingTableauEventType.EditButtonClicked))}handleCustomMarkClickedContextMenuEvent(e){const n=new UQ.CustomMarkContextMenuEvent(this.getWorksheetForNotificationHandler(e.visualId),e.contextMenuId);this.dispatchEvent(new CustomEvent(wt.EmbeddingTableauEventType.CustomMarkContextMenuEvent,{detail:n}))}handleParameterChangedEvent(e){const n=new $Q.ParameterChangedEvent(e,this.vizImpl.embeddingId);this.dispatchEvent(new CustomEvent(wt.EmbeddingTableauEventType.ParameterChanged,{detail:n}))}handleUrlAction(e){const n=new HQ.UrlActionEvent(e.url,e.target);this.dispatchEvent(new CustomEvent(wt.EmbeddingTableauEventType.UrlAction,{detail:n}))}handleStoryPointSwitch(e){const n=this.vizImpl.workbookImpl.activeSheet,a=n.storyPointsInfo.find(u=>u.active===!0);if(n.activeStoryPoint&&a&&n.activeStoryPoint.index!==e.index){n.updateStory(e);const u=new WQ.StoryPointSwitchedEvent(a,n.activeStoryPoint,this.vizImpl.workbookImpl);this.dispatchEvent(new CustomEvent(wt.EmbeddingTableauEventType.StoryPointSwitched,{detail:u}))}}getWorksheetForNotificationHandler(e){let n;switch(this.workbook.activeSheet.sheetType){case wt.SheetType.Worksheet:{n=this.workbook.activeSheet;break}case wt.SheetType.Dashboard:{const u=this.workbook.activeSheet.worksheets.filter(d=>d.name===e.worksheet);if(u.length===1)n=u[0];else throw new Zf.TableauError(wt.EmbeddingErrorCodes.IndexOutOfRange,"Worksheet not found");break}case wt.SheetType.Story:{const u=this.workbook.activeSheet.activeStoryPoint.containedSheet;if(!u)throw new Zf.TableauError(wt.EmbeddingErrorCodes.IndexOutOfRange,"Worksheet not found");if(u.sheetType===wt.SheetType.Worksheet)n=u;else if(u.sheetType===wt.SheetType.Dashboard){const _=u.worksheets.filter(l=>l.name===e.worksheet);if(_.length===1)n=_[0];else throw new Zf.TableauError(wt.EmbeddingErrorCodes.IndexOutOfRange,"Worksheet not found")}else throw new Zf.TableauError(wt.EmbeddingErrorCodes.ImplementationError,"Could not find sheetType");break}default:throw new Zf.TableauError(wt.EmbeddingErrorCodes.ImplementationError,"Could not find sheetType")}return n}get disableUrlActionsPopups(){return this.hasAttribute(wt.VizAttributes.DisableUrlActionsPopups)}set disableUrlActionsPopups(e){e?this.setAttribute(wt.VizAttributes.DisableUrlActionsPopups,""):this.removeAttribute(wt.VizAttributes.DisableUrlActionsPopups)}get hideTabs(){return this.hasAttribute(wt.VizAttributes.HideTabs)}set hideTabs(e){e?this.setAttribute(wt.VizAttributes.HideTabs,""):this.removeAttribute(wt.VizAttributes.HideTabs)}get toolbar(){const e=Kf.attributeToEnumKey(this.getAttribute(wt.VizAttributes.Toolbar)),n=wt.Toolbar[e];return n||Kf.TableauVizBase.VizAttributeDefaults.toolbar}set toolbar(e){e&&this.setAttribute(wt.VizAttributes.Toolbar,e)}get instanceIdToClone(){const e=this.getAttribute(wt.VizAttributes.InstanceIdToClone);if(e)return e}set instanceIdToClone(e){e?this.setAttribute(wt.VizAttributes.InstanceIdToClone,e):this.removeAttribute(wt.VizAttributes.InstanceIdToClone)}get device(){const e=Kf.attributeToEnumKey(this.getAttribute(wt.VizAttributes.Device)),n=wt.DeviceType[e];return n||Kf.TableauVizBase.VizAttributeDefaults.device}set device(e){this.setAttribute(wt.VizAttributes.Device,e)}get hideEditButton(){return this.hasAttribute(wt.VizAttributes.HideEditButton)}set hideEditButton(e){e?this.setAttribute(wt.VizAttributes.HideEditButton,""):this.removeAttribute(wt.VizAttributes.HideEditButton)}get automaticUpdatesArePaused(){return this.vizImpl.automaticUpdatesArePaused}pauseAutomaticUpdatesAsync(){return this.vizImpl.pauseAutomaticUpdatesAsync()}resumeAutomaticUpdatesAsync(){return this.vizImpl.resumeAutomaticUpdatesAsync()}toggleAutomaticUpdatesAsync(){return this.vizImpl.toggleAutomaticUpdatesAsync()}revertAllAsync(){return this.vizImpl.revertAllAsync()}refreshDataAsync(){return this.vizImpl.refreshDataAsync()}exportImageAsync(){return this.vizImpl.exportImageAsync()}exportCrosstabAsync(e,n){return this.vizImpl.exportCrosstabAsync(e,n)}exportDataAsync(e,n){return this.vizImpl.exportDataAsync(e,n)}exportPowerPointAsync(e){return this.vizImpl.exportPowerPointAsync(e)}exportPDFAsync(e,n){return this.vizImpl.exportPDFAsync(e,n)}displayDialogAsync(e){return this.vizImpl.displayDialogAsync(e)}redoAsync(){return this.vizImpl.redoAsync()}undoAsync(){return this.vizImpl.undoAsync()}setAuthToken(e){this.vizImpl.setAuthToken(e)}addFilter(e,n){this.preInitFilters.push({field:e,value:n}),ZQ.WebComponentManager.synchronizeRender(this.updateRenderingIfInitialized.bind(this,this.src))}get workbook(){return new qQ.Workbook(this.vizImpl.workbookImpl)}};Hv.TableauViz=KQ;Object.defineProperty(Jt,"__esModule",{value:!0});const oM=Nt,XQ=sn(),YQ=Rv,QQ=Lv,JQ=Wv,eJ=Hv,tJ=typeof VERSION_IS_ALPHA<"u"?VERSION_IS_ALPHA:!1;XQ.ApiVersion.SetVersionNumber(typeof API_VERSION_NUMBER<"u"?API_VERSION_NUMBER:"0.0.0",tJ);function My(t,e){try{window.customElements.get(t)?console.warn(`Custom element '${t}' is already defined.`):window.customElements.define(t,e)}catch(n){console.error(`Error defining custom element '${t}':`,n)}}function rJ(){return"customElements"in window}rJ()?(My("tableau-viz",eJ.TableauViz),My("tableau-authoring-viz",QQ.TableauAuthoringViz),My("tableau-ask-data",YQ.TableauAskData),My("tableau-pulse",JQ.TableauPulse)):console.error("Custom Elements API is not supported in this browser.");const nJ=Object.assign(Object.assign({},oM.EmbeddingErrorCodes),oM.SharedErrorCodes);Jt.ErrorCodes=nJ;var sr=Nt;Jt.AnalyticsObjectType=sr.AnalyticsObjectType;Jt.AnnotationType=sr.AnnotationType;Jt.ApiMenuType=sr.ApiMenuType;Jt.ClassNameKey=sr.ClassNameKey;Jt.ColumnType=sr.ColumnType;Jt.CrosstabFileFormat=sr.CrosstabFileFormat;Jt.DashboardLayoutChange=sr.DashboardLayoutChange;Jt.DashboardObjectType=sr.DashboardObjectType;Jt.DataType=sr.DataType;Jt.DateRangeType=sr.DateRangeType;Jt.DeviceType=sr.DeviceType;Jt.EncodingType=sr.EncodingType;Jt.FieldAggregationType=sr.FieldAggregationType;Jt.FieldRoleType=sr.FieldRoleType;Jt.FileFormats=sr.FileFormats;Jt.FilterDomainType=sr.FilterDomainType;Jt.FilterNullOption=sr.FilterNullOption;Jt.FilterType=sr.FilterType;Jt.FilterUpdateType=sr.FilterUpdateType;Jt.HierarchicalLevelSelectionState=sr.HierarchicalLevelSelectionState;Jt.IncludeDataValuesOption=sr.IncludeDataValuesOption;Jt.MarkType=sr.MarkType;Jt.ParameterValueType=sr.ParameterValueType;Jt.PeriodType=sr.PeriodType;Jt.PrintOrientation=sr.PrintOrientation;Jt.PrintPageSize=sr.PrintPageSize;Jt.PrintScaling=sr.PrintScaling;Jt.PulseAttributes=sr.PulseAttributes;Jt.PulseLayout=sr.PulseLayout;Jt.QuickTableCalcType=sr.QuickTableCalcType;Jt.SelectionUpdateType=sr.SelectionUpdateType;Jt.SheetSizeBehavior=sr.SheetSizeBehavior;var Yb=Jt.SheetType=sr.SheetType;Jt.SortDirection=sr.SortDirection;Jt.TableauDialogType=sr.TableauDialogType;var aM=Jt.TableauEventType=sr.EmbeddingTableauEventType;Jt.Toolbar=sr.Toolbar;Jt.TrendLineModelType=sr.TrendLineModelType;Jt.VizAttributes=sr.VizAttributes;Jt.VizAuthoringAttributes=sr.VizAuthoringAttributes;Jt.VizSharedAttributes=sr.VizSharedAttributes;Jt.WebComponentAttributes=sr.WebComponentAttributes;var iJ=Rv;Jt.TableauAskData=iJ.TableauAskData;var oJ=Lv;Jt.TableauAuthoringViz=oJ.TableauAuthoringViz;var aJ=Wv;Jt.TableauPulse=aJ.TableauPulse;var sJ=Hv;Jt.TableauViz=sJ.TableauViz;var WO={exports:{}};function lJ(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Qb={exports:{}};const cJ={},uJ=Object.freeze(Object.defineProperty({__proto__:null,default:cJ},Symbol.toStringTag,{value:"Module"})),hJ=WM(uJ);var sM;function kr(){return sM||(sM=1,function(t,e){(function(n,a){t.exports=a()})($e,function(){var n=n||function(a,u){var d;if(typeof window<"u"&&window.crypto&&(d=window.crypto),typeof self<"u"&&self.crypto&&(d=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(d=globalThis.crypto),!d&&typeof window<"u"&&window.msCrypto&&(d=window.msCrypto),!d&&typeof $e<"u"&&$e.crypto&&(d=$e.crypto),!d&&typeof lJ=="function")try{d=hJ}catch{}var _=function(){if(d){if(typeof d.getRandomValues=="function")try{return d.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof d.randomBytes=="function")try{return d.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},l=Object.create||function(){function R(){}return function(F){var H;return R.prototype=F,H=new R,R.prototype=null,H}}(),w={},T=w.lib={},C=T.Base=function(){return{extend:function(R){var F=l(this);return R&&F.mixIn(R),(!F.hasOwnProperty("init")||this.init===F.init)&&(F.init=function(){F.$super.init.apply(this,arguments)}),F.init.prototype=F,F.$super=this,F},create:function(){var R=this.extend();return R.init.apply(R,arguments),R},init:function(){},mixIn:function(R){for(var F in R)R.hasOwnProperty(F)&&(this[F]=R[F]);R.hasOwnProperty("toString")&&(this.toString=R.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),P=T.WordArray=C.extend({init:function(R,F){R=this.words=R||[],F!=u?this.sigBytes=F:this.sigBytes=R.length*4},toString:function(R){return(R||W).stringify(this)},concat:function(R){var F=this.words,H=R.words,Q=this.sigBytes,te=R.sigBytes;if(this.clamp(),Q%4)for(var se=0;se>>2]>>>24-se%4*8&255;F[Q+se>>>2]|=ge<<24-(Q+se)%4*8}else for(var xe=0;xe>>2]=H[xe>>>2];return this.sigBytes+=te,this},clamp:function(){var R=this.words,F=this.sigBytes;R[F>>>2]&=4294967295<<32-F%4*8,R.length=a.ceil(F/4)},clone:function(){var R=C.clone.call(this);return R.words=this.words.slice(0),R},random:function(R){for(var F=[],H=0;H>>2]>>>24-te%4*8&255;Q.push((se>>>4).toString(16)),Q.push((se&15).toString(16))}return Q.join("")},parse:function(R){for(var F=R.length,H=[],Q=0;Q>>3]|=parseInt(R.substr(Q,2),16)<<24-Q%8*4;return new P.init(H,F/2)}},U=z.Latin1={stringify:function(R){for(var F=R.words,H=R.sigBytes,Q=[],te=0;te>>2]>>>24-te%4*8&255;Q.push(String.fromCharCode(se))}return Q.join("")},parse:function(R){for(var F=R.length,H=[],Q=0;Q>>2]|=(R.charCodeAt(Q)&255)<<24-Q%4*8;return new P.init(H,F)}},j=z.Utf8={stringify:function(R){try{return decodeURIComponent(escape(U.stringify(R)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(R){return U.parse(unescape(encodeURIComponent(R)))}},L=T.BufferedBlockAlgorithm=C.extend({reset:function(){this._data=new P.init,this._nDataBytes=0},_append:function(R){typeof R=="string"&&(R=j.parse(R)),this._data.concat(R),this._nDataBytes+=R.sigBytes},_process:function(R){var F,H=this._data,Q=H.words,te=H.sigBytes,se=this.blockSize,ge=se*4,xe=te/ge;R?xe=a.ceil(xe):xe=a.max((xe|0)-this._minBufferSize,0);var Ee=xe*se,Be=a.min(Ee*4,te);if(Ee){for(var Fe=0;Fe>>2]|=w[P]<<24-P%4*8;_.call(this,C,T)}else _.apply(this,arguments)};l.prototype=d}}(),n.lib.WordArray})}(ew)),ew.exports}var tw={exports:{}},uM;function pJ(){return uM||(uM=1,function(t,e){(function(n,a){t.exports=a(kr())})($e,function(n){return function(){var a=n,u=a.lib,d=u.WordArray,_=a.enc;_.Utf16=_.Utf16BE={stringify:function(w){for(var T=w.words,C=w.sigBytes,P=[],z=0;z>>2]>>>16-z%4*8&65535;P.push(String.fromCharCode(W))}return P.join("")},parse:function(w){for(var T=w.length,C=[],P=0;P>>1]|=w.charCodeAt(P)<<16-P%2*16;return d.create(C,T*2)}},_.Utf16LE={stringify:function(w){for(var T=w.words,C=w.sigBytes,P=[],z=0;z>>2]>>>16-z%4*8&65535);P.push(String.fromCharCode(W))}return P.join("")},parse:function(w){for(var T=w.length,C=[],P=0;P>>1]|=l(w.charCodeAt(P)<<16-P%2*16);return d.create(C,T*2)}};function l(w){return w<<8&4278255360|w>>>8&16711935}}(),n.enc.Utf16})}(tw)),tw.exports}var rw={exports:{}},hM;function ju(){return hM||(hM=1,function(t,e){(function(n,a){t.exports=a(kr())})($e,function(n){return function(){var a=n,u=a.lib,d=u.WordArray,_=a.enc;_.Base64={stringify:function(w){var T=w.words,C=w.sigBytes,P=this._map;w.clamp();for(var z=[],W=0;W>>2]>>>24-W%4*8&255,j=T[W+1>>>2]>>>24-(W+1)%4*8&255,L=T[W+2>>>2]>>>24-(W+2)%4*8&255,V=U<<16|j<<8|L,R=0;R<4&&W+R*.75>>6*(3-R)&63));var F=P.charAt(64);if(F)for(;z.length%4;)z.push(F);return z.join("")},parse:function(w){var T=w.length,C=this._map,P=this._reverseMap;if(!P){P=this._reverseMap=[];for(var z=0;z>>6-W%4*2,L=U|j;P[z>>>2]|=L<<24-z%4*8,z++}return d.create(P,z)}}(),n.enc.Base64})}(rw)),rw.exports}var nw={exports:{}},dM;function fJ(){return dM||(dM=1,function(t,e){(function(n,a){t.exports=a(kr())})($e,function(n){return function(){var a=n,u=a.lib,d=u.WordArray,_=a.enc;_.Base64url={stringify:function(w,T){T===void 0&&(T=!0);var C=w.words,P=w.sigBytes,z=T?this._safe_map:this._map;w.clamp();for(var W=[],U=0;U>>2]>>>24-U%4*8&255,L=C[U+1>>>2]>>>24-(U+1)%4*8&255,V=C[U+2>>>2]>>>24-(U+2)%4*8&255,R=j<<16|L<<8|V,F=0;F<4&&U+F*.75>>6*(3-F)&63));var H=z.charAt(64);if(H)for(;W.length%4;)W.push(H);return W.join("")},parse:function(w,T){T===void 0&&(T=!0);var C=w.length,P=T?this._safe_map:this._map,z=this._reverseMap;if(!z){z=this._reverseMap=[];for(var W=0;W>>6-W%4*2,L=U|j;P[z>>>2]|=L<<24-z%4*8,z++}return d.create(P,z)}}(),n.enc.Base64url})}(nw)),nw.exports}var iw={exports:{}},pM;function Vu(){return pM||(pM=1,function(t,e){(function(n,a){t.exports=a(kr())})($e,function(n){return function(a){var u=n,d=u.lib,_=d.WordArray,l=d.Hasher,w=u.algo,T=[];(function(){for(var j=0;j<64;j++)T[j]=a.abs(a.sin(j+1))*4294967296|0})();var C=w.MD5=l.extend({_doReset:function(){this._hash=new _.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(j,L){for(var V=0;V<16;V++){var R=L+V,F=j[R];j[R]=(F<<8|F>>>24)&16711935|(F<<24|F>>>8)&4278255360}var H=this._hash.words,Q=j[L+0],te=j[L+1],se=j[L+2],ge=j[L+3],xe=j[L+4],Ee=j[L+5],Be=j[L+6],Fe=j[L+7],Ve=j[L+8],kt=j[L+9],Dt=j[L+10],Ut=j[L+11],cr=j[L+12],qe=j[L+13],Tt=j[L+14],gt=j[L+15],je=H[0],et=H[1],nt=H[2],it=H[3];je=P(je,et,nt,it,Q,7,T[0]),it=P(it,je,et,nt,te,12,T[1]),nt=P(nt,it,je,et,se,17,T[2]),et=P(et,nt,it,je,ge,22,T[3]),je=P(je,et,nt,it,xe,7,T[4]),it=P(it,je,et,nt,Ee,12,T[5]),nt=P(nt,it,je,et,Be,17,T[6]),et=P(et,nt,it,je,Fe,22,T[7]),je=P(je,et,nt,it,Ve,7,T[8]),it=P(it,je,et,nt,kt,12,T[9]),nt=P(nt,it,je,et,Dt,17,T[10]),et=P(et,nt,it,je,Ut,22,T[11]),je=P(je,et,nt,it,cr,7,T[12]),it=P(it,je,et,nt,qe,12,T[13]),nt=P(nt,it,je,et,Tt,17,T[14]),et=P(et,nt,it,je,gt,22,T[15]),je=z(je,et,nt,it,te,5,T[16]),it=z(it,je,et,nt,Be,9,T[17]),nt=z(nt,it,je,et,Ut,14,T[18]),et=z(et,nt,it,je,Q,20,T[19]),je=z(je,et,nt,it,Ee,5,T[20]),it=z(it,je,et,nt,Dt,9,T[21]),nt=z(nt,it,je,et,gt,14,T[22]),et=z(et,nt,it,je,xe,20,T[23]),je=z(je,et,nt,it,kt,5,T[24]),it=z(it,je,et,nt,Tt,9,T[25]),nt=z(nt,it,je,et,ge,14,T[26]),et=z(et,nt,it,je,Ve,20,T[27]),je=z(je,et,nt,it,qe,5,T[28]),it=z(it,je,et,nt,se,9,T[29]),nt=z(nt,it,je,et,Fe,14,T[30]),et=z(et,nt,it,je,cr,20,T[31]),je=W(je,et,nt,it,Ee,4,T[32]),it=W(it,je,et,nt,Ve,11,T[33]),nt=W(nt,it,je,et,Ut,16,T[34]),et=W(et,nt,it,je,Tt,23,T[35]),je=W(je,et,nt,it,te,4,T[36]),it=W(it,je,et,nt,xe,11,T[37]),nt=W(nt,it,je,et,Fe,16,T[38]),et=W(et,nt,it,je,Dt,23,T[39]),je=W(je,et,nt,it,qe,4,T[40]),it=W(it,je,et,nt,Q,11,T[41]),nt=W(nt,it,je,et,ge,16,T[42]),et=W(et,nt,it,je,Be,23,T[43]),je=W(je,et,nt,it,kt,4,T[44]),it=W(it,je,et,nt,cr,11,T[45]),nt=W(nt,it,je,et,gt,16,T[46]),et=W(et,nt,it,je,se,23,T[47]),je=U(je,et,nt,it,Q,6,T[48]),it=U(it,je,et,nt,Fe,10,T[49]),nt=U(nt,it,je,et,Tt,15,T[50]),et=U(et,nt,it,je,Ee,21,T[51]),je=U(je,et,nt,it,cr,6,T[52]),it=U(it,je,et,nt,ge,10,T[53]),nt=U(nt,it,je,et,Dt,15,T[54]),et=U(et,nt,it,je,te,21,T[55]),je=U(je,et,nt,it,Ve,6,T[56]),it=U(it,je,et,nt,gt,10,T[57]),nt=U(nt,it,je,et,Be,15,T[58]),et=U(et,nt,it,je,qe,21,T[59]),je=U(je,et,nt,it,xe,6,T[60]),it=U(it,je,et,nt,Ut,10,T[61]),nt=U(nt,it,je,et,se,15,T[62]),et=U(et,nt,it,je,kt,21,T[63]),H[0]=H[0]+je|0,H[1]=H[1]+et|0,H[2]=H[2]+nt|0,H[3]=H[3]+it|0},_doFinalize:function(){var j=this._data,L=j.words,V=this._nDataBytes*8,R=j.sigBytes*8;L[R>>>5]|=128<<24-R%32;var F=a.floor(V/4294967296),H=V;L[(R+64>>>9<<4)+15]=(F<<8|F>>>24)&16711935|(F<<24|F>>>8)&4278255360,L[(R+64>>>9<<4)+14]=(H<<8|H>>>24)&16711935|(H<<24|H>>>8)&4278255360,j.sigBytes=(L.length+1)*4,this._process();for(var Q=this._hash,te=Q.words,se=0;se<4;se++){var ge=te[se];te[se]=(ge<<8|ge>>>24)&16711935|(ge<<24|ge>>>8)&4278255360}return Q},clone:function(){var j=l.clone.call(this);return j._hash=this._hash.clone(),j}});function P(j,L,V,R,F,H,Q){var te=j+(L&V|~L&R)+F+Q;return(te<>>32-H)+L}function z(j,L,V,R,F,H,Q){var te=j+(L&R|V&~R)+F+Q;return(te<>>32-H)+L}function W(j,L,V,R,F,H,Q){var te=j+(L^V^R)+F+Q;return(te<>>32-H)+L}function U(j,L,V,R,F,H,Q){var te=j+(V^(L|~R))+F+Q;return(te<>>32-H)+L}u.MD5=l._createHelper(C),u.HmacMD5=l._createHmacHelper(C)}(Math),n.MD5})}(iw)),iw.exports}var ow={exports:{}},fM;function GO(){return fM||(fM=1,function(t,e){(function(n,a){t.exports=a(kr())})($e,function(n){return function(){var a=n,u=a.lib,d=u.WordArray,_=u.Hasher,l=a.algo,w=[],T=l.SHA1=_.extend({_doReset:function(){this._hash=new d.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(C,P){for(var z=this._hash.words,W=z[0],U=z[1],j=z[2],L=z[3],V=z[4],R=0;R<80;R++){if(R<16)w[R]=C[P+R]|0;else{var F=w[R-3]^w[R-8]^w[R-14]^w[R-16];w[R]=F<<1|F>>>31}var H=(W<<5|W>>>27)+V+w[R];R<20?H+=(U&j|~U&L)+1518500249:R<40?H+=(U^j^L)+1859775393:R<60?H+=(U&j|U&L|j&L)-1894007588:H+=(U^j^L)-899497514,V=L,L=j,j=U<<30|U>>>2,U=W,W=H}z[0]=z[0]+W|0,z[1]=z[1]+U|0,z[2]=z[2]+j|0,z[3]=z[3]+L|0,z[4]=z[4]+V|0},_doFinalize:function(){var C=this._data,P=C.words,z=this._nDataBytes*8,W=C.sigBytes*8;return P[W>>>5]|=128<<24-W%32,P[(W+64>>>9<<4)+14]=Math.floor(z/4294967296),P[(W+64>>>9<<4)+15]=z,C.sigBytes=P.length*4,this._process(),this._hash},clone:function(){var C=_.clone.call(this);return C._hash=this._hash.clone(),C}});a.SHA1=_._createHelper(T),a.HmacSHA1=_._createHmacHelper(T)}(),n.SHA1})}(ow)),ow.exports}var aw={exports:{}},mM;function PA(){return mM||(mM=1,function(t,e){(function(n,a){t.exports=a(kr())})($e,function(n){return function(a){var u=n,d=u.lib,_=d.WordArray,l=d.Hasher,w=u.algo,T=[],C=[];(function(){function W(V){for(var R=a.sqrt(V),F=2;F<=R;F++)if(!(V%F))return!1;return!0}function U(V){return(V-(V|0))*4294967296|0}for(var j=2,L=0;L<64;)W(j)&&(L<8&&(T[L]=U(a.pow(j,1/2))),C[L]=U(a.pow(j,1/3)),L++),j++})();var P=[],z=w.SHA256=l.extend({_doReset:function(){this._hash=new _.init(T.slice(0))},_doProcessBlock:function(W,U){for(var j=this._hash.words,L=j[0],V=j[1],R=j[2],F=j[3],H=j[4],Q=j[5],te=j[6],se=j[7],ge=0;ge<64;ge++){if(ge<16)P[ge]=W[U+ge]|0;else{var xe=P[ge-15],Ee=(xe<<25|xe>>>7)^(xe<<14|xe>>>18)^xe>>>3,Be=P[ge-2],Fe=(Be<<15|Be>>>17)^(Be<<13|Be>>>19)^Be>>>10;P[ge]=Ee+P[ge-7]+Fe+P[ge-16]}var Ve=H&Q^~H&te,kt=L&V^L&R^V&R,Dt=(L<<30|L>>>2)^(L<<19|L>>>13)^(L<<10|L>>>22),Ut=(H<<26|H>>>6)^(H<<21|H>>>11)^(H<<7|H>>>25),cr=se+Ut+Ve+C[ge]+P[ge],qe=Dt+kt;se=te,te=Q,Q=H,H=F+cr|0,F=R,R=V,V=L,L=cr+qe|0}j[0]=j[0]+L|0,j[1]=j[1]+V|0,j[2]=j[2]+R|0,j[3]=j[3]+F|0,j[4]=j[4]+H|0,j[5]=j[5]+Q|0,j[6]=j[6]+te|0,j[7]=j[7]+se|0},_doFinalize:function(){var W=this._data,U=W.words,j=this._nDataBytes*8,L=W.sigBytes*8;return U[L>>>5]|=128<<24-L%32,U[(L+64>>>9<<4)+14]=a.floor(j/4294967296),U[(L+64>>>9<<4)+15]=j,W.sigBytes=U.length*4,this._process(),this._hash},clone:function(){var W=l.clone.call(this);return W._hash=this._hash.clone(),W}});u.SHA256=l._createHelper(z),u.HmacSHA256=l._createHmacHelper(z)}(Math),n.SHA256})}(aw)),aw.exports}var sw={exports:{}},gM;function mJ(){return gM||(gM=1,function(t,e){(function(n,a,u){t.exports=a(kr(),PA())})($e,function(n){return function(){var a=n,u=a.lib,d=u.WordArray,_=a.algo,l=_.SHA256,w=_.SHA224=l.extend({_doReset:function(){this._hash=new d.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var T=l._doFinalize.call(this);return T.sigBytes-=4,T}});a.SHA224=l._createHelper(w),a.HmacSHA224=l._createHmacHelper(w)}(),n.SHA224})}(sw)),sw.exports}var lw={exports:{}},yM;function HO(){return yM||(yM=1,function(t,e){(function(n,a,u){t.exports=a(kr(),qv())})($e,function(n){return function(){var a=n,u=a.lib,d=u.Hasher,_=a.x64,l=_.Word,w=_.WordArray,T=a.algo;function C(){return l.create.apply(l,arguments)}var P=[C(1116352408,3609767458),C(1899447441,602891725),C(3049323471,3964484399),C(3921009573,2173295548),C(961987163,4081628472),C(1508970993,3053834265),C(2453635748,2937671579),C(2870763221,3664609560),C(3624381080,2734883394),C(310598401,1164996542),C(607225278,1323610764),C(1426881987,3590304994),C(1925078388,4068182383),C(2162078206,991336113),C(2614888103,633803317),C(3248222580,3479774868),C(3835390401,2666613458),C(4022224774,944711139),C(264347078,2341262773),C(604807628,2007800933),C(770255983,1495990901),C(1249150122,1856431235),C(1555081692,3175218132),C(1996064986,2198950837),C(2554220882,3999719339),C(2821834349,766784016),C(2952996808,2566594879),C(3210313671,3203337956),C(3336571891,1034457026),C(3584528711,2466948901),C(113926993,3758326383),C(338241895,168717936),C(666307205,1188179964),C(773529912,1546045734),C(1294757372,1522805485),C(1396182291,2643833823),C(1695183700,2343527390),C(1986661051,1014477480),C(2177026350,1206759142),C(2456956037,344077627),C(2730485921,1290863460),C(2820302411,3158454273),C(3259730800,3505952657),C(3345764771,106217008),C(3516065817,3606008344),C(3600352804,1432725776),C(4094571909,1467031594),C(275423344,851169720),C(430227734,3100823752),C(506948616,1363258195),C(659060556,3750685593),C(883997877,3785050280),C(958139571,3318307427),C(1322822218,3812723403),C(1537002063,2003034995),C(1747873779,3602036899),C(1955562222,1575990012),C(2024104815,1125592928),C(2227730452,2716904306),C(2361852424,442776044),C(2428436474,593698344),C(2756734187,3733110249),C(3204031479,2999351573),C(3329325298,3815920427),C(3391569614,3928383900),C(3515267271,566280711),C(3940187606,3454069534),C(4118630271,4000239992),C(116418474,1914138554),C(174292421,2731055270),C(289380356,3203993006),C(460393269,320620315),C(685471733,587496836),C(852142971,1086792851),C(1017036298,365543100),C(1126000580,2618297676),C(1288033470,3409855158),C(1501505948,4234509866),C(1607167915,987167468),C(1816402316,1246189591)],z=[];(function(){for(var U=0;U<80;U++)z[U]=C()})();var W=T.SHA512=d.extend({_doReset:function(){this._hash=new w.init([new l.init(1779033703,4089235720),new l.init(3144134277,2227873595),new l.init(1013904242,4271175723),new l.init(2773480762,1595750129),new l.init(1359893119,2917565137),new l.init(2600822924,725511199),new l.init(528734635,4215389547),new l.init(1541459225,327033209)])},_doProcessBlock:function(U,j){for(var L=this._hash.words,V=L[0],R=L[1],F=L[2],H=L[3],Q=L[4],te=L[5],se=L[6],ge=L[7],xe=V.high,Ee=V.low,Be=R.high,Fe=R.low,Ve=F.high,kt=F.low,Dt=H.high,Ut=H.low,cr=Q.high,qe=Q.low,Tt=te.high,gt=te.low,je=se.high,et=se.low,nt=ge.high,it=ge.low,ur=xe,Xt=Ee,Pr=Be,Yt=Fe,si=Ve,mr=kt,Vt=Dt,Ii=Ut,qr=cr,pn=qe,Tr=Tt,Bn=gt,ma=je,yi=et,Yn=nt,bo=it,Nn=0;Nn<80;Nn++){var Un,Qn,wo=z[Nn];if(Nn<16)Qn=wo.high=U[j+Nn*2]|0,Un=wo.low=U[j+Nn*2+1]|0;else{var Ps=z[Nn-15],Eo=Ps.high,jn=Ps.low,Wo=(Eo>>>1|jn<<31)^(Eo>>>8|jn<<24)^Eo>>>7,Qa=(jn>>>1|Eo<<31)^(jn>>>8|Eo<<24)^(jn>>>7|Eo<<25),Go=z[Nn-2],Hi=Go.high,So=Go.low,ga=(Hi>>>19|So<<13)^(Hi<<3|So>>>29)^Hi>>>6,To=(So>>>19|Hi<<13)^(So<<3|Hi>>>29)^(So>>>6|Hi<<26),Ho=z[Nn-7],ya=Ho.high,Ja=Ho.low,Ds=z[Nn-16],fe=Ds.high,X=Ds.low;Un=Qa+Ja,Qn=Wo+ya+(Un>>>0>>0?1:0),Un=Un+To,Qn=Qn+ga+(Un>>>0>>0?1:0),Un=Un+X,Qn=Qn+fe+(Un>>>0>>0?1:0),wo.high=Qn,wo.low=Un}var Y=qr&Tr^~qr&ma,de=pn&Bn^~pn&yi,ve=ur&Pr^ur&si^Pr&si,Ae=Xt&Yt^Xt&mr^Yt&mr,Pe=(ur>>>28|Xt<<4)^(ur<<30|Xt>>>2)^(ur<<25|Xt>>>7),ke=(Xt>>>28|ur<<4)^(Xt<<30|ur>>>2)^(Xt<<25|ur>>>7),Te=(qr>>>14|pn<<18)^(qr>>>18|pn<<14)^(qr<<23|pn>>>9),Le=(pn>>>14|qr<<18)^(pn>>>18|qr<<14)^(pn<<23|qr>>>9),dt=P[Nn],mt=dt.high,ct=dt.low,Ft=bo+Le,jt=Yn+Te+(Ft>>>0>>0?1:0),Ft=Ft+de,jt=jt+Y+(Ft>>>0>>0?1:0),Ft=Ft+ct,jt=jt+mt+(Ft>>>0>>0?1:0),Ft=Ft+Un,jt=jt+Qn+(Ft>>>0>>0?1:0),Wt=ke+Ae,Qt=Pe+ve+(Wt>>>0>>0?1:0);Yn=ma,bo=yi,ma=Tr,yi=Bn,Tr=qr,Bn=pn,pn=Ii+Ft|0,qr=Vt+jt+(pn>>>0>>0?1:0)|0,Vt=si,Ii=mr,si=Pr,mr=Yt,Pr=ur,Yt=Xt,Xt=Ft+Wt|0,ur=jt+Qt+(Xt>>>0>>0?1:0)|0}Ee=V.low=Ee+Xt,V.high=xe+ur+(Ee>>>0>>0?1:0),Fe=R.low=Fe+Yt,R.high=Be+Pr+(Fe>>>0>>0?1:0),kt=F.low=kt+mr,F.high=Ve+si+(kt>>>0>>0?1:0),Ut=H.low=Ut+Ii,H.high=Dt+Vt+(Ut>>>0>>0?1:0),qe=Q.low=qe+pn,Q.high=cr+qr+(qe>>>0>>0?1:0),gt=te.low=gt+Bn,te.high=Tt+Tr+(gt>>>0>>0?1:0),et=se.low=et+yi,se.high=je+ma+(et>>>0>>0?1:0),it=ge.low=it+bo,ge.high=nt+Yn+(it>>>0>>0?1:0)},_doFinalize:function(){var U=this._data,j=U.words,L=this._nDataBytes*8,V=U.sigBytes*8;j[V>>>5]|=128<<24-V%32,j[(V+128>>>10<<5)+30]=Math.floor(L/4294967296),j[(V+128>>>10<<5)+31]=L,U.sigBytes=j.length*4,this._process();var R=this._hash.toX32();return R},clone:function(){var U=d.clone.call(this);return U._hash=this._hash.clone(),U},blockSize:1024/32});a.SHA512=d._createHelper(W),a.HmacSHA512=d._createHmacHelper(W)}(),n.SHA512})}(lw)),lw.exports}var cw={exports:{}},_M;function gJ(){return _M||(_M=1,function(t,e){(function(n,a,u){t.exports=a(kr(),qv(),HO())})($e,function(n){return function(){var a=n,u=a.x64,d=u.Word,_=u.WordArray,l=a.algo,w=l.SHA512,T=l.SHA384=w.extend({_doReset:function(){this._hash=new _.init([new d.init(3418070365,3238371032),new d.init(1654270250,914150663),new d.init(2438529370,812702999),new d.init(355462360,4144912697),new d.init(1731405415,4290775857),new d.init(2394180231,1750603025),new d.init(3675008525,1694076839),new d.init(1203062813,3204075428)])},_doFinalize:function(){var C=w._doFinalize.call(this);return C.sigBytes-=16,C}});a.SHA384=w._createHelper(T),a.HmacSHA384=w._createHmacHelper(T)}(),n.SHA384})}(cw)),cw.exports}var uw={exports:{}},vM;function yJ(){return vM||(vM=1,function(t,e){(function(n,a,u){t.exports=a(kr(),qv())})($e,function(n){return function(a){var u=n,d=u.lib,_=d.WordArray,l=d.Hasher,w=u.x64,T=w.Word,C=u.algo,P=[],z=[],W=[];(function(){for(var L=1,V=0,R=0;R<24;R++){P[L+5*V]=(R+1)*(R+2)/2%64;var F=V%5,H=(2*L+3*V)%5;L=F,V=H}for(var L=0;L<5;L++)for(var V=0;V<5;V++)z[L+5*V]=V+(2*L+3*V)%5*5;for(var Q=1,te=0;te<24;te++){for(var se=0,ge=0,xe=0;xe<7;xe++){if(Q&1){var Ee=(1<>>24)&16711935|(Q<<24|Q>>>8)&4278255360,te=(te<<8|te>>>24)&16711935|(te<<24|te>>>8)&4278255360;var se=R[H];se.high^=te,se.low^=Q}for(var ge=0;ge<24;ge++){for(var xe=0;xe<5;xe++){for(var Ee=0,Be=0,Fe=0;Fe<5;Fe++){var se=R[xe+5*Fe];Ee^=se.high,Be^=se.low}var Ve=U[xe];Ve.high=Ee,Ve.low=Be}for(var xe=0;xe<5;xe++)for(var kt=U[(xe+4)%5],Dt=U[(xe+1)%5],Ut=Dt.high,cr=Dt.low,Ee=kt.high^(Ut<<1|cr>>>31),Be=kt.low^(cr<<1|Ut>>>31),Fe=0;Fe<5;Fe++){var se=R[xe+5*Fe];se.high^=Ee,se.low^=Be}for(var qe=1;qe<25;qe++){var Ee,Be,se=R[qe],Tt=se.high,gt=se.low,je=P[qe];je<32?(Ee=Tt<>>32-je,Be=gt<>>32-je):(Ee=gt<>>64-je,Be=Tt<>>64-je);var et=U[z[qe]];et.high=Ee,et.low=Be}var nt=U[0],it=R[0];nt.high=it.high,nt.low=it.low;for(var xe=0;xe<5;xe++)for(var Fe=0;Fe<5;Fe++){var qe=xe+5*Fe,se=R[qe],ur=U[qe],Xt=U[(xe+1)%5+5*Fe],Pr=U[(xe+2)%5+5*Fe];se.high=ur.high^~Xt.high&Pr.high,se.low=ur.low^~Xt.low&Pr.low}var se=R[0],Yt=W[ge];se.high^=Yt.high,se.low^=Yt.low}},_doFinalize:function(){var L=this._data,V=L.words;this._nDataBytes*8;var R=L.sigBytes*8,F=this.blockSize*32;V[R>>>5]|=1<<24-R%32,V[(a.ceil((R+1)/F)*F>>>5)-1]|=128,L.sigBytes=V.length*4,this._process();for(var H=this._state,Q=this.cfg.outputLength/8,te=Q/8,se=[],ge=0;ge>>24)&16711935|(Ee<<24|Ee>>>8)&4278255360,Be=(Be<<8|Be>>>24)&16711935|(Be<<24|Be>>>8)&4278255360,se.push(Be),se.push(Ee)}return new _.init(se,Q)},clone:function(){for(var L=l.clone.call(this),V=L._state=this._state.slice(0),R=0;R<25;R++)V[R]=V[R].clone();return L}});u.SHA3=l._createHelper(j),u.HmacSHA3=l._createHmacHelper(j)}(Math),n.SHA3})}(uw)),uw.exports}var hw={exports:{}},xM;function _J(){return xM||(xM=1,function(t,e){(function(n,a){t.exports=a(kr())})($e,function(n){/** @preserve + (c) 2012 by Cédric Mesnil. All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */return function(a){var u=n,d=u.lib,_=d.WordArray,l=d.Hasher,w=u.algo,T=_.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),C=_.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),P=_.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),z=_.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),W=_.create([0,1518500249,1859775393,2400959708,2840853838]),U=_.create([1352829926,1548603684,1836072691,2053994217,0]),j=w.RIPEMD160=l.extend({_doReset:function(){this._hash=_.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(te,se){for(var ge=0;ge<16;ge++){var xe=se+ge,Ee=te[xe];te[xe]=(Ee<<8|Ee>>>24)&16711935|(Ee<<24|Ee>>>8)&4278255360}var Be=this._hash.words,Fe=W.words,Ve=U.words,kt=T.words,Dt=C.words,Ut=P.words,cr=z.words,qe,Tt,gt,je,et,nt,it,ur,Xt,Pr;nt=qe=Be[0],it=Tt=Be[1],ur=gt=Be[2],Xt=je=Be[3],Pr=et=Be[4];for(var Yt,ge=0;ge<80;ge+=1)Yt=qe+te[se+kt[ge]]|0,ge<16?Yt+=L(Tt,gt,je)+Fe[0]:ge<32?Yt+=V(Tt,gt,je)+Fe[1]:ge<48?Yt+=R(Tt,gt,je)+Fe[2]:ge<64?Yt+=F(Tt,gt,je)+Fe[3]:Yt+=H(Tt,gt,je)+Fe[4],Yt=Yt|0,Yt=Q(Yt,Ut[ge]),Yt=Yt+et|0,qe=et,et=je,je=Q(gt,10),gt=Tt,Tt=Yt,Yt=nt+te[se+Dt[ge]]|0,ge<16?Yt+=H(it,ur,Xt)+Ve[0]:ge<32?Yt+=F(it,ur,Xt)+Ve[1]:ge<48?Yt+=R(it,ur,Xt)+Ve[2]:ge<64?Yt+=V(it,ur,Xt)+Ve[3]:Yt+=L(it,ur,Xt)+Ve[4],Yt=Yt|0,Yt=Q(Yt,cr[ge]),Yt=Yt+Pr|0,nt=Pr,Pr=Xt,Xt=Q(ur,10),ur=it,it=Yt;Yt=Be[1]+gt+Xt|0,Be[1]=Be[2]+je+Pr|0,Be[2]=Be[3]+et+nt|0,Be[3]=Be[4]+qe+it|0,Be[4]=Be[0]+Tt+ur|0,Be[0]=Yt},_doFinalize:function(){var te=this._data,se=te.words,ge=this._nDataBytes*8,xe=te.sigBytes*8;se[xe>>>5]|=128<<24-xe%32,se[(xe+64>>>9<<4)+14]=(ge<<8|ge>>>24)&16711935|(ge<<24|ge>>>8)&4278255360,te.sigBytes=(se.length+1)*4,this._process();for(var Ee=this._hash,Be=Ee.words,Fe=0;Fe<5;Fe++){var Ve=Be[Fe];Be[Fe]=(Ve<<8|Ve>>>24)&16711935|(Ve<<24|Ve>>>8)&4278255360}return Ee},clone:function(){var te=l.clone.call(this);return te._hash=this._hash.clone(),te}});function L(te,se,ge){return te^se^ge}function V(te,se,ge){return te&se|~te&ge}function R(te,se,ge){return(te|~se)^ge}function F(te,se,ge){return te&ge|se&~ge}function H(te,se,ge){return te^(se|~ge)}function Q(te,se){return te<>>32-se}u.RIPEMD160=l._createHelper(j),u.HmacRIPEMD160=l._createHmacHelper(j)}(),n.RIPEMD160})}(hw)),hw.exports}var dw={exports:{}},bM;function DA(){return bM||(bM=1,function(t,e){(function(n,a){t.exports=a(kr())})($e,function(n){(function(){var a=n,u=a.lib,d=u.Base,_=a.enc,l=_.Utf8,w=a.algo;w.HMAC=d.extend({init:function(T,C){T=this._hasher=new T.init,typeof C=="string"&&(C=l.parse(C));var P=T.blockSize,z=P*4;C.sigBytes>z&&(C=T.finalize(C)),C.clamp();for(var W=this._oKey=C.clone(),U=this._iKey=C.clone(),j=W.words,L=U.words,V=0;V>>2]&255;Ee.sigBytes-=Be}};d.BlockCipher=W.extend({cfg:W.cfg.extend({mode:L,padding:R}),reset:function(){var Ee;W.reset.call(this);var Be=this.cfg,Fe=Be.iv,Ve=Be.mode;this._xformMode==this._ENC_XFORM_MODE?Ee=Ve.createEncryptor:(Ee=Ve.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==Ee?this._mode.init(this,Fe&&Fe.words):(this._mode=Ee.call(Ve,this,Fe&&Fe.words),this._mode.__creator=Ee)},_doProcessBlock:function(Ee,Be){this._mode.processBlock(Ee,Be)},_doFinalize:function(){var Ee,Be=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(Be.pad(this._data,this.blockSize),Ee=this._process(!0)):(Ee=this._process(!0),Be.unpad(Ee)),Ee},blockSize:128/32});var F=d.CipherParams=_.extend({init:function(Ee){this.mixIn(Ee)},toString:function(Ee){return(Ee||this.formatter).stringify(this)}}),H=u.format={},Q=H.OpenSSL={stringify:function(Ee){var Be,Fe=Ee.ciphertext,Ve=Ee.salt;return Ve?Be=l.create([1398893684,1701076831]).concat(Ve).concat(Fe):Be=Fe,Be.toString(C)},parse:function(Ee){var Be,Fe=C.parse(Ee),Ve=Fe.words;return Ve[0]==1398893684&&Ve[1]==1701076831&&(Be=l.create(Ve.slice(2,4)),Ve.splice(0,4),Fe.sigBytes-=16),F.create({ciphertext:Fe,salt:Be})}},te=d.SerializableCipher=_.extend({cfg:_.extend({format:Q}),encrypt:function(Ee,Be,Fe,Ve){Ve=this.cfg.extend(Ve);var kt=Ee.createEncryptor(Fe,Ve),Dt=kt.finalize(Be),Ut=kt.cfg;return F.create({ciphertext:Dt,key:Fe,iv:Ut.iv,algorithm:Ee,mode:Ut.mode,padding:Ut.padding,blockSize:Ee.blockSize,formatter:Ve.format})},decrypt:function(Ee,Be,Fe,Ve){Ve=this.cfg.extend(Ve),Be=this._parse(Be,Ve.format);var kt=Ee.createDecryptor(Fe,Ve).finalize(Be.ciphertext);return kt},_parse:function(Ee,Be){return typeof Ee=="string"?Be.parse(Ee,this):Ee}}),se=u.kdf={},ge=se.OpenSSL={execute:function(Ee,Be,Fe,Ve,kt){if(Ve||(Ve=l.random(64/8)),kt)var Dt=z.create({keySize:Be+Fe,hasher:kt}).compute(Ee,Ve);else var Dt=z.create({keySize:Be+Fe}).compute(Ee,Ve);var Ut=l.create(Dt.words.slice(Be),Fe*4);return Dt.sigBytes=Be*4,F.create({key:Dt,iv:Ut,salt:Ve})}},xe=d.PasswordBasedCipher=te.extend({cfg:te.cfg.extend({kdf:ge}),encrypt:function(Ee,Be,Fe,Ve){Ve=this.cfg.extend(Ve);var kt=Ve.kdf.execute(Fe,Ee.keySize,Ee.ivSize,Ve.salt,Ve.hasher);Ve.iv=kt.iv;var Dt=te.encrypt.call(this,Ee,Be,kt.key,Ve);return Dt.mixIn(kt),Dt},decrypt:function(Ee,Be,Fe,Ve){Ve=this.cfg.extend(Ve),Be=this._parse(Be,Ve.format);var kt=Ve.kdf.execute(Fe,Ee.keySize,Ee.ivSize,Be.salt,Ve.hasher);Ve.iv=kt.iv;var Dt=te.decrypt.call(this,Ee,Be,kt.key,Ve);return Dt}})}()})}(mw)),mw.exports}var gw={exports:{}},TM;function xJ(){return TM||(TM=1,function(t,e){(function(n,a,u){t.exports=a(kr(),gi())})($e,function(n){return n.mode.CFB=function(){var a=n.lib.BlockCipherMode.extend();a.Encryptor=a.extend({processBlock:function(d,_){var l=this._cipher,w=l.blockSize;u.call(this,d,_,w,l),this._prevBlock=d.slice(_,_+w)}}),a.Decryptor=a.extend({processBlock:function(d,_){var l=this._cipher,w=l.blockSize,T=d.slice(_,_+w);u.call(this,d,_,w,l),this._prevBlock=T}});function u(d,_,l,w){var T,C=this._iv;C?(T=C.slice(0),this._iv=void 0):T=this._prevBlock,w.encryptBlock(T,0);for(var P=0;P>24&255)===255){var w=l>>16&255,T=l>>8&255,C=l&255;w===255?(w=0,T===255?(T=0,C===255?C=0:++C):++T):++w,l=0,l+=w<<16,l+=T<<8,l+=C}else l+=1<<24;return l}function d(l){return(l[0]=u(l[0]))===0&&(l[1]=u(l[1])),l}var _=a.Encryptor=a.extend({processBlock:function(l,w){var T=this._cipher,C=T.blockSize,P=this._iv,z=this._counter;P&&(z=this._counter=P.slice(0),this._iv=void 0),d(z);var W=z.slice(0);T.encryptBlock(W,0);for(var U=0;U>>2]|=l<<24-w%4*8,a.sigBytes+=l},unpad:function(a){var u=a.words[a.sigBytes-1>>>2]&255;a.sigBytes-=u}},n.pad.Ansix923})}(bw)),bw.exports}var ww={exports:{}},DM;function AJ(){return DM||(DM=1,function(t,e){(function(n,a,u){t.exports=a(kr(),gi())})($e,function(n){return n.pad.Iso10126={pad:function(a,u){var d=u*4,_=d-a.sigBytes%d;a.concat(n.lib.WordArray.random(_-1)).concat(n.lib.WordArray.create([_<<24],1))},unpad:function(a){var u=a.words[a.sigBytes-1>>>2]&255;a.sigBytes-=u}},n.pad.Iso10126})}(ww)),ww.exports}var Ew={exports:{}},MM;function IJ(){return MM||(MM=1,function(t,e){(function(n,a,u){t.exports=a(kr(),gi())})($e,function(n){return n.pad.Iso97971={pad:function(a,u){a.concat(n.lib.WordArray.create([2147483648],1)),n.pad.ZeroPadding.pad(a,u)},unpad:function(a){n.pad.ZeroPadding.unpad(a),a.sigBytes--}},n.pad.Iso97971})}(Ew)),Ew.exports}var Sw={exports:{}},zM;function CJ(){return zM||(zM=1,function(t,e){(function(n,a,u){t.exports=a(kr(),gi())})($e,function(n){return n.pad.ZeroPadding={pad:function(a,u){var d=u*4;a.clamp(),a.sigBytes+=d-(a.sigBytes%d||d)},unpad:function(a){for(var u=a.words,d=a.sigBytes-1,d=a.sigBytes-1;d>=0;d--)if(u[d>>>2]>>>24-d%4*8&255){a.sigBytes=d+1;break}}},n.pad.ZeroPadding})}(Sw)),Sw.exports}var Tw={exports:{}},RM;function kJ(){return RM||(RM=1,function(t,e){(function(n,a,u){t.exports=a(kr(),gi())})($e,function(n){return n.pad.NoPadding={pad:function(){},unpad:function(){}},n.pad.NoPadding})}(Tw)),Tw.exports}var Aw={exports:{}},OM;function PJ(){return OM||(OM=1,function(t,e){(function(n,a,u){t.exports=a(kr(),gi())})($e,function(n){return function(a){var u=n,d=u.lib,_=d.CipherParams,l=u.enc,w=l.Hex,T=u.format;T.Hex={stringify:function(C){return C.ciphertext.toString(w)},parse:function(C){var P=w.parse(C);return _.create({ciphertext:P})}}}(),n.format.Hex})}(Aw)),Aw.exports}var Iw={exports:{}},FM;function DJ(){return FM||(FM=1,function(t,e){(function(n,a,u){t.exports=a(kr(),ju(),Vu(),Ac(),gi())})($e,function(n){return function(){var a=n,u=a.lib,d=u.BlockCipher,_=a.algo,l=[],w=[],T=[],C=[],P=[],z=[],W=[],U=[],j=[],L=[];(function(){for(var F=[],H=0;H<256;H++)H<128?F[H]=H<<1:F[H]=H<<1^283;for(var Q=0,te=0,H=0;H<256;H++){var se=te^te<<1^te<<2^te<<3^te<<4;se=se>>>8^se&255^99,l[Q]=se,w[se]=Q;var ge=F[Q],xe=F[ge],Ee=F[xe],Be=F[se]*257^se*16843008;T[Q]=Be<<24|Be>>>8,C[Q]=Be<<16|Be>>>16,P[Q]=Be<<8|Be>>>24,z[Q]=Be;var Be=Ee*16843009^xe*65537^ge*257^Q*16843008;W[se]=Be<<24|Be>>>8,U[se]=Be<<16|Be>>>16,j[se]=Be<<8|Be>>>24,L[se]=Be,Q?(Q=ge^F[F[F[Ee^ge]]],te^=F[F[te]]):Q=te=1}})();var V=[0,1,2,4,8,16,32,64,128,27,54],R=_.AES=d.extend({_doReset:function(){var F;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var H=this._keyPriorReset=this._key,Q=H.words,te=H.sigBytes/4,se=this._nRounds=te+6,ge=(se+1)*4,xe=this._keySchedule=[],Ee=0;Ee6&&Ee%te==4&&(F=l[F>>>24]<<24|l[F>>>16&255]<<16|l[F>>>8&255]<<8|l[F&255]):(F=F<<8|F>>>24,F=l[F>>>24]<<24|l[F>>>16&255]<<16|l[F>>>8&255]<<8|l[F&255],F^=V[Ee/te|0]<<24),xe[Ee]=xe[Ee-te]^F);for(var Be=this._invKeySchedule=[],Fe=0;Fe>>24]]^U[l[F>>>16&255]]^j[l[F>>>8&255]]^L[l[F&255]]}}},encryptBlock:function(F,H){this._doCryptBlock(F,H,this._keySchedule,T,C,P,z,l)},decryptBlock:function(F,H){var Q=F[H+1];F[H+1]=F[H+3],F[H+3]=Q,this._doCryptBlock(F,H,this._invKeySchedule,W,U,j,L,w);var Q=F[H+1];F[H+1]=F[H+3],F[H+3]=Q},_doCryptBlock:function(F,H,Q,te,se,ge,xe,Ee){for(var Be=this._nRounds,Fe=F[H]^Q[0],Ve=F[H+1]^Q[1],kt=F[H+2]^Q[2],Dt=F[H+3]^Q[3],Ut=4,cr=1;cr>>24]^se[Ve>>>16&255]^ge[kt>>>8&255]^xe[Dt&255]^Q[Ut++],Tt=te[Ve>>>24]^se[kt>>>16&255]^ge[Dt>>>8&255]^xe[Fe&255]^Q[Ut++],gt=te[kt>>>24]^se[Dt>>>16&255]^ge[Fe>>>8&255]^xe[Ve&255]^Q[Ut++],je=te[Dt>>>24]^se[Fe>>>16&255]^ge[Ve>>>8&255]^xe[kt&255]^Q[Ut++];Fe=qe,Ve=Tt,kt=gt,Dt=je}var qe=(Ee[Fe>>>24]<<24|Ee[Ve>>>16&255]<<16|Ee[kt>>>8&255]<<8|Ee[Dt&255])^Q[Ut++],Tt=(Ee[Ve>>>24]<<24|Ee[kt>>>16&255]<<16|Ee[Dt>>>8&255]<<8|Ee[Fe&255])^Q[Ut++],gt=(Ee[kt>>>24]<<24|Ee[Dt>>>16&255]<<16|Ee[Fe>>>8&255]<<8|Ee[Ve&255])^Q[Ut++],je=(Ee[Dt>>>24]<<24|Ee[Fe>>>16&255]<<16|Ee[Ve>>>8&255]<<8|Ee[kt&255])^Q[Ut++];F[H]=qe,F[H+1]=Tt,F[H+2]=gt,F[H+3]=je},keySize:256/32});a.AES=d._createHelper(R)}(),n.AES})}(Iw)),Iw.exports}var Cw={exports:{}},LM;function MJ(){return LM||(LM=1,function(t,e){(function(n,a,u){t.exports=a(kr(),ju(),Vu(),Ac(),gi())})($e,function(n){return function(){var a=n,u=a.lib,d=u.WordArray,_=u.BlockCipher,l=a.algo,w=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],T=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],C=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],P=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],z=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],W=l.DES=_.extend({_doReset:function(){for(var V=this._key,R=V.words,F=[],H=0;H<56;H++){var Q=w[H]-1;F[H]=R[Q>>>5]>>>31-Q%32&1}for(var te=this._subKeys=[],se=0;se<16;se++){for(var ge=te[se]=[],xe=C[se],H=0;H<24;H++)ge[H/6|0]|=F[(T[H]-1+xe)%28]<<31-H%6,ge[4+(H/6|0)]|=F[28+(T[H+24]-1+xe)%28]<<31-H%6;ge[0]=ge[0]<<1|ge[0]>>>31;for(var H=1;H<7;H++)ge[H]=ge[H]>>>(H-1)*4+3;ge[7]=ge[7]<<5|ge[7]>>>27}for(var Ee=this._invSubKeys=[],H=0;H<16;H++)Ee[H]=te[15-H]},encryptBlock:function(V,R){this._doCryptBlock(V,R,this._subKeys)},decryptBlock:function(V,R){this._doCryptBlock(V,R,this._invSubKeys)},_doCryptBlock:function(V,R,F){this._lBlock=V[R],this._rBlock=V[R+1],U.call(this,4,252645135),U.call(this,16,65535),j.call(this,2,858993459),j.call(this,8,16711935),U.call(this,1,1431655765);for(var H=0;H<16;H++){for(var Q=F[H],te=this._lBlock,se=this._rBlock,ge=0,xe=0;xe<8;xe++)ge|=P[xe][((se^Q[xe])&z[xe])>>>0];this._lBlock=se,this._rBlock=te^ge}var Ee=this._lBlock;this._lBlock=this._rBlock,this._rBlock=Ee,U.call(this,1,1431655765),j.call(this,8,16711935),j.call(this,2,858993459),U.call(this,16,65535),U.call(this,4,252645135),V[R]=this._lBlock,V[R+1]=this._rBlock},keySize:64/32,ivSize:64/32,blockSize:64/32});function U(V,R){var F=(this._lBlock>>>V^this._rBlock)&R;this._rBlock^=F,this._lBlock^=F<>>V^this._lBlock)&R;this._lBlock^=F,this._rBlock^=F<192.");var F=R.slice(0,2),H=R.length<4?R.slice(0,2):R.slice(2,4),Q=R.length<6?R.slice(0,2):R.slice(4,6);this._des1=W.createEncryptor(d.create(F)),this._des2=W.createEncryptor(d.create(H)),this._des3=W.createEncryptor(d.create(Q))},encryptBlock:function(V,R){this._des1.encryptBlock(V,R),this._des2.decryptBlock(V,R),this._des3.encryptBlock(V,R)},decryptBlock:function(V,R){this._des3.decryptBlock(V,R),this._des2.encryptBlock(V,R),this._des1.decryptBlock(V,R)},keySize:192/32,ivSize:64/32,blockSize:64/32});a.TripleDES=_._createHelper(L)}(),n.TripleDES})}(Cw)),Cw.exports}var kw={exports:{}},BM;function zJ(){return BM||(BM=1,function(t,e){(function(n,a,u){t.exports=a(kr(),ju(),Vu(),Ac(),gi())})($e,function(n){return function(){var a=n,u=a.lib,d=u.StreamCipher,_=a.algo,l=_.RC4=d.extend({_doReset:function(){for(var C=this._key,P=C.words,z=C.sigBytes,W=this._S=[],U=0;U<256;U++)W[U]=U;for(var U=0,j=0;U<256;U++){var L=U%z,V=P[L>>>2]>>>24-L%4*8&255;j=(j+W[U]+V)%256;var R=W[U];W[U]=W[j],W[j]=R}this._i=this._j=0},_doProcessBlock:function(C,P){C[P]^=w.call(this)},keySize:256/32,ivSize:0});function w(){for(var C=this._S,P=this._i,z=this._j,W=0,U=0;U<4;U++){P=(P+1)%256,z=(z+C[P])%256;var j=C[P];C[P]=C[z],C[z]=j,W|=C[(C[P]+C[z])%256]<<24-U*8}return this._i=P,this._j=z,W}a.RC4=d._createHelper(l);var T=_.RC4Drop=l.extend({cfg:l.cfg.extend({drop:192}),_doReset:function(){l._doReset.call(this);for(var C=this.cfg.drop;C>0;C--)w.call(this)}});a.RC4Drop=d._createHelper(T)}(),n.RC4})}(kw)),kw.exports}var Pw={exports:{}},NM;function RJ(){return NM||(NM=1,function(t,e){(function(n,a,u){t.exports=a(kr(),ju(),Vu(),Ac(),gi())})($e,function(n){return function(){var a=n,u=a.lib,d=u.StreamCipher,_=a.algo,l=[],w=[],T=[],C=_.Rabbit=d.extend({_doReset:function(){for(var z=this._key.words,W=this.cfg.iv,U=0;U<4;U++)z[U]=(z[U]<<8|z[U]>>>24)&16711935|(z[U]<<24|z[U]>>>8)&4278255360;var j=this._X=[z[0],z[3]<<16|z[2]>>>16,z[1],z[0]<<16|z[3]>>>16,z[2],z[1]<<16|z[0]>>>16,z[3],z[2]<<16|z[1]>>>16],L=this._C=[z[2]<<16|z[2]>>>16,z[0]&4294901760|z[1]&65535,z[3]<<16|z[3]>>>16,z[1]&4294901760|z[2]&65535,z[0]<<16|z[0]>>>16,z[2]&4294901760|z[3]&65535,z[1]<<16|z[1]>>>16,z[3]&4294901760|z[0]&65535];this._b=0;for(var U=0;U<4;U++)P.call(this);for(var U=0;U<8;U++)L[U]^=j[U+4&7];if(W){var V=W.words,R=V[0],F=V[1],H=(R<<8|R>>>24)&16711935|(R<<24|R>>>8)&4278255360,Q=(F<<8|F>>>24)&16711935|(F<<24|F>>>8)&4278255360,te=H>>>16|Q&4294901760,se=Q<<16|H&65535;L[0]^=H,L[1]^=te,L[2]^=Q,L[3]^=se,L[4]^=H,L[5]^=te,L[6]^=Q,L[7]^=se;for(var U=0;U<4;U++)P.call(this)}},_doProcessBlock:function(z,W){var U=this._X;P.call(this),l[0]=U[0]^U[5]>>>16^U[3]<<16,l[1]=U[2]^U[7]>>>16^U[5]<<16,l[2]=U[4]^U[1]>>>16^U[7]<<16,l[3]=U[6]^U[3]>>>16^U[1]<<16;for(var j=0;j<4;j++)l[j]=(l[j]<<8|l[j]>>>24)&16711935|(l[j]<<24|l[j]>>>8)&4278255360,z[W+j]^=l[j]},blockSize:128/32,ivSize:64/32});function P(){for(var z=this._X,W=this._C,U=0;U<8;U++)w[U]=W[U];W[0]=W[0]+1295307597+this._b|0,W[1]=W[1]+3545052371+(W[0]>>>0>>0?1:0)|0,W[2]=W[2]+886263092+(W[1]>>>0>>0?1:0)|0,W[3]=W[3]+1295307597+(W[2]>>>0>>0?1:0)|0,W[4]=W[4]+3545052371+(W[3]>>>0>>0?1:0)|0,W[5]=W[5]+886263092+(W[4]>>>0>>0?1:0)|0,W[6]=W[6]+1295307597+(W[5]>>>0>>0?1:0)|0,W[7]=W[7]+3545052371+(W[6]>>>0>>0?1:0)|0,this._b=W[7]>>>0>>0?1:0;for(var U=0;U<8;U++){var j=z[U]+W[U],L=j&65535,V=j>>>16,R=((L*L>>>17)+L*V>>>15)+V*V,F=((j&4294901760)*j|0)+((j&65535)*j|0);T[U]=R^F}z[0]=T[0]+(T[7]<<16|T[7]>>>16)+(T[6]<<16|T[6]>>>16)|0,z[1]=T[1]+(T[0]<<8|T[0]>>>24)+T[7]|0,z[2]=T[2]+(T[1]<<16|T[1]>>>16)+(T[0]<<16|T[0]>>>16)|0,z[3]=T[3]+(T[2]<<8|T[2]>>>24)+T[1]|0,z[4]=T[4]+(T[3]<<16|T[3]>>>16)+(T[2]<<16|T[2]>>>16)|0,z[5]=T[5]+(T[4]<<8|T[4]>>>24)+T[3]|0,z[6]=T[6]+(T[5]<<16|T[5]>>>16)+(T[4]<<16|T[4]>>>16)|0,z[7]=T[7]+(T[6]<<8|T[6]>>>24)+T[5]|0}a.Rabbit=d._createHelper(C)}(),n.Rabbit})}(Pw)),Pw.exports}var Dw={exports:{}},UM;function OJ(){return UM||(UM=1,function(t,e){(function(n,a,u){t.exports=a(kr(),ju(),Vu(),Ac(),gi())})($e,function(n){return function(){var a=n,u=a.lib,d=u.StreamCipher,_=a.algo,l=[],w=[],T=[],C=_.RabbitLegacy=d.extend({_doReset:function(){var z=this._key.words,W=this.cfg.iv,U=this._X=[z[0],z[3]<<16|z[2]>>>16,z[1],z[0]<<16|z[3]>>>16,z[2],z[1]<<16|z[0]>>>16,z[3],z[2]<<16|z[1]>>>16],j=this._C=[z[2]<<16|z[2]>>>16,z[0]&4294901760|z[1]&65535,z[3]<<16|z[3]>>>16,z[1]&4294901760|z[2]&65535,z[0]<<16|z[0]>>>16,z[2]&4294901760|z[3]&65535,z[1]<<16|z[1]>>>16,z[3]&4294901760|z[0]&65535];this._b=0;for(var L=0;L<4;L++)P.call(this);for(var L=0;L<8;L++)j[L]^=U[L+4&7];if(W){var V=W.words,R=V[0],F=V[1],H=(R<<8|R>>>24)&16711935|(R<<24|R>>>8)&4278255360,Q=(F<<8|F>>>24)&16711935|(F<<24|F>>>8)&4278255360,te=H>>>16|Q&4294901760,se=Q<<16|H&65535;j[0]^=H,j[1]^=te,j[2]^=Q,j[3]^=se,j[4]^=H,j[5]^=te,j[6]^=Q,j[7]^=se;for(var L=0;L<4;L++)P.call(this)}},_doProcessBlock:function(z,W){var U=this._X;P.call(this),l[0]=U[0]^U[5]>>>16^U[3]<<16,l[1]=U[2]^U[7]>>>16^U[5]<<16,l[2]=U[4]^U[1]>>>16^U[7]<<16,l[3]=U[6]^U[3]>>>16^U[1]<<16;for(var j=0;j<4;j++)l[j]=(l[j]<<8|l[j]>>>24)&16711935|(l[j]<<24|l[j]>>>8)&4278255360,z[W+j]^=l[j]},blockSize:128/32,ivSize:64/32});function P(){for(var z=this._X,W=this._C,U=0;U<8;U++)w[U]=W[U];W[0]=W[0]+1295307597+this._b|0,W[1]=W[1]+3545052371+(W[0]>>>0>>0?1:0)|0,W[2]=W[2]+886263092+(W[1]>>>0>>0?1:0)|0,W[3]=W[3]+1295307597+(W[2]>>>0>>0?1:0)|0,W[4]=W[4]+3545052371+(W[3]>>>0>>0?1:0)|0,W[5]=W[5]+886263092+(W[4]>>>0>>0?1:0)|0,W[6]=W[6]+1295307597+(W[5]>>>0>>0?1:0)|0,W[7]=W[7]+3545052371+(W[6]>>>0>>0?1:0)|0,this._b=W[7]>>>0>>0?1:0;for(var U=0;U<8;U++){var j=z[U]+W[U],L=j&65535,V=j>>>16,R=((L*L>>>17)+L*V>>>15)+V*V,F=((j&4294901760)*j|0)+((j&65535)*j|0);T[U]=R^F}z[0]=T[0]+(T[7]<<16|T[7]>>>16)+(T[6]<<16|T[6]>>>16)|0,z[1]=T[1]+(T[0]<<8|T[0]>>>24)+T[7]|0,z[2]=T[2]+(T[1]<<16|T[1]>>>16)+(T[0]<<16|T[0]>>>16)|0,z[3]=T[3]+(T[2]<<8|T[2]>>>24)+T[1]|0,z[4]=T[4]+(T[3]<<16|T[3]>>>16)+(T[2]<<16|T[2]>>>16)|0,z[5]=T[5]+(T[4]<<8|T[4]>>>24)+T[3]|0,z[6]=T[6]+(T[5]<<16|T[5]>>>16)+(T[4]<<16|T[4]>>>16)|0,z[7]=T[7]+(T[6]<<8|T[6]>>>24)+T[5]|0}a.RabbitLegacy=d._createHelper(C)}(),n.RabbitLegacy})}(Dw)),Dw.exports}var Mw={exports:{}},jM;function FJ(){return jM||(jM=1,function(t,e){(function(n,a,u){t.exports=a(kr(),ju(),Vu(),Ac(),gi())})($e,function(n){return function(){var a=n,u=a.lib,d=u.BlockCipher,_=a.algo;const l=16,w=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],T=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var C={pbox:[],sbox:[]};function P(L,V){let R=V>>24&255,F=V>>16&255,H=V>>8&255,Q=V&255,te=L.sbox[0][R]+L.sbox[1][F];return te=te^L.sbox[2][H],te=te+L.sbox[3][Q],te}function z(L,V,R){let F=V,H=R,Q;for(let te=0;te1;--te)F=F^L.pbox[te],H=P(L,F)^H,Q=F,F=H,H=Q;return Q=F,F=H,H=Q,H=H^L.pbox[1],F=F^L.pbox[0],{left:F,right:H}}function U(L,V,R){for(let se=0;se<4;se++){L.sbox[se]=[];for(let ge=0;ge<256;ge++)L.sbox[se][ge]=T[se][ge]}let F=0;for(let se=0;se=R&&(F=0);let H=0,Q=0,te=0;for(let se=0;se0&&setTimeout(T=>{console.log(`Will append content to ${w.className}: `,l),l.childNodes.forEach(C=>{if(C.nodeType===1){const P=C;T.insertAdjacentElement("beforeend",P)}})},53,w),d=!0)}}return St.useEffect(()=>{n!==null&&a!==null&&setTimeout(function(){const l=typeof e=="function"?e():null;if(console.log("viz_content:",l),l!==null){const w=l==null?void 0:l.querySelector(n);console.log("viz:",w),w.token=$J(UJ,BJ,NJ,LJ,VJ),new Promise((T,C)=>{console.log("About to reference @tableau/embedding-api..."),w.addEventListener(aM.FirstInteractive,()=>{console.log("Viz is interactive!"),T()}),w.addEventListener(aM.VizLoadError,P=>{const z=JSON.parse(P.detail.message),U=`ca-error-${JSON.parse(z.errorMessage).result.errors[0].code}`;console.log("Error",U,z),C(U)})}).then(T=>{var z;let C,P;((z=w.workbook.activeSheet)==null?void 0:z.sheetType)===(Yb==null?void 0:Yb.Dashboard)?(C=w.workbook.activeSheet,P=C==null?void 0:C.worksheets.find(W=>W.name==="Replace-Name-of-Worksheet")):P=w.workbook.activeSheet,console.log("Tableau Viz Dashboard: ",C),console.log("Tableau Viz Worksheet: ",P)}),t&&w!==null?_(l):d=!0}},a+1e3)},[]),St.createElement("div",{className:u})}const Rw="pk.eyJ1IjoicnVyYWxpbm5vIiwiYSI6ImNqeHl0cW0xODBlMm0zY2x0dXltYzRuazUifQ.zZBovoCHzLIW0wCZveEKzA",$M="/examples/cori.data.rin/rin_service_areas.geojson";function WJ({app_id:t,attach_content:e=!1,content:n,content_selector:a,content_timeout:u}){var U;const d=St.useContext(ZR),[_,l]=St.useState(!0);function w(){u&&u!==null&&setTimeout(function(){if(!_){const j=document.getElementById(t);if(j){const L=typeof n=="function"?n():null;L!==null&&L.childNodes!==null&&L.childNodes.length>0&&(console.log(`Will append content to ${t}: `,L),setTimeout(V=>{L.childNodes.forEach(R=>{if(R.nodeType===1){const F=R;V.insertAdjacentElement("beforeend",F)}})},53,j),l(!0))}}},u+1e3)}St.useEffect(()=>{console.log("Viz content loaded:",_,a,u,n()),e?w():l(!0)},[]);const T=St.useRef(null),C=St.useMemo(()=>(j,L,V,R)=>{const F=new hT.Popup;return R.hasOwnProperty(V)?(F.setLngLat([j,L]),F.setText(R[V])):F.setText("Hello world!"),F},[]);let P=!1;function z(j,L,V,R,F,H,Q){return console.log(`Set marker (${Q[H]+"-marker"}): `,T),St.createElement(KR,{ref:j,longitude:L,latitude:V,color:R,popup:F(L,V,H,Q),key:Q[H]+"-marker"})}St.useEffect(()=>{if(d&&!d.data.hasOwnProperty("placeData")&&!P){console.log("Initial place data fetch..."),console.log($M),P=!0;const j=window.document.getElementById("info-wrapper");j!==null&&(j.style.opacity="1.0",j.style.position="absolute",j.style.background=`rgba(46, 60, 67, 0.5) url('${d.baseURL}/images/loading.gif') no-repeat fixed center`,j.style.backgroundSize="20px"),d.setData({...(d==null?void 0:d.data)||{},placeData:null}),d==null||d.apiClient.get($M).then(L=>{L&&L.hasOwnProperty("data")&&(d.setData({...d.data,placeData:L.data.features}),P=!1,j!==null&&(j.style.opacity="0.0",j.style.pointerEvents="none",setTimeout(()=>{j.style.background="transparent"},533)))}).catch(L=>{console.error("Error fetching data:",L),P=!1,j!==null&&(j.style.opacity="0.0",j.style.pointerEvents="none",setTimeout(()=>{j.style.background="transparent"},533))})}},[d==null?void 0:d.data]);const W=[];return St.createElement(St.Fragment,null,St.createElement("div",{className:"slippy-map"},St.createElement(jV,{mapboxAccessToken:Rw,initialViewState:{latitude:40,longitude:-99,pitch:45,zoom:4},style:{width:600,height:400},mapStyle:`https://api.mapbox.com/styles/v1/ruralinno/cl010e7b7001p15pe3l0306hv?access_token=${Rw}`},!!(d!=null&&d.data)&&!!((U=d==null?void 0:d.data)!=null&&U.placeData)&&d.data.placeData.length>0&&!!T&&typeof T!==void 0&&d.data.placeData.filter(j=>{const L=j.properties.rin_community.toString();return W.filter(V=>V===L).length<1?(W.push(L),!0):!1}).map(j=>{console.log(j.properties.rin_community);const L=typeof j.geometry.coordinates[0]=="number"?j.geometry.coordinates[0]:0,V=typeof j.geometry.coordinates[1]=="number"?j.geometry.coordinates[1]:0;return z(T,L,V,"#16343e",C,"rin_community",j.properties)}),St.createElement(Q9,{mapboxAccessToken:Rw,position:"top-right"}),St.createElement($V,{position:"top-right"}),St.createElement(VV,{position:"top-right"}),St.createElement(WV,{position:"bottom-left",unit:"imperial"}))),St.createElement("div",{id:"info-wrapper",style:{pointerEvents:"none",position:"absolute",top:0,left:0,minWidth:"100vw",minHeight:"100vh",transition:"opacity 5.05s ease-in-out 0.025s",opacity:"initial",background:"transparent",backgroundSize:"20px",zIndex:100}}),!!_&&!!a&&!!u&&(e?St.createElement(VM,{attach_content:e,content:()=>n(),content_selector:a,content_timeout:u+1e3}):St.createElement("div",{className:"hide tableau-viz-container",style:{display:"block",visibility:"hidden",width:0,height:0}},St.createElement(VM,{attach_content:e,content:()=>n(),content_selector:a,content_timeout:u+1e3}))))}const GJ="https://cori-risi-apps.s3.amazonaws.com",HJ=333;function qJ(t,e){const n=document.getElementById(t)||document.createElement("div"),a=document.createElement("div");n.id=t,document.getElementById("loader")!==null&&document.getElementById("loader").remove();for(const u of n.childNodes){const d=u;u.nodeType===1&&a.appendChild(d)}tR(n).render(St.createElement(St.StrictMode,null,St.createElement(uV,{baseURL:GJ},St.createElement(WJ,{app_id:t,attach_content:!1,content:()=>e!==null&&document.querySelector(e)!==null?document.querySelector(e).parentElement:a,content_selector:e,content_timeout:HJ}))))}qJ("app","tableau-viz, tableau-authoring-viz"); diff --git a/docs/cisco/eda.html b/docs/cisco/eda.html index 3ea6a0a..9972528 100644 --- a/docs/cisco/eda.html +++ b/docs/cisco/eda.html @@ -224,8 +224,8 @@

-
- +
+
@@ -234,8 +234,8 @@

-
- +
+
@@ -250,8 +250,8 @@

Who completed t
-
- +
+
+ + + + + + + + + + - diff --git a/docs/index.html b/docs/index.html index 5e63670..8d91562 100644 --- a/docs/index.html +++ b/docs/index.html @@ -177,7 +177,7 @@

Rural Innovation Network

And here's some more stuff to say about the network. Should we drop a micro dashboard here?
--> -

+

@@ -628,12 +628,24 @@

Rural Innovation Network

}; if (typeof window.exports === "undefined") { const exports = {}; } - +
- + + + diff --git a/docs/site_libs/bootstrap/bootstrap.min.css b/docs/site_libs/bootstrap/bootstrap.min.css index abfff14..c6b410b 100644 --- a/docs/site_libs/bootstrap/bootstrap.min.css +++ b/docs/site_libs/bootstrap/bootstrap.min.css @@ -1,4 +1,4 @@ -@import"https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;700&display=swap";body{background-color:#16343e !important}header#quarto-header{background-color:#16343e}header#quarto-header nav.navbar{text-shadow:-1px -1px 0 rgba(0,0,0,.3)}header#quarto-header nav.navbar[data-bs-theme=dark]{background-color:#16343e}header#quarto-header nav.navbar[data-bs-theme=dark] .navbar-brand{min-width:7em;min-height:3.5em;background-image:url("assets/images/Full-Logo_CORI_Cream.svg");background-size:calc(100% - 1em);background-position:left top;background-repeat:no-repeat;padding-left:.5em}header#quarto-header nav.navbar[data-bs-theme=dark] .navbar-brand .navbar-title{display:none}header#quarto-header nav.navbar[data-bs-theme=dark] .navbar-brand-container{min-width:196px}header#quarto-header nav.navbar[data-bs-theme=dark] .nav-link:hover,header#quarto-header nav.navbar[data-bs-theme=dark] .nav-link.active:hover{color:#fff}header#quarto-header nav.navbar[data-bs-theme=dark] .nav-link .menu-text,header#quarto-header nav.navbar[data-bs-theme=dark] .nav-link i,header#quarto-header nav.navbar[data-bs-theme=dark] .nav-link.active .menu-text,header#quarto-header nav.navbar[data-bs-theme=dark] .nav-link.active i{color:#fbf8e9}header#quarto-header nav.navbar[data-bs-theme=dark] .nav-link .menu-text:hover,header#quarto-header nav.navbar[data-bs-theme=dark] .nav-link i:hover,header#quarto-header nav.navbar[data-bs-theme=dark] .nav-link.active .menu-text:hover,header#quarto-header nav.navbar[data-bs-theme=dark] .nav-link.active i:hover{color:#fff}header#quarto-header * a:visited{color:#fff !important}header#quarto-header * a:hover{color:#7a7a7a !important;text-shadow:none}header#quarto-header * a.nav-link{font-variant:small-caps}header#quarto-header * a .navbar-title{font-weight:bold}header#title-block-header{margin-bottom:0;margin-top:10px;background-color:rgba(0,0,0,0) !important}header .quarto-title-breadcrumbs .breadcrumb{background-color:rgba(163,226,181,.75)}header .quarto-title-breadcrumbs .breadcrumb li.breadcrumb-item::before{color:#59666a}header .quarto-title-breadcrumbs .breadcrumb li a{color:#59666a}header .quarto-title-breadcrumbs .breadcrumb li:last-of-type a{color:#16343e}div.quarto-title-banner{background-color:#16343e}div.quarto-title,div.quarto-title .title,div.quarto-title .title{color:#fff}div#listing-listing{margin-top:4em}div#quarto-content{margin:0;padding:0;width:100vw;background-color:#fff}div#quarto-content>*{padding-top:0}div#quarto-content nav#quarto-sidebar{z-index:2}div#quarto-content nav#quarto-sidebar .mt-2.flex-shrink-0.align-items-center{display:none}div#quarto-content nav#quarto-sidebar .sidebar-menu-container{padding-top:1em}div#quarto-content div.quarto-about-jolla{margin-top:0}div#quarto-content div.quarto-about-jolla * a#github-profile-logo{display:none}div#quarto-content div.quarto-about-jolla img.about-image{margin-bottom:-2.5em;object-fit:contain}div#quarto-content div.quarto-about-jolla img.about-image.round{border-radius:0 !important}div#quarto-content div.quarto-about-jolla div.quarto-title .title{color:#7a7a7a}div#quarto-content div.quarto-about-jolla main#quarto-document-content{margin-top:0}div#quarto-content div.quarto-about-jolla main#quarto-document-content p{text-align:justify}div#quarto-content main#quarto-document-content{margin-top:0}div#quarto-content main#quarto-document-content>*{z-index:2}div#quarto-content main#quarto-document-content div.quarto-title .title,div#quarto-content main#quarto-document-content div.quarto-title .title{color:#59666a}div#quarto-content main#quarto-document-content code{color:#00835d}div#quarto-content main#quarto-document-content p{margin:2.5% 7.5% 2.5% 0}div#quarto-content main#quarto-document-content p img{margin:0 3.75%}div#quarto-content main#quarto-document-content .embedded-content{position:relative}div#quarto-content main#quarto-document-content .embedded-content.side-bar{margin:20px 2px;max-width:560px;max-height:calc(100vh - 200px);overflow:scroll;padding:2px;background-color:rgba(255,255,255,.75);border-radius:6px}div#quarto-content main#quarto-document-content .embedded-content p{position:relative;margin:0 !important}div#quarto-content main#quarto-document-content blockquote,div#quarto-content main#quarto-document-content blockquote p{margin:0}div#quarto-content #redoc{position:absolute;margin:0;padding:0;width:100%;background-color:#fff}.content#app{position:absolute;top:92px;left:225px}.content#app>div{width:calc(100vw - 225px);height:calc(100vh - 92px)}.content#app>div .mapboxgl-map{width:100%;height:100%}/*! +@import"https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;700&display=swap";body{background-color:#16343e !important}header#quarto-header{background-color:#16343e}header#quarto-header nav.navbar{text-shadow:-1px -1px 0 rgba(0,0,0,.3)}header#quarto-header nav.navbar[data-bs-theme=dark]{background-color:#16343e}header#quarto-header nav.navbar[data-bs-theme=dark] .navbar-brand{min-width:7em;min-height:3.5em;background-image:url("assets/images/Full-Logo_CORI_Cream.svg");background-size:calc(100% - 1em);background-position:left top;background-repeat:no-repeat;padding-left:.5em}header#quarto-header nav.navbar[data-bs-theme=dark] .navbar-brand .navbar-title{display:none}header#quarto-header nav.navbar[data-bs-theme=dark] .navbar-brand-container{min-width:196px}header#quarto-header nav.navbar[data-bs-theme=dark] .nav-link:hover,header#quarto-header nav.navbar[data-bs-theme=dark] .nav-link.active:hover{color:#fff}header#quarto-header nav.navbar[data-bs-theme=dark] .nav-link .menu-text,header#quarto-header nav.navbar[data-bs-theme=dark] .nav-link i,header#quarto-header nav.navbar[data-bs-theme=dark] .nav-link.active .menu-text,header#quarto-header nav.navbar[data-bs-theme=dark] .nav-link.active i{color:#fbf8e9}header#quarto-header nav.navbar[data-bs-theme=dark] .nav-link .menu-text:hover,header#quarto-header nav.navbar[data-bs-theme=dark] .nav-link i:hover,header#quarto-header nav.navbar[data-bs-theme=dark] .nav-link.active .menu-text:hover,header#quarto-header nav.navbar[data-bs-theme=dark] .nav-link.active i:hover{color:#fff}header#quarto-header * a:visited{color:#fff !important}header#quarto-header * a:hover{color:#7a7a7a !important;text-shadow:none}header#quarto-header * a.nav-link{font-variant:small-caps}header#quarto-header * a .navbar-title{font-weight:bold}header#title-block-header{margin-bottom:0;margin-top:10px;background-color:rgba(0,0,0,0) !important}header .quarto-title-breadcrumbs .breadcrumb{background-color:rgba(163,226,181,.75)}header .quarto-title-breadcrumbs .breadcrumb li.breadcrumb-item::before{color:#59666a}header .quarto-title-breadcrumbs .breadcrumb li a{color:#59666a}header .quarto-title-breadcrumbs .breadcrumb li:last-of-type a{color:#16343e}div.quarto-title-banner{background-color:#16343e}div.quarto-title,div.quarto-title .title,div.quarto-title .title{color:#fff}div#listing-listing{margin-top:4em}div#quarto-content{margin:0;padding:0;width:100vw;background-color:#fff}div#quarto-content>*{padding-top:0}div#quarto-content nav#quarto-sidebar{z-index:2}div#quarto-content nav#quarto-sidebar .mt-2.flex-shrink-0.align-items-center{display:none}div#quarto-content nav#quarto-sidebar .sidebar-menu-container{padding-top:1em}div#quarto-content div.quarto-about-jolla{margin-top:0}div#quarto-content div.quarto-about-jolla * a#github-profile-logo{display:none}div#quarto-content div.quarto-about-jolla img.about-image{margin-bottom:-2.5em;object-fit:contain}div#quarto-content div.quarto-about-jolla img.about-image.round{border-radius:0 !important}div#quarto-content div.quarto-about-jolla div.quarto-title .title{color:#7a7a7a}div#quarto-content div.quarto-about-jolla main#quarto-document-content{margin-top:0}div#quarto-content div.quarto-about-jolla main#quarto-document-content p{text-align:justify}div#quarto-content main#quarto-document-content{margin-top:0}div#quarto-content main#quarto-document-content>*{z-index:2}div#quarto-content main#quarto-document-content div.quarto-title .title,div#quarto-content main#quarto-document-content div.quarto-title .title{color:#59666a}div#quarto-content main#quarto-document-content code{color:#00835d}div#quarto-content main#quarto-document-content p{margin:2.5% 7.5% 2.5% 0}div#quarto-content main#quarto-document-content p img{margin:0 3.75%}div#quarto-content main#quarto-document-content .embedded-content{position:relative}div#quarto-content main#quarto-document-content .embedded-content.side-bar{margin:20px 2px;max-width:560px;max-height:calc(100vh - 200px);overflow:scroll;padding:2px;background-color:rgba(255,255,255,.75);border-radius:6px}div#quarto-content main#quarto-document-content .embedded-content p{position:relative;margin:0 !important}div#quarto-content main#quarto-document-content blockquote,div#quarto-content main#quarto-document-content blockquote p{margin:0}div#quarto-content #redoc{position:absolute;margin:0;padding:0;width:100%;background-color:#fff}.content#app{position:absolute;top:92px;left:225px;max-width:calc(100vw - 225px);overflow-x:hidden}.content#app>div{width:calc(100vw - 225px);height:calc(100vh - 92px)}.content#app>div .mapboxgl-map{width:100%;height:100%}/*! * Bootstrap v5.3.1 (https://getbootstrap.com/) * Copyright 2011-2023 The Bootstrap Authors * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) diff --git a/frontend b/frontend index 3e29afc..14e4f44 160000 --- a/frontend +++ b/frontend @@ -1 +1 @@ -Subproject commit 3e29afc2c746f0d7dce02f6727871ffecf7cabe6 +Subproject commit 14e4f448c0693f90a0daae730306a941087945ff diff --git a/index.qmd b/index.qmd index a1de9f5..9835fe6 100644 --- a/index.qmd +++ b/index.qmd @@ -24,7 +24,7 @@ And here's some more stuff to say about the network. Should we drop a micro dashboard here?
--> =6.9.0" @@ -18253,9 +18254,7 @@ }, "node_modules/@babel/core": { "version": "7.25.2", - "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@ampproject/remapping": "^2.2.0", "@babel/code-frame": "^7.24.7", @@ -18319,7 +18318,6 @@ }, "node_modules/@babel/helper-compilation-targets": { "version": "7.25.2", - "dev": true, "license": "MIT", "dependencies": { "@babel/compat-data": "^7.25.2", @@ -18408,7 +18406,6 @@ }, "node_modules/@babel/helper-module-transforms": { "version": "7.25.2", - "dev": true, "license": "MIT", "dependencies": { "@babel/helper-module-imports": "^7.24.7", @@ -18435,9 +18432,9 @@ } }, "node_modules/@babel/helper-plugin-utils": { - "version": "7.24.8", - "dev": true, - "license": "MIT", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.25.9.tgz", + "integrity": "sha512-kSMlyUVdWe25rEsRGviIgOWnoT/nfABVWlqt9N19/dIPWViAOW2s9wznP5tURbs/IDuNk4gPy3YdYRgH3uxhBw==", "engines": { "node": ">=6.9.0" } @@ -18476,7 +18473,6 @@ }, "node_modules/@babel/helper-simple-access": { "version": "7.24.7", - "dev": true, "license": "MIT", "dependencies": { "@babel/traverse": "^7.24.7", @@ -18514,7 +18510,6 @@ }, "node_modules/@babel/helper-validator-option": { "version": "7.24.8", - "dev": true, "license": "MIT", "engines": { "node": ">=6.9.0" @@ -18535,9 +18530,7 @@ }, "node_modules/@babel/helpers": { "version": "7.25.6", - "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@babel/template": "^7.25.0", "@babel/types": "^7.25.6" @@ -19537,6 +19530,34 @@ "@babel/core": "^7.0.0-0" } }, + "node_modules/@babel/plugin-transform-react-jsx-self": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.25.9.tgz", + "integrity": "sha512-y8quW6p0WHkEhmErnfe58r7x0A70uKphQm8Sp8cV7tjNQwK56sNVK0M73LK3WuYmsuyrftut4xAkjjgU0twaMg==", + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-react-jsx-source": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-source/-/plugin-transform-react-jsx-source-7.25.9.tgz", + "integrity": "sha512-+iqjT8xmXhhYv4/uiYd8FNQsraMFZIfxVSqxxVSZP0WbbSAWvBXAul0m/zu+7Vv4O/3WtApy9pmaTMiumEZgfg==", + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, "node_modules/@babel/plugin-transform-react-pure-annotations": { "version": "7.24.7", "dev": true, @@ -20344,7 +20365,6 @@ "cpu": [ "arm64" ], - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -21885,6 +21905,53 @@ } } }, + "node_modules/@noble/hashes": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.5.0.tgz", + "integrity": "sha512-1j6kQFb7QRru7eKN3ZDvRcP13rugwdxZqCjbiAVZfIJwgj2A65UmT4TgARXGlXgnRkORLTDTrO19ZErt7+QXgA==", + "dev": true, + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/@open-wc/dedupe-mixin": { "version": "1.4.0", "license": "MIT", @@ -23209,9 +23276,7 @@ }, "node_modules/@types/babel__core": { "version": "7.20.5", - "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@babel/parser": "^7.20.7", "@babel/types": "^7.20.7", @@ -23222,18 +23287,14 @@ }, "node_modules/@types/babel__generator": { "version": "7.6.8", - "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@babel/types": "^7.0.0" } }, "node_modules/@types/babel__template": { "version": "7.4.4", - "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@babel/parser": "^7.1.0", "@babel/types": "^7.0.0" @@ -23241,9 +23302,7 @@ }, "node_modules/@types/babel__traverse": { "version": "7.20.6", - "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@babel/types": "^7.20.7" } @@ -23937,6 +23996,24 @@ "node": "^12.20.0 || ^14.13.1 || >=16.0.0" } }, + "node_modules/@vitejs/plugin-react": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-4.3.3.tgz", + "integrity": "sha512-NooDe9GpHGqNns1i8XDERg0Vsg5SSYRhRxxyTGogUdkdNt47jal+fbuYi+Yfq6pzRCKXyoPcWisfxE6RIM3GKA==", + "dependencies": { + "@babel/core": "^7.25.2", + "@babel/plugin-transform-react-jsx-self": "^7.24.7", + "@babel/plugin-transform-react-jsx-source": "^7.24.7", + "@types/babel__core": "^7.20.5", + "react-refresh": "^0.14.2" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "peerDependencies": { + "vite": "^4.2.0 || ^5.0.0" + } + }, "node_modules/@webcomponents/shadycss": { "version": "1.11.2", "license": "BSD-3-Clause", @@ -24533,7 +24610,6 @@ }, "node_modules/browserslist": { "version": "4.23.3", - "dev": true, "funding": [ { "type": "opencollective", @@ -24679,7 +24755,6 @@ }, "node_modules/caniuse-lite": { "version": "1.0.30001657", - "dev": true, "funding": [ { "type": "opencollective", @@ -25070,9 +25145,7 @@ }, "node_modules/convert-source-map": { "version": "2.0.0", - "dev": true, - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/core-assert": { "version": "0.2.1", @@ -25945,7 +26018,6 @@ }, "node_modules/electron-to-chromium": { "version": "1.5.14", - "dev": true, "license": "ISC" }, "node_modules/emittery": { @@ -25993,9 +26065,14 @@ "is-arrayish": "^0.2.1" } }, + "node_modules/es-module-lexer": { + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.5.4.tgz", + "integrity": "sha512-MVNK56NiMrOwitFB7cqDwq0CQutbw+0BvLshJSse0MUNU+y1FC3bUS/AQg7oUng+/wKrrki7JfmwtVHkVfPLlw==", + "dev": true + }, "node_modules/esbuild": { "version": "0.18.20", - "dev": true, "hasInstallScript": true, "license": "MIT", "bin": { @@ -26031,7 +26108,6 @@ }, "node_modules/escalade": { "version": "3.2.0", - "dev": true, "license": "MIT", "engines": { "node": ">=6" @@ -26215,6 +26291,22 @@ "node": ">=0.10.0" } }, + "node_modules/fast-glob": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz", + "integrity": "sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + }, + "engines": { + "node": ">=8.6.0" + } + }, "node_modules/fast-json-stable-stringify": { "version": "2.1.0", "dev": true, @@ -26240,6 +26332,15 @@ "fxparser": "src/cli/cli.js" } }, + "node_modules/fastq": { + "version": "1.17.1", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.17.1.tgz", + "integrity": "sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==", + "dev": true, + "dependencies": { + "reusify": "^1.0.4" + } + }, "node_modules/fb-watchman": { "version": "2.0.2", "dev": true, @@ -26378,7 +26479,6 @@ }, "node_modules/fsevents": { "version": "2.3.3", - "dev": true, "license": "MIT", "optional": true, "os": [ @@ -26403,9 +26503,7 @@ }, "node_modules/gensync": { "version": "1.0.0-beta.2", - "dev": true, "license": "MIT", - "peer": true, "engines": { "node": ">=6.9.0" } @@ -26481,6 +26579,18 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/globals": { "version": "11.12.0", "license": "MIT", @@ -26624,6 +26734,12 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/hmac": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac/-/hmac-1.0.1.tgz", + "integrity": "sha512-7pSzEtIx7WBY04FDVFvdU7gufDrdthJIfQuW3eM6tSNcCWWBW2zSYDgYT74vwys74vuasInzgo5e1Rc4Uoh70Q==", + "dev": true + }, "node_modules/hoist-non-react-statics": { "version": "3.3.2", "license": "BSD-3-Clause", @@ -26967,6 +27083,15 @@ "node": ">=0.10.0" } }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/is-fullwidth-code-point": { "version": "3.0.0", "license": "MIT", @@ -26983,6 +27108,18 @@ "node": ">=6" } }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/is-hexadecimal": { "version": "2.0.1", "license": "MIT", @@ -28911,7 +29048,6 @@ }, "node_modules/json5": { "version": "2.2.3", - "dev": true, "license": "MIT", "bin": { "json5": "lib/cli.js" @@ -29214,7 +29350,6 @@ }, "node_modules/lru-cache": { "version": "5.1.1", - "dev": true, "license": "ISC", "dependencies": { "yallist": "^3.0.2" @@ -29529,6 +29664,15 @@ "license": "MIT", "peer": true }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, "node_modules/micromark": { "version": "4.0.0", "funding": [ @@ -30167,7 +30311,6 @@ }, "node_modules/node-releases": { "version": "2.0.18", - "dev": true, "license": "MIT" }, "node_modules/normalize-package-data": { @@ -30513,7 +30656,6 @@ }, "node_modules/postcss": { "version": "8.4.45", - "dev": true, "funding": [ { "type": "opencollective", @@ -30540,7 +30682,6 @@ }, "node_modules/postcss/node_modules/nanoid": { "version": "3.3.7", - "dev": true, "funding": [ { "type": "github", @@ -30808,6 +30949,26 @@ "dev": true, "license": "MIT" }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/quick-lru": { "version": "4.0.1", "license": "MIT", @@ -30941,6 +31102,14 @@ "react": ">=18" } }, + "node_modules/react-refresh": { + "version": "0.14.2", + "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.14.2.tgz", + "integrity": "sha512-jCvmsr+1IUSMUyzOkRcvnVbX3ZYC6g9TDrDbFuFmRDq7PD4yaGbLKNQL6k2jnArV8hjYxh7hVhAZB6s9HDGpZA==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/react-remove-scroll": { "version": "2.5.4", "license": "MIT", @@ -31424,6 +31593,16 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true, + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, "node_modules/robust-predicates": { "version": "3.0.2", "license": "Unlicense" @@ -31432,7 +31611,6 @@ "version": "3.29.5", "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.29.5.tgz", "integrity": "sha512-GVsDdsbJzzy4S/v3dqWPJ7EfvZJfCHiDqe80IyrF59LYuP+e6U1LJoUqeuqRbwAWoMNoXivMNeNAOf5E22VA1w==", - "dev": true, "bin": { "rollup": "dist/bin/rollup" }, @@ -31474,6 +31652,29 @@ "estree-walker": "^0.6.1" } }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, "node_modules/rw": { "version": "1.3.3", "license": "BSD-3-Clause" @@ -31513,7 +31714,6 @@ }, "node_modules/semver": { "version": "6.3.1", - "dev": true, "license": "ISC", "bin": { "semver": "bin/semver.js" @@ -31641,7 +31841,6 @@ }, "node_modules/source-map-js": { "version": "1.2.0", - "dev": true, "license": "BSD-3-Clause", "engines": { "node": ">=0.10.0" @@ -32389,7 +32588,6 @@ }, "node_modules/update-browserslist-db": { "version": "1.1.0", - "dev": true, "funding": [ { "type": "opencollective", @@ -32548,7 +32746,6 @@ }, "node_modules/vite": { "version": "4.5.5", - "dev": true, "license": "MIT", "dependencies": { "esbuild": "^0.18.10", @@ -32600,6 +32797,47 @@ } } }, + "node_modules/vite-plugin-commonjs": { + "version": "0.10.3", + "resolved": "https://registry.npmjs.org/vite-plugin-commonjs/-/vite-plugin-commonjs-0.10.3.tgz", + "integrity": "sha512-trtH4dfAqrbqwiUhSKcqrfjnlXnqLHdIbYuUy943y34JnDjIX8qlpExP0nFN+kE2s6/BS6r9d1cAHS0KtiF4yQ==", + "dev": true, + "dependencies": { + "acorn": "^8.12.1", + "magic-string": "^0.30.11", + "vite-plugin-dynamic-import": "^1.6.0" + } + }, + "node_modules/vite-plugin-commonjs/node_modules/magic-string": { + "version": "0.30.12", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.12.tgz", + "integrity": "sha512-Ea8I3sQMVXr8JhN4z+H/d8zwo+tYDgHE9+5G4Wnrwhs0gaK9fXTKx0Tw5Xwsd/bCPTTZNRAdpyzvoeORe9LYpw==", + "dev": true, + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.0" + } + }, + "node_modules/vite-plugin-dynamic-import": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/vite-plugin-dynamic-import/-/vite-plugin-dynamic-import-1.6.0.tgz", + "integrity": "sha512-TM0sz70wfzTIo9YCxVFwS8OA9lNREsh+0vMHGSkWDTZ7bgd1Yjs5RV8EgB634l/91IsXJReg0xtmuQqP0mf+rg==", + "dev": true, + "dependencies": { + "acorn": "^8.12.1", + "es-module-lexer": "^1.5.4", + "fast-glob": "^3.3.2", + "magic-string": "^0.30.11" + } + }, + "node_modules/vite-plugin-dynamic-import/node_modules/magic-string": { + "version": "0.30.12", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.12.tgz", + "integrity": "sha512-Ea8I3sQMVXr8JhN4z+H/d8zwo+tYDgHE9+5G4Wnrwhs0gaK9fXTKx0Tw5Xwsd/bCPTTZNRAdpyzvoeORe9LYpw==", + "dev": true, + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.0" + } + }, "node_modules/vt-pbf": { "version": "3.1.3", "license": "MIT", @@ -32845,7 +33083,6 @@ }, "node_modules/yallist": { "version": "3.1.1", - "dev": true, "license": "ISC" }, "node_modules/yaml": { diff --git a/src/custom.scss b/src/custom.scss index d2303cc..a6e4d1b 100644 --- a/src/custom.scss +++ b/src/custom.scss @@ -139,6 +139,8 @@ div#quarto-content { margin: 0; padding: 0; width: 100vw; + //max-height: calc(-91px + 100vh); + //overflow: hidden; background-color: #FFF; & > * { @@ -262,6 +264,10 @@ div#quarto-content { position: absolute; top: 92px; left: 225px; + max-width: calc(100vw - 225px); + overflow-x: hidden; + //max-height: calc(100vw - 92px); + //overflow: hidden; &>div { width: calc(100vw - 225px);