@geoimpact/sep-map-sdk 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +82 -0
- package/dist/index.d.ts +2485 -0
- package/dist/sep-map-sdk.css +1 -0
- package/dist/sep-map.esm.js +50 -0
- package/dist/sep-map.esm.js.map +1 -0
- package/dist/sep-map.js +2 -0
- package/dist/sep-map.js.map +1 -0
- package/dist/sep-map.umd.js +2 -0
- package/dist/sep-map.umd.js.map +1 -0
- package/package.json +65 -0
package/dist/sep-map.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var SEPMapLib=function(e){"use strict";var t=Object.defineProperty,i=(e,i,n)=>((e,i,n)=>i in e?t(e,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[i]=n)(e,"symbol"!=typeof i?i+"":i,n);function n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var r,o,a={exports:{}},s={},l={exports:{}},c={};function u(){return o||(o=1,l.exports=(r||(r=1,function(e){function t(e,t){var i=e.length;e.push(t);e:for(;0<i;){var n=i-1>>>1,o=e[n];if(!(0<r(o,t)))break e;e[n]=t,e[i]=o,i=n}}function i(e){return 0===e.length?null:e[0]}function n(e){if(0===e.length)return null;var t=e[0],i=e.pop();if(i!==t){e[0]=i;e:for(var n=0,o=e.length,a=o>>>1;n<a;){var s=2*(n+1)-1,l=e[s],c=s+1,u=e[c];if(0>r(l,i))c<o&&0>r(u,l)?(e[n]=u,e[c]=i,n=c):(e[n]=l,e[s]=i,n=s);else{if(!(c<o&&0>r(u,i)))break e;e[n]=u,e[c]=i,n=c}}}return t}function r(e,t){var i=e.sortIndex-t.sortIndex;return 0!==i?i:e.id-t.id}if(e.unstable_now=void 0,"object"==typeof performance&&"function"==typeof performance.now){var o=performance;e.unstable_now=function(){return o.now()}}else{var a=Date,s=a.now();e.unstable_now=function(){return a.now()-s}}var l=[],c=[],u=1,h=null,d=3,p=!1,f=!1,m=!1,g=!1,_="function"==typeof setTimeout?setTimeout:null,y="function"==typeof clearTimeout?clearTimeout:null,v="undefined"!=typeof setImmediate?setImmediate:null;function x(e){for(var r=i(c);null!==r;){if(null===r.callback)n(c);else{if(!(r.startTime<=e))break;n(c),r.sortIndex=r.expirationTime,t(l,r)}r=i(c)}}function b(e){if(m=!1,x(e),!f)if(null!==i(l))f=!0,T||(T=!0,w());else{var t=i(c);null!==t&&z(b,t.startTime-e)}}var w,T=!1,S=-1,P=5,M=-1;function E(){return!(!g&&e.unstable_now()-M<P)}function C(){if(g=!1,T){var t=e.unstable_now();M=t;var r=!0;try{e:{f=!1,m&&(m=!1,y(S),S=-1),p=!0;var o=d;try{t:{for(x(t),h=i(l);null!==h&&!(h.expirationTime>t&&E());){var a=h.callback;if("function"==typeof a){h.callback=null,d=h.priorityLevel;var s=a(h.expirationTime<=t);if(t=e.unstable_now(),"function"==typeof s){h.callback=s,x(t),r=!0;break t}h===i(l)&&n(l),x(t)}else n(l);h=i(l)}if(null!==h)r=!0;else{var u=i(c);null!==u&&z(b,u.startTime-t),r=!1}}break e}finally{h=null,d=o,p=!1}r=void 0}}finally{r?w():T=!1}}}if("function"==typeof v)w=function(){v(C)};else if("undefined"!=typeof MessageChannel){var k=new MessageChannel,I=k.port2;k.port1.onmessage=C,w=function(){I.postMessage(null)}}else w=function(){_(C,0)};function z(t,i){S=_(function(){t(e.unstable_now())},i)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e||(P=0<e?Math.floor(1e3/e):5)},e.unstable_getCurrentPriorityLevel=function(){return d},e.unstable_next=function(e){switch(d){case 1:case 2:case 3:var t=3;break;default:t=d}var i=d;d=t;try{return e()}finally{d=i}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var i=d;d=e;try{return t()}finally{d=i}},e.unstable_scheduleCallback=function(n,r,o){var a=e.unstable_now();switch(o="object"==typeof o&&null!==o&&"number"==typeof(o=o.delay)&&0<o?a+o:a,n){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return n={id:u++,callback:r,priorityLevel:n,startTime:o,expirationTime:s=o+s,sortIndex:-1},o>a?(n.sortIndex=o,t(c,n),null===i(l)&&n===i(c)&&(m?(y(S),S=-1):m=!0,z(b,o-a))):(n.sortIndex=s,t(l,n),f||p||(f=!0,T||(T=!0,w()))),n},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=d;return function(){var i=d;d=t;try{return e.apply(this,arguments)}finally{d=i}}}}(c)),c)),l.exports}var h,d,p={exports:{}},f={};function m(){if(h)return f;h=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),a=Symbol.for("react.context"),s=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),c=Symbol.for("react.memo"),u=Symbol.for("react.lazy"),d=Symbol.for("react.activity"),p=Symbol.iterator;var m={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function y(e,t,i){this.props=e,this.context=t,this.refs=_,this.updater=i||m}function v(){}function x(e,t,i){this.props=e,this.context=t,this.refs=_,this.updater=i||m}y.prototype.isReactComponent={},y.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},y.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},v.prototype=y.prototype;var b=x.prototype=new v;b.constructor=x,g(b,y.prototype),b.isPureReactComponent=!0;var w=Array.isArray;function T(){}var S={H:null,A:null,T:null,S:null},P=Object.prototype.hasOwnProperty;function M(t,i,n){var r=n.ref;return{$$typeof:e,type:t,key:i,ref:void 0!==r?r:null,props:n}}function E(t){return"object"==typeof t&&null!==t&&t.$$typeof===e}var C=/\/+/g;function k(e,t){return"object"==typeof e&&null!==e&&null!=e.key?(i=""+e.key,n={"=":"=0",":":"=2"},"$"+i.replace(/[=:]/g,function(e){return n[e]})):t.toString(36);var i,n}function I(i,n,r,o,a){var s=typeof i;"undefined"!==s&&"boolean"!==s||(i=null);var l,c,h=!1;if(null===i)h=!0;else switch(s){case"bigint":case"string":case"number":h=!0;break;case"object":switch(i.$$typeof){case e:case t:h=!0;break;case u:return I((h=i._init)(i._payload),n,r,o,a)}}if(h)return a=a(i),h=""===o?"."+k(i,0):o,w(a)?(r="",null!=h&&(r=h.replace(C,"$&/")+"/"),I(a,n,r,"",function(e){return e})):null!=a&&(E(a)&&(l=a,c=r+(null==a.key||i&&i.key===a.key?"":(""+a.key).replace(C,"$&/")+"/")+h,a=M(l.type,c,l.props)),n.push(a)),1;h=0;var d,f=""===o?".":o+":";if(w(i))for(var m=0;m<i.length;m++)h+=I(o=i[m],n,r,s=f+k(o,m),a);else if("function"==typeof(m=null===(d=i)||"object"!=typeof d?null:"function"==typeof(d=p&&d[p]||d["@@iterator"])?d:null))for(i=m.call(i),m=0;!(o=i.next()).done;)h+=I(o=o.value,n,r,s=f+k(o,m++),a);else if("object"===s){if("function"==typeof i.then)return I(function(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch("string"==typeof e.status?e.then(T,T):(e.status="pending",e.then(function(t){"pending"===e.status&&(e.status="fulfilled",e.value=t)},function(t){"pending"===e.status&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}(i),n,r,o,a);throw n=String(i),Error("Objects are not valid as a React child (found: "+("[object Object]"===n?"object with keys {"+Object.keys(i).join(", ")+"}":n)+"). If you meant to render a collection of children, use an array instead.")}return h}function z(e,t,i){if(null==e)return e;var n=[],r=0;return I(e,n,"","",function(e){return t.call(i,e,r++)}),n}function A(e){if(-1===e._status){var t=e._result;(t=t()).then(function(t){0!==e._status&&-1!==e._status||(e._status=1,e._result=t)},function(t){0!==e._status&&-1!==e._status||(e._status=2,e._result=t)}),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var L="function"==typeof reportError?reportError:function(e){if("object"==typeof window&&"function"==typeof window.ErrorEvent){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:"object"==typeof e&&null!==e&&"string"==typeof e.message?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if("object"==typeof process&&"function"==typeof process.emit)return void process.emit("uncaughtException",e)},D={map:z,forEach:function(e,t,i){z(e,function(){t.apply(this,arguments)},i)},count:function(e){var t=0;return z(e,function(){t++}),t},toArray:function(e){return z(e,function(e){return e})||[]},only:function(e){if(!E(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};return f.Activity=d,f.Children=D,f.Component=y,f.Fragment=i,f.Profiler=r,f.PureComponent=x,f.StrictMode=n,f.Suspense=l,f.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=S,f.__COMPILER_RUNTIME={__proto__:null,c:function(e){return S.H.useMemoCache(e)}},f.cache=function(e){return function(){return e.apply(null,arguments)}},f.cacheSignal=function(){return null},f.cloneElement=function(e,t,i){if(null==e)throw Error("The argument must be a React element, but you passed "+e+".");var n=g({},e.props),r=e.key;if(null!=t)for(o in void 0!==t.key&&(r=""+t.key),t)!P.call(t,o)||"key"===o||"__self"===o||"__source"===o||"ref"===o&&void 0===t.ref||(n[o]=t[o]);var o=arguments.length-2;if(1===o)n.children=i;else if(1<o){for(var a=Array(o),s=0;s<o;s++)a[s]=arguments[s+2];n.children=a}return M(e.type,r,n)},f.createContext=function(e){return(e={$$typeof:a,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null}).Provider=e,e.Consumer={$$typeof:o,_context:e},e},f.createElement=function(e,t,i){var n,r={},o=null;if(null!=t)for(n in void 0!==t.key&&(o=""+t.key),t)P.call(t,n)&&"key"!==n&&"__self"!==n&&"__source"!==n&&(r[n]=t[n]);var a=arguments.length-2;if(1===a)r.children=i;else if(1<a){for(var s=Array(a),l=0;l<a;l++)s[l]=arguments[l+2];r.children=s}if(e&&e.defaultProps)for(n in a=e.defaultProps)void 0===r[n]&&(r[n]=a[n]);return M(e,o,r)},f.createRef=function(){return{current:null}},f.forwardRef=function(e){return{$$typeof:s,render:e}},f.isValidElement=E,f.lazy=function(e){return{$$typeof:u,_payload:{_status:-1,_result:e},_init:A}},f.memo=function(e,t){return{$$typeof:c,type:e,compare:void 0===t?null:t}},f.startTransition=function(e){var t=S.T,i={};S.T=i;try{var n=e(),r=S.S;null!==r&&r(i,n),"object"==typeof n&&null!==n&&"function"==typeof n.then&&n.then(T,L)}catch(o){L(o)}finally{null!==t&&null!==i.types&&(t.types=i.types),S.T=t}},f.unstable_useCacheRefresh=function(){return S.H.useCacheRefresh()},f.use=function(e){return S.H.use(e)},f.useActionState=function(e,t,i){return S.H.useActionState(e,t,i)},f.useCallback=function(e,t){return S.H.useCallback(e,t)},f.useContext=function(e){return S.H.useContext(e)},f.useDebugValue=function(){},f.useDeferredValue=function(e,t){return S.H.useDeferredValue(e,t)},f.useEffect=function(e,t){return S.H.useEffect(e,t)},f.useEffectEvent=function(e){return S.H.useEffectEvent(e)},f.useId=function(){return S.H.useId()},f.useImperativeHandle=function(e,t,i){return S.H.useImperativeHandle(e,t,i)},f.useInsertionEffect=function(e,t){return S.H.useInsertionEffect(e,t)},f.useLayoutEffect=function(e,t){return S.H.useLayoutEffect(e,t)},f.useMemo=function(e,t){return S.H.useMemo(e,t)},f.useOptimistic=function(e,t){return S.H.useOptimistic(e,t)},f.useReducer=function(e,t,i){return S.H.useReducer(e,t,i)},f.useRef=function(e){return S.H.useRef(e)},f.useState=function(e){return S.H.useState(e)},f.useSyncExternalStore=function(e,t,i){return S.H.useSyncExternalStore(e,t,i)},f.useTransition=function(){return S.H.useTransition()},f.version="19.2.3",f}function g(){return d||(d=1,p.exports=m()),p.exports}var _,y,v,x,b={exports:{}},w={};function T(){if(_)return w;_=1;var e=g();function t(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var i=2;i<arguments.length;i++)t+="&args[]="+encodeURIComponent(arguments[i])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(){}var n={d:{f:i,r:function(){throw Error(t(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},r=Symbol.for("react.portal");var o=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function a(e,t){return"font"===e?"":"string"==typeof t?"use-credentials"===t?t:"":void 0}return w.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=n,w.createPortal=function(e,i){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;if(!i||1!==i.nodeType&&9!==i.nodeType&&11!==i.nodeType)throw Error(t(299));return function(e,t,i){var n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:r,key:null==n?null:""+n,children:e,containerInfo:t,implementation:i}}(e,i,null,n)},w.flushSync=function(e){var t=o.T,i=n.p;try{if(o.T=null,n.p=2,e)return e()}finally{o.T=t,n.p=i,n.d.f()}},w.preconnect=function(e,t){"string"==typeof e&&(t?t="string"==typeof(t=t.crossOrigin)?"use-credentials"===t?t:"":void 0:t=null,n.d.C(e,t))},w.prefetchDNS=function(e){"string"==typeof e&&n.d.D(e)},w.preinit=function(e,t){if("string"==typeof e&&t&&"string"==typeof t.as){var i=t.as,r=a(i,t.crossOrigin),o="string"==typeof t.integrity?t.integrity:void 0,s="string"==typeof t.fetchPriority?t.fetchPriority:void 0;"style"===i?n.d.S(e,"string"==typeof t.precedence?t.precedence:void 0,{crossOrigin:r,integrity:o,fetchPriority:s}):"script"===i&&n.d.X(e,{crossOrigin:r,integrity:o,fetchPriority:s,nonce:"string"==typeof t.nonce?t.nonce:void 0})}},w.preinitModule=function(e,t){if("string"==typeof e)if("object"==typeof t&&null!==t){if(null==t.as||"script"===t.as){var i=a(t.as,t.crossOrigin);n.d.M(e,{crossOrigin:i,integrity:"string"==typeof t.integrity?t.integrity:void 0,nonce:"string"==typeof t.nonce?t.nonce:void 0})}}else null==t&&n.d.M(e)},w.preload=function(e,t){if("string"==typeof e&&"object"==typeof t&&null!==t&&"string"==typeof t.as){var i=t.as,r=a(i,t.crossOrigin);n.d.L(e,i,{crossOrigin:r,integrity:"string"==typeof t.integrity?t.integrity:void 0,nonce:"string"==typeof t.nonce?t.nonce:void 0,type:"string"==typeof t.type?t.type:void 0,fetchPriority:"string"==typeof t.fetchPriority?t.fetchPriority:void 0,referrerPolicy:"string"==typeof t.referrerPolicy?t.referrerPolicy:void 0,imageSrcSet:"string"==typeof t.imageSrcSet?t.imageSrcSet:void 0,imageSizes:"string"==typeof t.imageSizes?t.imageSizes:void 0,media:"string"==typeof t.media?t.media:void 0})}},w.preloadModule=function(e,t){if("string"==typeof e)if(t){var i=a(t.as,t.crossOrigin);n.d.m(e,{as:"string"==typeof t.as&&"script"!==t.as?t.as:void 0,crossOrigin:i,integrity:"string"==typeof t.integrity?t.integrity:void 0})}else n.d.m(e)},w.requestFormReset=function(e){n.d.r(e)},w.unstable_batchedUpdates=function(e,t){return e(t)},w.useFormState=function(e,t,i){return o.H.useFormState(e,t,i)},w.useFormStatus=function(){return o.H.useHostTransitionStatus()},w.version="19.2.3",w}function S(){if(v)return s;v=1;var e=u(),t=g(),i=(y||(y=1,function e(){if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){}}(),b.exports=T()),b.exports);function n(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var i=2;i<arguments.length;i++)t+="&args[]="+encodeURIComponent(arguments[i])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType)}function o(e){var t=e,i=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do{!!(4098&(t=e).flags)&&(i=t.return),e=t.return}while(e)}return 3===t.tag?i:null}function a(e){if(13===e.tag){var t=e.memoizedState;if(null===t&&(null!==(e=e.alternate)&&(t=e.memoizedState)),null!==t)return t.dehydrated}return null}function l(e){if(31===e.tag){var t=e.memoizedState;if(null===t&&(null!==(e=e.alternate)&&(t=e.memoizedState)),null!==t)return t.dehydrated}return null}function c(e){if(o(e)!==e)throw Error(n(188))}function h(e){var t=e.tag;if(5===t||26===t||27===t||6===t)return e;for(e=e.child;null!==e;){if(null!==(t=h(e)))return t;e=e.sibling}return null}var d=Object.assign,p=Symbol.for("react.element"),f=Symbol.for("react.transitional.element"),m=Symbol.for("react.portal"),_=Symbol.for("react.fragment"),x=Symbol.for("react.strict_mode"),w=Symbol.for("react.profiler"),S=Symbol.for("react.consumer"),P=Symbol.for("react.context"),M=Symbol.for("react.forward_ref"),E=Symbol.for("react.suspense"),C=Symbol.for("react.suspense_list"),k=Symbol.for("react.memo"),I=Symbol.for("react.lazy"),z=Symbol.for("react.activity"),A=Symbol.for("react.memo_cache_sentinel"),L=Symbol.iterator;function D(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=L&&e[L]||e["@@iterator"])?e:null}var R=Symbol.for("react.client.reference");function F(e){if(null==e)return null;if("function"==typeof e)return e.$$typeof===R?null:e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case _:return"Fragment";case w:return"Profiler";case x:return"StrictMode";case E:return"Suspense";case C:return"SuspenseList";case z:return"Activity"}if("object"==typeof e)switch(e.$$typeof){case m:return"Portal";case P:return e.displayName||"Context";case S:return(e._context.displayName||"Context")+".Consumer";case M:var t=e.render;return(e=e.displayName)||(e=""!==(e=t.displayName||t.name||"")?"ForwardRef("+e+")":"ForwardRef"),e;case k:return null!==(t=e.displayName||null)?t:F(e.type)||"Memo";case I:t=e._payload,e=e._init;try{return F(e(t))}catch(i){}}return null}var B=Array.isArray,O=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,N=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,j={pending:!1,data:null,method:null,action:null},V=[],U=-1;function Z(e){return{current:e}}function G(e){0>U||(e.current=V[U],V[U]=null,U--)}function q(e,t){U++,V[U]=e.current,e.current=t}var $,W,H=Z(null),X=Z(null),Y=Z(null),K=Z(null);function Q(e,t){switch(q(Y,t),q(X,e),q(H,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?bh(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)e=wh(t=bh(t),e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}G(H),q(H,e)}function J(){G(H),G(X),G(Y)}function ee(e){null!==e.memoizedState&&q(K,e);var t=H.current,i=wh(t,e.type);t!==i&&(q(X,e),q(H,i))}function te(e){X.current===e&&(G(H),G(X)),K.current===e&&(G(K),fd._currentValue=j)}function ie(e){if(void 0===$)try{throw Error()}catch(i){var t=i.stack.trim().match(/\n( *(at )?)/);$=t&&t[1]||"",W=-1<i.stack.indexOf("\n at")?" (<anonymous>)":-1<i.stack.indexOf("@")?"@unknown:0:0":""}return"\n"+$+e+W}var ne=!1;function re(e,t){if(!e||ne)return"";ne=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var n={DetermineComponentFrameRoot:function(){try{if(t){var i=function(){throw Error()};if(Object.defineProperty(i.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(i,[])}catch(r){var n=r}Reflect.construct(e,[],i)}else{try{i.call()}catch(o){n=o}e.call(i.prototype)}}else{try{throw Error()}catch(a){n=a}(i=e())&&"function"==typeof i.catch&&i.catch(function(){})}}catch(s){if(s&&n&&"string"==typeof s.stack)return[s.stack,n.stack]}return[null,null]}};n.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var r=Object.getOwnPropertyDescriptor(n.DetermineComponentFrameRoot,"name");r&&r.configurable&&Object.defineProperty(n.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var o=n.DetermineComponentFrameRoot(),a=o[0],s=o[1];if(a&&s){var l=a.split("\n"),c=s.split("\n");for(r=n=0;n<l.length&&!l[n].includes("DetermineComponentFrameRoot");)n++;for(;r<c.length&&!c[r].includes("DetermineComponentFrameRoot");)r++;if(n===l.length||r===c.length)for(n=l.length-1,r=c.length-1;1<=n&&0<=r&&l[n]!==c[r];)r--;for(;1<=n&&0<=r;n--,r--)if(l[n]!==c[r]){if(1!==n||1!==r)do{if(n--,0>--r||l[n]!==c[r]){var u="\n"+l[n].replace(" at new "," at ");return e.displayName&&u.includes("<anonymous>")&&(u=u.replace("<anonymous>",e.displayName)),u}}while(1<=n&&0<=r);break}}}finally{ne=!1,Error.prepareStackTrace=i}return(i=e?e.displayName||e.name:"")?ie(i):""}function oe(e,t){switch(e.tag){case 26:case 27:case 5:return ie(e.type);case 16:return ie("Lazy");case 13:return e.child!==t&&null!==t?ie("Suspense Fallback"):ie("Suspense");case 19:return ie("SuspenseList");case 0:case 15:return re(e.type,!1);case 11:return re(e.type.render,!1);case 1:return re(e.type,!0);case 31:return ie("Activity");default:return""}}function ae(e){try{var t="",i=null;do{t+=oe(e,i),i=e,e=e.return}while(e);return t}catch(n){return"\nError generating stack: "+n.message+"\n"+n.stack}}var se=Object.prototype.hasOwnProperty,le=e.unstable_scheduleCallback,ce=e.unstable_cancelCallback,ue=e.unstable_shouldYield,he=e.unstable_requestPaint,de=e.unstable_now,pe=e.unstable_getCurrentPriorityLevel,fe=e.unstable_ImmediatePriority,me=e.unstable_UserBlockingPriority,ge=e.unstable_NormalPriority,_e=e.unstable_LowPriority,ye=e.unstable_IdlePriority,ve=e.log,xe=e.unstable_setDisableYieldValue,be=null,we=null;function Te(e){if("function"==typeof ve&&xe(e),we&&"function"==typeof we.setStrictMode)try{we.setStrictMode(be,e)}catch(t){}}var Se=Math.clz32?Math.clz32:function(e){return 0===(e>>>=0)?32:31-(Pe(e)/Me|0)|0},Pe=Math.log,Me=Math.LN2;var Ee=256,Ce=262144,ke=4194304;function Ie(e){var t=42&e;if(0!==t)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return 261888&e;case 262144:case 524288:case 1048576:case 2097152:return 3932160&e;case 4194304:case 8388608:case 16777216:case 33554432:return 62914560&e;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function ze(e,t,i){var n=e.pendingLanes;if(0===n)return 0;var r=0,o=e.suspendedLanes,a=e.pingedLanes;e=e.warmLanes;var s=134217727&n;return 0!==s?0!==(n=s&~o)?r=Ie(n):0!==(a&=s)?r=Ie(a):i||0!==(i=s&~e)&&(r=Ie(i)):0!==(s=n&~o)?r=Ie(s):0!==a?r=Ie(a):i||0!==(i=n&~e)&&(r=Ie(i)),0===r?0:0!==t&&t!==r&&0===(t&o)&&((o=r&-r)>=(i=t&-t)||32===o&&4194048&i)?t:r}function Ae(e,t){return 0===(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)}function Le(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32: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+5e3;default:return-1}}function De(){var e=ke;return!(62914560&(ke<<=1))&&(ke=4194304),e}function Re(e){for(var t=[],i=0;31>i;i++)t.push(e);return t}function Fe(e,t){e.pendingLanes|=t,268435456!==t&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Be(e,t,i){e.pendingLanes|=t,e.suspendedLanes&=~t;var n=31-Se(t);e.entangledLanes|=t,e.entanglements[n]=1073741824|e.entanglements[n]|261930&i}function Oe(e,t){var i=e.entangledLanes|=t;for(e=e.entanglements;i;){var n=31-Se(i),r=1<<n;r&t|e[n]&t&&(e[n]|=t),i&=~r}}function Ne(e,t){var i=t&-t;return 0!==((i=42&i?1:je(i))&(e.suspendedLanes|t))?0:i}function je(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;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:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Ve(e){return 2<(e&=-e)?8<e?134217727&e?32:268435456:8:2}function Ue(){var e=N.p;return 0!==e?e:void 0===(e=window.event)?32:Id(e.type)}function Ze(e,t){var i=N.p;try{return N.p=e,t()}finally{N.p=i}}var Ge=Math.random().toString(36).slice(2),qe="__reactFiber$"+Ge,$e="__reactProps$"+Ge,We="__reactContainer$"+Ge,He="__reactEvents$"+Ge,Xe="__reactListeners$"+Ge,Ye="__reactHandles$"+Ge,Ke="__reactResources$"+Ge,Qe="__reactMarker$"+Ge;function Je(e){delete e[qe],delete e[$e],delete e[He],delete e[Xe],delete e[Ye]}function et(e){var t=e[qe];if(t)return t;for(var i=e.parentNode;i;){if(t=i[We]||i[qe]){if(i=t.alternate,null!==t.child||null!==i&&null!==i.child)for(e=jh(e);null!==e;){if(i=e[qe])return i;e=jh(e)}return t}i=(e=i).parentNode}return null}function tt(e){if(e=e[qe]||e[We]){var t=e.tag;if(5===t||6===t||13===t||31===t||26===t||27===t||3===t)return e}return null}function it(e){var t=e.tag;if(5===t||26===t||27===t||6===t)return e.stateNode;throw Error(n(33))}function nt(e){var t=e[Ke];return t||(t=e[Ke]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function rt(e){e[Qe]=!0}var ot=new Set,at={};function st(e,t){lt(e,t),lt(e+"Capture",t)}function lt(e,t){for(at[e]=t,e=0;e<t.length;e++)ot.add(t[e])}var ct=RegExp("^[: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]*$"),ut={},ht={};function dt(e,t,i){if(r=t,se.call(ht,r)||!se.call(ut,r)&&(ct.test(r)?ht[r]=!0:(ut[r]=!0,0)))if(null===i)e.removeAttribute(t);else{switch(typeof i){case"undefined":case"function":case"symbol":return void e.removeAttribute(t);case"boolean":var n=t.toLowerCase().slice(0,5);if("data-"!==n&&"aria-"!==n)return void e.removeAttribute(t)}e.setAttribute(t,""+i)}var r}function pt(e,t,i){if(null===i)e.removeAttribute(t);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":return void e.removeAttribute(t)}e.setAttribute(t,""+i)}}function ft(e,t,i,n){if(null===n)e.removeAttribute(i);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":return void e.removeAttribute(i)}e.setAttributeNS(t,i,""+n)}}function mt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":case"object":return e;default:return""}}function gt(e){var t=e.type;return(e=e.nodeName)&&"input"===e.toLowerCase()&&("checkbox"===t||"radio"===t)}function _t(e){if(!e._valueTracker){var t=gt(e)?"checked":"value";e._valueTracker=function(e,t,i){var n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&void 0!==n&&"function"==typeof n.get&&"function"==typeof n.set){var r=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return r.call(this)},set:function(e){i=""+e,o.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return i},setValue:function(e){i=""+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}(e,t,""+e[t])}}function yt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var i=t.getValue(),n="";return e&&(n=gt(e)?e.checked?"true":"false":e.value),(e=n)!==i&&(t.setValue(e),!0)}function vt(e){if(void 0===(e=e||("undefined"!=typeof document?document:void 0)))return null;try{return e.activeElement||e.body}catch(t){return e.body}}var xt=/[\n"\\]/g;function bt(e){return e.replace(xt,function(e){return"\\"+e.charCodeAt(0).toString(16)+" "})}function wt(e,t,i,n,r,o,a,s){e.name="",null!=a&&"function"!=typeof a&&"symbol"!=typeof a&&"boolean"!=typeof a?e.type=a:e.removeAttribute("type"),null!=t?"number"===a?(0===t&&""===e.value||e.value!=t)&&(e.value=""+mt(t)):e.value!==""+mt(t)&&(e.value=""+mt(t)):"submit"!==a&&"reset"!==a||e.removeAttribute("value"),null!=t?St(e,a,mt(t)):null!=i?St(e,a,mt(i)):null!=n&&e.removeAttribute("value"),null==r&&null!=o&&(e.defaultChecked=!!o),null!=r&&(e.checked=r&&"function"!=typeof r&&"symbol"!=typeof r),null!=s&&"function"!=typeof s&&"symbol"!=typeof s&&"boolean"!=typeof s?e.name=""+mt(s):e.removeAttribute("name")}function Tt(e,t,i,n,r,o,a,s){if(null!=o&&"function"!=typeof o&&"symbol"!=typeof o&&"boolean"!=typeof o&&(e.type=o),null!=t||null!=i){if(("submit"===o||"reset"===o)&&null==t)return void _t(e);i=null!=i?""+mt(i):"",t=null!=t?""+mt(t):i,s||t===e.value||(e.value=t),e.defaultValue=t}n="function"!=typeof(n=null!=n?n:r)&&"symbol"!=typeof n&&!!n,e.checked=s?e.checked:!!n,e.defaultChecked=!!n,null!=a&&"function"!=typeof a&&"symbol"!=typeof a&&"boolean"!=typeof a&&(e.name=a),_t(e)}function St(e,t,i){"number"===t&&vt(e.ownerDocument)===e||e.defaultValue===""+i||(e.defaultValue=""+i)}function Pt(e,t,i,n){if(e=e.options,t){t={};for(var r=0;r<i.length;r++)t["$"+i[r]]=!0;for(i=0;i<e.length;i++)r=t.hasOwnProperty("$"+e[i].value),e[i].selected!==r&&(e[i].selected=r),r&&n&&(e[i].defaultSelected=!0)}else{for(i=""+mt(i),t=null,r=0;r<e.length;r++){if(e[r].value===i)return e[r].selected=!0,void(n&&(e[r].defaultSelected=!0));null!==t||e[r].disabled||(t=e[r])}null!==t&&(t.selected=!0)}}function Mt(e,t,i){null==t||((t=""+mt(t))!==e.value&&(e.value=t),null!=i)?e.defaultValue=null!=i?""+mt(i):"":e.defaultValue!==t&&(e.defaultValue=t)}function Et(e,t,i,r){if(null==t){if(null!=r){if(null!=i)throw Error(n(92));if(B(r)){if(1<r.length)throw Error(n(93));r=r[0]}i=r}null==i&&(i=""),t=i}i=mt(t),e.defaultValue=i,(r=e.textContent)===i&&""!==r&&null!==r&&(e.value=r),_t(e)}function Ct(e,t){if(t){var i=e.firstChild;if(i&&i===e.lastChild&&3===i.nodeType)return void(i.nodeValue=t)}e.textContent=t}var kt=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function It(e,t,i){var n=0===t.indexOf("--");null==i||"boolean"==typeof i||""===i?n?e.setProperty(t,""):"float"===t?e.cssFloat="":e[t]="":n?e.setProperty(t,i):"number"!=typeof i||0===i||kt.has(t)?"float"===t?e.cssFloat=i:e[t]=(""+i).trim():e[t]=i+"px"}function zt(e,t,i){if(null!=t&&"object"!=typeof t)throw Error(n(62));if(e=e.style,null!=i){for(var r in i)!i.hasOwnProperty(r)||null!=t&&t.hasOwnProperty(r)||(0===r.indexOf("--")?e.setProperty(r,""):"float"===r?e.cssFloat="":e[r]="");for(var o in t)r=t[o],t.hasOwnProperty(o)&&i[o]!==r&&It(e,o,r)}else for(var a in t)t.hasOwnProperty(a)&&It(e,a,t[a])}function At(e){if(-1===e.indexOf("-"))return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Lt=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),Dt=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Rt(e){return Dt.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Ft(){}var Bt=null;function Ot(e){return(e=e.target||e.srcElement||window).correspondingUseElement&&(e=e.correspondingUseElement),3===e.nodeType?e.parentNode:e}var Nt=null,jt=null;function Vt(e){var t=tt(e);if(t&&(e=t.stateNode)){var i=e[$e]||null;e:switch(e=t.stateNode,t.type){case"input":if(wt(e,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name),t=i.name,"radio"===i.type&&null!=t){for(i=e;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll('input[name="'+bt(""+t)+'"][type="radio"]'),t=0;t<i.length;t++){var r=i[t];if(r!==e&&r.form===e.form){var o=r[$e]||null;if(!o)throw Error(n(90));wt(r,o.value,o.defaultValue,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name)}}for(t=0;t<i.length;t++)(r=i[t]).form===e.form&&yt(r)}break e;case"textarea":Mt(e,i.value,i.defaultValue);break e;case"select":null!=(t=i.value)&&Pt(e,!!i.multiple,t,!1)}}}var Ut=!1;function Zt(e,t,i){if(Ut)return e(t,i);Ut=!0;try{return e(t)}finally{if(Ut=!1,(null!==Nt||null!==jt)&&(nu(),Nt&&(t=Nt,e=jt,jt=Nt=null,Vt(t),e)))for(t=0;t<e.length;t++)Vt(e[t])}}function Gt(e,t){var i=e.stateNode;if(null===i)return null;var r=i[$e]||null;if(null===r)return null;i=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(r=!("button"===(e=e.type)||"input"===e||"select"===e||"textarea"===e)),e=!r;break e;default:e=!1}if(e)return null;if(i&&"function"!=typeof i)throw Error(n(231,t,typeof i));return i}var qt=!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement),$t=!1;if(qt)try{var Wt={};Object.defineProperty(Wt,"passive",{get:function(){$t=!0}}),window.addEventListener("test",Wt,Wt),window.removeEventListener("test",Wt,Wt)}catch(tp){$t=!1}var Ht=null,Xt=null,Yt=null;function Kt(){if(Yt)return Yt;var e,t,i=Xt,n=i.length,r="value"in Ht?Ht.value:Ht.textContent,o=r.length;for(e=0;e<n&&i[e]===r[e];e++);var a=n-e;for(t=1;t<=a&&i[n-t]===r[o-t];t++);return Yt=r.slice(e,1<t?1-t:void 0)}function Qt(e){var t=e.keyCode;return"charCode"in e?0===(e=e.charCode)&&13===t&&(e=13):e=t,10===e&&(e=13),32<=e||13===e?e:0}function Jt(){return!0}function ei(){return!1}function ti(e){function t(t,i,n,r,o){for(var a in this._reactName=t,this._targetInst=n,this.type=i,this.nativeEvent=r,this.target=o,this.currentTarget=null,e)e.hasOwnProperty(a)&&(t=e[a],this[a]=t?t(r):r[a]);return this.isDefaultPrevented=(null!=r.defaultPrevented?r.defaultPrevented:!1===r.returnValue)?Jt:ei,this.isPropagationStopped=ei,this}return d(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=Jt)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=Jt)},persist:function(){},isPersistent:Jt}),t}var ii,ni,ri,oi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ai=ti(oi),si=d({},oi,{view:0,detail:0}),li=ti(si),ci=d({},si,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:xi,button:0,buttons:0,relatedTarget:function(e){return void 0===e.relatedTarget?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==ri&&(ri&&"mousemove"===e.type?(ii=e.screenX-ri.screenX,ni=e.screenY-ri.screenY):ni=ii=0,ri=e),ii)},movementY:function(e){return"movementY"in e?e.movementY:ni}}),ui=ti(ci),hi=ti(d({},ci,{dataTransfer:0})),di=ti(d({},si,{relatedTarget:0})),pi=ti(d({},oi,{animationName:0,elapsedTime:0,pseudoElement:0})),fi=ti(d({},oi,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}})),mi=ti(d({},oi,{data:0})),gi={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},_i={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},yi={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function vi(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):!!(e=yi[e])&&!!t[e]}function xi(){return vi}var bi=ti(d({},si,{key:function(e){if(e.key){var t=gi[e.key]||e.key;if("Unidentified"!==t)return t}return"keypress"===e.type?13===(e=Qt(e))?"Enter":String.fromCharCode(e):"keydown"===e.type||"keyup"===e.type?_i[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:xi,charCode:function(e){return"keypress"===e.type?Qt(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?Qt(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}})),wi=ti(d({},ci,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Ti=ti(d({},si,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:xi})),Si=ti(d({},oi,{propertyName:0,elapsedTime:0,pseudoElement:0})),Pi=ti(d({},ci,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),Mi=ti(d({},oi,{newState:0,oldState:0})),Ei=[9,13,27,32],Ci=qt&&"CompositionEvent"in window,ki=null;qt&&"documentMode"in document&&(ki=document.documentMode);var Ii=qt&&"TextEvent"in window&&!ki,zi=qt&&(!Ci||ki&&8<ki&&11>=ki),Ai=String.fromCharCode(32),Li=!1;function Di(e,t){switch(e){case"keyup":return-1!==Ei.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ri(e){return"object"==typeof(e=e.detail)&&"data"in e?e.data:null}var Fi=!1;var Bi={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Oi(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!Bi[e.type]:"textarea"===t}function Ni(e,t,i,n){Nt?jt?jt.push(n):jt=[n]:Nt=n,0<(t=sh(t,"onChange")).length&&(i=new ai("onChange","change",null,i,n),e.push({event:i,listeners:t}))}var ji=null,Vi=null;function Ui(e){Ju(e,0)}function Zi(e){if(yt(it(e)))return e}function Gi(e,t){if("change"===e)return t}var qi=!1;if(qt){var $i;if(qt){var Wi="oninput"in document;if(!Wi){var Hi=document.createElement("div");Hi.setAttribute("oninput","return;"),Wi="function"==typeof Hi.oninput}$i=Wi}else $i=!1;qi=$i&&(!document.documentMode||9<document.documentMode)}function Xi(){ji&&(ji.detachEvent("onpropertychange",Yi),Vi=ji=null)}function Yi(e){if("value"===e.propertyName&&Zi(Vi)){var t=[];Ni(t,Vi,e,Ot(e)),Zt(Ui,t)}}function Ki(e,t,i){"focusin"===e?(Xi(),Vi=i,(ji=t).attachEvent("onpropertychange",Yi)):"focusout"===e&&Xi()}function Qi(e){if("selectionchange"===e||"keyup"===e||"keydown"===e)return Zi(Vi)}function Ji(e,t){if("click"===e)return Zi(t)}function en(e,t){if("input"===e||"change"===e)return Zi(t)}var tn="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t};function nn(e,t){if(tn(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var i=Object.keys(e),n=Object.keys(t);if(i.length!==n.length)return!1;for(n=0;n<i.length;n++){var r=i[n];if(!se.call(t,r)||!tn(e[r],t[r]))return!1}return!0}function rn(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function on(e,t){var i,n=rn(e);for(e=0;n;){if(3===n.nodeType){if(i=e+n.textContent.length,e<=t&&i>=t)return{node:n,offset:t-e};e=i}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=rn(n)}}function an(e,t){return!(!e||!t)&&(e===t||(!e||3!==e.nodeType)&&(t&&3===t.nodeType?an(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}function sn(e){for(var t=vt((e=null!=e&&null!=e.ownerDocument&&null!=e.ownerDocument.defaultView?e.ownerDocument.defaultView:window).document);t instanceof e.HTMLIFrameElement;){try{var i="string"==typeof t.contentWindow.location.href}catch(n){i=!1}if(!i)break;t=vt((e=t.contentWindow).document)}return t}function ln(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===t||"true"===e.contentEditable)}var cn=qt&&"documentMode"in document&&11>=document.documentMode,un=null,hn=null,dn=null,pn=!1;function fn(e,t,i){var n=i.window===i?i.document:9===i.nodeType?i:i.ownerDocument;pn||null==un||un!==vt(n)||("selectionStart"in(n=un)&&ln(n)?n={start:n.selectionStart,end:n.selectionEnd}:n={anchorNode:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset},dn&&nn(dn,n)||(dn=n,0<(n=sh(hn,"onSelect")).length&&(t=new ai("onSelect","select",null,t,i),e.push({event:t,listeners:n}),t.target=un)))}function mn(e,t){var i={};return i[e.toLowerCase()]=t.toLowerCase(),i["Webkit"+e]="webkit"+t,i["Moz"+e]="moz"+t,i}var gn={animationend:mn("Animation","AnimationEnd"),animationiteration:mn("Animation","AnimationIteration"),animationstart:mn("Animation","AnimationStart"),transitionrun:mn("Transition","TransitionRun"),transitionstart:mn("Transition","TransitionStart"),transitioncancel:mn("Transition","TransitionCancel"),transitionend:mn("Transition","TransitionEnd")},_n={},yn={};function vn(e){if(_n[e])return _n[e];if(!gn[e])return e;var t,i=gn[e];for(t in i)if(i.hasOwnProperty(t)&&t in yn)return _n[e]=i[t];return e}qt&&(yn=document.createElement("div").style,"AnimationEvent"in window||(delete gn.animationend.animation,delete gn.animationiteration.animation,delete gn.animationstart.animation),"TransitionEvent"in window||delete gn.transitionend.transition);var xn=vn("animationend"),bn=vn("animationiteration"),wn=vn("animationstart"),Tn=vn("transitionrun"),Sn=vn("transitionstart"),Pn=vn("transitioncancel"),Mn=vn("transitionend"),En=new Map,Cn="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function kn(e,t){En.set(e,t),st(t,[e])}Cn.push("scrollEnd");var In="function"==typeof reportError?reportError:function(e){if("object"==typeof window&&"function"==typeof window.ErrorEvent){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:"object"==typeof e&&null!==e&&"string"==typeof e.message?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if("object"==typeof process&&"function"==typeof process.emit)return void process.emit("uncaughtException",e)},zn=[],An=0,Ln=0;function Dn(){for(var e=An,t=Ln=An=0;t<e;){var i=zn[t];zn[t++]=null;var n=zn[t];zn[t++]=null;var r=zn[t];zn[t++]=null;var o=zn[t];if(zn[t++]=null,null!==n&&null!==r){var a=n.pending;null===a?r.next=r:(r.next=a.next,a.next=r),n.pending=r}0!==o&&On(i,r,o)}}function Rn(e,t,i,n){zn[An++]=e,zn[An++]=t,zn[An++]=i,zn[An++]=n,Ln|=n,e.lanes|=n,null!==(e=e.alternate)&&(e.lanes|=n)}function Fn(e,t,i,n){return Rn(e,t,i,n),Nn(e)}function Bn(e,t){return Rn(e,null,null,t),Nn(e)}function On(e,t,i){e.lanes|=i;var n=e.alternate;null!==n&&(n.lanes|=i);for(var r=!1,o=e.return;null!==o;)o.childLanes|=i,null!==(n=o.alternate)&&(n.childLanes|=i),22===o.tag&&(null===(e=o.stateNode)||1&e._visibility||(r=!0)),e=o,o=o.return;return 3===e.tag?(o=e.stateNode,r&&null!==t&&(r=31-Se(i),null===(n=(e=o.hiddenUpdates)[r])?e[r]=[t]:n.push(t),t.lane=536870912|i),o):null}function Nn(e){if(50<Hc)throw Hc=0,Xc=null,Error(n(185));for(var t=e.return;null!==t;)t=(e=t).return;return 3===e.tag?e.stateNode:null}var jn={};function Vn(e,t,i,n){this.tag=e,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Un(e,t,i,n){return new Vn(e,t,i,n)}function Zn(e){return!(!(e=e.prototype)||!e.isReactComponent)}function Gn(e,t){var i=e.alternate;return null===i?((i=Un(e.tag,t,e.key,e.mode)).elementType=e.elementType,i.type=e.type,i.stateNode=e.stateNode,i.alternate=e,e.alternate=i):(i.pendingProps=t,i.type=e.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=65011712&e.flags,i.childLanes=e.childLanes,i.lanes=e.lanes,i.child=e.child,i.memoizedProps=e.memoizedProps,i.memoizedState=e.memoizedState,i.updateQueue=e.updateQueue,t=e.dependencies,i.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext},i.sibling=e.sibling,i.index=e.index,i.ref=e.ref,i.refCleanup=e.refCleanup,i}function qn(e,t){e.flags&=65011714;var i=e.alternate;return null===i?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=i.childLanes,e.lanes=i.lanes,e.child=i.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=i.memoizedProps,e.memoizedState=i.memoizedState,e.updateQueue=i.updateQueue,e.type=i.type,t=i.dependencies,e.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function $n(e,t,i,r,o,a){var s=0;if(r=e,"function"==typeof e)Zn(e)&&(s=1);else if("string"==typeof e)s=function(e,t,i){if(1===i||null!=t.itemProp)return!1;switch(e){case"meta":case"title":return!0;case"style":if("string"!=typeof t.precedence||"string"!=typeof t.href||""===t.href)break;return!0;case"link":if("string"!=typeof t.rel||"string"!=typeof t.href||""===t.href||t.onLoad||t.onError)break;return"stylesheet"!==t.rel||(e=t.disabled,"string"==typeof t.precedence&&null==e);case"script":if(t.async&&"function"!=typeof t.async&&"symbol"!=typeof t.async&&!t.onLoad&&!t.onError&&t.src&&"string"==typeof t.src)return!0}return!1}(e,i,H.current)?26:"html"===e||"head"===e||"body"===e?27:5;else e:switch(e){case z:return(e=Un(31,i,t,o)).elementType=z,e.lanes=a,e;case _:return Wn(i.children,o,a,t);case x:s=8,o|=24;break;case w:return(e=Un(12,i,t,2|o)).elementType=w,e.lanes=a,e;case E:return(e=Un(13,i,t,o)).elementType=E,e.lanes=a,e;case C:return(e=Un(19,i,t,o)).elementType=C,e.lanes=a,e;default:if("object"==typeof e&&null!==e)switch(e.$$typeof){case P:s=10;break e;case S:s=9;break e;case M:s=11;break e;case k:s=14;break e;case I:s=16,r=null;break e}s=29,i=Error(n(130,null===e?"null":typeof e,"")),r=null}return(t=Un(s,i,t,o)).elementType=e,t.type=r,t.lanes=a,t}function Wn(e,t,i,n){return(e=Un(7,e,n,t)).lanes=i,e}function Hn(e,t,i){return(e=Un(6,e,null,t)).lanes=i,e}function Xn(e){var t=Un(18,null,null,0);return t.stateNode=e,t}function Yn(e,t,i){return(t=Un(4,null!==e.children?e.children:[],e.key,t)).lanes=i,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Kn=new WeakMap;function Qn(e,t){if("object"==typeof e&&null!==e){var i=Kn.get(e);return void 0!==i?i:(t={value:e,source:t,stack:ae(t)},Kn.set(e,t),t)}return{value:e,source:t,stack:ae(t)}}var Jn=[],er=0,tr=null,ir=0,nr=[],rr=0,or=null,ar=1,sr="";function lr(e,t){Jn[er++]=ir,Jn[er++]=tr,tr=e,ir=t}function cr(e,t,i){nr[rr++]=ar,nr[rr++]=sr,nr[rr++]=or,or=e;var n=ar;e=sr;var r=32-Se(n)-1;n&=~(1<<r),i+=1;var o=32-Se(t)+r;if(30<o){var a=r-r%5;o=(n&(1<<a)-1).toString(32),n>>=a,r-=a,ar=1<<32-Se(t)+r|i<<r|n,sr=o+e}else ar=1<<o|i<<r|n,sr=e}function ur(e){null!==e.return&&(lr(e,1),cr(e,1,0))}function hr(e){for(;e===tr;)tr=Jn[--er],Jn[er]=null,ir=Jn[--er],Jn[er]=null;for(;e===or;)or=nr[--rr],nr[rr]=null,sr=nr[--rr],nr[rr]=null,ar=nr[--rr],nr[rr]=null}function dr(e,t){nr[rr++]=ar,nr[rr++]=sr,nr[rr++]=or,ar=t.id,sr=t.overflow,or=e}var pr=null,fr=null,mr=!1,gr=null,_r=!1,yr=Error(n(519));function vr(e){throw Pr(Qn(Error(n(418,1<arguments.length&&void 0!==arguments[1]&&arguments[1]?"text":"HTML","")),e)),yr}function xr(e){var t=e.stateNode,i=e.type,n=e.memoizedProps;switch(t[qe]=e,t[$e]=n,i){case"dialog":eh("cancel",t),eh("close",t);break;case"iframe":case"object":case"embed":eh("load",t);break;case"video":case"audio":for(i=0;i<Ku.length;i++)eh(Ku[i],t);break;case"source":eh("error",t);break;case"img":case"image":case"link":eh("error",t),eh("load",t);break;case"details":eh("toggle",t);break;case"input":eh("invalid",t),Tt(t,n.value,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name,!0);break;case"select":eh("invalid",t);break;case"textarea":eh("invalid",t),Et(t,n.value,n.defaultValue,n.children)}"string"!=typeof(i=n.children)&&"number"!=typeof i&&"bigint"!=typeof i||t.textContent===""+i||!0===n.suppressHydrationWarning||ph(t.textContent,i)?(null!=n.popover&&(eh("beforetoggle",t),eh("toggle",t)),null!=n.onScroll&&eh("scroll",t),null!=n.onScrollEnd&&eh("scrollend",t),null!=n.onClick&&(t.onclick=Ft),t=!0):t=!1,t||vr(e,!0)}function br(e){for(pr=e.return;pr;)switch(pr.tag){case 5:case 31:case 13:return void(_r=!1);case 27:case 3:return void(_r=!0);default:pr=pr.return}}function wr(e){if(e!==pr)return!1;if(!mr)return br(e),mr=!0,!1;var t,i=e.tag;if((t=3!==i&&27!==i)&&((t=5===i)&&(t=!("form"!==(t=e.type)&&"button"!==t)||Th(e.type,e.memoizedProps)),t=!t),t&&fr&&vr(e),br(e),13===i){if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(n(317));fr=Nh(e)}else if(31===i){if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(n(317));fr=Nh(e)}else 27===i?(i=fr,Ih(e.type)?(e=Oh,Oh=null,fr=e):fr=i):fr=pr?Bh(e.stateNode.nextSibling):null;return!0}function Tr(){fr=pr=null,mr=!1}function Sr(){var e=gr;return null!==e&&(null===Dc?Dc=e:Dc.push.apply(Dc,e),gr=null),e}function Pr(e){null===gr?gr=[e]:gr.push(e)}var Mr=Z(null),Er=null,Cr=null;function kr(e,t,i){q(Mr,t._currentValue),t._currentValue=i}function Ir(e){e._currentValue=Mr.current,G(Mr)}function zr(e,t,i){for(;null!==e;){var n=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,null!==n&&(n.childLanes|=t)):null!==n&&(n.childLanes&t)!==t&&(n.childLanes|=t),e===i)break;e=e.return}}function Ar(e,t,i,r){var o=e.child;for(null!==o&&(o.return=e);null!==o;){var a=o.dependencies;if(null!==a){var s=o.child;a=a.firstContext;e:for(;null!==a;){var l=a;a=o;for(var c=0;c<t.length;c++)if(l.context===t[c]){a.lanes|=i,null!==(l=a.alternate)&&(l.lanes|=i),zr(a.return,i,e),r||(s=null);break e}a=l.next}}else if(18===o.tag){if(null===(s=o.return))throw Error(n(341));s.lanes|=i,null!==(a=s.alternate)&&(a.lanes|=i),zr(s,i,e),s=null}else s=o.child;if(null!==s)s.return=o;else for(s=o;null!==s;){if(s===e){s=null;break}if(null!==(o=s.sibling)){o.return=s.return,s=o;break}s=s.return}o=s}}function Lr(e,t,i,r){e=null;for(var o=t,a=!1;null!==o;){if(!a)if(524288&o.flags)a=!0;else if(262144&o.flags)break;if(10===o.tag){var s=o.alternate;if(null===s)throw Error(n(387));if(null!==(s=s.memoizedProps)){var l=o.type;tn(o.pendingProps.value,s.value)||(null!==e?e.push(l):e=[l])}}else if(o===K.current){if(null===(s=o.alternate))throw Error(n(387));s.memoizedState.memoizedState!==o.memoizedState.memoizedState&&(null!==e?e.push(fd):e=[fd])}o=o.return}null!==e&&Ar(t,e,i,r),t.flags|=262144}function Dr(e){for(e=e.firstContext;null!==e;){if(!tn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Rr(e){Er=e,Cr=null,null!==(e=e.dependencies)&&(e.firstContext=null)}function Fr(e){return Or(Er,e)}function Br(e,t){return null===Er&&Rr(e),Or(e,t)}function Or(e,t){var i=t._currentValue;if(t={context:t,memoizedValue:i,next:null},null===Cr){if(null===e)throw Error(n(308));Cr=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Cr=Cr.next=t;return i}var Nr="undefined"!=typeof AbortController?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,i){e.push(i)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},jr=e.unstable_scheduleCallback,Vr=e.unstable_NormalPriority,Ur={$$typeof:P,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Zr(){return{controller:new Nr,data:new Map,refCount:0}}function Gr(e){e.refCount--,0===e.refCount&&jr(Vr,function(){e.controller.abort()})}var qr=null,$r=0,Wr=0,Hr=null;function Xr(){if(0===--$r&&null!==qr){null!==Hr&&(Hr.status="fulfilled");var e=qr;qr=null,Wr=0,Hr=null;for(var t=0;t<e.length;t++)(0,e[t])()}}var Yr=O.S;O.S=function(e,t){Bc=de(),"object"==typeof t&&null!==t&&"function"==typeof t.then&&function(e,t){if(null===qr){var i=qr=[];$r=0,Wr=$u(),Hr={status:"pending",value:void 0,then:function(e){i.push(e)}}}$r++,t.then(Xr,Xr)}(0,t),null!==Yr&&Yr(e,t)};var Kr=Z(null);function Qr(){var e=Kr.current;return null!==e?e:yc.pooledCache}function Jr(e,t){q(Kr,null===t?Kr.current:t.pool)}function eo(){var e=Qr();return null===e?null:{parent:Ur._currentValue,pool:e}}var to=Error(n(460)),io=Error(n(474)),no=Error(n(542)),ro={then:function(){}};function oo(e){return"fulfilled"===(e=e.status)||"rejected"===e}function ao(e,t,i){switch(void 0===(i=e[i])?e.push(t):i!==t&&(t.then(Ft,Ft),t=i),t.status){case"fulfilled":return t.value;case"rejected":throw uo(e=t.reason),e;default:if("string"==typeof t.status)t.then(Ft,Ft);else{if(null!==(e=yc)&&100<e.shellSuspendCounter)throw Error(n(482));(e=t).status="pending",e.then(function(e){if("pending"===t.status){var i=t;i.status="fulfilled",i.value=e}},function(e){if("pending"===t.status){var i=t;i.status="rejected",i.reason=e}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw uo(e=t.reason),e}throw lo=t,to}}function so(e){try{return(0,e._init)(e._payload)}catch(t){if(null!==t&&"object"==typeof t&&"function"==typeof t.then)throw lo=t,to;throw t}}var lo=null;function co(){if(null===lo)throw Error(n(459));var e=lo;return lo=null,e}function uo(e){if(e===to||e===no)throw Error(n(483))}var ho=null,po=0;function fo(e){var t=po;return po+=1,null===ho&&(ho=[]),ao(ho,e,t)}function mo(e,t){t=t.props.ref,e.ref=void 0!==t?t:null}function go(e,t){if(t.$$typeof===p)throw Error(n(525));throw e=Object.prototype.toString.call(t),Error(n(31,"[object Object]"===e?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function _o(e){function t(t,i){if(e){var n=t.deletions;null===n?(t.deletions=[i],t.flags|=16):n.push(i)}}function i(i,n){if(!e)return null;for(;null!==n;)t(i,n),n=n.sibling;return null}function r(e){for(var t=new Map;null!==e;)null!==e.key?t.set(e.key,e):t.set(e.index,e),e=e.sibling;return t}function o(e,t){return(e=Gn(e,t)).index=0,e.sibling=null,e}function a(t,i,n){return t.index=n,e?null!==(n=t.alternate)?(n=n.index)<i?(t.flags|=67108866,i):n:(t.flags|=67108866,i):(t.flags|=1048576,i)}function s(t){return e&&null===t.alternate&&(t.flags|=67108866),t}function l(e,t,i,n){return null===t||6!==t.tag?((t=Hn(i,e.mode,n)).return=e,t):((t=o(t,i)).return=e,t)}function c(e,t,i,n){var r=i.type;return r===_?h(e,t,i.props.children,n,i.key):null!==t&&(t.elementType===r||"object"==typeof r&&null!==r&&r.$$typeof===I&&so(r)===t.type)?(mo(t=o(t,i.props),i),t.return=e,t):(mo(t=$n(i.type,i.key,i.props,null,e.mode,n),i),t.return=e,t)}function u(e,t,i,n){return null===t||4!==t.tag||t.stateNode.containerInfo!==i.containerInfo||t.stateNode.implementation!==i.implementation?((t=Yn(i,e.mode,n)).return=e,t):((t=o(t,i.children||[])).return=e,t)}function h(e,t,i,n,r){return null===t||7!==t.tag?((t=Wn(i,e.mode,n,r)).return=e,t):((t=o(t,i)).return=e,t)}function d(e,t,i){if("string"==typeof t&&""!==t||"number"==typeof t||"bigint"==typeof t)return(t=Hn(""+t,e.mode,i)).return=e,t;if("object"==typeof t&&null!==t){switch(t.$$typeof){case f:return mo(i=$n(t.type,t.key,t.props,null,e.mode,i),t),i.return=e,i;case m:return(t=Yn(t,e.mode,i)).return=e,t;case I:return d(e,t=so(t),i)}if(B(t)||D(t))return(t=Wn(t,e.mode,i,null)).return=e,t;if("function"==typeof t.then)return d(e,fo(t),i);if(t.$$typeof===P)return d(e,Br(e,t),i);go(e,t)}return null}function p(e,t,i,n){var r=null!==t?t.key:null;if("string"==typeof i&&""!==i||"number"==typeof i||"bigint"==typeof i)return null!==r?null:l(e,t,""+i,n);if("object"==typeof i&&null!==i){switch(i.$$typeof){case f:return i.key===r?c(e,t,i,n):null;case m:return i.key===r?u(e,t,i,n):null;case I:return p(e,t,i=so(i),n)}if(B(i)||D(i))return null!==r?null:h(e,t,i,n,null);if("function"==typeof i.then)return p(e,t,fo(i),n);if(i.$$typeof===P)return p(e,t,Br(e,i),n);go(e,i)}return null}function g(e,t,i,n,r){if("string"==typeof n&&""!==n||"number"==typeof n||"bigint"==typeof n)return l(t,e=e.get(i)||null,""+n,r);if("object"==typeof n&&null!==n){switch(n.$$typeof){case f:return c(t,e=e.get(null===n.key?i:n.key)||null,n,r);case m:return u(t,e=e.get(null===n.key?i:n.key)||null,n,r);case I:return g(e,t,i,n=so(n),r)}if(B(n)||D(n))return h(t,e=e.get(i)||null,n,r,null);if("function"==typeof n.then)return g(e,t,i,fo(n),r);if(n.$$typeof===P)return g(e,t,i,Br(t,n),r);go(t,n)}return null}function y(l,c,u,h){if("object"==typeof u&&null!==u&&u.type===_&&null===u.key&&(u=u.props.children),"object"==typeof u&&null!==u){switch(u.$$typeof){case f:e:{for(var v=u.key;null!==c;){if(c.key===v){if((v=u.type)===_){if(7===c.tag){i(l,c.sibling),(h=o(c,u.props.children)).return=l,l=h;break e}}else if(c.elementType===v||"object"==typeof v&&null!==v&&v.$$typeof===I&&so(v)===c.type){i(l,c.sibling),mo(h=o(c,u.props),u),h.return=l,l=h;break e}i(l,c);break}t(l,c),c=c.sibling}u.type===_?((h=Wn(u.props.children,l.mode,h,u.key)).return=l,l=h):(mo(h=$n(u.type,u.key,u.props,null,l.mode,h),u),h.return=l,l=h)}return s(l);case m:e:{for(v=u.key;null!==c;){if(c.key===v){if(4===c.tag&&c.stateNode.containerInfo===u.containerInfo&&c.stateNode.implementation===u.implementation){i(l,c.sibling),(h=o(c,u.children||[])).return=l,l=h;break e}i(l,c);break}t(l,c),c=c.sibling}(h=Yn(u,l.mode,h)).return=l,l=h}return s(l);case I:return y(l,c,u=so(u),h)}if(B(u))return function(n,o,s,l){for(var c=null,u=null,h=o,f=o=0,m=null;null!==h&&f<s.length;f++){h.index>f?(m=h,h=null):m=h.sibling;var _=p(n,h,s[f],l);if(null===_){null===h&&(h=m);break}e&&h&&null===_.alternate&&t(n,h),o=a(_,o,f),null===u?c=_:u.sibling=_,u=_,h=m}if(f===s.length)return i(n,h),mr&&lr(n,f),c;if(null===h){for(;f<s.length;f++)null!==(h=d(n,s[f],l))&&(o=a(h,o,f),null===u?c=h:u.sibling=h,u=h);return mr&&lr(n,f),c}for(h=r(h);f<s.length;f++)null!==(m=g(h,n,f,s[f],l))&&(e&&null!==m.alternate&&h.delete(null===m.key?f:m.key),o=a(m,o,f),null===u?c=m:u.sibling=m,u=m);return e&&h.forEach(function(e){return t(n,e)}),mr&&lr(n,f),c}(l,c,u,h);if(D(u)){if("function"!=typeof(v=D(u)))throw Error(n(150));return function(o,s,l,c){if(null==l)throw Error(n(151));for(var u=null,h=null,f=s,m=s=0,_=null,y=l.next();null!==f&&!y.done;m++,y=l.next()){f.index>m?(_=f,f=null):_=f.sibling;var v=p(o,f,y.value,c);if(null===v){null===f&&(f=_);break}e&&f&&null===v.alternate&&t(o,f),s=a(v,s,m),null===h?u=v:h.sibling=v,h=v,f=_}if(y.done)return i(o,f),mr&&lr(o,m),u;if(null===f){for(;!y.done;m++,y=l.next())null!==(y=d(o,y.value,c))&&(s=a(y,s,m),null===h?u=y:h.sibling=y,h=y);return mr&&lr(o,m),u}for(f=r(f);!y.done;m++,y=l.next())null!==(y=g(f,o,m,y.value,c))&&(e&&null!==y.alternate&&f.delete(null===y.key?m:y.key),s=a(y,s,m),null===h?u=y:h.sibling=y,h=y);return e&&f.forEach(function(e){return t(o,e)}),mr&&lr(o,m),u}(l,c,u=v.call(u),h)}if("function"==typeof u.then)return y(l,c,fo(u),h);if(u.$$typeof===P)return y(l,c,Br(l,u),h);go(l,u)}return"string"==typeof u&&""!==u||"number"==typeof u||"bigint"==typeof u?(u=""+u,null!==c&&6===c.tag?(i(l,c.sibling),(h=o(c,u)).return=l,l=h):(i(l,c),(h=Hn(u,l.mode,h)).return=l,l=h),s(l)):i(l,c)}return function(e,t,i,n){try{po=0;var r=y(e,t,i,n);return ho=null,r}catch(a){if(a===to||a===no)throw a;var o=Un(29,a,null,e.mode);return o.lanes=n,o.return=e,o}}}var yo=_o(!0),vo=_o(!1),xo=!1;function bo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function wo(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function To(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function So(e,t,i){var n=e.updateQueue;if(null===n)return null;if(n=n.shared,2&_c){var r=n.pending;return null===r?t.next=t:(t.next=r.next,r.next=t),n.pending=t,t=Nn(e),On(e,null,i),t}return Rn(e,n,t,i),Nn(e)}function Po(e,t,i){if(null!==(t=t.updateQueue)&&(t=t.shared,4194048&i)){var n=t.lanes;i|=n&=e.pendingLanes,t.lanes=i,Oe(e,i)}}function Mo(e,t){var i=e.updateQueue,n=e.alternate;if(null!==n&&i===(n=n.updateQueue)){var r=null,o=null;if(null!==(i=i.firstBaseUpdate)){do{var a={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};null===o?r=o=a:o=o.next=a,i=i.next}while(null!==i);null===o?r=o=t:o=o.next=t}else r=o=t;return i={baseState:n.baseState,firstBaseUpdate:r,lastBaseUpdate:o,shared:n.shared,callbacks:n.callbacks},void(e.updateQueue=i)}null===(e=i.lastBaseUpdate)?i.firstBaseUpdate=t:e.next=t,i.lastBaseUpdate=t}var Eo=!1;function Co(){if(Eo){if(null!==Hr)throw Hr}}function ko(e,t,i,n){Eo=!1;var r=e.updateQueue;xo=!1;var o=r.firstBaseUpdate,a=r.lastBaseUpdate,s=r.shared.pending;if(null!==s){r.shared.pending=null;var l=s,c=l.next;l.next=null,null===a?o=c:a.next=c,a=l;var u=e.alternate;null!==u&&((s=(u=u.updateQueue).lastBaseUpdate)!==a&&(null===s?u.firstBaseUpdate=c:s.next=c,u.lastBaseUpdate=l))}if(null!==o){var h=r.baseState;for(a=0,u=c=l=null,s=o;;){var p=-536870913&s.lane,f=p!==s.lane;if(f?(xc&p)===p:(n&p)===p){0!==p&&p===Wr&&(Eo=!0),null!==u&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});e:{var m=e,g=s;p=t;var _=i;switch(g.tag){case 1:if("function"==typeof(m=g.payload)){h=m.call(_,h,p);break e}h=m;break e;case 3:m.flags=-65537&m.flags|128;case 0:if(null==(p="function"==typeof(m=g.payload)?m.call(_,h,p):m))break e;h=d({},h,p);break e;case 2:xo=!0}}null!==(p=s.callback)&&(e.flags|=64,f&&(e.flags|=8192),null===(f=r.callbacks)?r.callbacks=[p]:f.push(p))}else f={lane:p,tag:s.tag,payload:s.payload,callback:s.callback,next:null},null===u?(c=u=f,l=h):u=u.next=f,a|=p;if(null===(s=s.next)){if(null===(s=r.shared.pending))break;s=(f=s).next,f.next=null,r.lastBaseUpdate=f,r.shared.pending=null}}null===u&&(l=h),r.baseState=l,r.firstBaseUpdate=c,r.lastBaseUpdate=u,null===o&&(r.shared.lanes=0),Cc|=a,e.lanes=a,e.memoizedState=h}}function Io(e,t){if("function"!=typeof e)throw Error(n(191,e));e.call(t)}function zo(e,t){var i=e.callbacks;if(null!==i)for(e.callbacks=null,e=0;e<i.length;e++)Io(i[e],t)}var Ao=Z(null),Lo=Z(0);function Do(e,t){q(Lo,e=Mc),q(Ao,t),Mc=e|t.baseLanes}function Ro(){q(Lo,Mc),q(Ao,Ao.current)}function Fo(){Mc=Lo.current,G(Ao),G(Lo)}var Bo=Z(null),Oo=null;function No(e){var t=e.alternate;q(Go,1&Go.current),q(Bo,e),null===Oo&&(null===t||null!==Ao.current||null!==t.memoizedState)&&(Oo=e)}function jo(e){q(Go,Go.current),q(Bo,e),null===Oo&&(Oo=e)}function Vo(e){22===e.tag?(q(Go,Go.current),q(Bo,e),null===Oo&&(Oo=e)):Uo()}function Uo(){q(Go,Go.current),q(Bo,Bo.current)}function Zo(e){G(Bo),Oo===e&&(Oo=null),G(Go)}var Go=Z(0);function qo(e){for(var t=e;null!==t;){if(13===t.tag){var i=t.memoizedState;if(null!==i&&(null===(i=i.dehydrated)||Rh(i)||Fh(i)))return t}else if(19!==t.tag||"forwards"!==t.memoizedProps.revealOrder&&"backwards"!==t.memoizedProps.revealOrder&&"unstable_legacy-backwards"!==t.memoizedProps.revealOrder&&"together"!==t.memoizedProps.revealOrder){if(null!==t.child){t.child.return=t,t=t.child;continue}}else if(128&t.flags)return t;if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var $o=0,Wo=null,Ho=null,Xo=null,Yo=!1,Ko=!1,Qo=!1,Jo=0,ea=0,ta=null,ia=0;function na(){throw Error(n(321))}function ra(e,t){if(null===t)return!1;for(var i=0;i<t.length&&i<e.length;i++)if(!tn(e[i],t[i]))return!1;return!0}function oa(e,t,i,n,r,o){return $o=o,Wo=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,O.H=null===e||null===e.memoizedState?xs:bs,Qo=!1,o=i(n,r),Qo=!1,Ko&&(o=sa(t,i,n,r)),aa(e),o}function aa(e){O.H=vs;var t=null!==Ho&&null!==Ho.next;if($o=0,Xo=Ho=Wo=null,Yo=!1,ea=0,ta=null,t)throw Error(n(300));null===e||Bs||null!==(e=e.dependencies)&&Dr(e)&&(Bs=!0)}function sa(e,t,i,r){Wo=e;var o=0;do{if(Ko&&(ta=null),ea=0,Ko=!1,25<=o)throw Error(n(301));if(o+=1,Xo=Ho=null,null!=e.updateQueue){var a=e.updateQueue;a.lastEffect=null,a.events=null,a.stores=null,null!=a.memoCache&&(a.memoCache.index=0)}O.H=ws,a=t(i,r)}while(Ko);return a}function la(){var e=O.H,t=e.useState()[0];return t="function"==typeof t.then?fa(t):t,e=e.useState()[0],(null!==Ho?Ho.memoizedState:null)!==e&&(Wo.flags|=1024),t}function ca(){var e=0!==Jo;return Jo=0,e}function ua(e,t,i){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i}function ha(e){if(Yo){for(e=e.memoizedState;null!==e;){var t=e.queue;null!==t&&(t.pending=null),e=e.next}Yo=!1}$o=0,Xo=Ho=Wo=null,Ko=!1,ea=Jo=0,ta=null}function da(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===Xo?Wo.memoizedState=Xo=e:Xo=Xo.next=e,Xo}function pa(){if(null===Ho){var e=Wo.alternate;e=null!==e?e.memoizedState:null}else e=Ho.next;var t=null===Xo?Wo.memoizedState:Xo.next;if(null!==t)Xo=t,Ho=e;else{if(null===e){if(null===Wo.alternate)throw Error(n(467));throw Error(n(310))}e={memoizedState:(Ho=e).memoizedState,baseState:Ho.baseState,baseQueue:Ho.baseQueue,queue:Ho.queue,next:null},null===Xo?Wo.memoizedState=Xo=e:Xo=Xo.next=e}return Xo}function fa(e){var t=ea;return ea+=1,null===ta&&(ta=[]),e=ao(ta,e,t),t=Wo,null===(null===Xo?t.memoizedState:Xo.next)&&(t=t.alternate,O.H=null===t||null===t.memoizedState?xs:bs),e}function ma(e){if(null!==e&&"object"==typeof e){if("function"==typeof e.then)return fa(e);if(e.$$typeof===P)return Fr(e)}throw Error(n(438,String(e)))}function ga(e){var t=null,i=Wo.updateQueue;if(null!==i&&(t=i.memoCache),null==t){var n=Wo.alternate;null!==n&&(null!==(n=n.updateQueue)&&(null!=(n=n.memoCache)&&(t={data:n.data.map(function(e){return e.slice()}),index:0})))}if(null==t&&(t={data:[],index:0}),null===i&&(i={lastEffect:null,events:null,stores:null,memoCache:null},Wo.updateQueue=i),i.memoCache=t,void 0===(i=t.data[t.index]))for(i=t.data[t.index]=Array(e),n=0;n<e;n++)i[n]=A;return t.index++,i}function _a(e,t){return"function"==typeof t?t(e):t}function ya(e){return va(pa(),Ho,e)}function va(e,t,i){var r=e.queue;if(null===r)throw Error(n(311));r.lastRenderedReducer=i;var o=e.baseQueue,a=r.pending;if(null!==a){if(null!==o){var s=o.next;o.next=a.next,a.next=s}t.baseQueue=o=a,r.pending=null}if(a=e.baseState,null===o)e.memoizedState=a;else{var l=s=null,c=null,u=t=o.next,h=!1;do{var d=-536870913&u.lane;if(d!==u.lane?(xc&d)===d:($o&d)===d){var p=u.revertLane;if(0===p)null!==c&&(c=c.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),d===Wr&&(h=!0);else{if(($o&p)===p){u=u.next,p===Wr&&(h=!0);continue}d={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},null===c?(l=c=d,s=a):c=c.next=d,Wo.lanes|=p,Cc|=p}d=u.action,Qo&&i(a,d),a=u.hasEagerState?u.eagerState:i(a,d)}else p={lane:d,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},null===c?(l=c=p,s=a):c=c.next=p,Wo.lanes|=d,Cc|=d;u=u.next}while(null!==u&&u!==t);if(null===c?s=a:c.next=l,!tn(a,e.memoizedState)&&(Bs=!0,h&&null!==(i=Hr)))throw i;e.memoizedState=a,e.baseState=s,e.baseQueue=c,r.lastRenderedState=a}return null===o&&(r.lanes=0),[e.memoizedState,r.dispatch]}function xa(e){var t=pa(),i=t.queue;if(null===i)throw Error(n(311));i.lastRenderedReducer=e;var r=i.dispatch,o=i.pending,a=t.memoizedState;if(null!==o){i.pending=null;var s=o=o.next;do{a=e(a,s.action),s=s.next}while(s!==o);tn(a,t.memoizedState)||(Bs=!0),t.memoizedState=a,null===t.baseQueue&&(t.baseState=a),i.lastRenderedState=a}return[a,r]}function ba(e,t,i){var r=Wo,o=pa(),a=mr;if(a){if(void 0===i)throw Error(n(407));i=i()}else i=t();var s=!tn((Ho||o).memoizedState,i);if(s&&(o.memoizedState=i,Bs=!0),o=o.queue,$a(Sa.bind(null,r,o,e),[e]),o.getSnapshot!==t||s||null!==Xo&&1&Xo.memoizedState.tag){if(r.flags|=2048,Va(9,{destroy:void 0},Ta.bind(null,r,o,i,t),null),null===yc)throw Error(n(349));a||127&$o||wa(r,t,i)}return i}function wa(e,t,i){e.flags|=16384,e={getSnapshot:t,value:i},null===(t=Wo.updateQueue)?(t={lastEffect:null,events:null,stores:null,memoCache:null},Wo.updateQueue=t,t.stores=[e]):null===(i=t.stores)?t.stores=[e]:i.push(e)}function Ta(e,t,i,n){t.value=i,t.getSnapshot=n,Pa(t)&&Ma(e)}function Sa(e,t,i){return i(function(){Pa(t)&&Ma(e)})}function Pa(e){var t=e.getSnapshot;e=e.value;try{var i=t();return!tn(e,i)}catch(n){return!0}}function Ma(e){var t=Bn(e,2);null!==t&&Qc(t,e,2)}function Ea(e){var t=da();if("function"==typeof e){var i=e;if(e=i(),Qo){Te(!0);try{i()}finally{Te(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:_a,lastRenderedState:e},t}function Ca(e,t,i,n){return e.baseState=i,va(e,Ho,"function"==typeof n?n:_a)}function ka(e,t,i,r,o){if(gs(e))throw Error(n(485));if(null!==(e=t.action)){var a={payload:o,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(e){a.listeners.push(e)}};null!==O.T?i(!0):a.isTransition=!1,r(a),null===(i=t.pending)?(a.next=t.pending=a,Ia(t,a)):(a.next=i.next,t.pending=i.next=a)}}function Ia(e,t){var i=t.action,n=t.payload,r=e.state;if(t.isTransition){var o=O.T,a={};O.T=a;try{var s=i(r,n),l=O.S;null!==l&&l(a,s),za(e,t,s)}catch(c){La(e,t,c)}finally{null!==o&&null!==a.types&&(o.types=a.types),O.T=o}}else try{za(e,t,o=i(r,n))}catch(u){La(e,t,u)}}function za(e,t,i){null!==i&&"object"==typeof i&&"function"==typeof i.then?i.then(function(i){Aa(e,t,i)},function(i){return La(e,t,i)}):Aa(e,t,i)}function Aa(e,t,i){t.status="fulfilled",t.value=i,Da(t),e.state=i,null!==(t=e.pending)&&((i=t.next)===t?e.pending=null:(i=i.next,t.next=i,Ia(e,i)))}function La(e,t,i){var n=e.pending;if(e.pending=null,null!==n){n=n.next;do{t.status="rejected",t.reason=i,Da(t),t=t.next}while(t!==n)}e.action=null}function Da(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Ra(e,t){return t}function Fa(e,t){if(mr){var i=yc.formState;if(null!==i){e:{var n=Wo;if(mr){if(fr){t:{for(var r=fr,o=_r;8!==r.nodeType;){if(!o){r=null;break t}if(null===(r=Bh(r.nextSibling))){r=null;break t}}r="F!"===(o=r.data)||"F"===o?r:null}if(r){fr=Bh(r.nextSibling),n="F!"===r.data;break e}}vr(n)}n=!1}n&&(t=i[0])}}return(i=da()).memoizedState=i.baseState=t,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ra,lastRenderedState:t},i.queue=n,i=ps.bind(null,Wo,n),n.dispatch=i,n=Ea(!1),o=ms.bind(null,Wo,!1,n.queue),r={state:t,dispatch:null,action:e,pending:null},(n=da()).queue=r,i=ka.bind(null,Wo,r,o,i),r.dispatch=i,n.memoizedState=e,[t,i,!1]}function Ba(e){return Oa(pa(),Ho,e)}function Oa(e,t,i){if(t=va(e,t,Ra)[0],e=ya(_a)[0],"object"==typeof t&&null!==t&&"function"==typeof t.then)try{var n=fa(t)}catch(a){if(a===to)throw no;throw a}else n=t;var r=(t=pa()).queue,o=r.dispatch;return i!==t.memoizedState&&(Wo.flags|=2048,Va(9,{destroy:void 0},Na.bind(null,r,i),null)),[n,o,e]}function Na(e,t){e.action=t}function ja(e){var t=pa(),i=Ho;if(null!==i)return Oa(t,i,e);pa(),t=t.memoizedState;var n=(i=pa()).queue.dispatch;return i.memoizedState=e,[t,n,!1]}function Va(e,t,i,n){return e={tag:e,create:i,deps:n,inst:t,next:null},null===(t=Wo.updateQueue)&&(t={lastEffect:null,events:null,stores:null,memoCache:null},Wo.updateQueue=t),null===(i=t.lastEffect)?t.lastEffect=e.next=e:(n=i.next,i.next=e,e.next=n,t.lastEffect=e),e}function Ua(){return pa().memoizedState}function Za(e,t,i,n){var r=da();Wo.flags|=e,r.memoizedState=Va(1|t,{destroy:void 0},i,void 0===n?null:n)}function Ga(e,t,i,n){var r=pa();n=void 0===n?null:n;var o=r.memoizedState.inst;null!==Ho&&null!==n&&ra(n,Ho.memoizedState.deps)?r.memoizedState=Va(t,o,i,n):(Wo.flags|=e,r.memoizedState=Va(1|t,o,i,n))}function qa(e,t){Za(8390656,8,e,t)}function $a(e,t){Ga(2048,8,e,t)}function Wa(e){var t=pa().memoizedState;return function(e){Wo.flags|=4;var t=Wo.updateQueue;if(null===t)t={lastEffect:null,events:null,stores:null,memoCache:null},Wo.updateQueue=t,t.events=[e];else{var i=t.events;null===i?t.events=[e]:i.push(e)}}({ref:t,nextImpl:e}),function(){if(2&_c)throw Error(n(440));return t.impl.apply(void 0,arguments)}}function Ha(e,t){return Ga(4,2,e,t)}function Xa(e,t){return Ga(4,4,e,t)}function Ya(e,t){if("function"==typeof t){e=e();var i=t(e);return function(){"function"==typeof i?i():t(null)}}if(null!=t)return e=e(),t.current=e,function(){t.current=null}}function Ka(e,t,i){i=null!=i?i.concat([e]):null,Ga(4,4,Ya.bind(null,t,e),i)}function Qa(){}function Ja(e,t){var i=pa();t=void 0===t?null:t;var n=i.memoizedState;return null!==t&&ra(t,n[1])?n[0]:(i.memoizedState=[e,t],e)}function es(e,t){var i=pa();t=void 0===t?null:t;var n=i.memoizedState;if(null!==t&&ra(t,n[1]))return n[0];if(n=e(),Qo){Te(!0);try{e()}finally{Te(!1)}}return i.memoizedState=[n,t],n}function ts(e,t,i){return void 0===i||1073741824&$o&&!(261930&xc)?e.memoizedState=t:(e.memoizedState=i,e=Kc(),Wo.lanes|=e,Cc|=e,i)}function is(e,t,i,n){return tn(i,t)?i:null!==Ao.current?(e=ts(e,i,n),tn(e,t)||(Bs=!0),e):42&$o&&(!(1073741824&$o)||261930&xc)?(e=Kc(),Wo.lanes|=e,Cc|=e,t):(Bs=!0,e.memoizedState=i)}function ns(e,t,i,n,r){var o=N.p;N.p=0!==o&&8>o?o:8;var a,s,l,c=O.T,u={};O.T=u,ms(e,!1,t,i);try{var h=r(),d=O.S;if(null!==d&&d(u,h),null!==h&&"object"==typeof h&&"function"==typeof h.then)fs(e,t,(a=n,s=[],l={status:"pending",value:null,reason:null,then:function(e){s.push(e)}},h.then(function(){l.status="fulfilled",l.value=a;for(var e=0;e<s.length;e++)(0,s[e])(a)},function(e){for(l.status="rejected",l.reason=e,e=0;e<s.length;e++)(0,s[e])(void 0)}),l),Yc());else fs(e,t,n,Yc())}catch(p){fs(e,t,{then:function(){},status:"rejected",reason:p},Yc())}finally{N.p=o,null!==c&&null!==u.types&&(c.types=u.types),O.T=c}}function rs(){}function os(e,t,i,r){if(5!==e.tag)throw Error(n(476));var o=as(e).queue;ns(e,o,t,j,null===i?rs:function(){return ss(e),i(r)})}function as(e){var t=e.memoizedState;if(null!==t)return t;var i={};return(t={memoizedState:j,baseState:j,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:_a,lastRenderedState:j},next:null}).next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:_a,lastRenderedState:i},next:null},e.memoizedState=t,null!==(e=e.alternate)&&(e.memoizedState=t),t}function ss(e){var t=as(e);null===t.next&&(t=e.alternate.memoizedState),fs(e,t.next.queue,{},Yc())}function ls(){return Fr(fd)}function cs(){return pa().memoizedState}function us(){return pa().memoizedState}function hs(e){for(var t=e.return;null!==t;){switch(t.tag){case 24:case 3:var i=Yc(),n=So(t,e=To(i),i);return null!==n&&(Qc(n,t,i),Po(n,t,i)),t={cache:Zr()},void(e.payload=t)}t=t.return}}function ds(e,t,i){var n=Yc();i={lane:n,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},gs(e)?_s(t,i):null!==(i=Fn(e,t,i,n))&&(Qc(i,e,n),ys(i,t,n))}function ps(e,t,i){fs(e,t,i,Yc())}function fs(e,t,i,n){var r={lane:n,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(gs(e))_s(t,r);else{var o=e.alternate;if(0===e.lanes&&(null===o||0===o.lanes)&&null!==(o=t.lastRenderedReducer))try{var a=t.lastRenderedState,s=o(a,i);if(r.hasEagerState=!0,r.eagerState=s,tn(s,a))return Rn(e,t,r,0),null===yc&&Dn(),!1}catch(l){}if(null!==(i=Fn(e,t,r,n)))return Qc(i,e,n),ys(i,t,n),!0}return!1}function ms(e,t,i,r){if(r={lane:2,revertLane:$u(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},gs(e)){if(t)throw Error(n(479))}else null!==(t=Fn(e,i,r,2))&&Qc(t,e,2)}function gs(e){var t=e.alternate;return e===Wo||null!==t&&t===Wo}function _s(e,t){Ko=Yo=!0;var i=e.pending;null===i?t.next=t:(t.next=i.next,i.next=t),e.pending=t}function ys(e,t,i){if(4194048&i){var n=t.lanes;i|=n&=e.pendingLanes,t.lanes=i,Oe(e,i)}}var vs={readContext:Fr,use:ma,useCallback:na,useContext:na,useEffect:na,useImperativeHandle:na,useLayoutEffect:na,useInsertionEffect:na,useMemo:na,useReducer:na,useRef:na,useState:na,useDebugValue:na,useDeferredValue:na,useTransition:na,useSyncExternalStore:na,useId:na,useHostTransitionStatus:na,useFormState:na,useActionState:na,useOptimistic:na,useMemoCache:na,useCacheRefresh:na};vs.useEffectEvent=na;var xs={readContext:Fr,use:ma,useCallback:function(e,t){return da().memoizedState=[e,void 0===t?null:t],e},useContext:Fr,useEffect:qa,useImperativeHandle:function(e,t,i){i=null!=i?i.concat([e]):null,Za(4194308,4,Ya.bind(null,t,e),i)},useLayoutEffect:function(e,t){return Za(4194308,4,e,t)},useInsertionEffect:function(e,t){Za(4,2,e,t)},useMemo:function(e,t){var i=da();t=void 0===t?null:t;var n=e();if(Qo){Te(!0);try{e()}finally{Te(!1)}}return i.memoizedState=[n,t],n},useReducer:function(e,t,i){var n=da();if(void 0!==i){var r=i(t);if(Qo){Te(!0);try{i(t)}finally{Te(!1)}}}else r=t;return n.memoizedState=n.baseState=r,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:r},n.queue=e,e=e.dispatch=ds.bind(null,Wo,e),[n.memoizedState,e]},useRef:function(e){return e={current:e},da().memoizedState=e},useState:function(e){var t=(e=Ea(e)).queue,i=ps.bind(null,Wo,t);return t.dispatch=i,[e.memoizedState,i]},useDebugValue:Qa,useDeferredValue:function(e,t){return ts(da(),e,t)},useTransition:function(){var e=Ea(!1);return e=ns.bind(null,Wo,e.queue,!0,!1),da().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,i){var r=Wo,o=da();if(mr){if(void 0===i)throw Error(n(407));i=i()}else{if(i=t(),null===yc)throw Error(n(349));127&xc||wa(r,t,i)}o.memoizedState=i;var a={value:i,getSnapshot:t};return o.queue=a,qa(Sa.bind(null,r,a,e),[e]),r.flags|=2048,Va(9,{destroy:void 0},Ta.bind(null,r,a,i,t),null),i},useId:function(){var e=da(),t=yc.identifierPrefix;if(mr){var i=sr;t="_"+t+"R_"+(i=(ar&~(1<<32-Se(ar)-1)).toString(32)+i),0<(i=Jo++)&&(t+="H"+i.toString(32)),t+="_"}else t="_"+t+"r_"+(i=ia++).toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:ls,useFormState:Fa,useActionState:Fa,useOptimistic:function(e){var t=da();t.memoizedState=t.baseState=e;var i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=i,t=ms.bind(null,Wo,!0,i),i.dispatch=t,[e,t]},useMemoCache:ga,useCacheRefresh:function(){return da().memoizedState=hs.bind(null,Wo)},useEffectEvent:function(e){var t=da(),i={impl:e};return t.memoizedState=i,function(){if(2&_c)throw Error(n(440));return i.impl.apply(void 0,arguments)}}},bs={readContext:Fr,use:ma,useCallback:Ja,useContext:Fr,useEffect:$a,useImperativeHandle:Ka,useInsertionEffect:Ha,useLayoutEffect:Xa,useMemo:es,useReducer:ya,useRef:Ua,useState:function(){return ya(_a)},useDebugValue:Qa,useDeferredValue:function(e,t){return is(pa(),Ho.memoizedState,e,t)},useTransition:function(){var e=ya(_a)[0],t=pa().memoizedState;return["boolean"==typeof e?e:fa(e),t]},useSyncExternalStore:ba,useId:cs,useHostTransitionStatus:ls,useFormState:Ba,useActionState:Ba,useOptimistic:function(e,t){return Ca(pa(),0,e,t)},useMemoCache:ga,useCacheRefresh:us};bs.useEffectEvent=Wa;var ws={readContext:Fr,use:ma,useCallback:Ja,useContext:Fr,useEffect:$a,useImperativeHandle:Ka,useInsertionEffect:Ha,useLayoutEffect:Xa,useMemo:es,useReducer:xa,useRef:Ua,useState:function(){return xa(_a)},useDebugValue:Qa,useDeferredValue:function(e,t){var i=pa();return null===Ho?ts(i,e,t):is(i,Ho.memoizedState,e,t)},useTransition:function(){var e=xa(_a)[0],t=pa().memoizedState;return["boolean"==typeof e?e:fa(e),t]},useSyncExternalStore:ba,useId:cs,useHostTransitionStatus:ls,useFormState:ja,useActionState:ja,useOptimistic:function(e,t){var i=pa();return null!==Ho?Ca(i,0,e,t):(i.baseState=e,[e,i.queue.dispatch])},useMemoCache:ga,useCacheRefresh:us};function Ts(e,t,i,n){i=null==(i=i(n,t=e.memoizedState))?t:d({},t,i),e.memoizedState=i,0===e.lanes&&(e.updateQueue.baseState=i)}ws.useEffectEvent=Wa;var Ss={enqueueSetState:function(e,t,i){e=e._reactInternals;var n=Yc(),r=To(n);r.payload=t,null!=i&&(r.callback=i),null!==(t=So(e,r,n))&&(Qc(t,e,n),Po(t,e,n))},enqueueReplaceState:function(e,t,i){e=e._reactInternals;var n=Yc(),r=To(n);r.tag=1,r.payload=t,null!=i&&(r.callback=i),null!==(t=So(e,r,n))&&(Qc(t,e,n),Po(t,e,n))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var i=Yc(),n=To(i);n.tag=2,null!=t&&(n.callback=t),null!==(t=So(e,n,i))&&(Qc(t,e,i),Po(t,e,i))}};function Ps(e,t,i,n,r,o,a){return"function"==typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(n,o,a):!t.prototype||!t.prototype.isPureReactComponent||(!nn(i,n)||!nn(r,o))}function Ms(e,t,i,n){e=t.state,"function"==typeof t.componentWillReceiveProps&&t.componentWillReceiveProps(i,n),"function"==typeof t.UNSAFE_componentWillReceiveProps&&t.UNSAFE_componentWillReceiveProps(i,n),t.state!==e&&Ss.enqueueReplaceState(t,t.state,null)}function Es(e,t){var i=t;if("ref"in t)for(var n in i={},t)"ref"!==n&&(i[n]=t[n]);if(e=e.defaultProps)for(var r in i===t&&(i=d({},i)),e)void 0===i[r]&&(i[r]=e[r]);return i}function Cs(e){In(e)}function ks(e){}function Is(e){In(e)}function zs(e,t){try{(0,e.onUncaughtError)(t.value,{componentStack:t.stack})}catch(i){setTimeout(function(){throw i})}}function As(e,t,i){try{(0,e.onCaughtError)(i.value,{componentStack:i.stack,errorBoundary:1===t.tag?t.stateNode:null})}catch(n){setTimeout(function(){throw n})}}function Ls(e,t,i){return(i=To(i)).tag=3,i.payload={element:null},i.callback=function(){zs(e,t)},i}function Ds(e){return(e=To(e)).tag=3,e}function Rs(e,t,i,n){var r=i.type.getDerivedStateFromError;if("function"==typeof r){var o=n.value;e.payload=function(){return r(o)},e.callback=function(){As(t,i,n)}}var a=i.stateNode;null!==a&&"function"==typeof a.componentDidCatch&&(e.callback=function(){As(t,i,n),"function"!=typeof r&&(null===jc?jc=new Set([this]):jc.add(this));var e=n.stack;this.componentDidCatch(n.value,{componentStack:null!==e?e:""})})}var Fs=Error(n(461)),Bs=!1;function Os(e,t,i,n){t.child=null===e?vo(t,null,i,n):yo(t,e.child,i,n)}function Ns(e,t,i,n,r){i=i.render;var o=t.ref;if("ref"in n){var a={};for(var s in n)"ref"!==s&&(a[s]=n[s])}else a=n;return Rr(t),n=oa(e,t,i,a,o,r),s=ca(),null===e||Bs?(mr&&s&&ur(t),t.flags|=1,Os(e,t,n,r),t.child):(ua(e,t,r),ll(e,t,r))}function js(e,t,i,n,r){if(null===e){var o=i.type;return"function"!=typeof o||Zn(o)||void 0!==o.defaultProps||null!==i.compare?((e=$n(i.type,null,n,t,t.mode,r)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=o,Vs(e,t,o,n,r))}if(o=e.child,!cl(e,r)){var a=o.memoizedProps;if((i=null!==(i=i.compare)?i:nn)(a,n)&&e.ref===t.ref)return ll(e,t,r)}return t.flags|=1,(e=Gn(o,n)).ref=t.ref,e.return=t,t.child=e}function Vs(e,t,i,n,r){if(null!==e){var o=e.memoizedProps;if(nn(o,n)&&e.ref===t.ref){if(Bs=!1,t.pendingProps=n=o,!cl(e,r))return t.lanes=e.lanes,ll(e,t,r);131072&e.flags&&(Bs=!0)}}return Hs(e,t,i,n,r)}function Us(e,t,i,n){var r=n.children,o=null!==e?e.memoizedState:null;if(null===e&&null===t.stateNode&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),"hidden"===n.mode){if(128&t.flags){if(o=null!==o?o.baseLanes|i:i,null!==e){for(n=t.child=e.child,r=0;null!==n;)r=r|n.lanes|n.childLanes,n=n.sibling;n=r&~o}else n=0,t.child=null;return Gs(e,t,o,i,n)}if(!(536870912&i))return n=t.lanes=536870912,Gs(e,t,null!==o?o.baseLanes|i:i,i,n);t.memoizedState={baseLanes:0,cachePool:null},null!==e&&Jr(0,null!==o?o.cachePool:null),null!==o?Do(t,o):Ro(),Vo(t)}else null!==o?(Jr(0,o.cachePool),Do(t,o),Uo(),t.memoizedState=null):(null!==e&&Jr(0,null),Ro(),Uo());return Os(e,t,r,i),t.child}function Zs(e,t){return null!==e&&22===e.tag||null!==t.stateNode||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Gs(e,t,i,n,r){var o=Qr();return o=null===o?null:{parent:Ur._currentValue,pool:o},t.memoizedState={baseLanes:i,cachePool:o},null!==e&&Jr(0,null),Ro(),Vo(t),null!==e&&Lr(e,t,n,!0),t.childLanes=r,null}function qs(e,t){return(t=nl({mode:t.mode,children:t.children},e.mode)).ref=e.ref,e.child=t,t.return=e,t}function $s(e,t,i){return yo(t,e.child,null,i),(e=qs(t,t.pendingProps)).flags|=2,Zo(t),t.memoizedState=null,e}function Ws(e,t){var i=t.ref;if(null===i)null!==e&&null!==e.ref&&(t.flags|=4194816);else{if("function"!=typeof i&&"object"!=typeof i)throw Error(n(284));null!==e&&e.ref===i||(t.flags|=4194816)}}function Hs(e,t,i,n,r){return Rr(t),i=oa(e,t,i,n,void 0,r),n=ca(),null===e||Bs?(mr&&n&&ur(t),t.flags|=1,Os(e,t,i,r),t.child):(ua(e,t,r),ll(e,t,r))}function Xs(e,t,i,n,r,o){return Rr(t),t.updateQueue=null,i=sa(t,n,i,r),aa(e),n=ca(),null===e||Bs?(mr&&n&&ur(t),t.flags|=1,Os(e,t,i,o),t.child):(ua(e,t,o),ll(e,t,o))}function Ys(e,t,i,n,r){if(Rr(t),null===t.stateNode){var o=jn,a=i.contextType;"object"==typeof a&&null!==a&&(o=Fr(a)),o=new i(n,o),t.memoizedState=null!==o.state&&void 0!==o.state?o.state:null,o.updater=Ss,t.stateNode=o,o._reactInternals=t,(o=t.stateNode).props=n,o.state=t.memoizedState,o.refs={},bo(t),a=i.contextType,o.context="object"==typeof a&&null!==a?Fr(a):jn,o.state=t.memoizedState,"function"==typeof(a=i.getDerivedStateFromProps)&&(Ts(t,i,a,n),o.state=t.memoizedState),"function"==typeof i.getDerivedStateFromProps||"function"==typeof o.getSnapshotBeforeUpdate||"function"!=typeof o.UNSAFE_componentWillMount&&"function"!=typeof o.componentWillMount||(a=o.state,"function"==typeof o.componentWillMount&&o.componentWillMount(),"function"==typeof o.UNSAFE_componentWillMount&&o.UNSAFE_componentWillMount(),a!==o.state&&Ss.enqueueReplaceState(o,o.state,null),ko(t,n,o,r),Co(),o.state=t.memoizedState),"function"==typeof o.componentDidMount&&(t.flags|=4194308),n=!0}else if(null===e){o=t.stateNode;var s=t.memoizedProps,l=Es(i,s);o.props=l;var c=o.context,u=i.contextType;a=jn,"object"==typeof u&&null!==u&&(a=Fr(u));var h=i.getDerivedStateFromProps;u="function"==typeof h||"function"==typeof o.getSnapshotBeforeUpdate,s=t.pendingProps!==s,u||"function"!=typeof o.UNSAFE_componentWillReceiveProps&&"function"!=typeof o.componentWillReceiveProps||(s||c!==a)&&Ms(t,o,n,a),xo=!1;var d=t.memoizedState;o.state=d,ko(t,n,o,r),Co(),c=t.memoizedState,s||d!==c||xo?("function"==typeof h&&(Ts(t,i,h,n),c=t.memoizedState),(l=xo||Ps(t,i,l,n,d,c,a))?(u||"function"!=typeof o.UNSAFE_componentWillMount&&"function"!=typeof o.componentWillMount||("function"==typeof o.componentWillMount&&o.componentWillMount(),"function"==typeof o.UNSAFE_componentWillMount&&o.UNSAFE_componentWillMount()),"function"==typeof o.componentDidMount&&(t.flags|=4194308)):("function"==typeof o.componentDidMount&&(t.flags|=4194308),t.memoizedProps=n,t.memoizedState=c),o.props=n,o.state=c,o.context=a,n=l):("function"==typeof o.componentDidMount&&(t.flags|=4194308),n=!1)}else{o=t.stateNode,wo(e,t),u=Es(i,a=t.memoizedProps),o.props=u,h=t.pendingProps,d=o.context,c=i.contextType,l=jn,"object"==typeof c&&null!==c&&(l=Fr(c)),(c="function"==typeof(s=i.getDerivedStateFromProps)||"function"==typeof o.getSnapshotBeforeUpdate)||"function"!=typeof o.UNSAFE_componentWillReceiveProps&&"function"!=typeof o.componentWillReceiveProps||(a!==h||d!==l)&&Ms(t,o,n,l),xo=!1,d=t.memoizedState,o.state=d,ko(t,n,o,r),Co();var p=t.memoizedState;a!==h||d!==p||xo||null!==e&&null!==e.dependencies&&Dr(e.dependencies)?("function"==typeof s&&(Ts(t,i,s,n),p=t.memoizedState),(u=xo||Ps(t,i,u,n,d,p,l)||null!==e&&null!==e.dependencies&&Dr(e.dependencies))?(c||"function"!=typeof o.UNSAFE_componentWillUpdate&&"function"!=typeof o.componentWillUpdate||("function"==typeof o.componentWillUpdate&&o.componentWillUpdate(n,p,l),"function"==typeof o.UNSAFE_componentWillUpdate&&o.UNSAFE_componentWillUpdate(n,p,l)),"function"==typeof o.componentDidUpdate&&(t.flags|=4),"function"==typeof o.getSnapshotBeforeUpdate&&(t.flags|=1024)):("function"!=typeof o.componentDidUpdate||a===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),"function"!=typeof o.getSnapshotBeforeUpdate||a===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),t.memoizedProps=n,t.memoizedState=p),o.props=n,o.state=p,o.context=l,n=u):("function"!=typeof o.componentDidUpdate||a===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),"function"!=typeof o.getSnapshotBeforeUpdate||a===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),n=!1)}return o=n,Ws(e,t),n=!!(128&t.flags),o||n?(o=t.stateNode,i=n&&"function"!=typeof i.getDerivedStateFromError?null:o.render(),t.flags|=1,null!==e&&n?(t.child=yo(t,e.child,null,r),t.child=yo(t,null,i,r)):Os(e,t,i,r),t.memoizedState=o.state,e=t.child):e=ll(e,t,r),e}function Ks(e,t,i,n){return Tr(),t.flags|=256,Os(e,t,i,n),t.child}var Qs={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Js(e){return{baseLanes:e,cachePool:eo()}}function el(e,t,i){return e=null!==e?e.childLanes&~i:0,t&&(e|=zc),e}function tl(e,t,i){var r,o=t.pendingProps,a=!1,s=!!(128&t.flags);if((r=s)||(r=(null===e||null!==e.memoizedState)&&!!(2&Go.current)),r&&(a=!0,t.flags&=-129),r=!!(32&t.flags),t.flags&=-33,null===e){if(mr){if(a?No(t):Uo(),(e=fr)?null!==(e=null!==(e=Dh(e,_r))&&"&"!==e.data?e:null)&&(t.memoizedState={dehydrated:e,treeContext:null!==or?{id:ar,overflow:sr}:null,retryLane:536870912,hydrationErrors:null},(i=Xn(e)).return=t,t.child=i,pr=t,fr=null):e=null,null===e)throw vr(t);return Fh(e)?t.lanes=32:t.lanes=536870912,null}var l=o.children;return o=o.fallback,a?(Uo(),l=nl({mode:"hidden",children:l},a=t.mode),o=Wn(o,a,i,null),l.return=t,o.return=t,l.sibling=o,t.child=l,(o=t.child).memoizedState=Js(i),o.childLanes=el(e,r,i),t.memoizedState=Qs,Zs(null,o)):(No(t),il(t,l))}var c=e.memoizedState;if(null!==c&&null!==(l=c.dehydrated)){if(s)256&t.flags?(No(t),t.flags&=-257,t=rl(e,t,i)):null!==t.memoizedState?(Uo(),t.child=e.child,t.flags|=128,t=null):(Uo(),l=o.fallback,a=t.mode,o=nl({mode:"visible",children:o.children},a),(l=Wn(l,a,i,null)).flags|=2,o.return=t,l.return=t,o.sibling=l,t.child=o,yo(t,e.child,null,i),(o=t.child).memoizedState=Js(i),o.childLanes=el(e,r,i),t.memoizedState=Qs,t=Zs(null,o));else if(No(t),Fh(l)){if(r=l.nextSibling&&l.nextSibling.dataset)var u=r.dgst;r=u,(o=Error(n(419))).stack="",o.digest=r,Pr({value:o,source:null,stack:null}),t=rl(e,t,i)}else if(Bs||Lr(e,t,i,!1),r=0!==(i&e.childLanes),Bs||r){if(null!==(r=yc)&&(0!==(o=Ne(r,i))&&o!==c.retryLane))throw c.retryLane=o,Bn(e,o),Qc(r,e,o),Fs;Rh(l)||uu(),t=rl(e,t,i)}else Rh(l)?(t.flags|=192,t.child=e.child,t=null):(e=c.treeContext,fr=Bh(l.nextSibling),pr=t,mr=!0,gr=null,_r=!1,null!==e&&dr(t,e),(t=il(t,o.children)).flags|=4096);return t}return a?(Uo(),l=o.fallback,a=t.mode,u=(c=e.child).sibling,(o=Gn(c,{mode:"hidden",children:o.children})).subtreeFlags=65011712&c.subtreeFlags,null!==u?l=Gn(u,l):(l=Wn(l,a,i,null)).flags|=2,l.return=t,o.return=t,o.sibling=l,t.child=o,Zs(null,o),o=t.child,null===(l=e.child.memoizedState)?l=Js(i):(null!==(a=l.cachePool)?(c=Ur._currentValue,a=a.parent!==c?{parent:c,pool:c}:a):a=eo(),l={baseLanes:l.baseLanes|i,cachePool:a}),o.memoizedState=l,o.childLanes=el(e,r,i),t.memoizedState=Qs,Zs(e.child,o)):(No(t),e=(i=e.child).sibling,(i=Gn(i,{mode:"visible",children:o.children})).return=t,i.sibling=null,null!==e&&(null===(r=t.deletions)?(t.deletions=[e],t.flags|=16):r.push(e)),t.child=i,t.memoizedState=null,i)}function il(e,t){return(t=nl({mode:"visible",children:t},e.mode)).return=e,e.child=t}function nl(e,t){return(e=Un(22,e,null,t)).lanes=0,e}function rl(e,t,i){return yo(t,e.child,null,i),(e=il(t,t.pendingProps.children)).flags|=2,t.memoizedState=null,e}function ol(e,t,i){e.lanes|=t;var n=e.alternate;null!==n&&(n.lanes|=t),zr(e.return,t,i)}function al(e,t,i,n,r,o){var a=e.memoizedState;null===a?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:n,tail:i,tailMode:r,treeForkCount:o}:(a.isBackwards=t,a.rendering=null,a.renderingStartTime=0,a.last=n,a.tail=i,a.tailMode=r,a.treeForkCount=o)}function sl(e,t,i){var n=t.pendingProps,r=n.revealOrder,o=n.tail;n=n.children;var a=Go.current,s=!!(2&a);if(s?(a=1&a|2,t.flags|=128):a&=1,q(Go,a),Os(e,t,n,i),n=mr?ir:0,!s&&null!==e&&128&e.flags)e:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&ol(e,i,t);else if(19===e.tag)ol(e,i,t);else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;null===e.sibling;){if(null===e.return||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(r){case"forwards":for(i=t.child,r=null;null!==i;)null!==(e=i.alternate)&&null===qo(e)&&(r=i),i=i.sibling;null===(i=r)?(r=t.child,t.child=null):(r=i.sibling,i.sibling=null),al(t,!1,r,i,o,n);break;case"backwards":case"unstable_legacy-backwards":for(i=null,r=t.child,t.child=null;null!==r;){if(null!==(e=r.alternate)&&null===qo(e)){t.child=r;break}e=r.sibling,r.sibling=i,i=r,r=e}al(t,!0,i,null,o,n);break;case"together":al(t,!1,null,null,void 0,n);break;default:t.memoizedState=null}return t.child}function ll(e,t,i){if(null!==e&&(t.dependencies=e.dependencies),Cc|=t.lanes,0===(i&t.childLanes)){if(null===e)return null;if(Lr(e,t,i,!1),0===(i&t.childLanes))return null}if(null!==e&&t.child!==e.child)throw Error(n(153));if(null!==t.child){for(i=Gn(e=t.child,e.pendingProps),t.child=i,i.return=t;null!==e.sibling;)e=e.sibling,(i=i.sibling=Gn(e,e.pendingProps)).return=t;i.sibling=null}return t.child}function cl(e,t){return 0!==(e.lanes&t)||!(null===(e=e.dependencies)||!Dr(e))}function ul(e,t,i){if(null!==e)if(e.memoizedProps!==t.pendingProps)Bs=!0;else{if(!(cl(e,i)||128&t.flags))return Bs=!1,function(e,t,i){switch(t.tag){case 3:Q(t,t.stateNode.containerInfo),kr(0,Ur,e.memoizedState.cache),Tr();break;case 27:case 5:ee(t);break;case 4:Q(t,t.stateNode.containerInfo);break;case 10:kr(0,t.type,t.memoizedProps.value);break;case 31:if(null!==t.memoizedState)return t.flags|=128,jo(t),null;break;case 13:var n=t.memoizedState;if(null!==n)return null!==n.dehydrated?(No(t),t.flags|=128,null):0!==(i&t.child.childLanes)?tl(e,t,i):(No(t),null!==(e=ll(e,t,i))?e.sibling:null);No(t);break;case 19:var r=!!(128&e.flags);if((n=0!==(i&t.childLanes))||(Lr(e,t,i,!1),n=0!==(i&t.childLanes)),r){if(n)return sl(e,t,i);t.flags|=128}if(null!==(r=t.memoizedState)&&(r.rendering=null,r.tail=null,r.lastEffect=null),q(Go,Go.current),n)break;return null;case 22:return t.lanes=0,Us(e,t,i,t.pendingProps);case 24:kr(0,Ur,e.memoizedState.cache)}return ll(e,t,i)}(e,t,i);Bs=!!(131072&e.flags)}else Bs=!1,mr&&1048576&t.flags&&cr(t,ir,t.index);switch(t.lanes=0,t.tag){case 16:e:{var r=t.pendingProps;if(e=so(t.elementType),t.type=e,"function"!=typeof e){if(null!=e){var o=e.$$typeof;if(o===M){t.tag=11,t=Ns(null,t,e,r,i);break e}if(o===k){t.tag=14,t=js(null,t,e,r,i);break e}}throw t=F(e)||e,Error(n(306,t,""))}Zn(e)?(r=Es(e,r),t.tag=1,t=Ys(null,t,e,r,i)):(t.tag=0,t=Hs(null,t,e,r,i))}return t;case 0:return Hs(e,t,t.type,t.pendingProps,i);case 1:return Ys(e,t,r=t.type,o=Es(r,t.pendingProps),i);case 3:e:{if(Q(t,t.stateNode.containerInfo),null===e)throw Error(n(387));r=t.pendingProps;var a=t.memoizedState;o=a.element,wo(e,t),ko(t,r,null,i);var s=t.memoizedState;if(r=s.cache,kr(0,Ur,r),r!==a.cache&&Ar(t,[Ur],i,!0),Co(),r=s.element,a.isDehydrated){if(a={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=a,t.memoizedState=a,256&t.flags){t=Ks(e,t,r,i);break e}if(r!==o){Pr(o=Qn(Error(n(424)),t)),t=Ks(e,t,r,i);break e}if(9===(e=t.stateNode.containerInfo).nodeType)e=e.body;else e="HTML"===e.nodeName?e.ownerDocument.body:e;for(fr=Bh(e.firstChild),pr=t,mr=!0,gr=null,_r=!0,i=vo(t,null,r,i),t.child=i;i;)i.flags=-3&i.flags|4096,i=i.sibling}else{if(Tr(),r===o){t=ll(e,t,i);break e}Os(e,t,r,i)}t=t.child}return t;case 26:return Ws(e,t),null===e?(i=Xh(t.type,null,t.pendingProps,null))?t.memoizedState=i:mr||(i=t.type,e=t.pendingProps,(r=xh(Y.current).createElement(i))[qe]=t,r[$e]=e,gh(r,i,e),rt(r),t.stateNode=r):t.memoizedState=Xh(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return ee(t),null===e&&mr&&(r=t.stateNode=Vh(t.type,t.pendingProps,Y.current),pr=t,_r=!0,o=fr,Ih(t.type)?(Oh=o,fr=Bh(r.firstChild)):fr=o),Os(e,t,t.pendingProps.children,i),Ws(e,t),null===e&&(t.flags|=4194304),t.child;case 5:return null===e&&mr&&((o=r=fr)&&(null!==(r=function(e,t,i,n){for(;1===e.nodeType;){var r=i;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!n&&("INPUT"!==e.nodeName||"hidden"!==e.type))break}else if(n){if(!e[Qe])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if("stylesheet"===(o=e.getAttribute("rel"))&&e.hasAttribute("data-precedence"))break;if(o!==r.rel||e.getAttribute("href")!==(null==r.href||""===r.href?null:r.href)||e.getAttribute("crossorigin")!==(null==r.crossOrigin?null:r.crossOrigin)||e.getAttribute("title")!==(null==r.title?null:r.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(((o=e.getAttribute("src"))!==(null==r.src?null:r.src)||e.getAttribute("type")!==(null==r.type?null:r.type)||e.getAttribute("crossorigin")!==(null==r.crossOrigin?null:r.crossOrigin))&&o&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else{if("input"!==t||"hidden"!==e.type)return e;var o=null==r.name?null:""+r.name;if("hidden"===r.type&&e.getAttribute("name")===o)return e}if(null===(e=Bh(e.nextSibling)))break}return null}(r,t.type,t.pendingProps,_r))?(t.stateNode=r,pr=t,fr=Bh(r.firstChild),_r=!1,o=!0):o=!1),o||vr(t)),ee(t),o=t.type,a=t.pendingProps,s=null!==e?e.memoizedProps:null,r=a.children,Th(o,a)?r=null:null!==s&&Th(o,s)&&(t.flags|=32),null!==t.memoizedState&&(o=oa(e,t,la,null,null,i),fd._currentValue=o),Ws(e,t),Os(e,t,r,i),t.child;case 6:return null===e&&mr&&((e=i=fr)&&(null!==(i=function(e,t,i){if(""===t)return null;for(;3!==e.nodeType;){if((1!==e.nodeType||"INPUT"!==e.nodeName||"hidden"!==e.type)&&!i)return null;if(null===(e=Bh(e.nextSibling)))return null}return e}(i,t.pendingProps,_r))?(t.stateNode=i,pr=t,fr=null,e=!0):e=!1),e||vr(t)),null;case 13:return tl(e,t,i);case 4:return Q(t,t.stateNode.containerInfo),r=t.pendingProps,null===e?t.child=yo(t,null,r,i):Os(e,t,r,i),t.child;case 11:return Ns(e,t,t.type,t.pendingProps,i);case 7:return Os(e,t,t.pendingProps,i),t.child;case 8:case 12:return Os(e,t,t.pendingProps.children,i),t.child;case 10:return r=t.pendingProps,kr(0,t.type,r.value),Os(e,t,r.children,i),t.child;case 9:return o=t.type._context,r=t.pendingProps.children,Rr(t),r=r(o=Fr(o)),t.flags|=1,Os(e,t,r,i),t.child;case 14:return js(e,t,t.type,t.pendingProps,i);case 15:return Vs(e,t,t.type,t.pendingProps,i);case 19:return sl(e,t,i);case 31:return function(e,t,i){var r=t.pendingProps,o=!!(128&t.flags);if(t.flags&=-129,null===e){if(mr){if("hidden"===r.mode)return e=qs(t,r),t.lanes=536870912,Zs(null,e);if(jo(t),(e=fr)?null!==(e=null!==(e=Dh(e,_r))&&"&"===e.data?e:null)&&(t.memoizedState={dehydrated:e,treeContext:null!==or?{id:ar,overflow:sr}:null,retryLane:536870912,hydrationErrors:null},(i=Xn(e)).return=t,t.child=i,pr=t,fr=null):e=null,null===e)throw vr(t);return t.lanes=536870912,null}return qs(t,r)}var a=e.memoizedState;if(null!==a){var s=a.dehydrated;if(jo(t),o)if(256&t.flags)t.flags&=-257,t=$s(e,t,i);else{if(null===t.memoizedState)throw Error(n(558));t.child=e.child,t.flags|=128,t=null}else if(Bs||Lr(e,t,i,!1),o=0!==(i&e.childLanes),Bs||o){if(null!==(r=yc)&&0!==(s=Ne(r,i))&&s!==a.retryLane)throw a.retryLane=s,Bn(e,s),Qc(r,e,s),Fs;uu(),t=$s(e,t,i)}else e=a.treeContext,fr=Bh(s.nextSibling),pr=t,mr=!0,gr=null,_r=!1,null!==e&&dr(t,e),(t=qs(t,r)).flags|=4096;return t}return(e=Gn(e.child,{mode:r.mode,children:r.children})).ref=t.ref,t.child=e,e.return=t,e}(e,t,i);case 22:return Us(e,t,i,t.pendingProps);case 24:return Rr(t),r=Fr(Ur),null===e?(null===(o=Qr())&&(o=yc,a=Zr(),o.pooledCache=a,a.refCount++,null!==a&&(o.pooledCacheLanes|=i),o=a),t.memoizedState={parent:r,cache:o},bo(t),kr(0,Ur,o)):(0!==(e.lanes&i)&&(wo(e,t),ko(t,null,null,i),Co()),o=e.memoizedState,a=t.memoizedState,o.parent!==r?(o={parent:r,cache:r},t.memoizedState=o,0===t.lanes&&(t.memoizedState=t.updateQueue.baseState=o),kr(0,Ur,r)):(r=a.cache,kr(0,Ur,r),r!==o.cache&&Ar(t,[Ur],i,!0))),Os(e,t,t.pendingProps.children,i),t.child;case 29:throw t.pendingProps}throw Error(n(156,t.tag))}function hl(e){e.flags|=4}function dl(e,t,i,n,r){if((t=!!(32&e.mode))&&(t=!1),t){if(e.flags|=16777216,(335544128&r)===r)if(e.stateNode.complete)e.flags|=8192;else{if(!su())throw lo=ro,io;e.flags|=8192}}else e.flags&=-16777217}function pl(e,t){if("stylesheet"!==t.type||4&t.state.loading)e.flags&=-16777217;else if(e.flags|=16777216,!ld(t)){if(!su())throw lo=ro,io;e.flags|=8192}}function fl(e,t){null!==t&&(e.flags|=4),16384&e.flags&&(t=22!==e.tag?De():536870912,e.lanes|=t,Ac|=t)}function ml(e,t){if(!mr)switch(e.tailMode){case"hidden":t=e.tail;for(var i=null;null!==t;)null!==t.alternate&&(i=t),t=t.sibling;null===i?e.tail=null:i.sibling=null;break;case"collapsed":i=e.tail;for(var n=null;null!==i;)null!==i.alternate&&(n=i),i=i.sibling;null===n?t||null===e.tail?e.tail=null:e.tail.sibling=null:n.sibling=null}}function gl(e){var t=null!==e.alternate&&e.alternate.child===e.child,i=0,n=0;if(t)for(var r=e.child;null!==r;)i|=r.lanes|r.childLanes,n|=65011712&r.subtreeFlags,n|=65011712&r.flags,r.return=e,r=r.sibling;else for(r=e.child;null!==r;)i|=r.lanes|r.childLanes,n|=r.subtreeFlags,n|=r.flags,r.return=e,r=r.sibling;return e.subtreeFlags|=n,e.childLanes=i,t}function _l(e,t,i){var r=t.pendingProps;switch(hr(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:case 1:return gl(t),null;case 3:return i=t.stateNode,r=null,null!==e&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Ir(Ur),J(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),null!==e&&null!==e.child||(wr(t)?hl(t):null===e||e.memoizedState.isDehydrated&&!(256&t.flags)||(t.flags|=1024,Sr())),gl(t),null;case 26:var o=t.type,a=t.memoizedState;return null===e?(hl(t),null!==a?(gl(t),pl(t,a)):(gl(t),dl(t,o,0,0,i))):a?a!==e.memoizedState?(hl(t),gl(t),pl(t,a)):(gl(t),t.flags&=-16777217):((e=e.memoizedProps)!==r&&hl(t),gl(t),dl(t,o,0,0,i)),null;case 27:if(te(t),i=Y.current,o=t.type,null!==e&&null!=t.stateNode)e.memoizedProps!==r&&hl(t);else{if(!r){if(null===t.stateNode)throw Error(n(166));return gl(t),null}e=H.current,wr(t)?xr(t):(e=Vh(o,r,i),t.stateNode=e,hl(t))}return gl(t),null;case 5:if(te(t),o=t.type,null!==e&&null!=t.stateNode)e.memoizedProps!==r&&hl(t);else{if(!r){if(null===t.stateNode)throw Error(n(166));return gl(t),null}if(a=H.current,wr(t))xr(t);else{var s=xh(Y.current);switch(a){case 1:a=s.createElementNS("http://www.w3.org/2000/svg",o);break;case 2:a=s.createElementNS("http://www.w3.org/1998/Math/MathML",o);break;default:switch(o){case"svg":a=s.createElementNS("http://www.w3.org/2000/svg",o);break;case"math":a=s.createElementNS("http://www.w3.org/1998/Math/MathML",o);break;case"script":(a=s.createElement("div")).innerHTML="<script><\/script>",a=a.removeChild(a.firstChild);break;case"select":a="string"==typeof r.is?s.createElement("select",{is:r.is}):s.createElement("select"),r.multiple?a.multiple=!0:r.size&&(a.size=r.size);break;default:a="string"==typeof r.is?s.createElement(o,{is:r.is}):s.createElement(o)}}a[qe]=t,a[$e]=r;e:for(s=t.child;null!==s;){if(5===s.tag||6===s.tag)a.appendChild(s.stateNode);else if(4!==s.tag&&27!==s.tag&&null!==s.child){s.child.return=s,s=s.child;continue}if(s===t)break e;for(;null===s.sibling;){if(null===s.return||s.return===t)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=a;e:switch(gh(a,o,r),o){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}r&&hl(t)}}return gl(t),dl(t,t.type,null===e||e.memoizedProps,t.pendingProps,i),null;case 6:if(e&&null!=t.stateNode)e.memoizedProps!==r&&hl(t);else{if("string"!=typeof r&&null===t.stateNode)throw Error(n(166));if(e=Y.current,wr(t)){if(e=t.stateNode,i=t.memoizedProps,r=null,null!==(o=pr))switch(o.tag){case 27:case 5:r=o.memoizedProps}e[qe]=t,(e=!!(e.nodeValue===i||null!==r&&!0===r.suppressHydrationWarning||ph(e.nodeValue,i)))||vr(t,!0)}else(e=xh(e).createTextNode(r))[qe]=t,t.stateNode=e}return gl(t),null;case 31:if(i=t.memoizedState,null===e||null!==e.memoizedState){if(r=wr(t),null!==i){if(null===e){if(!r)throw Error(n(318));if(!(e=null!==(e=t.memoizedState)?e.dehydrated:null))throw Error(n(557));e[qe]=t}else Tr(),!(128&t.flags)&&(t.memoizedState=null),t.flags|=4;gl(t),e=!1}else i=Sr(),null!==e&&null!==e.memoizedState&&(e.memoizedState.hydrationErrors=i),e=!0;if(!e)return 256&t.flags?(Zo(t),t):(Zo(t),null);if(128&t.flags)throw Error(n(558))}return gl(t),null;case 13:if(r=t.memoizedState,null===e||null!==e.memoizedState&&null!==e.memoizedState.dehydrated){if(o=wr(t),null!==r&&null!==r.dehydrated){if(null===e){if(!o)throw Error(n(318));if(!(o=null!==(o=t.memoizedState)?o.dehydrated:null))throw Error(n(317));o[qe]=t}else Tr(),!(128&t.flags)&&(t.memoizedState=null),t.flags|=4;gl(t),o=!1}else o=Sr(),null!==e&&null!==e.memoizedState&&(e.memoizedState.hydrationErrors=o),o=!0;if(!o)return 256&t.flags?(Zo(t),t):(Zo(t),null)}return Zo(t),128&t.flags?(t.lanes=i,t):(i=null!==r,e=null!==e&&null!==e.memoizedState,i&&(o=null,null!==(r=t.child).alternate&&null!==r.alternate.memoizedState&&null!==r.alternate.memoizedState.cachePool&&(o=r.alternate.memoizedState.cachePool.pool),a=null,null!==r.memoizedState&&null!==r.memoizedState.cachePool&&(a=r.memoizedState.cachePool.pool),a!==o&&(r.flags|=2048)),i!==e&&i&&(t.child.flags|=8192),fl(t,t.updateQueue),gl(t),null);case 4:return J(),null===e&&nh(t.stateNode.containerInfo),gl(t),null;case 10:return Ir(t.type),gl(t),null;case 19:if(G(Go),null===(r=t.memoizedState))return gl(t),null;if(o=!!(128&t.flags),null===(a=r.rendering))if(o)ml(r,!1);else{if(0!==Ec||null!==e&&128&e.flags)for(e=t.child;null!==e;){if(null!==(a=qo(e))){for(t.flags|=128,ml(r,!1),e=a.updateQueue,t.updateQueue=e,fl(t,e),t.subtreeFlags=0,e=i,i=t.child;null!==i;)qn(i,e),i=i.sibling;return q(Go,1&Go.current|2),mr&&lr(t,r.treeForkCount),t.child}e=e.sibling}null!==r.tail&&de()>Oc&&(t.flags|=128,o=!0,ml(r,!1),t.lanes=4194304)}else{if(!o)if(null!==(e=qo(a))){if(t.flags|=128,o=!0,e=e.updateQueue,t.updateQueue=e,fl(t,e),ml(r,!0),null===r.tail&&"hidden"===r.tailMode&&!a.alternate&&!mr)return gl(t),null}else 2*de()-r.renderingStartTime>Oc&&536870912!==i&&(t.flags|=128,o=!0,ml(r,!1),t.lanes=4194304);r.isBackwards?(a.sibling=t.child,t.child=a):(null!==(e=r.last)?e.sibling=a:t.child=a,r.last=a)}return null!==r.tail?(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=de(),e.sibling=null,i=Go.current,q(Go,o?1&i|2:1&i),mr&&lr(t,r.treeForkCount),e):(gl(t),null);case 22:case 23:return Zo(t),Fo(),r=null!==t.memoizedState,null!==e?null!==e.memoizedState!==r&&(t.flags|=8192):r&&(t.flags|=8192),r?!!(536870912&i)&&!(128&t.flags)&&(gl(t),6&t.subtreeFlags&&(t.flags|=8192)):gl(t),null!==(i=t.updateQueue)&&fl(t,i.retryQueue),i=null,null!==e&&null!==e.memoizedState&&null!==e.memoizedState.cachePool&&(i=e.memoizedState.cachePool.pool),r=null,null!==t.memoizedState&&null!==t.memoizedState.cachePool&&(r=t.memoizedState.cachePool.pool),r!==i&&(t.flags|=2048),null!==e&&G(Kr),null;case 24:return i=null,null!==e&&(i=e.memoizedState.cache),t.memoizedState.cache!==i&&(t.flags|=2048),Ir(Ur),gl(t),null;case 25:case 30:return null}throw Error(n(156,t.tag))}function yl(e,t){switch(hr(t),t.tag){case 1:return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 3:return Ir(Ur),J(),65536&(e=t.flags)&&!(128&e)?(t.flags=-65537&e|128,t):null;case 26:case 27:case 5:return te(t),null;case 31:if(null!==t.memoizedState){if(Zo(t),null===t.alternate)throw Error(n(340));Tr()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 13:if(Zo(t),null!==(e=t.memoizedState)&&null!==e.dehydrated){if(null===t.alternate)throw Error(n(340));Tr()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 19:return G(Go),null;case 4:return J(),null;case 10:return Ir(t.type),null;case 22:case 23:return Zo(t),Fo(),null!==e&&G(Kr),65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 24:return Ir(Ur),null;default:return null}}function vl(e,t){switch(hr(t),t.tag){case 3:Ir(Ur),J();break;case 26:case 27:case 5:te(t);break;case 4:J();break;case 31:null!==t.memoizedState&&Zo(t);break;case 13:Zo(t);break;case 19:G(Go);break;case 10:Ir(t.type);break;case 22:case 23:Zo(t),Fo(),null!==e&&G(Kr);break;case 24:Ir(Ur)}}function xl(e,t){try{var i=t.updateQueue,n=null!==i?i.lastEffect:null;if(null!==n){var r=n.next;i=r;do{if((i.tag&e)===e){n=void 0;var o=i.create,a=i.inst;n=o(),a.destroy=n}i=i.next}while(i!==r)}}catch(s){Eu(t,t.return,s)}}function bl(e,t,i){try{var n=t.updateQueue,r=null!==n?n.lastEffect:null;if(null!==r){var o=r.next;n=o;do{if((n.tag&e)===e){var a=n.inst,s=a.destroy;if(void 0!==s){a.destroy=void 0,r=t;var l=i,c=s;try{c()}catch(u){Eu(r,l,u)}}}n=n.next}while(n!==o)}}catch(u){Eu(t,t.return,u)}}function wl(e){var t=e.updateQueue;if(null!==t){var i=e.stateNode;try{zo(t,i)}catch(n){Eu(e,e.return,n)}}}function Tl(e,t,i){i.props=Es(e.type,e.memoizedProps),i.state=e.memoizedState;try{i.componentWillUnmount()}catch(n){Eu(e,t,n)}}function Sl(e,t){try{var i=e.ref;if(null!==i){switch(e.tag){case 26:case 27:case 5:var n=e.stateNode;break;default:n=e.stateNode}"function"==typeof i?e.refCleanup=i(n):i.current=n}}catch(r){Eu(e,t,r)}}function Pl(e,t){var i=e.ref,n=e.refCleanup;if(null!==i)if("function"==typeof n)try{n()}catch(r){Eu(e,t,r)}finally{e.refCleanup=null,null!=(e=e.alternate)&&(e.refCleanup=null)}else if("function"==typeof i)try{i(null)}catch(o){Eu(e,t,o)}else i.current=null}function Ml(e){var t=e.type,i=e.memoizedProps,n=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":i.autoFocus&&n.focus();break e;case"img":i.src?n.src=i.src:i.srcSet&&(n.srcset=i.srcSet)}}catch(r){Eu(e,e.return,r)}}function El(e,t,i){try{var r=e.stateNode;!function(e,t,i,r){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var o=null,a=null,s=null,l=null,c=null,u=null,h=null;for(f in i){var d=i[f];if(i.hasOwnProperty(f)&&null!=d)switch(f){case"checked":case"value":break;case"defaultValue":c=d;default:r.hasOwnProperty(f)||fh(e,t,f,null,r,d)}}for(var p in r){var f=r[p];if(d=i[p],r.hasOwnProperty(p)&&(null!=f||null!=d))switch(p){case"type":a=f;break;case"name":o=f;break;case"checked":u=f;break;case"defaultChecked":h=f;break;case"value":s=f;break;case"defaultValue":l=f;break;case"children":case"dangerouslySetInnerHTML":if(null!=f)throw Error(n(137,t));break;default:f!==d&&fh(e,t,p,f,r,d)}}return void wt(e,s,l,c,u,h,a,o);case"select":for(a in f=s=l=p=null,i)if(c=i[a],i.hasOwnProperty(a)&&null!=c)switch(a){case"value":break;case"multiple":f=c;default:r.hasOwnProperty(a)||fh(e,t,a,null,r,c)}for(o in r)if(a=r[o],c=i[o],r.hasOwnProperty(o)&&(null!=a||null!=c))switch(o){case"value":p=a;break;case"defaultValue":l=a;break;case"multiple":s=a;default:a!==c&&fh(e,t,o,a,r,c)}return t=l,i=s,r=f,void(null!=p?Pt(e,!!i,p,!1):!!r!=!!i&&(null!=t?Pt(e,!!i,t,!0):Pt(e,!!i,i?[]:"",!1)));case"textarea":for(l in f=p=null,i)if(o=i[l],i.hasOwnProperty(l)&&null!=o&&!r.hasOwnProperty(l))switch(l){case"value":case"children":break;default:fh(e,t,l,null,r,o)}for(s in r)if(o=r[s],a=i[s],r.hasOwnProperty(s)&&(null!=o||null!=a))switch(s){case"value":p=o;break;case"defaultValue":f=o;break;case"children":break;case"dangerouslySetInnerHTML":if(null!=o)throw Error(n(91));break;default:o!==a&&fh(e,t,s,o,r,a)}return void Mt(e,p,f);case"option":for(var m in i)if(p=i[m],i.hasOwnProperty(m)&&null!=p&&!r.hasOwnProperty(m))if("selected"===m)e.selected=!1;else fh(e,t,m,null,r,p);for(c in r)if(p=r[c],f=i[c],r.hasOwnProperty(c)&&p!==f&&(null!=p||null!=f))if("selected"===c)e.selected=p&&"function"!=typeof p&&"symbol"!=typeof p;else fh(e,t,c,p,r,f);return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var g in i)p=i[g],i.hasOwnProperty(g)&&null!=p&&!r.hasOwnProperty(g)&&fh(e,t,g,null,r,p);for(u in r)if(p=r[u],f=i[u],r.hasOwnProperty(u)&&p!==f&&(null!=p||null!=f))switch(u){case"children":case"dangerouslySetInnerHTML":if(null!=p)throw Error(n(137,t));break;default:fh(e,t,u,p,r,f)}return;default:if(At(t)){for(var _ in i)p=i[_],i.hasOwnProperty(_)&&void 0!==p&&!r.hasOwnProperty(_)&&mh(e,t,_,void 0,r,p);for(h in r)p=r[h],f=i[h],!r.hasOwnProperty(h)||p===f||void 0===p&&void 0===f||mh(e,t,h,p,r,f);return}}for(var y in i)p=i[y],i.hasOwnProperty(y)&&null!=p&&!r.hasOwnProperty(y)&&fh(e,t,y,null,r,p);for(d in r)p=r[d],f=i[d],!r.hasOwnProperty(d)||p===f||null==p&&null==f||fh(e,t,d,p,r,f)}(r,e.type,i,t),r[$e]=t}catch(o){Eu(e,e.return,o)}}function Cl(e){return 5===e.tag||3===e.tag||26===e.tag||27===e.tag&&Ih(e.type)||4===e.tag}function kl(e){e:for(;;){for(;null===e.sibling;){if(null===e.return||Cl(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;5!==e.tag&&6!==e.tag&&18!==e.tag;){if(27===e.tag&&Ih(e.type))continue e;if(2&e.flags)continue e;if(null===e.child||4===e.tag)continue e;e.child.return=e,e=e.child}if(!(2&e.flags))return e.stateNode}}function Il(e,t,i){var n=e.tag;if(5===n||6===n)e=e.stateNode,t?(9===i.nodeType?i.body:"HTML"===i.nodeName?i.ownerDocument.body:i).insertBefore(e,t):((t=9===i.nodeType?i.body:"HTML"===i.nodeName?i.ownerDocument.body:i).appendChild(e),null!=(i=i._reactRootContainer)||null!==t.onclick||(t.onclick=Ft));else if(4!==n&&(27===n&&Ih(e.type)&&(i=e.stateNode,t=null),null!==(e=e.child)))for(Il(e,t,i),e=e.sibling;null!==e;)Il(e,t,i),e=e.sibling}function zl(e,t,i){var n=e.tag;if(5===n||6===n)e=e.stateNode,t?i.insertBefore(e,t):i.appendChild(e);else if(4!==n&&(27===n&&Ih(e.type)&&(i=e.stateNode),null!==(e=e.child)))for(zl(e,t,i),e=e.sibling;null!==e;)zl(e,t,i),e=e.sibling}function Al(e){var t=e.stateNode,i=e.memoizedProps;try{for(var n=e.type,r=t.attributes;r.length;)t.removeAttributeNode(r[0]);gh(t,n,i),t[qe]=e,t[$e]=i}catch(o){Eu(e,e.return,o)}}var Ll=!1,Dl=!1,Rl=!1,Fl="function"==typeof WeakSet?WeakSet:Set,Bl=null;function Ol(e,t,i){var n=i.flags;switch(i.tag){case 0:case 11:case 15:Ql(e,i),4&n&&xl(5,i);break;case 1:if(Ql(e,i),4&n)if(e=i.stateNode,null===t)try{e.componentDidMount()}catch(a){Eu(i,i.return,a)}else{var r=Es(i.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(r,t,e.__reactInternalSnapshotBeforeUpdate)}catch(s){Eu(i,i.return,s)}}64&n&&wl(i),512&n&&Sl(i,i.return);break;case 3:if(Ql(e,i),64&n&&null!==(e=i.updateQueue)){if(t=null,null!==i.child)switch(i.child.tag){case 27:case 5:case 1:t=i.child.stateNode}try{zo(e,t)}catch(a){Eu(i,i.return,a)}}break;case 27:null===t&&4&n&&Al(i);case 26:case 5:Ql(e,i),null===t&&4&n&&Ml(i),512&n&&Sl(i,i.return);break;case 12:Ql(e,i);break;case 31:Ql(e,i),4&n&&Gl(e,i);break;case 13:Ql(e,i),4&n&&ql(e,i),64&n&&(null!==(e=i.memoizedState)&&(null!==(e=e.dehydrated)&&function(e,t){var i=e.ownerDocument;if("$~"===e.data)e._reactRetry=t;else if("$?"!==e.data||"loading"!==i.readyState)t();else{var n=function(){t(),i.removeEventListener("DOMContentLoaded",n)};i.addEventListener("DOMContentLoaded",n),e._reactRetry=n}}(e,i=zu.bind(null,i))));break;case 22:if(!(n=null!==i.memoizedState||Ll)){t=null!==t&&null!==t.memoizedState||Dl,r=Ll;var o=Dl;Ll=n,(Dl=t)&&!o?ec(e,i,!!(8772&i.subtreeFlags)):Ql(e,i),Ll=r,Dl=o}break;case 30:break;default:Ql(e,i)}}function Nl(e){var t=e.alternate;null!==t&&(e.alternate=null,Nl(t)),e.child=null,e.deletions=null,e.sibling=null,5===e.tag&&(null!==(t=e.stateNode)&&Je(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var jl=null,Vl=!1;function Ul(e,t,i){for(i=i.child;null!==i;)Zl(e,t,i),i=i.sibling}function Zl(e,t,i){if(we&&"function"==typeof we.onCommitFiberUnmount)try{we.onCommitFiberUnmount(be,i)}catch(o){}switch(i.tag){case 26:Dl||Pl(i,t),Ul(e,t,i),i.memoizedState?i.memoizedState.count--:i.stateNode&&(i=i.stateNode).parentNode.removeChild(i);break;case 27:Dl||Pl(i,t);var n=jl,r=Vl;Ih(i.type)&&(jl=i.stateNode,Vl=!1),Ul(e,t,i),Uh(i.stateNode),jl=n,Vl=r;break;case 5:Dl||Pl(i,t);case 6:if(n=jl,r=Vl,jl=null,Ul(e,t,i),Vl=r,null!==(jl=n))if(Vl)try{(9===jl.nodeType?jl.body:"HTML"===jl.nodeName?jl.ownerDocument.body:jl).removeChild(i.stateNode)}catch(a){Eu(i,t,a)}else try{jl.removeChild(i.stateNode)}catch(a){Eu(i,t,a)}break;case 18:null!==jl&&(Vl?(zh(9===(e=jl).nodeType?e.body:"HTML"===e.nodeName?e.ownerDocument.body:e,i.stateNode),Hd(e)):zh(jl,i.stateNode));break;case 4:n=jl,r=Vl,jl=i.stateNode.containerInfo,Vl=!0,Ul(e,t,i),jl=n,Vl=r;break;case 0:case 11:case 14:case 15:bl(2,i,t),Dl||bl(4,i,t),Ul(e,t,i);break;case 1:Dl||(Pl(i,t),"function"==typeof(n=i.stateNode).componentWillUnmount&&Tl(i,t,n)),Ul(e,t,i);break;case 21:Ul(e,t,i);break;case 22:Dl=(n=Dl)||null!==i.memoizedState,Ul(e,t,i),Dl=n;break;default:Ul(e,t,i)}}function Gl(e,t){if(null===t.memoizedState&&(null!==(e=t.alternate)&&null!==(e=e.memoizedState))){e=e.dehydrated;try{Hd(e)}catch(i){Eu(t,t.return,i)}}}function ql(e,t){if(null===t.memoizedState&&(null!==(e=t.alternate)&&(null!==(e=e.memoizedState)&&null!==(e=e.dehydrated))))try{Hd(e)}catch(i){Eu(t,t.return,i)}}function $l(e,t){var i=function(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return null===t&&(t=e.stateNode=new Fl),t;case 22:return null===(t=(e=e.stateNode)._retryCache)&&(t=e._retryCache=new Fl),t;default:throw Error(n(435,e.tag))}}(e);t.forEach(function(t){if(!i.has(t)){i.add(t);var n=Au.bind(null,e,t);t.then(n,n)}})}function Wl(e,t){var i=t.deletions;if(null!==i)for(var r=0;r<i.length;r++){var o=i[r],a=e,s=t,l=s;e:for(;null!==l;){switch(l.tag){case 27:if(Ih(l.type)){jl=l.stateNode,Vl=!1;break e}break;case 5:jl=l.stateNode,Vl=!1;break e;case 3:case 4:jl=l.stateNode.containerInfo,Vl=!0;break e}l=l.return}if(null===jl)throw Error(n(160));Zl(a,s,o),jl=null,Vl=!1,null!==(a=o.alternate)&&(a.return=null),o.return=null}if(13886&t.subtreeFlags)for(t=t.child;null!==t;)Xl(t,e),t=t.sibling}var Hl=null;function Xl(e,t){var i=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Wl(t,e),Yl(e),4&r&&(bl(3,e,e.return),xl(3,e),bl(5,e,e.return));break;case 1:Wl(t,e),Yl(e),512&r&&(Dl||null===i||Pl(i,i.return)),64&r&&Ll&&(null!==(e=e.updateQueue)&&(null!==(r=e.callbacks)&&(i=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=null===i?r:i.concat(r))));break;case 26:var o=Hl;if(Wl(t,e),Yl(e),512&r&&(Dl||null===i||Pl(i,i.return)),4&r){var a=null!==i?i.memoizedState:null;if(r=e.memoizedState,null===i)if(null===r)if(null===e.stateNode){e:{r=e.type,i=e.memoizedProps,o=o.ownerDocument||o;t:switch(r){case"title":(!(a=o.getElementsByTagName("title")[0])||a[Qe]||a[qe]||"http://www.w3.org/2000/svg"===a.namespaceURI||a.hasAttribute("itemprop"))&&(a=o.createElement(r),o.head.insertBefore(a,o.querySelector("head > title"))),gh(a,r,i),a[qe]=e,rt(a),r=a;break e;case"link":var s=ad("link","href",o).get(r+(i.href||""));if(s)for(var l=0;l<s.length;l++)if((a=s[l]).getAttribute("href")===(null==i.href||""===i.href?null:i.href)&&a.getAttribute("rel")===(null==i.rel?null:i.rel)&&a.getAttribute("title")===(null==i.title?null:i.title)&&a.getAttribute("crossorigin")===(null==i.crossOrigin?null:i.crossOrigin)){s.splice(l,1);break t}gh(a=o.createElement(r),r,i),o.head.appendChild(a);break;case"meta":if(s=ad("meta","content",o).get(r+(i.content||"")))for(l=0;l<s.length;l++)if((a=s[l]).getAttribute("content")===(null==i.content?null:""+i.content)&&a.getAttribute("name")===(null==i.name?null:i.name)&&a.getAttribute("property")===(null==i.property?null:i.property)&&a.getAttribute("http-equiv")===(null==i.httpEquiv?null:i.httpEquiv)&&a.getAttribute("charset")===(null==i.charSet?null:i.charSet)){s.splice(l,1);break t}gh(a=o.createElement(r),r,i),o.head.appendChild(a);break;default:throw Error(n(468,r))}a[qe]=e,rt(a),r=a}e.stateNode=r}else sd(o,e.type,e.stateNode);else e.stateNode=td(o,r,e.memoizedProps);else a!==r?(null===a?null!==i.stateNode&&(i=i.stateNode).parentNode.removeChild(i):a.count--,null===r?sd(o,e.type,e.stateNode):td(o,r,e.memoizedProps)):null===r&&null!==e.stateNode&&El(e,e.memoizedProps,i.memoizedProps)}break;case 27:Wl(t,e),Yl(e),512&r&&(Dl||null===i||Pl(i,i.return)),null!==i&&4&r&&El(e,e.memoizedProps,i.memoizedProps);break;case 5:if(Wl(t,e),Yl(e),512&r&&(Dl||null===i||Pl(i,i.return)),32&e.flags){o=e.stateNode;try{Ct(o,"")}catch(m){Eu(e,e.return,m)}}4&r&&null!=e.stateNode&&El(e,o=e.memoizedProps,null!==i?i.memoizedProps:o),1024&r&&(Rl=!0);break;case 6:if(Wl(t,e),Yl(e),4&r){if(null===e.stateNode)throw Error(n(162));r=e.memoizedProps,i=e.stateNode;try{i.nodeValue=r}catch(m){Eu(e,e.return,m)}}break;case 3:if(od=null,o=Hl,Hl=qh(t.containerInfo),Wl(t,e),Hl=o,Yl(e),4&r&&null!==i&&i.memoizedState.isDehydrated)try{Hd(t.containerInfo)}catch(m){Eu(e,e.return,m)}Rl&&(Rl=!1,Kl(e));break;case 4:r=Hl,Hl=qh(e.stateNode.containerInfo),Wl(t,e),Yl(e),Hl=r;break;case 12:default:Wl(t,e),Yl(e);break;case 31:case 19:Wl(t,e),Yl(e),4&r&&(null!==(r=e.updateQueue)&&(e.updateQueue=null,$l(e,r)));break;case 13:Wl(t,e),Yl(e),8192&e.child.flags&&null!==e.memoizedState!=(null!==i&&null!==i.memoizedState)&&(Fc=de()),4&r&&(null!==(r=e.updateQueue)&&(e.updateQueue=null,$l(e,r)));break;case 22:o=null!==e.memoizedState;var c=null!==i&&null!==i.memoizedState,u=Ll,h=Dl;if(Ll=u||o,Dl=h||c,Wl(t,e),Dl=h,Ll=u,Yl(e),8192&r)e:for(t=e.stateNode,t._visibility=o?-2&t._visibility:1|t._visibility,o&&(null===i||c||Ll||Dl||Jl(e)),i=null,t=e;;){if(5===t.tag||26===t.tag){if(null===i){c=i=t;try{if(a=c.stateNode,o)"function"==typeof(s=a.style).setProperty?s.setProperty("display","none","important"):s.display="none";else{l=c.stateNode;var d=c.memoizedProps.style,p=null!=d&&d.hasOwnProperty("display")?d.display:null;l.style.display=null==p||"boolean"==typeof p?"":(""+p).trim()}}catch(m){Eu(c,c.return,m)}}}else if(6===t.tag){if(null===i){c=t;try{c.stateNode.nodeValue=o?"":c.memoizedProps}catch(m){Eu(c,c.return,m)}}}else if(18===t.tag){if(null===i){c=t;try{var f=c.stateNode;o?Ah(f,!0):Ah(c.stateNode,!1)}catch(m){Eu(c,c.return,m)}}}else if((22!==t.tag&&23!==t.tag||null===t.memoizedState||t===e)&&null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;null===t.sibling;){if(null===t.return||t.return===e)break e;i===t&&(i=null),t=t.return}i===t&&(i=null),t.sibling.return=t.return,t=t.sibling}4&r&&(null!==(r=e.updateQueue)&&(null!==(i=r.retryQueue)&&(r.retryQueue=null,$l(e,i))));case 30:case 21:}}function Yl(e){var t=e.flags;if(2&t){try{for(var i,r=e.return;null!==r;){if(Cl(r)){i=r;break}r=r.return}if(null==i)throw Error(n(160));switch(i.tag){case 27:var o=i.stateNode;zl(e,kl(e),o);break;case 5:var a=i.stateNode;32&i.flags&&(Ct(a,""),i.flags&=-33),zl(e,kl(e),a);break;case 3:case 4:var s=i.stateNode.containerInfo;Il(e,kl(e),s);break;default:throw Error(n(161))}}catch(l){Eu(e,e.return,l)}e.flags&=-3}4096&t&&(e.flags&=-4097)}function Kl(e){if(1024&e.subtreeFlags)for(e=e.child;null!==e;){var t=e;Kl(t),5===t.tag&&1024&t.flags&&t.stateNode.reset(),e=e.sibling}}function Ql(e,t){if(8772&t.subtreeFlags)for(t=t.child;null!==t;)Ol(e,t.alternate,t),t=t.sibling}function Jl(e){for(e=e.child;null!==e;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:bl(4,t,t.return),Jl(t);break;case 1:Pl(t,t.return);var i=t.stateNode;"function"==typeof i.componentWillUnmount&&Tl(t,t.return,i),Jl(t);break;case 27:Uh(t.stateNode);case 26:case 5:Pl(t,t.return),Jl(t);break;case 22:null===t.memoizedState&&Jl(t);break;default:Jl(t)}e=e.sibling}}function ec(e,t,i){for(i=i&&!!(8772&t.subtreeFlags),t=t.child;null!==t;){var n=t.alternate,r=e,o=t,a=o.flags;switch(o.tag){case 0:case 11:case 15:ec(r,o,i),xl(4,o);break;case 1:if(ec(r,o,i),"function"==typeof(r=(n=o).stateNode).componentDidMount)try{r.componentDidMount()}catch(c){Eu(n,n.return,c)}if(null!==(r=(n=o).updateQueue)){var s=n.stateNode;try{var l=r.shared.hiddenCallbacks;if(null!==l)for(r.shared.hiddenCallbacks=null,r=0;r<l.length;r++)Io(l[r],s)}catch(c){Eu(n,n.return,c)}}i&&64&a&&wl(o),Sl(o,o.return);break;case 27:Al(o);case 26:case 5:ec(r,o,i),i&&null===n&&4&a&&Ml(o),Sl(o,o.return);break;case 12:ec(r,o,i);break;case 31:ec(r,o,i),i&&4&a&&Gl(r,o);break;case 13:ec(r,o,i),i&&4&a&&ql(r,o);break;case 22:null===o.memoizedState&&ec(r,o,i),Sl(o,o.return);break;case 30:break;default:ec(r,o,i)}t=t.sibling}}function tc(e,t){var i=null;null!==e&&null!==e.memoizedState&&null!==e.memoizedState.cachePool&&(i=e.memoizedState.cachePool.pool),e=null,null!==t.memoizedState&&null!==t.memoizedState.cachePool&&(e=t.memoizedState.cachePool.pool),e!==i&&(null!=e&&e.refCount++,null!=i&&Gr(i))}function ic(e,t){e=null,null!==t.alternate&&(e=t.alternate.memoizedState.cache),(t=t.memoizedState.cache)!==e&&(t.refCount++,null!=e&&Gr(e))}function nc(e,t,i,n){if(10256&t.subtreeFlags)for(t=t.child;null!==t;)rc(e,t,i,n),t=t.sibling}function rc(e,t,i,n){var r=t.flags;switch(t.tag){case 0:case 11:case 15:nc(e,t,i,n),2048&r&&xl(9,t);break;case 1:case 31:case 13:default:nc(e,t,i,n);break;case 3:nc(e,t,i,n),2048&r&&(e=null,null!==t.alternate&&(e=t.alternate.memoizedState.cache),(t=t.memoizedState.cache)!==e&&(t.refCount++,null!=e&&Gr(e)));break;case 12:if(2048&r){nc(e,t,i,n),e=t.stateNode;try{var o=t.memoizedProps,a=o.id,s=o.onPostCommit;"function"==typeof s&&s(a,null===t.alternate?"mount":"update",e.passiveEffectDuration,-0)}catch(l){Eu(t,t.return,l)}}else nc(e,t,i,n);break;case 23:break;case 22:o=t.stateNode,a=t.alternate,null!==t.memoizedState?2&o._visibility?nc(e,t,i,n):ac(e,t):2&o._visibility?nc(e,t,i,n):(o._visibility|=2,oc(e,t,i,n,!!(10256&t.subtreeFlags)||!1)),2048&r&&tc(a,t);break;case 24:nc(e,t,i,n),2048&r&&ic(t.alternate,t)}}function oc(e,t,i,n,r){for(r=r&&(!!(10256&t.subtreeFlags)||!1),t=t.child;null!==t;){var o=e,a=t,s=i,l=n,c=a.flags;switch(a.tag){case 0:case 11:case 15:oc(o,a,s,l,r),xl(8,a);break;case 23:break;case 22:var u=a.stateNode;null!==a.memoizedState?2&u._visibility?oc(o,a,s,l,r):ac(o,a):(u._visibility|=2,oc(o,a,s,l,r)),r&&2048&c&&tc(a.alternate,a);break;case 24:oc(o,a,s,l,r),r&&2048&c&&ic(a.alternate,a);break;default:oc(o,a,s,l,r)}t=t.sibling}}function ac(e,t){if(10256&t.subtreeFlags)for(t=t.child;null!==t;){var i=e,n=t,r=n.flags;switch(n.tag){case 22:ac(i,n),2048&r&&tc(n.alternate,n);break;case 24:ac(i,n),2048&r&&ic(n.alternate,n);break;default:ac(i,n)}t=t.sibling}}var sc=8192;function lc(e,t,i){if(e.subtreeFlags&sc)for(e=e.child;null!==e;)cc(e,t,i),e=e.sibling}function cc(e,t,i){switch(e.tag){case 26:lc(e,t,i),e.flags&sc&&null!==e.memoizedState&&function(e,t,i,n){if(!("stylesheet"!==i.type||"string"==typeof n.media&&!1===matchMedia(n.media).matches||4&i.state.loading)){if(null===i.instance){var r=Yh(n.href),o=t.querySelector(Kh(r));if(o)return null!==(t=o._p)&&"object"==typeof t&&"function"==typeof t.then&&(e.count++,e=ud.bind(e),t.then(e,e)),i.state.loading|=4,i.instance=o,void rt(o);o=t.ownerDocument||t,n=Qh(n),(r=Zh.get(r))&&nd(n,r),rt(o=o.createElement("link"));var a=o;a._p=new Promise(function(e,t){a.onload=e,a.onerror=t}),gh(o,"link",n),i.instance=o}null===e.stylesheets&&(e.stylesheets=new Map),e.stylesheets.set(i,t),(t=i.state.preload)&&!(3&i.state.loading)&&(e.count++,i=ud.bind(e),t.addEventListener("load",i),t.addEventListener("error",i))}}(i,Hl,e.memoizedState,e.memoizedProps);break;case 5:default:lc(e,t,i);break;case 3:case 4:var n=Hl;Hl=qh(e.stateNode.containerInfo),lc(e,t,i),Hl=n;break;case 22:null===e.memoizedState&&(null!==(n=e.alternate)&&null!==n.memoizedState?(n=sc,sc=16777216,lc(e,t,i),sc=n):lc(e,t,i))}}function uc(e){var t=e.alternate;if(null!==t&&null!==(e=t.child)){t.child=null;do{t=e.sibling,e.sibling=null,e=t}while(null!==e)}}function hc(e){var t=e.deletions;if(16&e.flags){if(null!==t)for(var i=0;i<t.length;i++){var n=t[i];Bl=n,fc(n,e)}uc(e)}if(10256&e.subtreeFlags)for(e=e.child;null!==e;)dc(e),e=e.sibling}function dc(e){switch(e.tag){case 0:case 11:case 15:hc(e),2048&e.flags&&bl(9,e,e.return);break;case 3:case 12:default:hc(e);break;case 22:var t=e.stateNode;null!==e.memoizedState&&2&t._visibility&&(null===e.return||13!==e.return.tag)?(t._visibility&=-3,pc(e)):hc(e)}}function pc(e){var t=e.deletions;if(16&e.flags){if(null!==t)for(var i=0;i<t.length;i++){var n=t[i];Bl=n,fc(n,e)}uc(e)}for(e=e.child;null!==e;){switch((t=e).tag){case 0:case 11:case 15:bl(8,t,t.return),pc(t);break;case 22:2&(i=t.stateNode)._visibility&&(i._visibility&=-3,pc(t));break;default:pc(t)}e=e.sibling}}function fc(e,t){for(;null!==Bl;){var i=Bl;switch(i.tag){case 0:case 11:case 15:bl(8,i,t);break;case 23:case 22:if(null!==i.memoizedState&&null!==i.memoizedState.cachePool){var n=i.memoizedState.cachePool.pool;null!=n&&n.refCount++}break;case 24:Gr(i.memoizedState.cache)}if(null!==(n=i.child))n.return=i,Bl=n;else e:for(i=e;null!==Bl;){var r=(n=Bl).sibling,o=n.return;if(Nl(n),n===i){Bl=null;break e}if(null!==r){r.return=o,Bl=r;break e}Bl=o}}}var mc={getCacheForType:function(e){var t=Fr(Ur),i=t.data.get(e);return void 0===i&&(i=e(),t.data.set(e,i)),i},cacheSignal:function(){return Fr(Ur).controller.signal}},gc="function"==typeof WeakMap?WeakMap:Map,_c=0,yc=null,vc=null,xc=0,bc=0,wc=null,Tc=!1,Sc=!1,Pc=!1,Mc=0,Ec=0,Cc=0,kc=0,Ic=0,zc=0,Ac=0,Lc=null,Dc=null,Rc=!1,Fc=0,Bc=0,Oc=1/0,Nc=null,jc=null,Vc=0,Uc=null,Zc=null,Gc=0,qc=0,$c=null,Wc=null,Hc=0,Xc=null;function Yc(){return 2&_c&&0!==xc?xc&-xc:null!==O.T?$u():Ue()}function Kc(){if(0===zc)if(536870912&xc&&!mr)zc=536870912;else{var e=Ce;!(3932160&(Ce<<=1))&&(Ce=262144),zc=e}return null!==(e=Bo.current)&&(e.flags|=32),zc}function Qc(e,t,i){(e!==yc||2!==bc&&9!==bc)&&null===e.cancelPendingCommit||(ou(e,0),iu(e,xc,zc,!1)),Fe(e,i),2&_c&&e===yc||(e===yc&&(!(2&_c)&&(kc|=i),4===Ec&&iu(e,xc,zc,!1)),Nu(e))}function Jc(e,t,i){if(6&_c)throw Error(n(327));for(var r=!i&&!(127&t)&&0===(t&e.expiredLanes)||Ae(e,t),o=r?function(e,t){var i=_c;_c|=2;var r=lu(),o=cu();yc!==e||xc!==t?(Nc=null,Oc=de()+500,ou(e,t)):Sc=Ae(e,t);e:for(;;)try{if(0!==bc&&null!==vc){t=vc;var a=wc;t:switch(bc){case 1:bc=0,wc=null,gu(e,t,a,1);break;case 2:case 9:if(oo(a)){bc=0,wc=null,mu(t);break}t=function(){2!==bc&&9!==bc||yc!==e||(bc=7),Nu(e)},a.then(t,t);break e;case 3:bc=7;break e;case 4:bc=5;break e;case 7:oo(a)?(bc=0,wc=null,mu(t)):(bc=0,wc=null,gu(e,t,a,7));break;case 5:var s=null;switch(vc.tag){case 26:s=vc.memoizedState;case 5:case 27:var l=vc;if(s?ld(s):l.stateNode.complete){bc=0,wc=null;var c=l.sibling;if(null!==c)vc=c;else{var u=l.return;null!==u?(vc=u,_u(u)):vc=null}break t}}bc=0,wc=null,gu(e,t,a,5);break;case 6:bc=0,wc=null,gu(e,t,a,6);break;case 8:ru(),Ec=6;break e;default:throw Error(n(462))}}pu();break}catch(h){au(e,h)}return Cr=Er=null,O.H=r,O.A=o,_c=i,null!==vc?0:(yc=null,xc=0,Dn(),Ec)}(e,t):hu(e,t,!0),a=r;;){if(0===o){Sc&&!r&&iu(e,t,0,!1);break}if(i=e.current.alternate,!a||tu(i)){if(2===o){if(a=t,e.errorRecoveryDisabledLanes&a)var s=0;else s=0!==(s=-536870913&e.pendingLanes)?s:536870912&s?536870912:0;if(0!==s){t=s;e:{var l=e;o=Lc;var c=l.current.memoizedState.isDehydrated;if(c&&(ou(l,s).flags|=256),2!==(s=hu(l,s,!1))){if(Pc&&!c){l.errorRecoveryDisabledLanes|=a,kc|=a,o=4;break e}a=Dc,Dc=o,null!==a&&(null===Dc?Dc=a:Dc.push.apply(Dc,a))}o=s}if(a=!1,2!==o)continue}}if(1===o){ou(e,0),iu(e,t,0,!0);break}e:{switch(r=e,a=o){case 0:case 1:throw Error(n(345));case 4:if((4194048&t)!==t)break;case 6:iu(r,t,zc,!Tc);break e;case 2:Dc=null;break;case 3:case 5:break;default:throw Error(n(329))}if((62914560&t)===t&&10<(o=Fc+300-de())){if(iu(r,t,zc,!Tc),0!==ze(r,0,!0))break e;Gc=t,r.timeoutHandle=Ph(eu.bind(null,r,i,Dc,Nc,Rc,t,zc,kc,Ac,Tc,a,"Throttled",-0,0),o)}else eu(r,i,Dc,Nc,Rc,t,zc,kc,Ac,Tc,a,null,-0,0)}break}o=hu(e,t,!1),a=!1}Nu(e)}function eu(e,t,i,n,r,o,a,s,l,c,u,h,d,p){if(e.timeoutHandle=-1,8192&(h=t.subtreeFlags)||!(16785408&~h)){cc(t,o,h={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ft});var f=(62914560&o)===o?Fc-de():(4194048&o)===o?Bc-de():0;if(null!==(f=function(e,t){return e.stylesheets&&0===e.count&&dd(e,e.stylesheets),0<e.count||0<e.imgCount?function(i){var n=setTimeout(function(){if(e.stylesheets&&dd(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&0===cd&&(cd=62500*function(){if("function"==typeof performance.getEntriesByType){for(var e=0,t=0,i=performance.getEntriesByType("resource"),n=0;n<i.length;n++){var r=i[n],o=r.transferSize,a=r.initiatorType,s=r.duration;if(o&&s&&_h(a)){for(a=0,s=r.responseEnd,n+=1;n<i.length;n++){var l=i[n],c=l.startTime;if(c>s)break;var u=l.transferSize,h=l.initiatorType;u&&_h(h)&&(a+=u*((l=l.responseEnd)<s?1:(s-c)/(l-c)))}if(--n,t+=8*(o+a)/(r.duration/1e3),10<++e)break}}if(0<e)return t/e/1e6}return navigator.connection&&"number"==typeof(e=navigator.connection.downlink)?e:5}());var r=setTimeout(function(){if(e.waitingForImages=!1,0===e.count&&(e.stylesheets&&dd(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>cd?50:800)+t);return e.unsuspend=i,function(){e.unsuspend=null,clearTimeout(n),clearTimeout(r)}}:null}(h,f)))return Gc=o,e.cancelPendingCommit=f(vu.bind(null,e,t,o,i,n,r,a,s,l,u,h,null,d,p)),void iu(e,o,a,!c)}vu(e,t,o,i,n,r,a,s,l)}function tu(e){for(var t=e;;){var i=t.tag;if((0===i||11===i||15===i)&&16384&t.flags&&(null!==(i=t.updateQueue)&&null!==(i=i.stores)))for(var n=0;n<i.length;n++){var r=i[n],o=r.getSnapshot;r=r.value;try{if(!tn(o(),r))return!1}catch(a){return!1}}if(i=t.child,16384&t.subtreeFlags&&null!==i)i.return=t,t=i;else{if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function iu(e,t,i,n){t&=~Ic,t&=~kc,e.suspendedLanes|=t,e.pingedLanes&=~t,n&&(e.warmLanes|=t),n=e.expirationTimes;for(var r=t;0<r;){var o=31-Se(r),a=1<<o;n[o]=-1,r&=~a}0!==i&&Be(e,i,t)}function nu(){return!!(6&_c)||(ju(0),!1)}function ru(){if(null!==vc){if(0===bc)var e=vc.return;else Cr=Er=null,ha(e=vc),ho=null,po=0,e=vc;for(;null!==e;)vl(e.alternate,e),e=e.return;vc=null}}function ou(e,t){var i=e.timeoutHandle;-1!==i&&(e.timeoutHandle=-1,Mh(i)),null!==(i=e.cancelPendingCommit)&&(e.cancelPendingCommit=null,i()),Gc=0,ru(),yc=e,vc=i=Gn(e.current,null),xc=t,bc=0,wc=null,Tc=!1,Sc=Ae(e,t),Pc=!1,Ac=zc=Ic=kc=Cc=Ec=0,Dc=Lc=null,Rc=!1,8&t&&(t|=32&t);var n=e.entangledLanes;if(0!==n)for(e=e.entanglements,n&=t;0<n;){var r=31-Se(n),o=1<<r;t|=e[r],n&=~o}return Mc=t,Dn(),i}function au(e,t){Wo=null,O.H=vs,t===to||t===no?(t=co(),bc=3):t===io?(t=co(),bc=4):bc=t===Fs?8:null!==t&&"object"==typeof t&&"function"==typeof t.then?6:1,wc=t,null===vc&&(Ec=1,zs(e,Qn(t,e.current)))}function su(){var e=Bo.current;return null===e||((4194048&xc)===xc?null===Oo:!!((62914560&xc)===xc||536870912&xc)&&e===Oo)}function lu(){var e=O.H;return O.H=vs,null===e?vs:e}function cu(){var e=O.A;return O.A=mc,e}function uu(){Ec=4,Tc||(4194048&xc)!==xc&&null!==Bo.current||(Sc=!0),!(134217727&Cc)&&!(134217727&kc)||null===yc||iu(yc,xc,zc,!1)}function hu(e,t,i){var n=_c;_c|=2;var r=lu(),o=cu();yc===e&&xc===t||(Nc=null,ou(e,t)),t=!1;var a=Ec;e:for(;;)try{if(0!==bc&&null!==vc){var s=vc,l=wc;switch(bc){case 8:ru(),a=6;break e;case 3:case 2:case 9:case 6:null===Bo.current&&(t=!0);var c=bc;if(bc=0,wc=null,gu(e,s,l,c),i&&Sc){a=0;break e}break;default:c=bc,bc=0,wc=null,gu(e,s,l,c)}}du(),a=Ec;break}catch(u){au(e,u)}return t&&e.shellSuspendCounter++,Cr=Er=null,_c=n,O.H=r,O.A=o,null===vc&&(yc=null,xc=0,Dn()),a}function du(){for(;null!==vc;)fu(vc)}function pu(){for(;null!==vc&&!ue();)fu(vc)}function fu(e){var t=ul(e.alternate,e,Mc);e.memoizedProps=e.pendingProps,null===t?_u(e):vc=t}function mu(e){var t=e,i=t.alternate;switch(t.tag){case 15:case 0:t=Xs(i,t,t.pendingProps,t.type,void 0,xc);break;case 11:t=Xs(i,t,t.pendingProps,t.type.render,t.ref,xc);break;case 5:ha(t);default:vl(i,t),t=ul(i,t=vc=qn(t,Mc),Mc)}e.memoizedProps=e.pendingProps,null===t?_u(e):vc=t}function gu(e,t,i,r){Cr=Er=null,ha(t),ho=null,po=0;var o=t.return;try{if(function(e,t,i,r,o){if(i.flags|=32768,null!==r&&"object"==typeof r&&"function"==typeof r.then){if(null!==(t=i.alternate)&&Lr(t,i,o,!0),null!==(i=Bo.current)){switch(i.tag){case 31:case 13:return null===Oo?uu():null===i.alternate&&0===Ec&&(Ec=3),i.flags&=-257,i.flags|=65536,i.lanes=o,r===ro?i.flags|=16384:(null===(t=i.updateQueue)?i.updateQueue=new Set([r]):t.add(r),Cu(e,r,o)),!1;case 22:return i.flags|=65536,r===ro?i.flags|=16384:(null===(t=i.updateQueue)?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},i.updateQueue=t):null===(i=t.retryQueue)?t.retryQueue=new Set([r]):i.add(r),Cu(e,r,o)),!1}throw Error(n(435,i.tag))}return Cu(e,r,o),uu(),!1}if(mr)return null!==(t=Bo.current)?(!(65536&t.flags)&&(t.flags|=256),t.flags|=65536,t.lanes=o,r!==yr&&Pr(Qn(e=Error(n(422),{cause:r}),i))):(r!==yr&&Pr(Qn(t=Error(n(423),{cause:r}),i)),(e=e.current.alternate).flags|=65536,o&=-o,e.lanes|=o,r=Qn(r,i),Mo(e,o=Ls(e.stateNode,r,o)),4!==Ec&&(Ec=2)),!1;var a=Error(n(520),{cause:r});if(a=Qn(a,i),null===Lc?Lc=[a]:Lc.push(a),4!==Ec&&(Ec=2),null===t)return!0;r=Qn(r,i),i=t;do{switch(i.tag){case 3:return i.flags|=65536,e=o&-o,i.lanes|=e,Mo(i,e=Ls(i.stateNode,r,e)),!1;case 1:if(t=i.type,a=i.stateNode,!(128&i.flags||"function"!=typeof t.getDerivedStateFromError&&(null===a||"function"!=typeof a.componentDidCatch||null!==jc&&jc.has(a))))return i.flags|=65536,o&=-o,i.lanes|=o,Rs(o=Ds(o),e,i,r),Mo(i,o),!1}i=i.return}while(null!==i);return!1}(e,o,t,i,xc))return Ec=1,zs(e,Qn(i,e.current)),void(vc=null)}catch(a){if(null!==o)throw vc=o,a;return Ec=1,zs(e,Qn(i,e.current)),void(vc=null)}32768&t.flags?(mr||1===r?e=!0:Sc||536870912&xc?e=!1:(Tc=e=!0,(2===r||9===r||3===r||6===r)&&(null!==(r=Bo.current)&&13===r.tag&&(r.flags|=16384))),yu(t,e)):_u(t)}function _u(e){var t=e;do{if(32768&t.flags)return void yu(t,Tc);e=t.return;var i=_l(t.alternate,t,Mc);if(null!==i)return void(vc=i);if(null!==(t=t.sibling))return void(vc=t);vc=t=e}while(null!==t);0===Ec&&(Ec=5)}function yu(e,t){do{var i=yl(e.alternate,e);if(null!==i)return i.flags&=32767,void(vc=i);if(null!==(i=e.return)&&(i.flags|=32768,i.subtreeFlags=0,i.deletions=null),!t&&null!==(e=e.sibling))return void(vc=e);vc=e=i}while(null!==e);Ec=6,vc=null}function vu(e,t,i,r,o,a,s,l,c){e.cancelPendingCommit=null;do{Su()}while(0!==Vc);if(6&_c)throw Error(n(327));if(null!==t){if(t===e.current)throw Error(n(177));if(a=t.lanes|t.childLanes,function(e,t,i,n,r,o){var a=e.pendingLanes;e.pendingLanes=i,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=i,e.entangledLanes&=i,e.errorRecoveryDisabledLanes&=i,e.shellSuspendCounter=0;var s=e.entanglements,l=e.expirationTimes,c=e.hiddenUpdates;for(i=a&~i;0<i;){var u=31-Se(i),h=1<<u;s[u]=0,l[u]=-1;var d=c[u];if(null!==d)for(c[u]=null,u=0;u<d.length;u++){var p=d[u];null!==p&&(p.lane&=-536870913)}i&=~h}0!==n&&Be(e,n,0),0!==o&&0===r&&0!==e.tag&&(e.suspendedLanes|=o&~(a&~t))}(e,i,a|=Ln,s,l,c),e===yc&&(vc=yc=null,xc=0),Zc=t,Uc=e,Gc=i,qc=a,$c=o,Wc=r,10256&t.subtreeFlags||10256&t.flags?(e.callbackNode=null,e.callbackPriority=0,le(ge,function(){return Pu(),null})):(e.callbackNode=null,e.callbackPriority=0),r=!!(13878&t.flags),13878&t.subtreeFlags||r){r=O.T,O.T=null,o=N.p,N.p=2,s=_c,_c|=4;try{!function(e,t){if(e=e.containerInfo,yh=Td,ln(e=sn(e))){if("selectionStart"in e)var i={start:e.selectionStart,end:e.selectionEnd};else e:{var r=(i=(i=e.ownerDocument)&&i.defaultView||window).getSelection&&i.getSelection();if(r&&0!==r.rangeCount){i=r.anchorNode;var o=r.anchorOffset,a=r.focusNode;r=r.focusOffset;try{i.nodeType,a.nodeType}catch(g){i=null;break e}var s=0,l=-1,c=-1,u=0,h=0,d=e,p=null;t:for(;;){for(var f;d!==i||0!==o&&3!==d.nodeType||(l=s+o),d!==a||0!==r&&3!==d.nodeType||(c=s+r),3===d.nodeType&&(s+=d.nodeValue.length),null!==(f=d.firstChild);)p=d,d=f;for(;;){if(d===e)break t;if(p===i&&++u===o&&(l=s),p===a&&++h===r&&(c=s),null!==(f=d.nextSibling))break;p=(d=p).parentNode}d=f}i=-1===l||-1===c?null:{start:l,end:c}}else i=null}i=i||{start:0,end:0}}else i=null;for(vh={focusedElem:e,selectionRange:i},Td=!1,Bl=t;null!==Bl;)if(e=(t=Bl).child,1028&t.subtreeFlags&&null!==e)e.return=t,Bl=e;else for(;null!==Bl;){switch(a=(t=Bl).alternate,e=t.flags,t.tag){case 0:if(4&e&&null!==(e=null!==(e=t.updateQueue)?e.events:null))for(i=0;i<e.length;i++)(o=e[i]).ref.impl=o.nextImpl;break;case 11:case 15:case 5:case 26:case 27:case 6:case 4:case 17:break;case 1:if(1024&e&&null!==a){e=void 0,i=t,o=a.memoizedProps,a=a.memoizedState,r=i.stateNode;try{var m=Es(i.type,o);e=r.getSnapshotBeforeUpdate(m,a),r.__reactInternalSnapshotBeforeUpdate=e}catch(_){Eu(i,i.return,_)}}break;case 3:if(1024&e)if(9===(i=(e=t.stateNode.containerInfo).nodeType))Lh(e);else if(1===i)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Lh(e);break;default:e.textContent=""}break;default:if(1024&e)throw Error(n(163))}if(null!==(e=t.sibling)){e.return=t.return,Bl=e;break}Bl=t.return}}(e,t)}finally{_c=s,N.p=o,O.T=r}}Vc=1,xu(),bu(),wu()}}function xu(){if(1===Vc){Vc=0;var e=Uc,t=Zc,i=!!(13878&t.flags);if(13878&t.subtreeFlags||i){i=O.T,O.T=null;var n=N.p;N.p=2;var r=_c;_c|=4;try{Xl(t,e);var o=vh,a=sn(e.containerInfo),s=o.focusedElem,l=o.selectionRange;if(a!==s&&s&&s.ownerDocument&&an(s.ownerDocument.documentElement,s)){if(null!==l&&ln(s)){var c=l.start,u=l.end;if(void 0===u&&(u=c),"selectionStart"in s)s.selectionStart=c,s.selectionEnd=Math.min(u,s.value.length);else{var h=s.ownerDocument||document,d=h&&h.defaultView||window;if(d.getSelection){var p=d.getSelection(),f=s.textContent.length,m=Math.min(l.start,f),g=void 0===l.end?m:Math.min(l.end,f);!p.extend&&m>g&&(a=g,g=m,m=a);var _=on(s,m),y=on(s,g);if(_&&y&&(1!==p.rangeCount||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==y.node||p.focusOffset!==y.offset)){var v=h.createRange();v.setStart(_.node,_.offset),p.removeAllRanges(),m>g?(p.addRange(v),p.extend(y.node,y.offset)):(v.setEnd(y.node,y.offset),p.addRange(v))}}}}for(h=[],p=s;p=p.parentNode;)1===p.nodeType&&h.push({element:p,left:p.scrollLeft,top:p.scrollTop});for("function"==typeof s.focus&&s.focus(),s=0;s<h.length;s++){var x=h[s];x.element.scrollLeft=x.left,x.element.scrollTop=x.top}}Td=!!yh,vh=yh=null}finally{_c=r,N.p=n,O.T=i}}e.current=t,Vc=2}}function bu(){if(2===Vc){Vc=0;var e=Uc,t=Zc,i=!!(8772&t.flags);if(8772&t.subtreeFlags||i){i=O.T,O.T=null;var n=N.p;N.p=2;var r=_c;_c|=4;try{Ol(e,t.alternate,t)}finally{_c=r,N.p=n,O.T=i}}Vc=3}}function wu(){if(4===Vc||3===Vc){Vc=0,he();var e=Uc,t=Zc,i=Gc,n=Wc;10256&t.subtreeFlags||10256&t.flags?Vc=5:(Vc=0,Zc=Uc=null,Tu(e,e.pendingLanes));var r=e.pendingLanes;if(0===r&&(jc=null),Ve(i),t=t.stateNode,we&&"function"==typeof we.onCommitFiberRoot)try{we.onCommitFiberRoot(be,t,void 0,!(128&~t.current.flags))}catch(l){}if(null!==n){t=O.T,r=N.p,N.p=2,O.T=null;try{for(var o=e.onRecoverableError,a=0;a<n.length;a++){var s=n[a];o(s.value,{componentStack:s.stack})}}finally{O.T=t,N.p=r}}3&Gc&&Su(),Nu(e),r=e.pendingLanes,261930&i&&42&r?e===Xc?Hc++:(Hc=0,Xc=e):Hc=0,ju(0)}}function Tu(e,t){0===(e.pooledCacheLanes&=t)&&(null!=(t=e.pooledCache)&&(e.pooledCache=null,Gr(t)))}function Su(){return xu(),bu(),wu(),Pu()}function Pu(){if(5!==Vc)return!1;var e=Uc,t=qc;qc=0;var i=Ve(Gc),r=O.T,o=N.p;try{N.p=32>i?32:i,O.T=null,i=$c,$c=null;var a=Uc,s=Gc;if(Vc=0,Zc=Uc=null,Gc=0,6&_c)throw Error(n(331));var l=_c;if(_c|=4,dc(a.current),rc(a,a.current,s,i),_c=l,ju(0,!1),we&&"function"==typeof we.onPostCommitFiberRoot)try{we.onPostCommitFiberRoot(be,a)}catch(c){}return!0}finally{N.p=o,O.T=r,Tu(e,t)}}function Mu(e,t,i){t=Qn(i,t),null!==(e=So(e,t=Ls(e.stateNode,t,2),2))&&(Fe(e,2),Nu(e))}function Eu(e,t,i){if(3===e.tag)Mu(e,e,i);else for(;null!==t;){if(3===t.tag){Mu(t,e,i);break}if(1===t.tag){var n=t.stateNode;if("function"==typeof t.type.getDerivedStateFromError||"function"==typeof n.componentDidCatch&&(null===jc||!jc.has(n))){e=Qn(i,e),null!==(n=So(t,i=Ds(2),2))&&(Rs(i,n,t,e),Fe(n,2),Nu(n));break}}t=t.return}}function Cu(e,t,i){var n=e.pingCache;if(null===n){n=e.pingCache=new gc;var r=new Set;n.set(t,r)}else void 0===(r=n.get(t))&&(r=new Set,n.set(t,r));r.has(i)||(Pc=!0,r.add(i),e=ku.bind(null,e,t,i),t.then(e,e))}function ku(e,t,i){var n=e.pingCache;null!==n&&n.delete(t),e.pingedLanes|=e.suspendedLanes&i,e.warmLanes&=~i,yc===e&&(xc&i)===i&&(4===Ec||3===Ec&&(62914560&xc)===xc&&300>de()-Fc?!(2&_c)&&ou(e,0):Ic|=i,Ac===xc&&(Ac=0)),Nu(e)}function Iu(e,t){0===t&&(t=De()),null!==(e=Bn(e,t))&&(Fe(e,t),Nu(e))}function zu(e){var t=e.memoizedState,i=0;null!==t&&(i=t.retryLane),Iu(e,i)}function Au(e,t){var i=0;switch(e.tag){case 31:case 13:var r=e.stateNode,o=e.memoizedState;null!==o&&(i=o.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(n(314))}null!==r&&r.delete(t),Iu(e,i)}var Lu=null,Du=null,Ru=!1,Fu=!1,Bu=!1,Ou=0;function Nu(e){e!==Du&&null===e.next&&(null===Du?Lu=Du=e:Du=Du.next=e),Fu=!0,Ru||(Ru=!0,Ch(function(){6&_c?le(fe,Vu):Uu()}))}function ju(e,t){if(!Bu&&Fu){Bu=!0;do{for(var i=!1,n=Lu;null!==n;){if(0!==e){var r=n.pendingLanes;if(0===r)var o=0;else{var a=n.suspendedLanes,s=n.pingedLanes;o=(1<<31-Se(42|e)+1)-1,o=201326741&(o&=r&~(a&~s))?201326741&o|1:o?2|o:0}0!==o&&(i=!0,qu(n,o))}else o=xc,!(3&(o=ze(n,n===yc?o:0,null!==n.cancelPendingCommit||-1!==n.timeoutHandle)))||Ae(n,o)||(i=!0,qu(n,o));n=n.next}}while(i);Bu=!1}}function Vu(){Uu()}function Uu(){Fu=Ru=!1;var e=0;0!==Ou&&function(){var e=window.event;if(e&&"popstate"===e.type)return e!==Sh&&(Sh=e,!0);return Sh=null,!1}()&&(e=Ou);for(var t=de(),i=null,n=Lu;null!==n;){var r=n.next,o=Zu(n,t);0===o?(n.next=null,null===i?Lu=r:i.next=r,null===r&&(Du=i)):(i=n,(0!==e||3&o)&&(Fu=!0)),n=r}0!==Vc&&5!==Vc||ju(e),0!==Ou&&(Ou=0)}function Zu(e,t){for(var i=e.suspendedLanes,n=e.pingedLanes,r=e.expirationTimes,o=-62914561&e.pendingLanes;0<o;){var a=31-Se(o),s=1<<a,l=r[a];-1===l?0!==(s&i)&&0===(s&n)||(r[a]=Le(s,t)):l<=t&&(e.expiredLanes|=s),o&=~s}if(i=xc,i=ze(e,e===(t=yc)?i:0,null!==e.cancelPendingCommit||-1!==e.timeoutHandle),n=e.callbackNode,0===i||e===t&&(2===bc||9===bc)||null!==e.cancelPendingCommit)return null!==n&&null!==n&&ce(n),e.callbackNode=null,e.callbackPriority=0;if(!(3&i)||Ae(e,i)){if((t=i&-i)===e.callbackPriority)return t;switch(null!==n&&ce(n),Ve(i)){case 2:case 8:i=me;break;case 32:default:i=ge;break;case 268435456:i=ye}return n=Gu.bind(null,e),i=le(i,n),e.callbackPriority=t,e.callbackNode=i,t}return null!==n&&null!==n&&ce(n),e.callbackPriority=2,e.callbackNode=null,2}function Gu(e,t){if(0!==Vc&&5!==Vc)return e.callbackNode=null,e.callbackPriority=0,null;var i=e.callbackNode;if(Su()&&e.callbackNode!==i)return null;var n=xc;return 0===(n=ze(e,e===yc?n:0,null!==e.cancelPendingCommit||-1!==e.timeoutHandle))?null:(Jc(e,n,t),Zu(e,de()),null!=e.callbackNode&&e.callbackNode===i?Gu.bind(null,e):null)}function qu(e,t){if(Su())return null;Jc(e,t,!0)}function $u(){if(0===Ou){var e=Wr;0===e&&(e=Ee,!(261888&(Ee<<=1))&&(Ee=256)),Ou=e}return Ou}function Wu(e){return null==e||"symbol"==typeof e||"boolean"==typeof e?null:"function"==typeof e?e:Rt(""+e)}function Hu(e,t){var i=t.ownerDocument.createElement("input");return i.name=t.name,i.value=t.value,e.id&&i.setAttribute("form",e.id),t.parentNode.insertBefore(i,t),e=new FormData(e),i.parentNode.removeChild(i),e}for(var Xu=0;Xu<Cn.length;Xu++){var Yu=Cn[Xu];kn(Yu.toLowerCase(),"on"+(Yu[0].toUpperCase()+Yu.slice(1)))}kn(xn,"onAnimationEnd"),kn(bn,"onAnimationIteration"),kn(wn,"onAnimationStart"),kn("dblclick","onDoubleClick"),kn("focusin","onFocus"),kn("focusout","onBlur"),kn(Tn,"onTransitionRun"),kn(Sn,"onTransitionStart"),kn(Pn,"onTransitionCancel"),kn(Mn,"onTransitionEnd"),lt("onMouseEnter",["mouseout","mouseover"]),lt("onMouseLeave",["mouseout","mouseover"]),lt("onPointerEnter",["pointerout","pointerover"]),lt("onPointerLeave",["pointerout","pointerover"]),st("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),st("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),st("onBeforeInput",["compositionend","keypress","textInput","paste"]),st("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),st("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),st("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ku="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Qu=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ku));function Ju(e,t){t=!!(4&t);for(var i=0;i<e.length;i++){var n=e[i],r=n.event;n=n.listeners;e:{var o=void 0;if(t)for(var a=n.length-1;0<=a;a--){var s=n[a],l=s.instance,c=s.currentTarget;if(s=s.listener,l!==o&&r.isPropagationStopped())break e;o=s,r.currentTarget=c;try{o(r)}catch(u){In(u)}r.currentTarget=null,o=l}else for(a=0;a<n.length;a++){if(l=(s=n[a]).instance,c=s.currentTarget,s=s.listener,l!==o&&r.isPropagationStopped())break e;o=s,r.currentTarget=c;try{o(r)}catch(u){In(u)}r.currentTarget=null,o=l}}}}function eh(e,t){var i=t[He];void 0===i&&(i=t[He]=new Set);var n=e+"__bubble";i.has(n)||(rh(t,e,2,!1),i.add(n))}function th(e,t,i){var n=0;t&&(n|=4),rh(i,e,n,t)}var ih="_reactListening"+Math.random().toString(36).slice(2);function nh(e){if(!e[ih]){e[ih]=!0,ot.forEach(function(t){"selectionchange"!==t&&(Qu.has(t)||th(t,!1,e),th(t,!0,e))});var t=9===e.nodeType?e:e.ownerDocument;null===t||t[ih]||(t[ih]=!0,th("selectionchange",!1,t))}}function rh(e,t,i,n){switch(Id(t)){case 2:var r=Sd;break;case 8:r=Pd;break;default:r=Md}i=r.bind(null,t,i,e),r=void 0,!$t||"touchstart"!==t&&"touchmove"!==t&&"wheel"!==t||(r=!0),n?void 0!==r?e.addEventListener(t,i,{capture:!0,passive:r}):e.addEventListener(t,i,!0):void 0!==r?e.addEventListener(t,i,{passive:r}):e.addEventListener(t,i,!1)}function oh(e,t,i,n,r){var a=n;if(!(1&t||2&t||null===n))e:for(;;){if(null===n)return;var s=n.tag;if(3===s||4===s){var l=n.stateNode.containerInfo;if(l===r)break;if(4===s)for(s=n.return;null!==s;){var c=s.tag;if((3===c||4===c)&&s.stateNode.containerInfo===r)return;s=s.return}for(;null!==l;){if(null===(s=et(l)))return;if(5===(c=s.tag)||6===c||26===c||27===c){n=a=s;continue e}l=l.parentNode}}n=n.return}Zt(function(){var n=a,r=Ot(i),s=[];e:{var l=En.get(e);if(void 0!==l){var c=ai,u=e;switch(e){case"keypress":if(0===Qt(i))break e;case"keydown":case"keyup":c=bi;break;case"focusin":u="focus",c=di;break;case"focusout":u="blur",c=di;break;case"beforeblur":case"afterblur":c=di;break;case"click":if(2===i.button)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":c=ui;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":c=hi;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":c=Ti;break;case xn:case bn:case wn:c=pi;break;case Mn:c=Si;break;case"scroll":case"scrollend":c=li;break;case"wheel":c=Pi;break;case"copy":case"cut":case"paste":c=fi;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":c=wi;break;case"toggle":case"beforetoggle":c=Mi}var h=!!(4&t),d=!h&&("scroll"===e||"scrollend"===e),p=h?null!==l?l+"Capture":null:l;h=[];for(var f,m=n;null!==m;){var g=m;if(f=g.stateNode,5!==(g=g.tag)&&26!==g&&27!==g||null===f||null===p||null!=(g=Gt(m,p))&&h.push(ah(m,g,f)),d)break;m=m.return}0<h.length&&(l=new c(l,u,null,i,r),s.push({event:l,listeners:h}))}}if(!(7&t)){if(c="mouseout"===e||"pointerout"===e,(!(l="mouseover"===e||"pointerover"===e)||i===Bt||!(u=i.relatedTarget||i.fromElement)||!et(u)&&!u[We])&&(c||l)&&(l=r.window===r?r:(l=r.ownerDocument)?l.defaultView||l.parentWindow:window,c?(c=n,null!==(u=(u=i.relatedTarget||i.toElement)?et(u):null)&&(d=o(u),h=u.tag,u!==d||5!==h&&27!==h&&6!==h)&&(u=null)):(c=null,u=n),c!==u)){if(h=ui,g="onMouseLeave",p="onMouseEnter",m="mouse","pointerout"!==e&&"pointerover"!==e||(h=wi,g="onPointerLeave",p="onPointerEnter",m="pointer"),d=null==c?l:it(c),f=null==u?l:it(u),(l=new h(g,m+"leave",c,i,r)).target=d,l.relatedTarget=f,g=null,et(r)===n&&((h=new h(p,m+"enter",u,i,r)).target=f,h.relatedTarget=d,g=h),d=g,c&&u)e:{for(h=lh,m=u,f=0,g=p=c;g;g=h(g))f++;g=0;for(var _=m;_;_=h(_))g++;for(;0<f-g;)p=h(p),f--;for(;0<g-f;)m=h(m),g--;for(;f--;){if(p===m||null!==m&&p===m.alternate){h=p;break e}p=h(p),m=h(m)}h=null}else h=null;null!==c&&ch(s,l,c,h,!1),null!==u&&null!==d&&ch(s,d,u,h,!0)}if("select"===(c=(l=n?it(n):window).nodeName&&l.nodeName.toLowerCase())||"input"===c&&"file"===l.type)var y=Gi;else if(Oi(l))if(qi)y=en;else{y=Qi;var v=Ki}else!(c=l.nodeName)||"input"!==c.toLowerCase()||"checkbox"!==l.type&&"radio"!==l.type?n&&At(n.elementType)&&(y=Gi):y=Ji;switch(y&&(y=y(e,n))?Ni(s,y,i,r):(v&&v(e,l,n),"focusout"===e&&n&&"number"===l.type&&null!=n.memoizedProps.value&&St(l,"number",l.value)),v=n?it(n):window,e){case"focusin":(Oi(v)||"true"===v.contentEditable)&&(un=v,hn=n,dn=null);break;case"focusout":dn=hn=un=null;break;case"mousedown":pn=!0;break;case"contextmenu":case"mouseup":case"dragend":pn=!1,fn(s,i,r);break;case"selectionchange":if(cn)break;case"keydown":case"keyup":fn(s,i,r)}var x;if(Ci)e:{switch(e){case"compositionstart":var b="onCompositionStart";break e;case"compositionend":b="onCompositionEnd";break e;case"compositionupdate":b="onCompositionUpdate";break e}b=void 0}else Fi?Di(e,i)&&(b="onCompositionEnd"):"keydown"===e&&229===i.keyCode&&(b="onCompositionStart");b&&(zi&&"ko"!==i.locale&&(Fi||"onCompositionStart"!==b?"onCompositionEnd"===b&&Fi&&(x=Kt()):(Xt="value"in(Ht=r)?Ht.value:Ht.textContent,Fi=!0)),0<(v=sh(n,b)).length&&(b=new mi(b,e,null,i,r),s.push({event:b,listeners:v}),x?b.data=x:null!==(x=Ri(i))&&(b.data=x))),(x=Ii?function(e,t){switch(e){case"compositionend":return Ri(t);case"keypress":return 32!==t.which?null:(Li=!0,Ai);case"textInput":return(e=t.data)===Ai&&Li?null:e;default:return null}}(e,i):function(e,t){if(Fi)return"compositionend"===e||!Ci&&Di(e,t)?(e=Kt(),Yt=Xt=Ht=null,Fi=!1,e):null;switch(e){case"paste":default:return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return zi&&"ko"!==t.locale?null:t.data}}(e,i))&&(0<(b=sh(n,"onBeforeInput")).length&&(v=new mi("onBeforeInput","beforeinput",null,i,r),s.push({event:v,listeners:b}),v.data=x)),function(e,t,i,n,r){if("submit"===t&&i&&i.stateNode===r){var o=Wu((r[$e]||null).action),a=n.submitter;a&&null!==(t=(t=a[$e]||null)?Wu(t.formAction):a.getAttribute("formAction"))&&(o=t,a=null);var s=new ai("action","action",null,n,r);e.push({event:s,listeners:[{instance:null,listener:function(){if(n.defaultPrevented){if(0!==Ou){var e=a?Hu(r,a):new FormData(r);os(i,{pending:!0,data:e,method:r.method,action:o},null,e)}}else"function"==typeof o&&(s.preventDefault(),e=a?Hu(r,a):new FormData(r),os(i,{pending:!0,data:e,method:r.method,action:o},o,e))},currentTarget:r}]})}}(s,e,n,i,r)}Ju(s,t)})}function ah(e,t,i){return{instance:e,listener:t,currentTarget:i}}function sh(e,t){for(var i=t+"Capture",n=[];null!==e;){var r=e,o=r.stateNode;if(5!==(r=r.tag)&&26!==r&&27!==r||null===o||(null!=(r=Gt(e,i))&&n.unshift(ah(e,r,o)),null!=(r=Gt(e,t))&&n.push(ah(e,r,o))),3===e.tag)return n;e=e.return}return[]}function lh(e){if(null===e)return null;do{e=e.return}while(e&&5!==e.tag&&27!==e.tag);return e||null}function ch(e,t,i,n,r){for(var o=t._reactName,a=[];null!==i&&i!==n;){var s=i,l=s.alternate,c=s.stateNode;if(s=s.tag,null!==l&&l===n)break;5!==s&&26!==s&&27!==s||null===c||(l=c,r?null!=(c=Gt(i,o))&&a.unshift(ah(i,c,l)):r||null!=(c=Gt(i,o))&&a.push(ah(i,c,l))),i=i.return}0!==a.length&&e.push({event:t,listeners:a})}var uh=/\r\n?/g,hh=/\u0000|\uFFFD/g;function dh(e){return("string"==typeof e?e:""+e).replace(uh,"\n").replace(hh,"")}function ph(e,t){return t=dh(t),dh(e)===t}function fh(e,t,i,r,o,a){switch(i){case"children":"string"==typeof r?"body"===t||"textarea"===t&&""===r||Ct(e,r):("number"==typeof r||"bigint"==typeof r)&&"body"!==t&&Ct(e,""+r);break;case"className":pt(e,"class",r);break;case"tabIndex":pt(e,"tabindex",r);break;case"dir":case"role":case"viewBox":case"width":case"height":pt(e,i,r);break;case"style":zt(e,r,a);break;case"data":if("object"!==t){pt(e,"data",r);break}case"src":case"href":if(""===r&&("a"!==t||"href"!==i)){e.removeAttribute(i);break}if(null==r||"function"==typeof r||"symbol"==typeof r||"boolean"==typeof r){e.removeAttribute(i);break}r=Rt(""+r),e.setAttribute(i,r);break;case"action":case"formAction":if("function"==typeof r){e.setAttribute(i,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}if("function"==typeof a&&("formAction"===i?("input"!==t&&fh(e,t,"name",o.name,o,null),fh(e,t,"formEncType",o.formEncType,o,null),fh(e,t,"formMethod",o.formMethod,o,null),fh(e,t,"formTarget",o.formTarget,o,null)):(fh(e,t,"encType",o.encType,o,null),fh(e,t,"method",o.method,o,null),fh(e,t,"target",o.target,o,null))),null==r||"symbol"==typeof r||"boolean"==typeof r){e.removeAttribute(i);break}r=Rt(""+r),e.setAttribute(i,r);break;case"onClick":null!=r&&(e.onclick=Ft);break;case"onScroll":null!=r&&eh("scroll",e);break;case"onScrollEnd":null!=r&&eh("scrollend",e);break;case"dangerouslySetInnerHTML":if(null!=r){if("object"!=typeof r||!("__html"in r))throw Error(n(61));if(null!=(i=r.__html)){if(null!=o.children)throw Error(n(60));e.innerHTML=i}}break;case"multiple":e.multiple=r&&"function"!=typeof r&&"symbol"!=typeof r;break;case"muted":e.muted=r&&"function"!=typeof r&&"symbol"!=typeof r;break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":case"autoFocus":break;case"xlinkHref":if(null==r||"function"==typeof r||"boolean"==typeof r||"symbol"==typeof r){e.removeAttribute("xlink:href");break}i=Rt(""+r),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",i);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":null!=r&&"function"!=typeof r&&"symbol"!=typeof r?e.setAttribute(i,""+r):e.removeAttribute(i);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":r&&"function"!=typeof r&&"symbol"!=typeof r?e.setAttribute(i,""):e.removeAttribute(i);break;case"capture":case"download":!0===r?e.setAttribute(i,""):!1!==r&&null!=r&&"function"!=typeof r&&"symbol"!=typeof r?e.setAttribute(i,r):e.removeAttribute(i);break;case"cols":case"rows":case"size":case"span":null!=r&&"function"!=typeof r&&"symbol"!=typeof r&&!isNaN(r)&&1<=r?e.setAttribute(i,r):e.removeAttribute(i);break;case"rowSpan":case"start":null==r||"function"==typeof r||"symbol"==typeof r||isNaN(r)?e.removeAttribute(i):e.setAttribute(i,r);break;case"popover":eh("beforetoggle",e),eh("toggle",e),dt(e,"popover",r);break;case"xlinkActuate":ft(e,"http://www.w3.org/1999/xlink","xlink:actuate",r);break;case"xlinkArcrole":ft(e,"http://www.w3.org/1999/xlink","xlink:arcrole",r);break;case"xlinkRole":ft(e,"http://www.w3.org/1999/xlink","xlink:role",r);break;case"xlinkShow":ft(e,"http://www.w3.org/1999/xlink","xlink:show",r);break;case"xlinkTitle":ft(e,"http://www.w3.org/1999/xlink","xlink:title",r);break;case"xlinkType":ft(e,"http://www.w3.org/1999/xlink","xlink:type",r);break;case"xmlBase":ft(e,"http://www.w3.org/XML/1998/namespace","xml:base",r);break;case"xmlLang":ft(e,"http://www.w3.org/XML/1998/namespace","xml:lang",r);break;case"xmlSpace":ft(e,"http://www.w3.org/XML/1998/namespace","xml:space",r);break;case"is":dt(e,"is",r);break;case"innerText":case"textContent":break;default:(!(2<i.length)||"o"!==i[0]&&"O"!==i[0]||"n"!==i[1]&&"N"!==i[1])&&dt(e,i=Lt.get(i)||i,r)}}function mh(e,t,i,r,o,a){switch(i){case"style":zt(e,r,a);break;case"dangerouslySetInnerHTML":if(null!=r){if("object"!=typeof r||!("__html"in r))throw Error(n(61));if(null!=(i=r.__html)){if(null!=o.children)throw Error(n(60));e.innerHTML=i}}break;case"children":"string"==typeof r?Ct(e,r):("number"==typeof r||"bigint"==typeof r)&&Ct(e,""+r);break;case"onScroll":null!=r&&eh("scroll",e);break;case"onScrollEnd":null!=r&&eh("scrollend",e);break;case"onClick":null!=r&&(e.onclick=Ft);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":case"innerText":case"textContent":break;default:at.hasOwnProperty(i)||("o"!==i[0]||"n"!==i[1]||(o=i.endsWith("Capture"),t=i.slice(2,o?i.length-7:void 0),"function"==typeof(a=null!=(a=e[$e]||null)?a[i]:null)&&e.removeEventListener(t,a,o),"function"!=typeof r)?i in e?e[i]=r:!0===r?e.setAttribute(i,""):dt(e,i,r):("function"!=typeof a&&null!==a&&(i in e?e[i]=null:e.hasAttribute(i)&&e.removeAttribute(i)),e.addEventListener(t,r,o)))}}function gh(e,t,i){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":eh("error",e),eh("load",e);var r,o=!1,a=!1;for(r in i)if(i.hasOwnProperty(r)){var s=i[r];if(null!=s)switch(r){case"src":o=!0;break;case"srcSet":a=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(n(137,t));default:fh(e,t,r,s,i,null)}}return a&&fh(e,t,"srcSet",i.srcSet,i,null),void(o&&fh(e,t,"src",i.src,i,null));case"input":eh("invalid",e);var l=r=s=a=null,c=null,u=null;for(o in i)if(i.hasOwnProperty(o)){var h=i[o];if(null!=h)switch(o){case"name":a=h;break;case"type":s=h;break;case"checked":c=h;break;case"defaultChecked":u=h;break;case"value":r=h;break;case"defaultValue":l=h;break;case"children":case"dangerouslySetInnerHTML":if(null!=h)throw Error(n(137,t));break;default:fh(e,t,o,h,i,null)}}return void Tt(e,r,l,c,u,s,a,!1);case"select":for(a in eh("invalid",e),o=s=r=null,i)if(i.hasOwnProperty(a)&&null!=(l=i[a]))switch(a){case"value":r=l;break;case"defaultValue":s=l;break;case"multiple":o=l;default:fh(e,t,a,l,i,null)}return t=r,i=s,e.multiple=!!o,void(null!=t?Pt(e,!!o,t,!1):null!=i&&Pt(e,!!o,i,!0));case"textarea":for(s in eh("invalid",e),r=a=o=null,i)if(i.hasOwnProperty(s)&&null!=(l=i[s]))switch(s){case"value":o=l;break;case"defaultValue":a=l;break;case"children":r=l;break;case"dangerouslySetInnerHTML":if(null!=l)throw Error(n(91));break;default:fh(e,t,s,l,i,null)}return void Et(e,o,a,r);case"option":for(c in i)if(i.hasOwnProperty(c)&&null!=(o=i[c]))if("selected"===c)e.selected=o&&"function"!=typeof o&&"symbol"!=typeof o;else fh(e,t,c,o,i,null);return;case"dialog":eh("beforetoggle",e),eh("toggle",e),eh("cancel",e),eh("close",e);break;case"iframe":case"object":eh("load",e);break;case"video":case"audio":for(o=0;o<Ku.length;o++)eh(Ku[o],e);break;case"image":eh("error",e),eh("load",e);break;case"details":eh("toggle",e);break;case"embed":case"source":case"link":eh("error",e),eh("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(u in i)if(i.hasOwnProperty(u)&&null!=(o=i[u]))switch(u){case"children":case"dangerouslySetInnerHTML":throw Error(n(137,t));default:fh(e,t,u,o,i,null)}return;default:if(At(t)){for(h in i)i.hasOwnProperty(h)&&(void 0!==(o=i[h])&&mh(e,t,h,o,i,void 0));return}}for(l in i)i.hasOwnProperty(l)&&(null!=(o=i[l])&&fh(e,t,l,o,i,null))}function _h(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}var yh=null,vh=null;function xh(e){return 9===e.nodeType?e:e.ownerDocument}function bh(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function wh(e,t){if(0===e)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return 1===e&&"foreignObject"===t?0:e}function Th(e,t){return"textarea"===e||"noscript"===e||"string"==typeof t.children||"number"==typeof t.children||"bigint"==typeof t.children||"object"==typeof t.dangerouslySetInnerHTML&&null!==t.dangerouslySetInnerHTML&&null!=t.dangerouslySetInnerHTML.__html}var Sh=null;var Ph="function"==typeof setTimeout?setTimeout:void 0,Mh="function"==typeof clearTimeout?clearTimeout:void 0,Eh="function"==typeof Promise?Promise:void 0,Ch="function"==typeof queueMicrotask?queueMicrotask:void 0!==Eh?function(e){return Eh.resolve(null).then(e).catch(kh)}:Ph;function kh(e){setTimeout(function(){throw e})}function Ih(e){return"head"===e}function zh(e,t){var i=t,n=0;do{var r=i.nextSibling;if(e.removeChild(i),r&&8===r.nodeType)if("/$"===(i=r.data)||"/&"===i){if(0===n)return e.removeChild(r),void Hd(t);n--}else if("$"===i||"$?"===i||"$~"===i||"$!"===i||"&"===i)n++;else if("html"===i)Uh(e.ownerDocument.documentElement);else if("head"===i){Uh(i=e.ownerDocument.head);for(var o=i.firstChild;o;){var a=o.nextSibling,s=o.nodeName;o[Qe]||"SCRIPT"===s||"STYLE"===s||"LINK"===s&&"stylesheet"===o.rel.toLowerCase()||i.removeChild(o),o=a}}else"body"===i&&Uh(e.ownerDocument.body);i=r}while(i);Hd(t)}function Ah(e,t){var i=e;e=0;do{var n=i.nextSibling;if(1===i.nodeType?t?(i._stashedDisplay=i.style.display,i.style.display="none"):(i.style.display=i._stashedDisplay||"",""===i.getAttribute("style")&&i.removeAttribute("style")):3===i.nodeType&&(t?(i._stashedText=i.nodeValue,i.nodeValue=""):i.nodeValue=i._stashedText||""),n&&8===n.nodeType)if("/$"===(i=n.data)){if(0===e)break;e--}else"$"!==i&&"$?"!==i&&"$~"!==i&&"$!"!==i||e++;i=n}while(i)}function Lh(e){var t=e.firstChild;for(t&&10===t.nodeType&&(t=t.nextSibling);t;){var i=t;switch(t=t.nextSibling,i.nodeName){case"HTML":case"HEAD":case"BODY":Lh(i),Je(i);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if("stylesheet"===i.rel.toLowerCase())continue}e.removeChild(i)}}function Dh(e,t){for(;8!==e.nodeType;){if((1!==e.nodeType||"INPUT"!==e.nodeName||"hidden"!==e.type)&&!t)return null;if(null===(e=Bh(e.nextSibling)))return null}return e}function Rh(e){return"$?"===e.data||"$~"===e.data}function Fh(e){return"$!"===e.data||"$?"===e.data&&"loading"!==e.ownerDocument.readyState}function Bh(e){for(;null!=e;e=e.nextSibling){var t=e.nodeType;if(1===t||3===t)break;if(8===t){if("$"===(t=e.data)||"$!"===t||"$?"===t||"$~"===t||"&"===t||"F!"===t||"F"===t)break;if("/$"===t||"/&"===t)return null}}return e}var Oh=null;function Nh(e){e=e.nextSibling;for(var t=0;e;){if(8===e.nodeType){var i=e.data;if("/$"===i||"/&"===i){if(0===t)return Bh(e.nextSibling);t--}else"$"!==i&&"$!"!==i&&"$?"!==i&&"$~"!==i&&"&"!==i||t++}e=e.nextSibling}return null}function jh(e){e=e.previousSibling;for(var t=0;e;){if(8===e.nodeType){var i=e.data;if("$"===i||"$!"===i||"$?"===i||"$~"===i||"&"===i){if(0===t)return e;t--}else"/$"!==i&&"/&"!==i||t++}e=e.previousSibling}return null}function Vh(e,t,i){switch(t=xh(i),e){case"html":if(!(e=t.documentElement))throw Error(n(452));return e;case"head":if(!(e=t.head))throw Error(n(453));return e;case"body":if(!(e=t.body))throw Error(n(454));return e;default:throw Error(n(451))}}function Uh(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Je(e)}var Zh=new Map,Gh=new Set;function qh(e){return"function"==typeof e.getRootNode?e.getRootNode():9===e.nodeType?e:e.ownerDocument}var $h=N.d;N.d={f:function(){var e=$h.f(),t=nu();return e||t},r:function(e){var t=tt(e);null!==t&&5===t.tag&&"form"===t.type?ss(t):$h.r(e)},D:function(e){$h.D(e),Hh("dns-prefetch",e,null)},C:function(e,t){$h.C(e,t),Hh("preconnect",e,t)},L:function(e,t,i){$h.L(e,t,i);var n=Wh;if(n&&e&&t){var r='link[rel="preload"][as="'+bt(t)+'"]';"image"===t&&i&&i.imageSrcSet?(r+='[imagesrcset="'+bt(i.imageSrcSet)+'"]',"string"==typeof i.imageSizes&&(r+='[imagesizes="'+bt(i.imageSizes)+'"]')):r+='[href="'+bt(e)+'"]';var o=r;switch(t){case"style":o=Yh(e);break;case"script":o=Jh(e)}Zh.has(o)||(e=d({rel:"preload",href:"image"===t&&i&&i.imageSrcSet?void 0:e,as:t},i),Zh.set(o,e),null!==n.querySelector(r)||"style"===t&&n.querySelector(Kh(o))||"script"===t&&n.querySelector(ed(o))||(gh(t=n.createElement("link"),"link",e),rt(t),n.head.appendChild(t)))}},m:function(e,t){$h.m(e,t);var i=Wh;if(i&&e){var n=t&&"string"==typeof t.as?t.as:"script",r='link[rel="modulepreload"][as="'+bt(n)+'"][href="'+bt(e)+'"]',o=r;switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":o=Jh(e)}if(!Zh.has(o)&&(e=d({rel:"modulepreload",href:e},t),Zh.set(o,e),null===i.querySelector(r))){switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(ed(o)))return}gh(n=i.createElement("link"),"link",e),rt(n),i.head.appendChild(n)}}},X:function(e,t){$h.X(e,t);var i=Wh;if(i&&e){var n=nt(i).hoistableScripts,r=Jh(e),o=n.get(r);o||((o=i.querySelector(ed(r)))||(e=d({src:e,async:!0},t),(t=Zh.get(r))&&rd(e,t),rt(o=i.createElement("script")),gh(o,"link",e),i.head.appendChild(o)),o={type:"script",instance:o,count:1,state:null},n.set(r,o))}},S:function(e,t,i){$h.S(e,t,i);var n=Wh;if(n&&e){var r=nt(n).hoistableStyles,o=Yh(e);t=t||"default";var a=r.get(o);if(!a){var s={loading:0,preload:null};if(a=n.querySelector(Kh(o)))s.loading=5;else{e=d({rel:"stylesheet",href:e,"data-precedence":t},i),(i=Zh.get(o))&&nd(e,i);var l=a=n.createElement("link");rt(l),gh(l,"link",e),l._p=new Promise(function(e,t){l.onload=e,l.onerror=t}),l.addEventListener("load",function(){s.loading|=1}),l.addEventListener("error",function(){s.loading|=2}),s.loading|=4,id(a,t,n)}a={type:"stylesheet",instance:a,count:1,state:s},r.set(o,a)}}},M:function(e,t){$h.M(e,t);var i=Wh;if(i&&e){var n=nt(i).hoistableScripts,r=Jh(e),o=n.get(r);o||((o=i.querySelector(ed(r)))||(e=d({src:e,async:!0,type:"module"},t),(t=Zh.get(r))&&rd(e,t),rt(o=i.createElement("script")),gh(o,"link",e),i.head.appendChild(o)),o={type:"script",instance:o,count:1,state:null},n.set(r,o))}}};var Wh="undefined"==typeof document?null:document;function Hh(e,t,i){var n=Wh;if(n&&"string"==typeof t&&t){var r=bt(t);r='link[rel="'+e+'"][href="'+r+'"]',"string"==typeof i&&(r+='[crossorigin="'+i+'"]'),Gh.has(r)||(Gh.add(r),e={rel:e,crossOrigin:i,href:t},null===n.querySelector(r)&&(gh(t=n.createElement("link"),"link",e),rt(t),n.head.appendChild(t)))}}function Xh(e,t,i,r){var o,a,s,l,c=(c=Y.current)?qh(c):null;if(!c)throw Error(n(446));switch(e){case"meta":case"title":return null;case"style":return"string"==typeof i.precedence&&"string"==typeof i.href?(t=Yh(i.href),(r=(i=nt(c).hoistableStyles).get(t))||(r={type:"style",instance:null,count:0,state:null},i.set(t,r)),r):{type:"void",instance:null,count:0,state:null};case"link":if("stylesheet"===i.rel&&"string"==typeof i.href&&"string"==typeof i.precedence){e=Yh(i.href);var u=nt(c).hoistableStyles,h=u.get(e);if(h||(c=c.ownerDocument||c,h={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(e,h),(u=c.querySelector(Kh(e)))&&!u._p&&(h.instance=u,h.state.loading=5),Zh.has(e)||(i={rel:"preload",as:"style",href:i.href,crossOrigin:i.crossOrigin,integrity:i.integrity,media:i.media,hrefLang:i.hrefLang,referrerPolicy:i.referrerPolicy},Zh.set(e,i),u||(o=c,a=e,s=i,l=h.state,o.querySelector('link[rel="preload"][as="style"]['+a+"]")?l.loading=1:(a=o.createElement("link"),l.preload=a,a.addEventListener("load",function(){return l.loading|=1}),a.addEventListener("error",function(){return l.loading|=2}),gh(a,"link",s),rt(a),o.head.appendChild(a))))),t&&null===r)throw Error(n(528,""));return h}if(t&&null!==r)throw Error(n(529,""));return null;case"script":return t=i.async,"string"==typeof(i=i.src)&&t&&"function"!=typeof t&&"symbol"!=typeof t?(t=Jh(i),(r=(i=nt(c).hoistableScripts).get(t))||(r={type:"script",instance:null,count:0,state:null},i.set(t,r)),r):{type:"void",instance:null,count:0,state:null};default:throw Error(n(444,e))}}function Yh(e){return'href="'+bt(e)+'"'}function Kh(e){return'link[rel="stylesheet"]['+e+"]"}function Qh(e){return d({},e,{"data-precedence":e.precedence,precedence:null})}function Jh(e){return'[src="'+bt(e)+'"]'}function ed(e){return"script[async]"+e}function td(e,t,i){if(t.count++,null===t.instance)switch(t.type){case"style":var r=e.querySelector('style[data-href~="'+bt(i.href)+'"]');if(r)return t.instance=r,rt(r),r;var o=d({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return rt(r=(e.ownerDocument||e).createElement("style")),gh(r,"style",o),id(r,i.precedence,e),t.instance=r;case"stylesheet":o=Yh(i.href);var a=e.querySelector(Kh(o));if(a)return t.state.loading|=4,t.instance=a,rt(a),a;r=Qh(i),(o=Zh.get(o))&&nd(r,o),rt(a=(e.ownerDocument||e).createElement("link"));var s=a;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),gh(a,"link",r),t.state.loading|=4,id(a,i.precedence,e),t.instance=a;case"script":return a=Jh(i.src),(o=e.querySelector(ed(a)))?(t.instance=o,rt(o),o):(r=i,(o=Zh.get(a))&&rd(r=d({},i),o),rt(o=(e=e.ownerDocument||e).createElement("script")),gh(o,"link",r),e.head.appendChild(o),t.instance=o);case"void":return null;default:throw Error(n(443,t.type))}else"stylesheet"===t.type&&!(4&t.state.loading)&&(r=t.instance,t.state.loading|=4,id(r,i.precedence,e));return t.instance}function id(e,t,i){for(var n=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),r=n.length?n[n.length-1]:null,o=r,a=0;a<n.length;a++){var s=n[a];if(s.dataset.precedence===t)o=s;else if(o!==r)break}o?o.parentNode.insertBefore(e,o.nextSibling):(t=9===i.nodeType?i.head:i).insertBefore(e,t.firstChild)}function nd(e,t){null==e.crossOrigin&&(e.crossOrigin=t.crossOrigin),null==e.referrerPolicy&&(e.referrerPolicy=t.referrerPolicy),null==e.title&&(e.title=t.title)}function rd(e,t){null==e.crossOrigin&&(e.crossOrigin=t.crossOrigin),null==e.referrerPolicy&&(e.referrerPolicy=t.referrerPolicy),null==e.integrity&&(e.integrity=t.integrity)}var od=null;function ad(e,t,i){if(null===od){var n=new Map,r=od=new Map;r.set(i,n)}else(n=(r=od).get(i))||(n=new Map,r.set(i,n));if(n.has(e))return n;for(n.set(e,null),i=i.getElementsByTagName(e),r=0;r<i.length;r++){var o=i[r];if(!(o[Qe]||o[qe]||"link"===e&&"stylesheet"===o.getAttribute("rel"))&&"http://www.w3.org/2000/svg"!==o.namespaceURI){var a=o.getAttribute(t)||"";a=e+a;var s=n.get(a);s?s.push(o):n.set(a,[o])}}return n}function sd(e,t,i){(e=e.ownerDocument||e).head.insertBefore(i,"title"===t?e.querySelector("head > title"):null)}function ld(e){return!!("stylesheet"!==e.type||3&e.state.loading)}var cd=0;function ud(){if(this.count--,0===this.count&&(0===this.imgCount||!this.waitingForImages))if(this.stylesheets)dd(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}var hd=null;function dd(e,t){e.stylesheets=null,null!==e.unsuspend&&(e.count++,hd=new Map,t.forEach(pd,e),hd=null,ud.call(e))}function pd(e,t){if(!(4&t.state.loading)){var i=hd.get(e);if(i)var n=i.get(null);else{i=new Map,hd.set(e,i);for(var r=e.querySelectorAll("link[data-precedence],style[data-precedence]"),o=0;o<r.length;o++){var a=r[o];"LINK"!==a.nodeName&&"not all"===a.getAttribute("media")||(i.set(a.dataset.precedence,a),n=a)}n&&i.set(null,n)}a=(r=t.instance).getAttribute("data-precedence"),(o=i.get(a)||n)===n&&i.set(null,r),i.set(a,r),this.count++,n=ud.bind(this),r.addEventListener("load",n),r.addEventListener("error",n),o?o.parentNode.insertBefore(r,o.nextSibling):(e=9===e.nodeType?e.head:e).insertBefore(r,e.firstChild),t.state.loading|=4}}var fd={$$typeof:P,Provider:null,Consumer:null,_currentValue:j,_currentValue2:j,_threadCount:0};function md(e,t,i,n,r,o,a,s,l){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Re(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Re(0),this.hiddenUpdates=Re(null),this.identifierPrefix=n,this.onUncaughtError=r,this.onCaughtError=o,this.onRecoverableError=a,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=l,this.incompleteTransitions=new Map}function gd(e,t,i,n,r,o,a,s,l,c,u,h){return e=new md(e,t,i,a,l,c,u,h,s),t=1,!0===o&&(t|=24),o=Un(3,null,null,t),e.current=o,o.stateNode=e,(t=Zr()).refCount++,e.pooledCache=t,t.refCount++,o.memoizedState={element:n,isDehydrated:i,cache:t},bo(o),e}function _d(e){return e?e=jn:jn}function yd(e,t,i,n,r,o){r=_d(r),null===n.context?n.context=r:n.pendingContext=r,(n=To(t)).payload={element:i},null!==(o=void 0===o?null:o)&&(n.callback=o),null!==(i=So(e,n,t))&&(Qc(i,0,t),Po(i,e,t))}function vd(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var i=e.retryLane;e.retryLane=0!==i&&i<t?i:t}}function xd(e,t){vd(e,t),(e=e.alternate)&&vd(e,t)}function bd(e){if(13===e.tag||31===e.tag){var t=Bn(e,67108864);null!==t&&Qc(t,0,67108864),xd(e,67108864)}}function wd(e){if(13===e.tag||31===e.tag){var t=Yc(),i=Bn(e,t=je(t));null!==i&&Qc(i,0,t),xd(e,t)}}var Td=!0;function Sd(e,t,i,n){var r=O.T;O.T=null;var o=N.p;try{N.p=2,Md(e,t,i,n)}finally{N.p=o,O.T=r}}function Pd(e,t,i,n){var r=O.T;O.T=null;var o=N.p;try{N.p=8,Md(e,t,i,n)}finally{N.p=o,O.T=r}}function Md(e,t,i,n){if(Td){var r=Ed(n);if(null===r)oh(e,t,n,Cd,i),Nd(e,n);else if(function(e,t,i,n,r){switch(t){case"focusin":return Ad=jd(Ad,e,t,i,n,r),!0;case"dragenter":return Ld=jd(Ld,e,t,i,n,r),!0;case"mouseover":return Dd=jd(Dd,e,t,i,n,r),!0;case"pointerover":var o=r.pointerId;return Rd.set(o,jd(Rd.get(o)||null,e,t,i,n,r)),!0;case"gotpointercapture":return o=r.pointerId,Fd.set(o,jd(Fd.get(o)||null,e,t,i,n,r)),!0}return!1}(r,e,t,i,n))n.stopPropagation();else if(Nd(e,n),4&t&&-1<Od.indexOf(e)){for(;null!==r;){var o=tt(r);if(null!==o)switch(o.tag){case 3:if((o=o.stateNode).current.memoizedState.isDehydrated){var a=Ie(o.pendingLanes);if(0!==a){var s=o;for(s.pendingLanes|=2,s.entangledLanes|=2;a;){var l=1<<31-Se(a);s.entanglements[1]|=l,a&=~l}Nu(o),!(6&_c)&&(Oc=de()+500,ju(0))}}break;case 31:case 13:null!==(s=Bn(o,2))&&Qc(s,0,2),nu(),xd(o,2)}if(null===(o=Ed(n))&&oh(e,t,n,Cd,i),o===r)break;r=o}null!==r&&n.stopPropagation()}else oh(e,t,n,null,i)}}function Ed(e){return kd(e=Ot(e))}var Cd=null;function kd(e){if(Cd=null,null!==(e=et(e))){var t=o(e);if(null===t)e=null;else{var i=t.tag;if(13===i){if(null!==(e=a(t)))return e;e=null}else if(31===i){if(null!==(e=l(t)))return e;e=null}else if(3===i){if(t.stateNode.current.memoizedState.isDehydrated)return 3===t.tag?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Cd=e,null}function Id(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(pe()){case fe:return 2;case me:return 8;case ge:case _e:return 32;case ye:return 268435456;default:return 32}default:return 32}}var zd=!1,Ad=null,Ld=null,Dd=null,Rd=new Map,Fd=new Map,Bd=[],Od="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Nd(e,t){switch(e){case"focusin":case"focusout":Ad=null;break;case"dragenter":case"dragleave":Ld=null;break;case"mouseover":case"mouseout":Dd=null;break;case"pointerover":case"pointerout":Rd.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Fd.delete(t.pointerId)}}function jd(e,t,i,n,r,o){return null===e||e.nativeEvent!==o?(e={blockedOn:t,domEventName:i,eventSystemFlags:n,nativeEvent:o,targetContainers:[r]},null!==t&&(null!==(t=tt(t))&&bd(t)),e):(e.eventSystemFlags|=n,t=e.targetContainers,null!==r&&-1===t.indexOf(r)&&t.push(r),e)}function Vd(e){var t=et(e.target);if(null!==t){var i=o(t);if(null!==i)if(13===(t=i.tag)){if(null!==(t=a(i)))return e.blockedOn=t,void Ze(e.priority,function(){wd(i)})}else if(31===t){if(null!==(t=l(i)))return e.blockedOn=t,void Ze(e.priority,function(){wd(i)})}else if(3===t&&i.stateNode.current.memoizedState.isDehydrated)return void(e.blockedOn=3===i.tag?i.stateNode.containerInfo:null)}e.blockedOn=null}function Ud(e){if(null!==e.blockedOn)return!1;for(var t=e.targetContainers;0<t.length;){var i=Ed(e.nativeEvent);if(null!==i)return null!==(t=tt(i))&&bd(t),e.blockedOn=i,!1;var n=new(i=e.nativeEvent).constructor(i.type,i);Bt=n,i.target.dispatchEvent(n),Bt=null,t.shift()}return!0}function Zd(e,t,i){Ud(e)&&i.delete(t)}function Gd(){zd=!1,null!==Ad&&Ud(Ad)&&(Ad=null),null!==Ld&&Ud(Ld)&&(Ld=null),null!==Dd&&Ud(Dd)&&(Dd=null),Rd.forEach(Zd),Fd.forEach(Zd)}function qd(t,i){t.blockedOn===i&&(t.blockedOn=null,zd||(zd=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,Gd)))}var $d=null;function Wd(t){$d!==t&&($d=t,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){$d===t&&($d=null);for(var e=0;e<t.length;e+=3){var i=t[e],n=t[e+1],r=t[e+2];if("function"!=typeof n){if(null===kd(n||i))continue;break}var o=tt(i);null!==o&&(t.splice(e,3),e-=3,os(o,{pending:!0,data:r,method:i.method,action:n},n,r))}}))}function Hd(e){function t(t){return qd(t,e)}null!==Ad&&qd(Ad,e),null!==Ld&&qd(Ld,e),null!==Dd&&qd(Dd,e),Rd.forEach(t),Fd.forEach(t);for(var i=0;i<Bd.length;i++){var n=Bd[i];n.blockedOn===e&&(n.blockedOn=null)}for(;0<Bd.length&&null===(i=Bd[0]).blockedOn;)Vd(i),null===i.blockedOn&&Bd.shift();if(null!=(i=(e.ownerDocument||e).$$reactFormReplay))for(n=0;n<i.length;n+=3){var r=i[n],o=i[n+1],a=r[$e]||null;if("function"==typeof o)a||Wd(i);else if(a){var s=null;if(o&&o.hasAttribute("formAction")){if(r=o,a=o[$e]||null)s=a.formAction;else if(null!==kd(r))continue}else s=a.action;"function"==typeof s?i[n+1]=s:(i.splice(n,3),n-=3),Wd(i)}}}function Xd(){function e(e){e.canIntercept&&"react-transition"===e.info&&e.intercept({handler:function(){return new Promise(function(e){return r=e})},focusReset:"manual",scroll:"manual"})}function t(){null!==r&&(r(),r=null),n||setTimeout(i,20)}function i(){if(!n&&!navigation.transition){var e=navigation.currentEntry;e&&null!=e.url&&navigation.navigate(e.url,{state:e.getState(),info:"react-transition",history:"replace"})}}if("object"==typeof navigation){var n=!1,r=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(i,100),function(){n=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),null!==r&&(r(),r=null)}}}function Yd(e){this._internalRoot=e}function Kd(e){this._internalRoot=e}Kd.prototype.render=Yd.prototype.render=function(e){var t=this._internalRoot;if(null===t)throw Error(n(409));yd(t.current,Yc(),e,t,null,null)},Kd.prototype.unmount=Yd.prototype.unmount=function(){var e=this._internalRoot;if(null!==e){this._internalRoot=null;var t=e.containerInfo;yd(e.current,2,null,e,null,null),nu(),t[We]=null}},Kd.prototype.unstable_scheduleHydration=function(e){if(e){var t=Ue();e={blockedOn:null,target:e,priority:t};for(var i=0;i<Bd.length&&0!==t&&t<Bd[i].priority;i++);Bd.splice(i,0,e),0===i&&Vd(e)}};var Qd=t.version;if("19.2.3"!==Qd)throw Error(n(527,Qd,"19.2.3"));N.findDOMNode=function(e){var t=e._reactInternals;if(void 0===t){if("function"==typeof e.render)throw Error(n(188));throw e=Object.keys(e).join(","),Error(n(268,e))}return e=function(e){var t=e.alternate;if(!t){if(null===(t=o(e)))throw Error(n(188));return t!==e?null:e}for(var i=e,r=t;;){var a=i.return;if(null===a)break;var s=a.alternate;if(null===s){if(null!==(r=a.return)){i=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===i)return c(a),e;if(s===r)return c(a),t;s=s.sibling}throw Error(n(188))}if(i.return!==r.return)i=a,r=s;else{for(var l=!1,u=a.child;u;){if(u===i){l=!0,i=a,r=s;break}if(u===r){l=!0,r=a,i=s;break}u=u.sibling}if(!l){for(u=s.child;u;){if(u===i){l=!0,i=s,r=a;break}if(u===r){l=!0,r=s,i=a;break}u=u.sibling}if(!l)throw Error(n(189))}}if(i.alternate!==r)throw Error(n(190))}if(3!==i.tag)throw Error(n(188));return i.stateNode.current===i?e:t}(t),e=null===(e=null!==e?h(e):null)?null:e.stateNode};var Jd={bundleType:0,version:"19.2.3",rendererPackageName:"react-dom",currentDispatcherRef:O,reconcilerVersion:"19.2.3"};if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__){var ep=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ep.isDisabled&&ep.supportsFiber)try{be=ep.inject(Jd),we=ep}catch(ip){}}return s.createRoot=function(e,t){if(!r(e))throw Error(n(299));var i=!1,o="",a=Cs,s=ks,l=Is;return null!=t&&(!0===t.unstable_strictMode&&(i=!0),void 0!==t.identifierPrefix&&(o=t.identifierPrefix),void 0!==t.onUncaughtError&&(a=t.onUncaughtError),void 0!==t.onCaughtError&&(s=t.onCaughtError),void 0!==t.onRecoverableError&&(l=t.onRecoverableError)),t=gd(e,1,!1,null,0,i,o,null,a,s,l,Xd),e[We]=t.current,nh(e),new Yd(t)},s.hydrateRoot=function(e,t,i){if(!r(e))throw Error(n(299));var o=!1,a="",s=Cs,l=ks,c=Is,u=null;return null!=i&&(!0===i.unstable_strictMode&&(o=!0),void 0!==i.identifierPrefix&&(a=i.identifierPrefix),void 0!==i.onUncaughtError&&(s=i.onUncaughtError),void 0!==i.onCaughtError&&(l=i.onCaughtError),void 0!==i.onRecoverableError&&(c=i.onRecoverableError),void 0!==i.formState&&(u=i.formState)),(t=gd(e,1,!0,t,0,o,a,u,s,l,c,Xd)).context=_d(null),i=t.current,(a=To(o=je(o=Yc()))).callback=null,So(i,a,o),i=o,t.current.lanes=i,Fe(t,i),Nu(t),e[We]=t.current,nh(e),new Kd(t)},s.version="19.2.3",s}var P=(x||(x=1,function e(){if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){}}(),a.exports=S()),a.exports),M=g();const E=n(M);var C,k,I={exports:{}},z={};var A=(k||(k=1,I.exports=function(){if(C)return z;C=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function i(t,i,n){var r=null;if(void 0!==n&&(r=""+n),void 0!==i.key&&(r=""+i.key),"key"in i)for(var o in n={},i)"key"!==o&&(n[o]=i[o]);else n=i;return i=n.ref,{$$typeof:e,type:t,key:r,ref:void 0!==i?i:null,props:n}}return z.Fragment=t,z.jsx=i,z.jsxs=i,z}()),I.exports);const D=class e{constructor(t,n){i(this,"locale"),i(this,"translations"),i(this,"fallback"),i(this,"listeners",new Set),i(this,"customTranslations",{}),this.fallback=e.bundledTranslations.de,this.locale=t||this.detectLocale(),this.customTranslations=n||{},this.translations=this.fallback,this.updateTranslations()}updateTranslations(){const t=e.bundledTranslations[this.locale]||this.fallback,i=this.customTranslations[this.locale]||{};this.translations=this.deepMerge(t,i)}deepMerge(e,t){const i=e=>e&&"object"==typeof e&&!Array.isArray(e),n={...e};return i(e)&&i(t)&&Object.keys(t).forEach(r=>{i(t[r])?r in e?n[r]=this.deepMerge(e[r],t[r]):Object.assign(n,{[r]:t[r]}):Object.assign(n,{[r]:t[r]})}),n}detectLocale(){if("undefined"==typeof window)return"de";const e=new URLSearchParams(window.location.search).get("lang");if(e&&this.isSupported(e))return e;const t=navigator.language?.split("-")[0];return t&&this.isSupported(t)?t:"de"}isSupported(e){return["de","fr","it","en"].includes(e)}t(e,t){const i=e.split(".");let n=this.translations,r=this.fallback;for(const a of i)n=n?.[a],r=r?.[a];const o=("string"==typeof n?n:r)||e;return t?o.replace(/\{(\w+)\}/g,(e,i)=>t[i]?.toString()??`{${i}}`):o}setLocale(e){this.isSupported(e)||(e="de"),this.locale=e,this.updateTranslations(),this.listeners.forEach(t=>t(e))}getLocale(){return this.locale}onLocaleChange(e){return this.listeners.add(e),()=>this.listeners.delete(e)}getSupportedLocales(){return[{code:"de",name:"Deutsch"},{code:"fr",name:"Français"},{code:"it",name:"Italiano"},{code:"en",name:"English"}]}};i(D,"bundledTranslations",{de:{search:{placeholder:"Adresse oder Perimeter suchen...",loading:"Suche...",noResults:"Keine Ergebnisse gefunden",error:"Suche fehlgeschlagen. Bitte versuchen Sie es erneut.",clear:"Suche löschen",resultsCount:"{count} Ergebnisse gefunden",groups:{addresses:"Adressen",perimeters:"Fernwärmeperimeter"}},accessibility:{searchLabel:"Adresse oder Perimeter suchen"},layers:{toggle:"Kartenebenen",baseLayers:"Grundkarten",overlays:"Ebenen",noOverlays:"Keine Ebenen verfügbar",opacity:"Transparenz",osm:{standard:"OpenStreetMap",humanitarian:"OSM Humanitarian",topo:"OpenTopoMap"},swisstopo:{color:"Swisstopo Farbe",grey:"Swisstopo Grau",satellite:"Luftbild",cadastral:"Amtliche Vermessung",streets:"Strassenverzeichnis",addresses:"Gebäudeadressen",vectorLight:"Beschriftungen (hell)",vectorDark:"Beschriftungen (dunkel)"}}},fr:{search:{placeholder:"Rechercher une adresse ou un périmètre...",loading:"Recherche...",noResults:"Aucun résultat trouvé",error:"Échec de la recherche. Veuillez réessayer.",clear:"Effacer la recherche",resultsCount:"{count} résultats trouvés",groups:{addresses:"Adresses",perimeters:"Périmètres de chauffage à distance"}},accessibility:{searchLabel:"Rechercher une adresse ou un périmètre"}},it:{search:{placeholder:"Cerca indirizzo...",loading:"Caricamento...",noResults:"Nessun risultato"}},en:{search:{placeholder:"Search address...",loading:"Loading...",noResults:"No results"}}});let R=D;class F{constructor(e,t){i(this,"baseUrl"),i(this,"token"),this.baseUrl=e,this.token=t}async search(e,t={}){if(!e||e.length<2)return[];const i=new FormData;i.append("searchtext",e),t.districts?.length&&i.append("districts",t.districts.join(","));try{const e=await fetch(`${this.baseUrl}/api/searchaddress`,{method:"POST",headers:{Authorization:`Bearer ${this.token}`},body:i,signal:t.signal});if(!e.ok)throw new B(`Search failed: ${e.status}`,e.status);const n=await e.json(),r=new Set,o=n.rows||[],a=new Map;for(const t of o){const e=t.fields?.id||t.id;e&&!isNaN(Number(e))&&(r.add(Number(e)),(t.match||t.fields?.match)&&a.set(Number(e),t.match||t.fields.match))}const s=Array.from(r).map(e=>this.getById(e,t.signal));return(await Promise.all(s)).filter(e=>null!==e).map(e=>{const t=a.get(e.id);return t&&e.raw?{...e,raw:{...e.raw,match:t}}:e})}catch(n){if(n instanceof Error&&"AbortError"===n.name)return[];throw n}}async searchAdvanced(e,t={}){if(!e||e.length<2)return[];const i=new FormData;i.append("searchtext",e);try{const e=await fetch(`${this.baseUrl}/api/searchaddress-advanced`,{method:"POST",headers:{Authorization:`Bearer ${this.token}`},body:i,signal:t.signal});if(!e.ok)throw new B(`Advanced search failed: ${e.status}`,e.status);return((await e.json()).rows||[]).map(e=>{const t=this.transformAddress(e.fields||e);return e.match&&t.raw&&(t.raw={...t.raw,match:e.match}),t})}catch(n){if(n instanceof Error&&"AbortError"===n.name)return[];throw n}}async getById(e,t){try{const i=await fetch(`${this.baseUrl}/api/marketsense/addresspoint-by-addressid/${e}`,{headers:{Authorization:`Bearer ${this.token}`,"Content-Type":"application/json"},signal:t});if(!i.ok){if(404===i.status)return null;throw new B(`Failed to get address: ${i.status}`,i.status)}const n=await i.json();return n&&n[0]?this.transformAddress(n[0]):null}catch(i){if(i instanceof Error&&"AbortError"===i.name)return null;throw i}}async getByCoordinates(e,t,i){try{const n=await fetch(`${this.baseUrl}/api/marketsense/addresspoints-by-coordinates/${t}/${e}`,{headers:{Authorization:`Bearer ${this.token}`,"Content-Type":"application/json"},signal:i});if(!n.ok)return null;const r=await n.json();return r&&Array.isArray(r)&&0!==r.length?this.transformAddress(r[0]):null}catch(n){if(n instanceof Error&&"AbortError"===n.name)return null;throw n}}async getInPolygon(e,t){try{const i=await fetch(`${this.baseUrl}/api/addresses-in-polygon`,{method:"POST",headers:{Authorization:`Bearer ${this.token}`,"Content-Type":"application/json"},body:JSON.stringify({geometry:e}),signal:t});if(!i.ok)throw new B(`Polygon search failed: ${i.status}`,i.status);return(await i.json()||[]).map(e=>this.transformAddress(e))}catch(i){if(i instanceof Error&&"AbortError"===i.name)return[];throw i}}transformAddress(e){const t=e.fields||e;let i=Number(t.lat||e.lat)||0,n=Number(t.long||t.lng||e.lng||e.long)||0;if(0===i&&0===n){const r=t.lat_long||e.lat_long;if(r&&"string"==typeof r){const e=r.split(";");2===e.length&&(i=Number(e[0])||0,n=Number(e[1])||0)}}return{id:Number(t.id||e.id),label:this.buildLabel(e),street:t.street||t.strname||"",houseNumber:t.houseNumber||t.deinr||t.house_number||t.nr||t.housenumber||"",zip:t.swissZipCode||t.plz||t.zip||"",town:t.town||t.gdename||t.city||"",coordinates:[i,n],raw:e}}buildLabel(e){const t=e.fields||e,i=t.street||t.strname||"",n=t.houseNumber||t.deinr||t.house_number||t.nr||t.housenumber||"",r=t.swissZipCode||t.plz||t.zip||"",o=t.town||t.gdename||t.city||"",a=[[i,n].filter(Boolean).join(" "),[r,o].filter(Boolean).join(" ")].filter(Boolean).join(", ");return a||!t.address&&!t.strname_deinr?a:t.address||t.strname_deinr}}class B extends Error{constructor(e,t){super(e),i(this,"statusCode"),this.statusCode=t,this.name="AddressServiceError"}}class O{constructor(e,t){i(this,"baseUrl"),i(this,"token"),i(this,"perimetersCache",null),i(this,"fetchPromise",null),this.baseUrl=e,this.token=t}async getAll(){return this.perimetersCache?this.perimetersCache:(this.fetchPromise||(this.fetchPromise=(async()=>{try{const e=await fetch(`${this.baseUrl}/api/marketsense/fw-perimeter-all-centroid`,{headers:{Authorization:`Bearer ${this.token}`,"Content-Type":"application/json"}});if(!e.ok)throw new Error(`Failed to fetch perimeters: ${e.status}`);const t=await e.json();return this.perimetersCache=t.filter(e=>e.lat&&e.long).map(e=>({id:`${e.lat}-${e.long}`,name:e.perimeter||"Unknown Perimeter",properties:{description:e.description},centroid:[e.lat,e.long],geometry:{type:"Point",coordinates:[e.long,e.lat]}})),this.perimetersCache||[]}catch(e){return[]}finally{this.fetchPromise=null}})()),this.fetchPromise)}async search(e){if(!e)return[];const t=await this.getAll(),i=e.toLowerCase();return t.filter(e=>e.name.toLowerCase().includes(i))}async getById(e){if(this.perimetersCache){const t=this.perimetersCache.find(t=>t.id===e);if(t)return t}return(await this.getAll()).find(t=>t.id===e)||null}async getClosest(e,t,i=.1){const n=await this.getAll();let r=null,o=1/0;for(const a of n){const[n,s]=a.centroid,l=this.getDistanceFromLatLonInKm(e,t,n,s);l<i&&l<o&&(o=l,r=a)}return r}getDistanceFromLatLonInKm(e,t,i,n){var r=this.deg2rad(i-e),o=this.deg2rad(n-t),a=Math.sin(r/2)*Math.sin(r/2)+Math.cos(this.deg2rad(e))*Math.cos(this.deg2rad(i))*Math.sin(o/2)*Math.sin(o/2);return 6371*(2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a)))}deg2rad(e){return e*(Math.PI/180)}}class N{constructor(e,t){i(this,"clientId"),this.clientId=t}async evaluateDecisionTree(e){return{clientId:this.clientId,context:"multi",selection:e,result:{allowed:!0}}}}const j=e=>{let t;const i=new Set,n=(e,n)=>{const r="function"==typeof e?e(t):e;if(!Object.is(r,t)){const e=t;t=(null!=n?n:"object"!=typeof r||null===r)?r:Object.assign({},t,r),i.forEach(i=>i(t,e))}},r=()=>t,o={setState:n,getState:r,getInitialState:()=>a,subscribe:e=>(i.add(e),()=>i.delete(e))},a=t=e(n,r,o);return o},V=e=>e;const U=e=>{const t=(e=>e?j(e):j)(e),i=e=>function(e,t=V){const i=E.useSyncExternalStore(e.subscribe,E.useCallback(()=>t(e.getState()),[e,t]),E.useCallback(()=>t(e.getInitialState()),[e,t]));return E.useDebugValue(i),i}(t,e);return Object.assign(i,t),i},Z=e=>(t,i,n)=>{const r=n.subscribe;n.subscribe=(e,t,i)=>{let o=e;if(t){const r=(null==i?void 0:i.equalityFn)||Object.is;let a=e(n.getState());o=i=>{const n=e(i);if(!r(a,n)){const e=a;t(a=n,e)}},(null==i?void 0:i.fireImmediately)&&t(a,a)}return r(o)};return e(t,i,n)},G=(e=1/0)=>{return(t?U(t):U)(Z((t,i)=>({items:new Map,maxItems:e,add:e=>{const n=q(e);return!i().items.has(n)&&(1===i().maxItems&&i().items.size>=1?(t({items:new Map([[n,e]])}),!0):!(i().items.size>=i().maxItems)&&(t(t=>{const i=new Map(t.items);return i.set(n,e),{items:i}}),!0))},remove:e=>{t(t=>{const i=new Map(t.items);return i.delete(e),{items:i}})},clear:()=>t({items:new Map}),toggle:e=>{const t=q(e);i().has(t)?i().remove(t):i().add(e)},has:e=>i().items.has(e),getAll:()=>Array.from(i().items.values()),getAddresses:()=>i().getAll().filter(e=>"address"===e.type).map(e=>e.data),getPerimeters:()=>i().getAll().filter(e=>"perimeter"===e.type).map(e=>e.data),count:()=>i().items.size,isFull:()=>i().items.size>=i().maxItems})));var t};function q(e){return"address"===e.type?`addr-${e.data.id}`:`perim-${e.data.id}`}const $=M.createContext(null);function W({config:e,children:t}){const[i,n]=M.useState(null),[r,o]=M.useState(null),[a,s]=M.useState(e.language||"de"),{i18n:l,services:c,selectionStore:u}=M.useMemo(()=>{const t=new R(e.language,e.translations),i=e.apiUrl||"https://services.swissenergyplanning.ch",n={address:new F(i,e.token||""),perimeter:new O(i,e.token||""),config:new N(i,e.clientId)},r="object"==typeof e.features?.multiSelect?e.features.multiSelect.maxSelections:!0===e.features?.multiSelect?void 0:1;return{i18n:t,services:n,selectionStore:G(r)}},[e.clientId,e.apiUrl,e.token,e.language,e.features?.multiSelect]),h=M.useCallback(e=>{l.setLocale(e),s(e)},[l]),d=M.useCallback((e,t)=>l.t(e,t),[l,a]),p=M.useMemo(()=>({config:e,services:c,i18n:l,locale:a,setLocale:h,t:d,selectionStore:u,map:i,setMap:n,layerManager:r,setLayerManager:o}),[e,c,l,a,h,d,u,i,r]);return A.jsx($.Provider,{value:p,children:t})}function H(){const e=M.useContext($);if(!e)throw new Error("useSEPMap must be used within a SEPMapProvider");return e}function X(){const{t:e,locale:t,setLocale:i,i18n:n}=H();return{t:e,locale:t,setLocale:i,supportedLocales:n.getSupportedLocales()}}function Y(){const{map:e,setMap:t}=H();return{map:e,setMap:t}}const K=M.memo(function({type:e,item:t,isHighlighted:i,onClick:n,onMouseEnter:r,renderChip:o}){const a="address"===e,s=a?t:null,l=a?null:t;let c="address",u="Adresse";if(l)c="region",u="Region";else if(s?.raw){const e=s.raw.match;"egid"===e?(c="egid",u="EGID"):"egrid"===e?(c="egrid",u="EGRID"):"parz_nr"!==e&&"parcel"!==e&&"egaid"!==e||(c="parcel",u="Parzell")}return A.jsxs("button",{type:"button",className:"sep-search-item "+(i?"sep-search-item--highlighted":""),onClick:n,onMouseEnter:r,role:"option","aria-selected":i,children:[A.jsxs("span",{className:"sep-search-item__content",children:[A.jsx("span",{className:"sep-search-item__label",children:s?.label||l?.name}),l?.properties?.description&&A.jsx("span",{className:"sep-search-item__description",children:l.properties.description})]}),o?o(t,c):A.jsx("span",{className:`sep-search-chip sep-search-chip--${c}`,children:u})]})}),Q=M.memo(function({results:e,isLoading:t,error:i,highlightedIndex:n,onSelectAddress:r,onSelectPerimeter:o,onHighlight:a}){const{t:s,config:l}=H(),c=M.useRef(null),u=M.useRef(null),h=l?.features?.search?.renderResultChip;if(M.useEffect(()=>{if(u.current&&c.current){const e=c.current,t=u.current,i=e.getBoundingClientRect(),n=t.getBoundingClientRect();(n.bottom>i.bottom||n.top<i.top)&&t.scrollIntoView({block:"nearest",behavior:"smooth"})}},[n]),t)return A.jsx("div",{className:"sep-search-results",children:A.jsxs("div",{className:"sep-search-status sep-search-status--loading",children:[A.jsx("span",{className:"sep-search-spinner","aria-hidden":"true"}),A.jsx("span",{children:s("search.loading")})]})});if(i)return A.jsx("div",{className:"sep-search-results",children:A.jsxs("div",{className:"sep-search-status sep-search-status--error",role:"alert",children:[A.jsx("span",{className:"sep-search-error-icon","aria-hidden":"true",children:"⚠️"}),A.jsx("span",{children:s("search.error")})]})});if(e&&0===e.addresses.length&&0===e.perimeters.length)return A.jsx("div",{className:"sep-search-results",children:A.jsx("div",{className:"sep-search-status sep-search-status--empty",children:s("search.noResults")})});if(!e)return null;let d=0;return A.jsxs("div",{ref:c,className:"sep-search-results",role:"listbox",children:[e.addresses.length>0&&A.jsxs("div",{className:"sep-search-group",children:[A.jsxs("div",{className:"sep-search-group__header",children:[s("search.groups.addresses")," (",e.addresses.length,")"]}),e.addresses.map(e=>{const t=d++,i=t===n;return A.jsx("div",{ref:i?u:void 0,children:A.jsx(K,{type:"address",item:e,isHighlighted:i,onClick:()=>r(e),onMouseEnter:()=>a(t),renderChip:h})},`addr-${e.id}`)})]}),e.perimeters.length>0&&A.jsxs("div",{className:"sep-search-group",children:[A.jsxs("div",{className:"sep-search-group__header",children:[s("search.groups.perimeters")," (",e.perimeters.length,")"]}),e.perimeters.map(e=>{const t=d++,i=t===n;return A.jsx("div",{ref:i?u:void 0,children:A.jsx(K,{type:"perimeter",item:e,isHighlighted:i,onClick:()=>o(e),onMouseEnter:()=>a(t),renderChip:h})},`perim-${e.id}`)})]})]})});function J({onSelect:e,onPerimeterSelect:t,placement:i="top-left",placeholder:n,className:r="",includePerimeters:o=!0,autoFocus:a=!1,value:s,onChange:l,style:c}){const{t:u}=X(),h=M.useRef(null),d=M.useRef(null),{query:p,setQuery:f,results:m,isLoading:g,error:_,isOpen:y,highlightedIndex:v,clear:x,open:b,close:w,highlightNext:T,highlightPrev:S,selectHighlighted:P,totalResults:E,flatResults:C}=function(e={}){const{debounceMs:t=300,minQueryLength:i=2,includePerimeters:n=!0}=e,{services:r,config:o}=H(),[a,s]=M.useState(""),[l,c]=M.useState(null),[u,h]=M.useState(!1),[d,p]=M.useState(null),[f,m]=M.useState(!1),[g,_]=M.useState(-1),y=M.useRef(null),v=M.useRef(null);M.useEffect(()=>()=>{y.current&&clearTimeout(y.current),v.current?.abort()},[]);const x=M.useCallback(()=>{if(!l)return[];const e=[];return l.addresses.forEach(t=>{e.push({type:"address",item:t})}),l.perimeters.forEach(t=>{e.push({type:"perimeter",item:t})}),e},[l]),b=l?l.addresses.length+l.perimeters.length:0;M.useEffect(()=>{o.features?.search?.prefetchPerimeters&&o.features.perimeterSelection&&r.perimeter.getAll().catch(console.error)},[o.features?.search?.prefetchPerimeters,o.features?.perimeterSelection,r.perimeter]);const w=M.useCallback(async e=>{if(v.current?.abort(),e.length<i)return c(null),void p(null);v.current=new AbortController;const t=v.current.signal;h(!0),p(null),_(-1);const a=o.features?.search,s=a?.mode||"all";try{const i=[Promise.resolve([]),Promise.resolve([])];if("all"===s||"normal"===s||"advanced"===s){const n={signal:t,districts:a?.districts};i[0]="advanced"===s||"all"===s?r.address.searchAdvanced(e,n):r.address.search(e,n)}("all"===s||"perimeter"===s)&&n&&o.features?.perimeterSelection&&(i[1]=r.perimeter.search(e));const[l,u]=await Promise.all(i);if(t.aborted)return;c({addresses:l,perimeters:u}),m(!0)}catch(l){if(l instanceof Error&&"AbortError"===l.name)return;p(l instanceof Error?l.message:"Search failed"),c(null)}finally{v.current?.signal.aborted||h(!1)}},[r,o.features,n,i]),T=M.useCallback(e=>new Promise(i=>{y.current&&clearTimeout(y.current),y.current=setTimeout(async()=>{await w(e),i()},t)}),[w,t]),S=M.useCallback(e=>{s(e),T(e)},[T]),P=M.useCallback(()=>{s(""),c(null),p(null),m(!1),_(-1),v.current?.abort()},[]),E=M.useCallback(()=>{(l||a.length>=i)&&m(!0)},[l,a,i]),C=M.useCallback(()=>{m(!1),_(-1)},[]),k=M.useCallback(()=>{const e=x();0!==e.length&&_(t=>{const i=t+1;return i>=e.length?0:i})},[x]),I=M.useCallback(()=>{const e=x();0!==e.length&&_(t=>{const i=t-1;return i<0?e.length-1:i})},[x]),z=M.useCallback(()=>{const e=x();return g<0||g>=e.length?null:e[g].item},[x,g]);return{query:a,results:l,isLoading:u,error:d,isOpen:f,highlightedIndex:g,setQuery:S,search:w,clear:P,open:E,close:C,highlightNext:k,highlightPrev:I,selectHighlighted:z,totalResults:b,flatResults:x()}}({includePerimeters:o}),k=void 0!==s,I=k?s:p,z=M.useCallback(e=>{const t=e.target.value;k&&l?.(t),f(t)},[k,l,f]),L=M.useCallback(()=>{(I.length>=2||m)&&b()},[I,m,b]);M.useEffect(()=>{const e=e=>{d.current&&!d.current.contains(e.target)&&w()};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[w]),M.useEffect(()=>{a&&h.current&&h.current.focus()},[a]);const D=M.useCallback(t=>{k?l?.(t.label):f(t.label),w(),e(t),h.current?.blur()},[k,l,f,w,e]),R=M.useCallback(e=>{k?l?.(e.name):f(e.name),w(),t?.(e),h.current?.blur()},[k,l,f,w,t]),F=M.useCallback(e=>{switch(e.key){case"ArrowDown":e.preventDefault(),!y&&I.length>=2?b():T();break;case"ArrowUp":e.preventDefault(),S();break;case"Enter":if(e.preventDefault(),y&&v>=0){const e=P();if(e){"address"===C[v].type?D(e):R(e)}}break;case"Escape":e.preventDefault(),y?w():(x(),h.current?.blur());break;case"Tab":w()}},[y,I,v,b,w,x,T,S,P,C,D,R]),B=M.useCallback(()=>{x(),k&&l?.(""),h.current?.focus()},[x,k,l]),O=M.useCallback(e=>{},[]),N="external"!==i?`sep-search--${i}`:"";return A.jsxs("div",{ref:d,className:`sep-search ${N} ${r}`.trim(),style:c,role:"combobox","aria-expanded":y,"aria-haspopup":"listbox","aria-owns":"sep-search-results",children:[A.jsxs("div",{className:"sep-search__input-container",children:[A.jsx("span",{className:"sep-search__icon","aria-hidden":"true",children:A.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[A.jsx("circle",{cx:"11",cy:"11",r:"8"}),A.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]})}),A.jsx("input",{ref:h,type:"text",className:"sep-search__input",placeholder:n||u("search.placeholder"),value:I,onChange:z,onFocus:L,onKeyDown:F,"aria-label":u("accessibility.searchLabel"),"aria-autocomplete":"list","aria-controls":"sep-search-results","aria-activedescendant":v>=0?`sep-search-item-${v}`:void 0,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:"false"}),g&&A.jsx("span",{className:"sep-search__spinner","aria-hidden":"true",children:A.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",className:"sep-search__spinner-icon",children:A.jsx("circle",{cx:"12",cy:"12",r:"10",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeDasharray:"32",strokeLinecap:"round"})})}),I&&!g&&A.jsx("button",{type:"button",className:"sep-search__clear",onClick:B,"aria-label":u("search.clear")||"Clear search",children:A.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[A.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),A.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),y&&A.jsx("div",{id:"sep-search-results",className:"sep-search__dropdown",children:A.jsx(Q,{results:m,isLoading:g,error:_,highlightedIndex:v,onSelectAddress:D,onSelectPerimeter:R,onHighlight:O})}),y&&E>0&&A.jsx("div",{className:"sr-only",role:"status","aria-live":"polite",children:u("search.resultsCount",{count:E})})]})}const ee=M.createContext(null);var te,ie={exports:{}};var ne=(te||(te=1,function(e){var t="1.9.4";function i(e){var t,i,n,r;for(i=1,n=arguments.length;i<n;i++)for(t in r=arguments[i])e[t]=r[t];return e}var n=Object.create||function(){function e(){}return function(t){return e.prototype=t,new e}}();function r(e,t){var i=Array.prototype.slice;if(e.bind)return e.bind.apply(e,i.call(arguments,1));var n=i.call(arguments,2);return function(){return e.apply(t,n.length?n.concat(i.call(arguments)):arguments)}}var o=0;function a(e){return"_leaflet_id"in e||(e._leaflet_id=++o),e._leaflet_id}function s(e,t,i){var n,r,o,a;return a=function(){n=!1,r&&(o.apply(i,r),r=!1)},o=function(){n?r=arguments:(e.apply(i,arguments),setTimeout(a,t),n=!0)},o}function l(e,t,i){var n=t[1],r=t[0],o=n-r;return e===n&&i?e:((e-r)%o+o)%o+r}function c(){return!1}function u(e,t){if(!1===t)return e;var i=Math.pow(10,void 0===t?6:t);return Math.round(e*i)/i}function h(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function d(e){return h(e).split(/\s+/)}function p(e,t){for(var i in Object.prototype.hasOwnProperty.call(e,"options")||(e.options=e.options?n(e.options):{}),t)e.options[i]=t[i];return e.options}function f(e,t,i){var n=[];for(var r in e)n.push(encodeURIComponent(i?r.toUpperCase():r)+"="+encodeURIComponent(e[r]));return(t&&-1!==t.indexOf("?")?"&":"?")+n.join("&")}var m=/\{ *([\w_ -]+) *\}/g;function g(e,t){return e.replace(m,function(e,i){var n=t[i];if(void 0===n)throw new Error("No value provided for variable "+e);return"function"==typeof n&&(n=n(t)),n})}var _=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function y(e,t){for(var i=0;i<e.length;i++)if(e[i]===t)return i;return-1}var v="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=";function x(e){return window["webkit"+e]||window["moz"+e]||window["ms"+e]}var b=0;function w(e){var t=+new Date,i=Math.max(0,16-(t-b));return b=t+i,window.setTimeout(e,i)}var T=window.requestAnimationFrame||x("RequestAnimationFrame")||w,S=window.cancelAnimationFrame||x("CancelAnimationFrame")||x("CancelRequestAnimationFrame")||function(e){window.clearTimeout(e)};function P(e,t,i){if(!i||T!==w)return T.call(window,r(e,t));e.call(t)}function M(e){e&&S.call(window,e)}var E={__proto__:null,extend:i,create:n,bind:r,get lastId(){return o},stamp:a,throttle:s,wrapNum:l,falseFn:c,formatNum:u,trim:h,splitWords:d,setOptions:p,getParamString:f,template:g,isArray:_,indexOf:y,emptyImageUrl:v,requestFn:T,cancelFn:S,requestAnimFrame:P,cancelAnimFrame:M};function C(){}function k(e){if("undefined"!=typeof L&&L&&L.Mixin){e=_(e)?e:[e];for(var t=0;t<e.length;t++)e[t],L.Mixin.Events}}C.extend=function(e){var t=function(){p(this),this.initialize&&this.initialize.apply(this,arguments),this.callInitHooks()},r=t.__super__=this.prototype,o=n(r);for(var a in o.constructor=t,t.prototype=o,this)Object.prototype.hasOwnProperty.call(this,a)&&"prototype"!==a&&"__super__"!==a&&(t[a]=this[a]);return e.statics&&i(t,e.statics),e.includes&&(k(e.includes),i.apply(null,[o].concat(e.includes))),i(o,e),delete o.statics,delete o.includes,o.options&&(o.options=r.options?n(r.options):{},i(o.options,e.options)),o._initHooks=[],o.callInitHooks=function(){if(!this._initHooksCalled){r.callInitHooks&&r.callInitHooks.call(this),this._initHooksCalled=!0;for(var e=0,t=o._initHooks.length;e<t;e++)o._initHooks[e].call(this)}},t},C.include=function(e){var t=this.prototype.options;return i(this.prototype,e),e.options&&(this.prototype.options=t,this.mergeOptions(e.options)),this},C.mergeOptions=function(e){return i(this.prototype.options,e),this},C.addInitHook=function(e){var t=Array.prototype.slice.call(arguments,1),i="function"==typeof e?e:function(){this[e].apply(this,t)};return this.prototype._initHooks=this.prototype._initHooks||[],this.prototype._initHooks.push(i),this};var I={on:function(e,t,i){if("object"==typeof e)for(var n in e)this._on(n,e[n],t);else for(var r=0,o=(e=d(e)).length;r<o;r++)this._on(e[r],t,i);return this},off:function(e,t,i){if(arguments.length)if("object"==typeof e)for(var n in e)this._off(n,e[n],t);else{e=d(e);for(var r=1===arguments.length,o=0,a=e.length;o<a;o++)r?this._off(e[o]):this._off(e[o],t,i)}else delete this._events;return this},_on:function(e,t,i,n){if("function"==typeof t&&!1===this._listens(e,t,i)){i===this&&(i=void 0);var r={fn:t,ctx:i};n&&(r.once=!0),this._events=this._events||{},this._events[e]=this._events[e]||[],this._events[e].push(r)}},_off:function(e,t,i){var n,r,o;if(this._events&&(n=this._events[e]))if(1!==arguments.length){if("function"==typeof t){var a=this._listens(e,t,i);if(!1!==a){var s=n[a];this._firingCount&&(s.fn=c,this._events[e]=n=n.slice()),n.splice(a,1)}}}else{if(this._firingCount)for(r=0,o=n.length;r<o;r++)n[r].fn=c;delete this._events[e]}},fire:function(e,t,n){if(!this.listens(e,n))return this;var r=i({},t,{type:e,target:this,sourceTarget:t&&t.sourceTarget||this});if(this._events){var o=this._events[e];if(o){this._firingCount=this._firingCount+1||1;for(var a=0,s=o.length;a<s;a++){var l=o[a],c=l.fn;l.once&&this.off(e,c,l.ctx),c.call(l.ctx||this,r)}this._firingCount--}}return n&&this._propagateEvent(r),this},listens:function(e,t,i,n){var r=t;"function"!=typeof t&&(n=!!t,r=void 0,i=void 0);var o=this._events&&this._events[e];if(o&&o.length&&!1!==this._listens(e,r,i))return!0;if(n)for(var a in this._eventParents)if(this._eventParents[a].listens(e,t,i,n))return!0;return!1},_listens:function(e,t,i){if(!this._events)return!1;var n=this._events[e]||[];if(!t)return!!n.length;i===this&&(i=void 0);for(var r=0,o=n.length;r<o;r++)if(n[r].fn===t&&n[r].ctx===i)return r;return!1},once:function(e,t,i){if("object"==typeof e)for(var n in e)this._on(n,e[n],t,!0);else for(var r=0,o=(e=d(e)).length;r<o;r++)this._on(e[r],t,i,!0);return this},addEventParent:function(e){return this._eventParents=this._eventParents||{},this._eventParents[a(e)]=e,this},removeEventParent:function(e){return this._eventParents&&delete this._eventParents[a(e)],this},_propagateEvent:function(e){for(var t in this._eventParents)this._eventParents[t].fire(e.type,i({layer:e.target,propagatedFrom:e.target},e),!0)}};I.addEventListener=I.on,I.removeEventListener=I.clearAllEventListeners=I.off,I.addOneTimeEventListener=I.once,I.fireEvent=I.fire,I.hasEventListeners=I.listens;var z=C.extend(I);function A(e,t,i){this.x=i?Math.round(e):e,this.y=i?Math.round(t):t}var D=Math.trunc||function(e){return e>0?Math.floor(e):Math.ceil(e)};function R(e,t,i){return e instanceof A?e:_(e)?new A(e[0],e[1]):null==e?e:"object"==typeof e&&"x"in e&&"y"in e?new A(e.x,e.y):new A(e,t,i)}function F(e,t){if(e)for(var i=t?[e,t]:e,n=0,r=i.length;n<r;n++)this.extend(i[n])}function B(e,t){return!e||e instanceof F?e:new F(e,t)}function O(e,t){if(e)for(var i=t?[e,t]:e,n=0,r=i.length;n<r;n++)this.extend(i[n])}function N(e,t){return e instanceof O?e:new O(e,t)}function j(e,t,i){if(isNaN(e)||isNaN(t))throw new Error("Invalid LatLng object: ("+e+", "+t+")");this.lat=+e,this.lng=+t,void 0!==i&&(this.alt=+i)}function V(e,t,i){return e instanceof j?e:_(e)&&"object"!=typeof e[0]?3===e.length?new j(e[0],e[1],e[2]):2===e.length?new j(e[0],e[1]):null:null==e?e:"object"==typeof e&&"lat"in e?new j(e.lat,"lng"in e?e.lng:e.lon,e.alt):void 0===t?null:new j(e,t,i)}A.prototype={clone:function(){return new A(this.x,this.y)},add:function(e){return this.clone()._add(R(e))},_add:function(e){return this.x+=e.x,this.y+=e.y,this},subtract:function(e){return this.clone()._subtract(R(e))},_subtract:function(e){return this.x-=e.x,this.y-=e.y,this},divideBy:function(e){return this.clone()._divideBy(e)},_divideBy:function(e){return this.x/=e,this.y/=e,this},multiplyBy:function(e){return this.clone()._multiplyBy(e)},_multiplyBy:function(e){return this.x*=e,this.y*=e,this},scaleBy:function(e){return new A(this.x*e.x,this.y*e.y)},unscaleBy:function(e){return new A(this.x/e.x,this.y/e.y)},round:function(){return this.clone()._round()},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},floor:function(){return this.clone()._floor()},_floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.clone()._ceil()},_ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},trunc:function(){return this.clone()._trunc()},_trunc:function(){return this.x=D(this.x),this.y=D(this.y),this},distanceTo:function(e){var t=(e=R(e)).x-this.x,i=e.y-this.y;return Math.sqrt(t*t+i*i)},equals:function(e){return(e=R(e)).x===this.x&&e.y===this.y},contains:function(e){return e=R(e),Math.abs(e.x)<=Math.abs(this.x)&&Math.abs(e.y)<=Math.abs(this.y)},toString:function(){return"Point("+u(this.x)+", "+u(this.y)+")"}},F.prototype={extend:function(e){var t,i;if(!e)return this;if(e instanceof A||"number"==typeof e[0]||"x"in e)t=i=R(e);else if(t=(e=B(e)).min,i=e.max,!t||!i)return this;return this.min||this.max?(this.min.x=Math.min(t.x,this.min.x),this.max.x=Math.max(i.x,this.max.x),this.min.y=Math.min(t.y,this.min.y),this.max.y=Math.max(i.y,this.max.y)):(this.min=t.clone(),this.max=i.clone()),this},getCenter:function(e){return R((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,e)},getBottomLeft:function(){return R(this.min.x,this.max.y)},getTopRight:function(){return R(this.max.x,this.min.y)},getTopLeft:function(){return this.min},getBottomRight:function(){return this.max},getSize:function(){return this.max.subtract(this.min)},contains:function(e){var t,i;return(e="number"==typeof e[0]||e instanceof A?R(e):B(e))instanceof F?(t=e.min,i=e.max):t=i=e,t.x>=this.min.x&&i.x<=this.max.x&&t.y>=this.min.y&&i.y<=this.max.y},intersects:function(e){e=B(e);var t=this.min,i=this.max,n=e.min,r=e.max,o=r.x>=t.x&&n.x<=i.x,a=r.y>=t.y&&n.y<=i.y;return o&&a},overlaps:function(e){e=B(e);var t=this.min,i=this.max,n=e.min,r=e.max,o=r.x>t.x&&n.x<i.x,a=r.y>t.y&&n.y<i.y;return o&&a},isValid:function(){return!(!this.min||!this.max)},pad:function(e){var t=this.min,i=this.max,n=Math.abs(t.x-i.x)*e,r=Math.abs(t.y-i.y)*e;return B(R(t.x-n,t.y-r),R(i.x+n,i.y+r))},equals:function(e){return!!e&&(e=B(e),this.min.equals(e.getTopLeft())&&this.max.equals(e.getBottomRight()))}},O.prototype={extend:function(e){var t,i,n=this._southWest,r=this._northEast;if(e instanceof j)t=e,i=e;else{if(!(e instanceof O))return e?this.extend(V(e)||N(e)):this;if(t=e._southWest,i=e._northEast,!t||!i)return this}return n||r?(n.lat=Math.min(t.lat,n.lat),n.lng=Math.min(t.lng,n.lng),r.lat=Math.max(i.lat,r.lat),r.lng=Math.max(i.lng,r.lng)):(this._southWest=new j(t.lat,t.lng),this._northEast=new j(i.lat,i.lng)),this},pad:function(e){var t=this._southWest,i=this._northEast,n=Math.abs(t.lat-i.lat)*e,r=Math.abs(t.lng-i.lng)*e;return new O(new j(t.lat-n,t.lng-r),new j(i.lat+n,i.lng+r))},getCenter:function(){return new j((this._southWest.lat+this._northEast.lat)/2,(this._southWest.lng+this._northEast.lng)/2)},getSouthWest:function(){return this._southWest},getNorthEast:function(){return this._northEast},getNorthWest:function(){return new j(this.getNorth(),this.getWest())},getSouthEast:function(){return new j(this.getSouth(),this.getEast())},getWest:function(){return this._southWest.lng},getSouth:function(){return this._southWest.lat},getEast:function(){return this._northEast.lng},getNorth:function(){return this._northEast.lat},contains:function(e){e="number"==typeof e[0]||e instanceof j||"lat"in e?V(e):N(e);var t,i,n=this._southWest,r=this._northEast;return e instanceof O?(t=e.getSouthWest(),i=e.getNorthEast()):t=i=e,t.lat>=n.lat&&i.lat<=r.lat&&t.lng>=n.lng&&i.lng<=r.lng},intersects:function(e){e=N(e);var t=this._southWest,i=this._northEast,n=e.getSouthWest(),r=e.getNorthEast(),o=r.lat>=t.lat&&n.lat<=i.lat,a=r.lng>=t.lng&&n.lng<=i.lng;return o&&a},overlaps:function(e){e=N(e);var t=this._southWest,i=this._northEast,n=e.getSouthWest(),r=e.getNorthEast(),o=r.lat>t.lat&&n.lat<i.lat,a=r.lng>t.lng&&n.lng<i.lng;return o&&a},toBBoxString:function(){return[this.getWest(),this.getSouth(),this.getEast(),this.getNorth()].join(",")},equals:function(e,t){return!!e&&(e=N(e),this._southWest.equals(e.getSouthWest(),t)&&this._northEast.equals(e.getNorthEast(),t))},isValid:function(){return!(!this._southWest||!this._northEast)}},j.prototype={equals:function(e,t){return!!e&&(e=V(e),Math.max(Math.abs(this.lat-e.lat),Math.abs(this.lng-e.lng))<=(void 0===t?1e-9:t))},toString:function(e){return"LatLng("+u(this.lat,e)+", "+u(this.lng,e)+")"},distanceTo:function(e){return G.distance(this,V(e))},wrap:function(){return G.wrapLatLng(this)},toBounds:function(e){var t=180*e/40075017,i=t/Math.cos(Math.PI/180*this.lat);return N([this.lat-t,this.lng-i],[this.lat+t,this.lng+i])},clone:function(){return new j(this.lat,this.lng,this.alt)}};var U,Z={latLngToPoint:function(e,t){var i=this.projection.project(e),n=this.scale(t);return this.transformation._transform(i,n)},pointToLatLng:function(e,t){var i=this.scale(t),n=this.transformation.untransform(e,i);return this.projection.unproject(n)},project:function(e){return this.projection.project(e)},unproject:function(e){return this.projection.unproject(e)},scale:function(e){return 256*Math.pow(2,e)},zoom:function(e){return Math.log(e/256)/Math.LN2},getProjectedBounds:function(e){if(this.infinite)return null;var t=this.projection.bounds,i=this.scale(e);return new F(this.transformation.transform(t.min,i),this.transformation.transform(t.max,i))},infinite:!1,wrapLatLng:function(e){var t=this.wrapLng?l(e.lng,this.wrapLng,!0):e.lng;return new j(this.wrapLat?l(e.lat,this.wrapLat,!0):e.lat,t,e.alt)},wrapLatLngBounds:function(e){var t=e.getCenter(),i=this.wrapLatLng(t),n=t.lat-i.lat,r=t.lng-i.lng;if(0===n&&0===r)return e;var o=e.getSouthWest(),a=e.getNorthEast();return new O(new j(o.lat-n,o.lng-r),new j(a.lat-n,a.lng-r))}},G=i({},Z,{wrapLng:[-180,180],R:6371e3,distance:function(e,t){var i=Math.PI/180,n=e.lat*i,r=t.lat*i,o=Math.sin((t.lat-e.lat)*i/2),a=Math.sin((t.lng-e.lng)*i/2),s=o*o+Math.cos(n)*Math.cos(r)*a*a,l=2*Math.atan2(Math.sqrt(s),Math.sqrt(1-s));return this.R*l}}),q=6378137,$={R:q,MAX_LATITUDE:85.0511287798,project:function(e){var t=Math.PI/180,i=this.MAX_LATITUDE,n=Math.max(Math.min(i,e.lat),-i),r=Math.sin(n*t);return new A(this.R*e.lng*t,this.R*Math.log((1+r)/(1-r))/2)},unproject:function(e){var t=180/Math.PI;return new j((2*Math.atan(Math.exp(e.y/this.R))-Math.PI/2)*t,e.x*t/this.R)},bounds:(U=q*Math.PI,new F([-U,-U],[U,U]))};function W(e,t,i,n){if(_(e))return this._a=e[0],this._b=e[1],this._c=e[2],void(this._d=e[3]);this._a=e,this._b=t,this._c=i,this._d=n}function H(e,t,i,n){return new W(e,t,i,n)}W.prototype={transform:function(e,t){return this._transform(e.clone(),t)},_transform:function(e,t){return t=t||1,e.x=t*(this._a*e.x+this._b),e.y=t*(this._c*e.y+this._d),e},untransform:function(e,t){return t=t||1,new A((e.x/t-this._b)/this._a,(e.y/t-this._d)/this._c)}};var X,Y=i({},G,{code:"EPSG:3857",projection:$,transformation:(X=.5/(Math.PI*$.R),H(X,.5,-X,.5))}),K=i({},Y,{code:"EPSG:900913"});function Q(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}function J(e,t){var i,n,r,o,a,s,l="";for(i=0,r=e.length;i<r;i++){for(n=0,o=(a=e[i]).length;n<o;n++)l+=(n?"L":"M")+(s=a[n]).x+" "+s.y;l+=t?Ne.svg?"z":"x":""}return l||"M0 0"}var ee,te=document.documentElement.style,ie="ActiveXObject"in window,ne=ie&&!document.addEventListener,re="msLaunchUri"in navigator&&!("documentMode"in document),oe=Oe("webkit"),ae=Oe("android"),se=Oe("android 2")||Oe("android 3"),le=parseInt(/WebKit\/([0-9]+)|$/.exec(navigator.userAgent)[1],10),ce=ae&&Oe("Google")&&le<537&&!("AudioNode"in window),ue=!!window.opera,he=!re&&Oe("chrome"),de=Oe("gecko")&&!oe&&!ue&&!ie,pe=!he&&Oe("safari"),fe=Oe("phantom"),me="OTransition"in te,ge=0===navigator.platform.indexOf("Win"),_e=ie&&"transition"in te,ye="WebKitCSSMatrix"in window&&"m11"in new window.WebKitCSSMatrix&&!se,ve="MozPerspective"in te,xe=!window.L_DISABLE_3D&&(_e||ye||ve)&&!me&&!fe,be="undefined"!=typeof orientation||Oe("mobile"),we=be&&oe,Te=be&&ye,Se=!window.PointerEvent&&window.MSPointerEvent,Pe=!(!window.PointerEvent&&!Se),Me="ontouchstart"in window||!!window.TouchEvent,Ee=!window.L_NO_TOUCH&&(Me||Pe),Ce=be&&ue,ke=be&&de,Ie=(window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI)>1,ze=function(){var e=!1;try{var t=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener("testPassiveEventSupport",c,t),window.removeEventListener("testPassiveEventSupport",c,t)}catch(i){}return e}(),Ae=!!document.createElement("canvas").getContext,Le=!(!document.createElementNS||!Q("svg").createSVGRect),De=!!Le&&((ee=document.createElement("div")).innerHTML="<svg/>","http://www.w3.org/2000/svg"===(ee.firstChild&&ee.firstChild.namespaceURI)),Re=!Le&&function(){try{var e=document.createElement("div");e.innerHTML='<v:shape adj="1"/>';var t=e.firstChild;return t.style.behavior="url(#default#VML)",t&&"object"==typeof t.adj}catch(i){return!1}}(),Fe=0===navigator.platform.indexOf("Mac"),Be=0===navigator.platform.indexOf("Linux");function Oe(e){return navigator.userAgent.toLowerCase().indexOf(e)>=0}var Ne={ie:ie,ielt9:ne,edge:re,webkit:oe,android:ae,android23:se,androidStock:ce,opera:ue,chrome:he,gecko:de,safari:pe,phantom:fe,opera12:me,win:ge,ie3d:_e,webkit3d:ye,gecko3d:ve,any3d:xe,mobile:be,mobileWebkit:we,mobileWebkit3d:Te,msPointer:Se,pointer:Pe,touch:Ee,touchNative:Me,mobileOpera:Ce,mobileGecko:ke,retina:Ie,passiveEvents:ze,canvas:Ae,svg:Le,vml:Re,inlineSvg:De,mac:Fe,linux:Be},je=Ne.msPointer?"MSPointerDown":"pointerdown",Ve=Ne.msPointer?"MSPointerMove":"pointermove",Ue=Ne.msPointer?"MSPointerUp":"pointerup",Ze=Ne.msPointer?"MSPointerCancel":"pointercancel",Ge={touchstart:je,touchmove:Ve,touchend:Ue,touchcancel:Ze},qe={touchstart:tt,touchmove:et,touchend:et,touchcancel:et},$e={},We=!1;function He(e,t,i){return"touchstart"===t&&Je(),qe[t]?(i=qe[t].bind(this,i),e.addEventListener(Ge[t],i,!1),i):c}function Xe(e,t,i){Ge[t]&&e.removeEventListener(Ge[t],i,!1)}function Ye(e){$e[e.pointerId]=e}function Ke(e){$e[e.pointerId]&&($e[e.pointerId]=e)}function Qe(e){delete $e[e.pointerId]}function Je(){We||(document.addEventListener(je,Ye,!0),document.addEventListener(Ve,Ke,!0),document.addEventListener(Ue,Qe,!0),document.addEventListener(Ze,Qe,!0),We=!0)}function et(e,t){if(t.pointerType!==(t.MSPOINTER_TYPE_MOUSE||"mouse")){for(var i in t.touches=[],$e)t.touches.push($e[i]);t.changedTouches=[t],e(t)}}function tt(e,t){t.MSPOINTER_TYPE_TOUCH&&t.pointerType===t.MSPOINTER_TYPE_TOUCH&&Yt(t),et(e,t)}function it(e){var t,i,n={};for(i in e)t=e[i],n[i]=t&&t.bind?t.bind(e):t;return e=n,n.type="dblclick",n.detail=2,n.isTrusted=!1,n._simulated=!0,n}var nt=200;function rt(e,t){e.addEventListener("dblclick",t);var i,n=0;function r(e){if(1===e.detail){if("mouse"!==e.pointerType&&(!e.sourceCapabilities||e.sourceCapabilities.firesTouchEvents)){var r=Qt(e);if(!r.some(function(e){return e instanceof HTMLLabelElement&&e.attributes.for})||r.some(function(e){return e instanceof HTMLInputElement||e instanceof HTMLSelectElement})){var o=Date.now();o-n<=nt?2===++i&&t(it(e)):i=1,n=o}}}else i=e.detail}return e.addEventListener("click",r),{dblclick:t,simDblclick:r}}function ot(e,t){e.removeEventListener("dblclick",t.dblclick),e.removeEventListener("click",t.simDblclick)}var at,st,lt,ct,ut,ht=Ct(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),dt=Ct(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),pt="webkitTransition"===dt||"OTransition"===dt?dt+"End":"transitionend";function ft(e){return"string"==typeof e?document.getElementById(e):e}function mt(e,t){var i=e.style[t]||e.currentStyle&&e.currentStyle[t];if((!i||"auto"===i)&&document.defaultView){var n=document.defaultView.getComputedStyle(e,null);i=n?n[t]:null}return"auto"===i?null:i}function gt(e,t,i){var n=document.createElement(e);return n.className=t||"",i&&i.appendChild(n),n}function _t(e){var t=e.parentNode;t&&t.removeChild(e)}function yt(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function vt(e){var t=e.parentNode;t&&t.lastChild!==e&&t.appendChild(e)}function xt(e){var t=e.parentNode;t&&t.firstChild!==e&&t.insertBefore(e,t.firstChild)}function bt(e,t){if(void 0!==e.classList)return e.classList.contains(t);var i=Pt(e);return i.length>0&&new RegExp("(^|\\s)"+t+"(\\s|$)").test(i)}function wt(e,t){if(void 0!==e.classList)for(var i=d(t),n=0,r=i.length;n<r;n++)e.classList.add(i[n]);else if(!bt(e,t)){var o=Pt(e);St(e,(o?o+" ":"")+t)}}function Tt(e,t){void 0!==e.classList?e.classList.remove(t):St(e,h((" "+Pt(e)+" ").replace(" "+t+" "," ")))}function St(e,t){void 0===e.className.baseVal?e.className=t:e.className.baseVal=t}function Pt(e){return e.correspondingElement&&(e=e.correspondingElement),void 0===e.className.baseVal?e.className:e.className.baseVal}function Mt(e,t){"opacity"in e.style?e.style.opacity=t:"filter"in e.style&&Et(e,t)}function Et(e,t){var i=!1,n="DXImageTransform.Microsoft.Alpha";try{i=e.filters.item(n)}catch(r){if(1===t)return}t=Math.round(100*t),i?(i.Enabled=100!==t,i.Opacity=t):e.style.filter+=" progid:"+n+"(opacity="+t+")"}function Ct(e){for(var t=document.documentElement.style,i=0;i<e.length;i++)if(e[i]in t)return e[i];return!1}function kt(e,t,i){var n=t||new A(0,0);e.style[ht]=(Ne.ie3d?"translate("+n.x+"px,"+n.y+"px)":"translate3d("+n.x+"px,"+n.y+"px,0)")+(i?" scale("+i+")":"")}function It(e,t){e._leaflet_pos=t,Ne.any3d?kt(e,t):(e.style.left=t.x+"px",e.style.top=t.y+"px")}function zt(e){return e._leaflet_pos||new A(0,0)}if("onselectstart"in document)at=function(){jt(window,"selectstart",Yt)},st=function(){Ut(window,"selectstart",Yt)};else{var At=Ct(["userSelect","WebkitUserSelect","OUserSelect","MozUserSelect","msUserSelect"]);at=function(){if(At){var e=document.documentElement.style;lt=e[At],e[At]="none"}},st=function(){At&&(document.documentElement.style[At]=lt,lt=void 0)}}function Lt(){jt(window,"dragstart",Yt)}function Dt(){Ut(window,"dragstart",Yt)}function Rt(e){for(;-1===e.tabIndex;)e=e.parentNode;e.style&&(Ft(),ct=e,ut=e.style.outlineStyle,e.style.outlineStyle="none",jt(window,"keydown",Ft))}function Ft(){ct&&(ct.style.outlineStyle=ut,ct=void 0,ut=void 0,Ut(window,"keydown",Ft))}function Bt(e){do{e=e.parentNode}while(!(e.offsetWidth&&e.offsetHeight||e===document.body));return e}function Ot(e){var t=e.getBoundingClientRect();return{x:t.width/e.offsetWidth||1,y:t.height/e.offsetHeight||1,boundingClientRect:t}}var Nt={__proto__:null,TRANSFORM:ht,TRANSITION:dt,TRANSITION_END:pt,get:ft,getStyle:mt,create:gt,remove:_t,empty:yt,toFront:vt,toBack:xt,hasClass:bt,addClass:wt,removeClass:Tt,setClass:St,getClass:Pt,setOpacity:Mt,testProp:Ct,setTransform:kt,setPosition:It,getPosition:zt,get disableTextSelection(){return at},get enableTextSelection(){return st},disableImageDrag:Lt,enableImageDrag:Dt,preventOutline:Rt,restoreOutline:Ft,getSizedParentNode:Bt,getScale:Ot};function jt(e,t,i,n){if(t&&"object"==typeof t)for(var r in t)qt(e,r,t[r],i);else for(var o=0,a=(t=d(t)).length;o<a;o++)qt(e,t[o],i,n);return this}var Vt="_leaflet_events";function Ut(e,t,i,n){if(1===arguments.length)Zt(e),delete e[Vt];else if(t&&"object"==typeof t)for(var r in t)$t(e,r,t[r],i);else if(t=d(t),2===arguments.length)Zt(e,function(e){return-1!==y(t,e)});else for(var o=0,a=t.length;o<a;o++)$t(e,t[o],i,n);return this}function Zt(e,t){for(var i in e[Vt]){var n=i.split(/\d/)[0];t&&!t(n)||$t(e,n,null,null,i)}}var Gt={mouseenter:"mouseover",mouseleave:"mouseout",wheel:!("onwheel"in window)&&"mousewheel"};function qt(e,t,i,n){var r=t+a(i)+(n?"_"+a(n):"");if(e[Vt]&&e[Vt][r])return this;var o=function(t){return i.call(n||e,t||window.event)},s=o;!Ne.touchNative&&Ne.pointer&&0===t.indexOf("touch")?o=He(e,t,o):Ne.touch&&"dblclick"===t?o=rt(e,o):"addEventListener"in e?"touchstart"===t||"touchmove"===t||"wheel"===t||"mousewheel"===t?e.addEventListener(Gt[t]||t,o,!!Ne.passiveEvents&&{passive:!1}):"mouseenter"===t||"mouseleave"===t?(o=function(t){t=t||window.event,ii(e,t)&&s(t)},e.addEventListener(Gt[t],o,!1)):e.addEventListener(t,s,!1):e.attachEvent("on"+t,o),e[Vt]=e[Vt]||{},e[Vt][r]=o}function $t(e,t,i,n,r){r=r||t+a(i)+(n?"_"+a(n):"");var o=e[Vt]&&e[Vt][r];if(!o)return this;!Ne.touchNative&&Ne.pointer&&0===t.indexOf("touch")?Xe(e,t,o):Ne.touch&&"dblclick"===t?ot(e,o):"removeEventListener"in e?e.removeEventListener(Gt[t]||t,o,!1):e.detachEvent("on"+t,o),e[Vt][r]=null}function Wt(e){return e.stopPropagation?e.stopPropagation():e.originalEvent?e.originalEvent._stopped=!0:e.cancelBubble=!0,this}function Ht(e){return qt(e,"wheel",Wt),this}function Xt(e){return jt(e,"mousedown touchstart dblclick contextmenu",Wt),e._leaflet_disable_click=!0,this}function Yt(e){return e.preventDefault?e.preventDefault():e.returnValue=!1,this}function Kt(e){return Yt(e),Wt(e),this}function Qt(e){if(e.composedPath)return e.composedPath();for(var t=[],i=e.target;i;)t.push(i),i=i.parentNode;return t}function Jt(e,t){if(!t)return new A(e.clientX,e.clientY);var i=Ot(t),n=i.boundingClientRect;return new A((e.clientX-n.left)/i.x-t.clientLeft,(e.clientY-n.top)/i.y-t.clientTop)}var ei=Ne.linux&&Ne.chrome?window.devicePixelRatio:Ne.mac?3*window.devicePixelRatio:window.devicePixelRatio>0?2*window.devicePixelRatio:1;function ti(e){return Ne.edge?e.wheelDeltaY/2:e.deltaY&&0===e.deltaMode?-e.deltaY/ei:e.deltaY&&1===e.deltaMode?20*-e.deltaY:e.deltaY&&2===e.deltaMode?60*-e.deltaY:e.deltaX||e.deltaZ?0:e.wheelDelta?(e.wheelDeltaY||e.wheelDelta)/2:e.detail&&Math.abs(e.detail)<32765?20*-e.detail:e.detail?e.detail/-32765*60:0}function ii(e,t){var i=t.relatedTarget;if(!i)return!0;try{for(;i&&i!==e;)i=i.parentNode}catch(n){return!1}return i!==e}var ni={__proto__:null,on:jt,off:Ut,stopPropagation:Wt,disableScrollPropagation:Ht,disableClickPropagation:Xt,preventDefault:Yt,stop:Kt,getPropagationPath:Qt,getMousePosition:Jt,getWheelDelta:ti,isExternalTarget:ii,addListener:jt,removeListener:Ut},ri=z.extend({run:function(e,t,i,n){this.stop(),this._el=e,this._inProgress=!0,this._duration=i||.25,this._easeOutPower=1/Math.max(n||.5,.2),this._startPos=zt(e),this._offset=t.subtract(this._startPos),this._startTime=+new Date,this.fire("start"),this._animate()},stop:function(){this._inProgress&&(this._step(!0),this._complete())},_animate:function(){this._animId=P(this._animate,this),this._step()},_step:function(e){var t=+new Date-this._startTime,i=1e3*this._duration;t<i?this._runFrame(this._easeOut(t/i),e):(this._runFrame(1),this._complete())},_runFrame:function(e,t){var i=this._startPos.add(this._offset.multiplyBy(e));t&&i._round(),It(this._el,i),this.fire("step")},_complete:function(){M(this._animId),this._inProgress=!1,this.fire("end")},_easeOut:function(e){return 1-Math.pow(1-e,this._easeOutPower)}}),oi=z.extend({options:{crs:Y,center:void 0,zoom:void 0,minZoom:void 0,maxZoom:void 0,layers:[],maxBounds:void 0,renderer:void 0,zoomAnimation:!0,zoomAnimationThreshold:4,fadeAnimation:!0,markerZoomAnimation:!0,transform3DLimit:8388608,zoomSnap:1,zoomDelta:1,trackResize:!0},initialize:function(e,t){t=p(this,t),this._handlers=[],this._layers={},this._zoomBoundLayers={},this._sizeChanged=!0,this._initContainer(e),this._initLayout(),this._onResize=r(this._onResize,this),this._initEvents(),t.maxBounds&&this.setMaxBounds(t.maxBounds),void 0!==t.zoom&&(this._zoom=this._limitZoom(t.zoom)),t.center&&void 0!==t.zoom&&this.setView(V(t.center),t.zoom,{reset:!0}),this.callInitHooks(),this._zoomAnimated=dt&&Ne.any3d&&!Ne.mobileOpera&&this.options.zoomAnimation,this._zoomAnimated&&(this._createAnimProxy(),jt(this._proxy,pt,this._catchTransitionEnd,this)),this._addLayers(this.options.layers)},setView:function(e,t,n){return t=void 0===t?this._zoom:this._limitZoom(t),e=this._limitCenter(V(e),t,this.options.maxBounds),n=n||{},this._stop(),this._loaded&&!n.reset&&!0!==n&&(void 0!==n.animate&&(n.zoom=i({animate:n.animate},n.zoom),n.pan=i({animate:n.animate,duration:n.duration},n.pan)),this._zoom!==t?this._tryAnimatedZoom&&this._tryAnimatedZoom(e,t,n.zoom):this._tryAnimatedPan(e,n.pan))?(clearTimeout(this._sizeTimer),this):(this._resetView(e,t,n.pan&&n.pan.noMoveStart),this)},setZoom:function(e,t){return this._loaded?this.setView(this.getCenter(),e,{zoom:t}):(this._zoom=e,this)},zoomIn:function(e,t){return e=e||(Ne.any3d?this.options.zoomDelta:1),this.setZoom(this._zoom+e,t)},zoomOut:function(e,t){return e=e||(Ne.any3d?this.options.zoomDelta:1),this.setZoom(this._zoom-e,t)},setZoomAround:function(e,t,i){var n=this.getZoomScale(t),r=this.getSize().divideBy(2),o=(e instanceof A?e:this.latLngToContainerPoint(e)).subtract(r).multiplyBy(1-1/n),a=this.containerPointToLatLng(r.add(o));return this.setView(a,t,{zoom:i})},_getBoundsCenterZoom:function(e,t){t=t||{},e=e.getBounds?e.getBounds():N(e);var i=R(t.paddingTopLeft||t.padding||[0,0]),n=R(t.paddingBottomRight||t.padding||[0,0]),r=this.getBoundsZoom(e,!1,i.add(n));if((r="number"==typeof t.maxZoom?Math.min(t.maxZoom,r):r)===1/0)return{center:e.getCenter(),zoom:r};var o=n.subtract(i).divideBy(2),a=this.project(e.getSouthWest(),r),s=this.project(e.getNorthEast(),r);return{center:this.unproject(a.add(s).divideBy(2).add(o),r),zoom:r}},fitBounds:function(e,t){if(!(e=N(e)).isValid())throw new Error("Bounds are not valid.");var i=this._getBoundsCenterZoom(e,t);return this.setView(i.center,i.zoom,t)},fitWorld:function(e){return this.fitBounds([[-90,-180],[90,180]],e)},panTo:function(e,t){return this.setView(e,this._zoom,{pan:t})},panBy:function(e,t){if(t=t||{},!(e=R(e).round()).x&&!e.y)return this.fire("moveend");if(!0!==t.animate&&!this.getSize().contains(e))return this._resetView(this.unproject(this.project(this.getCenter()).add(e)),this.getZoom()),this;if(this._panAnim||(this._panAnim=new ri,this._panAnim.on({step:this._onPanTransitionStep,end:this._onPanTransitionEnd},this)),t.noMoveStart||this.fire("movestart"),!1!==t.animate){wt(this._mapPane,"leaflet-pan-anim");var i=this._getMapPanePos().subtract(e).round();this._panAnim.run(this._mapPane,i,t.duration||.25,t.easeLinearity)}else this._rawPanBy(e),this.fire("move").fire("moveend");return this},flyTo:function(e,t,i){if(!1===(i=i||{}).animate||!Ne.any3d)return this.setView(e,t,i);this._stop();var n=this.project(this.getCenter()),r=this.project(e),o=this.getSize(),a=this._zoom;e=V(e),t=void 0===t?a:t;var s=Math.max(o.x,o.y),l=s*this.getZoomScale(a,t),c=r.distanceTo(n)||1,u=1.42,h=u*u;function d(e){var t=(l*l-s*s+(e?-1:1)*h*h*c*c)/(2*(e?l:s)*h*c),i=Math.sqrt(t*t+1)-t;return i<1e-9?-18:Math.log(i)}function p(e){return(Math.exp(e)-Math.exp(-e))/2}function f(e){return(Math.exp(e)+Math.exp(-e))/2}function m(e){return p(e)/f(e)}var g=d(0);function _(e){return s*(f(g)/f(g+u*e))}function y(e){return s*(f(g)*m(g+u*e)-p(g))/h}function v(e){return 1-Math.pow(1-e,1.5)}var x=Date.now(),b=(d(1)-g)/u,w=i.duration?1e3*i.duration:1e3*b*.8;function T(){var i=(Date.now()-x)/w,o=v(i)*b;i<=1?(this._flyToFrame=P(T,this),this._move(this.unproject(n.add(r.subtract(n).multiplyBy(y(o)/c)),a),this.getScaleZoom(s/_(o),a),{flyTo:!0})):this._move(e,t)._moveEnd(!0)}return this._moveStart(!0,i.noMoveStart),T.call(this),this},flyToBounds:function(e,t){var i=this._getBoundsCenterZoom(e,t);return this.flyTo(i.center,i.zoom,t)},setMaxBounds:function(e){return e=N(e),this.listens("moveend",this._panInsideMaxBounds)&&this.off("moveend",this._panInsideMaxBounds),e.isValid()?(this.options.maxBounds=e,this._loaded&&this._panInsideMaxBounds(),this.on("moveend",this._panInsideMaxBounds)):(this.options.maxBounds=null,this)},setMinZoom:function(e){var t=this.options.minZoom;return this.options.minZoom=e,this._loaded&&t!==e&&(this.fire("zoomlevelschange"),this.getZoom()<this.options.minZoom)?this.setZoom(e):this},setMaxZoom:function(e){var t=this.options.maxZoom;return this.options.maxZoom=e,this._loaded&&t!==e&&(this.fire("zoomlevelschange"),this.getZoom()>this.options.maxZoom)?this.setZoom(e):this},panInsideBounds:function(e,t){this._enforcingBounds=!0;var i=this.getCenter(),n=this._limitCenter(i,this._zoom,N(e));return i.equals(n)||this.panTo(n,t),this._enforcingBounds=!1,this},panInside:function(e,t){var i=R((t=t||{}).paddingTopLeft||t.padding||[0,0]),n=R(t.paddingBottomRight||t.padding||[0,0]),r=this.project(this.getCenter()),o=this.project(e),a=this.getPixelBounds(),s=B([a.min.add(i),a.max.subtract(n)]),l=s.getSize();if(!s.contains(o)){this._enforcingBounds=!0;var c=o.subtract(s.getCenter()),u=s.extend(o).getSize().subtract(l);r.x+=c.x<0?-u.x:u.x,r.y+=c.y<0?-u.y:u.y,this.panTo(this.unproject(r),t),this._enforcingBounds=!1}return this},invalidateSize:function(e){if(!this._loaded)return this;e=i({animate:!1,pan:!0},!0===e?{animate:!0}:e);var t=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var n=this.getSize(),o=t.divideBy(2).round(),a=n.divideBy(2).round(),s=o.subtract(a);return s.x||s.y?(e.animate&&e.pan?this.panBy(s):(e.pan&&this._rawPanBy(s),this.fire("move"),e.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(r(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:t,newSize:n})):this},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(e){if(e=this._locateOptions=i({timeout:1e4,watch:!1},e),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var t=r(this._handleGeolocationResponse,this),n=r(this._handleGeolocationError,this);return e.watch?this._locationWatchId=navigator.geolocation.watchPosition(t,n,e):navigator.geolocation.getCurrentPosition(t,n,e),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(e){if(this._container._leaflet_id){var t=e.code,i=e.message||(1===t?"permission denied":2===t?"position unavailable":"timeout");this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:t,message:"Geolocation error: "+i+"."})}},_handleGeolocationResponse:function(e){if(this._container._leaflet_id){var t=new j(e.coords.latitude,e.coords.longitude),i=t.toBounds(2*e.coords.accuracy),n=this._locateOptions;if(n.setView){var r=this.getBoundsZoom(i);this.setView(t,n.maxZoom?Math.min(r,n.maxZoom):r)}var o={latlng:t,bounds:i,timestamp:e.timestamp};for(var a in e.coords)"number"==typeof e.coords[a]&&(o[a]=e.coords[a]);this.fire("locationfound",o)}},addHandler:function(e,t){if(!t)return this;var i=this[e]=new t(this);return this._handlers.push(i),this.options[e]&&i.enable(),this},remove:function(){if(this._initEvents(!0),this.options.maxBounds&&this.off("moveend",this._panInsideMaxBounds),this._containerId!==this._container._leaflet_id)throw new Error("Map container is being reused by another instance");try{delete this._container._leaflet_id,delete this._containerId}catch(t){this._container._leaflet_id=void 0,this._containerId=void 0}var e;for(e in void 0!==this._locationWatchId&&this.stopLocate(),this._stop(),_t(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(M(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload"),this._layers)this._layers[e].remove();for(e in this._panes)_t(this._panes[e]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(e,t){var i=gt("div","leaflet-pane"+(e?" leaflet-"+e.replace("Pane","")+"-pane":""),t||this._mapPane);return e&&(this._panes[e]=i),i},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter.clone():this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var e=this.getPixelBounds();return new O(this.unproject(e.getBottomLeft()),this.unproject(e.getTopRight()))},getMinZoom:function(){return void 0===this.options.minZoom?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return void 0===this.options.maxZoom?void 0===this._layersMaxZoom?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(e,t,i){e=N(e),i=R(i||[0,0]);var n=this.getZoom()||0,r=this.getMinZoom(),o=this.getMaxZoom(),a=e.getNorthWest(),s=e.getSouthEast(),l=this.getSize().subtract(i),c=B(this.project(s,n),this.project(a,n)).getSize(),u=Ne.any3d?this.options.zoomSnap:1,h=l.x/c.x,d=l.y/c.y,p=t?Math.max(h,d):Math.min(h,d);return n=this.getScaleZoom(p,n),u&&(n=Math.round(n/(u/100))*(u/100),n=t?Math.ceil(n/u)*u:Math.floor(n/u)*u),Math.max(r,Math.min(o,n))},getSize:function(){return this._size&&!this._sizeChanged||(this._size=new A(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(e,t){var i=this._getTopLeftPoint(e,t);return new F(i,i.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(e){return this.options.crs.getProjectedBounds(void 0===e?this.getZoom():e)},getPane:function(e){return"string"==typeof e?this._panes[e]:e},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(e,t){var i=this.options.crs;return t=void 0===t?this._zoom:t,i.scale(e)/i.scale(t)},getScaleZoom:function(e,t){var i=this.options.crs;t=void 0===t?this._zoom:t;var n=i.zoom(e*i.scale(t));return isNaN(n)?1/0:n},project:function(e,t){return t=void 0===t?this._zoom:t,this.options.crs.latLngToPoint(V(e),t)},unproject:function(e,t){return t=void 0===t?this._zoom:t,this.options.crs.pointToLatLng(R(e),t)},layerPointToLatLng:function(e){var t=R(e).add(this.getPixelOrigin());return this.unproject(t)},latLngToLayerPoint:function(e){return this.project(V(e))._round()._subtract(this.getPixelOrigin())},wrapLatLng:function(e){return this.options.crs.wrapLatLng(V(e))},wrapLatLngBounds:function(e){return this.options.crs.wrapLatLngBounds(N(e))},distance:function(e,t){return this.options.crs.distance(V(e),V(t))},containerPointToLayerPoint:function(e){return R(e).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(e){return R(e).add(this._getMapPanePos())},containerPointToLatLng:function(e){var t=this.containerPointToLayerPoint(R(e));return this.layerPointToLatLng(t)},latLngToContainerPoint:function(e){return this.layerPointToContainerPoint(this.latLngToLayerPoint(V(e)))},mouseEventToContainerPoint:function(e){return Jt(e,this._container)},mouseEventToLayerPoint:function(e){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(e))},mouseEventToLatLng:function(e){return this.layerPointToLatLng(this.mouseEventToLayerPoint(e))},_initContainer:function(e){var t=this._container=ft(e);if(!t)throw new Error("Map container not found.");if(t._leaflet_id)throw new Error("Map container is already initialized.");jt(t,"scroll",this._onScroll,this),this._containerId=a(t)},_initLayout:function(){var e=this._container;this._fadeAnimated=this.options.fadeAnimation&&Ne.any3d,wt(e,"leaflet-container"+(Ne.touch?" leaflet-touch":"")+(Ne.retina?" leaflet-retina":"")+(Ne.ielt9?" leaflet-oldie":"")+(Ne.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var t=mt(e,"position");"absolute"!==t&&"relative"!==t&&"fixed"!==t&&"sticky"!==t&&(e.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var e=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),It(this._mapPane,new A(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(wt(e.markerPane,"leaflet-zoom-hide"),wt(e.shadowPane,"leaflet-zoom-hide"))},_resetView:function(e,t,i){It(this._mapPane,new A(0,0));var n=!this._loaded;this._loaded=!0,t=this._limitZoom(t),this.fire("viewprereset");var r=this._zoom!==t;this._moveStart(r,i)._move(e,t)._moveEnd(r),this.fire("viewreset"),n&&this.fire("load")},_moveStart:function(e,t){return e&&this.fire("zoomstart"),t||this.fire("movestart"),this},_move:function(e,t,i,n){void 0===t&&(t=this._zoom);var r=this._zoom!==t;return this._zoom=t,this._lastCenter=e,this._pixelOrigin=this._getNewPixelOrigin(e),n?i&&i.pinch&&this.fire("zoom",i):((r||i&&i.pinch)&&this.fire("zoom",i),this.fire("move",i)),this},_moveEnd:function(e){return e&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return M(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(e){It(this._mapPane,this._getMapPanePos().subtract(e))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_panInsideMaxBounds:function(){this._enforcingBounds||this.panInsideBounds(this.options.maxBounds)},_checkIfLoaded:function(){if(!this._loaded)throw new Error("Set map center and zoom first.")},_initEvents:function(e){this._targets={},this._targets[a(this._container)]=this;var t=e?Ut:jt;t(this._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this),this.options.trackResize&&t(window,"resize",this._onResize,this),Ne.any3d&&this.options.transform3DLimit&&(e?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){M(this._resizeRequest),this._resizeRequest=P(function(){this.invalidateSize({debounceMoveend:!0})},this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var e=this._getMapPanePos();Math.max(Math.abs(e.x),Math.abs(e.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(e,t){for(var i,n=[],r="mouseout"===t||"mouseover"===t,o=e.target||e.srcElement,s=!1;o;){if((i=this._targets[a(o)])&&("click"===t||"preclick"===t)&&this._draggableMoved(i)){s=!0;break}if(i&&i.listens(t,!0)){if(r&&!ii(o,e))break;if(n.push(i),r)break}if(o===this._container)break;o=o.parentNode}return n.length||s||r||!this.listens(t,!0)||(n=[this]),n},_isClickDisabled:function(e){for(;e&&e!==this._container;){if(e._leaflet_disable_click)return!0;e=e.parentNode}},_handleDOMEvent:function(e){var t=e.target||e.srcElement;if(!(!this._loaded||t._leaflet_disable_events||"click"===e.type&&this._isClickDisabled(t))){var i=e.type;"mousedown"===i&&Rt(t),this._fireDOMEvent(e,i)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(e,t,n){if("click"===e.type){var r=i({},e);r.type="preclick",this._fireDOMEvent(r,r.type,n)}var o=this._findEventTargets(e,t);if(n){for(var a=[],s=0;s<n.length;s++)n[s].listens(t,!0)&&a.push(n[s]);o=a.concat(o)}if(o.length){"contextmenu"===t&&Yt(e);var l=o[0],c={originalEvent:e};if("keypress"!==e.type&&"keydown"!==e.type&&"keyup"!==e.type){var u=l.getLatLng&&(!l._radius||l._radius<=10);c.containerPoint=u?this.latLngToContainerPoint(l.getLatLng()):this.mouseEventToContainerPoint(e),c.layerPoint=this.containerPointToLayerPoint(c.containerPoint),c.latlng=u?l.getLatLng():this.layerPointToLatLng(c.layerPoint)}for(s=0;s<o.length;s++)if(o[s].fire(t,c,!0),c.originalEvent._stopped||!1===o[s].options.bubblingMouseEvents&&-1!==y(this._mouseEvents,t))return}},_draggableMoved:function(e){return(e=e.dragging&&e.dragging.enabled()?e:this).dragging&&e.dragging.moved()||this.boxZoom&&this.boxZoom.moved()},_clearHandlers:function(){for(var e=0,t=this._handlers.length;e<t;e++)this._handlers[e].disable()},whenReady:function(e,t){return this._loaded?e.call(t||this,{target:this}):this.on("load",e,t),this},_getMapPanePos:function(){return zt(this._mapPane)||new A(0,0)},_moved:function(){var e=this._getMapPanePos();return e&&!e.equals([0,0])},_getTopLeftPoint:function(e,t){return(e&&void 0!==t?this._getNewPixelOrigin(e,t):this.getPixelOrigin()).subtract(this._getMapPanePos())},_getNewPixelOrigin:function(e,t){var i=this.getSize()._divideBy(2);return this.project(e,t)._subtract(i)._add(this._getMapPanePos())._round()},_latLngToNewLayerPoint:function(e,t,i){var n=this._getNewPixelOrigin(i,t);return this.project(e,t)._subtract(n)},_latLngBoundsToNewLayerBounds:function(e,t,i){var n=this._getNewPixelOrigin(i,t);return B([this.project(e.getSouthWest(),t)._subtract(n),this.project(e.getNorthWest(),t)._subtract(n),this.project(e.getSouthEast(),t)._subtract(n),this.project(e.getNorthEast(),t)._subtract(n)])},_getCenterLayerPoint:function(){return this.containerPointToLayerPoint(this.getSize()._divideBy(2))},_getCenterOffset:function(e){return this.latLngToLayerPoint(e).subtract(this._getCenterLayerPoint())},_limitCenter:function(e,t,i){if(!i)return e;var n=this.project(e,t),r=this.getSize().divideBy(2),o=new F(n.subtract(r),n.add(r)),a=this._getBoundsOffset(o,i,t);return Math.abs(a.x)<=1&&Math.abs(a.y)<=1?e:this.unproject(n.add(a),t)},_limitOffset:function(e,t){if(!t)return e;var i=this.getPixelBounds(),n=new F(i.min.add(e),i.max.add(e));return e.add(this._getBoundsOffset(n,t))},_getBoundsOffset:function(e,t,i){var n=B(this.project(t.getNorthEast(),i),this.project(t.getSouthWest(),i)),r=n.min.subtract(e.min),o=n.max.subtract(e.max);return new A(this._rebound(r.x,-o.x),this._rebound(r.y,-o.y))},_rebound:function(e,t){return e+t>0?Math.round(e-t)/2:Math.max(0,Math.ceil(e))-Math.max(0,Math.floor(t))},_limitZoom:function(e){var t=this.getMinZoom(),i=this.getMaxZoom(),n=Ne.any3d?this.options.zoomSnap:1;return n&&(e=Math.round(e/n)*n),Math.max(t,Math.min(i,e))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){Tt(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(e,t){var i=this._getCenterOffset(e)._trunc();return!(!0!==(t&&t.animate)&&!this.getSize().contains(i)||(this.panBy(i,t),0))},_createAnimProxy:function(){var e=this._proxy=gt("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(e),this.on("zoomanim",function(e){var t=ht,i=this._proxy.style[t];kt(this._proxy,this.project(e.center,e.zoom),this.getZoomScale(e.zoom,1)),i===this._proxy.style[t]&&this._animatingZoom&&this._onZoomTransitionEnd()},this),this.on("load moveend",this._animMoveEnd,this),this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){_t(this._proxy),this.off("load moveend",this._animMoveEnd,this),delete this._proxy},_animMoveEnd:function(){var e=this.getCenter(),t=this.getZoom();kt(this._proxy,this.project(e,t),this.getZoomScale(t,1))},_catchTransitionEnd:function(e){this._animatingZoom&&e.propertyName.indexOf("transform")>=0&&this._onZoomTransitionEnd()},_nothingToAnimate:function(){return!this._container.getElementsByClassName("leaflet-zoom-animated").length},_tryAnimatedZoom:function(e,t,i){if(this._animatingZoom)return!0;if(i=i||{},!this._zoomAnimated||!1===i.animate||this._nothingToAnimate()||Math.abs(t-this._zoom)>this.options.zoomAnimationThreshold)return!1;var n=this.getZoomScale(t),r=this._getCenterOffset(e)._divideBy(1-1/n);return!(!0!==i.animate&&!this.getSize().contains(r)||(P(function(){this._moveStart(!0,i.noMoveStart||!1)._animateZoom(e,t,!0)},this),0))},_animateZoom:function(e,t,i,n){this._mapPane&&(i&&(this._animatingZoom=!0,this._animateToCenter=e,this._animateToZoom=t,wt(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:e,zoom:t,noUpdate:n}),this._tempFireZoomEvent||(this._tempFireZoomEvent=this._zoom!==this._animateToZoom),this._move(this._animateToCenter,this._animateToZoom,void 0,!0),setTimeout(r(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&Tt(this._mapPane,"leaflet-zoom-anim"),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom,void 0,!0),this._tempFireZoomEvent&&this.fire("zoom"),delete this._tempFireZoomEvent,this.fire("move"),this._moveEnd(!0))}});function ai(e,t){return new oi(e,t)}var si=C.extend({options:{position:"topright"},initialize:function(e){p(this,e)},getPosition:function(){return this.options.position},setPosition:function(e){var t=this._map;return t&&t.removeControl(this),this.options.position=e,t&&t.addControl(this),this},getContainer:function(){return this._container},addTo:function(e){this.remove(),this._map=e;var t=this._container=this.onAdd(e),i=this.getPosition(),n=e._controlCorners[i];return wt(t,"leaflet-control"),-1!==i.indexOf("bottom")?n.insertBefore(t,n.firstChild):n.appendChild(t),this._map.on("unload",this.remove,this),this},remove:function(){return this._map?(_t(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null,this):this},_refocusOnMap:function(e){this._map&&e&&e.screenX>0&&e.screenY>0&&this._map.getContainer().focus()}}),li=function(e){return new si(e)};oi.include({addControl:function(e){return e.addTo(this),this},removeControl:function(e){return e.remove(),this},_initControlPos:function(){var e=this._controlCorners={},t="leaflet-",i=this._controlContainer=gt("div",t+"control-container",this._container);function n(n,r){var o=t+n+" "+t+r;e[n+r]=gt("div",o,i)}n("top","left"),n("top","right"),n("bottom","left"),n("bottom","right")},_clearControlPos:function(){for(var e in this._controlCorners)_t(this._controlCorners[e]);_t(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var ci=si.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(e,t,i,n){return i<n?-1:n<i?1:0}},initialize:function(e,t,i){for(var n in p(this,i),this._layerControlInputs=[],this._layers=[],this._lastZIndex=0,this._handlingClick=!1,this._preventClick=!1,e)this._addLayer(e[n],n);for(n in t)this._addLayer(t[n],n,!0)},onAdd:function(e){this._initLayout(),this._update(),this._map=e,e.on("zoomend",this._checkDisabledLayers,this);for(var t=0;t<this._layers.length;t++)this._layers[t].layer.on("add remove",this._onLayerChange,this);return this._container},addTo:function(e){return si.prototype.addTo.call(this,e),this._expandIfNotCollapsed()},onRemove:function(){this._map.off("zoomend",this._checkDisabledLayers,this);for(var e=0;e<this._layers.length;e++)this._layers[e].layer.off("add remove",this._onLayerChange,this)},addBaseLayer:function(e,t){return this._addLayer(e,t),this._map?this._update():this},addOverlay:function(e,t){return this._addLayer(e,t,!0),this._map?this._update():this},removeLayer:function(e){e.off("add remove",this._onLayerChange,this);var t=this._getLayer(a(e));return t&&this._layers.splice(this._layers.indexOf(t),1),this._map?this._update():this},expand:function(){wt(this._container,"leaflet-control-layers-expanded"),this._section.style.height=null;var e=this._map.getSize().y-(this._container.offsetTop+50);return e<this._section.clientHeight?(wt(this._section,"leaflet-control-layers-scrollbar"),this._section.style.height=e+"px"):Tt(this._section,"leaflet-control-layers-scrollbar"),this._checkDisabledLayers(),this},collapse:function(){return Tt(this._container,"leaflet-control-layers-expanded"),this},_initLayout:function(){var e="leaflet-control-layers",t=this._container=gt("div",e),i=this.options.collapsed;t.setAttribute("aria-haspopup",!0),Xt(t),Ht(t);var n=this._section=gt("section",e+"-list");i&&(this._map.on("click",this.collapse,this),jt(t,{mouseenter:this._expandSafely,mouseleave:this.collapse},this));var r=this._layersLink=gt("a",e+"-toggle",t);r.href="#",r.title="Layers",r.setAttribute("role","button"),jt(r,{keydown:function(e){13===e.keyCode&&this._expandSafely()},click:function(e){Yt(e),this._expandSafely()}},this),i||this.expand(),this._baseLayersList=gt("div",e+"-base",n),this._separator=gt("div",e+"-separator",n),this._overlaysList=gt("div",e+"-overlays",n),t.appendChild(n)},_getLayer:function(e){for(var t=0;t<this._layers.length;t++)if(this._layers[t]&&a(this._layers[t].layer)===e)return this._layers[t]},_addLayer:function(e,t,i){this._map&&e.on("add remove",this._onLayerChange,this),this._layers.push({layer:e,name:t,overlay:i}),this.options.sortLayers&&this._layers.sort(r(function(e,t){return this.options.sortFunction(e.layer,t.layer,e.name,t.name)},this)),this.options.autoZIndex&&e.setZIndex&&(this._lastZIndex++,e.setZIndex(this._lastZIndex)),this._expandIfNotCollapsed()},_update:function(){if(!this._container)return this;yt(this._baseLayersList),yt(this._overlaysList),this._layerControlInputs=[];var e,t,i,n,r=0;for(i=0;i<this._layers.length;i++)n=this._layers[i],this._addItem(n),t=t||n.overlay,e=e||!n.overlay,r+=n.overlay?0:1;return this.options.hideSingleBase&&(e=e&&r>1,this._baseLayersList.style.display=e?"":"none"),this._separator.style.display=t&&e?"":"none",this},_onLayerChange:function(e){this._handlingClick||this._update();var t=this._getLayer(a(e.target)),i=t.overlay?"add"===e.type?"overlayadd":"overlayremove":"add"===e.type?"baselayerchange":null;i&&this._map.fire(i,t)},_createRadioElement:function(e,t){var i='<input type="radio" class="leaflet-control-layers-selector" name="'+e+'"'+(t?' checked="checked"':"")+"/>",n=document.createElement("div");return n.innerHTML=i,n.firstChild},_addItem:function(e){var t,i=document.createElement("label"),n=this._map.hasLayer(e.layer);e.overlay?((t=document.createElement("input")).type="checkbox",t.className="leaflet-control-layers-selector",t.defaultChecked=n):t=this._createRadioElement("leaflet-base-layers_"+a(this),n),this._layerControlInputs.push(t),t.layerId=a(e.layer),jt(t,"click",this._onInputClick,this);var r=document.createElement("span");r.innerHTML=" "+e.name;var o=document.createElement("span");return i.appendChild(o),o.appendChild(t),o.appendChild(r),(e.overlay?this._overlaysList:this._baseLayersList).appendChild(i),this._checkDisabledLayers(),i},_onInputClick:function(){if(!this._preventClick){var e,t,i=this._layerControlInputs,n=[],r=[];this._handlingClick=!0;for(var o=i.length-1;o>=0;o--)e=i[o],t=this._getLayer(e.layerId).layer,e.checked?n.push(t):e.checked||r.push(t);for(o=0;o<r.length;o++)this._map.hasLayer(r[o])&&this._map.removeLayer(r[o]);for(o=0;o<n.length;o++)this._map.hasLayer(n[o])||this._map.addLayer(n[o]);this._handlingClick=!1,this._refocusOnMap()}},_checkDisabledLayers:function(){for(var e,t,i=this._layerControlInputs,n=this._map.getZoom(),r=i.length-1;r>=0;r--)e=i[r],t=this._getLayer(e.layerId).layer,e.disabled=void 0!==t.options.minZoom&&n<t.options.minZoom||void 0!==t.options.maxZoom&&n>t.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expandSafely:function(){var e=this._section;this._preventClick=!0,jt(e,"click",Yt),this.expand();var t=this;setTimeout(function(){Ut(e,"click",Yt),t._preventClick=!1})}}),ui=function(e,t,i){return new ci(e,t,i)},hi=si.extend({options:{position:"topleft",zoomInText:'<span aria-hidden="true">+</span>',zoomInTitle:"Zoom in",zoomOutText:'<span aria-hidden="true">−</span>',zoomOutTitle:"Zoom out"},onAdd:function(e){var t="leaflet-control-zoom",i=gt("div",t+" leaflet-bar"),n=this.options;return this._zoomInButton=this._createButton(n.zoomInText,n.zoomInTitle,t+"-in",i,this._zoomIn),this._zoomOutButton=this._createButton(n.zoomOutText,n.zoomOutTitle,t+"-out",i,this._zoomOut),this._updateDisabled(),e.on("zoomend zoomlevelschange",this._updateDisabled,this),i},onRemove:function(e){e.off("zoomend zoomlevelschange",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(e){!this._disabled&&this._map._zoom<this._map.getMaxZoom()&&this._map.zoomIn(this._map.options.zoomDelta*(e.shiftKey?3:1))},_zoomOut:function(e){!this._disabled&&this._map._zoom>this._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(e.shiftKey?3:1))},_createButton:function(e,t,i,n,r){var o=gt("a",i,n);return o.innerHTML=e,o.href="#",o.title=t,o.setAttribute("role","button"),o.setAttribute("aria-label",t),Xt(o),jt(o,"click",Kt),jt(o,"click",r,this),jt(o,"click",this._refocusOnMap,this),o},_updateDisabled:function(){var e=this._map,t="leaflet-disabled";Tt(this._zoomInButton,t),Tt(this._zoomOutButton,t),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),(this._disabled||e._zoom===e.getMinZoom())&&(wt(this._zoomOutButton,t),this._zoomOutButton.setAttribute("aria-disabled","true")),(this._disabled||e._zoom===e.getMaxZoom())&&(wt(this._zoomInButton,t),this._zoomInButton.setAttribute("aria-disabled","true"))}});oi.mergeOptions({zoomControl:!0}),oi.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new hi,this.addControl(this.zoomControl))});var di=function(e){return new hi(e)},pi=si.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(e){var t="leaflet-control-scale",i=gt("div",t),n=this.options;return this._addScales(n,t+"-line",i),e.on(n.updateWhenIdle?"moveend":"move",this._update,this),e.whenReady(this._update,this),i},onRemove:function(e){e.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(e,t,i){e.metric&&(this._mScale=gt("div",t,i)),e.imperial&&(this._iScale=gt("div",t,i))},_update:function(){var e=this._map,t=e.getSize().y/2,i=e.distance(e.containerPointToLatLng([0,t]),e.containerPointToLatLng([this.options.maxWidth,t]));this._updateScales(i)},_updateScales:function(e){this.options.metric&&e&&this._updateMetric(e),this.options.imperial&&e&&this._updateImperial(e)},_updateMetric:function(e){var t=this._getRoundNum(e),i=t<1e3?t+" m":t/1e3+" km";this._updateScale(this._mScale,i,t/e)},_updateImperial:function(e){var t,i,n,r=3.2808399*e;r>5280?(t=r/5280,i=this._getRoundNum(t),this._updateScale(this._iScale,i+" mi",i/t)):(n=this._getRoundNum(r),this._updateScale(this._iScale,n+" ft",n/r))},_updateScale:function(e,t,i){e.style.width=Math.round(this.options.maxWidth*i)+"px",e.innerHTML=t},_getRoundNum:function(e){var t=Math.pow(10,(Math.floor(e)+"").length-1),i=e/t;return t*(i=i>=10?10:i>=5?5:i>=3?3:i>=2?2:1)}}),fi=function(e){return new pi(e)},mi='<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="12" height="8" viewBox="0 0 12 8" class="leaflet-attribution-flag"><path fill="#4C7BE1" d="M0 0h12v4H0z"/><path fill="#FFD500" d="M0 4h12v3H0z"/><path fill="#E0BC00" d="M0 7h12v1H0z"/></svg>',gi=si.extend({options:{position:"bottomright",prefix:'<a href="https://leafletjs.com" title="A JavaScript library for interactive maps">'+(Ne.inlineSvg?mi+" ":"")+"Leaflet</a>"},initialize:function(e){p(this,e),this._attributions={}},onAdd:function(e){for(var t in e.attributionControl=this,this._container=gt("div","leaflet-control-attribution"),Xt(this._container),e._layers)e._layers[t].getAttribution&&this.addAttribution(e._layers[t].getAttribution());return this._update(),e.on("layeradd",this._addAttribution,this),this._container},onRemove:function(e){e.off("layeradd",this._addAttribution,this)},_addAttribution:function(e){e.layer.getAttribution&&(this.addAttribution(e.layer.getAttribution()),e.layer.once("remove",function(){this.removeAttribution(e.layer.getAttribution())},this))},setPrefix:function(e){return this.options.prefix=e,this._update(),this},addAttribution:function(e){return e?(this._attributions[e]||(this._attributions[e]=0),this._attributions[e]++,this._update(),this):this},removeAttribution:function(e){return e?(this._attributions[e]&&(this._attributions[e]--,this._update()),this):this},_update:function(){if(this._map){var e=[];for(var t in this._attributions)this._attributions[t]&&e.push(t);var i=[];this.options.prefix&&i.push(this.options.prefix),e.length&&i.push(e.join(", ")),this._container.innerHTML=i.join(' <span aria-hidden="true">|</span> ')}}});oi.mergeOptions({attributionControl:!0}),oi.addInitHook(function(){this.options.attributionControl&&(new gi).addTo(this)});var _i=function(e){return new gi(e)};si.Layers=ci,si.Zoom=hi,si.Scale=pi,si.Attribution=gi,li.layers=ui,li.zoom=di,li.scale=fi,li.attribution=_i;var yi=C.extend({initialize:function(e){this._map=e},enable:function(){return this._enabled||(this._enabled=!0,this.addHooks()),this},disable:function(){return this._enabled?(this._enabled=!1,this.removeHooks(),this):this},enabled:function(){return!!this._enabled}});yi.addTo=function(e,t){return e.addHandler(t,this),this};var vi={Events:I},xi=Ne.touch?"touchstart mousedown":"mousedown",bi=z.extend({options:{clickTolerance:3},initialize:function(e,t,i,n){p(this,n),this._element=e,this._dragStartTarget=t||e,this._preventOutline=i},enable:function(){this._enabled||(jt(this._dragStartTarget,xi,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(bi._dragging===this&&this.finishDrag(!0),Ut(this._dragStartTarget,xi,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(e){if(this._enabled&&(this._moved=!1,!bt(this._element,"leaflet-zoom-anim")))if(e.touches&&1!==e.touches.length)bi._dragging===this&&this.finishDrag();else if(!(bi._dragging||e.shiftKey||1!==e.which&&1!==e.button&&!e.touches||(bi._dragging=this,this._preventOutline&&Rt(this._element),Lt(),at(),this._moving))){this.fire("down");var t=e.touches?e.touches[0]:e,i=Bt(this._element);this._startPoint=new A(t.clientX,t.clientY),this._startPos=zt(this._element),this._parentScale=Ot(i);var n="mousedown"===e.type;jt(document,n?"mousemove":"touchmove",this._onMove,this),jt(document,n?"mouseup":"touchend touchcancel",this._onUp,this)}},_onMove:function(e){if(this._enabled)if(e.touches&&e.touches.length>1)this._moved=!0;else{var t=e.touches&&1===e.touches.length?e.touches[0]:e,i=new A(t.clientX,t.clientY)._subtract(this._startPoint);(i.x||i.y)&&(Math.abs(i.x)+Math.abs(i.y)<this.options.clickTolerance||(i.x/=this._parentScale.x,i.y/=this._parentScale.y,Yt(e),this._moved||(this.fire("dragstart"),this._moved=!0,wt(document.body,"leaflet-dragging"),this._lastTarget=e.target||e.srcElement,window.SVGElementInstance&&this._lastTarget instanceof window.SVGElementInstance&&(this._lastTarget=this._lastTarget.correspondingUseElement),wt(this._lastTarget,"leaflet-drag-target")),this._newPos=this._startPos.add(i),this._moving=!0,this._lastEvent=e,this._updatePosition()))}},_updatePosition:function(){var e={originalEvent:this._lastEvent};this.fire("predrag",e),It(this._element,this._newPos),this.fire("drag",e)},_onUp:function(){this._enabled&&this.finishDrag()},finishDrag:function(e){Tt(document.body,"leaflet-dragging"),this._lastTarget&&(Tt(this._lastTarget,"leaflet-drag-target"),this._lastTarget=null),Ut(document,"mousemove touchmove",this._onMove,this),Ut(document,"mouseup touchend touchcancel",this._onUp,this),Dt(),st();var t=this._moved&&this._moving;this._moving=!1,bi._dragging=!1,t&&this.fire("dragend",{noInertia:e,distance:this._newPos.distanceTo(this._startPos)})}});function wi(e,t,i){var n,r,o,a,s,l,c,u,h,d=[1,4,2,8];for(r=0,c=e.length;r<c;r++)e[r]._code=Ri(e[r],t);for(a=0;a<4;a++){for(u=d[a],n=[],r=0,o=(c=e.length)-1;r<c;o=r++)s=e[r],l=e[o],s._code&u?l._code&u||((h=Di(l,s,u,t,i))._code=Ri(h,t),n.push(h)):(l._code&u&&((h=Di(l,s,u,t,i))._code=Ri(h,t),n.push(h)),n.push(s));e=n}return e}function Ti(e,t){var i,n,r,o,a,s,l,c,u;if(!e||0===e.length)throw new Error("latlngs not passed");Oi(e)||(e=e[0]);var h=V([0,0]),d=N(e);d.getNorthWest().distanceTo(d.getSouthWest())*d.getNorthEast().distanceTo(d.getNorthWest())<1700&&(h=Si(e));var p=e.length,f=[];for(i=0;i<p;i++){var m=V(e[i]);f.push(t.project(V([m.lat-h.lat,m.lng-h.lng])))}for(s=l=c=0,i=0,n=p-1;i<p;n=i++)r=f[i],o=f[n],a=r.y*o.x-o.y*r.x,l+=(r.x+o.x)*a,c+=(r.y+o.y)*a,s+=3*a;u=0===s?f[0]:[l/s,c/s];var g=t.unproject(R(u));return V([g.lat+h.lat,g.lng+h.lng])}function Si(e){for(var t=0,i=0,n=0,r=0;r<e.length;r++){var o=V(e[r]);t+=o.lat,i+=o.lng,n++}return V([t/n,i/n])}var Pi,Mi={__proto__:null,clipPolygon:wi,polygonCenter:Ti,centroid:Si};function Ei(e,t){if(!t||!e.length)return e.slice();var i=t*t;return e=Ii(e=Ai(e,i),i)}function Ci(e,t,i){return Math.sqrt(Bi(e,t,i,!0))}function ki(e,t,i){return Bi(e,t,i)}function Ii(e,t){var i=e.length,n=new("undefined"!=typeof Uint8Array?Uint8Array:Array)(i);n[0]=n[i-1]=1,zi(e,n,t,0,i-1);var r,o=[];for(r=0;r<i;r++)n[r]&&o.push(e[r]);return o}function zi(e,t,i,n,r){var o,a,s,l=0;for(a=n+1;a<=r-1;a++)(s=Bi(e[a],e[n],e[r],!0))>l&&(o=a,l=s);l>i&&(t[o]=1,zi(e,t,i,n,o),zi(e,t,i,o,r))}function Ai(e,t){for(var i=[e[0]],n=1,r=0,o=e.length;n<o;n++)Fi(e[n],e[r])>t&&(i.push(e[n]),r=n);return r<o-1&&i.push(e[o-1]),i}function Li(e,t,i,n,r){var o,a,s,l=n?Pi:Ri(e,i),c=Ri(t,i);for(Pi=c;;){if(!(l|c))return[e,t];if(l&c)return!1;s=Ri(a=Di(e,t,o=l||c,i,r),i),o===l?(e=a,l=s):(t=a,c=s)}}function Di(e,t,i,n,r){var o,a,s=t.x-e.x,l=t.y-e.y,c=n.min,u=n.max;return 8&i?(o=e.x+s*(u.y-e.y)/l,a=u.y):4&i?(o=e.x+s*(c.y-e.y)/l,a=c.y):2&i?(o=u.x,a=e.y+l*(u.x-e.x)/s):1&i&&(o=c.x,a=e.y+l*(c.x-e.x)/s),new A(o,a,r)}function Ri(e,t){var i=0;return e.x<t.min.x?i|=1:e.x>t.max.x&&(i|=2),e.y<t.min.y?i|=4:e.y>t.max.y&&(i|=8),i}function Fi(e,t){var i=t.x-e.x,n=t.y-e.y;return i*i+n*n}function Bi(e,t,i,n){var r,o=t.x,a=t.y,s=i.x-o,l=i.y-a,c=s*s+l*l;return c>0&&((r=((e.x-o)*s+(e.y-a)*l)/c)>1?(o=i.x,a=i.y):r>0&&(o+=s*r,a+=l*r)),s=e.x-o,l=e.y-a,n?s*s+l*l:new A(o,a)}function Oi(e){return!_(e[0])||"object"!=typeof e[0][0]&&void 0!==e[0][0]}function Ni(e){return Oi(e)}function ji(e,t){var i,n,r,o,a,s,l,c;if(!e||0===e.length)throw new Error("latlngs not passed");Oi(e)||(e=e[0]);var u=V([0,0]),h=N(e);h.getNorthWest().distanceTo(h.getSouthWest())*h.getNorthEast().distanceTo(h.getNorthWest())<1700&&(u=Si(e));var d=e.length,p=[];for(i=0;i<d;i++){var f=V(e[i]);p.push(t.project(V([f.lat-u.lat,f.lng-u.lng])))}for(i=0,n=0;i<d-1;i++)n+=p[i].distanceTo(p[i+1])/2;if(0===n)c=p[0];else for(i=0,o=0;i<d-1;i++)if(a=p[i],s=p[i+1],(o+=r=a.distanceTo(s))>n){l=(o-n)/r,c=[s.x-l*(s.x-a.x),s.y-l*(s.y-a.y)];break}var m=t.unproject(R(c));return V([m.lat+u.lat,m.lng+u.lng])}var Vi={__proto__:null,simplify:Ei,pointToSegmentDistance:Ci,closestPointOnSegment:ki,clipSegment:Li,_getEdgeIntersection:Di,_getBitCode:Ri,_sqClosestPointOnSegment:Bi,isFlat:Oi,_flat:Ni,polylineCenter:ji},Ui={project:function(e){return new A(e.lng,e.lat)},unproject:function(e){return new j(e.y,e.x)},bounds:new F([-180,-90],[180,90])},Zi={R:6378137,R_MINOR:6356752.314245179,bounds:new F([-20037508.34279,-15496570.73972],[20037508.34279,18764656.23138]),project:function(e){var t=Math.PI/180,i=this.R,n=e.lat*t,r=this.R_MINOR/i,o=Math.sqrt(1-r*r),a=o*Math.sin(n),s=Math.tan(Math.PI/4-n/2)/Math.pow((1-a)/(1+a),o/2);return n=-i*Math.log(Math.max(s,1e-10)),new A(e.lng*t*i,n)},unproject:function(e){for(var t,i=180/Math.PI,n=this.R,r=this.R_MINOR/n,o=Math.sqrt(1-r*r),a=Math.exp(-e.y/n),s=Math.PI/2-2*Math.atan(a),l=0,c=.1;l<15&&Math.abs(c)>1e-7;l++)t=o*Math.sin(s),t=Math.pow((1-t)/(1+t),o/2),s+=c=Math.PI/2-2*Math.atan(a*t)-s;return new j(s*i,e.x*i/n)}},Gi={__proto__:null,LonLat:Ui,Mercator:Zi,SphericalMercator:$},qi=i({},G,{code:"EPSG:3395",projection:Zi,transformation:function(){var e=.5/(Math.PI*Zi.R);return H(e,.5,-e,.5)}()}),$i=i({},G,{code:"EPSG:4326",projection:Ui,transformation:H(1/180,1,-1/180,.5)}),Wi=i({},Z,{projection:Ui,transformation:H(1,0,-1,0),scale:function(e){return Math.pow(2,e)},zoom:function(e){return Math.log(e)/Math.LN2},distance:function(e,t){var i=t.lng-e.lng,n=t.lat-e.lat;return Math.sqrt(i*i+n*n)},infinite:!0});Z.Earth=G,Z.EPSG3395=qi,Z.EPSG3857=Y,Z.EPSG900913=K,Z.EPSG4326=$i,Z.Simple=Wi;var Hi=z.extend({options:{pane:"overlayPane",attribution:null,bubblingMouseEvents:!0},addTo:function(e){return e.addLayer(this),this},remove:function(){return this.removeFrom(this._map||this._mapToAdd)},removeFrom:function(e){return e&&e.removeLayer(this),this},getPane:function(e){return this._map.getPane(e?this.options[e]||e:this.options.pane)},addInteractiveTarget:function(e){return this._map._targets[a(e)]=this,this},removeInteractiveTarget:function(e){return delete this._map._targets[a(e)],this},getAttribution:function(){return this.options.attribution},_layerAdd:function(e){var t=e.target;if(t.hasLayer(this)){if(this._map=t,this._zoomAnimated=t._zoomAnimated,this.getEvents){var i=this.getEvents();t.on(i,this),this.once("remove",function(){t.off(i,this)},this)}this.onAdd(t),this.fire("add"),t.fire("layeradd",{layer:this})}}});oi.include({addLayer:function(e){if(!e._layerAdd)throw new Error("The provided object is not a Layer.");var t=a(e);return this._layers[t]||(this._layers[t]=e,e._mapToAdd=this,e.beforeAdd&&e.beforeAdd(this),this.whenReady(e._layerAdd,e)),this},removeLayer:function(e){var t=a(e);return this._layers[t]?(this._loaded&&e.onRemove(this),delete this._layers[t],this._loaded&&(this.fire("layerremove",{layer:e}),e.fire("remove")),e._map=e._mapToAdd=null,this):this},hasLayer:function(e){return a(e)in this._layers},eachLayer:function(e,t){for(var i in this._layers)e.call(t,this._layers[i]);return this},_addLayers:function(e){for(var t=0,i=(e=e?_(e)?e:[e]:[]).length;t<i;t++)this.addLayer(e[t])},_addZoomLimit:function(e){isNaN(e.options.maxZoom)&&isNaN(e.options.minZoom)||(this._zoomBoundLayers[a(e)]=e,this._updateZoomLevels())},_removeZoomLimit:function(e){var t=a(e);this._zoomBoundLayers[t]&&(delete this._zoomBoundLayers[t],this._updateZoomLevels())},_updateZoomLevels:function(){var e=1/0,t=-1/0,i=this._getZoomSpan();for(var n in this._zoomBoundLayers){var r=this._zoomBoundLayers[n].options;e=void 0===r.minZoom?e:Math.min(e,r.minZoom),t=void 0===r.maxZoom?t:Math.max(t,r.maxZoom)}this._layersMaxZoom=t===-1/0?void 0:t,this._layersMinZoom=e===1/0?void 0:e,i!==this._getZoomSpan()&&this.fire("zoomlevelschange"),void 0===this.options.maxZoom&&this._layersMaxZoom&&this.getZoom()>this._layersMaxZoom&&this.setZoom(this._layersMaxZoom),void 0===this.options.minZoom&&this._layersMinZoom&&this.getZoom()<this._layersMinZoom&&this.setZoom(this._layersMinZoom)}});var Xi=Hi.extend({initialize:function(e,t){var i,n;if(p(this,t),this._layers={},e)for(i=0,n=e.length;i<n;i++)this.addLayer(e[i])},addLayer:function(e){var t=this.getLayerId(e);return this._layers[t]=e,this._map&&this._map.addLayer(e),this},removeLayer:function(e){var t=e in this._layers?e:this.getLayerId(e);return this._map&&this._layers[t]&&this._map.removeLayer(this._layers[t]),delete this._layers[t],this},hasLayer:function(e){return("number"==typeof e?e:this.getLayerId(e))in this._layers},clearLayers:function(){return this.eachLayer(this.removeLayer,this)},invoke:function(e){var t,i,n=Array.prototype.slice.call(arguments,1);for(t in this._layers)(i=this._layers[t])[e]&&i[e].apply(i,n);return this},onAdd:function(e){this.eachLayer(e.addLayer,e)},onRemove:function(e){this.eachLayer(e.removeLayer,e)},eachLayer:function(e,t){for(var i in this._layers)e.call(t,this._layers[i]);return this},getLayer:function(e){return this._layers[e]},getLayers:function(){var e=[];return this.eachLayer(e.push,e),e},setZIndex:function(e){return this.invoke("setZIndex",e)},getLayerId:function(e){return a(e)}}),Yi=function(e,t){return new Xi(e,t)},Ki=Xi.extend({addLayer:function(e){return this.hasLayer(e)?this:(e.addEventParent(this),Xi.prototype.addLayer.call(this,e),this.fire("layeradd",{layer:e}))},removeLayer:function(e){return this.hasLayer(e)?(e in this._layers&&(e=this._layers[e]),e.removeEventParent(this),Xi.prototype.removeLayer.call(this,e),this.fire("layerremove",{layer:e})):this},setStyle:function(e){return this.invoke("setStyle",e)},bringToFront:function(){return this.invoke("bringToFront")},bringToBack:function(){return this.invoke("bringToBack")},getBounds:function(){var e=new O;for(var t in this._layers){var i=this._layers[t];e.extend(i.getBounds?i.getBounds():i.getLatLng())}return e}}),Qi=function(e,t){return new Ki(e,t)},Ji=C.extend({options:{popupAnchor:[0,0],tooltipAnchor:[0,0],crossOrigin:!1},initialize:function(e){p(this,e)},createIcon:function(e){return this._createIcon("icon",e)},createShadow:function(e){return this._createIcon("shadow",e)},_createIcon:function(e,t){var i=this._getIconUrl(e);if(!i){if("icon"===e)throw new Error("iconUrl not set in Icon options (see the docs).");return null}var n=this._createImg(i,t&&"IMG"===t.tagName?t:null);return this._setIconStyles(n,e),(this.options.crossOrigin||""===this.options.crossOrigin)&&(n.crossOrigin=!0===this.options.crossOrigin?"":this.options.crossOrigin),n},_setIconStyles:function(e,t){var i=this.options,n=i[t+"Size"];"number"==typeof n&&(n=[n,n]);var r=R(n),o=R("shadow"===t&&i.shadowAnchor||i.iconAnchor||r&&r.divideBy(2,!0));e.className="leaflet-marker-"+t+" "+(i.className||""),o&&(e.style.marginLeft=-o.x+"px",e.style.marginTop=-o.y+"px"),r&&(e.style.width=r.x+"px",e.style.height=r.y+"px")},_createImg:function(e,t){return(t=t||document.createElement("img")).src=e,t},_getIconUrl:function(e){return Ne.retina&&this.options[e+"RetinaUrl"]||this.options[e+"Url"]}});function en(e){return new Ji(e)}var tn=Ji.extend({options:{iconUrl:"marker-icon.png",iconRetinaUrl:"marker-icon-2x.png",shadowUrl:"marker-shadow.png",iconSize:[25,41],iconAnchor:[12,41],popupAnchor:[1,-34],tooltipAnchor:[16,-28],shadowSize:[41,41]},_getIconUrl:function(e){return"string"!=typeof tn.imagePath&&(tn.imagePath=this._detectIconPath()),(this.options.imagePath||tn.imagePath)+Ji.prototype._getIconUrl.call(this,e)},_stripUrl:function(e){var t=function(e,t,i){var n=t.exec(e);return n&&n[i]};return(e=t(e,/^url\((['"])?(.+)\1\)$/,2))&&t(e,/^(.*)marker-icon\.png$/,1)},_detectIconPath:function(){var e=gt("div","leaflet-default-icon-path",document.body),t=mt(e,"background-image")||mt(e,"backgroundImage");if(document.body.removeChild(e),t=this._stripUrl(t))return t;var i=document.querySelector('link[href$="leaflet.css"]');return i?i.href.substring(0,i.href.length-11-1):""}}),nn=yi.extend({initialize:function(e){this._marker=e},addHooks:function(){var e=this._marker._icon;this._draggable||(this._draggable=new bi(e,e,!0)),this._draggable.on({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).enable(),wt(e,"leaflet-marker-draggable")},removeHooks:function(){this._draggable.off({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).disable(),this._marker._icon&&Tt(this._marker._icon,"leaflet-marker-draggable")},moved:function(){return this._draggable&&this._draggable._moved},_adjustPan:function(e){var t=this._marker,i=t._map,n=this._marker.options.autoPanSpeed,r=this._marker.options.autoPanPadding,o=zt(t._icon),a=i.getPixelBounds(),s=i.getPixelOrigin(),l=B(a.min._subtract(s).add(r),a.max._subtract(s).subtract(r));if(!l.contains(o)){var c=R((Math.max(l.max.x,o.x)-l.max.x)/(a.max.x-l.max.x)-(Math.min(l.min.x,o.x)-l.min.x)/(a.min.x-l.min.x),(Math.max(l.max.y,o.y)-l.max.y)/(a.max.y-l.max.y)-(Math.min(l.min.y,o.y)-l.min.y)/(a.min.y-l.min.y)).multiplyBy(n);i.panBy(c,{animate:!1}),this._draggable._newPos._add(c),this._draggable._startPos._add(c),It(t._icon,this._draggable._newPos),this._onDrag(e),this._panRequest=P(this._adjustPan.bind(this,e))}},_onDragStart:function(){this._oldLatLng=this._marker.getLatLng(),this._marker.closePopup&&this._marker.closePopup(),this._marker.fire("movestart").fire("dragstart")},_onPreDrag:function(e){this._marker.options.autoPan&&(M(this._panRequest),this._panRequest=P(this._adjustPan.bind(this,e)))},_onDrag:function(e){var t=this._marker,i=t._shadow,n=zt(t._icon),r=t._map.layerPointToLatLng(n);i&&It(i,n),t._latlng=r,e.latlng=r,e.oldLatLng=this._oldLatLng,t.fire("move",e).fire("drag",e)},_onDragEnd:function(e){M(this._panRequest),delete this._oldLatLng,this._marker.fire("moveend").fire("dragend",e)}}),rn=Hi.extend({options:{icon:new tn,interactive:!0,keyboard:!0,title:"",alt:"Marker",zIndexOffset:0,opacity:1,riseOnHover:!1,riseOffset:250,pane:"markerPane",shadowPane:"shadowPane",bubblingMouseEvents:!1,autoPanOnFocus:!0,draggable:!1,autoPan:!1,autoPanPadding:[50,50],autoPanSpeed:10},initialize:function(e,t){p(this,t),this._latlng=V(e)},onAdd:function(e){this._zoomAnimated=this._zoomAnimated&&e.options.markerZoomAnimation,this._zoomAnimated&&e.on("zoomanim",this._animateZoom,this),this._initIcon(),this.update()},onRemove:function(e){this.dragging&&this.dragging.enabled()&&(this.options.draggable=!0,this.dragging.removeHooks()),delete this.dragging,this._zoomAnimated&&e.off("zoomanim",this._animateZoom,this),this._removeIcon(),this._removeShadow()},getEvents:function(){return{zoom:this.update,viewreset:this.update}},getLatLng:function(){return this._latlng},setLatLng:function(e){var t=this._latlng;return this._latlng=V(e),this.update(),this.fire("move",{oldLatLng:t,latlng:this._latlng})},setZIndexOffset:function(e){return this.options.zIndexOffset=e,this.update()},getIcon:function(){return this.options.icon},setIcon:function(e){return this.options.icon=e,this._map&&(this._initIcon(),this.update()),this._popup&&this.bindPopup(this._popup,this._popup.options),this},getElement:function(){return this._icon},update:function(){if(this._icon&&this._map){var e=this._map.latLngToLayerPoint(this._latlng).round();this._setPos(e)}return this},_initIcon:function(){var e=this.options,t="leaflet-zoom-"+(this._zoomAnimated?"animated":"hide"),i=e.icon.createIcon(this._icon),n=!1;i!==this._icon&&(this._icon&&this._removeIcon(),n=!0,e.title&&(i.title=e.title),"IMG"===i.tagName&&(i.alt=e.alt||"")),wt(i,t),e.keyboard&&(i.tabIndex="0",i.setAttribute("role","button")),this._icon=i,e.riseOnHover&&this.on({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&jt(i,"focus",this._panOnFocus,this);var r=e.icon.createShadow(this._shadow),o=!1;r!==this._shadow&&(this._removeShadow(),o=!0),r&&(wt(r,t),r.alt=""),this._shadow=r,e.opacity<1&&this._updateOpacity(),n&&this.getPane().appendChild(this._icon),this._initInteraction(),r&&o&&this.getPane(e.shadowPane).appendChild(this._shadow)},_removeIcon:function(){this.options.riseOnHover&&this.off({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&Ut(this._icon,"focus",this._panOnFocus,this),_t(this._icon),this.removeInteractiveTarget(this._icon),this._icon=null},_removeShadow:function(){this._shadow&&_t(this._shadow),this._shadow=null},_setPos:function(e){this._icon&&It(this._icon,e),this._shadow&&It(this._shadow,e),this._zIndex=e.y+this.options.zIndexOffset,this._resetZIndex()},_updateZIndex:function(e){this._icon&&(this._icon.style.zIndex=this._zIndex+e)},_animateZoom:function(e){var t=this._map._latLngToNewLayerPoint(this._latlng,e.zoom,e.center).round();this._setPos(t)},_initInteraction:function(){if(this.options.interactive&&(wt(this._icon,"leaflet-interactive"),this.addInteractiveTarget(this._icon),nn)){var e=this.options.draggable;this.dragging&&(e=this.dragging.enabled(),this.dragging.disable()),this.dragging=new nn(this),e&&this.dragging.enable()}},setOpacity:function(e){return this.options.opacity=e,this._map&&this._updateOpacity(),this},_updateOpacity:function(){var e=this.options.opacity;this._icon&&Mt(this._icon,e),this._shadow&&Mt(this._shadow,e)},_bringToFront:function(){this._updateZIndex(this.options.riseOffset)},_resetZIndex:function(){this._updateZIndex(0)},_panOnFocus:function(){var e=this._map;if(e){var t=this.options.icon.options,i=t.iconSize?R(t.iconSize):R(0,0),n=t.iconAnchor?R(t.iconAnchor):R(0,0);e.panInside(this._latlng,{paddingTopLeft:n,paddingBottomRight:i.subtract(n)})}},_getPopupAnchor:function(){return this.options.icon.options.popupAnchor},_getTooltipAnchor:function(){return this.options.icon.options.tooltipAnchor}});function on(e,t){return new rn(e,t)}var an=Hi.extend({options:{stroke:!0,color:"#3388ff",weight:3,opacity:1,lineCap:"round",lineJoin:"round",dashArray:null,dashOffset:null,fill:!1,fillColor:null,fillOpacity:.2,fillRule:"evenodd",interactive:!0,bubblingMouseEvents:!0},beforeAdd:function(e){this._renderer=e.getRenderer(this)},onAdd:function(){this._renderer._initPath(this),this._reset(),this._renderer._addPath(this)},onRemove:function(){this._renderer._removePath(this)},redraw:function(){return this._map&&this._renderer._updatePath(this),this},setStyle:function(e){return p(this,e),this._renderer&&(this._renderer._updateStyle(this),this.options.stroke&&e&&Object.prototype.hasOwnProperty.call(e,"weight")&&this._updateBounds()),this},bringToFront:function(){return this._renderer&&this._renderer._bringToFront(this),this},bringToBack:function(){return this._renderer&&this._renderer._bringToBack(this),this},getElement:function(){return this._path},_reset:function(){this._project(),this._update()},_clickTolerance:function(){return(this.options.stroke?this.options.weight/2:0)+(this._renderer.options.tolerance||0)}}),sn=an.extend({options:{fill:!0,radius:10},initialize:function(e,t){p(this,t),this._latlng=V(e),this._radius=this.options.radius},setLatLng:function(e){var t=this._latlng;return this._latlng=V(e),this.redraw(),this.fire("move",{oldLatLng:t,latlng:this._latlng})},getLatLng:function(){return this._latlng},setRadius:function(e){return this.options.radius=this._radius=e,this.redraw()},getRadius:function(){return this._radius},setStyle:function(e){var t=e&&e.radius||this._radius;return an.prototype.setStyle.call(this,e),this.setRadius(t),this},_project:function(){this._point=this._map.latLngToLayerPoint(this._latlng),this._updateBounds()},_updateBounds:function(){var e=this._radius,t=this._radiusY||e,i=this._clickTolerance(),n=[e+i,t+i];this._pxBounds=new F(this._point.subtract(n),this._point.add(n))},_update:function(){this._map&&this._updatePath()},_updatePath:function(){this._renderer._updateCircle(this)},_empty:function(){return this._radius&&!this._renderer._bounds.intersects(this._pxBounds)},_containsPoint:function(e){return e.distanceTo(this._point)<=this._radius+this._clickTolerance()}});function ln(e,t){return new sn(e,t)}var cn=sn.extend({initialize:function(e,t,n){if("number"==typeof t&&(t=i({},n,{radius:t})),p(this,t),this._latlng=V(e),isNaN(this.options.radius))throw new Error("Circle radius cannot be NaN");this._mRadius=this.options.radius},setRadius:function(e){return this._mRadius=e,this.redraw()},getRadius:function(){return this._mRadius},getBounds:function(){var e=[this._radius,this._radiusY||this._radius];return new O(this._map.layerPointToLatLng(this._point.subtract(e)),this._map.layerPointToLatLng(this._point.add(e)))},setStyle:an.prototype.setStyle,_project:function(){var e=this._latlng.lng,t=this._latlng.lat,i=this._map,n=i.options.crs;if(n.distance===G.distance){var r=Math.PI/180,o=this._mRadius/G.R/r,a=i.project([t+o,e]),s=i.project([t-o,e]),l=a.add(s).divideBy(2),c=i.unproject(l).lat,u=Math.acos((Math.cos(o*r)-Math.sin(t*r)*Math.sin(c*r))/(Math.cos(t*r)*Math.cos(c*r)))/r;(isNaN(u)||0===u)&&(u=o/Math.cos(Math.PI/180*t)),this._point=l.subtract(i.getPixelOrigin()),this._radius=isNaN(u)?0:l.x-i.project([c,e-u]).x,this._radiusY=l.y-a.y}else{var h=n.unproject(n.project(this._latlng).subtract([this._mRadius,0]));this._point=i.latLngToLayerPoint(this._latlng),this._radius=this._point.x-i.latLngToLayerPoint(h).x}this._updateBounds()}});function un(e,t,i){return new cn(e,t,i)}var hn=an.extend({options:{smoothFactor:1,noClip:!1},initialize:function(e,t){p(this,t),this._setLatLngs(e)},getLatLngs:function(){return this._latlngs},setLatLngs:function(e){return this._setLatLngs(e),this.redraw()},isEmpty:function(){return!this._latlngs.length},closestLayerPoint:function(e){for(var t,i,n=1/0,r=null,o=Bi,a=0,s=this._parts.length;a<s;a++)for(var l=this._parts[a],c=1,u=l.length;c<u;c++){var h=o(e,t=l[c-1],i=l[c],!0);h<n&&(n=h,r=o(e,t,i))}return r&&(r.distance=Math.sqrt(n)),r},getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");return ji(this._defaultShape(),this._map.options.crs)},getBounds:function(){return this._bounds},addLatLng:function(e,t){return t=t||this._defaultShape(),e=V(e),t.push(e),this._bounds.extend(e),this.redraw()},_setLatLngs:function(e){this._bounds=new O,this._latlngs=this._convertLatLngs(e)},_defaultShape:function(){return Oi(this._latlngs)?this._latlngs:this._latlngs[0]},_convertLatLngs:function(e){for(var t=[],i=Oi(e),n=0,r=e.length;n<r;n++)i?(t[n]=V(e[n]),this._bounds.extend(t[n])):t[n]=this._convertLatLngs(e[n]);return t},_project:function(){var e=new F;this._rings=[],this._projectLatlngs(this._latlngs,this._rings,e),this._bounds.isValid()&&e.isValid()&&(this._rawPxBounds=e,this._updateBounds())},_updateBounds:function(){var e=this._clickTolerance(),t=new A(e,e);this._rawPxBounds&&(this._pxBounds=new F([this._rawPxBounds.min.subtract(t),this._rawPxBounds.max.add(t)]))},_projectLatlngs:function(e,t,i){var n,r,o=e[0]instanceof j,a=e.length;if(o){for(r=[],n=0;n<a;n++)r[n]=this._map.latLngToLayerPoint(e[n]),i.extend(r[n]);t.push(r)}else for(n=0;n<a;n++)this._projectLatlngs(e[n],t,i)},_clipPoints:function(){var e=this._renderer._bounds;if(this._parts=[],this._pxBounds&&this._pxBounds.intersects(e))if(this.options.noClip)this._parts=this._rings;else{var t,i,n,r,o,a,s,l=this._parts;for(t=0,n=0,r=this._rings.length;t<r;t++)for(i=0,o=(s=this._rings[t]).length;i<o-1;i++)(a=Li(s[i],s[i+1],e,i,!0))&&(l[n]=l[n]||[],l[n].push(a[0]),a[1]===s[i+1]&&i!==o-2||(l[n].push(a[1]),n++))}},_simplifyPoints:function(){for(var e=this._parts,t=this.options.smoothFactor,i=0,n=e.length;i<n;i++)e[i]=Ei(e[i],t)},_update:function(){this._map&&(this._clipPoints(),this._simplifyPoints(),this._updatePath())},_updatePath:function(){this._renderer._updatePoly(this)},_containsPoint:function(e,t){var i,n,r,o,a,s,l=this._clickTolerance();if(!this._pxBounds||!this._pxBounds.contains(e))return!1;for(i=0,o=this._parts.length;i<o;i++)for(n=0,r=(a=(s=this._parts[i]).length)-1;n<a;r=n++)if((t||0!==n)&&Ci(e,s[r],s[n])<=l)return!0;return!1}});function dn(e,t){return new hn(e,t)}hn._flat=Ni;var pn=hn.extend({options:{fill:!0},isEmpty:function(){return!this._latlngs.length||!this._latlngs[0].length},getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");return Ti(this._defaultShape(),this._map.options.crs)},_convertLatLngs:function(e){var t=hn.prototype._convertLatLngs.call(this,e),i=t.length;return i>=2&&t[0]instanceof j&&t[0].equals(t[i-1])&&t.pop(),t},_setLatLngs:function(e){hn.prototype._setLatLngs.call(this,e),Oi(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return Oi(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var e=this._renderer._bounds,t=this.options.weight,i=new A(t,t);if(e=new F(e.min.subtract(i),e.max.add(i)),this._parts=[],this._pxBounds&&this._pxBounds.intersects(e))if(this.options.noClip)this._parts=this._rings;else for(var n,r=0,o=this._rings.length;r<o;r++)(n=wi(this._rings[r],e,!0)).length&&this._parts.push(n)},_updatePath:function(){this._renderer._updatePoly(this,!0)},_containsPoint:function(e){var t,i,n,r,o,a,s,l,c=!1;if(!this._pxBounds||!this._pxBounds.contains(e))return!1;for(r=0,s=this._parts.length;r<s;r++)for(o=0,a=(l=(t=this._parts[r]).length)-1;o<l;a=o++)i=t[o],n=t[a],i.y>e.y!=n.y>e.y&&e.x<(n.x-i.x)*(e.y-i.y)/(n.y-i.y)+i.x&&(c=!c);return c||hn.prototype._containsPoint.call(this,e,!0)}});function fn(e,t){return new pn(e,t)}var mn=Ki.extend({initialize:function(e,t){p(this,t),this._layers={},e&&this.addData(e)},addData:function(e){var t,i,n,r=_(e)?e:e.features;if(r){for(t=0,i=r.length;t<i;t++)((n=r[t]).geometries||n.geometry||n.features||n.coordinates)&&this.addData(n);return this}var o=this.options;if(o.filter&&!o.filter(e))return this;var a=gn(e,o);return a?(a.feature=Tn(e),a.defaultOptions=a.options,this.resetStyle(a),o.onEachFeature&&o.onEachFeature(e,a),this.addLayer(a)):this},resetStyle:function(e){return void 0===e?this.eachLayer(this.resetStyle,this):(e.options=i({},e.defaultOptions),this._setLayerStyle(e,this.options.style),this)},setStyle:function(e){return this.eachLayer(function(t){this._setLayerStyle(t,e)},this)},_setLayerStyle:function(e,t){e.setStyle&&("function"==typeof t&&(t=t(e.feature)),e.setStyle(t))}});function gn(e,t){var i,n,r,o,a="Feature"===e.type?e.geometry:e,s=a?a.coordinates:null,l=[],c=t&&t.pointToLayer,u=t&&t.coordsToLatLng||yn;if(!s&&!a)return null;switch(a.type){case"Point":return _n(c,e,i=u(s),t);case"MultiPoint":for(r=0,o=s.length;r<o;r++)i=u(s[r]),l.push(_n(c,e,i,t));return new Ki(l);case"LineString":case"MultiLineString":return n=vn(s,"LineString"===a.type?0:1,u),new hn(n,t);case"Polygon":case"MultiPolygon":return n=vn(s,"Polygon"===a.type?1:2,u),new pn(n,t);case"GeometryCollection":for(r=0,o=a.geometries.length;r<o;r++){var h=gn({geometry:a.geometries[r],type:"Feature",properties:e.properties},t);h&&l.push(h)}return new Ki(l);case"FeatureCollection":for(r=0,o=a.features.length;r<o;r++){var d=gn(a.features[r],t);d&&l.push(d)}return new Ki(l);default:throw new Error("Invalid GeoJSON object.")}}function _n(e,t,i,n){return e?e(t,i):new rn(i,n&&n.markersInheritOptions&&n)}function yn(e){return new j(e[1],e[0],e[2])}function vn(e,t,i){for(var n,r=[],o=0,a=e.length;o<a;o++)n=t?vn(e[o],t-1,i):(i||yn)(e[o]),r.push(n);return r}function xn(e,t){return void 0!==(e=V(e)).alt?[u(e.lng,t),u(e.lat,t),u(e.alt,t)]:[u(e.lng,t),u(e.lat,t)]}function bn(e,t,i,n){for(var r=[],o=0,a=e.length;o<a;o++)r.push(t?bn(e[o],Oi(e[o])?0:t-1,i,n):xn(e[o],n));return!t&&i&&r.length>0&&r.push(r[0].slice()),r}function wn(e,t){return e.feature?i({},e.feature,{geometry:t}):Tn(t)}function Tn(e){return"Feature"===e.type||"FeatureCollection"===e.type?e:{type:"Feature",properties:{},geometry:e}}var Sn={toGeoJSON:function(e){return wn(this,{type:"Point",coordinates:xn(this.getLatLng(),e)})}};function Pn(e,t){return new mn(e,t)}rn.include(Sn),cn.include(Sn),sn.include(Sn),hn.include({toGeoJSON:function(e){var t=!Oi(this._latlngs);return wn(this,{type:(t?"Multi":"")+"LineString",coordinates:bn(this._latlngs,t?1:0,!1,e)})}}),pn.include({toGeoJSON:function(e){var t=!Oi(this._latlngs),i=t&&!Oi(this._latlngs[0]),n=bn(this._latlngs,i?2:t?1:0,!0,e);return t||(n=[n]),wn(this,{type:(i?"Multi":"")+"Polygon",coordinates:n})}}),Xi.include({toMultiPoint:function(e){var t=[];return this.eachLayer(function(i){t.push(i.toGeoJSON(e).geometry.coordinates)}),wn(this,{type:"MultiPoint",coordinates:t})},toGeoJSON:function(e){var t=this.feature&&this.feature.geometry&&this.feature.geometry.type;if("MultiPoint"===t)return this.toMultiPoint(e);var i="GeometryCollection"===t,n=[];return this.eachLayer(function(t){if(t.toGeoJSON){var r=t.toGeoJSON(e);if(i)n.push(r.geometry);else{var o=Tn(r);"FeatureCollection"===o.type?n.push.apply(n,o.features):n.push(o)}}}),i?wn(this,{geometries:n,type:"GeometryCollection"}):{type:"FeatureCollection",features:n}}});var Mn=Pn,En=Hi.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(e,t,i){this._url=e,this._bounds=N(t),p(this,i)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(wt(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){_t(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},setOpacity:function(e){return this.options.opacity=e,this._image&&this._updateOpacity(),this},setStyle:function(e){return e.opacity&&this.setOpacity(e.opacity),this},bringToFront:function(){return this._map&&vt(this._image),this},bringToBack:function(){return this._map&&xt(this._image),this},setUrl:function(e){return this._url=e,this._image&&(this._image.src=e),this},setBounds:function(e){return this._bounds=N(e),this._map&&this._reset(),this},getEvents:function(){var e={zoom:this._reset,viewreset:this._reset};return this._zoomAnimated&&(e.zoomanim=this._animateZoom),e},setZIndex:function(e){return this.options.zIndex=e,this._updateZIndex(),this},getBounds:function(){return this._bounds},getElement:function(){return this._image},_initImage:function(){var e="IMG"===this._url.tagName,t=this._image=e?this._url:gt("img");wt(t,"leaflet-image-layer"),this._zoomAnimated&&wt(t,"leaflet-zoom-animated"),this.options.className&&wt(t,this.options.className),t.onselectstart=c,t.onmousemove=c,t.onload=r(this.fire,this,"load"),t.onerror=r(this._overlayOnError,this,"error"),(this.options.crossOrigin||""===this.options.crossOrigin)&&(t.crossOrigin=!0===this.options.crossOrigin?"":this.options.crossOrigin),this.options.zIndex&&this._updateZIndex(),e?this._url=t.src:(t.src=this._url,t.alt=this.options.alt)},_animateZoom:function(e){var t=this._map.getZoomScale(e.zoom),i=this._map._latLngBoundsToNewLayerBounds(this._bounds,e.zoom,e.center).min;kt(this._image,i,t)},_reset:function(){var e=this._image,t=new F(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),i=t.getSize();It(e,t.min),e.style.width=i.x+"px",e.style.height=i.y+"px"},_updateOpacity:function(){Mt(this._image,this.options.opacity)},_updateZIndex:function(){this._image&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._image.style.zIndex=this.options.zIndex)},_overlayOnError:function(){this.fire("error");var e=this.options.errorOverlayUrl;e&&this._url!==e&&(this._url=e,this._image.src=e)},getCenter:function(){return this._bounds.getCenter()}}),Cn=function(e,t,i){return new En(e,t,i)},kn=En.extend({options:{autoplay:!0,loop:!0,keepAspectRatio:!0,muted:!1,playsInline:!0},_initImage:function(){var e="VIDEO"===this._url.tagName,t=this._image=e?this._url:gt("video");if(wt(t,"leaflet-image-layer"),this._zoomAnimated&&wt(t,"leaflet-zoom-animated"),this.options.className&&wt(t,this.options.className),t.onselectstart=c,t.onmousemove=c,t.onloadeddata=r(this.fire,this,"load"),e){for(var i=t.getElementsByTagName("source"),n=[],o=0;o<i.length;o++)n.push(i[o].src);this._url=i.length>0?n:[t.src]}else{_(this._url)||(this._url=[this._url]),!this.options.keepAspectRatio&&Object.prototype.hasOwnProperty.call(t.style,"objectFit")&&(t.style.objectFit="fill"),t.autoplay=!!this.options.autoplay,t.loop=!!this.options.loop,t.muted=!!this.options.muted,t.playsInline=!!this.options.playsInline;for(var a=0;a<this._url.length;a++){var s=gt("source");s.src=this._url[a],t.appendChild(s)}}}});function In(e,t,i){return new kn(e,t,i)}var zn=En.extend({_initImage:function(){var e=this._image=this._url;wt(e,"leaflet-image-layer"),this._zoomAnimated&&wt(e,"leaflet-zoom-animated"),this.options.className&&wt(e,this.options.className),e.onselectstart=c,e.onmousemove=c}});function An(e,t,i){return new zn(e,t,i)}var Ln=Hi.extend({options:{interactive:!1,offset:[0,0],className:"",pane:void 0,content:""},initialize:function(e,t){e&&(e instanceof j||_(e))?(this._latlng=V(e),p(this,t)):(p(this,e),this._source=t),this.options.content&&(this._content=this.options.content)},openOn:function(e){return(e=arguments.length?e:this._source._map).hasLayer(this)||e.addLayer(this),this},close:function(){return this._map&&this._map.removeLayer(this),this},toggle:function(e){return this._map?this.close():(arguments.length?this._source=e:e=this._source,this._prepareOpen(),this.openOn(e._map)),this},onAdd:function(e){this._zoomAnimated=e._zoomAnimated,this._container||this._initLayout(),e._fadeAnimated&&Mt(this._container,0),clearTimeout(this._removeTimeout),this.getPane().appendChild(this._container),this.update(),e._fadeAnimated&&Mt(this._container,1),this.bringToFront(),this.options.interactive&&(wt(this._container,"leaflet-interactive"),this.addInteractiveTarget(this._container))},onRemove:function(e){e._fadeAnimated?(Mt(this._container,0),this._removeTimeout=setTimeout(r(_t,void 0,this._container),200)):_t(this._container),this.options.interactive&&(Tt(this._container,"leaflet-interactive"),this.removeInteractiveTarget(this._container))},getLatLng:function(){return this._latlng},setLatLng:function(e){return this._latlng=V(e),this._map&&(this._updatePosition(),this._adjustPan()),this},getContent:function(){return this._content},setContent:function(e){return this._content=e,this.update(),this},getElement:function(){return this._container},update:function(){this._map&&(this._container.style.visibility="hidden",this._updateContent(),this._updateLayout(),this._updatePosition(),this._container.style.visibility="",this._adjustPan())},getEvents:function(){var e={zoom:this._updatePosition,viewreset:this._updatePosition};return this._zoomAnimated&&(e.zoomanim=this._animateZoom),e},isOpen:function(){return!!this._map&&this._map.hasLayer(this)},bringToFront:function(){return this._map&&vt(this._container),this},bringToBack:function(){return this._map&&xt(this._container),this},_prepareOpen:function(e){var t=this._source;if(!t._map)return!1;if(t instanceof Ki){t=null;var i=this._source._layers;for(var n in i)if(i[n]._map){t=i[n];break}if(!t)return!1;this._source=t}if(!e)if(t.getCenter)e=t.getCenter();else if(t.getLatLng)e=t.getLatLng();else{if(!t.getBounds)throw new Error("Unable to get source layer LatLng.");e=t.getBounds().getCenter()}return this.setLatLng(e),this._map&&this.update(),!0},_updateContent:function(){if(this._content){var e=this._contentNode,t="function"==typeof this._content?this._content(this._source||this):this._content;if("string"==typeof t)e.innerHTML=t;else{for(;e.hasChildNodes();)e.removeChild(e.firstChild);e.appendChild(t)}this.fire("contentupdate")}},_updatePosition:function(){if(this._map){var e=this._map.latLngToLayerPoint(this._latlng),t=R(this.options.offset),i=this._getAnchor();this._zoomAnimated?It(this._container,e.add(i)):t=t.add(e).add(i);var n=this._containerBottom=-t.y,r=this._containerLeft=-Math.round(this._containerWidth/2)+t.x;this._container.style.bottom=n+"px",this._container.style.left=r+"px"}},_getAnchor:function(){return[0,0]}});oi.include({_initOverlay:function(e,t,i,n){var r=t;return r instanceof e||(r=new e(n).setContent(t)),i&&r.setLatLng(i),r}}),Hi.include({_initOverlay:function(e,t,i,n){var r=i;return r instanceof e?(p(r,n),r._source=this):(r=t&&!n?t:new e(n,this)).setContent(i),r}});var Dn=Ln.extend({options:{pane:"popupPane",offset:[0,7],maxWidth:300,minWidth:50,maxHeight:null,autoPan:!0,autoPanPaddingTopLeft:null,autoPanPaddingBottomRight:null,autoPanPadding:[5,5],keepInView:!1,closeButton:!0,autoClose:!0,closeOnEscapeKey:!0,className:""},openOn:function(e){return!(e=arguments.length?e:this._source._map).hasLayer(this)&&e._popup&&e._popup.options.autoClose&&e.removeLayer(e._popup),e._popup=this,Ln.prototype.openOn.call(this,e)},onAdd:function(e){Ln.prototype.onAdd.call(this,e),e.fire("popupopen",{popup:this}),this._source&&(this._source.fire("popupopen",{popup:this},!0),this._source instanceof an||this._source.on("preclick",Wt))},onRemove:function(e){Ln.prototype.onRemove.call(this,e),e.fire("popupclose",{popup:this}),this._source&&(this._source.fire("popupclose",{popup:this},!0),this._source instanceof an||this._source.off("preclick",Wt))},getEvents:function(){var e=Ln.prototype.getEvents.call(this);return(void 0!==this.options.closeOnClick?this.options.closeOnClick:this._map.options.closePopupOnClick)&&(e.preclick=this.close),this.options.keepInView&&(e.moveend=this._adjustPan),e},_initLayout:function(){var e="leaflet-popup",t=this._container=gt("div",e+" "+(this.options.className||"")+" leaflet-zoom-animated"),i=this._wrapper=gt("div",e+"-content-wrapper",t);if(this._contentNode=gt("div",e+"-content",i),Xt(t),Ht(this._contentNode),jt(t,"contextmenu",Wt),this._tipContainer=gt("div",e+"-tip-container",t),this._tip=gt("div",e+"-tip",this._tipContainer),this.options.closeButton){var n=this._closeButton=gt("a",e+"-close-button",t);n.setAttribute("role","button"),n.setAttribute("aria-label","Close popup"),n.href="#close",n.innerHTML='<span aria-hidden="true">×</span>',jt(n,"click",function(e){Yt(e),this.close()},this)}},_updateLayout:function(){var e=this._contentNode,t=e.style;t.width="",t.whiteSpace="nowrap";var i=e.offsetWidth;i=Math.min(i,this.options.maxWidth),i=Math.max(i,this.options.minWidth),t.width=i+1+"px",t.whiteSpace="",t.height="";var n=e.offsetHeight,r=this.options.maxHeight,o="leaflet-popup-scrolled";r&&n>r?(t.height=r+"px",wt(e,o)):Tt(e,o),this._containerWidth=this._container.offsetWidth},_animateZoom:function(e){var t=this._map._latLngToNewLayerPoint(this._latlng,e.zoom,e.center),i=this._getAnchor();It(this._container,t.add(i))},_adjustPan:function(){if(this.options.autoPan)if(this._map._panAnim&&this._map._panAnim.stop(),this._autopanning)this._autopanning=!1;else{var e=this._map,t=parseInt(mt(this._container,"marginBottom"),10)||0,i=this._container.offsetHeight+t,n=this._containerWidth,r=new A(this._containerLeft,-i-this._containerBottom);r._add(zt(this._container));var o=e.layerPointToContainerPoint(r),a=R(this.options.autoPanPadding),s=R(this.options.autoPanPaddingTopLeft||a),l=R(this.options.autoPanPaddingBottomRight||a),c=e.getSize(),u=0,h=0;o.x+n+l.x>c.x&&(u=o.x+n-c.x+l.x),o.x-u-s.x<0&&(u=o.x-s.x),o.y+i+l.y>c.y&&(h=o.y+i-c.y+l.y),o.y-h-s.y<0&&(h=o.y-s.y),(u||h)&&(this.options.keepInView&&(this._autopanning=!0),e.fire("autopanstart").panBy([u,h]))}},_getAnchor:function(){return R(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),Rn=function(e,t){return new Dn(e,t)};oi.mergeOptions({closePopupOnClick:!0}),oi.include({openPopup:function(e,t,i){return this._initOverlay(Dn,e,t,i).openOn(this),this},closePopup:function(e){return(e=arguments.length?e:this._popup)&&e.close(),this}}),Hi.include({bindPopup:function(e,t){return this._popup=this._initOverlay(Dn,this._popup,e,t),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this},openPopup:function(e){return this._popup&&(this instanceof Ki||(this._popup._source=this),this._popup._prepareOpen(e||this._latlng)&&this._popup.openOn(this._map)),this},closePopup:function(){return this._popup&&this._popup.close(),this},togglePopup:function(){return this._popup&&this._popup.toggle(this),this},isPopupOpen:function(){return!!this._popup&&this._popup.isOpen()},setPopupContent:function(e){return this._popup&&this._popup.setContent(e),this},getPopup:function(){return this._popup},_openPopup:function(e){if(this._popup&&this._map){Kt(e);var t=e.layer||e.target;this._popup._source!==t||t instanceof an?(this._popup._source=t,this.openPopup(e.latlng)):this._map.hasLayer(this._popup)?this.closePopup():this.openPopup(e.latlng)}},_movePopup:function(e){this._popup.setLatLng(e.latlng)},_onKeyPress:function(e){13===e.originalEvent.keyCode&&this._openPopup(e)}});var Fn=Ln.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(e){Ln.prototype.onAdd.call(this,e),this.setOpacity(this.options.opacity),e.fire("tooltipopen",{tooltip:this}),this._source&&(this.addEventParent(this._source),this._source.fire("tooltipopen",{tooltip:this},!0))},onRemove:function(e){Ln.prototype.onRemove.call(this,e),e.fire("tooltipclose",{tooltip:this}),this._source&&(this.removeEventParent(this._source),this._source.fire("tooltipclose",{tooltip:this},!0))},getEvents:function(){var e=Ln.prototype.getEvents.call(this);return this.options.permanent||(e.preclick=this.close),e},_initLayout:function(){var e="leaflet-tooltip "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=gt("div",e),this._container.setAttribute("role","tooltip"),this._container.setAttribute("id","leaflet-tooltip-"+a(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(e){var t,i,n=this._map,r=this._container,o=n.latLngToContainerPoint(n.getCenter()),a=n.layerPointToContainerPoint(e),s=this.options.direction,l=r.offsetWidth,c=r.offsetHeight,u=R(this.options.offset),h=this._getAnchor();"top"===s?(t=l/2,i=c):"bottom"===s?(t=l/2,i=0):"center"===s?(t=l/2,i=c/2):"right"===s?(t=0,i=c/2):"left"===s?(t=l,i=c/2):a.x<o.x?(s="right",t=0,i=c/2):(s="left",t=l+2*(u.x+h.x),i=c/2),e=e.subtract(R(t,i,!0)).add(u).add(h),Tt(r,"leaflet-tooltip-right"),Tt(r,"leaflet-tooltip-left"),Tt(r,"leaflet-tooltip-top"),Tt(r,"leaflet-tooltip-bottom"),wt(r,"leaflet-tooltip-"+s),It(r,e)},_updatePosition:function(){var e=this._map.latLngToLayerPoint(this._latlng);this._setPosition(e)},setOpacity:function(e){this.options.opacity=e,this._container&&Mt(this._container,e)},_animateZoom:function(e){var t=this._map._latLngToNewLayerPoint(this._latlng,e.zoom,e.center);this._setPosition(t)},_getAnchor:function(){return R(this._source&&this._source._getTooltipAnchor&&!this.options.sticky?this._source._getTooltipAnchor():[0,0])}}),Bn=function(e,t){return new Fn(e,t)};oi.include({openTooltip:function(e,t,i){return this._initOverlay(Fn,e,t,i).openOn(this),this},closeTooltip:function(e){return e.close(),this}}),Hi.include({bindTooltip:function(e,t){return this._tooltip&&this.isTooltipOpen()&&this.unbindTooltip(),this._tooltip=this._initOverlay(Fn,this._tooltip,e,t),this._initTooltipInteractions(),this._tooltip.options.permanent&&this._map&&this._map.hasLayer(this)&&this.openTooltip(),this},unbindTooltip:function(){return this._tooltip&&(this._initTooltipInteractions(!0),this.closeTooltip(),this._tooltip=null),this},_initTooltipInteractions:function(e){if(e||!this._tooltipHandlersAdded){var t=e?"off":"on",i={remove:this.closeTooltip,move:this._moveTooltip};this._tooltip.options.permanent?i.add=this._openTooltip:(i.mouseover=this._openTooltip,i.mouseout=this.closeTooltip,i.click=this._openTooltip,this._map?this._addFocusListeners():i.add=this._addFocusListeners),this._tooltip.options.sticky&&(i.mousemove=this._moveTooltip),this[t](i),this._tooltipHandlersAdded=!e}},openTooltip:function(e){return this._tooltip&&(this instanceof Ki||(this._tooltip._source=this),this._tooltip._prepareOpen(e)&&(this._tooltip.openOn(this._map),this.getElement?this._setAriaDescribedByOnLayer(this):this.eachLayer&&this.eachLayer(this._setAriaDescribedByOnLayer,this))),this},closeTooltip:function(){if(this._tooltip)return this._tooltip.close()},toggleTooltip:function(){return this._tooltip&&this._tooltip.toggle(this),this},isTooltipOpen:function(){return this._tooltip.isOpen()},setTooltipContent:function(e){return this._tooltip&&this._tooltip.setContent(e),this},getTooltip:function(){return this._tooltip},_addFocusListeners:function(){this.getElement?this._addFocusListenersOnLayer(this):this.eachLayer&&this.eachLayer(this._addFocusListenersOnLayer,this)},_addFocusListenersOnLayer:function(e){var t="function"==typeof e.getElement&&e.getElement();t&&(jt(t,"focus",function(){this._tooltip._source=e,this.openTooltip()},this),jt(t,"blur",this.closeTooltip,this))},_setAriaDescribedByOnLayer:function(e){var t="function"==typeof e.getElement&&e.getElement();t&&t.setAttribute("aria-describedby",this._tooltip._container.id)},_openTooltip:function(e){if(this._tooltip&&this._map)if(this._map.dragging&&this._map.dragging.moving()&&!this._openOnceFlag){this._openOnceFlag=!0;var t=this;this._map.once("moveend",function(){t._openOnceFlag=!1,t._openTooltip(e)})}else this._tooltip._source=e.layer||e.target,this.openTooltip(this._tooltip.options.sticky?e.latlng:void 0)},_moveTooltip:function(e){var t,i,n=e.latlng;this._tooltip.options.sticky&&e.originalEvent&&(t=this._map.mouseEventToContainerPoint(e.originalEvent),i=this._map.containerPointToLayerPoint(t),n=this._map.layerPointToLatLng(i)),this._tooltip.setLatLng(n)}});var On=Ji.extend({options:{iconSize:[12,12],html:!1,bgPos:null,className:"leaflet-div-icon"},createIcon:function(e){var t=e&&"DIV"===e.tagName?e:document.createElement("div"),i=this.options;if(i.html instanceof Element?(yt(t),t.appendChild(i.html)):t.innerHTML=!1!==i.html?i.html:"",i.bgPos){var n=R(i.bgPos);t.style.backgroundPosition=-n.x+"px "+-n.y+"px"}return this._setIconStyles(t,"icon"),t},createShadow:function(){return null}});function Nn(e){return new On(e)}Ji.Default=tn;var jn=Hi.extend({options:{tileSize:256,opacity:1,updateWhenIdle:Ne.mobile,updateWhenZooming:!0,updateInterval:200,zIndex:1,bounds:null,minZoom:0,maxZoom:void 0,maxNativeZoom:void 0,minNativeZoom:void 0,noWrap:!1,pane:"tilePane",className:"",keepBuffer:2},initialize:function(e){p(this,e)},onAdd:function(){this._initContainer(),this._levels={},this._tiles={},this._resetView()},beforeAdd:function(e){e._addZoomLimit(this)},onRemove:function(e){this._removeAllTiles(),_t(this._container),e._removeZoomLimit(this),this._container=null,this._tileZoom=void 0},bringToFront:function(){return this._map&&(vt(this._container),this._setAutoZIndex(Math.max)),this},bringToBack:function(){return this._map&&(xt(this._container),this._setAutoZIndex(Math.min)),this},getContainer:function(){return this._container},setOpacity:function(e){return this.options.opacity=e,this._updateOpacity(),this},setZIndex:function(e){return this.options.zIndex=e,this._updateZIndex(),this},isLoading:function(){return this._loading},redraw:function(){if(this._map){this._removeAllTiles();var e=this._clampZoom(this._map.getZoom());e!==this._tileZoom&&(this._tileZoom=e,this._updateLevels()),this._update()}return this},getEvents:function(){var e={viewprereset:this._invalidateAll,viewreset:this._resetView,zoom:this._resetView,moveend:this._onMoveEnd};return this.options.updateWhenIdle||(this._onMove||(this._onMove=s(this._onMoveEnd,this.options.updateInterval,this)),e.move=this._onMove),this._zoomAnimated&&(e.zoomanim=this._animateZoom),e},createTile:function(){return document.createElement("div")},getTileSize:function(){var e=this.options.tileSize;return e instanceof A?e:new A(e,e)},_updateZIndex:function(){this._container&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._container.style.zIndex=this.options.zIndex)},_setAutoZIndex:function(e){for(var t,i=this.getPane().children,n=-e(-1/0,1/0),r=0,o=i.length;r<o;r++)t=i[r].style.zIndex,i[r]!==this._container&&t&&(n=e(n,+t));isFinite(n)&&(this.options.zIndex=n+e(-1,1),this._updateZIndex())},_updateOpacity:function(){if(this._map&&!Ne.ielt9){Mt(this._container,this.options.opacity);var e=+new Date,t=!1,i=!1;for(var n in this._tiles){var r=this._tiles[n];if(r.current&&r.loaded){var o=Math.min(1,(e-r.loaded)/200);Mt(r.el,o),o<1?t=!0:(r.active?i=!0:this._onOpaqueTile(r),r.active=!0)}}i&&!this._noPrune&&this._pruneTiles(),t&&(M(this._fadeFrame),this._fadeFrame=P(this._updateOpacity,this))}},_onOpaqueTile:c,_initContainer:function(){this._container||(this._container=gt("div","leaflet-layer "+(this.options.className||"")),this._updateZIndex(),this.options.opacity<1&&this._updateOpacity(),this.getPane().appendChild(this._container))},_updateLevels:function(){var e=this._tileZoom,t=this.options.maxZoom;if(void 0!==e){for(var i in this._levels)i=Number(i),this._levels[i].el.children.length||i===e?(this._levels[i].el.style.zIndex=t-Math.abs(e-i),this._onUpdateLevel(i)):(_t(this._levels[i].el),this._removeTilesAtZoom(i),this._onRemoveLevel(i),delete this._levels[i]);var n=this._levels[e],r=this._map;return n||((n=this._levels[e]={}).el=gt("div","leaflet-tile-container leaflet-zoom-animated",this._container),n.el.style.zIndex=t,n.origin=r.project(r.unproject(r.getPixelOrigin()),e).round(),n.zoom=e,this._setZoomTransform(n,r.getCenter(),r.getZoom()),c(n.el.offsetWidth),this._onCreateLevel(n)),this._level=n,n}},_onUpdateLevel:c,_onRemoveLevel:c,_onCreateLevel:c,_pruneTiles:function(){if(this._map){var e,t,i=this._map.getZoom();if(i>this.options.maxZoom||i<this.options.minZoom)this._removeAllTiles();else{for(e in this._tiles)(t=this._tiles[e]).retain=t.current;for(e in this._tiles)if((t=this._tiles[e]).current&&!t.active){var n=t.coords;this._retainParent(n.x,n.y,n.z,n.z-5)||this._retainChildren(n.x,n.y,n.z,n.z+2)}for(e in this._tiles)this._tiles[e].retain||this._removeTile(e)}}},_removeTilesAtZoom:function(e){for(var t in this._tiles)this._tiles[t].coords.z===e&&this._removeTile(t)},_removeAllTiles:function(){for(var e in this._tiles)this._removeTile(e)},_invalidateAll:function(){for(var e in this._levels)_t(this._levels[e].el),this._onRemoveLevel(Number(e)),delete this._levels[e];this._removeAllTiles(),this._tileZoom=void 0},_retainParent:function(e,t,i,n){var r=Math.floor(e/2),o=Math.floor(t/2),a=i-1,s=new A(+r,+o);s.z=+a;var l=this._tileCoordsToKey(s),c=this._tiles[l];return c&&c.active?(c.retain=!0,!0):(c&&c.loaded&&(c.retain=!0),a>n&&this._retainParent(r,o,a,n))},_retainChildren:function(e,t,i,n){for(var r=2*e;r<2*e+2;r++)for(var o=2*t;o<2*t+2;o++){var a=new A(r,o);a.z=i+1;var s=this._tileCoordsToKey(a),l=this._tiles[s];l&&l.active?l.retain=!0:(l&&l.loaded&&(l.retain=!0),i+1<n&&this._retainChildren(r,o,i+1,n))}},_resetView:function(e){var t=e&&(e.pinch||e.flyTo);this._setView(this._map.getCenter(),this._map.getZoom(),t,t)},_animateZoom:function(e){this._setView(e.center,e.zoom,!0,e.noUpdate)},_clampZoom:function(e){var t=this.options;return void 0!==t.minNativeZoom&&e<t.minNativeZoom?t.minNativeZoom:void 0!==t.maxNativeZoom&&t.maxNativeZoom<e?t.maxNativeZoom:e},_setView:function(e,t,i,n){var r=Math.round(t);r=void 0!==this.options.maxZoom&&r>this.options.maxZoom||void 0!==this.options.minZoom&&r<this.options.minZoom?void 0:this._clampZoom(r);var o=this.options.updateWhenZooming&&r!==this._tileZoom;n&&!o||(this._tileZoom=r,this._abortLoading&&this._abortLoading(),this._updateLevels(),this._resetGrid(),void 0!==r&&this._update(e),i||this._pruneTiles(),this._noPrune=!!i),this._setZoomTransforms(e,t)},_setZoomTransforms:function(e,t){for(var i in this._levels)this._setZoomTransform(this._levels[i],e,t)},_setZoomTransform:function(e,t,i){var n=this._map.getZoomScale(i,e.zoom),r=e.origin.multiplyBy(n).subtract(this._map._getNewPixelOrigin(t,i)).round();Ne.any3d?kt(e.el,r,n):It(e.el,r)},_resetGrid:function(){var e=this._map,t=e.options.crs,i=this._tileSize=this.getTileSize(),n=this._tileZoom,r=this._map.getPixelWorldBounds(this._tileZoom);r&&(this._globalTileRange=this._pxBoundsToTileRange(r)),this._wrapX=t.wrapLng&&!this.options.noWrap&&[Math.floor(e.project([0,t.wrapLng[0]],n).x/i.x),Math.ceil(e.project([0,t.wrapLng[1]],n).x/i.y)],this._wrapY=t.wrapLat&&!this.options.noWrap&&[Math.floor(e.project([t.wrapLat[0],0],n).y/i.x),Math.ceil(e.project([t.wrapLat[1],0],n).y/i.y)]},_onMoveEnd:function(){this._map&&!this._map._animatingZoom&&this._update()},_getTiledPixelBounds:function(e){var t=this._map,i=t._animatingZoom?Math.max(t._animateToZoom,t.getZoom()):t.getZoom(),n=t.getZoomScale(i,this._tileZoom),r=t.project(e,this._tileZoom).floor(),o=t.getSize().divideBy(2*n);return new F(r.subtract(o),r.add(o))},_update:function(e){var t=this._map;if(t){var i=this._clampZoom(t.getZoom());if(void 0===e&&(e=t.getCenter()),void 0!==this._tileZoom){var n=this._getTiledPixelBounds(e),r=this._pxBoundsToTileRange(n),o=r.getCenter(),a=[],s=this.options.keepBuffer,l=new F(r.getBottomLeft().subtract([s,-s]),r.getTopRight().add([s,-s]));if(!(isFinite(r.min.x)&&isFinite(r.min.y)&&isFinite(r.max.x)&&isFinite(r.max.y)))throw new Error("Attempted to load an infinite number of tiles");for(var c in this._tiles){var u=this._tiles[c].coords;u.z===this._tileZoom&&l.contains(new A(u.x,u.y))||(this._tiles[c].current=!1)}if(Math.abs(i-this._tileZoom)>1)this._setView(e,i);else{for(var h=r.min.y;h<=r.max.y;h++)for(var d=r.min.x;d<=r.max.x;d++){var p=new A(d,h);if(p.z=this._tileZoom,this._isValidTile(p)){var f=this._tiles[this._tileCoordsToKey(p)];f?f.current=!0:a.push(p)}}if(a.sort(function(e,t){return e.distanceTo(o)-t.distanceTo(o)}),0!==a.length){this._loading||(this._loading=!0,this.fire("loading"));var m=document.createDocumentFragment();for(d=0;d<a.length;d++)this._addTile(a[d],m);this._level.el.appendChild(m)}}}}},_isValidTile:function(e){var t=this._map.options.crs;if(!t.infinite){var i=this._globalTileRange;if(!t.wrapLng&&(e.x<i.min.x||e.x>i.max.x)||!t.wrapLat&&(e.y<i.min.y||e.y>i.max.y))return!1}if(!this.options.bounds)return!0;var n=this._tileCoordsToBounds(e);return N(this.options.bounds).overlaps(n)},_keyToBounds:function(e){return this._tileCoordsToBounds(this._keyToTileCoords(e))},_tileCoordsToNwSe:function(e){var t=this._map,i=this.getTileSize(),n=e.scaleBy(i),r=n.add(i);return[t.unproject(n,e.z),t.unproject(r,e.z)]},_tileCoordsToBounds:function(e){var t=this._tileCoordsToNwSe(e),i=new O(t[0],t[1]);return this.options.noWrap||(i=this._map.wrapLatLngBounds(i)),i},_tileCoordsToKey:function(e){return e.x+":"+e.y+":"+e.z},_keyToTileCoords:function(e){var t=e.split(":"),i=new A(+t[0],+t[1]);return i.z=+t[2],i},_removeTile:function(e){var t=this._tiles[e];t&&(_t(t.el),delete this._tiles[e],this.fire("tileunload",{tile:t.el,coords:this._keyToTileCoords(e)}))},_initTile:function(e){wt(e,"leaflet-tile");var t=this.getTileSize();e.style.width=t.x+"px",e.style.height=t.y+"px",e.onselectstart=c,e.onmousemove=c,Ne.ielt9&&this.options.opacity<1&&Mt(e,this.options.opacity)},_addTile:function(e,t){var i=this._getTilePos(e),n=this._tileCoordsToKey(e),o=this.createTile(this._wrapCoords(e),r(this._tileReady,this,e));this._initTile(o),this.createTile.length<2&&P(r(this._tileReady,this,e,null,o)),It(o,i),this._tiles[n]={el:o,coords:e,current:!0},t.appendChild(o),this.fire("tileloadstart",{tile:o,coords:e})},_tileReady:function(e,t,i){t&&this.fire("tileerror",{error:t,tile:i,coords:e});var n=this._tileCoordsToKey(e);(i=this._tiles[n])&&(i.loaded=+new Date,this._map._fadeAnimated?(Mt(i.el,0),M(this._fadeFrame),this._fadeFrame=P(this._updateOpacity,this)):(i.active=!0,this._pruneTiles()),t||(wt(i.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:i.el,coords:e})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),Ne.ielt9||!this._map._fadeAnimated?P(this._pruneTiles,this):setTimeout(r(this._pruneTiles,this),250)))},_getTilePos:function(e){return e.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(e){var t=new A(this._wrapX?l(e.x,this._wrapX):e.x,this._wrapY?l(e.y,this._wrapY):e.y);return t.z=e.z,t},_pxBoundsToTileRange:function(e){var t=this.getTileSize();return new F(e.min.unscaleBy(t).floor(),e.max.unscaleBy(t).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var e in this._tiles)if(!this._tiles[e].loaded)return!1;return!0}});function Vn(e){return new jn(e)}var Un=jn.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1,referrerPolicy:!1},initialize:function(e,t){this._url=e,(t=p(this,t)).detectRetina&&Ne.retina&&t.maxZoom>0?(t.tileSize=Math.floor(t.tileSize/2),t.zoomReverse?(t.zoomOffset--,t.minZoom=Math.min(t.maxZoom,t.minZoom+1)):(t.zoomOffset++,t.maxZoom=Math.max(t.minZoom,t.maxZoom-1)),t.minZoom=Math.max(0,t.minZoom)):t.zoomReverse?t.minZoom=Math.min(t.maxZoom,t.minZoom):t.maxZoom=Math.max(t.minZoom,t.maxZoom),"string"==typeof t.subdomains&&(t.subdomains=t.subdomains.split("")),this.on("tileunload",this._onTileRemove)},setUrl:function(e,t){return this._url===e&&void 0===t&&(t=!0),this._url=e,t||this.redraw(),this},createTile:function(e,t){var i=document.createElement("img");return jt(i,"load",r(this._tileOnLoad,this,t,i)),jt(i,"error",r(this._tileOnError,this,t,i)),(this.options.crossOrigin||""===this.options.crossOrigin)&&(i.crossOrigin=!0===this.options.crossOrigin?"":this.options.crossOrigin),"string"==typeof this.options.referrerPolicy&&(i.referrerPolicy=this.options.referrerPolicy),i.alt="",i.src=this.getTileUrl(e),i},getTileUrl:function(e){var t={r:Ne.retina?"@2x":"",s:this._getSubdomain(e),x:e.x,y:e.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var n=this._globalTileRange.max.y-e.y;this.options.tms&&(t.y=n),t["-y"]=n}return g(this._url,i(t,this.options))},_tileOnLoad:function(e,t){Ne.ielt9?setTimeout(r(e,this,null,t),0):e(null,t)},_tileOnError:function(e,t,i){var n=this.options.errorTileUrl;n&&t.getAttribute("src")!==n&&(t.src=n),e(i,t)},_onTileRemove:function(e){e.tile.onload=null},_getZoomForUrl:function(){var e=this._tileZoom,t=this.options.maxZoom;return this.options.zoomReverse&&(e=t-e),e+this.options.zoomOffset},_getSubdomain:function(e){var t=Math.abs(e.x+e.y)%this.options.subdomains.length;return this.options.subdomains[t]},_abortLoading:function(){var e,t;for(e in this._tiles)if(this._tiles[e].coords.z!==this._tileZoom&&((t=this._tiles[e].el).onload=c,t.onerror=c,!t.complete)){t.src=v;var i=this._tiles[e].coords;_t(t),delete this._tiles[e],this.fire("tileabort",{tile:t,coords:i})}},_removeTile:function(e){var t=this._tiles[e];if(t)return t.el.setAttribute("src",v),jn.prototype._removeTile.call(this,e)},_tileReady:function(e,t,i){if(this._map&&(!i||i.getAttribute("src")!==v))return jn.prototype._tileReady.call(this,e,t,i)}});function Zn(e,t){return new Un(e,t)}var Gn=Un.extend({defaultWmsParams:{service:"WMS",request:"GetMap",layers:"",styles:"",format:"image/jpeg",transparent:!1,version:"1.1.1"},options:{crs:null,uppercase:!1},initialize:function(e,t){this._url=e;var n=i({},this.defaultWmsParams);for(var r in t)r in this.options||(n[r]=t[r]);var o=(t=p(this,t)).detectRetina&&Ne.retina?2:1,a=this.getTileSize();n.width=a.x*o,n.height=a.y*o,this.wmsParams=n},onAdd:function(e){this._crs=this.options.crs||e.options.crs,this._wmsVersion=parseFloat(this.wmsParams.version);var t=this._wmsVersion>=1.3?"crs":"srs";this.wmsParams[t]=this._crs.code,Un.prototype.onAdd.call(this,e)},getTileUrl:function(e){var t=this._tileCoordsToNwSe(e),i=this._crs,n=B(i.project(t[0]),i.project(t[1])),r=n.min,o=n.max,a=(this._wmsVersion>=1.3&&this._crs===$i?[r.y,r.x,o.y,o.x]:[r.x,r.y,o.x,o.y]).join(","),s=Un.prototype.getTileUrl.call(this,e);return s+f(this.wmsParams,s,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+a},setParams:function(e,t){return i(this.wmsParams,e),t||this.redraw(),this}});function qn(e,t){return new Gn(e,t)}Un.WMS=Gn,Zn.wms=qn;var $n=Hi.extend({options:{padding:.1},initialize:function(e){p(this,e),a(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),wt(this._container,"leaflet-zoom-animated")),this.getPane().appendChild(this._container),this._update(),this.on("update",this._updatePaths,this)},onRemove:function(){this.off("update",this._updatePaths,this),this._destroyContainer()},getEvents:function(){var e={viewreset:this._reset,zoom:this._onZoom,moveend:this._update,zoomend:this._onZoomEnd};return this._zoomAnimated&&(e.zoomanim=this._onAnimZoom),e},_onAnimZoom:function(e){this._updateTransform(e.center,e.zoom)},_onZoom:function(){this._updateTransform(this._map.getCenter(),this._map.getZoom())},_updateTransform:function(e,t){var i=this._map.getZoomScale(t,this._zoom),n=this._map.getSize().multiplyBy(.5+this.options.padding),r=this._map.project(this._center,t),o=n.multiplyBy(-i).add(r).subtract(this._map._getNewPixelOrigin(e,t));Ne.any3d?kt(this._container,o,i):It(this._container,o)},_reset:function(){for(var e in this._update(),this._updateTransform(this._center,this._zoom),this._layers)this._layers[e]._reset()},_onZoomEnd:function(){for(var e in this._layers)this._layers[e]._project()},_updatePaths:function(){for(var e in this._layers)this._layers[e]._update()},_update:function(){var e=this.options.padding,t=this._map.getSize(),i=this._map.containerPointToLayerPoint(t.multiplyBy(-e)).round();this._bounds=new F(i,i.add(t.multiplyBy(1+2*e)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),Wn=$n.extend({options:{tolerance:0},getEvents:function(){var e=$n.prototype.getEvents.call(this);return e.viewprereset=this._onViewPreReset,e},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){$n.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var e=this._container=document.createElement("canvas");jt(e,"mousemove",this._onMouseMove,this),jt(e,"click dblclick mousedown mouseup contextmenu",this._onClick,this),jt(e,"mouseout",this._handleMouseOut,this),e._leaflet_disable_events=!0,this._ctx=e.getContext("2d")},_destroyContainer:function(){M(this._redrawRequest),delete this._ctx,_t(this._container),Ut(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){for(var e in this._redrawBounds=null,this._layers)this._layers[e]._update();this._redraw()}},_update:function(){if(!this._map._animatingZoom||!this._bounds){$n.prototype._update.call(this);var e=this._bounds,t=this._container,i=e.getSize(),n=Ne.retina?2:1;It(t,e.min),t.width=n*i.x,t.height=n*i.y,t.style.width=i.x+"px",t.style.height=i.y+"px",Ne.retina&&this._ctx.scale(2,2),this._ctx.translate(-e.min.x,-e.min.y),this.fire("update")}},_reset:function(){$n.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(e){this._updateDashArray(e),this._layers[a(e)]=e;var t=e._order={layer:e,prev:this._drawLast,next:null};this._drawLast&&(this._drawLast.next=t),this._drawLast=t,this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(e){this._requestRedraw(e)},_removePath:function(e){var t=e._order,i=t.next,n=t.prev;i?i.prev=n:this._drawLast=n,n?n.next=i:this._drawFirst=i,delete e._order,delete this._layers[a(e)],this._requestRedraw(e)},_updatePath:function(e){this._extendRedrawBounds(e),e._project(),e._update(),this._requestRedraw(e)},_updateStyle:function(e){this._updateDashArray(e),this._requestRedraw(e)},_updateDashArray:function(e){if("string"==typeof e.options.dashArray){var t,i,n=e.options.dashArray.split(/[, ]+/),r=[];for(i=0;i<n.length;i++){if(t=Number(n[i]),isNaN(t))return;r.push(t)}e.options._dashArray=r}else e.options._dashArray=e.options.dashArray},_requestRedraw:function(e){this._map&&(this._extendRedrawBounds(e),this._redrawRequest=this._redrawRequest||P(this._redraw,this))},_extendRedrawBounds:function(e){if(e._pxBounds){var t=(e.options.weight||0)+1;this._redrawBounds=this._redrawBounds||new F,this._redrawBounds.extend(e._pxBounds.min.subtract([t,t])),this._redrawBounds.extend(e._pxBounds.max.add([t,t]))}},_redraw:function(){this._redrawRequest=null,this._redrawBounds&&(this._redrawBounds.min._floor(),this._redrawBounds.max._ceil()),this._clear(),this._draw(),this._redrawBounds=null},_clear:function(){var e=this._redrawBounds;if(e){var t=e.getSize();this._ctx.clearRect(e.min.x,e.min.y,t.x,t.y)}else this._ctx.save(),this._ctx.setTransform(1,0,0,1,0,0),this._ctx.clearRect(0,0,this._container.width,this._container.height),this._ctx.restore()},_draw:function(){var e,t=this._redrawBounds;if(this._ctx.save(),t){var i=t.getSize();this._ctx.beginPath(),this._ctx.rect(t.min.x,t.min.y,i.x,i.y),this._ctx.clip()}this._drawing=!0;for(var n=this._drawFirst;n;n=n.next)e=n.layer,(!t||e._pxBounds&&e._pxBounds.intersects(t))&&e._updatePath();this._drawing=!1,this._ctx.restore()},_updatePoly:function(e,t){if(this._drawing){var i,n,r,o,a=e._parts,s=a.length,l=this._ctx;if(s){for(l.beginPath(),i=0;i<s;i++){for(n=0,r=a[i].length;n<r;n++)o=a[i][n],l[n?"lineTo":"moveTo"](o.x,o.y);t&&l.closePath()}this._fillStroke(l,e)}}},_updateCircle:function(e){if(this._drawing&&!e._empty()){var t=e._point,i=this._ctx,n=Math.max(Math.round(e._radius),1),r=(Math.max(Math.round(e._radiusY),1)||n)/n;1!==r&&(i.save(),i.scale(1,r)),i.beginPath(),i.arc(t.x,t.y/r,n,0,2*Math.PI,!1),1!==r&&i.restore(),this._fillStroke(i,e)}},_fillStroke:function(e,t){var i=t.options;i.fill&&(e.globalAlpha=i.fillOpacity,e.fillStyle=i.fillColor||i.color,e.fill(i.fillRule||"evenodd")),i.stroke&&0!==i.weight&&(e.setLineDash&&e.setLineDash(t.options&&t.options._dashArray||[]),e.globalAlpha=i.opacity,e.lineWidth=i.weight,e.strokeStyle=i.color,e.lineCap=i.lineCap,e.lineJoin=i.lineJoin,e.stroke())},_onClick:function(e){for(var t,i,n=this._map.mouseEventToLayerPoint(e),r=this._drawFirst;r;r=r.next)(t=r.layer).options.interactive&&t._containsPoint(n)&&("click"!==e.type&&"preclick"!==e.type||!this._map._draggableMoved(t))&&(i=t);this._fireEvent(!!i&&[i],e)},_onMouseMove:function(e){if(this._map&&!this._map.dragging.moving()&&!this._map._animatingZoom){var t=this._map.mouseEventToLayerPoint(e);this._handleMouseHover(e,t)}},_handleMouseOut:function(e){var t=this._hoveredLayer;t&&(Tt(this._container,"leaflet-interactive"),this._fireEvent([t],e,"mouseout"),this._hoveredLayer=null,this._mouseHoverThrottled=!1)},_handleMouseHover:function(e,t){if(!this._mouseHoverThrottled){for(var i,n,o=this._drawFirst;o;o=o.next)(i=o.layer).options.interactive&&i._containsPoint(t)&&(n=i);n!==this._hoveredLayer&&(this._handleMouseOut(e),n&&(wt(this._container,"leaflet-interactive"),this._fireEvent([n],e,"mouseover"),this._hoveredLayer=n)),this._fireEvent(!!this._hoveredLayer&&[this._hoveredLayer],e),this._mouseHoverThrottled=!0,setTimeout(r(function(){this._mouseHoverThrottled=!1},this),32)}},_fireEvent:function(e,t,i){this._map._fireDOMEvent(t,i||t.type,e)},_bringToFront:function(e){var t=e._order;if(t){var i=t.next,n=t.prev;i&&(i.prev=n,n?n.next=i:i&&(this._drawFirst=i),t.prev=this._drawLast,this._drawLast.next=t,t.next=null,this._drawLast=t,this._requestRedraw(e))}},_bringToBack:function(e){var t=e._order;if(t){var i=t.next,n=t.prev;n&&(n.next=i,i?i.prev=n:n&&(this._drawLast=n),t.prev=null,t.next=this._drawFirst,this._drawFirst.prev=t,this._drawFirst=t,this._requestRedraw(e))}}});function Hn(e){return Ne.canvas?new Wn(e):null}var Xn=function(){try{return document.namespaces.add("lvml","urn:schemas-microsoft-com:vml"),function(e){return document.createElement("<lvml:"+e+' class="lvml">')}}catch(e){}return function(e){return document.createElement("<"+e+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}(),Yn={_initContainer:function(){this._container=gt("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||($n.prototype._update.call(this),this.fire("update"))},_initPath:function(e){var t=e._container=Xn("shape");wt(t,"leaflet-vml-shape "+(this.options.className||"")),t.coordsize="1 1",e._path=Xn("path"),t.appendChild(e._path),this._updateStyle(e),this._layers[a(e)]=e},_addPath:function(e){var t=e._container;this._container.appendChild(t),e.options.interactive&&e.addInteractiveTarget(t)},_removePath:function(e){var t=e._container;_t(t),e.removeInteractiveTarget(t),delete this._layers[a(e)]},_updateStyle:function(e){var t=e._stroke,i=e._fill,n=e.options,r=e._container;r.stroked=!!n.stroke,r.filled=!!n.fill,n.stroke?(t||(t=e._stroke=Xn("stroke")),r.appendChild(t),t.weight=n.weight+"px",t.color=n.color,t.opacity=n.opacity,n.dashArray?t.dashStyle=_(n.dashArray)?n.dashArray.join(" "):n.dashArray.replace(/( *, *)/g," "):t.dashStyle="",t.endcap=n.lineCap.replace("butt","flat"),t.joinstyle=n.lineJoin):t&&(r.removeChild(t),e._stroke=null),n.fill?(i||(i=e._fill=Xn("fill")),r.appendChild(i),i.color=n.fillColor||n.color,i.opacity=n.fillOpacity):i&&(r.removeChild(i),e._fill=null)},_updateCircle:function(e){var t=e._point.round(),i=Math.round(e._radius),n=Math.round(e._radiusY||i);this._setPath(e,e._empty()?"M0 0":"AL "+t.x+","+t.y+" "+i+","+n+" 0,23592600")},_setPath:function(e,t){e._path.v=t},_bringToFront:function(e){vt(e._container)},_bringToBack:function(e){xt(e._container)}},Kn=Ne.vml?Xn:Q,Qn=$n.extend({_initContainer:function(){this._container=Kn("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=Kn("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){_t(this._container),Ut(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){if(!this._map._animatingZoom||!this._bounds){$n.prototype._update.call(this);var e=this._bounds,t=e.getSize(),i=this._container;this._svgSize&&this._svgSize.equals(t)||(this._svgSize=t,i.setAttribute("width",t.x),i.setAttribute("height",t.y)),It(i,e.min),i.setAttribute("viewBox",[e.min.x,e.min.y,t.x,t.y].join(" ")),this.fire("update")}},_initPath:function(e){var t=e._path=Kn("path");e.options.className&&wt(t,e.options.className),e.options.interactive&&wt(t,"leaflet-interactive"),this._updateStyle(e),this._layers[a(e)]=e},_addPath:function(e){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(e._path),e.addInteractiveTarget(e._path)},_removePath:function(e){_t(e._path),e.removeInteractiveTarget(e._path),delete this._layers[a(e)]},_updatePath:function(e){e._project(),e._update()},_updateStyle:function(e){var t=e._path,i=e.options;t&&(i.stroke?(t.setAttribute("stroke",i.color),t.setAttribute("stroke-opacity",i.opacity),t.setAttribute("stroke-width",i.weight),t.setAttribute("stroke-linecap",i.lineCap),t.setAttribute("stroke-linejoin",i.lineJoin),i.dashArray?t.setAttribute("stroke-dasharray",i.dashArray):t.removeAttribute("stroke-dasharray"),i.dashOffset?t.setAttribute("stroke-dashoffset",i.dashOffset):t.removeAttribute("stroke-dashoffset")):t.setAttribute("stroke","none"),i.fill?(t.setAttribute("fill",i.fillColor||i.color),t.setAttribute("fill-opacity",i.fillOpacity),t.setAttribute("fill-rule",i.fillRule||"evenodd")):t.setAttribute("fill","none"))},_updatePoly:function(e,t){this._setPath(e,J(e._parts,t))},_updateCircle:function(e){var t=e._point,i=Math.max(Math.round(e._radius),1),n="a"+i+","+(Math.max(Math.round(e._radiusY),1)||i)+" 0 1,0 ",r=e._empty()?"M0 0":"M"+(t.x-i)+","+t.y+n+2*i+",0 "+n+2*-i+",0 ";this._setPath(e,r)},_setPath:function(e,t){e._path.setAttribute("d",t)},_bringToFront:function(e){vt(e._path)},_bringToBack:function(e){xt(e._path)}});function Jn(e){return Ne.svg||Ne.vml?new Qn(e):null}Ne.vml&&Qn.include(Yn),oi.include({getRenderer:function(e){var t=e.options.renderer||this._getPaneRenderer(e.options.pane)||this.options.renderer||this._renderer;return t||(t=this._renderer=this._createRenderer()),this.hasLayer(t)||this.addLayer(t),t},_getPaneRenderer:function(e){if("overlayPane"===e||void 0===e)return!1;var t=this._paneRenderers[e];return void 0===t&&(t=this._createRenderer({pane:e}),this._paneRenderers[e]=t),t},_createRenderer:function(e){return this.options.preferCanvas&&Hn(e)||Jn(e)}});var er=pn.extend({initialize:function(e,t){pn.prototype.initialize.call(this,this._boundsToLatLngs(e),t)},setBounds:function(e){return this.setLatLngs(this._boundsToLatLngs(e))},_boundsToLatLngs:function(e){return[(e=N(e)).getSouthWest(),e.getNorthWest(),e.getNorthEast(),e.getSouthEast()]}});function tr(e,t){return new er(e,t)}Qn.create=Kn,Qn.pointsToPath=J,mn.geometryToLayer=gn,mn.coordsToLatLng=yn,mn.coordsToLatLngs=vn,mn.latLngToCoords=xn,mn.latLngsToCoords=bn,mn.getFeature=wn,mn.asFeature=Tn,oi.mergeOptions({boxZoom:!0});var ir=yi.extend({initialize:function(e){this._map=e,this._container=e._container,this._pane=e._panes.overlayPane,this._resetStateTimeout=0,e.on("unload",this._destroy,this)},addHooks:function(){jt(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){Ut(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){_t(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){0!==this._resetStateTimeout&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(e){if(!e.shiftKey||1!==e.which&&1!==e.button)return!1;this._clearDeferredResetState(),this._resetState(),at(),Lt(),this._startPoint=this._map.mouseEventToContainerPoint(e),jt(document,{contextmenu:Kt,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(e){this._moved||(this._moved=!0,this._box=gt("div","leaflet-zoom-box",this._container),wt(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(e);var t=new F(this._point,this._startPoint),i=t.getSize();It(this._box,t.min),this._box.style.width=i.x+"px",this._box.style.height=i.y+"px"},_finish:function(){this._moved&&(_t(this._box),Tt(this._container,"leaflet-crosshair")),st(),Dt(),Ut(document,{contextmenu:Kt,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(e){if((1===e.which||1===e.button)&&(this._finish(),this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(r(this._resetState,this),0);var t=new O(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(t).fire("boxzoomend",{boxZoomBounds:t})}},_onKeyDown:function(e){27===e.keyCode&&(this._finish(),this._clearDeferredResetState(),this._resetState())}});oi.addInitHook("addHandler","boxZoom",ir),oi.mergeOptions({doubleClickZoom:!0});var nr=yi.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(e){var t=this._map,i=t.getZoom(),n=t.options.zoomDelta,r=e.originalEvent.shiftKey?i-n:i+n;"center"===t.options.doubleClickZoom?t.setZoom(r):t.setZoomAround(e.containerPoint,r)}});oi.addInitHook("addHandler","doubleClickZoom",nr),oi.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var rr=yi.extend({addHooks:function(){if(!this._draggable){var e=this._map;this._draggable=new bi(e._mapPane,e._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),e.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),e.on("zoomend",this._onZoomEnd,this),e.whenReady(this._onZoomEnd,this))}wt(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){Tt(this._map._container,"leaflet-grab"),Tt(this._map._container,"leaflet-touch-drag"),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var e=this._map;if(e._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var t=N(this._map.options.maxBounds);this._offsetLimit=B(this._map.latLngToContainerPoint(t.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(t.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else this._offsetLimit=null;e.fire("movestart").fire("dragstart"),e.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(e){if(this._map.options.inertia){var t=this._lastTime=+new Date,i=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(i),this._times.push(t),this._prunePositions(t)}this._map.fire("move",e).fire("drag",e)},_prunePositions:function(e){for(;this._positions.length>1&&e-this._times[0]>50;)this._positions.shift(),this._times.shift()},_onZoomEnd:function(){var e=this._map.getSize().divideBy(2),t=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=t.subtract(e).x,this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(e,t){return e-(e-t)*this._viscosity},_onPreDragLimit:function(){if(this._viscosity&&this._offsetLimit){var e=this._draggable._newPos.subtract(this._draggable._startPos),t=this._offsetLimit;e.x<t.min.x&&(e.x=this._viscousLimit(e.x,t.min.x)),e.y<t.min.y&&(e.y=this._viscousLimit(e.y,t.min.y)),e.x>t.max.x&&(e.x=this._viscousLimit(e.x,t.max.x)),e.y>t.max.y&&(e.y=this._viscousLimit(e.y,t.max.y)),this._draggable._newPos=this._draggable._startPos.add(e)}},_onPreDragWrap:function(){var e=this._worldWidth,t=Math.round(e/2),i=this._initialWorldOffset,n=this._draggable._newPos.x,r=(n-t+i)%e+t-i,o=(n+t+i)%e-t-i,a=Math.abs(r+i)<Math.abs(o+i)?r:o;this._draggable._absPos=this._draggable._newPos.clone(),this._draggable._newPos.x=a},_onDragEnd:function(e){var t=this._map,i=t.options,n=!i.inertia||e.noInertia||this._times.length<2;if(t.fire("dragend",e),n)t.fire("moveend");else{this._prunePositions(+new Date);var r=this._lastPos.subtract(this._positions[0]),o=(this._lastTime-this._times[0])/1e3,a=i.easeLinearity,s=r.multiplyBy(a/o),l=s.distanceTo([0,0]),c=Math.min(i.inertiaMaxSpeed,l),u=s.multiplyBy(c/l),h=c/(i.inertiaDeceleration*a),d=u.multiplyBy(-h/2).round();d.x||d.y?(d=t._limitOffset(d,t.options.maxBounds),P(function(){t.panBy(d,{duration:h,easeLinearity:a,noMoveStart:!0,animate:!0})})):t.fire("moveend")}}});oi.addInitHook("addHandler","dragging",rr),oi.mergeOptions({keyboard:!0,keyboardPanDelta:80});var or=yi.extend({keyCodes:{left:[37],right:[39],down:[40],up:[38],zoomIn:[187,107,61,171],zoomOut:[189,109,54,173]},initialize:function(e){this._map=e,this._setPanDelta(e.options.keyboardPanDelta),this._setZoomDelta(e.options.zoomDelta)},addHooks:function(){var e=this._map._container;e.tabIndex<=0&&(e.tabIndex="0"),jt(e,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.on({focus:this._addHooks,blur:this._removeHooks},this)},removeHooks:function(){this._removeHooks(),Ut(this._map._container,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.off({focus:this._addHooks,blur:this._removeHooks},this)},_onMouseDown:function(){if(!this._focused){var e=document.body,t=document.documentElement,i=e.scrollTop||t.scrollTop,n=e.scrollLeft||t.scrollLeft;this._map._container.focus(),window.scrollTo(n,i)}},_onFocus:function(){this._focused=!0,this._map.fire("focus")},_onBlur:function(){this._focused=!1,this._map.fire("blur")},_setPanDelta:function(e){var t,i,n=this._panKeys={},r=this.keyCodes;for(t=0,i=r.left.length;t<i;t++)n[r.left[t]]=[-1*e,0];for(t=0,i=r.right.length;t<i;t++)n[r.right[t]]=[e,0];for(t=0,i=r.down.length;t<i;t++)n[r.down[t]]=[0,e];for(t=0,i=r.up.length;t<i;t++)n[r.up[t]]=[0,-1*e]},_setZoomDelta:function(e){var t,i,n=this._zoomKeys={},r=this.keyCodes;for(t=0,i=r.zoomIn.length;t<i;t++)n[r.zoomIn[t]]=e;for(t=0,i=r.zoomOut.length;t<i;t++)n[r.zoomOut[t]]=-e},_addHooks:function(){jt(document,"keydown",this._onKeyDown,this)},_removeHooks:function(){Ut(document,"keydown",this._onKeyDown,this)},_onKeyDown:function(e){if(!(e.altKey||e.ctrlKey||e.metaKey)){var t,i=e.keyCode,n=this._map;if(i in this._panKeys){if(!n._panAnim||!n._panAnim._inProgress)if(t=this._panKeys[i],e.shiftKey&&(t=R(t).multiplyBy(3)),n.options.maxBounds&&(t=n._limitOffset(R(t),n.options.maxBounds)),n.options.worldCopyJump){var r=n.wrapLatLng(n.unproject(n.project(n.getCenter()).add(t)));n.panTo(r)}else n.panBy(t)}else if(i in this._zoomKeys)n.setZoom(n.getZoom()+(e.shiftKey?3:1)*this._zoomKeys[i]);else{if(27!==i||!n._popup||!n._popup.options.closeOnEscapeKey)return;n.closePopup()}Kt(e)}}});oi.addInitHook("addHandler","keyboard",or),oi.mergeOptions({scrollWheelZoom:!0,wheelDebounceTime:40,wheelPxPerZoomLevel:60});var ar=yi.extend({addHooks:function(){jt(this._map._container,"wheel",this._onWheelScroll,this),this._delta=0},removeHooks:function(){Ut(this._map._container,"wheel",this._onWheelScroll,this)},_onWheelScroll:function(e){var t=ti(e),i=this._map.options.wheelDebounceTime;this._delta+=t,this._lastMousePos=this._map.mouseEventToContainerPoint(e),this._startTime||(this._startTime=+new Date);var n=Math.max(i-(+new Date-this._startTime),0);clearTimeout(this._timer),this._timer=setTimeout(r(this._performZoom,this),n),Kt(e)},_performZoom:function(){var e=this._map,t=e.getZoom(),i=this._map.options.zoomSnap||0;e._stop();var n=this._delta/(4*this._map.options.wheelPxPerZoomLevel),r=4*Math.log(2/(1+Math.exp(-Math.abs(n))))/Math.LN2,o=i?Math.ceil(r/i)*i:r,a=e._limitZoom(t+(this._delta>0?o:-o))-t;this._delta=0,this._startTime=null,a&&("center"===e.options.scrollWheelZoom?e.setZoom(t+a):e.setZoomAround(this._lastMousePos,t+a))}});oi.addInitHook("addHandler","scrollWheelZoom",ar);var sr=600;oi.mergeOptions({tapHold:Ne.touchNative&&Ne.safari&&Ne.mobile,tapTolerance:15});var lr=yi.extend({addHooks:function(){jt(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){Ut(this._map._container,"touchstart",this._onDown,this)},_onDown:function(e){if(clearTimeout(this._holdTimeout),1===e.touches.length){var t=e.touches[0];this._startPos=this._newPos=new A(t.clientX,t.clientY),this._holdTimeout=setTimeout(r(function(){this._cancel(),this._isTapValid()&&(jt(document,"touchend",Yt),jt(document,"touchend touchcancel",this._cancelClickPrevent),this._simulateEvent("contextmenu",t))},this),sr),jt(document,"touchend touchcancel contextmenu",this._cancel,this),jt(document,"touchmove",this._onMove,this)}},_cancelClickPrevent:function e(){Ut(document,"touchend",Yt),Ut(document,"touchend touchcancel",e)},_cancel:function(){clearTimeout(this._holdTimeout),Ut(document,"touchend touchcancel contextmenu",this._cancel,this),Ut(document,"touchmove",this._onMove,this)},_onMove:function(e){var t=e.touches[0];this._newPos=new A(t.clientX,t.clientY)},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_simulateEvent:function(e,t){var i=new MouseEvent(e,{bubbles:!0,cancelable:!0,view:window,screenX:t.screenX,screenY:t.screenY,clientX:t.clientX,clientY:t.clientY});i._simulated=!0,t.target.dispatchEvent(i)}});oi.addInitHook("addHandler","tapHold",lr),oi.mergeOptions({touchZoom:Ne.touch,bounceAtZoomLimits:!0});var cr=yi.extend({addHooks:function(){wt(this._map._container,"leaflet-touch-zoom"),jt(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){Tt(this._map._container,"leaflet-touch-zoom"),Ut(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(e){var t=this._map;if(e.touches&&2===e.touches.length&&!t._animatingZoom&&!this._zooming){var i=t.mouseEventToContainerPoint(e.touches[0]),n=t.mouseEventToContainerPoint(e.touches[1]);this._centerPoint=t.getSize()._divideBy(2),this._startLatLng=t.containerPointToLatLng(this._centerPoint),"center"!==t.options.touchZoom&&(this._pinchStartLatLng=t.containerPointToLatLng(i.add(n)._divideBy(2))),this._startDist=i.distanceTo(n),this._startZoom=t.getZoom(),this._moved=!1,this._zooming=!0,t._stop(),jt(document,"touchmove",this._onTouchMove,this),jt(document,"touchend touchcancel",this._onTouchEnd,this),Yt(e)}},_onTouchMove:function(e){if(e.touches&&2===e.touches.length&&this._zooming){var t=this._map,i=t.mouseEventToContainerPoint(e.touches[0]),n=t.mouseEventToContainerPoint(e.touches[1]),o=i.distanceTo(n)/this._startDist;if(this._zoom=t.getScaleZoom(o,this._startZoom),!t.options.bounceAtZoomLimits&&(this._zoom<t.getMinZoom()&&o<1||this._zoom>t.getMaxZoom()&&o>1)&&(this._zoom=t._limitZoom(this._zoom)),"center"===t.options.touchZoom){if(this._center=this._startLatLng,1===o)return}else{var a=i._add(n)._divideBy(2)._subtract(this._centerPoint);if(1===o&&0===a.x&&0===a.y)return;this._center=t.unproject(t.project(this._pinchStartLatLng,this._zoom).subtract(a),this._zoom)}this._moved||(t._moveStart(!0,!1),this._moved=!0),M(this._animRequest);var s=r(t._move,t,this._center,this._zoom,{pinch:!0,round:!1},void 0);this._animRequest=P(s,this,!0),Yt(e)}},_onTouchEnd:function(){this._moved&&this._zooming?(this._zooming=!1,M(this._animRequest),Ut(document,"touchmove",this._onTouchMove,this),Ut(document,"touchend touchcancel",this._onTouchEnd,this),this._map.options.zoomAnimation?this._map._animateZoom(this._center,this._map._limitZoom(this._zoom),!0,this._map.options.zoomSnap):this._map._resetView(this._center,this._map._limitZoom(this._zoom))):this._zooming=!1}});oi.addInitHook("addHandler","touchZoom",cr),oi.BoxZoom=ir,oi.DoubleClickZoom=nr,oi.Drag=rr,oi.Keyboard=or,oi.ScrollWheelZoom=ar,oi.TapHold=lr,oi.TouchZoom=cr,e.Bounds=F,e.Browser=Ne,e.CRS=Z,e.Canvas=Wn,e.Circle=cn,e.CircleMarker=sn,e.Class=C,e.Control=si,e.DivIcon=On,e.DivOverlay=Ln,e.DomEvent=ni,e.DomUtil=Nt,e.Draggable=bi,e.Evented=z,e.FeatureGroup=Ki,e.GeoJSON=mn,e.GridLayer=jn,e.Handler=yi,e.Icon=Ji,e.ImageOverlay=En,e.LatLng=j,e.LatLngBounds=O,e.Layer=Hi,e.LayerGroup=Xi,e.LineUtil=Vi,e.Map=oi,e.Marker=rn,e.Mixin=vi,e.Path=an,e.Point=A,e.PolyUtil=Mi,e.Polygon=pn,e.Polyline=hn,e.Popup=Dn,e.PosAnimation=ri,e.Projection=Gi,e.Rectangle=er,e.Renderer=$n,e.SVG=Qn,e.SVGOverlay=zn,e.TileLayer=Un,e.Tooltip=Fn,e.Transformation=W,e.Util=E,e.VideoOverlay=kn,e.bind=r,e.bounds=B,e.canvas=Hn,e.circle=un,e.circleMarker=ln,e.control=li,e.divIcon=Nn,e.extend=i,e.featureGroup=Qi,e.geoJSON=Pn,e.geoJson=Mn,e.gridLayer=Vn,e.icon=en,e.imageOverlay=Cn,e.latLng=V,e.latLngBounds=N,e.layerGroup=Yi,e.map=ai,e.marker=on,e.point=R,e.polygon=fn,e.polyline=dn,e.popup=Rn,e.rectangle=tr,e.setOptions=p,e.stamp=a,e.svg=Jn,e.svgOverlay=An,e.tileLayer=Zn,e.tooltip=Bn,e.transformation=H,e.version=t,e.videoOverlay=In;var ur=window.L;e.noConflict=function(){return window.L=ur,this},window.L=e}(ie.exports)),ie.exports);const re=n(ne);function oe(){return function(){const e=M.use(ee);if(null==e)throw new Error("No context provided: useLeafletContext() can only be used in a descendant of <MapContainer>");return e}().map}function ae({bounds:e,boundsOptions:t,center:i,children:n,className:r,id:o,placeholder:a,style:s,whenReady:l,zoom:c,...u},h){const[d]=M.useState({className:r,id:o,style:s}),[p,f]=M.useState(null),m=M.useRef(void 0);M.useImperativeHandle(h,()=>p?.map??null,[p]);const g=M.useCallback(n=>{if(null!==n&&!m.current){const r=new ne.Map(n,u);m.current=r,null!=i&&null!=c?r.setView(i,c):null!=e&&r.fitBounds(e,t),null!=l&&r.whenReady(l),f(function(e){return Object.freeze({__version:1,map:e})}(r))}},[]);M.useEffect(()=>()=>{p?.map.remove()},[p]);const _=p?E.createElement(ee,{value:p},n):a??null;return E.createElement("div",{...d,ref:g},_)}const se=M.forwardRef(ae),le=M.memo(function({layers:e,position:t="top-right",collapsed:i=!0}){const{t:n}=X(),[r,o]=M.useState(i),[a,s]=M.useState("base"),{baseLayerId:l,setBaseLayer:c,availableBaseLayers:u,overlayStates:h,toggleOverlay:d,availableOverlays:p}=e;return A.jsxs("div",{className:`sep-layer-control sep-layer-control--${t}`,children:[A.jsx("button",{className:"sep-layer-control__toggle",onClick:()=>o(!r),"aria-label":n("layers.toggle"),"aria-expanded":!r,children:A.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[A.jsx("polygon",{points:"12 2 2 7 12 12 22 7 12 2"}),A.jsx("polyline",{points:"2 17 12 22 22 17"}),A.jsx("polyline",{points:"2 12 12 17 22 12"})]})}),!r&&A.jsxs("div",{className:"sep-layer-control__panel",children:[A.jsxs("div",{className:"sep-layer-control__tabs",children:[A.jsx("button",{className:"sep-layer-control__tab "+("base"===a?"active":""),onClick:()=>s("base"),children:n("layers.baseLayers")}),A.jsx("button",{className:"sep-layer-control__tab "+("overlay"===a?"active":""),onClick:()=>s("overlay"),children:n("layers.overlays")})]}),A.jsxs("div",{className:"sep-layer-control__content",children:["base"===a&&A.jsx("div",{className:"sep-layer-control__list",children:u.map(e=>A.jsxs("label",{className:"sep-layer-control__item "+(l===e.id?"active":""),children:[A.jsx("input",{type:"radio",name:"base-layer",value:e.id,checked:l===e.id,onChange:()=>c(e.id)}),A.jsxs("span",{className:"sep-layer-control__item-content",children:[A.jsx("span",{className:"sep-layer-control__item-name",children:n(e.name)||e.name}),e.description&&A.jsx("span",{className:"sep-layer-control__item-desc",children:n(e.description)||e.description})]})]},e.id))}),"overlay"===a&&A.jsxs("div",{className:"sep-layer-control__list",children:[p.map(e=>A.jsxs("label",{className:"sep-layer-control__item "+(h[e.id]?"active":""),children:[A.jsx("input",{type:"checkbox",checked:h[e.id]??!1,onChange:()=>d(e.id)}),A.jsxs("span",{className:"sep-layer-control__item-content",children:[A.jsx("span",{className:"sep-layer-control__item-name",children:n(e.name)||e.name}),e.description&&A.jsx("span",{className:"sep-layer-control__item-desc",children:n(e.description)||e.description})]})]},e.id)),0===p.length&&A.jsx("div",{className:"sep-layer-control__empty",children:n("layers.noOverlays")})]})]})]})]})});var ce,ue={exports:{}};var he=(ce||(ce=1,ue.exports=function(){var e={},t={};function n(i,n,r){if(t[i]=r,"index"===i){var o="var sharedModule = {}; ("+t.shared+")(sharedModule); ("+t.worker+")(sharedModule);",a={};return t.shared(a),t.index(e,a),"undefined"!=typeof window&&e.setWorkerUrl(window.URL.createObjectURL(new Blob([o],{type:"text/javascript"}))),e}}return n("shared",["exports"],function(e){function t(e,t,i,n){return new(i||(i=Promise))(function(r,o){function a(e){try{l(n.next(e))}catch(t){o(t)}}function s(e){try{l(n.throw(e))}catch(t){o(t)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(a,s)}l((n=n.apply(e,t||[])).next())})}function n(e,t){this.x=e,this.y=t}function r(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var o,a;"function"==typeof SuppressedError&&SuppressedError,n.prototype={clone(){return new n(this.x,this.y)},add(e){return this.clone()._add(e)},sub(e){return this.clone()._sub(e)},multByPoint(e){return this.clone()._multByPoint(e)},divByPoint(e){return this.clone()._divByPoint(e)},mult(e){return this.clone()._mult(e)},div(e){return this.clone()._div(e)},rotate(e){return this.clone()._rotate(e)},rotateAround(e,t){return this.clone()._rotateAround(e,t)},matMult(e){return this.clone()._matMult(e)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(e){return this.x===e.x&&this.y===e.y},dist(e){return Math.sqrt(this.distSqr(e))},distSqr(e){const t=e.x-this.x,i=e.y-this.y;return t*t+i*i},angle(){return Math.atan2(this.y,this.x)},angleTo(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith(e){return this.angleWithSep(e.x,e.y)},angleWithSep(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult(e){const t=e[2]*this.x+e[3]*this.y;return this.x=e[0]*this.x+e[1]*this.y,this.y=t,this},_add(e){return this.x+=e.x,this.y+=e.y,this},_sub(e){return this.x-=e.x,this.y-=e.y,this},_mult(e){return this.x*=e,this.y*=e,this},_div(e){return this.x/=e,this.y/=e,this},_multByPoint(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint(e){return this.x/=e.x,this.y/=e.y,this},_unit(){return this._div(this.mag()),this},_perp(){const e=this.y;return this.y=this.x,this.x=-e,this},_rotate(e){const t=Math.cos(e),i=Math.sin(e),n=i*this.x+t*this.y;return this.x=t*this.x-i*this.y,this.y=n,this},_rotateAround(e,t){const i=Math.cos(e),n=Math.sin(e),r=t.y+n*(this.x-t.x)+i*(this.y-t.y);return this.x=t.x+i*(this.x-t.x)-n*(this.y-t.y),this.y=r,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:n},n.convert=function(e){if(e instanceof n)return e;if(Array.isArray(e))return new n(+e[0],+e[1]);if(void 0!==e.x&&void 0!==e.y)return new n(+e.x,+e.y);throw new Error("Expected [x, y] or {x, y} point format")};var s=function(){if(a)return o;function e(e,t,i,n){this.cx=3*e,this.bx=3*(i-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(n-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=i,this.p2y=n}return a=1,o=e,e.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,t){if(void 0===t&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var i=e,n=0;n<8;n++){var r=this.sampleCurveX(i)-e;if(Math.abs(r)<t)return i;var o=this.sampleCurveDerivativeX(i);if(Math.abs(o)<1e-6)break;i-=r/o}var a=0,s=1;for(i=e,n=0;n<20&&(r=this.sampleCurveX(i),!(Math.abs(r-e)<t));n++)e>r?a=i:s=i,i=.5*(s-a)+a;return i},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}},o}(),l=r(s);let c,u;function h(){return null==c&&(c="undefined"!=typeof OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof createImageBitmap),c}function d(){if(null==u&&(u=!1,h())){const e=5,t=new OffscreenCanvas(e,e).getContext("2d",{willReadFrequently:!0});if(t){for(let n=0;n<e*e;n++){const i=4*n;t.fillStyle=`rgb(${i},${i+1},${i+2})`,t.fillRect(n%e,Math.floor(n/e),1,1)}const i=t.getImageData(0,0,e,e).data;for(let t=0;t<e*e*4;t++)if(t%4!=3&&i[t]!==t){u=!0;break}}}return u||!1}var p=1e-6,f="undefined"!=typeof Float32Array?Float32Array:Array;function m(){var e=new f(9);return f!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function g(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function _(){var e=new f(3);return f!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function y(e){var t=e[0],i=e[1],n=e[2];return Math.sqrt(t*t+i*i+n*n)}function v(e,t,i){var n=new f(3);return n[0]=e,n[1]=t,n[2]=i,n}function x(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e}function b(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e}function w(e,t,i){var n=t[0],r=t[1],o=t[2],a=i[0],s=i[1],l=i[2];return e[0]=r*l-o*s,e[1]=o*a-n*l,e[2]=n*s-r*a,e}var T,S=y;function P(e,t,i){var n=t[0],r=t[1],o=t[2],a=t[3];return e[0]=i[0]*n+i[4]*r+i[8]*o+i[12]*a,e[1]=i[1]*n+i[5]*r+i[9]*o+i[13]*a,e[2]=i[2]*n+i[6]*r+i[10]*o+i[14]*a,e[3]=i[3]*n+i[7]*r+i[11]*o+i[15]*a,e}function M(){var e=new f(4);return f!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function E(e,t,i,n){var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"zyx",o=Math.PI/360;t*=o,n*=o,i*=o;var a=Math.sin(t),s=Math.cos(t),l=Math.sin(i),c=Math.cos(i),u=Math.sin(n),h=Math.cos(n);switch(r){case"xyz":e[0]=a*c*h+s*l*u,e[1]=s*l*h-a*c*u,e[2]=s*c*u+a*l*h,e[3]=s*c*h-a*l*u;break;case"xzy":e[0]=a*c*h-s*l*u,e[1]=s*l*h-a*c*u,e[2]=s*c*u+a*l*h,e[3]=s*c*h+a*l*u;break;case"yxz":e[0]=a*c*h+s*l*u,e[1]=s*l*h-a*c*u,e[2]=s*c*u-a*l*h,e[3]=s*c*h+a*l*u;break;case"yzx":e[0]=a*c*h+s*l*u,e[1]=s*l*h+a*c*u,e[2]=s*c*u-a*l*h,e[3]=s*c*h-a*l*u;break;case"zxy":e[0]=a*c*h-s*l*u,e[1]=s*l*h+a*c*u,e[2]=s*c*u+a*l*h,e[3]=s*c*h-a*l*u;break;case"zyx":e[0]=a*c*h-s*l*u,e[1]=s*l*h+a*c*u,e[2]=s*c*u-a*l*h,e[3]=s*c*h+a*l*u;break;default:throw new Error("Unknown angle order "+r)}return e}function C(){var e=new f(2);return f!=Float32Array&&(e[0]=0,e[1]=0),e}function k(e,t){var i=new f(2);return i[0]=e,i[1]=t,i}_(),T=new f(4),f!=Float32Array&&(T[0]=0,T[1]=0,T[2]=0,T[3]=0),_(),v(1,0,0),v(0,1,0),M(),M(),m(),C();const I=8192;function z(e,t,i){return t*(I/(e.tileSize*Math.pow(2,i-e.tileID.overscaledZ)))}function A(e,t){return(e%t+t)%t}function L(e,t,i){return e*(1-i)+t*i}function D(e){if(e<=0)return 0;if(e>=1)return 1;const t=e*e,i=t*e;return 4*(e<.5?i:3*(e-t)+i-.75)}function R(e,t,i,n){const r=new l(e,t,i,n);return e=>r.solve(e)}const F=R(.25,.1,.25,1);function B(e,t,i){return Math.min(i,Math.max(t,e))}function O(e,t,i){const n=i-t,r=((e-t)%n+n)%n+t;return r===t?i:r}function N(e,...t){for(const i of t)for(const t in i)e[t]=i[t];return e}let j=1;function V(e,t,i){const n={};for(const r in e)n[r]=t.call(this,e[r],r,e);return n}function U(e,t,i){const n={};for(const r in e)t.call(this,e[r],r,e)&&(n[r]=e[r]);return n}function Z(e){return Array.isArray(e)?e.map(Z):"object"==typeof e&&e?V(e,Z):e}const G={};function q(e){G[e]||(G[e]=!0)}function $(e,t,i){return(i.y-e.y)*(t.x-e.x)>(t.y-e.y)*(i.x-e.x)}function W(e){return"undefined"!=typeof WorkerGlobalScope&&void 0!==e&&e instanceof WorkerGlobalScope}let H=null;function X(e){return"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap}const Y="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function K(e,i,n,r,o){return t(this,void 0,void 0,function*(){if("undefined"==typeof VideoFrame)throw new Error("VideoFrame not supported");const t=new VideoFrame(e,{timestamp:0});try{const a=null==t?void 0:t.format;if(!a||!a.startsWith("BGR")&&!a.startsWith("RGB"))throw new Error(`Unrecognized format ${a}`);const s=a.startsWith("BGR"),l=new Uint8ClampedArray(r*o*4);if(yield t.copyTo(l,function(e,t,i,n,r){const o=4*Math.max(-t,0),a=(Math.max(0,i)-i)*n*4+o,s=4*n,l=Math.max(0,t),c=Math.max(0,i);return{rect:{x:l,y:c,width:Math.min(e.width,t+n)-l,height:Math.min(e.height,i+r)-c},layout:[{offset:a,stride:s}]}}(e,i,n,r,o)),s)for(let e=0;e<l.length;e+=4){const t=l[e];l[e]=l[e+2],l[e+2]=t}return l}finally{t.close()}})}let Q,J;function ee(e,t,i,n){return e.addEventListener(t,i,n),{unsubscribe:()=>{e.removeEventListener(t,i,n)}}}function te(e){return e*Math.PI/180}function ie(e){return e/Math.PI*180}const ne={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},re={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0},oe="AbortError";class ae extends Error{constructor(e=oe){super(e instanceof Error?e.message:e),this.name=oe,e instanceof Error&&e.stack&&(this.stack=e.stack)}}function se(e){return e.name===oe}const le={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function ce(e){return le.REGISTERED_PROTOCOLS[e.substring(0,e.indexOf("://"))]}const ue="global-dispatcher";class he extends Error{constructor(e,t,i,n){super(`AJAXError: ${t} (${e}): ${i}`),this.status=e,this.statusText=t,this.url=i,this.body=n}}const de=()=>W(self)?self.worker&&self.worker.referrer:("blob:"===window.location.protocol?window.parent:window).location.href,pe=function(e,i){if(/:\/\//.test(e.url)&&!/^https?:|^file:/.test(e.url)){const t=ce(e.url);if(t)return t(e,i);if(W(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:e,targetMapId:ue},i)}if(!(/^file:/.test(n=e.url)||/^file:/.test(de())&&!/^\w+:/.test(n))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(e,i){return t(this,void 0,void 0,function*(){const t=new Request(e.url,{method:e.method||"GET",body:e.body,credentials:e.credentials,headers:e.headers,cache:e.cache,referrer:de(),signal:i.signal});let n,r;"json"!==e.type||t.headers.has("Accept")||t.headers.set("Accept","application/json");try{n=yield fetch(t)}catch(a){if(se(a))throw a;throw new he(0,a.message,e.url,new Blob)}if(!n.ok){const t=yield n.blob();throw new he(n.status,n.statusText,e.url,t)}r="arrayBuffer"===e.type||"image"===e.type?n.arrayBuffer():"json"===e.type?n.json():n.text();const o=yield r;return i.signal.throwIfAborted(),{data:o,cacheControl:n.headers.get("Cache-Control"),expires:n.headers.get("Expires")}})}(e,i);if(W(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:e,mustQueue:!0,targetMapId:ue},i)}var n,r,o;return r=e,o=i,new Promise((e,t)=>{var i;const n=new XMLHttpRequest;n.open(r.method||"GET",r.url,!0),"arrayBuffer"!==r.type&&"image"!==r.type||(n.responseType="arraybuffer");for(const o in r.headers)n.setRequestHeader(o,r.headers[o]);"json"===r.type&&(n.responseType="text",(null===(i=r.headers)||void 0===i?void 0:i.Accept)||n.setRequestHeader("Accept","application/json")),n.withCredentials="include"===r.credentials,n.onerror=()=>{t(new Error(n.statusText))},n.onload=()=>{if(!o.signal.aborted)if((n.status>=200&&n.status<300||0===n.status)&&null!==n.response){let o=n.response;if("json"===r.type)try{o=JSON.parse(n.response)}catch(i){return void t(i)}e({data:o,cacheControl:n.getResponseHeader("Cache-Control"),expires:n.getResponseHeader("Expires")})}else{const e=new Blob([n.response],{type:n.getResponseHeader("Content-Type")});t(new he(n.status,n.statusText,r.url,e))}},o.signal.addEventListener("abort",()=>{n.abort(),t(new ae(o.signal.reason))}),n.send(r.body)})};function fe(e){if(!e||e.indexOf("://")<=0||0===e.indexOf("data:image/")||0===e.indexOf("blob:"))return!0;const t=new URL(e),i=window.location;return t.protocol===i.protocol&&t.host===i.host}function me(e,t,i){i[e]&&-1!==i[e].indexOf(t)||(i[e]=i[e]||[],i[e].push(t))}function ge(e,t,i){if(i&&i[e]){const n=i[e].indexOf(t);-1!==n&&i[e].splice(n,1)}}class _e{constructor(e,t={}){N(this,t),this.type=e}}class ye extends _e{constructor(e,t={}){super("error",N({error:e},t))}}class ve{on(e,t){return this._listeners=this._listeners||{},me(e,t,this._listeners),{unsubscribe:()=>{this.off(e,t)}}}off(e,t){return ge(e,t,this._listeners),ge(e,t,this._oneTimeListeners),this}once(e,t){return t?(this._oneTimeListeners=this._oneTimeListeners||{},me(e,t,this._oneTimeListeners),this):new Promise(t=>this.once(e,t))}fire(e,t){"string"==typeof e&&(e=new _e(e,t||{}));const i=e.type;if(this.listens(i)){e.target=this;const t=this._listeners&&this._listeners[i]?this._listeners[i].slice():[];for(const i of t)i.call(this,e);const n=this._oneTimeListeners&&this._oneTimeListeners[i]?this._oneTimeListeners[i].slice():[];for(const o of n)ge(i,o,this._oneTimeListeners),o.call(this,e);const r=this._eventedParent;r&&(N(e,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),r.fire(e))}return this}listens(e){return this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)}setEventedParent(e,t){return this._eventedParent=e,this._eventedParentData=t,this}}var xe={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number",length:2},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},"font-faces":{type:"fontFaces"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},encoding:{type:"enum",values:{mvt:{},mlt:{}},default:"mvt"},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"filter"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},"color-relief":{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},filter:{type:"boolean",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"expression_name",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}},interpolation:{type:"array",value:"interpolation_name",minimum:1},interpolation_name:{type:"enum",values:{linear:{syntax:{overloads:[{parameters:[],"output-type":"interpolation"}],parameters:[]}},exponential:{syntax:{overloads:[{parameters:["base"],"output-type":"interpolation"}],parameters:[{name:"base",type:"number literal"}]}},"cubic-bezier":{syntax:{overloads:[{parameters:["x1","y1","x2","y2"],"output-type":"interpolation"}],parameters:[{name:"x1",type:"number literal"},{name:"y1",type:"number literal"},{name:"x2",type:"number literal"},{name:"y2",type:"number literal"}]}}}}};const be=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function we(e,t){const i={};for(const n in e)"ref"!==n&&(i[n]=e[n]);return be.forEach(e=>{e in t&&(i[e]=t[e])}),i}function Te(e,t){if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(!Te(e[i],t[i]))return!1;return!0}if("object"==typeof e&&null!==e&&null!==t){if("object"!=typeof t)return!1;if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const i in e)if(!Te(e[i],t[i]))return!1;return!0}return e===t}function Se(e,t){e.push(t)}function Pe(e,t,i){Se(i,{command:"addSource",args:[e,t[e]]})}function Me(e,t,i){Se(t,{command:"removeSource",args:[e]}),i[e]=!0}function Ee(e,t,i,n){Me(e,i,n),Pe(e,t,i)}function Ce(e,t,i){let n;for(n in e[i])if(Object.prototype.hasOwnProperty.call(e[i],n)&&"data"!==n&&!Te(e[i][n],t[i][n]))return!1;for(n in t[i])if(Object.prototype.hasOwnProperty.call(t[i],n)&&"data"!==n&&!Te(e[i][n],t[i][n]))return!1;return!0}function ke(e,t,i,n,r,o){e=e||{},t=t||{};for(const a in e)Object.prototype.hasOwnProperty.call(e,a)&&(Te(e[a],t[a])||i.push({command:o,args:[n,a,t[a],r]}));for(const a in t)Object.prototype.hasOwnProperty.call(t,a)&&!Object.prototype.hasOwnProperty.call(e,a)&&(Te(e[a],t[a])||i.push({command:o,args:[n,a,t[a],r]}))}function Ie(e){return e.id}function ze(e,t){return e[t.id]=t,e}class Ae{constructor(e,t,i,n){this.message=(e?`${e}: `:"")+i,n&&(this.identifier=n),null!=t&&t.__line__&&(this.line=t.__line__)}}function Le(e,...t){for(const i of t)for(const t in i)e[t]=i[t];return e}class De extends Error{constructor(e,t){super(t),this.message=t,this.key=e}}class Re{constructor(e,t=[]){this.parent=e,this.bindings={};for(const[i,n]of t)this.bindings[i]=n}concat(e){return new Re(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}const Fe={kind:"null"},Be={kind:"number"},Oe={kind:"string"},Ne={kind:"boolean"},je={kind:"color"},Ve={kind:"projectionDefinition"},Ue={kind:"object"},Ze={kind:"value"},Ge={kind:"collator"},qe={kind:"formatted"},$e={kind:"padding"},We={kind:"colorArray"},He={kind:"numberArray"},Xe={kind:"resolvedImage"},Ye={kind:"variableAnchorOffsetCollection"};function Ke(e,t){return{kind:"array",itemType:e,N:t}}function Qe(e){if("array"===e.kind){const t=Qe(e.itemType);return"number"==typeof e.N?`array<${t}, ${e.N}>`:"value"===e.itemType.kind?"array":`array<${t}>`}return e.kind}const Je=[Fe,Be,Oe,Ne,je,Ve,qe,Ue,Ke(Ze),$e,He,We,Xe,Ye];function et(e,t){if("error"===t.kind)return null;if("array"===e.kind){if("array"===t.kind&&(0===t.N&&"value"===t.itemType.kind||!et(e.itemType,t.itemType))&&("number"!=typeof e.N||e.N===t.N))return null}else{if(e.kind===t.kind)return null;if("value"===e.kind)for(const e of Je)if(!et(e,t))return null}return`Expected ${Qe(e)} but found ${Qe(t)} instead.`}function tt(e,t){return t.some(t=>t.kind===e.kind)}function it(e,t){return t.some(t=>"null"===t?null===e:"array"===t?Array.isArray(e):"object"===t?e&&!Array.isArray(e)&&"object"==typeof e:t===typeof e)}function nt(e,t){return"array"===e.kind&&"array"===t.kind?e.itemType.kind===t.itemType.kind&&"number"==typeof e.N:e.kind===t.kind}const rt=.96422,ot=.82521,at=4/29,st=6/29,lt=3*st*st,ct=st*st*st,ut=Math.PI/180,ht=180/Math.PI;function dt(e){return(e%=360)<0&&(e+=360),e}function pt([e,t,i,n]){let r,o;const a=mt((.2225045*(e=ft(e))+.7168786*(t=ft(t))+.0606169*(i=ft(i)))/1);e===t&&t===i?r=o=a:(r=mt((.4360747*e+.3850649*t+.1430804*i)/rt),o=mt((.0139322*e+.0971045*t+.7141733*i)/ot));const s=116*a-16;return[s<0?0:s,500*(r-a),200*(a-o),n]}function ft(e){return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function mt(e){return e>ct?Math.pow(e,1/3):e/lt+at}function gt([e,t,i,n]){let r=(e+16)/116,o=isNaN(t)?r:r+t/500,a=isNaN(i)?r:r-i/200;return r=1*yt(r),o=rt*yt(o),a=ot*yt(a),[_t(3.1338561*o-1.6168667*r-.4906146*a),_t(-.9787684*o+1.9161415*r+.033454*a),_t(.0719453*o-.2289914*r+1.4052427*a),n]}function _t(e){return(e=e<=.00304?12.92*e:1.055*Math.pow(e,1/2.4)-.055)<0?0:e>1?1:e}function yt(e){return e>st?e*e*e:lt*(e-at)}const vt=Object.hasOwn||function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};function xt(e,t){return vt(e,t)?e[t]:void 0}function bt(e){return parseInt(e.padEnd(2,e),16)/255}function wt(e,t){return Tt(t?e/100:e,0,1)}function Tt(e,t,i){return Math.min(Math.max(t,e),i)}function St(e){return!e.some(Number.isNaN)}const Pt={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function Mt(e,t,i){return e+i*(t-e)}function Et(e,t,i){return e.map((e,n)=>Mt(e,t[n],i))}class Ct{constructor(e,t,i,n=1,r=!0){this.r=e,this.g=t,this.b=i,this.a=n,r||(this.r*=n,this.g*=n,this.b*=n,n||this.overwriteGetter("rgb",[e,t,i,n]))}static parse(e){if(e instanceof Ct)return e;if("string"!=typeof e)return;const t=function(e){if("transparent"===(e=e.toLowerCase().trim()))return[0,0,0,0];const t=xt(Pt,e);if(t){const[e,i,n]=t;return[e/255,i/255,n/255,1]}if(e.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(e)){const t=e.length<6?1:2;let i=1;return[bt(e.slice(i,i+=t)),bt(e.slice(i,i+=t)),bt(e.slice(i,i+=t)),bt(e.slice(i,i+t)||"ff")]}if(e.startsWith("rgb")){const t=e.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(t){const[e,i,n,r,o,a,s,l,c,u,h,d]=t,p=[r||" ",s||" ",u].join("");if(" "===p||" /"===p||",,"===p||",,,"===p){const e=[n,a,c].join(""),t="%%%"===e?100:""===e?255:0;if(t){const e=[Tt(+i/t,0,1),Tt(+o/t,0,1),Tt(+l/t,0,1),h?wt(+h,d):1];if(St(e))return e}}return}}const i=e.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(i){const[e,t,n,r,o,a,s,l,c]=i,u=[n||" ",o||" ",s].join("");if(" "===u||" /"===u||",,"===u||",,,"===u){const e=[+t,Tt(+r,0,100),Tt(+a,0,100),l?wt(+l,c):1];if(St(e))return function([e,t,i,n]){function r(n){const r=(n+e/30)%12,o=t*Math.min(i,1-i);return i-o*Math.max(-1,Math.min(r-3,9-r,1))}return e=dt(e),t/=100,i/=100,[r(0),r(8),r(4),n]}(e)}}}(e);return t?new Ct(...t,!1):void 0}get rgb(){const{r:e,g:t,b:i,a:n}=this,r=n||1/0;return this.overwriteGetter("rgb",[e/r,t/r,i/r,n])}get hcl(){return this.overwriteGetter("hcl",function(e){const[t,i,n,r]=pt(e),o=Math.sqrt(i*i+n*n);return[Math.round(1e4*o)?dt(Math.atan2(n,i)*ht):NaN,o,t,r]}(this.rgb))}get lab(){return this.overwriteGetter("lab",pt(this.rgb))}overwriteGetter(e,t){return Object.defineProperty(this,e,{value:t}),t}toString(){const[e,t,i,n]=this.rgb;return`rgba(${[e,t,i].map(e=>Math.round(255*e)).join(",")},${n})`}static interpolate(e,t,i,n="rgb"){switch(n){case"rgb":{const[n,r,o,a]=Et(e.rgb,t.rgb,i);return new Ct(n,r,o,a,!1)}case"hcl":{const[n,r,o,a]=e.hcl,[s,l,c,u]=t.hcl;let h,d;if(isNaN(n)||isNaN(s))isNaN(n)?isNaN(s)?h=NaN:(h=s,1!==o&&0!==o||(d=l)):(h=n,1!==c&&0!==c||(d=r));else{let e=s-n;s>n&&e>180?e-=360:s<n&&n-s>180&&(e+=360),h=n+i*e}const[p,f,m,g]=function([e,t,i,n]){return e=isNaN(e)?0:e*ut,gt([i,Math.cos(e)*t,Math.sin(e)*t,n])}([h,null!=d?d:Mt(r,l,i),Mt(o,c,i),Mt(a,u,i)]);return new Ct(p,f,m,g,!1)}case"lab":{const[n,r,o,a]=gt(Et(e.lab,t.lab,i));return new Ct(n,r,o,a,!1)}}}}Ct.black=new Ct(0,0,0,1),Ct.white=new Ct(1,1,1,1),Ct.transparent=new Ct(0,0,0,0),Ct.red=new Ct(1,0,0,1);class kt{constructor(e,t,i){this.sensitivity=e?t?"variant":"case":t?"accent":"base",this.locale=i,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,t){return this.collator.compare(e,t)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}const It=["bottom","center","top"];class zt{constructor(e,t,i,n,r,o){this.text=e,this.image=t,this.scale=i,this.fontStack=n,this.textColor=r,this.verticalAlign=o}}class At{constructor(e){this.sections=e}static fromString(e){return new At([new zt(e,null,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some(e=>0!==e.text.length||e.image&&0!==e.image.name.length)}static factory(e){return e instanceof At?e:At.fromString(e)}toString(){return 0===this.sections.length?"":this.sections.map(e=>e.text).join("")}}class Lt{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Lt)return e;if("number"==typeof e)return new Lt([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const t of e)if("number"!=typeof t)return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new Lt(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,i){return new Lt(Et(e.values,t.values,i))}}class Dt{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Dt)return e;if("number"==typeof e)return new Dt([e]);if(Array.isArray(e)){for(const t of e)if("number"!=typeof t)return;return new Dt(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,i){return new Dt(Et(e.values,t.values,i))}}class Rt{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Rt)return e;if("string"==typeof e){const t=Ct.parse(e);if(!t)return;return new Rt([t])}if(!Array.isArray(e))return;const t=[];for(const i of e){if("string"!=typeof i)return;const e=Ct.parse(i);if(!e)return;t.push(e)}return new Rt(t)}toString(){return JSON.stringify(this.values)}static interpolate(e,t,i,n="rgb"){const r=[];if(e.values.length!=t.values.length)throw new Error(`colorArray: Arrays have mismatched length (${e.values.length} vs. ${t.values.length}), cannot interpolate.`);for(let o=0;o<e.values.length;o++)r.push(Ct.interpolate(e.values[o],t.values[o],i,n));return new Rt(r)}}class Ft extends Error{constructor(e){super(e),this.name="RuntimeError"}toJSON(){return this.message}}const Bt=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Ot{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Ot)return e;if(Array.isArray(e)&&!(e.length<1)&&e.length%2==0){for(let t=0;t<e.length;t+=2){const i=e[t],n=e[t+1];if("string"!=typeof i||!Bt.has(i))return;if(!Array.isArray(n)||2!==n.length||"number"!=typeof n[0]||"number"!=typeof n[1])return}return new Ot(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,i){const n=e.values,r=t.values;if(n.length!==r.length)throw new Ft(`Cannot interpolate values of different length. from: ${e.toString()}, to: ${t.toString()}`);const o=[];for(let a=0;a<n.length;a+=2){if(n[a]!==r[a])throw new Ft(`Cannot interpolate values containing mismatched anchors. from[${a}]: ${n[a]}, to[${a}]: ${r[a]}`);o.push(n[a]);const[e,t]=n[a+1],[s,l]=r[a+1];o.push([Mt(e,s,i),Mt(t,l,i)])}return new Ot(o)}}class Nt{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new Nt({name:e,available:!1}):null}}class jt{constructor(e,t,i){this.from=e,this.to=t,this.transition=i}static interpolate(e,t,i){return new jt(e,t,i)}static parse(e){return e instanceof jt?e:Array.isArray(e)&&3===e.length&&"string"==typeof e[0]&&"string"==typeof e[1]&&"number"==typeof e[2]?new jt(e[0],e[1],e[2]):"object"==typeof e&&"string"==typeof e.from&&"string"==typeof e.to&&"number"==typeof e.transition?new jt(e.from,e.to,e.transition):"string"==typeof e?new jt(e,e,1):void 0}}function Vt(e,t,i,n){return"number"==typeof e&&e>=0&&e<=255&&"number"==typeof t&&t>=0&&t<=255&&"number"==typeof i&&i>=0&&i<=255?void 0===n||"number"==typeof n&&n>=0&&n<=1?null:`Invalid rgba value [${[e,t,i,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof n?[e,t,i,n]:[e,t,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Ut(e){if(null===e||"string"==typeof e||"boolean"==typeof e||"number"==typeof e||e instanceof jt||e instanceof Ct||e instanceof kt||e instanceof At||e instanceof Lt||e instanceof Dt||e instanceof Rt||e instanceof Ot||e instanceof Nt)return!0;if(Array.isArray(e)){for(const t of e)if(!Ut(t))return!1;return!0}if("object"==typeof e){for(const t in e)if(!Ut(e[t]))return!1;return!0}return!1}function Zt(e){if(null===e)return Fe;if("string"==typeof e)return Oe;if("boolean"==typeof e)return Ne;if("number"==typeof e)return Be;if(e instanceof Ct)return je;if(e instanceof jt)return Ve;if(e instanceof kt)return Ge;if(e instanceof At)return qe;if(e instanceof Lt)return $e;if(e instanceof Dt)return He;if(e instanceof Rt)return We;if(e instanceof Ot)return Ye;if(e instanceof Nt)return Xe;if(Array.isArray(e)){const t=e.length;let i;for(const n of e){const e=Zt(n);if(i){if(i===e)continue;i=Ze;break}i=e}return Ke(i||Ze,t)}return Ue}function Gt(e){const t=typeof e;return null===e?"":"string"===t||"number"===t||"boolean"===t?String(e):e instanceof Ct||e instanceof jt||e instanceof At||e instanceof Lt||e instanceof Dt||e instanceof Rt||e instanceof Ot||e instanceof Nt?e.toString():JSON.stringify(e)}class qt{constructor(e,t){this.type=e,this.value=t}static parse(e,t){if(2!==e.length)return t.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!Ut(e[1]))return t.error("invalid value");const i=e[1];let n=Zt(i);const r=t.expectedType;return"array"!==n.kind||0!==n.N||!r||"array"!==r.kind||"number"==typeof r.N&&0!==r.N||(n=r),new qt(n,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const $t={string:Oe,number:Be,boolean:Ne,object:Ue};class Wt{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let i,n=1;const r=e[0];if("array"===r){let r,o;if(e.length>2){const i=e[1];if("string"!=typeof i||!(i in $t)||"object"===i)return t.error('The item type argument of "array" must be one of string, number, boolean',1);r=$t[i],n++}else r=Ze;if(e.length>3){if(null!==e[2]&&("number"!=typeof e[2]||e[2]<0||e[2]!==Math.floor(e[2])))return t.error('The length argument to "array" must be a positive integer literal',2);o=e[2],n++}i=Ke(r,o)}else{if(!$t[r])throw new Error(`Types doesn't contain name = ${r}`);i=$t[r]}const o=[];for(;n<e.length;n++){const i=t.parse(e[n],n,Ze);if(!i)return null;o.push(i)}return new Wt(i,o)}evaluate(e){for(let t=0;t<this.args.length;t++){const i=this.args[t].evaluate(e);if(!et(this.type,Zt(i)))return i;if(t===this.args.length-1)throw new Ft(`Expected value to be of type ${Qe(this.type)}, but found ${Qe(Zt(i))} instead.`)}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const Ht={"to-boolean":Ne,"to-color":je,"to-number":Be,"to-string":Oe};class Xt{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const i=e[0];if(!Ht[i])throw new Error(`Can't parse ${i} as it is not part of the known types`);if(("to-boolean"===i||"to-string"===i)&&2!==e.length)return t.error("Expected one argument.");const n=Ht[i],r=[];for(let o=1;o<e.length;o++){const i=t.parse(e[o],o,Ze);if(!i)return null;r.push(i)}return new Xt(n,r)}evaluate(e){switch(this.type.kind){case"boolean":return Boolean(this.args[0].evaluate(e));case"color":{let t,i;for(const n of this.args){if(t=n.evaluate(e),i=null,t instanceof Ct)return t;if("string"==typeof t){const i=e.parseColor(t);if(i)return i}else if(Array.isArray(t)&&(i=t.length<3||t.length>4?`Invalid rgba value ${JSON.stringify(t)}: expected an array containing either three or four numeric values.`:Vt(t[0],t[1],t[2],t[3]),!i))return new Ct(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new Ft(i||`Could not parse color from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"padding":{let t;for(const i of this.args){t=i.evaluate(e);const n=Lt.parse(t);if(n)return n}throw new Ft(`Could not parse padding from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"numberArray":{let t;for(const i of this.args){t=i.evaluate(e);const n=Dt.parse(t);if(n)return n}throw new Ft(`Could not parse numberArray from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"colorArray":{let t;for(const i of this.args){t=i.evaluate(e);const n=Rt.parse(t);if(n)return n}throw new Ft(`Could not parse colorArray from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"variableAnchorOffsetCollection":{let t;for(const i of this.args){t=i.evaluate(e);const n=Ot.parse(t);if(n)return n}throw new Ft(`Could not parse variableAnchorOffsetCollection from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"number":{let t=null;for(const i of this.args){if(t=i.evaluate(e),null===t)return 0;const n=Number(t);if(!isNaN(n))return n}throw new Ft(`Could not convert ${JSON.stringify(t)} to number.`)}case"formatted":return At.fromString(Gt(this.args[0].evaluate(e)));case"resolvedImage":return Nt.fromString(Gt(this.args[0].evaluate(e)));case"projectionDefinition":return this.args[0].evaluate(e);default:return Gt(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const Yt=["Unknown","Point","LineString","Polygon"];class Kt{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?Yt[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(e){let t=this._parseColorCache.get(e);return t||(t=Ct.parse(e),this._parseColorCache.set(e,t)),t}}class Qt{constructor(e,t,i=[],n,r=new Re,o=[]){this.registry=e,this.path=i,this.key=i.map(e=>`[${e}]`).join(""),this.scope=r,this.errors=o,this.expectedType=n,this._isConstant=t}parse(e,t,i,n,r={}){return t?this.concat(t,i,n)._parse(e,r):this._parse(e,r)}_parse(e,t){function i(e,t,i){return"assert"===i?new Wt(t,[e]):"coerce"===i?new Xt(t,[e]):e}if(null!==e&&"string"!=typeof e&&"boolean"!=typeof e&&"number"!=typeof e||(e=["literal",e]),Array.isArray(e)){if(0===e.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const r=e[0];if("string"!=typeof r)return this.error(`Expression name must be a string, but found ${typeof r} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const o=this.registry[r];if(o){let r=o.parse(e,this);if(!r)return null;if(this.expectedType){const e=this.expectedType,n=r.type;if("string"!==e.kind&&"number"!==e.kind&&"boolean"!==e.kind&&"object"!==e.kind&&"array"!==e.kind||"value"!==n.kind){if("projectionDefinition"===e.kind&&["string","array"].includes(n.kind)||["color","formatted","resolvedImage"].includes(e.kind)&&["value","string"].includes(n.kind)||["padding","numberArray"].includes(e.kind)&&["value","number","array"].includes(n.kind)||"colorArray"===e.kind&&["value","string","array"].includes(n.kind)||"variableAnchorOffsetCollection"===e.kind&&["value","array"].includes(n.kind))r=i(r,e,t.typeAnnotation||"coerce");else if(this.checkSubtype(e,n))return null}else r=i(r,e,t.typeAnnotation||"assert")}if(!(r instanceof qt)&&"resolvedImage"!==r.type.kind&&this._isConstant(r)){const e=new Kt;try{r=new qt(r.type,r.evaluate(e))}catch(n){return this.error(n.message),null}}return r}return this.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(void 0===e?"'undefined' value invalid. Use null instead.":"object"==typeof e?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,t,i){const n="number"==typeof e?this.path.concat(e):this.path,r=i?this.scope.concat(i):this.scope;return new Qt(this.registry,this._isConstant,n,t||null,r,this.errors)}error(e,...t){const i=`${this.key}${t.map(e=>`[${e}]`).join("")}`;this.errors.push(new De(i,e))}checkSubtype(e,t){const i=et(e,t);return i&&this.error(i),i}}class Jt{constructor(e,t){this.type=t.type,this.bindings=[].concat(e),this.result=t}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const t of this.bindings)e(t[1]);e(this.result)}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const i=[];for(let r=1;r<e.length-1;r+=2){const n=e[r];if("string"!=typeof n)return t.error(`Expected string, but found ${typeof n} instead.`,r);if(/[^a-zA-Z0-9_]/.test(n))return t.error("Variable names must contain only alphanumeric characters or '_'.",r);const o=t.parse(e[r+1],r+1);if(!o)return null;i.push([n,o])}const n=t.parse(e[e.length-1],e.length-1,t.expectedType,i);return n?new Jt(i,n):null}outputDefined(){return this.result.outputDefined()}}class ei{constructor(e,t){this.type=t.type,this.name=e,this.boundExpression=t}static parse(e,t){if(2!==e.length||"string"!=typeof e[1])return t.error("'var' expression requires exactly one string literal argument.");const i=e[1];return t.scope.has(i)?new ei(i,t.scope.get(i)):t.error(`Unknown variable "${i}". Make sure "${i}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}}class ti{constructor(e,t,i){this.type=e,this.index=t,this.input=i}static parse(e,t){if(3!==e.length)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,Be),n=t.parse(e[2],2,Ke(t.expectedType||Ze));return i&&n?new ti(n.type.itemType,i,n):null}evaluate(e){const t=this.index.evaluate(e),i=this.input.evaluate(e);if(t<0)throw new Ft(`Array index out of bounds: ${t} < 0.`);if(t>=i.length)throw new Ft(`Array index out of bounds: ${t} > ${i.length-1}.`);if(t!==Math.floor(t))throw new Ft(`Array index must be an integer, but found ${t} instead.`);return i[t]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class ii{constructor(e,t){this.type=Ne,this.needle=e,this.haystack=t}static parse(e,t){if(3!==e.length)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,Ze),n=t.parse(e[2],2,Ze);return i&&n?tt(i.type,[Ne,Oe,Be,Fe,Ze])?new ii(i,n):t.error(`Expected first argument to be of type boolean, string, number or null, but found ${Qe(i.type)} instead`):null}evaluate(e){const t=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!i)return!1;if(!it(t,["boolean","string","number","null"]))throw new Ft(`Expected first argument to be of type boolean, string, number or null, but found ${Qe(Zt(t))} instead.`);if(!it(i,["string","array"]))throw new Ft(`Expected second argument to be of type array or string, but found ${Qe(Zt(i))} instead.`);return i.indexOf(t)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class ni{constructor(e,t,i){this.type=Be,this.needle=e,this.haystack=t,this.fromIndex=i}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,Ze),n=t.parse(e[2],2,Ze);if(!i||!n)return null;if(!tt(i.type,[Ne,Oe,Be,Fe,Ze]))return t.error(`Expected first argument to be of type boolean, string, number or null, but found ${Qe(i.type)} instead`);if(4===e.length){const r=t.parse(e[3],3,Be);return r?new ni(i,n,r):null}return new ni(i,n)}evaluate(e){const t=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!it(t,["boolean","string","number","null"]))throw new Ft(`Expected first argument to be of type boolean, string, number or null, but found ${Qe(Zt(t))} instead.`);let n;if(this.fromIndex&&(n=this.fromIndex.evaluate(e)),it(i,["string"])){const e=i.indexOf(t,n);return-1===e?-1:[...i.slice(0,e)].length}if(it(i,["array"]))return i.indexOf(t,n);throw new Ft(`Expected second argument to be of type array or string, but found ${Qe(Zt(i))} instead.`)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class ri{constructor(e,t,i,n,r,o){this.inputType=e,this.type=t,this.input=i,this.cases=n,this.outputs=r,this.otherwise=o}static parse(e,t){if(e.length<5)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return t.error("Expected an even number of arguments.");let i,n;t.expectedType&&"value"!==t.expectedType.kind&&(n=t.expectedType);const r={},o=[];for(let l=2;l<e.length-1;l+=2){let a=e[l];const s=e[l+1];Array.isArray(a)||(a=[a]);const c=t.concat(l);if(0===a.length)return c.error("Expected at least one branch label.");for(const e of a){if("number"!=typeof e&&"string"!=typeof e)return c.error("Branch labels must be numbers or strings.");if("number"==typeof e&&Math.abs(e)>Number.MAX_SAFE_INTEGER)return c.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof e&&Math.floor(e)!==e)return c.error("Numeric branch labels must be integer values.");if(i){if(c.checkSubtype(i,Zt(e)))return null}else i=Zt(e);if(void 0!==r[String(e)])return c.error("Branch labels must be unique.");r[String(e)]=o.length}const u=t.parse(s,l,n);if(!u)return null;n=n||u.type,o.push(u)}const a=t.parse(e[1],1,Ze);if(!a)return null;const s=t.parse(e[e.length-1],e.length-1,n);return s?"value"!==a.type.kind&&t.concat(1).checkSubtype(i,a.type)?null:new ri(i,n,a,r,o,s):null}evaluate(e){const t=this.input.evaluate(e);return(Zt(t)===this.inputType&&this.outputs[this.cases[t]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}}class oi{constructor(e,t,i){this.type=e,this.branches=t,this.otherwise=i}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return t.error("Expected an odd number of arguments.");let i;t.expectedType&&"value"!==t.expectedType.kind&&(i=t.expectedType);const n=[];for(let o=1;o<e.length-1;o+=2){const r=t.parse(e[o],o,Ne);if(!r)return null;const a=t.parse(e[o+1],o+1,i);if(!a)return null;n.push([r,a]),i=i||a.type}const r=t.parse(e[e.length-1],e.length-1,i);if(!r)return null;if(!i)throw new Error("Can't infer output type");return new oi(i,n,r)}evaluate(e){for(const[t,i]of this.branches)if(t.evaluate(e))return i.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[t,i]of this.branches)e(t),e(i);e(this.otherwise)}outputDefined(){return this.branches.every(([e,t])=>t.outputDefined())&&this.otherwise.outputDefined()}}class ai{constructor(e,t,i,n){this.type=e,this.input=t,this.beginIndex=i,this.endIndex=n}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,Ze),n=t.parse(e[2],2,Be);if(!i||!n)return null;if(!tt(i.type,[Ke(Ze),Oe,Ze]))return t.error(`Expected first argument to be of type array or string, but found ${Qe(i.type)} instead`);if(4===e.length){const r=t.parse(e[3],3,Be);return r?new ai(i.type,i,n,r):null}return new ai(i.type,i,n)}evaluate(e){const t=this.input.evaluate(e),i=this.beginIndex.evaluate(e);let n;if(this.endIndex&&(n=this.endIndex.evaluate(e)),it(t,["string"]))return[...t].slice(i,n).join("");if(it(t,["array"]))return t.slice(i,n);throw new Ft(`Expected first argument to be of type array or string, but found ${Qe(Zt(t))} instead.`)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function si(e,t){const i=e.length-1;let n,r,o=0,a=i,s=0;for(;o<=a;)if(s=Math.floor((o+a)/2),n=e[s],r=e[s+1],n<=t){if(s===i||t<r)return s;o=s+1}else{if(!(n>t))throw new Ft("Input is not a number.");a=s-1}return 0}class li{constructor(e,t,i){this.type=e,this.input=t,this.labels=[],this.outputs=[];for(const[n,r]of i)this.labels.push(n),this.outputs.push(r)}static parse(e,t){if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return t.error("Expected an even number of arguments.");const i=t.parse(e[1],1,Be);if(!i)return null;const n=[];let r=null;t.expectedType&&"value"!==t.expectedType.kind&&(r=t.expectedType);for(let o=1;o<e.length;o+=2){const i=1===o?-1/0:e[o],a=e[o+1],s=o,l=o+1;if("number"!=typeof i)return t.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',s);if(n.length&&n[n.length-1][0]>=i)return t.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',s);const c=t.parse(a,l,r);if(!c)return null;r=r||c.type,n.push([i,c])}return new li(r,i,n)}evaluate(e){const t=this.labels,i=this.outputs;if(1===t.length)return i[0].evaluate(e);const n=this.input.evaluate(e);if(n<=t[0])return i[0].evaluate(e);const r=t.length;return n>=t[r-1]?i[r-1].evaluate(e):i[si(t,n)].evaluate(e)}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function ci(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ui,hi,di=function(){if(hi)return ui;function e(e,t,i,n){this.cx=3*e,this.bx=3*(i-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(n-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=i,this.p2y=n}return hi=1,ui=e,e.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,t){if(void 0===t&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var i=e,n=0;n<8;n++){var r=this.sampleCurveX(i)-e;if(Math.abs(r)<t)return i;var o=this.sampleCurveDerivativeX(i);if(Math.abs(o)<1e-6)break;i-=r/o}var a=0,s=1;for(i=e,n=0;n<20&&(r=this.sampleCurveX(i),!(Math.abs(r-e)<t));n++)e>r?a=i:s=i,i=.5*(s-a)+a;return i},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}},ui}(),pi=ci(di);class fi{constructor(e,t,i,n,r){this.type=e,this.operator=t,this.interpolation=i,this.input=n,this.labels=[],this.outputs=[];for(const[o,a]of r)this.labels.push(o),this.outputs.push(a)}static interpolationFactor(e,t,i,n){let r=0;if("exponential"===e.name)r=mi(t,e.base,i,n);else if("linear"===e.name)r=mi(t,1,i,n);else if("cubic-bezier"===e.name){const o=e.controlPoints;r=new pi(o[0],o[1],o[2],o[3]).solve(mi(t,1,i,n))}return r}static parse(e,t){let[i,n,r,...o]=e;if(!Array.isArray(n)||0===n.length)return t.error("Expected an interpolation type expression.",1);if("linear"===n[0])n={name:"linear"};else if("exponential"===n[0]){const e=n[1];if("number"!=typeof e)return t.error("Exponential interpolation requires a numeric base.",1,1);n={name:"exponential",base:e}}else{if("cubic-bezier"!==n[0])return t.error(`Unknown interpolation type ${String(n[0])}`,1,0);{const e=n.slice(1);if(4!==e.length||e.some(e=>"number"!=typeof e||e<0||e>1))return t.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:e}}}if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return t.error("Expected an even number of arguments.");if(r=t.parse(r,2,Be),!r)return null;const a=[];let s=null;"interpolate-hcl"!==i&&"interpolate-lab"!==i||t.expectedType==We?t.expectedType&&"value"!==t.expectedType.kind&&(s=t.expectedType):s=je;for(let l=0;l<o.length;l+=2){const e=o[l],i=o[l+1],n=l+3,r=l+4;if("number"!=typeof e)return t.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',n);if(a.length&&a[a.length-1][0]>=e)return t.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',n);const c=t.parse(i,r,s);if(!c)return null;s=s||c.type,a.push([e,c])}return nt(s,Be)||nt(s,Ve)||nt(s,je)||nt(s,$e)||nt(s,He)||nt(s,We)||nt(s,Ye)||nt(s,Ke(Be))?new fi(s,i,n,r,a):t.error(`Type ${Qe(s)} is not interpolatable.`)}evaluate(e){const t=this.labels,i=this.outputs;if(1===t.length)return i[0].evaluate(e);const n=this.input.evaluate(e);if(n<=t[0])return i[0].evaluate(e);const r=t.length;if(n>=t[r-1])return i[r-1].evaluate(e);const o=si(t,n),a=fi.interpolationFactor(this.interpolation,n,t[o],t[o+1]),s=i[o].evaluate(e),l=i[o+1].evaluate(e);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return Mt(s,l,a);case"color":return Ct.interpolate(s,l,a);case"padding":return Lt.interpolate(s,l,a);case"colorArray":return Rt.interpolate(s,l,a);case"numberArray":return Dt.interpolate(s,l,a);case"variableAnchorOffsetCollection":return Ot.interpolate(s,l,a);case"array":return Et(s,l,a);case"projectionDefinition":return jt.interpolate(s,l,a)}case"interpolate-hcl":switch(this.type.kind){case"color":return Ct.interpolate(s,l,a,"hcl");case"colorArray":return Rt.interpolate(s,l,a,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return Ct.interpolate(s,l,a,"lab");case"colorArray":return Rt.interpolate(s,l,a,"lab")}}}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function mi(e,t,i,n){const r=n-i,o=e-i;return 0===r?0:1===t?o/r:(Math.pow(t,o)-1)/(Math.pow(t,r)-1)}const gi={color:Ct.interpolate,number:Mt,padding:Lt.interpolate,numberArray:Dt.interpolate,colorArray:Rt.interpolate,variableAnchorOffsetCollection:Ot.interpolate,array:Et};class _i{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let i=null;const n=t.expectedType;n&&"value"!==n.kind&&(i=n);const r=[];for(const a of e.slice(1)){const e=t.parse(a,1+r.length,i,void 0,{typeAnnotation:"omit"});if(!e)return null;i=i||e.type,r.push(e)}if(!i)throw new Error("No output type");const o=n&&r.some(e=>et(n,e.type));return new _i(o?Ze:i,r)}evaluate(e){let t,i=null,n=0;for(const r of this.args)if(n++,i=r.evaluate(e),i&&i instanceof Nt&&!i.available&&(t||(t=i.name),i=null,n===this.args.length&&(i=t)),null!==i)break;return i}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}function yi(e,t){return"=="===e||"!="===e?"boolean"===t.kind||"string"===t.kind||"number"===t.kind||"null"===t.kind||"value"===t.kind:"string"===t.kind||"number"===t.kind||"value"===t.kind}function vi(e,t,i,n){return 0===n.compare(t,i)}function xi(e,t,i){const n="=="!==e&&"!="!==e;return class r{constructor(e,t,i){this.type=Ne,this.lhs=e,this.rhs=t,this.collator=i,this.hasUntypedArgument="value"===e.type.kind||"value"===t.type.kind}static parse(e,t){if(3!==e.length&&4!==e.length)return t.error("Expected two or three arguments.");const i=e[0];let o=t.parse(e[1],1,Ze);if(!o)return null;if(!yi(i,o.type))return t.concat(1).error(`"${i}" comparisons are not supported for type '${Qe(o.type)}'.`);let a=t.parse(e[2],2,Ze);if(!a)return null;if(!yi(i,a.type))return t.concat(2).error(`"${i}" comparisons are not supported for type '${Qe(a.type)}'.`);if(o.type.kind!==a.type.kind&&"value"!==o.type.kind&&"value"!==a.type.kind)return t.error(`Cannot compare types '${Qe(o.type)}' and '${Qe(a.type)}'.`);n&&("value"===o.type.kind&&"value"!==a.type.kind?o=new Wt(a.type,[o]):"value"!==o.type.kind&&"value"===a.type.kind&&(a=new Wt(o.type,[a])));let s=null;if(4===e.length){if("string"!==o.type.kind&&"string"!==a.type.kind&&"value"!==o.type.kind&&"value"!==a.type.kind)return t.error("Cannot use collator to compare non-string types.");if(s=t.parse(e[3],3,Ge),!s)return null}return new r(o,a,s)}evaluate(r){const o=this.lhs.evaluate(r),a=this.rhs.evaluate(r);if(n&&this.hasUntypedArgument){const t=Zt(o),i=Zt(a);if(t.kind!==i.kind||"string"!==t.kind&&"number"!==t.kind)throw new Ft(`Expected arguments for "${e}" to be (string, string) or (number, number), but found (${t.kind}, ${i.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){const e=Zt(o),i=Zt(a);if("string"!==e.kind||"string"!==i.kind)return t(r,o,a)}return this.collator?i(r,o,a,this.collator.evaluate(r)):t(r,o,a)}eachChild(e){e(this.lhs),e(this.rhs),this.collator&&e(this.collator)}outputDefined(){return!0}}}const bi=xi("==",function(e,t,i){return t===i},vi),wi=xi("!=",function(e,t,i){return t!==i},function(e,t,i,n){return!vi(0,t,i,n)}),Ti=xi("<",function(e,t,i){return t<i},function(e,t,i,n){return n.compare(t,i)<0}),Si=xi(">",function(e,t,i){return t>i},function(e,t,i,n){return n.compare(t,i)>0}),Pi=xi("<=",function(e,t,i){return t<=i},function(e,t,i,n){return n.compare(t,i)<=0}),Mi=xi(">=",function(e,t,i){return t>=i},function(e,t,i,n){return n.compare(t,i)>=0});class Ei{constructor(e,t,i){this.type=Ge,this.locale=i,this.caseSensitive=e,this.diacriticSensitive=t}static parse(e,t){if(2!==e.length)return t.error("Expected one argument.");const i=e[1];if("object"!=typeof i||Array.isArray(i))return t.error("Collator options argument must be an object.");const n=t.parse(void 0!==i["case-sensitive"]&&i["case-sensitive"],1,Ne);if(!n)return null;const r=t.parse(void 0!==i["diacritic-sensitive"]&&i["diacritic-sensitive"],1,Ne);if(!r)return null;let o=null;return i.locale&&(o=t.parse(i.locale,1,Oe),!o)?null:new Ei(n,r,o)}evaluate(e){return new kt(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}}class Ci{constructor(e,t,i,n,r){this.type=Oe,this.number=e,this.locale=t,this.currency=i,this.minFractionDigits=n,this.maxFractionDigits=r}static parse(e,t){if(3!==e.length)return t.error("Expected two arguments.");const i=t.parse(e[1],1,Be);if(!i)return null;const n=e[2];if("object"!=typeof n||Array.isArray(n))return t.error("NumberFormat options argument must be an object.");let r=null;if(n.locale&&(r=t.parse(n.locale,1,Oe),!r))return null;let o=null;if(n.currency&&(o=t.parse(n.currency,1,Oe),!o))return null;let a=null;if(n["min-fraction-digits"]&&(a=t.parse(n["min-fraction-digits"],1,Be),!a))return null;let s=null;return n["max-fraction-digits"]&&(s=t.parse(n["max-fraction-digits"],1,Be),!s)?null:new Ci(i,r,o,a,s)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class ki{constructor(e){this.type=qe,this.sections=e}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const i=e[1];if(!Array.isArray(i)&&"object"==typeof i)return t.error("First argument must be an image or text section.");const n=[];let r=!1;for(let o=1;o<=e.length-1;++o){const i=e[o];if(r&&"object"==typeof i&&!Array.isArray(i)){r=!1;let e=null;if(i["font-scale"]&&(e=t.parse(i["font-scale"],1,Be),!e))return null;let o=null;if(i["text-font"]&&(o=t.parse(i["text-font"],1,Ke(Oe)),!o))return null;let a=null;if(i["text-color"]&&(a=t.parse(i["text-color"],1,je),!a))return null;let s=null;if(i["vertical-align"]){if("string"==typeof i["vertical-align"]&&!It.includes(i["vertical-align"]))return t.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${i["vertical-align"]}' instead.`);if(s=t.parse(i["vertical-align"],1,Oe),!s)return null}const l=n[n.length-1];l.scale=e,l.font=o,l.textColor=a,l.verticalAlign=s}else{const i=t.parse(e[o],1,Ze);if(!i)return null;const a=i.type.kind;if("string"!==a&&"value"!==a&&"null"!==a&&"resolvedImage"!==a)return t.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");r=!0,n.push({content:i,scale:null,font:null,textColor:null,verticalAlign:null})}}return new ki(n)}evaluate(e){return new At(this.sections.map(t=>{const i=t.content.evaluate(e);return Zt(i)===Xe?new zt("",i,null,null,null,t.verticalAlign?t.verticalAlign.evaluate(e):null):new zt(Gt(i),null,t.scale?t.scale.evaluate(e):null,t.font?t.font.evaluate(e).join(","):null,t.textColor?t.textColor.evaluate(e):null,t.verticalAlign?t.verticalAlign.evaluate(e):null)}))}eachChild(e){for(const t of this.sections)e(t.content),t.scale&&e(t.scale),t.font&&e(t.font),t.textColor&&e(t.textColor),t.verticalAlign&&e(t.verticalAlign)}outputDefined(){return!1}}class Ii{constructor(e){this.type=Xe,this.input=e}static parse(e,t){if(2!==e.length)return t.error("Expected two arguments.");const i=t.parse(e[1],1,Oe);return i?new Ii(i):t.error("No image name provided.")}evaluate(e){const t=this.input.evaluate(e),i=Nt.fromString(t);return i&&e.availableImages&&(i.available=e.availableImages.indexOf(t)>-1),i}eachChild(e){e(this.input)}outputDefined(){return!1}}class zi{constructor(e){this.type=Be,this.input=e}static parse(e,t){if(2!==e.length)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);const i=t.parse(e[1],1);return i?"array"!==i.type.kind&&"string"!==i.type.kind&&"value"!==i.type.kind?t.error(`Expected argument of type string or array, but found ${Qe(i.type)} instead.`):new zi(i):null}evaluate(e){const t=this.input.evaluate(e);if("string"==typeof t)return[...t].length;if(Array.isArray(t))return t.length;throw new Ft(`Expected value to be of type string or array, but found ${Qe(Zt(t))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const Ai=8192;function Li(e,t){const i=(180+e[0])/360,n=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e[1]*Math.PI/360)))/360,r=Math.pow(2,t.z);return[Math.round(i*r*Ai),Math.round(n*r*Ai)]}function Di(e,t){const i=Math.pow(2,t.z);return[(r=(e[0]/Ai+t.x)/i,360*r-180),(n=(e[1]/Ai+t.y)/i,360/Math.PI*Math.atan(Math.exp((180-360*n)*Math.PI/180))-90)];var n,r}function Ri(e,t){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[0]),e[3]=Math.max(e[3],t[1])}function Fi(e,t){return!(e[0]<=t[0]||e[2]>=t[2]||e[1]<=t[1]||e[3]>=t[3])}function Bi(e,t,i){const n=e[0]-t[0],r=e[1]-t[1],o=e[0]-i[0],a=e[1]-i[1];return n*a-o*r==0&&n*o<=0&&r*a<=0}function Oi(e,t,i,n){return 0!=(r=[n[0]-i[0],n[1]-i[1]])[0]*(o=[t[0]-e[0],t[1]-e[1]])[1]-r[1]*o[0]&&!(!Gi(e,t,i,n)||!Gi(i,n,e,t));var r,o}function Ni(e,t,i){for(const n of i)for(let i=0;i<n.length-1;++i)if(Oi(e,t,n[i],n[i+1]))return!0;return!1}function ji(e,t,i=!1){let n=!1;for(const s of t)for(let t=0;t<s.length-1;t++){if(Bi(e,s[t],s[t+1]))return i;(o=s[t])[1]>(r=e)[1]!=(a=s[t+1])[1]>r[1]&&r[0]<(a[0]-o[0])*(r[1]-o[1])/(a[1]-o[1])+o[0]&&(n=!n)}var r,o,a;return n}function Vi(e,t){for(const i of t)if(ji(e,i))return!0;return!1}function Ui(e,t){for(const i of e)if(!ji(i,t))return!1;for(let i=0;i<e.length-1;++i)if(Ni(e[i],e[i+1],t))return!1;return!0}function Zi(e,t){for(const i of t)if(Ui(e,i))return!0;return!1}function Gi(e,t,i,n){const r=n[0]-i[0],o=n[1]-i[1],a=(e[0]-i[0])*o-r*(e[1]-i[1]),s=(t[0]-i[0])*o-r*(t[1]-i[1]);return a>0&&s<0||a<0&&s>0}function qi(e,t,i){const n=[];for(let r=0;r<e.length;r++){const o=[];for(let n=0;n<e[r].length;n++){const a=Li(e[r][n],i);Ri(t,a),o.push(a)}n.push(o)}return n}function $i(e,t,i){const n=[];for(let r=0;r<e.length;r++){const o=qi(e[r],t,i);n.push(o)}return n}function Wi(e,t,i,n){if(e[0]<i[0]||e[0]>i[2]){const t=.5*n;let r=e[0]-i[0]>t?-n:i[0]-e[0]>t?n:0;0===r&&(r=e[0]-i[2]>t?-n:i[2]-e[0]>t?n:0),e[0]+=r}Ri(t,e)}function Hi(e,t,i,n){const r=Math.pow(2,n.z)*Ai,o=[n.x*Ai,n.y*Ai],a=[];for(const s of e)for(const e of s){const n=[e.x+o[0],e.y+o[1]];Wi(n,t,i,r),a.push(n)}return a}function Xi(e,t,i,n){const r=Math.pow(2,n.z)*Ai,o=[n.x*Ai,n.y*Ai],a=[];for(const l of e){const e=[];for(const i of l){const n=[i.x+o[0],i.y+o[1]];Ri(t,n),e.push(n)}a.push(e)}if(t[2]-t[0]<=r/2){(s=t)[0]=s[1]=1/0,s[2]=s[3]=-1/0;for(const e of a)for(const n of e)Wi(n,t,i,r)}var s;return a}class Yi{constructor(e,t){this.type=Ne,this.geojson=e,this.geometries=t}static parse(e,t){if(2!==e.length)return t.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Ut(e[1])){const t=e[1];if("FeatureCollection"===t.type){const e=[];for(const i of t.features){const{type:t,coordinates:n}=i.geometry;"Polygon"===t&&e.push(n),"MultiPolygon"===t&&e.push(...n)}if(e.length)return new Yi(t,{type:"MultiPolygon",coordinates:e})}else if("Feature"===t.type){const e=t.geometry.type;if("Polygon"===e||"MultiPolygon"===e)return new Yi(t,t.geometry)}else if("Polygon"===t.type||"MultiPolygon"===t.type)return new Yi(t,t)}return t.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(null!=e.geometry()&&null!=e.canonicalID()){if("Point"===e.geometryType())return function(e,t){const i=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],r=e.canonicalID();if("Polygon"===t.type){const o=qi(t.coordinates,n,r),a=Hi(e.geometry(),i,n,r);if(!Fi(i,n))return!1;for(const e of a)if(!ji(e,o))return!1}if("MultiPolygon"===t.type){const o=$i(t.coordinates,n,r),a=Hi(e.geometry(),i,n,r);if(!Fi(i,n))return!1;for(const e of a)if(!Vi(e,o))return!1}return!0}(e,this.geometries);if("LineString"===e.geometryType())return function(e,t){const i=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],r=e.canonicalID();if("Polygon"===t.type){const o=qi(t.coordinates,n,r),a=Xi(e.geometry(),i,n,r);if(!Fi(i,n))return!1;for(const e of a)if(!Ui(e,o))return!1}if("MultiPolygon"===t.type){const o=$i(t.coordinates,n,r),a=Xi(e.geometry(),i,n,r);if(!Fi(i,n))return!1;for(const e of a)if(!Zi(e,o))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let Ki=class{constructor(e=[],t=(e,t)=>e<t?-1:e>t?1:0){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let i=(this.length>>1)-1;i>=0;i--)this._down(i)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(0===this.length)return;const e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:t,compare:i}=this,n=t[e];for(;e>0;){const r=e-1>>1,o=t[r];if(i(n,o)>=0)break;t[e]=o,e=r}t[e]=n}_down(e){const{data:t,compare:i}=this,n=this.length>>1,r=t[e];for(;e<n;){let n=1+(e<<1);const o=n+1;if(o<this.length&&i(t[o],t[n])<0&&(n=o),i(t[n],r)>=0)break;t[e]=t[n],e=n}t[e]=r}};function Qi(e,t,i=0,n=e.length-1,r=en){for(;n>i;){if(n-i>600){const o=n-i+1,a=t-i+1,s=Math.log(o),l=.5*Math.exp(2*s/3),c=.5*Math.sqrt(s*l*(o-l)/o)*(a-o/2<0?-1:1);Qi(e,t,Math.max(i,Math.floor(t-a*l/o+c)),Math.min(n,Math.floor(t+(o-a)*l/o+c)),r)}const o=e[t];let a=i,s=n;for(Ji(e,i,t),r(e[n],o)>0&&Ji(e,i,n);a<s;){for(Ji(e,a,s),a++,s--;r(e[a],o)<0;)a++;for(;r(e[s],o)>0;)s--}0===r(e[i],o)?Ji(e,i,s):(s++,Ji(e,s,n)),s<=t&&(i=s+1),t<=s&&(n=s-1)}}function Ji(e,t,i){const n=e[t];e[t]=e[i],e[i]=n}function en(e,t){return e<t?-1:e>t?1:0}function tn(e,t){if(e.length<=1)return[e];const i=[];let n,r;for(const o of e){const e=rn(o);0!==e&&(o.area=Math.abs(e),void 0===r&&(r=e<0),r===e<0?(n&&i.push(n),n=[o]):n.push(o))}if(n&&i.push(n),t>1)for(let o=0;o<i.length;o++)i[o].length<=t||(Qi(i[o],t,1,i[o].length-1,nn),i[o]=i[o].slice(0,t));return i}function nn(e,t){return t.area-e.area}function rn(e){let t=0;for(let i,n,r=0,o=e.length,a=o-1;r<o;a=r++)i=e[r],n=e[a],t+=(n.x-i.x)*(i.y+n.y);return t}const on=1/298.257223563,an=on*(2-on),sn=Math.PI/180;class ln{constructor(e){const t=6378.137*sn*1e3,i=Math.cos(e*sn),n=1/(1-an*(1-i*i)),r=Math.sqrt(n);this.kx=t*r*i,this.ky=t*r*n*(1-an)}distance(e,t){const i=this.wrap(e[0]-t[0])*this.kx,n=(e[1]-t[1])*this.ky;return Math.sqrt(i*i+n*n)}pointOnLine(e,t){let i,n,r,o,a=1/0;for(let s=0;s<e.length-1;s++){let l=e[s][0],c=e[s][1],u=this.wrap(e[s+1][0]-l)*this.kx,h=(e[s+1][1]-c)*this.ky,d=0;0===u&&0===h||(d=(this.wrap(t[0]-l)*this.kx*u+(t[1]-c)*this.ky*h)/(u*u+h*h),d>1?(l=e[s+1][0],c=e[s+1][1]):d>0&&(l+=u/this.kx*d,c+=h/this.ky*d)),u=this.wrap(t[0]-l)*this.kx,h=(t[1]-c)*this.ky;const p=u*u+h*h;p<a&&(a=p,i=l,n=c,r=s,o=d)}return{point:[i,n],index:r,t:Math.max(0,Math.min(1,o))}}wrap(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}}function cn(e,t){return t[0]-e[0]}function un(e){return e[1]-e[0]+1}function hn(e,t){return e[1]>=e[0]&&e[1]<t}function dn(e,t){if(e[0]>e[1])return[null,null];const i=un(e);if(t){if(2===i)return[e,null];const t=Math.floor(i/2);return[[e[0],e[0]+t],[e[0]+t,e[1]]]}if(1===i)return[e,null];const n=Math.floor(i/2)-1;return[[e[0],e[0]+n],[e[0]+n+1,e[1]]]}function pn(e,t){if(!hn(t,e.length))return[1/0,1/0,-1/0,-1/0];const i=[1/0,1/0,-1/0,-1/0];for(let n=t[0];n<=t[1];++n)Ri(i,e[n]);return i}function fn(e){const t=[1/0,1/0,-1/0,-1/0];for(const i of e)for(const e of i)Ri(t,e);return t}function mn(e){return e[0]!==-1/0&&e[1]!==-1/0&&e[2]!==1/0&&e[3]!==1/0}function gn(e,t,i){if(!mn(e)||!mn(t))return NaN;let n=0,r=0;return e[2]<t[0]&&(n=t[0]-e[2]),e[0]>t[2]&&(n=e[0]-t[2]),e[1]>t[3]&&(r=e[1]-t[3]),e[3]<t[1]&&(r=t[1]-e[3]),i.distance([0,0],[n,r])}function _n(e,t,i){const n=i.pointOnLine(t,e);return i.distance(e,n.point)}function yn(e,t,i,n,r){const o=Math.min(_n(e,[i,n],r),_n(t,[i,n],r)),a=Math.min(_n(i,[e,t],r),_n(n,[e,t],r));return Math.min(o,a)}function vn(e,t,i,n,r){if(!hn(t,e.length)||!hn(n,i.length))return 1/0;let o=1/0;for(let a=t[0];a<t[1];++a){const t=e[a],s=e[a+1];for(let e=n[0];e<n[1];++e){const n=i[e],a=i[e+1];if(Oi(t,s,n,a))return 0;o=Math.min(o,yn(t,s,n,a,r))}}return o}function xn(e,t,i,n,r){if(!hn(t,e.length)||!hn(n,i.length))return NaN;let o=1/0;for(let a=t[0];a<=t[1];++a)for(let t=n[0];t<=n[1];++t)if(o=Math.min(o,r.distance(e[a],i[t])),0===o)return o;return o}function bn(e,t,i){if(ji(e,t,!0))return 0;let n=1/0;for(const r of t){const t=r[0],o=r[r.length-1];if(t!==o&&(n=Math.min(n,_n(e,[o,t],i)),0===n))return n;const a=i.pointOnLine(r,e);if(n=Math.min(n,i.distance(e,a.point)),0===n)return n}return n}function wn(e,t,i,n){if(!hn(t,e.length))return NaN;for(let o=t[0];o<=t[1];++o)if(ji(e[o],i,!0))return 0;let r=1/0;for(let o=t[0];o<t[1];++o){const t=e[o],a=e[o+1];for(const e of i)for(let i=0,o=e.length,s=o-1;i<o;s=i++){const o=e[s],l=e[i];if(Oi(t,a,o,l))return 0;r=Math.min(r,yn(t,a,o,l,n))}}return r}function Tn(e,t){for(const i of e)for(const e of i)if(ji(e,t,!0))return!0;return!1}function Sn(e,t,i,n=1/0){const r=fn(e),o=fn(t);if(n!==1/0&&gn(r,o,i)>=n)return n;if(Fi(r,o)){if(Tn(e,t))return 0}else if(Tn(t,e))return 0;let a=1/0;for(const s of e)for(let e=0,n=s.length,r=n-1;e<n;r=e++){const n=s[r],o=s[e];for(const e of t)for(let t=0,r=e.length,s=r-1;t<r;s=t++){const r=e[s],l=e[t];if(Oi(n,o,r,l))return 0;a=Math.min(a,yn(n,o,r,l,i))}}return a}function Pn(e,t,i,n,r,o){if(!o)return;const a=gn(pn(n,o),r,i);a<t&&e.push([a,o,[0,0]])}function Mn(e,t,i,n,r,o,a){if(!o||!a)return;const s=gn(pn(n,o),pn(r,a),i);s<t&&e.push([s,o,a])}function En(e,t,i,n,r=1/0){let o=Math.min(n.distance(e[0],i[0][0]),r);if(0===o)return o;const a=new Ki([[0,[0,e.length-1],[0,0]]],cn),s=fn(i);for(;a.length>0;){const r=a.pop();if(r[0]>=o)continue;const l=r[1],c=t?50:100;if(un(l)<=c){if(!hn(l,e.length))return NaN;if(t){const t=wn(e,l,i,n);if(isNaN(t)||0===t)return t;o=Math.min(o,t)}else for(let t=l[0];t<=l[1];++t){const r=bn(e[t],i,n);if(o=Math.min(o,r),0===o)return 0}}else{const i=dn(l,t);Pn(a,o,n,e,s,i[0]),Pn(a,o,n,e,s,i[1])}}return o}function Cn(e,t,i,n,r,o=1/0){let a=Math.min(o,r.distance(e[0],i[0]));if(0===a)return a;const s=new Ki([[0,[0,e.length-1],[0,i.length-1]]],cn);for(;s.length>0;){const o=s.pop();if(o[0]>=a)continue;const l=o[1],c=o[2],u=t?50:100,h=n?50:100;if(un(l)<=u&&un(c)<=h){if(!hn(l,e.length)&&hn(c,i.length))return NaN;let o;if(t&&n)o=vn(e,l,i,c,r),a=Math.min(a,o);else if(t&&!n){const t=e.slice(l[0],l[1]+1);for(let e=c[0];e<=c[1];++e)if(o=_n(i[e],t,r),a=Math.min(a,o),0===a)return a}else if(!t&&n){const t=i.slice(c[0],c[1]+1);for(let i=l[0];i<=l[1];++i)if(o=_n(e[i],t,r),a=Math.min(a,o),0===a)return a}else o=xn(e,l,i,c,r),a=Math.min(a,o)}else{const o=dn(l,t),u=dn(c,n);Mn(s,a,r,e,i,o[0],u[0]),Mn(s,a,r,e,i,o[0],u[1]),Mn(s,a,r,e,i,o[1],u[0]),Mn(s,a,r,e,i,o[1],u[1])}}return a}function kn(e){return"MultiPolygon"===e.type?e.coordinates.map(e=>({type:"Polygon",coordinates:e})):"MultiLineString"===e.type?e.coordinates.map(e=>({type:"LineString",coordinates:e})):"MultiPoint"===e.type?e.coordinates.map(e=>({type:"Point",coordinates:e})):[e]}class In{constructor(e,t){this.type=Be,this.geojson=e,this.geometries=t}static parse(e,t){if(2!==e.length)return t.error(`'distance' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Ut(e[1])){const t=e[1];if("FeatureCollection"===t.type)return new In(t,t.features.map(e=>kn(e.geometry)).flat());if("Feature"===t.type)return new In(t,kn(t.geometry));if("type"in t&&"coordinates"in t)return new In(t,kn(t))}return t.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(null!=e.geometry()&&null!=e.canonicalID()){if("Point"===e.geometryType())return function(e,t){const i=e.geometry(),n=i.flat().map(t=>Di([t.x,t.y],e.canonical));if(0===i.length)return NaN;const r=new ln(n[0][1]);let o=1/0;for(const a of t){switch(a.type){case"Point":o=Math.min(o,Cn(n,!1,[a.coordinates],!1,r,o));break;case"LineString":o=Math.min(o,Cn(n,!1,a.coordinates,!0,r,o));break;case"Polygon":o=Math.min(o,En(n,!1,a.coordinates,r,o))}if(0===o)return o}return o}(e,this.geometries);if("LineString"===e.geometryType())return function(e,t){const i=e.geometry(),n=i.flat().map(t=>Di([t.x,t.y],e.canonical));if(0===i.length)return NaN;const r=new ln(n[0][1]);let o=1/0;for(const a of t){switch(a.type){case"Point":o=Math.min(o,Cn(n,!0,[a.coordinates],!1,r,o));break;case"LineString":o=Math.min(o,Cn(n,!0,a.coordinates,!0,r,o));break;case"Polygon":o=Math.min(o,En(n,!0,a.coordinates,r,o))}if(0===o)return o}return o}(e,this.geometries);if("Polygon"===e.geometryType())return function(e,t){const i=e.geometry();if(0===i.length||0===i[0].length)return NaN;const n=tn(i,0).map(t=>t.map(t=>t.map(t=>Di([t.x,t.y],e.canonical)))),r=new ln(n[0][0][0][1]);let o=1/0;for(const a of t)for(const e of n){switch(a.type){case"Point":o=Math.min(o,En([a.coordinates],!1,e,r,o));break;case"LineString":o=Math.min(o,En(a.coordinates,!0,e,r,o));break;case"Polygon":o=Math.min(o,Sn(e,a.coordinates,r,o))}if(0===o)return o}return o}(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class zn{constructor(e){this.type=Ze,this.key=e}static parse(e,t){if(2!==e.length)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);const i=e[1];return null==i?t.error("Global state property must be defined."):"string"!=typeof i?t.error(`Global state property must be string, but found ${typeof e[1]} instead.`):new zn(i)}evaluate(e){var t;const i=null===(t=e.globals)||void 0===t?void 0:t.globalState;return i&&0!==Object.keys(i).length?xt(i,this.key):null}eachChild(){}outputDefined(){return!1}}const An={"==":bi,"!=":wi,">":Si,"<":Ti,">=":Mi,"<=":Pi,array:Wt,at:ti,boolean:Wt,case:oi,coalesce:_i,collator:Ei,format:ki,image:Ii,in:ii,"index-of":ni,interpolate:fi,"interpolate-hcl":fi,"interpolate-lab":fi,length:zi,let:Jt,literal:qt,match:ri,number:Wt,"number-format":Ci,object:Wt,slice:ai,step:li,string:Wt,"to-boolean":Xt,"to-color":Xt,"to-number":Xt,"to-string":Xt,var:ei,within:Yi,distance:In,"global-state":zn};class Ln{constructor(e,t,i,n){this.name=e,this.type=t,this._evaluate=i,this.args=n}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,t){const i=e[0],n=Ln.definitions[i];if(!n)return t.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0);const r=Array.isArray(n)?n[0]:n.type,o=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,a=o.filter(([t])=>!Array.isArray(t)||t.length===e.length-1);let s=null;for(const[l,c]of a){s=new Qt(t.registry,On,t.path,null,t.scope);const n=[];let o=!1;for(let t=1;t<e.length;t++){const i=e[t],r=Array.isArray(l)?l[t-1]:l.type,a=s.parse(i,1+n.length,r);if(!a){o=!0;break}n.push(a)}if(!o)if(Array.isArray(l)&&l.length!==n.length)s.error(`Expected ${l.length} arguments, but found ${n.length} instead.`);else{for(let e=0;e<n.length;e++){const t=Array.isArray(l)?l[e]:l.type,i=n[e];s.concat(e+1).checkSubtype(t,i.type)}if(0===s.errors.length)return new Ln(i,r,c,n)}}if(1===a.length)t.errors.push(...s.errors);else{const i=(a.length?a:o).map(([e])=>{return t=e,Array.isArray(t)?`(${t.map(Qe).join(", ")})`:`(${Qe(t.type)}...)`;var t}).join(" | "),n=[];for(let r=1;r<e.length;r++){const i=t.parse(e[r],1+n.length);if(!i)return null;n.push(Qe(i.type))}t.error(`Expected arguments of type ${i}, but found (${n.join(", ")}) instead.`)}return null}static register(e,t){Ln.definitions=t;for(const i in t)e[i]=Ln}}function Dn(e,[t,i,n,r]){t=t.evaluate(e),i=i.evaluate(e),n=n.evaluate(e);const o=r?r.evaluate(e):1,a=Vt(t,i,n,o);if(a)throw new Ft(a);return new Ct(t/255,i/255,n/255,o,!1)}function Rn(e,t){return e in t}function Fn(e,t){const i=t[e];return void 0===i?null:i}function Bn(e){return{type:e}}function On(e){if(e instanceof ei)return On(e.boundExpression);if(e instanceof Ln&&"error"===e.name)return!1;if(e instanceof Ei)return!1;if(e instanceof Yi)return!1;if(e instanceof In)return!1;if(e instanceof zn)return!1;const t=e instanceof Xt||e instanceof Wt;let i=!0;return e.eachChild(e=>{i=t?i&&On(e):i&&e instanceof qt}),!!i&&Nn(e)&&Vn(e,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"])}function Nn(e){if(e instanceof Ln){if("get"===e.name&&1===e.args.length)return!1;if("feature-state"===e.name)return!1;if("has"===e.name&&1===e.args.length)return!1;if("properties"===e.name||"geometry-type"===e.name||"id"===e.name)return!1;if(/^filter-/.test(e.name))return!1}if(e instanceof Yi)return!1;if(e instanceof In)return!1;let t=!0;return e.eachChild(e=>{t&&!Nn(e)&&(t=!1)}),t}function jn(e){if(e instanceof Ln&&"feature-state"===e.name)return!1;let t=!0;return e.eachChild(e=>{t&&!jn(e)&&(t=!1)}),t}function Vn(e,t){if(e instanceof Ln&&t.indexOf(e.name)>=0)return!1;let i=!0;return e.eachChild(e=>{i&&!Vn(e,t)&&(i=!1)}),i}function Un(e){return{result:"success",value:e}}function Zn(e){return{result:"error",value:e}}function Gn(e){return"data-driven"===e["property-type"]||"cross-faded-data-driven"===e["property-type"]}function qn(e){return!!e.expression&&e.expression.parameters.indexOf("zoom")>-1}function $n(e){return!!e.expression&&e.expression.interpolated}function Wn(e){return e instanceof Number?"number":e instanceof String?"string":e instanceof Boolean?"boolean":Array.isArray(e)?"array":null===e?"null":typeof e}function Hn(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)&&Zt(e)===Ue}function Xn(e){return e}function Yn(e,t){const i=e.stops&&"object"==typeof e.stops[0][0],n=i||!(i||void 0!==e.property),r=e.type||($n(t)?"exponential":"interval"),o=function(e){switch(e.type){case"color":return Ct.parse;case"padding":return Lt.parse;case"numberArray":return Dt.parse;case"colorArray":return Rt.parse;default:return null}}(t);if(o&&((e=Le({},e)).stops&&(e.stops=e.stops.map(e=>[e[0],o(e[1])])),e.default=o(e.default?e.default:t.default)),e.colorSpace&&"rgb"!==(a=e.colorSpace)&&"hcl"!==a&&"lab"!==a)throw new Error(`Unknown color space: "${e.colorSpace}"`);var a;const s=function(e){switch(e){case"exponential":return er;case"interval":return Jn;case"categorical":return Qn;case"identity":return tr;default:throw new Error(`Unknown function type "${e}"`)}}(r);let l,c;if("categorical"===r){l=Object.create(null);for(const t of e.stops)l[t[0]]=t[1];c=typeof e.stops[0][0]}if(i){const i={},n=[];for(let t=0;t<e.stops.length;t++){const r=e.stops[t],o=r[0].zoom;void 0===i[o]&&(i[o]={zoom:o,type:e.type,property:e.property,default:e.default,stops:[]},n.push(o)),i[o].stops.push([r[0].value,r[1]])}const r=[];for(const e of n)r.push([i[e].zoom,Yn(i[e],t)]);const o={name:"linear"};return{kind:"composite",interpolationType:o,interpolationFactor:fi.interpolationFactor.bind(void 0,o),zoomStops:r.map(e=>e[0]),evaluate:({zoom:i},n)=>er({stops:r,base:e.base},t,i).evaluate(i,n)}}if(n){const i="exponential"===r?{name:"exponential",base:void 0!==e.base?e.base:1}:null;return{kind:"camera",interpolationType:i,interpolationFactor:fi.interpolationFactor.bind(void 0,i),zoomStops:e.stops.map(e=>e[0]),evaluate:({zoom:i})=>s(e,t,i,l,c)}}return{kind:"source",evaluate(i,n){const r=n&&n.properties?n.properties[e.property]:void 0;return void 0===r?Kn(e.default,t.default):s(e,t,r,l,c)}}}function Kn(e,t,i){return void 0!==e?e:void 0!==t?t:void 0!==i?i:void 0}function Qn(e,t,i,n,r){return Kn(typeof i===r?n[i]:void 0,e.default,t.default)}function Jn(e,t,i){if("number"!==Wn(i))return Kn(e.default,t.default);const n=e.stops.length;if(1===n)return e.stops[0][1];if(i<=e.stops[0][0])return e.stops[0][1];if(i>=e.stops[n-1][0])return e.stops[n-1][1];const r=si(e.stops.map(e=>e[0]),i);return e.stops[r][1]}function er(e,t,i){const n=void 0!==e.base?e.base:1;if("number"!==Wn(i))return Kn(e.default,t.default);const r=e.stops.length;if(1===r)return e.stops[0][1];if(i<=e.stops[0][0])return e.stops[0][1];if(i>=e.stops[r-1][0])return e.stops[r-1][1];const o=si(e.stops.map(e=>e[0]),i),a=function(e,t,i,n){const r=n-i,o=e-i;return 0===r?0:1===t?o/r:(Math.pow(t,o)-1)/(Math.pow(t,r)-1)}(i,n,e.stops[o][0],e.stops[o+1][0]),s=e.stops[o][1],l=e.stops[o+1][1],c=gi[t.type]||Xn;return"function"==typeof s.evaluate?{evaluate(...t){const i=s.evaluate.apply(void 0,t),n=l.evaluate.apply(void 0,t);if(void 0!==i&&void 0!==n)return c(i,n,a,e.colorSpace)}}:c(s,l,a,e.colorSpace)}function tr(e,t,i){switch(t.type){case"color":i=Ct.parse(i);break;case"formatted":i=At.fromString(i.toString());break;case"resolvedImage":i=Nt.fromString(i.toString());break;case"padding":i=Lt.parse(i);break;case"colorArray":i=Rt.parse(i);break;case"numberArray":i=Dt.parse(i);break;default:Wn(i)===t.type||"enum"===t.type&&t.values[i]||(i=void 0)}return Kn(i,e.default,t.default)}Ln.register(An,{error:[{kind:"error"},[Oe],(e,[t])=>{throw new Ft(t.evaluate(e))}],typeof:[Oe,[Ze],(e,[t])=>Qe(Zt(t.evaluate(e)))],"to-rgba":[Ke(Be,4),[je],(e,[t])=>{const[i,n,r,o]=t.evaluate(e).rgb;return[255*i,255*n,255*r,o]}],rgb:[je,[Be,Be,Be],Dn],rgba:[je,[Be,Be,Be,Be],Dn],has:{type:Ne,overloads:[[[Oe],(e,[t])=>Rn(t.evaluate(e),e.properties())],[[Oe,Ue],(e,[t,i])=>Rn(t.evaluate(e),i.evaluate(e))]]},get:{type:Ze,overloads:[[[Oe],(e,[t])=>Fn(t.evaluate(e),e.properties())],[[Oe,Ue],(e,[t,i])=>Fn(t.evaluate(e),i.evaluate(e))]]},"feature-state":[Ze,[Oe],(e,[t])=>Fn(t.evaluate(e),e.featureState||{})],properties:[Ue,[],e=>e.properties()],"geometry-type":[Oe,[],e=>e.geometryType()],id:[Ze,[],e=>e.id()],zoom:[Be,[],e=>e.globals.zoom],"heatmap-density":[Be,[],e=>e.globals.heatmapDensity||0],elevation:[Be,[],e=>e.globals.elevation||0],"line-progress":[Be,[],e=>e.globals.lineProgress||0],accumulated:[Ze,[],e=>void 0===e.globals.accumulated?null:e.globals.accumulated],"+":[Be,Bn(Be),(e,t)=>{let i=0;for(const n of t)i+=n.evaluate(e);return i}],"*":[Be,Bn(Be),(e,t)=>{let i=1;for(const n of t)i*=n.evaluate(e);return i}],"-":{type:Be,overloads:[[[Be,Be],(e,[t,i])=>t.evaluate(e)-i.evaluate(e)],[[Be],(e,[t])=>-t.evaluate(e)]]},"/":[Be,[Be,Be],(e,[t,i])=>t.evaluate(e)/i.evaluate(e)],"%":[Be,[Be,Be],(e,[t,i])=>t.evaluate(e)%i.evaluate(e)],ln2:[Be,[],()=>Math.LN2],pi:[Be,[],()=>Math.PI],e:[Be,[],()=>Math.E],"^":[Be,[Be,Be],(e,[t,i])=>Math.pow(t.evaluate(e),i.evaluate(e))],sqrt:[Be,[Be],(e,[t])=>Math.sqrt(t.evaluate(e))],log10:[Be,[Be],(e,[t])=>Math.log(t.evaluate(e))/Math.LN10],ln:[Be,[Be],(e,[t])=>Math.log(t.evaluate(e))],log2:[Be,[Be],(e,[t])=>Math.log(t.evaluate(e))/Math.LN2],sin:[Be,[Be],(e,[t])=>Math.sin(t.evaluate(e))],cos:[Be,[Be],(e,[t])=>Math.cos(t.evaluate(e))],tan:[Be,[Be],(e,[t])=>Math.tan(t.evaluate(e))],asin:[Be,[Be],(e,[t])=>Math.asin(t.evaluate(e))],acos:[Be,[Be],(e,[t])=>Math.acos(t.evaluate(e))],atan:[Be,[Be],(e,[t])=>Math.atan(t.evaluate(e))],min:[Be,Bn(Be),(e,t)=>Math.min(...t.map(t=>t.evaluate(e)))],max:[Be,Bn(Be),(e,t)=>Math.max(...t.map(t=>t.evaluate(e)))],abs:[Be,[Be],(e,[t])=>Math.abs(t.evaluate(e))],round:[Be,[Be],(e,[t])=>{const i=t.evaluate(e);return i<0?-Math.round(-i):Math.round(i)}],floor:[Be,[Be],(e,[t])=>Math.floor(t.evaluate(e))],ceil:[Be,[Be],(e,[t])=>Math.ceil(t.evaluate(e))],"filter-==":[Ne,[Oe,Ze],(e,[t,i])=>e.properties()[t.value]===i.value],"filter-id-==":[Ne,[Ze],(e,[t])=>e.id()===t.value],"filter-type-==":[Ne,[Oe],(e,[t])=>e.geometryType()===t.value],"filter-<":[Ne,[Oe,Ze],(e,[t,i])=>{const n=e.properties()[t.value],r=i.value;return typeof n==typeof r&&n<r}],"filter-id-<":[Ne,[Ze],(e,[t])=>{const i=e.id(),n=t.value;return typeof i==typeof n&&i<n}],"filter->":[Ne,[Oe,Ze],(e,[t,i])=>{const n=e.properties()[t.value],r=i.value;return typeof n==typeof r&&n>r}],"filter-id->":[Ne,[Ze],(e,[t])=>{const i=e.id(),n=t.value;return typeof i==typeof n&&i>n}],"filter-<=":[Ne,[Oe,Ze],(e,[t,i])=>{const n=e.properties()[t.value],r=i.value;return typeof n==typeof r&&n<=r}],"filter-id-<=":[Ne,[Ze],(e,[t])=>{const i=e.id(),n=t.value;return typeof i==typeof n&&i<=n}],"filter->=":[Ne,[Oe,Ze],(e,[t,i])=>{const n=e.properties()[t.value],r=i.value;return typeof n==typeof r&&n>=r}],"filter-id->=":[Ne,[Ze],(e,[t])=>{const i=e.id(),n=t.value;return typeof i==typeof n&&i>=n}],"filter-has":[Ne,[Ze],(e,[t])=>t.value in e.properties()],"filter-has-id":[Ne,[],e=>null!==e.id()&&void 0!==e.id()],"filter-type-in":[Ne,[Ke(Oe)],(e,[t])=>t.value.indexOf(e.geometryType())>=0],"filter-id-in":[Ne,[Ke(Ze)],(e,[t])=>t.value.indexOf(e.id())>=0],"filter-in-small":[Ne,[Oe,Ke(Ze)],(e,[t,i])=>i.value.indexOf(e.properties()[t.value])>=0],"filter-in-large":[Ne,[Oe,Ke(Ze)],(e,[t,i])=>function(e,t,i,n){for(;i<=n;){const r=i+n>>1;if(t[r]===e)return!0;t[r]>e?n=r-1:i=r+1}return!1}(e.properties()[t.value],i.value,0,i.value.length-1)],all:{type:Ne,overloads:[[[Ne,Ne],(e,[t,i])=>t.evaluate(e)&&i.evaluate(e)],[Bn(Ne),(e,t)=>{for(const i of t)if(!i.evaluate(e))return!1;return!0}]]},any:{type:Ne,overloads:[[[Ne,Ne],(e,[t,i])=>t.evaluate(e)||i.evaluate(e)],[Bn(Ne),(e,t)=>{for(const i of t)if(i.evaluate(e))return!0;return!1}]]},"!":[Ne,[Ne],(e,[t])=>!t.evaluate(e)],"is-supported-script":[Ne,[Oe],(e,[t])=>{const i=e.globals&&e.globals.isSupportedScript;return!i||i(t.evaluate(e))}],upcase:[Oe,[Oe],(e,[t])=>t.evaluate(e).toUpperCase()],downcase:[Oe,[Oe],(e,[t])=>t.evaluate(e).toLowerCase()],concat:[Oe,Bn(Ze),(e,t)=>t.map(t=>Gt(t.evaluate(e))).join("")],"resolved-locale":[Oe,[Ge],(e,[t])=>t.evaluate(e).resolvedLocale()]});class ir{constructor(e,t,i){this.expression=e,this._warningHistory={},this._evaluator=new Kt,this._defaultValue=t?function(e){if("color"===e.type&&Hn(e.default))return new Ct(0,0,0,0);switch(e.type){case"color":return Ct.parse(e.default)||null;case"padding":return Lt.parse(e.default)||null;case"numberArray":return Dt.parse(e.default)||null;case"colorArray":return Rt.parse(e.default)||null;case"variableAnchorOffsetCollection":return Ot.parse(e.default)||null;case"projectionDefinition":return jt.parse(e.default)||null;default:return void 0===e.default?null:e.default}}(t):null,this._enumValues=t&&"enum"===t.type?t.values:null,this._globalState=i}evaluateWithoutErrorHandling(e,t,i,n,r,o){return this._globalState&&(e=hr(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=i,this._evaluator.canonical=n,this._evaluator.availableImages=r||null,this._evaluator.formattedSection=o,this.expression.evaluate(this._evaluator)}evaluate(e,t,i,n,r,o){this._globalState&&(e=hr(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=i||null,this._evaluator.canonical=n,this._evaluator.availableImages=r||null,this._evaluator.formattedSection=o||null;try{const e=this.expression.evaluate(this._evaluator);if(null==e||"number"==typeof e&&e!=e)return this._defaultValue;if(this._enumValues&&!(e in this._enumValues))throw new Ft(`Expected value to be one of ${Object.keys(this._enumValues).map(e=>JSON.stringify(e)).join(", ")}, but found ${JSON.stringify(e)} instead.`);return e}catch(a){return this._warningHistory[a.message]||(this._warningHistory[a.message]=!0),this._defaultValue}}}function nr(e){return Array.isArray(e)&&e.length>0&&"string"==typeof e[0]&&e[0]in An}function rr(e,t,i){const n=new Qt(An,On,[],t?function(e){const t={color:je,string:Oe,number:Be,enum:Oe,boolean:Ne,formatted:qe,padding:$e,numberArray:He,colorArray:We,projectionDefinition:Ve,resolvedImage:Xe,variableAnchorOffsetCollection:Ye};return"array"===e.type?Ke(t[e.value]||Ze,e.length):t[e.type]}(t):void 0),r=n.parse(e,void 0,void 0,void 0,t&&"string"===t.type?{typeAnnotation:"coerce"}:void 0);return r?Un(new ir(r,t,i)):Zn(n.errors)}class or{constructor(e,t,i){this.kind=e,this._styleExpression=t,this.isStateDependent="constant"!==e&&!jn(t.expression),this.globalStateRefs=ur(t.expression),this._globalState=i}evaluateWithoutErrorHandling(e,t,i,n,r,o){return this._globalState&&(e=hr(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,t,i,n,r,o)}evaluate(e,t,i,n,r,o){return this._globalState&&(e=hr(e,this._globalState)),this._styleExpression.evaluate(e,t,i,n,r,o)}}class ar{constructor(e,t,i,n,r){this.kind=e,this.zoomStops=i,this._styleExpression=t,this.isStateDependent="camera"!==e&&!jn(t.expression),this.globalStateRefs=ur(t.expression),this.interpolationType=n,this._globalState=r}evaluateWithoutErrorHandling(e,t,i,n,r,o){return this._globalState&&(e=hr(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,t,i,n,r,o)}evaluate(e,t,i,n,r,o){return this._globalState&&(e=hr(e,this._globalState)),this._styleExpression.evaluate(e,t,i,n,r,o)}interpolationFactor(e,t,i){return this.interpolationType?fi.interpolationFactor(this.interpolationType,e,t,i):0}}function sr(e,t,i){const n=rr(e,t,i);if("error"===n.result)return n;const r=n.value.expression,o=Nn(r);if(!o&&!Gn(t))return Zn([new De("","data expressions not supported")]);const a=Vn(r,["zoom"]);if(!a&&!qn(t))return Zn([new De("","zoom expressions not supported")]);const s=cr(r);return s||a?s instanceof De?Zn([s]):s instanceof fi&&!$n(t)?Zn([new De("",'"interpolate" expressions cannot be used with this property')]):Un(s?new ar(o?"camera":"composite",n.value,s.labels,s instanceof fi?s.interpolation:void 0,i):new or(o?"constant":"source",n.value,i)):Zn([new De("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class lr{constructor(e,t){this._parameters=e,this._specification=t,Le(this,Yn(this._parameters,this._specification))}static deserialize(e){return new lr(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function cr(e){let t=null;if(e instanceof Jt)t=cr(e.result);else if(e instanceof _i){for(const i of e.args)if(t=cr(i),t)break}else(e instanceof li||e instanceof fi)&&e.input instanceof Ln&&"zoom"===e.input.name&&(t=e);return t instanceof De||e.eachChild(e=>{const i=cr(e);i instanceof De?t=i:!t&&i?t=new De("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&i&&t!==i&&(t=new De("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),t}function ur(e,t=new Set){return e instanceof zn&&t.add(e.key),e.eachChild(e=>{ur(e,t)}),t}function hr(e,t){const{zoom:i,heatmapDensity:n,elevation:r,lineProgress:o,isSupportedScript:a,accumulated:s}=null!=e?e:{};return{zoom:i,heatmapDensity:n,elevation:r,lineProgress:o,isSupportedScript:a,accumulated:s,globalState:t}}function dr(e){if(!0===e||!1===e)return!0;if(!Array.isArray(e)||0===e.length)return!1;switch(e[0]){case"has":return e.length>=2&&"$id"!==e[1]&&"$type"!==e[1];case"in":return e.length>=3&&("string"!=typeof e[1]||Array.isArray(e[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==e.length||Array.isArray(e[1])||Array.isArray(e[2]);case"any":case"all":for(const t of e.slice(1))if(!dr(t)&&"boolean"!=typeof t)return!1;return!0;default:return!0}}const pr={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function fr(e,t){if(null==e)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};dr(e)||(e=_r(e));const i=rr(e,pr,t);if("error"===i.result)throw new Error(i.value.map(e=>`${e.key}: ${e.message}`).join(", "));return{filter:(e,t,n)=>i.value.evaluate(e,t,{},n),needGeometry:gr(e),getGlobalStateRefs:()=>ur(i.value.expression)}}function mr(e,t){return e<t?-1:e>t?1:0}function gr(e){if(!Array.isArray(e))return!1;if("within"===e[0]||"distance"===e[0])return!0;for(let t=1;t<e.length;t++)if(gr(e[t]))return!0;return!1}function _r(e){if(!e)return!0;const t=e[0];return e.length<=1?"any"!==t:"=="===t?yr(e[1],e[2],"=="):"!="===t?br(yr(e[1],e[2],"==")):"<"===t||">"===t||"<="===t||">="===t?yr(e[1],e[2],t):"any"===t?(i=e.slice(1),["any"].concat(i.map(_r))):"all"===t?["all"].concat(e.slice(1).map(_r)):"none"===t?["all"].concat(e.slice(1).map(_r).map(br)):"in"===t?vr(e[1],e.slice(2)):"!in"===t?br(vr(e[1],e.slice(2))):"has"===t?xr(e[1]):"!has"!==t||br(xr(e[1]));var i}function yr(e,t,i){switch(e){case"$type":return[`filter-type-${i}`,t];case"$id":return[`filter-id-${i}`,t];default:return[`filter-${i}`,e,t]}}function vr(e,t){if(0===t.length)return!1;switch(e){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some(e=>typeof e!=typeof t[0])?["filter-in-large",e,["literal",t.sort(mr)]]:["filter-in-small",e,["literal",t]]}}function xr(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function br(e){return["!",e]}function wr(e){const t=typeof e;if("number"===t||"boolean"===t||"string"===t||null==e)return JSON.stringify(e);if(Array.isArray(e)){let t="[";for(const i of e)t+=`${wr(i)},`;return`${t}]`}const i=Object.keys(e).sort();let n="{";for(let r=0;r<i.length;r++)n+=`${JSON.stringify(i[r])}:${wr(e[i[r]])},`;return`${n}}`}function Tr(e){let t="";for(const i of be)t+=`/${wr(e[i])}`;return t}function Sr(e){const t=e.value;return t?[new Ae(e.key,t,"constants have been deprecated as of v8")]:[]}function Pr(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function Mr(e){if(Array.isArray(e))return e.map(Mr);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){const t={};for(const i in e)t[i]=Mr(e[i]);return t}return Pr(e)}function Er(e){const t=e.key,i=e.value,n=e.valueSpec||{},r=e.objectElementValidators||{},o=e.style,a=e.styleSpec,s=e.validateSpec;let l=[];const c=Wn(i);if("object"!==c)return[new Ae(t,i,`object expected, ${c} found`)];for(const u in i){const e=u.split(".")[0],c=xt(n,e)||n["*"];let h;if(xt(r,e))h=r[e];else if(xt(n,e)){if(void 0===i[u])continue;h=s}else if(r["*"])h=r["*"];else{if(!n["*"]){l.push(new Ae(t,i[u],`unknown property "${u}"`));continue}h=s}l=l.concat(h({key:(t?`${t}.`:t)+u,value:i[u],valueSpec:c,style:o,styleSpec:a,object:i,objectKey:u,validateSpec:s},i))}for(const u in n)r[u]||n[u].required&&void 0===n[u].default&&void 0===i[u]&&l.push(new Ae(t,i,`missing required property "${u}"`));return l}function Cr(e){const t=e.value,i=e.valueSpec,n=e.style,r=e.styleSpec,o=e.key,a=e.arrayElementValidator||e.validateSpec;if("array"!==Wn(t))return[new Ae(o,t,`array expected, ${Wn(t)} found`)];if(i.length&&t.length!==i.length)return[new Ae(o,t,`array length ${i.length} expected, length ${t.length} found`)];let s={type:i.value,values:i.values};r.$version<7&&(s.function=i.function),"object"===Wn(i.value)&&(s=i.value);let l=[];for(let c=0;c<t.length;c++)l=l.concat(a({array:t,arrayIndex:c,value:t[c],valueSpec:s,validateSpec:e.validateSpec,style:n,styleSpec:r,key:`${o}[${c}]`}));return l}function kr(e){const t=e.key,i=e.value,n=e.valueSpec;let r=Wn(i);return"number"===r&&i!=i&&(r="NaN"),"number"!==r?[new Ae(t,i,`number expected, ${r} found`)]:"minimum"in n&&i<n.minimum?[new Ae(t,i,`${i} is less than the minimum value ${n.minimum}`)]:"maximum"in n&&i>n.maximum?[new Ae(t,i,`${i} is greater than the maximum value ${n.maximum}`)]:[]}function Ir(e){const t=e.valueSpec,i=Pr(e.value.type);let n,r,o,a={};const s="categorical"!==i&&void 0===e.value.property,l=!s,c="array"===Wn(e.value.stops)&&"array"===Wn(e.value.stops[0])&&"object"===Wn(e.value.stops[0][0]),u=Er({key:e.key,value:e.value,valueSpec:e.styleSpec.function,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{stops:function(e){if("identity"===i)return[new Ae(e.key,e.value,'identity function may not have a "stops" property')];let t=[];const n=e.value;return t=t.concat(Cr({key:e.key,value:n,valueSpec:e.valueSpec,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,arrayElementValidator:h})),"array"===Wn(n)&&0===n.length&&t.push(new Ae(e.key,n,"array must have at least one stop")),t},default:function(e){return e.validateSpec({key:e.key,value:e.value,valueSpec:t,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec})}}});return"identity"===i&&s&&u.push(new Ae(e.key,e.value,'missing required property "property"')),"identity"===i||e.value.stops||u.push(new Ae(e.key,e.value,'missing required property "stops"')),"exponential"===i&&e.valueSpec.expression&&!$n(e.valueSpec)&&u.push(new Ae(e.key,e.value,"exponential functions not supported")),e.styleSpec.$version>=8&&(l&&!Gn(e.valueSpec)?u.push(new Ae(e.key,e.value,"property functions not supported")):s&&!qn(e.valueSpec)&&u.push(new Ae(e.key,e.value,"zoom functions not supported"))),"categorical"!==i&&!c||void 0!==e.value.property||u.push(new Ae(e.key,e.value,'"property" property is required')),u;function h(e){let i=[];const n=e.value,s=e.key;if("array"!==Wn(n))return[new Ae(s,n,`array expected, ${Wn(n)} found`)];if(2!==n.length)return[new Ae(s,n,`array length 2 expected, length ${n.length} found`)];if(c){if("object"!==Wn(n[0]))return[new Ae(s,n,`object expected, ${Wn(n[0])} found`)];if(void 0===n[0].zoom)return[new Ae(s,n,"object stop key must have zoom")];if(void 0===n[0].value)return[new Ae(s,n,"object stop key must have value")];if(o&&o>Pr(n[0].zoom))return[new Ae(s,n[0].zoom,"stop zoom values must appear in ascending order")];Pr(n[0].zoom)!==o&&(o=Pr(n[0].zoom),r=void 0,a={}),i=i.concat(Er({key:`${s}[0]`,value:n[0],valueSpec:{zoom:{}},validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{zoom:kr,value:d}}))}else i=i.concat(d({key:`${s}[0]`,value:n[0],validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec},n));return nr(Mr(n[1]))?i.concat([new Ae(`${s}[1]`,n[1],"expressions are not allowed in function stops.")]):i.concat(e.validateSpec({key:`${s}[1]`,value:n[1],valueSpec:t,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec}))}function d(e,o){const s=Wn(e.value),l=Pr(e.value),c=null!==e.value?e.value:o;if(n){if(s!==n)return[new Ae(e.key,c,`${s} stop domain type must match previous stop domain type ${n}`)]}else n=s;if("number"!==s&&"string"!==s&&"boolean"!==s)return[new Ae(e.key,c,"stop domain value must be a number, string, or boolean")];if("number"!==s&&"categorical"!==i){let n=`number expected, ${s} found`;return Gn(t)&&void 0===i&&(n+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Ae(e.key,c,n)]}return"categorical"!==i||"number"!==s||isFinite(l)&&Math.floor(l)===l?"categorical"!==i&&"number"===s&&void 0!==r&&l<r?[new Ae(e.key,c,"stop domain values must appear in ascending order")]:(r=l,"categorical"===i&&l in a?[new Ae(e.key,c,"stop domain values must be unique")]:(a[l]=!0,[])):[new Ae(e.key,c,`integer expected, found ${l}`)]}}function zr(e){const t=("property"===e.expressionContext?sr:rr)(Mr(e.value),e.valueSpec);if("error"===t.result)return t.value.map(t=>new Ae(`${e.key}${t.key}`,e.value,t.message));const i=t.value.expression||t.value._styleExpression.expression;if("property"===e.expressionContext&&"text-font"===e.propertyKey&&!i.outputDefined())return[new Ae(e.key,e.value,`Invalid data expression for "${e.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===e.expressionContext&&"layout"===e.propertyType&&!jn(i))return[new Ae(e.key,e.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===e.expressionContext&&!jn(i))return[new Ae(e.key,e.value,'"feature-state" data expressions are not supported with filters.')];if(e.expressionContext&&0===e.expressionContext.indexOf("cluster")){if(!Vn(i,["zoom","feature-state"]))return[new Ae(e.key,e.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===e.expressionContext&&!Nn(i))return[new Ae(e.key,e.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Ar(e){const t=e.key,i=e.value,n=Wn(i);return"string"!==n?[new Ae(t,i,`color expected, ${n} found`)]:Ct.parse(String(i))?[]:[new Ae(t,i,`color expected, "${i}" found`)]}function Lr(e){const t=e.key,i=e.value,n=e.valueSpec,r=[];return Array.isArray(n.values)?-1===n.values.indexOf(Pr(i))&&r.push(new Ae(t,i,`expected one of [${n.values.join(", ")}], ${JSON.stringify(i)} found`)):-1===Object.keys(n.values).indexOf(Pr(i))&&r.push(new Ae(t,i,`expected one of [${Object.keys(n.values).join(", ")}], ${JSON.stringify(i)} found`)),r}function Dr(e){return dr(Mr(e.value))?zr(Le({},e,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Rr(e)}function Rr(e){const t=e.value,i=e.key;if("array"!==Wn(t))return[new Ae(i,t,`array expected, ${Wn(t)} found`)];const n=e.styleSpec;let r,o=[];if(t.length<1)return[new Ae(i,t,"filter array must have at least 1 element")];switch(o=o.concat(Lr({key:`${i}[0]`,value:t[0],valueSpec:n.filter_operator,style:e.style,styleSpec:e.styleSpec})),Pr(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&"$type"===Pr(t[1])&&o.push(new Ae(i,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":3!==t.length&&o.push(new Ae(i,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(r=Wn(t[1]),"string"!==r&&o.push(new Ae(`${i}[1]`,t[1],`string expected, ${r} found`)));for(let a=2;a<t.length;a++)r=Wn(t[a]),"$type"===Pr(t[1])?o=o.concat(Lr({key:`${i}[${a}]`,value:t[a],valueSpec:n.geometry_type,style:e.style,styleSpec:e.styleSpec})):"string"!==r&&"number"!==r&&"boolean"!==r&&o.push(new Ae(`${i}[${a}]`,t[a],`string, number, or boolean expected, ${r} found`));break;case"any":case"all":case"none":for(let n=1;n<t.length;n++)o=o.concat(Rr({key:`${i}[${n}]`,value:t[n],style:e.style,styleSpec:e.styleSpec}));break;case"has":case"!has":r=Wn(t[1]),2!==t.length?o.push(new Ae(i,t,`filter array for "${t[0]}" operator must have 2 elements`)):"string"!==r&&o.push(new Ae(`${i}[1]`,t[1],`string expected, ${r} found`))}return o}function Fr(e,t){const i=e.key,n=e.validateSpec,r=e.style,o=e.styleSpec,a=e.value,s=e.objectKey,l=o[`${t}_${e.layerType}`];if(!l)return[];const c=s.match(/^(.*)-transition$/);if("paint"===t&&c&&l[c[1]]&&l[c[1]].transition)return n({key:i,value:a,valueSpec:o.transition,style:r,styleSpec:o});const u=e.valueSpec||l[s];if(!u)return[new Ae(i,a,`unknown property "${s}"`)];let h;if("string"===Wn(a)&&Gn(u)&&!u.tokens&&(h=/^{([^}]+)}$/.exec(a)))return[new Ae(i,a,`"${s}" does not support interpolation syntax\nUse an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(h[1])} }\`.`)];const d=[];return"symbol"===e.layerType&&"text-font"===s&&Hn(Mr(a))&&"identity"===Pr(a.type)&&d.push(new Ae(i,a,'"text-font" does not support identity functions')),d.concat(n({key:e.key,value:a,valueSpec:u,style:r,styleSpec:o,expressionContext:"property",propertyType:t,propertyKey:s}))}function Br(e){return Fr(e,"paint")}function Or(e){return Fr(e,"layout")}function Nr(e){let t=[];const i=e.value,n=e.key,r=e.style,o=e.styleSpec;if("object"!==Wn(i))return[new Ae(n,i,`object expected, ${Wn(i)} found`)];i.type||i.ref||t.push(new Ae(n,i,'either "type" or "ref" is required'));let a=Pr(i.type);const s=Pr(i.ref);if(i.id){const o=Pr(i.id);for(let a=0;a<e.arrayIndex;a++){const e=r.layers[a];Pr(e.id)===o&&t.push(new Ae(n,i.id,`duplicate layer id "${i.id}", previously used at line ${e.id.__line__}`))}}if("ref"in i){let e;["type","source","source-layer","filter","layout"].forEach(e=>{e in i&&t.push(new Ae(n,i[e],`"${e}" is prohibited for ref layers`))}),r.layers.forEach(t=>{Pr(t.id)===s&&(e=t)}),e?e.ref?t.push(new Ae(n,i.ref,"ref cannot reference another ref layer")):a=Pr(e.type):t.push(new Ae(n,i.ref,`ref layer "${s}" not found`))}else if("background"!==a)if(i.source){const e=r.sources&&r.sources[i.source],o=e&&Pr(e.type);e?"vector"===o&&"raster"===a?t.push(new Ae(n,i.source,`layer "${i.id}" requires a raster source`)):"raster-dem"!==o&&"hillshade"===a||"raster-dem"!==o&&"color-relief"===a?t.push(new Ae(n,i.source,`layer "${i.id}" requires a raster-dem source`)):"raster"===o&&"raster"!==a?t.push(new Ae(n,i.source,`layer "${i.id}" requires a vector source`)):"vector"!==o||i["source-layer"]?"raster-dem"===o&&"hillshade"!==a&&"color-relief"!==a?t.push(new Ae(n,i.source,"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")):"line"!==a||!i.paint||!i.paint["line-gradient"]||"geojson"===o&&e.lineMetrics||t.push(new Ae(n,i,`layer "${i.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new Ae(n,i,`layer "${i.id}" must specify a "source-layer"`)):t.push(new Ae(n,i.source,`source "${i.source}" not found`))}else t.push(new Ae(n,i,'missing required property "source"'));return t=t.concat(Er({key:n,value:i,valueSpec:o.layer,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":()=>[],type:()=>e.validateSpec({key:`${n}.type`,value:i.type,valueSpec:o.layer.type,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,object:i,objectKey:"type"}),filter:Dr,layout:e=>Er({layer:i,key:e.key,value:e.value,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":e=>Or(Le({layerType:a},e))}}),paint:e=>Er({layer:i,key:e.key,value:e.value,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":e=>Br(Le({layerType:a},e))}})}})),t}function jr(e){const t=e.value,i=e.key,n=Wn(t);return"string"!==n?[new Ae(i,t,`string expected, ${n} found`)]:[]}const Vr={promoteId:function({key:e,value:t}){if("string"===Wn(t))return jr({key:e,value:t});{const i=[];for(const n in t)i.push(...jr({key:`${e}.${n}`,value:t[n]}));return i}}};function Ur(e){const t=e.value,i=e.key,n=e.styleSpec,r=e.style,o=e.validateSpec;if(!t.type)return[new Ae(i,t,'"type" is required')];const a=Pr(t.type);let s;switch(a){case"vector":case"raster":return s=Er({key:i,value:t,valueSpec:n[`source_${a.replace("-","_")}`],style:e.style,styleSpec:n,objectElementValidators:Vr,validateSpec:o}),s;case"raster-dem":return s=function(e){var t;const i=null!==(t=e.sourceName)&&void 0!==t?t:"",n=e.value,r=e.styleSpec,o=r.source_raster_dem,a=e.style;let s=[];const l=Wn(n);if(void 0===n)return s;if("object"!==l)return s.push(new Ae("source_raster_dem",n,`object expected, ${l} found`)),s;const c="custom"===Pr(n.encoding),u=["redFactor","greenFactor","blueFactor","baseShift"],h=e.value.encoding?`"${e.value.encoding}"`:"Default";for(const d in n)!c&&u.includes(d)?s.push(new Ae(d,n[d],`In "${i}": "${d}" is only valid when "encoding" is set to "custom". ${h} encoding found`)):o[d]?s=s.concat(e.validateSpec({key:d,value:n[d],valueSpec:o[d],validateSpec:e.validateSpec,style:a,styleSpec:r})):s.push(new Ae(d,n[d],`unknown property "${d}"`));return s}({sourceName:i,value:t,style:e.style,styleSpec:n,validateSpec:o}),s;case"geojson":if(s=Er({key:i,value:t,valueSpec:n.source_geojson,style:r,styleSpec:n,validateSpec:o,objectElementValidators:Vr}),t.cluster)for(const e in t.clusterProperties){const[n,r]=t.clusterProperties[e],o="string"==typeof n?[n,["accumulated"],["get",e]]:n;s.push(...zr({key:`${i}.${e}.map`,value:r,expressionContext:"cluster-map"})),s.push(...zr({key:`${i}.${e}.reduce`,value:o,expressionContext:"cluster-reduce"}))}return s;case"video":return Er({key:i,value:t,valueSpec:n.source_video,style:r,validateSpec:o,styleSpec:n});case"image":return Er({key:i,value:t,valueSpec:n.source_image,style:r,validateSpec:o,styleSpec:n});case"canvas":return[new Ae(i,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Lr({key:`${i}.type`,value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function Zr(e){const t=e.value,i=e.styleSpec,n=i.light,r=e.style;let o=[];const a=Wn(t);if(void 0===t)return o;if("object"!==a)return o=o.concat([new Ae("light",t,`object expected, ${a} found`)]),o;for(const s in t){const a=s.match(/^(.*)-transition$/);o=o.concat(a&&n[a[1]]&&n[a[1]].transition?e.validateSpec({key:s,value:t[s],valueSpec:i.transition,validateSpec:e.validateSpec,style:r,styleSpec:i}):n[s]?e.validateSpec({key:s,value:t[s],valueSpec:n[s],validateSpec:e.validateSpec,style:r,styleSpec:i}):[new Ae(s,t[s],`unknown property "${s}"`)])}return o}function Gr(e){const t=e.value,i=e.styleSpec,n=i.sky,r=e.style,o=Wn(t);if(void 0===t)return[];if("object"!==o)return[new Ae("sky",t,`object expected, ${o} found`)];let a=[];for(const s in t)a=a.concat(n[s]?e.validateSpec({key:s,value:t[s],valueSpec:n[s],style:r,styleSpec:i}):[new Ae(s,t[s],`unknown property "${s}"`)]);return a}function qr(e){const t=e.value,i=e.styleSpec,n=i.terrain,r=e.style;let o=[];const a=Wn(t);if(void 0===t)return o;if("object"!==a)return o=o.concat([new Ae("terrain",t,`object expected, ${a} found`)]),o;for(const s in t)o=o.concat(n[s]?e.validateSpec({key:s,value:t[s],valueSpec:n[s],validateSpec:e.validateSpec,style:r,styleSpec:i}):[new Ae(s,t[s],`unknown property "${s}"`)]);return o}function $r(e){let t=[];const i=e.value,n=e.key;if(Array.isArray(i)){const r=[],o=[];for(const a in i)i[a].id&&r.includes(i[a].id)&&t.push(new Ae(n,i,`all the sprites' ids must be unique, but ${i[a].id} is duplicated`)),r.push(i[a].id),i[a].url&&o.includes(i[a].url)&&t.push(new Ae(n,i,`all the sprites' URLs must be unique, but ${i[a].url} is duplicated`)),o.push(i[a].url),t=t.concat(Er({key:`${n}[${a}]`,value:i[a],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:e.validateSpec}));return t}return jr({key:n,value:i})}function Wr(e){return Boolean(e)&&e.constructor===Object}function Hr(e){return Wr(e.value)?[]:[new Ae(e.key,e.value,`object expected, ${Wn(e.value)} found`)]}const Xr={"*":()=>[],array:Cr,boolean:function(e){const t=e.value,i=e.key,n=Wn(t);return"boolean"!==n?[new Ae(i,t,`boolean expected, ${n} found`)]:[]},number:kr,color:Ar,constants:Sr,enum:Lr,filter:Dr,function:Ir,layer:Nr,object:Er,source:Ur,light:Zr,sky:Gr,terrain:qr,projection:function(e){const t=e.value,i=e.styleSpec,n=i.projection,r=e.style,o=Wn(t);if(void 0===t)return[];if("object"!==o)return[new Ae("projection",t,`object expected, ${o} found`)];let a=[];for(const s in t)a=a.concat(n[s]?e.validateSpec({key:s,value:t[s],valueSpec:n[s],style:r,styleSpec:i}):[new Ae(s,t[s],`unknown property "${s}"`)]);return a},projectionDefinition:function(e){const t=e.key;let i=e.value;i=i instanceof String?i.valueOf():i;const n=Wn(i);return"array"!==n||(r=i,Array.isArray(r)&&3===r.length&&"string"==typeof r[0]&&"string"==typeof r[1]&&"number"==typeof r[2])||function(e){return!!["interpolate","step","literal"].includes(e[0])}(i)?["array","string"].includes(n)?[]:[new Ae(t,i,`projection expected, invalid type "${n}" found`)]:[new Ae(t,i,`projection expected, invalid array ${JSON.stringify(i)} found`)];var r},string:jr,formatted:function(e){return 0===jr(e).length?[]:zr(e)},resolvedImage:function(e){return 0===jr(e).length?[]:zr(e)},padding:function(e){const t=e.key,i=e.value;if("array"===Wn(i)){if(i.length<1||i.length>4)return[new Ae(t,i,`padding requires 1 to 4 values; ${i.length} values found`)];const n={type:"number"};let r=[];for(let o=0;o<i.length;o++)r=r.concat(e.validateSpec({key:`${t}[${o}]`,value:i[o],validateSpec:e.validateSpec,valueSpec:n}));return r}return kr({key:t,value:i,valueSpec:{}})},numberArray:function(e){const t=e.key,i=e.value;if("array"===Wn(i)){const n={type:"number"};if(i.length<1)return[new Ae(t,i,"array length at least 1 expected, length 0 found")];let r=[];for(let o=0;o<i.length;o++)r=r.concat(e.validateSpec({key:`${t}[${o}]`,value:i[o],validateSpec:e.validateSpec,valueSpec:n}));return r}return kr({key:t,value:i,valueSpec:{}})},colorArray:function(e){const t=e.key,i=e.value;if("array"===Wn(i)){if(i.length<1)return[new Ae(t,i,"array length at least 1 expected, length 0 found")];let e=[];for(let n=0;n<i.length;n++)e=e.concat(Ar({key:`${t}[${n}]`,value:i[n]}));return e}return Ar({key:t,value:i})},variableAnchorOffsetCollection:function(e){const t=e.key,i=e.value,n=Wn(i),r=e.styleSpec;if("array"!==n||i.length<1||i.length%2!=0)return[new Ae(t,i,"variableAnchorOffsetCollection requires a non-empty array of even length")];let o=[];for(let a=0;a<i.length;a+=2)o=o.concat(Lr({key:`${t}[${a}]`,value:i[a],valueSpec:r.layout_symbol["text-anchor"]})),o=o.concat(Cr({key:`${t}[${a+1}]`,value:i[a+1],valueSpec:{length:2,value:"number"},validateSpec:e.validateSpec,style:e.style,styleSpec:r}));return o},sprite:$r,state:Hr,fontFaces:function(e){const t=e.key,i=e.value,n=e.validateSpec,r=e.styleSpec,o=e.style;if(!Wr(i))return[new Ae(t,i,`object expected, ${Wn(i)} found`)];const a=[];for(const s in i){const e=i[s],l=Wn(e);if("string"===l)a.push(...jr({key:`${t}.${s}`,value:e}));else if("array"===l){const i={url:{type:"string",required:!0},"unicode-range":{type:"array",value:"string"}};for(const[l,c]of e.entries())a.push(...Er({key:`${t}.${s}[${l}]`,value:c,valueSpec:i,styleSpec:r,style:o,validateSpec:n}))}else a.push(new Ae(`${t}.${s}`,e,`string or array expected, ${l} found`))}return a}};function Yr(e){const t=e.value,i=e.valueSpec,n=e.styleSpec;return e.validateSpec=Yr,i.expression&&Hn(Pr(t))?Ir(e):i.expression&&nr(Mr(t))?zr(e):i.type&&Xr[i.type]?Xr[i.type](e):Er(Le({},e,{valueSpec:i.type?n[i.type]:i}))}function Kr(e){const t=e.value,i=e.key,n=jr(e);return n.length||(-1===t.indexOf("{fontstack}")&&n.push(new Ae(i,t,'"glyphs" url must include a "{fontstack}" token')),-1===t.indexOf("{range}")&&n.push(new Ae(i,t,'"glyphs" url must include a "{range}" token'))),n}function Qr(e,t=xe){let i=[];return i=i.concat(Yr({key:"",value:e,valueSpec:t.$root,styleSpec:t,style:e,validateSpec:Yr,objectElementValidators:{glyphs:Kr,"*":()=>[]}})),e.constants&&(i=i.concat(Sr({key:"constants",value:e.constants}))),eo(i)}function Jr(e){return function(t){return e(Object.assign({},t,{validateSpec:Yr}))}}function eo(e){return[].concat(e).sort((e,t)=>e.line-t.line)}function to(e){return function(...t){return eo(e.apply(this,t))}}Qr.source=to(Jr(Ur)),Qr.sprite=to(Jr($r)),Qr.glyphs=to(Jr(Kr)),Qr.light=to(Jr(Zr)),Qr.sky=to(Jr(Gr)),Qr.terrain=to(Jr(qr)),Qr.state=to(Jr(Hr)),Qr.layer=to(Jr(Nr)),Qr.filter=to(Jr(Dr)),Qr.paintProperty=to(Jr(Br)),Qr.layoutProperty=to(Jr(Or));const io={type:"enum","property-type":"data-constant",expression:{interpolated:!1,parameters:["global-state"]},values:{visible:{},none:{}},transition:!1,default:"visible"};class no{constructor(e,t){this._globalState=t,this.setValue(e)}evaluate(){var e;return null!==(e=this._literalValue)&&void 0!==e?e:this._compiledValue.evaluate({})}setValue(e){if(null==e||"visible"===e||"none"===e)return this._literalValue="none"===e?"none":"visible",this._compiledValue=void 0,void(this._globalStateRefs=new Set);const t=rr(e,io,this._globalState);if("error"===t.result)throw this._literalValue="visible",this._compiledValue=void 0,new Error(t.value.map(e=>`${e.key}: ${e.message}`).join(", "));this._literalValue=void 0,this._compiledValue=t.value,this._globalStateRefs=ur(t.value.expression)}getGlobalStateRefs(){return this._globalStateRefs}}const ro=xe,oo=Qr,ao=oo.light,so=oo.sky,lo=oo.paintProperty,co=oo.layoutProperty;function uo(e,t){let i=!1;if(t&&t.length)for(const n of t)e.fire(new ye(new Error(n.message))),i=!0;return i}class ho{constructor(e,t,i){const n=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const r=new Int32Array(this.arrayBuffer);e=r[0],this.d=(t=r[1])+2*(i=r[2]);for(let e=0;e<this.d*this.d;e++){const t=r[3+e],i=r[3+e+1];n.push(t===i?null:r.subarray(t,i))}const o=r[3+n.length+1];this.keys=r.subarray(r[3+n.length],o),this.bboxes=r.subarray(o),this.insert=this._insertReadonly}else{this.d=t+2*i;for(let e=0;e<this.d*this.d;e++)n.push([]);this.keys=[],this.bboxes=[]}this.n=t,this.extent=e,this.padding=i,this.scale=t/e,this.uid=0;const r=i/t*e;this.min=-r,this.max=e+r}insert(e,t,i,n,r){this._forEachCell(t,i,n,r,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(t),this.bboxes.push(i),this.bboxes.push(n),this.bboxes.push(r)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,t,i,n,r,o){this.cells[r].push(o)}query(e,t,i,n,r){const o=this.min,a=this.max;if(e<=o&&t<=o&&a<=i&&a<=n&&!r)return Array.prototype.slice.call(this.keys);{const o=[];return this._forEachCell(e,t,i,n,this._queryCell,o,{},r),o}}_queryCell(e,t,i,n,r,o,a,s){const l=this.cells[r];if(null!==l){const r=this.keys,c=this.bboxes;for(let u=0;u<l.length;u++){const h=l[u];if(void 0===a[h]){const l=4*h;(s?s(c[l+0],c[l+1],c[l+2],c[l+3]):e<=c[l+2]&&t<=c[l+3]&&i>=c[l+0]&&n>=c[l+1])?(a[h]=!0,o.push(r[h])):a[h]=!1}}}}_forEachCell(e,t,i,n,r,o,a,s){const l=this._convertToCellCoord(e),c=this._convertToCellCoord(t),u=this._convertToCellCoord(i),h=this._convertToCellCoord(n);for(let d=l;d<=u;d++)for(let l=c;l<=h;l++){const c=this.d*l+d;if((!s||s(this._convertFromCellCoord(d),this._convertFromCellCoord(l),this._convertFromCellCoord(d+1),this._convertFromCellCoord(l+1)))&&r.call(this,e,t,i,n,c,o,a,s))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const e=this.cells,t=3+this.cells.length+1+1;let i=0;for(let o=0;o<this.cells.length;o++)i+=this.cells[o].length;const n=new Int32Array(t+i+this.keys.length+this.bboxes.length);n[0]=this.extent,n[1]=this.n,n[2]=this.padding;let r=t;for(let o=0;o<e.length;o++){const t=e[o];n[3+o]=r,n.set(t,r),r+=t.length}return n[3+e.length]=r,n.set(this.keys,r),r+=this.keys.length,n[3+e.length+1]=r,n.set(this.bboxes,r),r+=this.bboxes.length,n.buffer}static serialize(e,t){const i=e.toArrayBuffer();return t&&t.push(i),{buffer:i}}static deserialize(e){return new ho(e.buffer)}}const po={};function fo(e,t,i={}){if(po[e])throw new Error(`${e} is already registered.`);Object.defineProperty(t,"_classRegistryKey",{value:e,writeable:!1}),po[e]={klass:t,omit:i.omit||[],shallow:i.shallow||[]}}fo("Object",Object),fo("Set",Set),fo("TransferableGridIndex",ho),fo("Color",Ct),fo("Error",Error),fo("AJAXError",he),fo("ResolvedImage",Nt),fo("StylePropertyFunction",lr),fo("StyleExpression",ir,{omit:["_evaluator"]}),fo("ZoomDependentExpression",ar),fo("ZoomConstantExpression",or),fo("CompoundExpression",Ln,{omit:["_evaluate"]});for(const i in An)An[i]._classRegistryKey||fo(`Expression_${i}`,An[i]);function mo(e){return e&&"undefined"!=typeof ArrayBuffer&&(e instanceof ArrayBuffer||e.constructor&&"ArrayBuffer"===e.constructor.name)}function go(e){return e.$name||e.constructor._classRegistryKey}function _o(e){return!function(e){if(null===e||"object"!=typeof e)return!1;const t=go(e);return!(!t||"Object"===t)}(e)&&(null==e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp||e instanceof Blob||e instanceof Error||mo(e)||X(e)||ArrayBuffer.isView(e)||e instanceof ImageData)}function yo(e,t){if(_o(e))return(mo(e)||X(e))&&t&&t.push(e),ArrayBuffer.isView(e)&&t&&t.push(e.buffer),e instanceof ImageData&&t&&t.push(e.data.buffer),e;if(Array.isArray(e)){const i=[];for(const n of e)i.push(yo(n,t));return i}if("object"!=typeof e)throw new Error("can't serialize object of type "+typeof e);const i=go(e);if(!i)throw new Error(`can't serialize object of unregistered class ${e.constructor.name}`);if(!po[i])throw new Error(`${i} is not registered.`);const{klass:n}=po[i],r=n.serialize?n.serialize(e,t):{};if(n.serialize){if(t&&r===t[t.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const n in e){if(!e.hasOwnProperty(n))continue;if(po[i].omit.indexOf(n)>=0)continue;const o=e[n];r[n]=po[i].shallow.indexOf(n)>=0?o:yo(o,t)}e instanceof Error&&(r.message=e.message)}if(r.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==i&&(r.$name=i),r}function vo(e){if(_o(e))return e;if(Array.isArray(e))return e.map(vo);if("object"!=typeof e)throw new Error("can't deserialize object of type "+typeof e);const t=go(e)||"Object";if(!po[t])throw new Error(`can't deserialize unregistered class ${t}`);const{klass:i}=po[t];if(!i)throw new Error(`can't deserialize unregistered class ${t}`);if(i.deserialize)return i.deserialize(e);const n=Object.create(i.prototype);for(const r of Object.keys(e)){if("$name"===r)continue;const i=e[r];n[r]=po[t].shallow.indexOf(r)>=0?i:vo(i)}return n}class xo{constructor(){this.first=!0}update(e,t){const i=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=i,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=i,!0):(this.lastFloorZoom>i?(this.lastIntegerZoom=i+1,this.lastIntegerZoomTime=t):this.lastFloorZoom<i&&(this.lastIntegerZoom=i,this.lastIntegerZoomTime=t),e!==this.lastZoom&&(this.lastZoom=e,this.lastFloorZoom=i,!0))}}function bo(e){return/[\u02EA\u02EB\u2E80-\u2FDF\u2FF0-\u303F\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FD-\u30FF\u3105-\u312F\u31A0-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE4F\uFF00-\uFFEF]|\uD81B[\uDFE0-\uDFFF]|[\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFFF]|\uD82C[\uDC00-\uDEFB]|\uD83C[\uDE00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(e))}function wo(e){return/[\u02EA\u02EB\u1100-\u11FF\u1400-\u167F\u18B0-\u18F5\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u3007\u3012\u3013\u3020-\u302F\u3031-\u303F\u3041-\u3096\u309D-\u30FB\u30FD-\u30FF\u3105-\u312F\u3131-\u318E\u3190-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE48\uFE50-\uFE57\uFE5F-\uFE62\uFE67-\uFE6F\uFF00-\uFF07\uFF0A-\uFF0C\uFF0E-\uFF19\uFF1F-\uFF3A\uFF3C\uFF3E\uFF40-\uFF5A\uFFE0-\uFFE2\uFFE4-\uFFE7]|\uD802[\uDD80-\uDD9F]|\uD805[\uDD80-\uDDFF]|\uD806[\uDE00-\uDEBF]|\uD811[\uDC00-\uDE7F]|\uD81B[\uDFE0-\uDFE4\uDFF0-\uDFF6]|[\uD81C-\uD822\uD83D\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD30-\uDEFB]|\uD833[\uDEC0-\uDFCF]|\uD834[\uDC00-\uDDFF\uDEE0-\uDF7F]|\uD836[\uDC00-\uDEAF]|\uD83C[\uDC00-\uDE00\uDF00-\uDFFF]|\uD83E[\uDD00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(e))}function To(e){return/\s/u.test(String.fromCodePoint(e))}function So(e){for(const t of e)if(wo(t.codePointAt(0)))return!0;return!1}function Po(e){for(const t of e)if(!Co(t.codePointAt(0)))return!1;return!0}function Mo(e){const t=e.map(e=>{try{return new RegExp(`\\p{sc=${e}}`,"u").source}catch(t){return null}}).filter(e=>e);return new RegExp(t.join("|"),"u")}const Eo=Mo(["Arab","Dupl","Mong","Ougr","Syrc"]);function Co(e){return!Eo.test(String.fromCodePoint(e))}function ko(e){return!(wo(e)||(t=e,/[\xA7\xA9\xAE\xB1\xBC-\xBE\xD7\xF7\u2016\u2020\u2021\u2030\u2031\u203B\u203C\u2042\u2047-\u2049\u2051\u2100-\u218F\u221E\u2234\u2235\u2300-\u2307\u230C-\u231F\u2324-\u2328\u232B\u237D-\u239A\u23BE-\u23CD\u23CF\u23D1-\u23DB\u23E2-\u2422\u2424-\u24FF\u25A0-\u2619\u2620-\u2767\u2776-\u2793\u2B12-\u2B2F\u2B50-\u2B59\u2BB8-\u2BEB\u3000-\u303F\u30A0-\u30FF\uE000-\uF8FF\uFE30-\uFE6F\uFF00-\uFFEF\uFFFC\uFFFD]|[\uDB80-\uDBFF][\uDC00-\uDFFF]/gim.test(String.fromCodePoint(t))));var t}const Io=Mo(["Adlm","Arab","Armi","Avst","Chrs","Cprt","Egyp","Elym","Gara","Hatr","Hebr","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogo","Syrc","Thaa","Todr","Yezi"]);function zo(e){return Io.test(String.fromCodePoint(e))}function Ao(e,t){return!(!t&&zo(e)||/[\u0900-\u0DFF\u0F00-\u109F\u1780-\u17FF]/gim.test(String.fromCodePoint(e)))}function Lo(e){for(const t of e)if(zo(t.codePointAt(0)))return!0;return!1}const Do=new class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(e){this.pluginStatus=e.pluginStatus,this.pluginURL=e.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(e){if(Do.isParsed())throw new Error("RTL text plugin already registered.");this.applyArabicShaping=e.applyArabicShaping,this.processBidirectionalText=e.processBidirectionalText,this.processStyledBidirectionalText=e.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return null!=this.applyArabicShaping&&null!=this.processBidirectionalText&&null!=this.processStyledBidirectionalText}getRTLTextPluginStatus(){return this.pluginStatus}syncState(e,i){return t(this,void 0,void 0,function*(){if(this.isParsed())return this.getState();if("loading"!==e.pluginStatus)return this.setState(e),e;const t=e.pluginURL,n=new Promise(e=>{this.loadScriptResolve=e});i(t);const r=new Promise(e=>setTimeout(()=>e(),this.TIMEOUT));if(yield Promise.race([n,r]),this.isParsed()){const e={pluginStatus:"loaded",pluginURL:t};return this.setState(e),e}throw this.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${t}`)})}};class Ro{constructor(e,t){this.isSupportedScript=Fo,this.zoom=e,t?(this.now=t.now||0,this.fadeDuration=t.fadeDuration||0,this.zoomHistory=t.zoomHistory||new xo,this.transition=t.transition||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new xo,this.transition={})}crossFadingFactor(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const e=this.zoom,t=e-Math.floor(e),i=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:t+(1-t)*i}:{fromScale:.5,toScale:1,t:1-(1-i)*t}}}function Fo(e){return function(e,t){for(const i of e)if(!Ao(i.codePointAt(0),t))return!1;return!0}(e,"loaded"===Do.getRTLTextPluginStatus())}const Bo="-transition";class Oo{constructor(e,t,i){this.property=e,this.value=t,this.expression=function(e,t,i){if(Hn(e))return new lr(e,t);if(nr(e)){const n=sr(e,t,i);if("error"===n.result)throw new Error(n.value.map(e=>`${e.key}: ${e.message}`).join(", "));return n.value}{let i=e;return"color"===t.type&&"string"==typeof e?i=Ct.parse(e):"padding"!==t.type||"number"!=typeof e&&!Array.isArray(e)?"numberArray"!==t.type||"number"!=typeof e&&!Array.isArray(e)?"colorArray"!==t.type||"string"!=typeof e&&!Array.isArray(e)?"variableAnchorOffsetCollection"===t.type&&Array.isArray(e)?i=Ot.parse(e):"projectionDefinition"===t.type&&"string"==typeof e&&(i=jt.parse(e)):i=Rt.parse(e):i=Dt.parse(e):i=Lt.parse(e),{globalStateRefs:new Set,_globalState:null,kind:"constant",evaluate:()=>i}}}(void 0===t?e.specification.default:t,e.specification,i)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(e,t,i){return this.property.possiblyEvaluate(this,e,t,i)}}class No{constructor(e,t){this.property=e,this.value=new Oo(e,void 0,t)}transitioned(e,t){return new Vo(this.property,this.value,t,N({},e.transition,this.transition),e.now)}untransitioned(){return new Vo(this.property,this.value,null,{},0)}}class jo{constructor(e,t){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._globalState=t}getValue(e){return Z(this._values[e].value.value)}setValue(e,t){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new No(this._values[e].property,this._globalState)),this._values[e].value=new Oo(this._values[e].property,null===t?void 0:Z(t),this._globalState)}getTransition(e){return Z(this._values[e].transition)}setTransition(e,t){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new No(this._values[e].property,this._globalState)),this._values[e].transition=Z(t)||void 0}serialize(){const e={};for(const t of Object.keys(this._values)){const i=this.getValue(t);void 0!==i&&(e[t]=i);const n=this.getTransition(t);void 0!==n&&(e[`${t}${Bo}`]=n)}return e}transitioned(e,t){const i=new Uo(this._properties);for(const n of Object.keys(this._values))i._values[n]=this._values[n].transitioned(e,t._values[n]);return i}untransitioned(){const e=new Uo(this._properties);for(const t of Object.keys(this._values))e._values[t]=this._values[t].untransitioned();return e}}class Vo{constructor(e,t,i,n,r){this.property=e,this.value=t,this.begin=r+n.delay||0,this.end=this.begin+n.duration||0,e.specification.transition&&(n.delay||n.duration)&&(this.prior=i)}possiblyEvaluate(e,t,i){const n=e.now||0,r=this.value.possiblyEvaluate(e,t,i),o=this.prior;if(o){if(n>this.end)return this.prior=null,r;if(this.value.isDataDriven())return this.prior=null,r;if(n<this.begin)return o.possiblyEvaluate(e,t,i);{const a=(n-this.begin)/(this.end-this.begin);return this.property.interpolate(o.possiblyEvaluate(e,t,i),r,D(a))}}return r}}class Uo{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,t,i){const n=new qo(this._properties);for(const r of Object.keys(this._values))n._values[r]=this._values[r].possiblyEvaluate(e,t,i);return n}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class Zo{constructor(e,t){this._properties=e,this._values=Object.create(e.defaultPropertyValues),this._globalState=t}hasValue(e){return void 0!==this._values[e].value}getValue(e){return Z(this._values[e].value)}setValue(e,t){this._values[e]=new Oo(this._values[e].property,null===t?void 0:Z(t),this._globalState)}serialize(){const e={};for(const t of Object.keys(this._values)){const i=this.getValue(t);void 0!==i&&(e[t]=i)}return e}possiblyEvaluate(e,t,i){const n=new qo(this._properties);for(const r of Object.keys(this._values))n._values[r]=this._values[r].possiblyEvaluate(e,t,i);return n}}class Go{constructor(e,t,i){this.property=e,this.value=t,this.parameters=i}isConstant(){return"constant"===this.value.kind}constantOr(e){return"constant"===this.value.kind?this.value.value:e}evaluate(e,t,i,n){return this.property.evaluate(this.value,this.parameters,e,t,i,n)}}class qo{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class $o{constructor(e){this.specification=e}possiblyEvaluate(e,t){if(e.isDataDriven())throw new Error("Value should not be data driven");return e.expression.evaluate(t)}interpolate(e,t,i){const n=gi[this.specification.type];return n?n(e,t,i):e}}class Wo{constructor(e,t){this.specification=e,this.overrides=t}possiblyEvaluate(e,t,i,n){return new Go(this,"constant"===e.expression.kind||"camera"===e.expression.kind?{kind:"constant",value:e.expression.evaluate(t,null,{},i,n)}:e.expression,t)}interpolate(e,t,i){if("constant"!==e.value.kind||"constant"!==t.value.kind)return e;if(void 0===e.value.value||void 0===t.value.value)return new Go(this,{kind:"constant",value:void 0},e.parameters);const n=gi[this.specification.type];if(n){const r=n(e.value.value,t.value.value,i);return new Go(this,{kind:"constant",value:r},e.parameters)}return e}evaluate(e,t,i,n,r,o){return"constant"===e.kind?e.value:e.evaluate(t,i,n,r,o)}}class Ho extends Wo{possiblyEvaluate(e,t,i,n){if(void 0===e.value)return new Go(this,{kind:"constant",value:void 0},t);if("constant"===e.expression.kind){const r=e.expression.evaluate(t,null,{},i,n),o="resolvedImage"===e.property.specification.type&&"string"!=typeof r?r.name:r,a=this._calculate(o,o,o,t);return new Go(this,{kind:"constant",value:a},t)}if("camera"===e.expression.kind){const i=this._calculate(e.expression.evaluate({zoom:t.zoom-1}),e.expression.evaluate({zoom:t.zoom}),e.expression.evaluate({zoom:t.zoom+1}),t);return new Go(this,{kind:"constant",value:i},t)}return new Go(this,e.expression,t)}evaluate(e,t,i,n,r,o){if("source"===e.kind){const a=e.evaluate(t,i,n,r,o);return this._calculate(a,a,a,t)}return"composite"===e.kind?this._calculate(e.evaluate({zoom:Math.floor(t.zoom)-1},i,n),e.evaluate({zoom:Math.floor(t.zoom)},i,n),e.evaluate({zoom:Math.floor(t.zoom)+1},i,n),t):e.value}_calculate(e,t,i,n){return n.zoom>n.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:i,to:t}}interpolate(e){return e}}class Xo{constructor(e){this.specification=e}possiblyEvaluate(e,t,i,n){if(void 0!==e.value){if("constant"===e.expression.kind){const r=e.expression.evaluate(t,null,{},i,n);return this._calculate(r,r,r,t)}return this._calculate(e.expression.evaluate(new Ro(Math.floor(t.zoom-1),t)),e.expression.evaluate(new Ro(Math.floor(t.zoom),t)),e.expression.evaluate(new Ro(Math.floor(t.zoom+1),t)),t)}}_calculate(e,t,i,n){return n.zoom>n.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:i,to:t}}interpolate(e){return e}}class Yo{constructor(e){this.specification=e}possiblyEvaluate(e,t,i,n){return!!e.expression.evaluate(t,null,{},i,n)}interpolate(){return!1}}class Ko{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const t in e){const i=e[t];i.specification.overridable&&this.overridableProperties.push(t);const n=this.defaultPropertyValues[t]=new Oo(i,void 0,void 0),r=this.defaultTransitionablePropertyValues[t]=new No(i,void 0);this.defaultTransitioningPropertyValues[t]=r.untransitioned(),this.defaultPossiblyEvaluatedValues[t]=n.possiblyEvaluate({})}}}fo("DataDrivenProperty",Wo),fo("DataConstantProperty",$o),fo("CrossFadedDataDrivenProperty",Ho),fo("CrossFadedProperty",Xo),fo("ColorRampProperty",Yo);class Qo extends ve{constructor(e,t,i){if(super(),this.id=e.id,this.type=e.type,this._globalState=i,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},this._visibilityExpression=(n=this.visibility,new no(n,i)),"custom"!==e.type&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,"background"!==e.type&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter,this._featureFilter=fr(e.filter,i)),t.layout&&(this._unevaluatedLayout=new Zo(t.layout,i)),t.paint)){this._transitionablePaint=new jo(t.paint,i);for(const t in e.paint)this.setPaintProperty(t,e.paint[t],{validate:!1});for(const t in e.layout)this.setLayoutProperty(t,e.layout[t],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new qo(t.paint)}var n}setFilter(e){this.filter=e,this._featureFilter=fr(e,this._globalState)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return"visibility"===e?this.visibility:this._unevaluatedLayout.getValue(e)}getLayoutAffectingGlobalStateRefs(){const e=new Set;for(const t of this._visibilityExpression.getGlobalStateRefs())e.add(t);if(this._unevaluatedLayout)for(const t in this._unevaluatedLayout._values){const i=this._unevaluatedLayout._values[t];for(const t of i.getGlobalStateRefs())e.add(t)}for(const t of this._featureFilter.getGlobalStateRefs())e.add(t);return e}getPaintAffectingGlobalStateRefs(){var e;const t=new globalThis.Map;if(this._transitionablePaint)for(const i in this._transitionablePaint._values){const n=this._transitionablePaint._values[i].value;for(const r of n.getGlobalStateRefs()){const o=null!==(e=t.get(r))&&void 0!==e?e:[];o.push({name:i,value:n.value}),t.set(r,o)}}return t}getVisibilityAffectingGlobalStateRefs(){return this._visibilityExpression.getGlobalStateRefs()}setLayoutProperty(e,t,i={}){if(null==t||!this._validate(co,`layers.${this.id}.layout.${e}`,e,t,i))return"visibility"===e?(this.visibility=t,this._visibilityExpression.setValue(t),void this.recalculateVisibility()):void this._unevaluatedLayout.setValue(e,t)}getPaintProperty(e){return e.endsWith(Bo)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,t,i={}){if(null!=t&&this._validate(lo,`layers.${this.id}.paint.${e}`,e,t,i))return!1;if(e.endsWith(Bo))return this._transitionablePaint.setTransition(e.slice(0,-11),t||void 0),!1;{const i=this._transitionablePaint._values[e],n="cross-faded-data-driven"===i.property.specification["property-type"],r=i.value.isDataDriven(),o=i.value;this._transitionablePaint.setValue(e,t),this._handleSpecialPaintPropertyUpdate(e);const a=this._transitionablePaint._values[e].value;return a.isDataDriven()||r||n||this._handleOverridablePaintPropertyUpdate(e,o,a)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,t,i){return!1}isHidden(e=this.minzoom,t=!1){return!!(this.minzoom&&e<(t?Math.floor(this.minzoom):this.minzoom))||!!(this.maxzoom&&e>=this.maxzoom)||"none"===this._evaluatedVisibility}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculateVisibility(){this._evaluatedVisibility=this._visibilityExpression.evaluate()}recalculate(e,t){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,t)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,t)}serialize(){const e={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),U(e,(e,t)=>!(void 0===e||"layout"===t&&!Object.keys(e).length||"paint"===t&&!Object.keys(e).length))}_validate(e,t,i,n,r={}){return(!r||!1!==r.validate)&&uo(this,e.call(oo,{key:t,layerType:this.type,objectKey:i,value:n,styleSpec:xe,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const e in this.paint._values){const t=this.paint.get(e);if(t instanceof Go&&Gn(t.property.specification)&&("source"===t.value.kind||"composite"===t.value.kind)&&t.value.isStateDependent)return!0}return!1}}let Jo;var ea={get paint(){return Jo=Jo||new Ko({"raster-opacity":new $o(xe.paint_raster["raster-opacity"]),"raster-hue-rotate":new $o(xe.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new $o(xe.paint_raster["raster-brightness-min"]),"raster-brightness-max":new $o(xe.paint_raster["raster-brightness-max"]),"raster-saturation":new $o(xe.paint_raster["raster-saturation"]),"raster-contrast":new $o(xe.paint_raster["raster-contrast"]),"raster-resampling":new $o(xe.paint_raster["raster-resampling"]),"raster-fade-duration":new $o(xe.paint_raster["raster-fade-duration"])})}};class ta extends Qo{constructor(e,t){super(e,ea,t)}}const ia={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class na{constructor(e,t){this._structArray=e,this._pos1=t*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class ra{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,t){return e._trim(),t&&(e.isTransferred=!0,t.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const t=Object.create(this.prototype);return t.arrayBuffer=e.arrayBuffer,t.length=e.length,t.capacity=e.arrayBuffer.byteLength/t.bytesPerElement,t._refreshViews(),t}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const t=this.uint8;this._refreshViews(),t&&this.uint8.set(t)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function oa(e,t=1){let i=0,n=0;return{members:e.map(e=>{const r=ia[e.type].BYTES_PER_ELEMENT,o=i=aa(i,Math.max(t,r)),a=e.components||1;return n=Math.max(n,r),i+=r*a,{name:e.name,type:e.type,components:a,offset:o}}),size:aa(i,Math.max(n,t)),alignment:t}}function aa(e,t){return Math.ceil(e/t)*t}class sa extends ra{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t){const i=this.length;return this.resize(i+1),this.emplace(i,e,t)}emplace(e,t,i){const n=2*e;return this.int16[n+0]=t,this.int16[n+1]=i,e}}sa.prototype.bytesPerElement=4,fo("StructArrayLayout2i4",sa);class la extends ra{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,i)}emplace(e,t,i,n){const r=3*e;return this.int16[r+0]=t,this.int16[r+1]=i,this.int16[r+2]=n,e}}la.prototype.bytesPerElement=6,fo("StructArrayLayout3i6",la);class ca extends ra{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,n){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i,n)}emplace(e,t,i,n,r){const o=4*e;return this.int16[o+0]=t,this.int16[o+1]=i,this.int16[o+2]=n,this.int16[o+3]=r,e}}ca.prototype.bytesPerElement=8,fo("StructArrayLayout4i8",ca);class ua extends ra{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,n,r,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,i,n,r,o)}emplace(e,t,i,n,r,o,a){const s=6*e;return this.int16[s+0]=t,this.int16[s+1]=i,this.int16[s+2]=n,this.int16[s+3]=r,this.int16[s+4]=o,this.int16[s+5]=a,e}}ua.prototype.bytesPerElement=12,fo("StructArrayLayout2i4i12",ua);class ha extends ra{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,n,r,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,i,n,r,o)}emplace(e,t,i,n,r,o,a){const s=4*e,l=8*e;return this.int16[s+0]=t,this.int16[s+1]=i,this.uint8[l+4]=n,this.uint8[l+5]=r,this.uint8[l+6]=o,this.uint8[l+7]=a,e}}ha.prototype.bytesPerElement=8,fo("StructArrayLayout2i4ub8",ha);class da extends ra{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t){const i=this.length;return this.resize(i+1),this.emplace(i,e,t)}emplace(e,t,i){const n=2*e;return this.float32[n+0]=t,this.float32[n+1]=i,e}}da.prototype.bytesPerElement=8,fo("StructArrayLayout2f8",da);class pa extends ra{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,n,r,o,a,s,l,c){const u=this.length;return this.resize(u+1),this.emplace(u,e,t,i,n,r,o,a,s,l,c)}emplace(e,t,i,n,r,o,a,s,l,c,u){const h=10*e;return this.uint16[h+0]=t,this.uint16[h+1]=i,this.uint16[h+2]=n,this.uint16[h+3]=r,this.uint16[h+4]=o,this.uint16[h+5]=a,this.uint16[h+6]=s,this.uint16[h+7]=l,this.uint16[h+8]=c,this.uint16[h+9]=u,e}}pa.prototype.bytesPerElement=20,fo("StructArrayLayout10ui20",pa);class fa extends ra{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,n,r,o,a,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,t,i,n,r,o,a,s)}emplace(e,t,i,n,r,o,a,s,l){const c=8*e;return this.uint16[c+0]=t,this.uint16[c+1]=i,this.uint16[c+2]=n,this.uint16[c+3]=r,this.uint16[c+4]=o,this.uint16[c+5]=a,this.uint16[c+6]=s,this.uint16[c+7]=l,e}}fa.prototype.bytesPerElement=16,fo("StructArrayLayout8ui16",fa);class ma extends ra{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,n,r,o,a,s,l,c,u,h){const d=this.length;return this.resize(d+1),this.emplace(d,e,t,i,n,r,o,a,s,l,c,u,h)}emplace(e,t,i,n,r,o,a,s,l,c,u,h,d){const p=12*e;return this.int16[p+0]=t,this.int16[p+1]=i,this.int16[p+2]=n,this.int16[p+3]=r,this.uint16[p+4]=o,this.uint16[p+5]=a,this.uint16[p+6]=s,this.uint16[p+7]=l,this.int16[p+8]=c,this.int16[p+9]=u,this.int16[p+10]=h,this.int16[p+11]=d,e}}ma.prototype.bytesPerElement=24,fo("StructArrayLayout4i4ui4i24",ma);class ga extends ra{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,i)}emplace(e,t,i,n){const r=3*e;return this.float32[r+0]=t,this.float32[r+1]=i,this.float32[r+2]=n,e}}ga.prototype.bytesPerElement=12,fo("StructArrayLayout3f12",ga);class _a extends ra{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint32[1*e+0]=t,e}}_a.prototype.bytesPerElement=4,fo("StructArrayLayout1ul4",_a);class ya extends ra{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,n,r,o,a,s,l){const c=this.length;return this.resize(c+1),this.emplace(c,e,t,i,n,r,o,a,s,l)}emplace(e,t,i,n,r,o,a,s,l,c){const u=10*e,h=5*e;return this.int16[u+0]=t,this.int16[u+1]=i,this.int16[u+2]=n,this.int16[u+3]=r,this.int16[u+4]=o,this.int16[u+5]=a,this.uint32[h+3]=s,this.uint16[u+8]=l,this.uint16[u+9]=c,e}}ya.prototype.bytesPerElement=20,fo("StructArrayLayout6i1ul2ui20",ya);class va extends ra{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,n,r,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,i,n,r,o)}emplace(e,t,i,n,r,o,a){const s=6*e;return this.int16[s+0]=t,this.int16[s+1]=i,this.int16[s+2]=n,this.int16[s+3]=r,this.int16[s+4]=o,this.int16[s+5]=a,e}}va.prototype.bytesPerElement=12,fo("StructArrayLayout2i2i2i12",va);class xa extends ra{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,n,r){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,n,r)}emplace(e,t,i,n,r,o){const a=4*e,s=8*e;return this.float32[a+0]=t,this.float32[a+1]=i,this.float32[a+2]=n,this.int16[s+6]=r,this.int16[s+7]=o,e}}xa.prototype.bytesPerElement=16,fo("StructArrayLayout2f1f2i16",xa);class ba extends ra{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,n,r,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,i,n,r,o)}emplace(e,t,i,n,r,o,a){const s=16*e,l=4*e,c=8*e;return this.uint8[s+0]=t,this.uint8[s+1]=i,this.float32[l+1]=n,this.float32[l+2]=r,this.int16[c+6]=o,this.int16[c+7]=a,e}}ba.prototype.bytesPerElement=16,fo("StructArrayLayout2ub2f2i16",ba);class wa extends ra{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,i)}emplace(e,t,i,n){const r=3*e;return this.uint16[r+0]=t,this.uint16[r+1]=i,this.uint16[r+2]=n,e}}wa.prototype.bytesPerElement=6,fo("StructArrayLayout3ui6",wa);class Ta extends ra{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,n,r,o,a,s,l,c,u,h,d,p,f,m,g){const _=this.length;return this.resize(_+1),this.emplace(_,e,t,i,n,r,o,a,s,l,c,u,h,d,p,f,m,g)}emplace(e,t,i,n,r,o,a,s,l,c,u,h,d,p,f,m,g,_){const y=24*e,v=12*e,x=48*e;return this.int16[y+0]=t,this.int16[y+1]=i,this.uint16[y+2]=n,this.uint16[y+3]=r,this.uint32[v+2]=o,this.uint32[v+3]=a,this.uint32[v+4]=s,this.uint16[y+10]=l,this.uint16[y+11]=c,this.uint16[y+12]=u,this.float32[v+7]=h,this.float32[v+8]=d,this.uint8[x+36]=p,this.uint8[x+37]=f,this.uint8[x+38]=m,this.uint32[v+10]=g,this.int16[y+22]=_,e}}Ta.prototype.bytesPerElement=48,fo("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Ta);class Sa extends ra{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,n,r,o,a,s,l,c,u,h,d,p,f,m,g,_,y,v,x,b,w,T,S,P,M,E){const C=this.length;return this.resize(C+1),this.emplace(C,e,t,i,n,r,o,a,s,l,c,u,h,d,p,f,m,g,_,y,v,x,b,w,T,S,P,M,E)}emplace(e,t,i,n,r,o,a,s,l,c,u,h,d,p,f,m,g,_,y,v,x,b,w,T,S,P,M,E,C){const k=32*e,I=16*e;return this.int16[k+0]=t,this.int16[k+1]=i,this.int16[k+2]=n,this.int16[k+3]=r,this.int16[k+4]=o,this.int16[k+5]=a,this.int16[k+6]=s,this.int16[k+7]=l,this.uint16[k+8]=c,this.uint16[k+9]=u,this.uint16[k+10]=h,this.uint16[k+11]=d,this.uint16[k+12]=p,this.uint16[k+13]=f,this.uint16[k+14]=m,this.uint16[k+15]=g,this.uint16[k+16]=_,this.uint16[k+17]=y,this.uint16[k+18]=v,this.uint16[k+19]=x,this.uint16[k+20]=b,this.uint16[k+21]=w,this.uint16[k+22]=T,this.uint32[I+12]=S,this.float32[I+13]=P,this.float32[I+14]=M,this.uint16[k+30]=E,this.uint16[k+31]=C,e}}Sa.prototype.bytesPerElement=64,fo("StructArrayLayout8i15ui1ul2f2ui64",Sa);class Pa extends ra{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.float32[1*e+0]=t,e}}Pa.prototype.bytesPerElement=4,fo("StructArrayLayout1f4",Pa);class Ma extends ra{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,i)}emplace(e,t,i,n){const r=3*e;return this.uint16[6*e+0]=t,this.float32[r+1]=i,this.float32[r+2]=n,e}}Ma.prototype.bytesPerElement=12,fo("StructArrayLayout1ui2f12",Ma);class Ea extends ra{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,i)}emplace(e,t,i,n){const r=4*e;return this.uint32[2*e+0]=t,this.uint16[r+2]=i,this.uint16[r+3]=n,e}}Ea.prototype.bytesPerElement=8,fo("StructArrayLayout1ul2ui8",Ea);class Ca extends ra{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t){const i=this.length;return this.resize(i+1),this.emplace(i,e,t)}emplace(e,t,i){const n=2*e;return this.uint16[n+0]=t,this.uint16[n+1]=i,e}}Ca.prototype.bytesPerElement=4,fo("StructArrayLayout2ui4",Ca);class ka extends ra{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint16[1*e+0]=t,e}}ka.prototype.bytesPerElement=2,fo("StructArrayLayout1ui2",ka);class Ia extends ra{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,n){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i,n)}emplace(e,t,i,n,r){const o=4*e;return this.float32[o+0]=t,this.float32[o+1]=i,this.float32[o+2]=n,this.float32[o+3]=r,e}}Ia.prototype.bytesPerElement=16,fo("StructArrayLayout4f16",Ia);class za extends na{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new n(this.anchorPointX,this.anchorPointY)}}za.prototype.size=20;class Aa extends ya{get(e){return new za(this,e)}}fo("CollisionBoxArray",Aa);class La extends na{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}La.prototype.size=48;class Da extends Ta{get(e){return new La(this,e)}}fo("PlacedSymbolArray",Da);class Ra extends na{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(e){this._structArray.uint32[this._pos4+12]=e}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}Ra.prototype.size=64;class Fa extends Sa{get(e){return new Ra(this,e)}}fo("SymbolInstanceArray",Fa);class Ba extends Pa{getoffsetX(e){return this.float32[1*e+0]}}fo("GlyphOffsetArray",Ba);class Oa extends la{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}fo("SymbolLineVertexArray",Oa);class Na extends na{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}}Na.prototype.size=12;class ja extends Ma{get(e){return new Na(this,e)}}fo("TextAnchorOffsetArray",ja);class Va extends na{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]}}Va.prototype.size=8;class Ua extends Ea{get(e){return new Va(this,e)}}fo("FeatureIndexArray",Ua);class Za extends sa{}class Ga extends sa{}class qa extends sa{}class $a extends ua{}class Wa extends ha{}class Ha extends da{}class Xa extends pa{}class Ya extends fa{}class Ka extends ma{}class Qa extends ga{}class Ja extends _a{}class es extends va{}class ts extends ba{}class is extends wa{}class ns extends Ca{}const rs=oa([{name:"a_pos",components:2,type:"Int16"}],4),{members:os}=rs;class as{constructor(e=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=e}prepareSegment(e,t,i,n){const r=this.segments[this.segments.length-1];return e>as.MAX_VERTEX_ARRAY_LENGTH&&q(`Max vertices per segment is ${as.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${as.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!r||r.vertexLength+e>as.MAX_VERTEX_ARRAY_LENGTH||r.sortKey!==n?this.createNewSegment(t,i,n):r}createNewSegment(e,t,i){const n={vertexOffset:e.length,primitiveOffset:t.length,vertexLength:0,primitiveLength:0,vaos:{}};return void 0!==i&&(n.sortKey=i),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(n),n}getOrCreateLatestSegment(e,t,i){return this.prepareSegment(0,e,t,i)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(const e of this.segments)for(const t in e.vaos)e.vaos[t].destroy()}static simpleSegment(e,t,i,n){return new as([{vertexOffset:e,primitiveOffset:t,vertexLength:i,primitiveLength:n,vaos:{},sortKey:0}])}}function ss(e,t){return 256*(e=B(Math.floor(e),0,255))+B(Math.floor(t),0,255)}as.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,fo("SegmentVector",as);const ls=oa([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]),cs=oa([{name:"a_dasharray_from",components:4,type:"Uint16"},{name:"a_dasharray_to",components:4,type:"Uint16"}]);var us,hs,ds,ps={exports:{}},fs={exports:{}},ms={exports:{}},gs=function(){if(ds)return ps.exports;ds=1;var e=(us||(us=1,fs.exports=function(e,t){var i,n,r,o,a,s,l,c;for(n=e.length-(i=3&e.length),r=t,a=3432918353,s=461845907,c=0;c<n;)l=255&e.charCodeAt(c)|(255&e.charCodeAt(++c))<<8|(255&e.charCodeAt(++c))<<16|(255&e.charCodeAt(++c))<<24,++c,r=27492+(65535&(o=5*(65535&(r=(r^=l=(65535&(l=(l=(65535&l)*a+(((l>>>16)*a&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295)<<13|r>>>19))+((5*(r>>>16)&65535)<<16)&4294967295))+((58964+(o>>>16)&65535)<<16);switch(l=0,i){case 3:l^=(255&e.charCodeAt(c+2))<<16;case 2:l^=(255&e.charCodeAt(c+1))<<8;case 1:r^=l=(65535&(l=(l=(65535&(l^=255&e.charCodeAt(c)))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295}return r^=e.length,r=2246822507*(65535&(r^=r>>>16))+((2246822507*(r>>>16)&65535)<<16)&4294967295,r=3266489909*(65535&(r^=r>>>13))+((3266489909*(r>>>16)&65535)<<16)&4294967295,(r^=r>>>16)>>>0}),fs.exports),t=(hs||(hs=1,ms.exports=function(e,t){for(var i,n=e.length,r=t^n,o=0;n>=4;)i=1540483477*(65535&(i=255&e.charCodeAt(o)|(255&e.charCodeAt(++o))<<8|(255&e.charCodeAt(++o))<<16|(255&e.charCodeAt(++o))<<24))+((1540483477*(i>>>16)&65535)<<16),r=1540483477*(65535&r)+((1540483477*(r>>>16)&65535)<<16)^(i=1540483477*(65535&(i^=i>>>24))+((1540483477*(i>>>16)&65535)<<16)),n-=4,++o;switch(n){case 3:r^=(255&e.charCodeAt(o+2))<<16;case 2:r^=(255&e.charCodeAt(o+1))<<8;case 1:r=1540483477*(65535&(r^=255&e.charCodeAt(o)))+((1540483477*(r>>>16)&65535)<<16)}return r=1540483477*(65535&(r^=r>>>13))+((1540483477*(r>>>16)&65535)<<16),(r^=r>>>15)>>>0}),ms.exports);return ps.exports=e,ps.exports.murmur3=e,ps.exports.murmur2=t,ps.exports}(),_s=r(gs);class ys{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,t,i,n){this.ids.push(vs(e)),this.positions.push(t,i,n)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const t=vs(e);let i=0,n=this.ids.length-1;for(;i<n;){const e=i+n>>1;this.ids[e]>=t?n=e:i=e+1}const r=[];for(;this.ids[i]===t;)r.push({index:this.positions[3*i],start:this.positions[3*i+1],end:this.positions[3*i+2]}),i++;return r}static serialize(e,t){const i=new Float64Array(e.ids),n=new Uint32Array(e.positions);return xs(i,n,0,i.length-1),t&&t.push(i.buffer,n.buffer),{ids:i,positions:n}}static deserialize(e){const t=new ys;return t.ids=e.ids,t.positions=e.positions,t.indexed=!0,t}}function vs(e){const t=+e;return!isNaN(t)&&t<=Number.MAX_SAFE_INTEGER?t:_s(String(e))}function xs(e,t,i,n){for(;i<n;){const r=e[i+n>>1];let o=i-1,a=n+1;for(;;){do{o++}while(e[o]<r);do{a--}while(e[a]>r);if(o>=a)break;bs(e,o,a),bs(t,3*o,3*a),bs(t,3*o+1,3*a+1),bs(t,3*o+2,3*a+2)}a-i<n-a?(xs(e,t,i,a),i=a+1):(xs(e,t,a+1,n),n=a)}}function bs(e,t,i){const n=e[t];e[t]=e[i],e[i]=n}fo("FeaturePositionMap",ys);class ws{constructor(e,t){this.gl=e.gl,this.location=t}}class Ts extends ws{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}}class Ss extends ws{constructor(e,t){super(e,t),this.current=[0,0,0,0]}set(e){e[0]===this.current[0]&&e[1]===this.current[1]&&e[2]===this.current[2]&&e[3]===this.current[3]||(this.current=e,this.gl.uniform4f(this.location,e[0],e[1],e[2],e[3]))}}class Ps extends ws{constructor(e,t){super(e,t),this.current=Ct.transparent}set(e){e.r===this.current.r&&e.g===this.current.g&&e.b===this.current.b&&e.a===this.current.a||(this.current=e,this.gl.uniform4f(this.location,e.r,e.g,e.b,e.a))}}const Ms=new Float32Array(16);function Es(e){return[ss(255*e.r,255*e.g),ss(255*e.b,255*e.a)]}class Cs{constructor(e,t,i){this.value=e,this.uniformNames=t.map(e=>`u_${e}`),this.type=i}setUniform(e,t,i){e.set(i.constantOr(this.value))}getBinding(e,t,i){return"color"===this.type?new Ps(e,t):new Ts(e,t)}}class ks{constructor(e,t){this.uniformNames=t.map(e=>`u_${e}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,t){this.pixelRatioFrom=t.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=t.tlbr,this.patternTo=e.tlbr}setConstantDashPositions(e,t){this.dashTo=[0,e.y,e.height,e.width],this.dashFrom=[0,t.y,t.height,t.width]}setUniform(e,t,i,n){let r=null;"u_pattern_to"===n?r=this.patternTo:"u_pattern_from"===n?r=this.patternFrom:"u_dasharray_to"===n?r=this.dashTo:"u_dasharray_from"===n?r=this.dashFrom:"u_pixel_ratio_to"===n?r=this.pixelRatioTo:"u_pixel_ratio_from"===n&&(r=this.pixelRatioFrom),null!==r&&e.set(r)}getBinding(e,t,i){return"u_pattern"===i.substr(0,9)||"u_dasharray_"===i.substr(0,12)?new Ss(e,t):new Ts(e,t)}}class Is{constructor(e,t,i,n){this.expression=e,this.type=i,this.maxValue=0,this.paintVertexAttributes=t.map(e=>({name:`a_${e}`,type:"Float32",components:"color"===i?2:1,offset:0})),this.paintVertexArray=new n}populatePaintArray(e,t,i){const n=this.paintVertexArray.length,r=this.expression.evaluate(new Ro(0,i),t,{},i.canonical,[],i.formattedSection);this.paintVertexArray.resize(e),this._setPaintValue(n,e,r)}updatePaintArray(e,t,i,n,r){const o=this.expression.evaluate(new Ro(0,r),i,n);this._setPaintValue(e,t,o)}_setPaintValue(e,t,i){if("color"===this.type){const n=Es(i);for(let i=e;i<t;i++)this.paintVertexArray.emplace(i,n[0],n[1])}else{for(let n=e;n<t;n++)this.paintVertexArray.emplace(n,i);this.maxValue=Math.max(this.maxValue,Math.abs(i))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class zs{constructor(e,t,i,n,r,o){this.expression=e,this.uniformNames=t.map(e=>`u_${e}_t`),this.type=i,this.useIntegerZoom=n,this.zoom=r,this.maxValue=0,this.paintVertexAttributes=t.map(e=>({name:`a_${e}`,type:"Float32",components:"color"===i?4:2,offset:0})),this.paintVertexArray=new o}populatePaintArray(e,t,i){const n=this.expression.evaluate(new Ro(this.zoom,i),t,{},i.canonical,[],i.formattedSection),r=this.expression.evaluate(new Ro(this.zoom+1,i),t,{},i.canonical,[],i.formattedSection),o=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(o,e,n,r)}updatePaintArray(e,t,i,n,r){const o=this.expression.evaluate(new Ro(this.zoom,r),i,n),a=this.expression.evaluate(new Ro(this.zoom+1,r),i,n);this._setPaintValue(e,t,o,a)}_setPaintValue(e,t,i,n){if("color"===this.type){const r=Es(i),o=Es(n);for(let i=e;i<t;i++)this.paintVertexArray.emplace(i,r[0],r[1],o[0],o[1])}else{for(let r=e;r<t;r++)this.paintVertexArray.emplace(r,i,n);this.maxValue=Math.max(this.maxValue,Math.abs(i),Math.abs(n))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,t){const i=this.useIntegerZoom?Math.floor(t.zoom):t.zoom,n=B(this.expression.interpolationFactor(i,this.zoom,this.zoom+1),0,1);e.set(n)}getBinding(e,t,i){return new Ts(e,t)}}class As{constructor(e,t,i,n,r,o){this.expression=e,this.type=t,this.useIntegerZoom=i,this.zoom=n,this.layerId=o,this.zoomInPaintVertexArray=new r,this.zoomOutPaintVertexArray=new r}populatePaintArray(e,t,i){const n=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(n,e,this.getPositionIds(t),i)}updatePaintArray(e,t,i,n,r){this._setPaintValues(e,t,this.getPositionIds(i),r)}_setPaintValues(e,t,i,n){const r=this.getPositions(n);if(!r||!i)return;const o=r[i.min],a=r[i.mid],s=r[i.max];if(o&&a&&s)for(let l=e;l<t;l++)this.emplace(this.zoomInPaintVertexArray,l,a,o),this.emplace(this.zoomOutPaintVertexArray,l,a,s)}upload(e){if(this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer){const t=this.getVertexAttributes();this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,t,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,t,this.expression.isStateDependent)}}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class Ls extends As{getPositions(e){return e.imagePositions}getPositionIds(e){return e.patterns&&e.patterns[this.layerId]}getVertexAttributes(){return ls.members}emplace(e,t,i,n){e.emplace(t,i.tlbr[0],i.tlbr[1],i.tlbr[2],i.tlbr[3],n.tlbr[0],n.tlbr[1],n.tlbr[2],n.tlbr[3],i.pixelRatio,n.pixelRatio)}}class Ds extends As{getPositions(e){return e.dashPositions}getPositionIds(e){return e.dashes&&e.dashes[this.layerId]}getVertexAttributes(){return cs.members}emplace(e,t,i,n){e.emplace(t,0,i.y,i.height,i.width,0,n.y,n.height,n.width)}}class Rs{constructor(e,t,i){this.binders={},this._buffers=[];const n=[];for(const r in e.paint._values){if(!i(r))continue;const o=e.paint.get(r);if(!(o instanceof Go&&Gn(o.property.specification)))continue;const a=Bs(r,e.type),s=o.value,l=o.property.specification.type,c=o.property.useIntegerZoom,u=o.property.specification["property-type"],h="cross-faded"===u||"cross-faded-data-driven"===u;if("constant"===s.kind)this.binders[r]=h?new ks(s.value,a):new Cs(s.value,a,l),n.push(`/u_${r}`);else if("source"===s.kind||h){const i=Os(r,l,"source");this.binders[r]=h?"line-dasharray"===r?new Ds(s,l,c,t,i,e.id):new Ls(s,l,c,t,i,e.id):new Is(s,a,l,i),n.push(`/a_${r}`)}else{const e=Os(r,l,"composite");this.binders[r]=new zs(s,a,l,c,t,e),n.push(`/z_${r}`)}}this.cacheKey=n.sort().join("")}getMaxValue(e){const t=this.binders[e];return t instanceof Is||t instanceof zs?t.maxValue:0}populatePaintArrays(e,t,i){for(const n in this.binders){const r=this.binders[n];(r instanceof Is||r instanceof zs||r instanceof As)&&r.populatePaintArray(e,t,i)}}setConstantPatternPositions(e,t){for(const i in this.binders){const n=this.binders[i];n instanceof ks&&n.setConstantPatternPositions(e,t)}}setConstantDashPositions(e,t){for(const i in this.binders){const n=this.binders[i];n instanceof ks&&n.setConstantDashPositions(e,t)}}updatePaintArrays(e,t,i,n,r){let o=!1;for(const a in e){const s=t.getPositions(a);for(const t of s){const s=i.feature(t.index);for(const i in this.binders){const l=this.binders[i];if((l instanceof Is||l instanceof zs||l instanceof As)&&!0===l.expression.isStateDependent){const c=n.paint.get(i);l.expression=c.value,l.updatePaintArray(t.start,t.end,s,e[a],r),o=!0}}}}return o}defines(){const e=[];for(const t in this.binders){const i=this.binders[t];(i instanceof Cs||i instanceof ks)&&e.push(...i.uniformNames.map(e=>`#define HAS_UNIFORM_${e}`))}return e}getBinderAttributes(){const e=[];for(const t in this.binders){const i=this.binders[t];if(i instanceof Is||i instanceof zs)for(let t=0;t<i.paintVertexAttributes.length;t++)e.push(i.paintVertexAttributes[t].name);else if(i instanceof As){const t=i.getVertexAttributes();for(const i of t)e.push(i.name)}}return e}getBinderUniforms(){const e=[];for(const t in this.binders){const i=this.binders[t];if(i instanceof Cs||i instanceof ks||i instanceof zs)for(const t of i.uniformNames)e.push(t)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,t){const i=[];for(const n in this.binders){const r=this.binders[n];if(r instanceof Cs||r instanceof ks||r instanceof zs)for(const o of r.uniformNames)if(t[o]){const a=r.getBinding(e,t[o],o);i.push({name:o,property:n,binding:a})}}return i}setUniforms(e,t,i,n){for(const{name:r,property:o,binding:a}of t)this.binders[o].setUniform(a,n,i.get(o),r)}updatePaintBuffers(e){this._buffers=[];for(const t in this.binders){const i=this.binders[t];if(e&&i instanceof As){const t=2===e.fromScale?i.zoomInPaintVertexBuffer:i.zoomOutPaintVertexBuffer;t&&this._buffers.push(t)}else(i instanceof Is||i instanceof zs)&&i.paintVertexBuffer&&this._buffers.push(i.paintVertexBuffer)}}upload(e){for(const t in this.binders){const i=this.binders[t];(i instanceof Is||i instanceof zs||i instanceof As)&&i.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const t=this.binders[e];(t instanceof Is||t instanceof zs||t instanceof As)&&t.destroy()}}}class Fs{constructor(e,t,i=()=>!0){this.programConfigurations={};for(const n of e)this.programConfigurations[n.id]=new Rs(n,t,i);this.needsUpload=!1,this._featureMap=new ys,this._bufferOffset=0}populatePaintArrays(e,t,i,n){for(const r in this.programConfigurations)this.programConfigurations[r].populatePaintArrays(e,t,n);void 0!==t.id&&this._featureMap.add(t.id,i,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,t,i,n){for(const r of i)this.needsUpload=this.programConfigurations[r.id].updatePaintArrays(e,this._featureMap,t,r,n)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const t in this.programConfigurations)this.programConfigurations[t].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}function Bs(e,t){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-dasharray":["dasharray_to","dasharray_from"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[e]||[e.replace(`${t}-`,"").replace(/-/g,"_")]}function Os(e,t,i){const n={color:{source:da,composite:Ia},number:{source:Pa,composite:da}},r={"line-pattern":{source:Xa,composite:Xa},"fill-pattern":{source:Xa,composite:Xa},"fill-extrusion-pattern":{source:Xa,composite:Xa},"line-dasharray":{source:Ya,composite:Ya}}[e];return r&&r[i]||n[t][i]}fo("ConstantBinder",Cs),fo("CrossFadedConstantBinder",ks),fo("SourceExpressionBinder",Is),fo("CrossFadedPatternBinder",Ls),fo("CrossFadedDasharrayBinder",Ds),fo("CompositeExpressionBinder",zs),fo("ProgramConfiguration",Rs,{omit:["_buffers"]}),fo("ProgramConfigurationSet",Fs);const Ns=Math.pow(2,14)-1,js=-Ns-1;function Vs(e){const t=I/e.extent,i=e.loadGeometry();for(let n=0;n<i.length;n++){const e=i[n];for(let i=0;i<e.length;i++){const n=e[i],r=Math.round(n.x*t),o=Math.round(n.y*t);n.x=B(r,js,Ns),n.y=B(o,js,Ns),(r<n.x||r>n.x+1||o<n.y||o>n.y+1)&&q("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return i}function Us(e,t){return{type:e.type,id:e.id,properties:e.properties,geometry:t?Vs(e):[]}}const Zs=-32768;function Gs(e,t,i,n,r){e.emplaceBack(Zs+8*t+n,Zs+8*i+r)}class qs{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.id),this.index=e.index,this.hasDependencies=!1,this.layoutVertexArray=new Ga,this.indexArray=new is,this.segments=new as,this.programConfigurations=new Fs(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(e,t,i){const n=this.layers[0],r=[];let o=null,a=!1,s="heatmap"===n.type;if("circle"===n.type){const e=n;o=e.layout.get("circle-sort-key"),a=!o.isConstant(),s=s||"map"===e.paint.get("circle-pitch-alignment")}const l=s?t.subdivisionGranularity.circle:1;for(const{feature:c,id:u,index:h,sourceLayerIndex:d}of e){const e=this.layers[0]._featureFilter.needGeometry,t=Us(c,e);if(!this.layers[0]._featureFilter.filter(new Ro(this.zoom),t,i))continue;const n=a?o.evaluate(t,{},i):void 0,s={id:u,properties:c.properties,type:c.type,sourceLayerIndex:d,index:h,geometry:e?t.geometry:Vs(c),patterns:{},sortKey:n};r.push(s)}a&&r.sort((e,t)=>e.sortKey-t.sortKey);for(const c of r){const{geometry:n,index:r,sourceLayerIndex:o}=c,a=e[r].feature;this.addFeature(c,n,r,i,l),t.featureIndex.insert(a,n,r,o,this.index)}}update(e,t,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,{imagePositions:i})}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,os),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,t,i,n,r=1){let o;switch(r){case 1:o=[0,7];break;case 3:o=[0,2,5,7];break;case 5:o=[0,1,3,4,6,7];break;case 7:o=[0,1,2,3,4,5,6,7];break;default:throw new Error(`Invalid circle bucket granularity: ${r}; valid values are 1, 3, 5, 7.`)}const a=o.length;for(const s of t)for(const t of s){const i=t.x,n=t.y;if(i<0||i>=I||n<0||n>=I)continue;const r=this.segments.prepareSegment(a*a,this.layoutVertexArray,this.indexArray,e.sortKey),s=r.vertexLength;for(let e=0;e<a;e++)for(let t=0;t<a;t++)Gs(this.layoutVertexArray,i,n,o[t],o[e]);for(let e=0;e<a-1;e++)for(let t=0;t<a-1;t++){const i=s+e*a+t,n=s+(e+1)*a+t;this.indexArray.emplaceBack(i,n+1,i+1),this.indexArray.emplaceBack(i,n,n+1)}r.vertexLength+=a*a,r.primitiveLength+=(a-1)*(a-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,{imagePositions:{},canonical:n})}}function $s(e,t){for(let i=0;i<e.length;i++)if(tl(t,e[i]))return!0;for(let i=0;i<t.length;i++)if(tl(e,t[i]))return!0;return!!Ys(e,t)}function Ws(e,t,i){return!!tl(e,t)||!!Qs(t,e,i)}function Hs(e,t){if(1===e.length)return el(t,e[0]);for(let i=0;i<t.length;i++){const n=t[i];for(let t=0;t<n.length;t++)if(tl(e,n[t]))return!0}for(let i=0;i<e.length;i++)if(el(t,e[i]))return!0;for(let i=0;i<t.length;i++)if(Ys(e,t[i]))return!0;return!1}function Xs(e,t,i){if(e.length>1){if(Ys(e,t))return!0;for(let n=0;n<t.length;n++)if(Qs(t[n],e,i))return!0}for(let n=0;n<e.length;n++)if(Qs(e[n],t,i))return!0;return!1}function Ys(e,t){if(0===e.length||0===t.length)return!1;for(let i=0;i<e.length-1;i++){const n=e[i],r=e[i+1];for(let e=0;e<t.length-1;e++)if(Ks(n,r,t[e],t[e+1]))return!0}return!1}function Ks(e,t,i,n){return $(e,i,n)!==$(t,i,n)&&$(e,t,i)!==$(e,t,n)}function Qs(e,t,i){const n=i*i;if(1===t.length)return e.distSqr(t[0])<n;for(let r=1;r<t.length;r++)if(Js(e,t[r-1],t[r])<n)return!0;return!1}function Js(e,t,i){const n=t.distSqr(i);if(0===n)return e.distSqr(t);const r=((e.x-t.x)*(i.x-t.x)+(e.y-t.y)*(i.y-t.y))/n;return e.distSqr(r<0?t:r>1?i:i.sub(t)._mult(r)._add(t))}function el(e,t){let i,n,r,o=!1;for(let a=0;a<e.length;a++){i=e[a];for(let e=0,a=i.length-1;e<i.length;a=e++)n=i[e],r=i[a],n.y>t.y!=r.y>t.y&&t.x<(r.x-n.x)*(t.y-n.y)/(r.y-n.y)+n.x&&(o=!o)}return o}function tl(e,t){let i=!1;for(let n=0,r=e.length-1;n<e.length;r=n++){const o=e[n],a=e[r];o.y>t.y!=a.y>t.y&&t.x<(a.x-o.x)*(t.y-o.y)/(a.y-o.y)+o.x&&(i=!i)}return i}function il(e,t,i){const n=i[0],r=i[2];if(e.x<n.x&&t.x<n.x||e.x>r.x&&t.x>r.x||e.y<n.y&&t.y<n.y||e.y>r.y&&t.y>r.y)return!1;const o=$(e,t,i[0]);return o!==$(e,t,i[1])||o!==$(e,t,i[2])||o!==$(e,t,i[3])}function nl(e,t,i){const n=t.paint.get(e).value;return"constant"===n.kind?n.value:i.programConfigurations.get(t.id).getMaxValue(e)}function rl(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function ol(e,t,i,r,o){if(!t[0]&&!t[1])return e;const a=n.convert(t)._mult(o);"viewport"===i&&a._rotate(-r);const s=[];for(let n=0;n<e.length;n++)s.push(e[n].sub(a));return s}function al(e){const t=[];for(let i=0;i<e.length;i++){const n=e[i],r=t.at(-1);(0===i||r&&!n.equals(r))&&t.push(n)}return t}function sl({queryGeometry:e,size:t},i){return Ws(e,i,t)}function ll({queryGeometry:e,size:t,transform:i,unwrappedTileID:n,getElevation:r},o){return Ws(e,o,t*(i.projectTileCoordinates(o.x,o.y,n,r).signedDistanceFromCamera/i.cameraToCenterDistance))}function cl({queryGeometry:e,size:t,transform:i,unwrappedTileID:n,getElevation:r},o){const a=i.projectTileCoordinates(o.x,o.y,n,r).signedDistanceFromCamera,s=t*(i.cameraToCenterDistance/a);return Ws(e,dl(o,i,n,r),s)}function ul({queryGeometry:e,size:t,transform:i,unwrappedTileID:n,getElevation:r},o){return Ws(e,dl(o,i,n,r),t)}function hl({queryGeometry:e,size:t,transform:i,unwrappedTileID:n,getElevation:r,pitchAlignment:o="map",pitchScale:a="map"},s){const l="map"===o?"map"===a?sl:ll:"map"===a?cl:ul,c={queryGeometry:e,size:t,transform:i,unwrappedTileID:n,getElevation:r};for(const u of s)for(const e of u)if(l(c,e))return!0;return!1}function dl(e,t,i,r){const o=t.projectTileCoordinates(e.x,e.y,i,r).point;return new n((.5*o.x+.5)*t.width,(.5*-o.y+.5)*t.height)}let pl,fl;fo("CircleBucket",qs,{omit:["layers"]});var ml={get paint(){return fl=fl||new Ko({"circle-radius":new Wo(xe.paint_circle["circle-radius"]),"circle-color":new Wo(xe.paint_circle["circle-color"]),"circle-blur":new Wo(xe.paint_circle["circle-blur"]),"circle-opacity":new Wo(xe.paint_circle["circle-opacity"]),"circle-translate":new $o(xe.paint_circle["circle-translate"]),"circle-translate-anchor":new $o(xe.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new $o(xe.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new $o(xe.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Wo(xe.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Wo(xe.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Wo(xe.paint_circle["circle-stroke-opacity"])})},get layout(){return pl=pl||new Ko({"circle-sort-key":new Wo(xe.layout_circle["circle-sort-key"])})}};class gl extends Qo{constructor(e,t){super(e,ml,t)}createBucket(e){return new qs(e)}queryRadius(e){const t=e;return nl("circle-radius",this,t)+nl("circle-stroke-width",this,t)+rl(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:i,geometry:n,transform:r,pixelsToTileUnits:o,unwrappedTileID:a,getElevation:s}){const l=ol(e,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-r.bearingInRadians,o),c=this.paint.get("circle-radius").evaluate(t,i)+this.paint.get("circle-stroke-width").evaluate(t,i),u=this.paint.get("circle-pitch-scale"),h=this.paint.get("circle-pitch-alignment");let d,p;return"map"===h?(d=l,p=c*o):(f=r,m=a,g=s,d=l.map(e=>dl(e,f,m,g)),p=c),hl({queryGeometry:d,size:p,transform:r,unwrappedTileID:a,getElevation:s,pitchAlignment:h,pitchScale:u},n);var f,m,g}}class _l extends qs{}let yl;fo("HeatmapBucket",_l,{omit:["layers"]});var vl={get paint(){return yl=yl||new Ko({"heatmap-radius":new Wo(xe.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Wo(xe.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new $o(xe.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Yo(xe.paint_heatmap["heatmap-color"]),"heatmap-opacity":new $o(xe.paint_heatmap["heatmap-opacity"])})}};function xl(e,{width:t,height:i},n,r){if(r){if(r instanceof Uint8ClampedArray)r=new Uint8Array(r.buffer);else if(r.length!==t*i*n)throw new RangeError(`mismatched image size. expected: ${r.length} but got: ${t*i*n}`)}else r=new Uint8Array(t*i*n);return e.width=t,e.height=i,e.data=r,e}function bl(e,{width:t,height:i},n){if(t===e.width&&i===e.height)return;const r=xl({},{width:t,height:i},n);wl(e,r,{x:0,y:0},{x:0,y:0},{width:Math.min(e.width,t),height:Math.min(e.height,i)},n),e.width=t,e.height=i,e.data=r.data}function wl(e,t,i,n,r,o){if(0===r.width||0===r.height)return t;if(r.width>e.width||r.height>e.height||i.x>e.width-r.width||i.y>e.height-r.height)throw new RangeError("out of range source coordinates for image copy");if(r.width>t.width||r.height>t.height||n.x>t.width-r.width||n.y>t.height-r.height)throw new RangeError("out of range destination coordinates for image copy");const a=e.data,s=t.data;if(a===s)throw new Error("srcData equals dstData, so image is already copied");for(let l=0;l<r.height;l++){const c=((i.y+l)*e.width+i.x)*o,u=((n.y+l)*t.width+n.x)*o;for(let e=0;e<r.width*o;e++)s[u+e]=a[c+e]}return t}class Tl{constructor(e,t){xl(this,e,1,t)}resize(e){bl(this,e,1)}clone(){return new Tl({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,i,n,r){wl(e,t,i,n,r,1)}}class Sl{constructor(e,t){xl(this,e,4,t)}resize(e){bl(this,e,4)}replace(e,t){t?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new Sl({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,i,n,r){wl(e,t,i,n,r,4)}setPixel(e,t,i){const n=4*(e*this.width+t);this.data[n+0]=Math.round(255*i.r/i.a),this.data[n+1]=Math.round(255*i.g/i.a),this.data[n+2]=Math.round(255*i.b/i.a),this.data[n+3]=Math.round(255*i.a)}}function Pl(e){const t={},i=e.resolution||256,n=e.clips?e.clips.length:1,r=e.image||new Sl({width:i,height:n});if(Math.log(i)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${i}`);const o=(n,o,a)=>{t[e.evaluationKey]=a;const s=e.expression.evaluate(t);r.setPixel(n/4/i,o/4,s)};if(e.clips)for(let a=0,s=0;a<n;++a,s+=4*i)for(let t=0,n=0;t<i;t++,n+=4){const r=t/(i-1),{start:l,end:c}=e.clips[a];o(s,n,l*(1-r)+c*r)}else for(let a=0,s=0;a<i;a++,s+=4)o(0,s,a/(i-1));return r}fo("AlphaImage",Tl),fo("RGBAImage",Sl);const Ml="big-fb";class El extends Qo{createBucket(e){return new _l(e)}constructor(e,t){super(e,vl,t),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){"heatmap-color"===e&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Pl({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(Ml)&&this.heatmapFbos.delete(Ml)}queryRadius(e){return nl("heatmap-radius",this,e)}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:i,geometry:n,transform:r,pixelsToTileUnits:o,unwrappedTileID:a,getElevation:s}){return hl({queryGeometry:e,size:this.paint.get("heatmap-radius").evaluate(t,i)*o,transform:r,unwrappedTileID:a,getElevation:s},n)}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&!this.isHidden()}}let Cl;var kl={get paint(){return Cl=Cl||new Ko({"hillshade-illumination-direction":new $o(xe.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-altitude":new $o(xe.paint_hillshade["hillshade-illumination-altitude"]),"hillshade-illumination-anchor":new $o(xe.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new $o(xe.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new $o(xe.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new $o(xe.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new $o(xe.paint_hillshade["hillshade-accent-color"]),"hillshade-method":new $o(xe.paint_hillshade["hillshade-method"])})}};class Il extends Qo{constructor(e,t){super(e,kl,t),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let e=this.paint.get("hillshade-illumination-direction").values,t=this.paint.get("hillshade-illumination-altitude").values,i=this.paint.get("hillshade-highlight-color").values,n=this.paint.get("hillshade-shadow-color").values;const r=Math.max(e.length,t.length,i.length,n.length);e=e.concat(Array(r-e.length).fill(e.at(-1))),t=t.concat(Array(r-t.length).fill(t.at(-1))),i=i.concat(Array(r-i.length).fill(i.at(-1))),n=n.concat(Array(r-n.length).fill(n.at(-1)));const o=t.map(te);return{directionRadians:e.map(te),altitudeRadians:o,shadowColor:n,highlightColor:i}}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&!this.isHidden()}}let zl;var Al={get paint(){return zl=zl||new Ko({"color-relief-opacity":new $o(xe["paint_color-relief"]["color-relief-opacity"]),"color-relief-color":new Yo(xe["paint_color-relief"]["color-relief-color"])})}};class Ll{constructor(e,t,i,n){this.context=e,this.format=i,this.texture=e.gl.createTexture(),this.update(t,n)}update(e,t,i){const{width:n,height:r}=e,o=!(this.size&&this.size[0]===n&&this.size[1]===r||i),{context:a}=this,{gl:s}=a;if(this.useMipmap=Boolean(t&&t.useMipmap),s.bindTexture(s.TEXTURE_2D,this.texture),a.pixelStoreUnpackFlipY.set(!1),a.pixelStoreUnpack.set(1),a.pixelStoreUnpackPremultiplyAlpha.set(this.format===s.RGBA&&(!t||!1!==t.premultiply)),o)this.size=[n,r],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||X(e)?s.texImage2D(s.TEXTURE_2D,0,this.format,this.format,s.UNSIGNED_BYTE,e):s.texImage2D(s.TEXTURE_2D,0,this.format,n,r,0,this.format,s.UNSIGNED_BYTE,e.data);else{const{x:t,y:o}=i||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||X(e)?s.texSubImage2D(s.TEXTURE_2D,0,t,o,s.RGBA,s.UNSIGNED_BYTE,e):s.texSubImage2D(s.TEXTURE_2D,0,t,o,n,r,s.RGBA,s.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&s.generateMipmap(s.TEXTURE_2D),a.pixelStoreUnpackFlipY.setDefault(),a.pixelStoreUnpack.setDefault(),a.pixelStoreUnpackPremultiplyAlpha.setDefault()}bind(e,t,i){const{context:n}=this,{gl:r}=n;r.bindTexture(r.TEXTURE_2D,this.texture),i!==r.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(i=r.LINEAR),e!==this.filter&&(r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,e),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,i||e),this.filter=e),t!==this.wrap&&(r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,t),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,t),this.wrap=t)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}class Dl{constructor(e,t,i,n=1,r=1,o=1,a=0){if(this.uid=e,t.height!==t.width)throw new RangeError("DEM tiles must be square");if(i&&!["mapbox","terrarium","custom"].includes(i))return void q(`"${i}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=t.height;const s=this.dim=t.height-2;switch(this.data=new Uint32Array(t.data.buffer),i){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=n,this.greenFactor=r,this.blueFactor=o,this.baseShift=a;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let l=0;l<s;l++)this.data[this._idx(-1,l)]=this.data[this._idx(0,l)],this.data[this._idx(s,l)]=this.data[this._idx(s-1,l)],this.data[this._idx(l,-1)]=this.data[this._idx(l,0)],this.data[this._idx(l,s)]=this.data[this._idx(l,s-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(s,-1)]=this.data[this._idx(s-1,0)],this.data[this._idx(-1,s)]=this.data[this._idx(0,s-1)],this.data[this._idx(s,s)]=this.data[this._idx(s-1,s-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let l=0;l<s;l++)for(let e=0;e<s;e++){const t=this.get(l,e);t>this.max&&(this.max=t),t<this.min&&(this.min=t)}}get(e,t){const i=new Uint8Array(this.data.buffer),n=4*this._idx(e,t);return this.unpack(i[n],i[n+1],i[n+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(e,t){if(e<-1||e>=this.dim+1||t<-1||t>=this.dim+1)throw new RangeError(`Out of range source coordinates for DEM data. x: ${e}, y: ${t}, dim: ${this.dim}`);return(t+1)*this.stride+(e+1)}unpack(e,t,i){return e*this.redFactor+t*this.greenFactor+i*this.blueFactor-this.baseShift}pack(e){return Rl(e,this.getUnpackVector())}getPixels(){return new Sl({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,t,i){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let n=t*this.dim,r=t*this.dim+this.dim,o=i*this.dim,a=i*this.dim+this.dim;switch(t){case-1:n=r-1;break;case 1:r=n+1}switch(i){case-1:o=a-1;break;case 1:a=o+1}const s=-t*this.dim,l=-i*this.dim;for(let c=o;c<a;c++)for(let t=n;t<r;t++)this.data[this._idx(t,c)]=e.data[this._idx(t+s,c+l)]}}function Rl(e,t){const i=t[0],n=t[1],r=t[2],o=t[3],a=Math.min(i,n,r),s=Math.round((e+o)/a);return{r:Math.floor(s*a/i)%256,g:Math.floor(s*a/n)%256,b:Math.floor(s*a/r)%256}}fo("DEMData",Dl);class Fl extends Qo{constructor(e,t){super(e,Al,t)}_createColorRamp(e){const t={elevationStops:[],colorStops:[]},i=this._transitionablePaint._values["color-relief-color"].value.expression;if(i instanceof or&&i._styleExpression.expression instanceof fi){this.colorRampExpression=i;const e=i._styleExpression.expression;t.elevationStops=e.labels,t.colorStops=[];for(const i of t.elevationStops)t.colorStops.push(e.evaluate({globals:{elevation:i}}))}if(t.elevationStops.length<1&&(t.elevationStops=[0],t.colorStops=[Ct.transparent]),t.elevationStops.length<2&&(t.elevationStops.push(t.elevationStops[0]+1),t.colorStops.push(t.colorStops[0])),t.elevationStops.length<=e)return t;const n={elevationStops:[],colorStops:[]},r=(t.elevationStops.length-1)/(e-1);for(let o=0;o<t.elevationStops.length-.5;o+=r)n.elevationStops.push(t.elevationStops[Math.round(o)]),n.colorStops.push(t.colorStops[Math.round(o)]);return q(`Too many colors in specification of ${this.id} color-relief layer, may not render properly. Max possible colors: ${e}, provided: ${t.elevationStops.length}`),n}_colorRampChanged(){return this.colorRampExpression!=this._transitionablePaint._values["color-relief-color"].value.expression}getColorRampTextures(e,t,i){if(this.colorRampTextures&&!this._colorRampChanged())return this.colorRampTextures;const n=this._createColorRamp(t),r=new Sl({width:n.colorStops.length,height:1}),o=new Sl({width:n.colorStops.length,height:1});for(let a=0;a<n.elevationStops.length;a++){const e=Rl(n.elevationStops[a],i);o.setPixel(0,a,new Ct(e.r/255,e.g/255,e.b/255,1)),r.setPixel(0,a,n.colorStops[a])}return this.colorRampTextures={elevationTexture:new Ll(e,o,e.gl.RGBA),colorTexture:new Ll(e,r,e.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return!this.isHidden()&&!!this.colorRampTextures}}const Bl=oa([{name:"a_pos",components:2,type:"Int16"}],4),{members:Ol}=Bl;function Nl(e,t,i){const n=i.patternDependencies;let r=!1;for(const o of t){const t=o.paint.get(`${e}-pattern`);t.isConstant()||(r=!0);const i=t.constantOr(null);i&&(r=!0,n[i.to]=!0,n[i.from]=!0)}return r}function jl(e,t,i,n,r){const{zoom:o}=n,a=r.patternDependencies;for(const s of t){const t=s.paint.get(`${e}-pattern`).value;if("constant"!==t.kind){let e=t.evaluate({zoom:o-1},i,{},r.availableImages),n=t.evaluate({zoom:o},i,{},r.availableImages),l=t.evaluate({zoom:o+1},i,{},r.availableImages);e=e&&e.name?e.name:e,n=n&&n.name?n.name:n,l=l&&l.name?l.name:l,a[e]=!0,a[n]=!0,a[l]=!0,i.patterns[s.id]={min:e,mid:n,max:l}}}return i}function Vl(e,t,i,n,r){let o;if(r===function(e,t,i,n){let r=0;for(let o=t,a=i-n;o<i;o+=n)r+=(e[a]-e[o])*(e[o+1]+e[a+1]),a=o;return r}(e,t,i,n)>0)for(let a=t;a<i;a+=n)o=cc(a/n|0,e[a],e[a+1],o);else for(let a=i-n;a>=t;a-=n)o=cc(a/n|0,e[a],e[a+1],o);return o&&nc(o,o.next)&&(uc(o),o=o.next),o}function Ul(e,t){if(!e)return e;t||(t=e);let i,n=e;do{if(i=!1,n.steiner||!nc(n,n.next)&&0!==ic(n.prev,n,n.next))n=n.next;else{if(uc(n),n=t=n.prev,n===n.next)break;i=!0}}while(i||n!==t);return t}function Zl(e,t,i,n,r,o,a){if(!e)return;!a&&o&&function(e,t,i,n){let r=e;do{0===r.z&&(r.z=Kl(r.x,r.y,t,i,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==e);r.prevZ.nextZ=null,r.prevZ=null,function(e){let t,i=1;do{let n,r=e;e=null;let o=null;for(t=0;r;){t++;let a=r,s=0;for(let e=0;e<i&&(s++,a=a.nextZ,a);e++);let l=i;for(;s>0||l>0&&a;)0!==s&&(0===l||!a||r.z<=a.z)?(n=r,r=r.nextZ,s--):(n=a,a=a.nextZ,l--),o?o.nextZ=n:e=n,n.prevZ=o,o=n;r=a}o.nextZ=null,i*=2}while(t>1)}(r)}(e,n,r,o);let s=e;for(;e.prev!==e.next;){const l=e.prev,c=e.next;if(o?ql(e,n,r,o):Gl(e))t.push(l.i,e.i,c.i),uc(e),e=c.next,s=c.next;else if((e=c)===s){a?1===a?Zl(e=$l(Ul(e),t),t,i,n,r,o,2):2===a&&Wl(e,t,i,n,r,o):Zl(Ul(e),t,i,n,r,o,1);break}}}function Gl(e){const t=e.prev,i=e,n=e.next;if(ic(t,i,n)>=0)return!1;const r=t.x,o=i.x,a=n.x,s=t.y,l=i.y,c=n.y,u=Math.min(r,o,a),h=Math.min(s,l,c),d=Math.max(r,o,a),p=Math.max(s,l,c);let f=n.next;for(;f!==t;){if(f.x>=u&&f.x<=d&&f.y>=h&&f.y<=p&&ec(r,s,o,l,a,c,f.x,f.y)&&ic(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function ql(e,t,i,n){const r=e.prev,o=e,a=e.next;if(ic(r,o,a)>=0)return!1;const s=r.x,l=o.x,c=a.x,u=r.y,h=o.y,d=a.y,p=Math.min(s,l,c),f=Math.min(u,h,d),m=Math.max(s,l,c),g=Math.max(u,h,d),_=Kl(p,f,t,i,n),y=Kl(m,g,t,i,n);let v=e.prevZ,x=e.nextZ;for(;v&&v.z>=_&&x&&x.z<=y;){if(v.x>=p&&v.x<=m&&v.y>=f&&v.y<=g&&v!==r&&v!==a&&ec(s,u,l,h,c,d,v.x,v.y)&&ic(v.prev,v,v.next)>=0)return!1;if(v=v.prevZ,x.x>=p&&x.x<=m&&x.y>=f&&x.y<=g&&x!==r&&x!==a&&ec(s,u,l,h,c,d,x.x,x.y)&&ic(x.prev,x,x.next)>=0)return!1;x=x.nextZ}for(;v&&v.z>=_;){if(v.x>=p&&v.x<=m&&v.y>=f&&v.y<=g&&v!==r&&v!==a&&ec(s,u,l,h,c,d,v.x,v.y)&&ic(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;x&&x.z<=y;){if(x.x>=p&&x.x<=m&&x.y>=f&&x.y<=g&&x!==r&&x!==a&&ec(s,u,l,h,c,d,x.x,x.y)&&ic(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function $l(e,t){let i=e;do{const n=i.prev,r=i.next.next;!nc(n,r)&&rc(n,i,i.next,r)&&sc(n,r)&&sc(r,n)&&(t.push(n.i,i.i,r.i),uc(i),uc(i.next),i=e=r),i=i.next}while(i!==e);return Ul(i)}function Wl(e,t,i,n,r,o){let a=e;do{let e=a.next.next;for(;e!==a.prev;){if(a.i!==e.i&&tc(a,e)){let s=lc(a,e);return a=Ul(a,a.next),s=Ul(s,s.next),Zl(a,t,i,n,r,o,0),void Zl(s,t,i,n,r,o,0)}e=e.next}a=a.next}while(a!==e)}function Hl(e,t){let i=e.x-t.x;return 0===i&&(i=e.y-t.y,0===i)&&(i=(e.next.y-e.y)/(e.next.x-e.x)-(t.next.y-t.y)/(t.next.x-t.x)),i}function Xl(e,t){const i=function(e,t){let i=t;const n=e.x,r=e.y;let o,a=-1/0;if(nc(e,i))return i;do{if(nc(e,i.next))return i.next;if(r<=i.y&&r>=i.next.y&&i.next.y!==i.y){const e=i.x+(r-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(e<=n&&e>a&&(a=e,o=i.x<i.next.x?i:i.next,e===n))return o}i=i.next}while(i!==t);if(!o)return null;const s=o,l=o.x,c=o.y;let u=1/0;i=o;do{if(n>=i.x&&i.x>=l&&n!==i.x&&Jl(r<c?n:a,r,l,c,r<c?a:n,r,i.x,i.y)){const t=Math.abs(r-i.y)/(n-i.x);sc(i,e)&&(t<u||t===u&&(i.x>o.x||i.x===o.x&&Yl(o,i)))&&(o=i,u=t)}i=i.next}while(i!==s);return o}(e,t);if(!i)return t;const n=lc(i,e);return Ul(n,n.next),Ul(i,i.next)}function Yl(e,t){return ic(e.prev,e,t.prev)<0&&ic(t.next,e,e.next)<0}function Kl(e,t,i,n,r){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-i)*r|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Ql(e){let t=e,i=e;do{(t.x<i.x||t.x===i.x&&t.y<i.y)&&(i=t),t=t.next}while(t!==e);return i}function Jl(e,t,i,n,r,o,a,s){return(r-a)*(t-s)>=(e-a)*(o-s)&&(e-a)*(n-s)>=(i-a)*(t-s)&&(i-a)*(o-s)>=(r-a)*(n-s)}function ec(e,t,i,n,r,o,a,s){return!(e===a&&t===s)&&Jl(e,t,i,n,r,o,a,s)}function tc(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){let i=e;do{if(i.i!==e.i&&i.next.i!==e.i&&i.i!==t.i&&i.next.i!==t.i&&rc(i,i.next,e,t))return!0;i=i.next}while(i!==e);return!1}(e,t)&&(sc(e,t)&&sc(t,e)&&function(e,t){let i=e,n=!1;const r=(e.x+t.x)/2,o=(e.y+t.y)/2;do{i.y>o!=i.next.y>o&&i.next.y!==i.y&&r<(i.next.x-i.x)*(o-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==e);return n}(e,t)&&(ic(e.prev,e,t.prev)||ic(e,t.prev,t))||nc(e,t)&&ic(e.prev,e,e.next)>0&&ic(t.prev,t,t.next)>0)}function ic(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function nc(e,t){return e.x===t.x&&e.y===t.y}function rc(e,t,i,n){const r=ac(ic(e,t,i)),o=ac(ic(e,t,n)),a=ac(ic(i,n,e)),s=ac(ic(i,n,t));return r!==o&&a!==s||!(0!==r||!oc(e,i,t))||!(0!==o||!oc(e,n,t))||!(0!==a||!oc(i,e,n))||!(0!==s||!oc(i,t,n))}function oc(e,t,i){return t.x<=Math.max(e.x,i.x)&&t.x>=Math.min(e.x,i.x)&&t.y<=Math.max(e.y,i.y)&&t.y>=Math.min(e.y,i.y)}function ac(e){return e>0?1:e<0?-1:0}function sc(e,t){return ic(e.prev,e,e.next)<0?ic(e,t,e.next)>=0&&ic(e,e.prev,t)>=0:ic(e,t,e.prev)<0||ic(e,e.next,t)<0}function lc(e,t){const i=hc(e.i,e.x,e.y),n=hc(t.i,t.x,t.y),r=e.next,o=t.prev;return e.next=t,t.prev=e,i.next=r,r.prev=i,n.next=i,i.prev=n,o.next=n,n.prev=o,n}function cc(e,t,i,n){const r=hc(e,t,i);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function uc(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function hc(e,t,i){return{i:e,x:t,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class dc{constructor(e,t){if(t>e)throw new Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=e,this._minGranularity=t}getGranularityForZoomLevel(e){return Math.max(Math.floor(this._baseZoomGranularity/(1<<e)),this._minGranularity,1)}}class pc{constructor(e){this.fill=e.fill,this.line=e.line,this.tile=e.tile,this.stencil=e.stencil,this.circle=e.circle}}pc.noSubdivision=new pc({fill:new dc(0,0),line:new dc(0,0),tile:new dc(0,0),stencil:new dc(0,0),circle:1}),fo("SubdivisionGranularityExpression",dc),fo("SubdivisionGranularitySetting",pc);const fc=-32768,mc=32767;class gc{constructor(e,t){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=e,this._granularityCellSize=I/e,this._canonical=t}_getKey(e,t){return(e+=32768)<<16|t+32768}_vertexToIndex(e,t){if(e<-32768||t<-32768||e>32767||t>32767)throw new Error("Vertex coordinates are out of signed 16 bit integer range.");const i=0|Math.round(e),n=0|Math.round(t),r=this._getKey(i,n);if(this._vertexDictionary.has(r))return this._vertexDictionary.get(r);const o=this._vertexBuffer.length/2;return this._vertexDictionary.set(r,o),this._vertexBuffer.push(i,n),o}_subdivideTrianglesScanline(e){if(this._granularity<2)return function(e,t){const i=[];for(let n=0;n<t.length;n+=3){const r=t[n],o=t[n+1],a=t[n+2],s=e[2*r],l=e[2*r+1];(e[2*o]-s)*(e[2*a+1]-l)-(e[2*o+1]-l)*(e[2*a]-s)>0?(i.push(r),i.push(a),i.push(o)):(i.push(r),i.push(o),i.push(a))}return i}(this._vertexBuffer,e);const t=[],i=e.length;for(let n=0;n<i;n+=3){const i=[e[n+0],e[n+1],e[n+2]],r=[this._vertexBuffer[2*e[n+0]+0],this._vertexBuffer[2*e[n+0]+1],this._vertexBuffer[2*e[n+1]+0],this._vertexBuffer[2*e[n+1]+1],this._vertexBuffer[2*e[n+2]+0],this._vertexBuffer[2*e[n+2]+1]];let o=1/0,a=1/0,s=-1/0,l=-1/0;for(let e=0;e<3;e++){const t=r[2*e],i=r[2*e+1];o=Math.min(o,t),s=Math.max(s,t),a=Math.min(a,i),l=Math.max(l,i)}if(o===s||a===l)continue;const c=Math.floor(o/this._granularityCellSize),u=Math.ceil(s/this._granularityCellSize),h=Math.floor(a/this._granularityCellSize),d=Math.ceil(l/this._granularityCellSize);if(c!==u||h!==d)for(let e=h;e<d;e++){const n=this._scanlineGenerateVertexRingForCellRow(e,r,i);vc(this._vertexBuffer,n,t)}else t.push(...i)}return t}_scanlineGenerateVertexRingForCellRow(e,t,i){const n=e*this._granularityCellSize,r=n+this._granularityCellSize,o=[];for(let a=0;a<3;a++){const e=t[2*a],s=t[2*a+1],l=t[2*(a+1)%6],c=t[(2*(a+1)+1)%6],u=t[2*(a+2)%6],h=t[(2*(a+2)+1)%6],d=l-e,p=c-s,f=0===d,m=0===p,g=(n-s)/p,_=(r-s)/p,y=Math.min(g,_),v=Math.max(g,_);if(!m&&(y>=1||v<=0)||m&&(s<n||s>r)){c>=n&&c<=r&&o.push(i[(a+1)%3]);continue}!m&&y>0&&o.push(this._vertexToIndex(e+d*y,s+p*y));const x=e+d*Math.max(y,0),b=e+d*Math.min(v,1);f||this._generateIntraEdgeVertices(o,e,s,l,c,x,b),!m&&v<1&&o.push(this._vertexToIndex(e+d*v,s+p*v)),(m||c>=n&&c<=r)&&o.push(i[(a+1)%3]),!m&&(c<=n||c>=r)&&this._generateInterEdgeVertices(o,e,s,l,c,u,h,b,n,r)}return o}_generateIntraEdgeVertices(e,t,i,n,r,o,a){const s=n-t,l=r-i,c=0===l,u=c?Math.min(t,n):Math.min(o,a),h=c?Math.max(t,n):Math.max(o,a),d=Math.floor(u/this._granularityCellSize)+1,p=Math.ceil(h/this._granularityCellSize)-1;if(c?t<n:o<a)for(let f=d;f<=p;f++){const n=f*this._granularityCellSize;e.push(this._vertexToIndex(n,i+l*(n-t)/s))}else for(let f=p;f>=d;f--){const n=f*this._granularityCellSize;e.push(this._vertexToIndex(n,i+l*(n-t)/s))}}_generateInterEdgeVertices(e,t,i,n,r,o,a,s,l,c){const u=r-i,h=o-n,d=a-r,p=(l-r)/d,f=(c-r)/d,m=Math.min(p,f),g=Math.max(p,f),_=n+h*m;let y=Math.floor(Math.min(_,s)/this._granularityCellSize)+1,v=Math.ceil(Math.max(_,s)/this._granularityCellSize)-1,x=s<_;const b=0===d;if(b&&(a===l||a===c))return;if(b||m>=1||g<=0){const e=i-a,n=o+(t-o)*Math.min((l-a)/e,(c-a)/e);y=Math.floor(Math.min(n,s)/this._granularityCellSize)+1,v=Math.ceil(Math.max(n,s)/this._granularityCellSize)-1,x=s<n}const w=u>0?c:l;if(x)for(let T=y;T<=v;T++)e.push(this._vertexToIndex(T*this._granularityCellSize,w));else for(let T=v;T>=y;T--)e.push(this._vertexToIndex(T*this._granularityCellSize,w))}_generateOutline(e){const t=[];for(const i of e){const e=yc(i,this._granularity,!0),n=this._pointArrayToIndices(e),r=[];for(let t=1;t<n.length;t++)r.push(n[t-1]),r.push(n[t]);t.push(r)}return t}_handlePoles(e){let t=!1,i=!1;this._canonical&&(0===this._canonical.y&&(t=!0),this._canonical.y===(1<<this._canonical.z)-1&&(i=!0)),(t||i)&&this._fillPoles(e,t,i)}_ensureNoPoleVertices(){const e=this._vertexBuffer;for(let t=0;t<e.length;t+=2){const i=e[t+1];i===fc&&(e[t+1]=-32767),i===mc&&(e[t+1]=32766)}}_generatePoleQuad(e,t,i,n,r,o){n>r!=(o===fc)?(e.push(t),e.push(i),e.push(this._vertexToIndex(n,o)),e.push(i),e.push(this._vertexToIndex(r,o)),e.push(this._vertexToIndex(n,o))):(e.push(i),e.push(t),e.push(this._vertexToIndex(n,o)),e.push(this._vertexToIndex(r,o)),e.push(i),e.push(this._vertexToIndex(n,o)))}_fillPoles(e,t,i){const n=this._vertexBuffer,r=I,o=e.length;for(let a=2;a<o;a+=3){const o=e[a-2],s=e[a-1],l=e[a],c=n[2*o],u=n[2*o+1],h=n[2*s],d=n[2*s+1],p=n[2*l],f=n[2*l+1];t&&(0===u&&0===d&&this._generatePoleQuad(e,o,s,c,h,fc),0===d&&0===f&&this._generatePoleQuad(e,s,l,h,p,fc),0===f&&0===u&&this._generatePoleQuad(e,l,o,p,c,fc)),i&&(u===r&&d===r&&this._generatePoleQuad(e,o,s,c,h,mc),d===r&&f===r&&this._generatePoleQuad(e,s,l,h,p,mc),f===r&&u===r&&this._generatePoleQuad(e,l,o,p,c,mc))}}_initializeVertices(e){for(let t=0;t<e.length;t+=2)this._vertexToIndex(e[t],e[t+1])}subdividePolygonInternal(e,t){if(this._used)throw new Error("Subdivision: multiple use not allowed.");this._used=!0;const{flattened:i,holeIndices:n}=function(e){const t=[],i=[];for(const n of e)if(0!==n.length){n!==e[0]&&t.push(i.length/2);for(let e=0;e<n.length;e++)i.push(n[e].x),i.push(n[e].y)}return{flattened:i,holeIndices:t}}(e);let r;this._initializeVertices(i);try{const e=function(e,t,i=2){const n=t&&t.length,r=n?t[0]*i:e.length;let o=Vl(e,0,r,i,!0);const a=[];if(!o||o.next===o.prev)return a;let s,l,c;if(n&&(o=function(e,t,i,n){const r=[];for(let o=0,a=t.length;o<a;o++){const i=Vl(e,t[o]*n,o<a-1?t[o+1]*n:e.length,n,!1);i===i.next&&(i.steiner=!0),r.push(Ql(i))}r.sort(Hl);for(let o=0;o<r.length;o++)i=Xl(r[o],i);return i}(e,t,o,i)),e.length>80*i){s=e[0],l=e[1];let t=s,n=l;for(let o=i;o<r;o+=i){const i=e[o],r=e[o+1];i<s&&(s=i),r<l&&(l=r),i>t&&(t=i),r>n&&(n=r)}c=Math.max(t-s,n-l),c=0!==c?32767/c:0}return Zl(o,a,i,s,l,c,0),a}(i,n),t=this._convertIndices(i,e);r=this._subdivideTrianglesScanline(t)}catch(a){}let o=[];return t&&(o=this._generateOutline(e)),this._ensureNoPoleVertices(),this._handlePoles(r),{verticesFlattened:this._vertexBuffer,indicesTriangles:r,indicesLineList:o}}_convertIndices(e,t){const i=[];for(let n=0;n<t.length;n++)i.push(this._vertexToIndex(e[2*t[n]],e[2*t[n]+1]));return i}_pointArrayToIndices(e){const t=[];for(let i=0;i<e.length;i++){const n=e[i];t.push(this._vertexToIndex(n.x,n.y))}return t}}function _c(e,t,i,n=!0){return new gc(i,t).subdividePolygonInternal(e,n)}function yc(e,t,i=!1){if(!e||e.length<1)return[];if(e.length<2)return[];const r=e[0],o=e[e.length-1],a=i&&(r.x!==o.x||r.y!==o.y);if(t<2)return a?[...e,e[0]]:[...e];const s=Math.floor(I/t),l=[];l.push(new n(e[0].x,e[0].y));const c=e.length,u=a?c:c-1;for(let h=0;h<u;h++){const t=e[h],i=h<c-1?e[h+1]:e[0],r=t.x,o=t.y,a=i.x,u=i.y,d=r!==a,p=o!==u;if(!d&&!p)continue;const f=a-r,m=u-o,g=Math.abs(f),_=Math.abs(m);let y=r,v=o;for(;;){const e=f>0?(Math.floor(y/s)+1)*s:(Math.ceil(y/s)-1)*s,t=m>0?(Math.floor(v/s)+1)*s:(Math.ceil(v/s)-1)*s,i=Math.abs(y-e),r=Math.abs(v-t),o=Math.abs(y-a),c=Math.abs(v-u),h=d?i/g:Number.POSITIVE_INFINITY,x=p?r/_:Number.POSITIVE_INFINITY;if((o<=i||!d)&&(c<=r||!p))break;if(h<x&&d||!p){y=e,v+=m*h;const t=new n(y,Math.round(v));l[l.length-1].x===t.x&&l[l.length-1].y===t.y||l.push(t)}else{y+=f*x,v=t;const e=new n(Math.round(y),v);l[l.length-1].x===e.x&&l[l.length-1].y===e.y||l.push(e)}}const x=new n(a,u);l[l.length-1].x===x.x&&l[l.length-1].y===x.y||l.push(x)}return l}function vc(e,t,i){if(0===t.length)throw new Error("Subdivision vertex ring is empty.");let n=0,r=e[2*t[0]];for(let l=1;l<t.length;l++){const i=e[2*t[l]];i<r&&(r=i,n=l)}const o=t.length;let a=n,s=(a+1)%o;for(;;){const n=a-1>=0?a-1:o-1,r=(s+1)%o,l=e[2*t[n]],c=e[2*t[r]],u=e[2*t[a]],h=e[2*t[a]+1],d=e[2*t[s]+1];let p=!1;if(l<c)p=!0;else if(l>c)p=!1;else{const i=d-h,o=-(e[2*t[s]]-u),a=h<d?1:-1;((l-u)*i+(e[2*t[n]+1]-h)*o)*a>((c-u)*i+(e[2*t[r]+1]-h)*o)*a&&(p=!0)}if(p){const e=t[n],r=t[a],l=t[s];e!==r&&e!==l&&r!==l&&i.push(l,r,e),a--,a<0&&(a=o-1)}else{const e=t[r],n=t[a],l=t[s];e!==n&&e!==l&&n!==l&&i.push(l,n,e),s++,s>=o&&(s=0)}if(n===r)break}}function xc(e,t,i,n,r,o,a,s,l){const c=r.length/2,u=a&&s&&l;if(c<as.MAX_VERTEX_ARRAY_LENGTH){const h=t.prepareSegment(c,i,n),d=h.vertexLength;for(let e=0;e<o.length;e+=3)n.emplaceBack(d+o[e],d+o[e+1],d+o[e+2]);let p,f;h.vertexLength+=c,h.primitiveLength+=o.length/3,u&&(f=a.prepareSegment(c,i,s),p=f.vertexLength,f.vertexLength+=c);for(let t=0;t<r.length;t+=2)e(r[t],r[t+1]);if(u)for(let e=0;e<l.length;e++){const t=l[e];for(let e=1;e<t.length;e+=2)s.emplaceBack(p+t[e-1],p+t[e]);f.primitiveLength+=t.length/2}}else!function(e,t,i,n,r,o){const a=[];for(let h=0;h<n.length/2;h++)a.push(-1);const s={count:0};let l=0,c=e.getOrCreateLatestSegment(t,i),u=c.vertexLength;for(let h=2;h<r.length;h+=3){const d=r[h-2],p=r[h-1],f=r[h];let m=a[d]<l,g=a[p]<l,_=a[f]<l;c.vertexLength+((m?1:0)+(g?1:0)+(_?1:0))>as.MAX_VERTEX_ARRAY_LENGTH&&(c=e.createNewSegment(t,i),l=s.count,m=!0,g=!0,_=!0,u=0);const y=bc(a,n,o,s,d,m,c),v=bc(a,n,o,s,p,g,c),x=bc(a,n,o,s,f,_,c);i.emplaceBack(u+y-l,u+v-l,u+x-l),c.primitiveLength++}}(t,i,n,r,o,e),u&&function(e,t,i,n,r,o){const a=[];for(let h=0;h<n.length/2;h++)a.push(-1);const s={count:0};let l=0,c=e.getOrCreateLatestSegment(t,i),u=c.vertexLength;for(let h=0;h<r.length;h++){const d=r[h];for(let p=1;p<r[h].length;p+=2){const r=d[p-1],h=d[p];let f=a[r]<l,m=a[h]<l;c.vertexLength+((f?1:0)+(m?1:0))>as.MAX_VERTEX_ARRAY_LENGTH&&(c=e.createNewSegment(t,i),l=s.count,f=!0,m=!0,u=0);const g=bc(a,n,o,s,r,f,c),_=bc(a,n,o,s,h,m,c);i.emplaceBack(u+g-l,u+_-l),c.primitiveLength++}}}(a,i,s,r,l,e),t.forceNewSegmentOnNextPrepare(),null==a||a.forceNewSegmentOnNextPrepare()}function bc(e,t,i,n,r,o,a){if(o){const o=n.count;return i(t[2*r],t[2*r+1]),e[r]=n.count,n.count++,a.vertexLength++,o}return e[r]}class wc{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.id),this.index=e.index,this.hasDependencies=!1,this.patternFeatures=[],this.layoutVertexArray=new qa,this.indexArray=new is,this.indexArray2=new ns,this.programConfigurations=new Fs(e.layers,e.zoom),this.segments=new as,this.segments2=new as,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(e,t,i){this.hasDependencies=Nl("fill",this.layers,t);const n=this.layers[0].layout.get("fill-sort-key"),r=!n.isConstant(),o=[];for(const{feature:a,id:s,index:l,sourceLayerIndex:c}of e){const e=this.layers[0]._featureFilter.needGeometry,u=Us(a,e);if(!this.layers[0]._featureFilter.filter(new Ro(this.zoom),u,i))continue;const h=r?n.evaluate(u,{},i,t.availableImages):void 0,d={id:s,properties:a.properties,type:a.type,sourceLayerIndex:c,index:l,geometry:e?u.geometry:Vs(a),patterns:{},sortKey:h};o.push(d)}r&&o.sort((e,t)=>e.sortKey-t.sortKey);for(const a of o){const{geometry:n,index:r,sourceLayerIndex:o}=a;if(this.hasDependencies){const e=jl("fill",this.layers,a,{zoom:this.zoom},t);this.patternFeatures.push(e)}else this.addFeature(a,n,r,i,{},t.subdivisionGranularity);t.featureIndex.insert(e[r].feature,n,r,o,this.index)}}update(e,t,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,{imagePositions:i})}addFeatures(e,t,i){for(const n of this.patternFeatures)this.addFeature(n,n.geometry,n.index,t,i,e.subdivisionGranularity)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Ol),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(e,t,i,n,r,o){for(const a of tn(t,500)){const e=_c(a,n,o.fill.getGranularityForZoomLevel(n.z)),t=this.layoutVertexArray;xc((e,i)=>{t.emplaceBack(e,i)},this.segments,this.layoutVertexArray,this.indexArray,e.verticesFlattened,e.indicesTriangles,this.segments2,this.indexArray2,e.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,{imagePositions:r,canonical:n})}}let Tc,Sc;fo("FillBucket",wc,{omit:["layers","patternFeatures"]});var Pc={get paint(){return Sc=Sc||new Ko({"fill-antialias":new $o(xe.paint_fill["fill-antialias"]),"fill-opacity":new Wo(xe.paint_fill["fill-opacity"]),"fill-color":new Wo(xe.paint_fill["fill-color"]),"fill-outline-color":new Wo(xe.paint_fill["fill-outline-color"]),"fill-translate":new $o(xe.paint_fill["fill-translate"]),"fill-translate-anchor":new $o(xe.paint_fill["fill-translate-anchor"]),"fill-pattern":new Ho(xe.paint_fill["fill-pattern"])})},get layout(){return Tc=Tc||new Ko({"fill-sort-key":new Wo(xe.layout_fill["fill-sort-key"])})}};class Mc extends Qo{constructor(e,t){super(e,Pc,t)}recalculate(e,t){super.recalculate(e,t);const i=this.paint._values["fill-outline-color"];"constant"===i.value.kind&&void 0===i.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(e){return new wc(e)}queryRadius(){return rl(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:e,geometry:t,transform:i,pixelsToTileUnits:n}){return Hs(ol(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-i.bearingInRadians,n),t)}isTileClipped(){return!0}}const Ec=oa([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Cc=oa([{name:"a_centroid",components:2,type:"Int16"}],4),{members:kc}=Ec;class Ic{constructor(e,t,i,n,r){this.properties={},this.extent=i,this.type=0,this.id=void 0,this._pbf=e,this._geometry=-1,this._keys=n,this._values=r,e.readFields(zc,this,t)}loadGeometry(){const e=this._pbf;e.pos=this._geometry;const t=e.readVarint()+e.pos,i=[];let r,o=1,a=0,s=0,l=0;for(;e.pos<t;){if(a<=0){const t=e.readVarint();o=7&t,a=t>>3}if(a--,1===o||2===o)s+=e.readSVarint(),l+=e.readSVarint(),1===o&&(r&&i.push(r),r=[]),r&&r.push(new n(s,l));else{if(7!==o)throw new Error(`unknown command ${o}`);r&&r.push(r[0].clone())}}return r&&i.push(r),i}bbox(){const e=this._pbf;e.pos=this._geometry;const t=e.readVarint()+e.pos;let i=1,n=0,r=0,o=0,a=1/0,s=-1/0,l=1/0,c=-1/0;for(;e.pos<t;){if(n<=0){const t=e.readVarint();i=7&t,n=t>>3}if(n--,1===i||2===i)r+=e.readSVarint(),o+=e.readSVarint(),r<a&&(a=r),r>s&&(s=r),o<l&&(l=o),o>c&&(c=o);else if(7!==i)throw new Error(`unknown command ${i}`)}return[a,l,s,c]}toGeoJSON(e,t,i){const n=this.extent*Math.pow(2,i),r=this.extent*e,o=this.extent*t,a=this.loadGeometry();function s(e){return[360*(e.x+r)/n-180,360/Math.PI*Math.atan(Math.exp((1-2*(e.y+o)/n)*Math.PI))-90]}function l(e){return e.map(s)}let c;if(1===this.type){const e=[];for(const i of a)e.push(i[0]);const t=l(e);c=1===e.length?{type:"Point",coordinates:t[0]}:{type:"MultiPoint",coordinates:t}}else if(2===this.type){const e=a.map(l);c=1===e.length?{type:"LineString",coordinates:e[0]}:{type:"MultiLineString",coordinates:e}}else{if(3!==this.type)throw new Error("unknown feature type");{const e=Ac(a),t=[];for(const i of e)t.push(i.map(l));c=1===t.length?{type:"Polygon",coordinates:t[0]}:{type:"MultiPolygon",coordinates:t}}}const u={type:"Feature",geometry:c,properties:this.properties};return null!=this.id&&(u.id=this.id),u}}function zc(e,t,i){1===e?t.id=i.readVarint():2===e?function(e,t){const i=e.readVarint()+e.pos;for(;e.pos<i;){const i=t._keys[e.readVarint()],n=t._values[e.readVarint()];t.properties[i]=n}}(i,t):3===e?t.type=i.readVarint():4===e&&(t._geometry=i.pos)}function Ac(e){const t=e.length;if(t<=1)return[e];const i=[];let n,r;for(let o=0;o<t;o++){const t=Lc(e[o]);0!==t&&(void 0===r&&(r=t<0),r===t<0?(n&&i.push(n),n=[e[o]]):n&&n.push(e[o]))}return n&&i.push(n),i}function Lc(e){let t=0;for(let i,n,r=0,o=e.length,a=o-1;r<o;a=r++)i=e[r],n=e[a],t+=(n.x-i.x)*(i.y+n.y);return t}Ic.types=["Unknown","Point","LineString","Polygon"];class Dc{constructor(e,t){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(Rc,this,t),this.length=this._features.length}feature(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];const t=this._pbf.readVarint()+this._pbf.pos;return new Ic(this._pbf,t,this.extent,this._keys,this._values)}}function Rc(e,t,i){15===e?t.version=i.readVarint():1===e?t.name=i.readString():5===e?t.extent=i.readVarint():2===e?t._features.push(i.pos):3===e?t._keys.push(i.readString()):4===e&&t._values.push(function(e){let t=null;const i=e.readVarint()+e.pos;for(;e.pos<i;){const i=e.readVarint()>>3;t=1===i?e.readString():2===i?e.readFloat():3===i?e.readDouble():4===i?e.readVarint64():5===i?e.readVarint():6===i?e.readSVarint():7===i?e.readBoolean():null}if(null==t)throw new Error("unknown feature value");return t}(i))}class Fc{constructor(e,t){this.layers=e.readFields(Bc,{},t)}}function Bc(e,t,i){if(3===e){const e=new Dc(i,i.readVarint()+i.pos);e.length&&(t[e.name]=e)}}const Oc=Math.pow(2,13);function Nc(e,t,i,n,r,o,a,s){e.emplaceBack(t,i,2*Math.floor(n*Oc)+a,r*Oc*2,o*Oc*2,Math.round(s))}class jc{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.id),this.index=e.index,this.hasDependencies=!1,this.layoutVertexArray=new $a,this.centroidVertexArray=new Za,this.indexArray=new is,this.programConfigurations=new Fs(e.layers,e.zoom),this.segments=new as,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(e,t,i){this.features=[],this.hasDependencies=Nl("fill-extrusion",this.layers,t);for(const{feature:n,id:r,index:o,sourceLayerIndex:a}of e){const e=this.layers[0]._featureFilter.needGeometry,s=Us(n,e);if(!this.layers[0]._featureFilter.filter(new Ro(this.zoom),s,i))continue;const l={id:r,sourceLayerIndex:a,index:o,geometry:e?s.geometry:Vs(n),properties:n.properties,type:n.type,patterns:{}};this.hasDependencies?this.features.push(jl("fill-extrusion",this.layers,l,{zoom:this.zoom},t)):this.addFeature(l,l.geometry,o,i,{},t.subdivisionGranularity),t.featureIndex.insert(n,l.geometry,o,a,this.index,!0)}}addFeatures(e,t,i){for(const n of this.features){const{geometry:r}=n;this.addFeature(n,r,n.index,t,i,e.subdivisionGranularity)}}update(e,t,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,{imagePositions:i})}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.centroidVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,kc),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,Cc.members,!0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,t,i,n,r,o){for(const a of tn(t,500)){const t={x:0,y:0,sampleCount:0},i=this.layoutVertexArray.length;this.processPolygon(t,n,e,a,o);const r=this.layoutVertexArray.length-i,s=Math.floor(t.x/t.sampleCount),l=Math.floor(t.y/t.sampleCount);for(let e=0;e<r;e++)this.centroidVertexArray.emplaceBack(s,l)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,{imagePositions:r,canonical:n})}processPolygon(e,t,i,n,r){if(n.length<1)return;if(Zc(n[0]))return;for(const u of n)0!==u.length&&Vc(e,u);const o={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},a=r.fill.getGranularityForZoomLevel(t.z),s="Polygon"===Ic.types[i.type];for(const u of n){if(0===u.length)continue;if(Zc(u))continue;const e=yc(u,a,s);this._generateSideFaces(e,o)}if(!s)return;const l=_c(n,t,a,!1),c=this.layoutVertexArray;xc((e,t)=>{Nc(c,e,t,0,0,1,1,0)},this.segments,this.layoutVertexArray,this.indexArray,l.verticesFlattened,l.indicesTriangles)}_generateSideFaces(e,t){let i=0;for(let n=1;n<e.length;n++){const r=e[n],o=e[n-1];if(Uc(r,o))continue;t.segment.vertexLength+4>as.MAX_VERTEX_ARRAY_LENGTH&&(t.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const a=r.sub(o)._perp()._unit(),s=o.dist(r);i+s>32768&&(i=0),Nc(this.layoutVertexArray,r.x,r.y,a.x,a.y,0,0,i),Nc(this.layoutVertexArray,r.x,r.y,a.x,a.y,0,1,i),i+=s,Nc(this.layoutVertexArray,o.x,o.y,a.x,a.y,0,0,i),Nc(this.layoutVertexArray,o.x,o.y,a.x,a.y,0,1,i);const l=t.segment.vertexLength;this.indexArray.emplaceBack(l,l+2,l+1),this.indexArray.emplaceBack(l+1,l+2,l+3),t.segment.vertexLength+=4,t.segment.primitiveLength+=2}}}function Vc(e,t){for(let i=0;i<t.length;i++){const n=t[i];i===t.length-1&&t[0].x===n.x&&t[0].y===n.y||(e.x+=n.x,e.y+=n.y,e.sampleCount++)}}function Uc(e,t){return e.x===t.x&&(e.x<0||e.x>I)||e.y===t.y&&(e.y<0||e.y>I)}function Zc(e){return e.every(e=>e.x<0)||e.every(e=>e.x>I)||e.every(e=>e.y<0)||e.every(e=>e.y>I)}let Gc;fo("FillExtrusionBucket",jc,{omit:["layers","features"]});var qc={get paint(){return Gc=Gc||new Ko({"fill-extrusion-opacity":new $o(xe["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Wo(xe["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new $o(xe["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new $o(xe["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Ho(xe["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Wo(xe["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Wo(xe["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new $o(xe["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class $c extends Qo{constructor(e,t){super(e,qc,t)}createBucket(e){return new jc(e)}queryRadius(){return rl(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:i,geometry:r,transform:o,pixelsToTileUnits:a,pixelPosMatrix:s}){const l=ol(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-o.bearingInRadians,a),c=this.paint.get("fill-extrusion-height").evaluate(t,i),u=this.paint.get("fill-extrusion-base").evaluate(t,i),h=function(e,t){const i=[];for(const r of e){const e=[r.x,r.y,0,1];P(e,e,t),i.push(new n(e[0]/e[3],e[1]/e[3]))}return i}(l,s),d=function(e,t,i,r){const o=[],a=[],s=r[8]*t,l=r[9]*t,c=r[10]*t,u=r[11]*t,h=r[8]*i,d=r[9]*i,p=r[10]*i,f=r[11]*i;for(const m of e){const e=[],t=[];for(const i of m){const o=i.x,a=i.y,m=r[0]*o+r[4]*a+r[12],g=r[1]*o+r[5]*a+r[13],_=r[2]*o+r[6]*a+r[14],y=r[3]*o+r[7]*a+r[15],v=_+c,x=y+u,b=m+h,w=g+d,T=_+p,S=y+f,P=new n((m+s)/x,(g+l)/x);P.z=v/x,e.push(P);const M=new n(b/S,w/S);M.z=T/S,t.push(M)}o.push(e),a.push(t)}return[o,a]}(r,u,c,s);return function(e,t,i){let n=1/0;Hs(i,t)&&(n=Hc(i,t[0]));for(let r=0;r<t.length;r++){const o=t[r],a=e[r];for(let e=0;e<o.length-1;e++){const t=o[e],r=[t,o[e+1],a[e+1],a[e],t];$s(i,r)&&(n=Math.min(n,Hc(i,r)))}}return n!==1/0&&n}(d[0],d[1],h)}}function Wc(e,t){return e.x*t.x+e.y*t.y}function Hc(e,t){if(1===e.length){let i=0;const n=t[i++];let r;for(;!r||n.equals(r);)if(r=t[i++],!r)return 1/0;for(;i<t.length;i++){const o=t[i],a=e[0],s=r.sub(n),l=o.sub(n),c=a.sub(n),u=Wc(s,s),h=Wc(s,l),d=Wc(l,l),p=Wc(c,s),f=Wc(c,l),m=u*d-h*h,g=(d*p-h*f)/m,_=(u*f-h*p)/m,y=n.z*(1-g-_)+r.z*g+o.z*_;if(isFinite(y))return y}return 1/0}{let e=1/0;for(const i of t)e=Math.min(e,i.z);return e}}const Xc=oa([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:Yc}=Xc,Kc=oa([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:Qc}=Kc,Jc=Math.cos(Math.PI/180*37.5),eu=Math.pow(2,14)/.5;class tu{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.id),this.index=e.index,this.hasDependencies=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(e=>{this.gradients[e.id]={}}),this.layoutVertexArray=new Wa,this.layoutVertexArray2=new Ha,this.indexArray=new is,this.programConfigurations=new Fs(e.layers,e.zoom),this.segments=new as,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(e,t,i){this.hasDependencies=Nl("line",this.layers,t)||this.hasLineDasharray(this.layers);const n=this.layers[0].layout.get("line-sort-key"),r=!n.isConstant(),o=[];for(const{feature:a,id:s,index:l,sourceLayerIndex:c}of e){const e=this.layers[0]._featureFilter.needGeometry,t=Us(a,e);if(!this.layers[0]._featureFilter.filter(new Ro(this.zoom),t,i))continue;const u=r?n.evaluate(t,{},i):void 0,h={id:s,properties:a.properties,type:a.type,sourceLayerIndex:c,index:l,geometry:e?t.geometry:Vs(a),patterns:{},dashes:{},sortKey:u};o.push(h)}r&&o.sort((e,t)=>e.sortKey-t.sortKey);for(const a of o){const{geometry:n,index:r,sourceLayerIndex:o}=a;this.hasDependencies?(Nl("line",this.layers,t)?jl("line",this.layers,a,{zoom:this.zoom},t):this.hasLineDasharray(this.layers)&&this.addLineDashDependencies(this.layers,a,this.zoom,t),this.patternFeatures.push(a)):this.addFeature(a,n,r,i,{},{},t.subdivisionGranularity),t.featureIndex.insert(e[r].feature,n,r,o,this.index)}}update(e,t,i,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,{imagePositions:i,dashPositions:n})}addFeatures(e,t,i,n){for(const r of this.patternFeatures)this.addFeature(r,r.geometry,r.index,t,i,n,e.subdivisionGranularity)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,Qc)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Yc),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,t,i,n,r,o,a){const s=this.layers[0].layout,l=s.get("line-join").evaluate(e,{}),c=s.get("line-cap"),u=s.get("line-miter-limit"),h=s.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const d of t)this.addLine(d,e,l,c,u,h,n,a);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,{imagePositions:r,dashPositions:o,canonical:n})}addLine(e,t,i,n,r,o,a,s){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,e=yc(e,a?s.line.getGranularityForZoomLevel(a.z):1),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let t=0;t<e.length-1;t++)this.totalDistance+=e[t].dist(e[t+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const l="Polygon"===Ic.types[t.type];let c=e.length;for(;c>=2&&e[c-1].equals(e[c-2]);)c--;let u=0;for(;u<c-1&&e[u].equals(e[u+1]);)u++;if(c<(l?3:2))return;"bevel"===i&&(r=1.05);const h=this.overscaling<=16?122880/(512*this.overscaling):0,d=this.segments.prepareSegment(10*c,this.layoutVertexArray,this.indexArray);let p,f,m,g,_;this.e1=this.e2=-1,l&&(p=e[c-2],_=e[u].sub(p)._unit()._perp());for(let y=u;y<c;y++){if(m=y===c-1?l?e[u+1]:void 0:e[y+1],m&&e[y].equals(m))continue;_&&(g=_),p&&(f=p),p=e[y],_=m?m.sub(p)._unit()._perp():g,g=g||_;let t=g.add(_);0===t.x&&0===t.y||t._unit();const a=g.x*_.x+g.y*_.y,s=t.x*_.x+t.y*_.y,v=0!==s?1/s:1/0,x=2*Math.sqrt(2-2*s),b=s<Jc&&f&&m,w=g.x*_.y-g.y*_.x>0;if(b&&y>u){const e=p.dist(f);if(e>2*h){const t=p.sub(p.sub(f)._mult(h/e)._round());this.updateDistance(f,t),this.addCurrentVertex(t,g,0,0,d),f=t}}const T=f&&m;let S=T?i:l?"butt":n;if(T&&"round"===S&&(v<o?S="miter":v<=2&&(S="fakeround")),"miter"===S&&v>r&&(S="bevel"),"bevel"===S&&(v>2&&(S="flipbevel"),v<r&&(S="miter")),f&&this.updateDistance(f,p),"miter"===S)t._mult(v),this.addCurrentVertex(p,t,0,0,d);else if("flipbevel"===S){if(v>100)t=_.mult(-1);else{const e=v*g.add(_).mag()/g.sub(_).mag();t._perp()._mult(e*(w?-1:1))}this.addCurrentVertex(p,t,0,0,d),this.addCurrentVertex(p,t.mult(-1),0,0,d)}else if("bevel"===S||"fakeround"===S){const e=-Math.sqrt(v*v-1),t=w?e:0,i=w?0:e;if(f&&this.addCurrentVertex(p,g,t,i,d),"fakeround"===S){const e=Math.round(180*x/Math.PI/20);for(let t=1;t<e;t++){let i=t/e;if(.5!==i){const e=i-.5;i+=i*e*(i-1)*((1.0904+a*(a*(3.55645-1.43519*a)-3.2452))*e*e+(.848013+a*(.215638*a-1.06021)))}const n=_.sub(g)._mult(i)._add(g)._unit()._mult(w?-1:1);this.addHalfVertex(p,n.x,n.y,!1,w,0,d)}}m&&this.addCurrentVertex(p,_,-t,-i,d)}else if("butt"===S)this.addCurrentVertex(p,t,0,0,d);else if("square"===S){const e=f?1:-1;this.addCurrentVertex(p,t,e,e,d)}else"round"===S&&(f&&(this.addCurrentVertex(p,g,0,0,d),this.addCurrentVertex(p,g,1,1,d,!0)),m&&(this.addCurrentVertex(p,_,-1,-1,d,!0),this.addCurrentVertex(p,_,0,0,d)));if(b&&y<c-1){const e=p.dist(m);if(e>2*h){const t=p.add(m.sub(p)._mult(h/e)._round());this.updateDistance(p,t),this.addCurrentVertex(t,_,0,0,d),p=t}}}}addCurrentVertex(e,t,i,n,r,o=!1){const a=t.y*n-t.x,s=-t.y-t.x*n;this.addHalfVertex(e,t.x+t.y*i,t.y-t.x*i,o,!1,i,r),this.addHalfVertex(e,a,s,o,!0,-n,r),this.distance>eu/2&&0===this.totalDistance&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,t,i,n,r,o))}addHalfVertex({x:e,y:t},i,n,r,o,a,s){const l=.5*(this.lineClips?this.scaledDistance*(eu-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(r?1:0),(t<<1)+(o?1:0),Math.round(63*i)+128,Math.round(63*n)+128,1+(0===a?0:a<0?-1:1)|(63&l)<<2,l>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const c=s.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,c,this.e2),s.primitiveLength++),o?this.e2=c:this.e1=c}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,t){this.distance+=e.dist(t),this.updateScaledDistance()}hasLineDasharray(e){for(const t of e){const e=t.paint.get("line-dasharray");if(e&&!e.isConstant())return!0}return!1}addLineDashDependencies(e,t,i,n){for(const r of e){const e=r.paint.get("line-dasharray");if(!e||"constant"===e.value.kind)continue;const o="round"===r.layout.get("line-cap"),a={dasharray:e.value.evaluate({zoom:i-1},t,{}),round:o},s={dasharray:e.value.evaluate({zoom:i},t,{}),round:o},l={dasharray:e.value.evaluate({zoom:i+1},t,{}),round:o},c=`${a.dasharray.join(",")},${a.round}`,u=`${s.dasharray.join(",")},${s.round}`,h=`${l.dasharray.join(",")},${l.round}`;n.dashDependencies[c]=a,n.dashDependencies[u]=s,n.dashDependencies[h]=l,t.dashes[r.id]={min:c,mid:u,max:h}}}}let iu,nu;fo("LineBucket",tu,{omit:["layers","patternFeatures"]});var ru={get paint(){return nu=nu||new Ko({"line-opacity":new Wo(xe.paint_line["line-opacity"]),"line-color":new Wo(xe.paint_line["line-color"]),"line-translate":new $o(xe.paint_line["line-translate"]),"line-translate-anchor":new $o(xe.paint_line["line-translate-anchor"]),"line-width":new Wo(xe.paint_line["line-width"]),"line-gap-width":new Wo(xe.paint_line["line-gap-width"]),"line-offset":new Wo(xe.paint_line["line-offset"]),"line-blur":new Wo(xe.paint_line["line-blur"]),"line-dasharray":new Ho(xe.paint_line["line-dasharray"]),"line-pattern":new Ho(xe.paint_line["line-pattern"]),"line-gradient":new Yo(xe.paint_line["line-gradient"])})},get layout(){return iu=iu||new Ko({"line-cap":new $o(xe.layout_line["line-cap"]),"line-join":new Wo(xe.layout_line["line-join"]),"line-miter-limit":new $o(xe.layout_line["line-miter-limit"]),"line-round-limit":new $o(xe.layout_line["line-round-limit"]),"line-sort-key":new Wo(xe.layout_line["line-sort-key"])})}};class ou extends Wo{possiblyEvaluate(e,t){return t=new Ro(Math.floor(t.zoom),{now:t.now,fadeDuration:t.fadeDuration,zoomHistory:t.zoomHistory,transition:t.transition}),super.possiblyEvaluate(e,t)}evaluate(e,t,i,n){return t=N({},t,{zoom:Math.floor(t.zoom)}),super.evaluate(e,t,i,n)}}let au;class su extends Qo{constructor(e,t){super(e,ru,t),this.gradientVersion=0,au||(au=new ou(ru.paint.properties["line-width"].specification),au.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if("line-gradient"===e){const e=this.gradientExpression();this.stepInterpolant=!(void 0===e._styleExpression)&&e._styleExpression.expression instanceof li,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(e,t){super.recalculate(e,t),this.paint._values["line-floorwidth"]=au.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new tu(e)}queryRadius(e){const t=e,i=lu(nl("line-width",this,t),nl("line-gap-width",this,t)),n=nl("line-offset",this,t);return i/2+Math.abs(n)+rl(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:i,geometry:r,transform:o,pixelsToTileUnits:a}){const s=ol(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-o.bearingInRadians,a),l=a/2*lu(this.paint.get("line-width").evaluate(t,i),this.paint.get("line-gap-width").evaluate(t,i)),c=this.paint.get("line-offset").evaluate(t,i);return c&&(r=function(e,t){const i=[];for(let r=0;r<e.length;r++){const o=al(e[r]),a=[];for(let e=0;e<o.length;e++){const i=o[e],r=o[e-1],s=o[e+1],l=0===e?new n(0,0):i.sub(r)._unit()._perp(),c=e===o.length-1?new n(0,0):s.sub(i)._unit()._perp(),u=l._add(c)._unit(),h=u.x*c.x+u.y*c.y;0!==h&&u._mult(1/h),a.push(u._mult(t)._add(i))}i.push(a)}return i}(r,c*a)),function(e,t,i){for(let n=0;n<t.length;n++){const r=t[n];if(e.length>=3)for(let t=0;t<r.length;t++)if(tl(e,r[t]))return!0;if(Xs(e,r,i))return!0}return!1}(s,r,l)}isTileClipped(){return!0}}function lu(e,t){return t>0?t+2*e:e}const cu=oa([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),uu=oa([{name:"a_projected_pos",components:3,type:"Float32"}],4);oa([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const hu=oa([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);oa([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const du=oa([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),pu=oa([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function fu(e,t,i){return e.sections.forEach(e=>{e.text=function(e,t,i){const n=t.layout.get("text-transform").evaluate(i,{});return"uppercase"===n?e=e.toLocaleUpperCase():"lowercase"===n&&(e=e.toLocaleLowerCase()),Do.applyArabicShaping&&(e=Do.applyArabicShaping(e)),e}(e.text,t,i)}),e}oa([{name:"triangle",components:3,type:"Uint16"}]),oa([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),oa([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),oa([{type:"Float32",name:"offsetX"}]),oa([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),oa([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);var mu=24;const gu={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","⋯":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"},_u={10:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},yu={40:!0};function vu(e,t,i,n,r,o){if("fontStack"in t){const n=i[t.fontStack],o=n&&n[e];return o?o.metrics.advance*t.scale+r:0}{const e=n[t.imageName];return e?e.displaySize[0]*t.scale*mu/o+r:0}}function xu(e,t,i,n){const r=Math.pow(e-t,2);return n?e<t?r/2:2*r:r+Math.abs(i)*i}function bu(e,t,i){let n=0;return 10===e&&(n-=1e4),i&&(n+=150),40!==e&&65288!==e||(n+=50),41!==t&&65289!==t||(n+=50),n}function wu(e,t,i,n,r,o){let a=null,s=xu(t,i,r,o);for(const l of n){const e=xu(t-l.x,i,r,o)+l.badness;e<=s&&(a=l,s=e)}return{index:e,x:t,priorBreak:a,badness:s}}function Tu(e){return e?Tu(e.priorBreak).concat(e.index):[]}class Su{constructor(e="",t=[],i=[]){this.text=e,this.sections=t,this.sectionIndex=i,this.imageSectionID=null}static fromFeature(e,t){const i=new Su;for(let n=0;n<e.sections.length;n++){const r=e.sections[n];r.image?i.addImageSection(r):i.addTextSection(r,t)}return i}length(){return[...this.text].length}getSection(e){return this.sections[this.sectionIndex[e]]}getSectionIndex(e){return this.sectionIndex[e]}verticalizePunctuation(){this.text=function(e){let t="",i={premature:!0,value:void 0};const n=e[Symbol.iterator]();let r=n.next();const o=e[Symbol.iterator]();o.next();let a=o.next();for(;!r.done;)t+=!a.done&&ko(a.value.codePointAt(0))&&!gu[a.value]||!i.premature&&ko(i.value.codePointAt(0))&&!gu[i.value]||!gu[r.value]?r.value:gu[r.value],i={value:r.value,premature:!1},r=n.next(),a=o.next();return t}(this.text)}hasZeroWidthSpaces(){return this.text.includes("")}trim(){const e=this.text.match(/^\s*/),t=e?e[0].length:0,i=this.text.match(/\S\s*$/),n=i?i[0].length-1:0;this.text=this.text.substring(t,this.text.length-n),this.sectionIndex=this.sectionIndex.slice(t,this.sectionIndex.length-n)}substring(e,t){const i=[...this.text].slice(e,t).join(""),n=this.sectionIndex.slice(e,t);return new Su(i,this.sections,n)}toCodeUnitIndex(e){return[...this.text].slice(0,e).join("").length}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,t)=>Math.max(e,this.sections[t].scale),0)}getMaxImageSize(e){let t=0,i=0;for(let n=0;n<this.length();n++){const r=this.getSection(n);if("imageName"in r){const n=e[r.imageName];if(!n)continue;const o=n.displaySize;t=Math.max(t,o[0]),i=Math.max(i,o[1])}}return{maxImageWidth:t,maxImageHeight:i}}addTextSection(e,t){this.text+=e.text,this.sections.push({scale:e.scale||1,verticalAlign:e.verticalAlign||"bottom",fontStack:e.fontStack||t});const i=this.sections.length-1;this.sectionIndex.push(...[...e.text].map(()=>i))}addImageSection(e){const t=e.image?e.image.name:"";if(0===t.length)return void q("Can't add FormattedSection with an empty image.");const i=this.getNextImageSectionCharCode();i?(this.text+=String.fromCharCode(i),this.sections.push({scale:1,verticalAlign:e.verticalAlign||"bottom",imageName:t}),this.sectionIndex.push(this.sections.length-1)):q("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}determineLineBreaks(e,t,i,n,r){const o=[],a=this.determineAverageLineWidth(e,t,i,n,r),s=this.hasZeroWidthSpaces();let l=0,c=0;const u=this.text[Symbol.iterator]();let h=u.next();const d=this.text[Symbol.iterator]();d.next();let p=d.next();const f=this.text[Symbol.iterator]();f.next(),f.next();let m=f.next();for(;!h.done;){const t=this.getSection(c),g=h.value.codePointAt(0);if(To(g)||(l+=vu(g,t,i,n,e,r)),!p.done){const e=bo(g),i=p.value.codePointAt(0);(_u[g]||e||"imageName"in t||!m.done&&yu[i])&&o.push(wu(c+1,l,a,o,bu(g,i,e&&s),!1))}c++,h=u.next(),p=d.next(),m=f.next()}return Tu(wu(this.length(),l,a,o,0,!0))}determineAverageLineWidth(e,t,i,n,r){let o=0,a=0;for(const s of this.text){const t=this.getSection(a);o+=vu(s.codePointAt(0),t,i,n,e,r),a++}return o/Math.max(1,Math.ceil(o/t))}}const Pu=4294967296,Mu=1/Pu,Eu="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8");class Cu{constructor(e=new Uint8Array(16)){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(e,t,i=this.length){for(;this.pos<i;){const i=this.readVarint(),n=i>>3,r=this.pos;this.type=7&i,e(n,t,this),this.pos===r&&this.skip(i)}return t}readMessage(e,t){return this.readFields(e,t,this.readVarint()+this.pos)}readFixed32(){const e=this.dataView.getUint32(this.pos,!0);return this.pos+=4,e}readSFixed32(){const e=this.dataView.getInt32(this.pos,!0);return this.pos+=4,e}readFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*Pu;return this.pos+=8,e}readSFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*Pu;return this.pos+=8,e}readFloat(){const e=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,e}readDouble(){const e=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,e}readVarint(e){const t=this.buf;let i,n;return n=t[this.pos++],i=127&n,n<128?i:(n=t[this.pos++],i|=(127&n)<<7,n<128?i:(n=t[this.pos++],i|=(127&n)<<14,n<128?i:(n=t[this.pos++],i|=(127&n)<<21,n<128?i:(n=t[this.pos],i|=(15&n)<<28,function(e,t,i){const n=i.buf;let r,o;if(o=n[i.pos++],r=(112&o)>>4,o<128)return ku(e,r,t);if(o=n[i.pos++],r|=(127&o)<<3,o<128)return ku(e,r,t);if(o=n[i.pos++],r|=(127&o)<<10,o<128)return ku(e,r,t);if(o=n[i.pos++],r|=(127&o)<<17,o<128)return ku(e,r,t);if(o=n[i.pos++],r|=(127&o)<<24,o<128)return ku(e,r,t);if(o=n[i.pos++],r|=(1&o)<<31,o<128)return ku(e,r,t);throw new Error("Expected varint not more than 10 bytes")}(i,e,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const e=this.readVarint();return e%2==1?(e+1)/-2:e/2}readBoolean(){return Boolean(this.readVarint())}readString(){const e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=12&&Eu?Eu.decode(this.buf.subarray(t,e)):function(e,t,i){let n="",r=t;for(;r<i;){const t=e[r];let o,a,s,l=null,c=t>239?4:t>223?3:t>191?2:1;if(r+c>i)break;1===c?t<128&&(l=t):2===c?(o=e[r+1],128==(192&o)&&(l=(31&t)<<6|63&o,l<=127&&(l=null))):3===c?(o=e[r+1],a=e[r+2],128==(192&o)&&128==(192&a)&&(l=(15&t)<<12|(63&o)<<6|63&a,(l<=2047||l>=55296&&l<=57343)&&(l=null))):4===c&&(o=e[r+1],a=e[r+2],s=e[r+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(l=(15&t)<<18|(63&o)<<12|(63&a)<<6|63&s,(l<=65535||l>=1114112)&&(l=null))),null===l?(l=65533,c=1):l>65535&&(l-=65536,n+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),n+=String.fromCharCode(l),r+=c}return n}(this.buf,t,e)}readBytes(){const e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t}readPackedVarint(e=[],t){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readVarint(t));return e}readPackedSVarint(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSVarint());return e}readPackedBoolean(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readBoolean());return e}readPackedFloat(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFloat());return e}readPackedDouble(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readDouble());return e}readPackedFixed32(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed32());return e}readPackedSFixed32(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed32());return e}readPackedFixed64(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed64());return e}readPackedSFixed64(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed64());return e}readPackedEnd(){return 2===this.type?this.readVarint()+this.pos:this.pos+1}skip(e){const t=7&e;if(0===t)for(;this.buf[this.pos++]>127;);else if(2===t)this.pos=this.readVarint()+this.pos;else if(5===t)this.pos+=4;else{if(1!==t)throw new Error(`Unimplemented type: ${t}`);this.pos+=8}}writeTag(e,t){this.writeVarint(e<<3|t)}realloc(e){let t=this.length||16;for(;t<this.pos+e;)t*=2;if(t!==this.length){const e=new Uint8Array(t);e.set(this.buf),this.buf=e,this.dataView=new DataView(e.buffer),this.length=t}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeSFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,-1&e,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*Mu),!0),this.pos+=8}writeSFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,-1&e,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*Mu),!0),this.pos+=8}writeVarint(e){(e=+e||0)>268435455||e<0?function(e,t){let i,n;if(e>=0?(i=e%4294967296|0,n=e/4294967296|0):(i=~(-e%4294967296),n=~(-e/4294967296),4294967295^i?i=i+1|0:(i=0,n=n+1|0)),e>=0x10000000000000000||e<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");var r,o;t.realloc(10),r=i,(o=t).buf[o.pos++]=127&r|128,r>>>=7,o.buf[o.pos++]=127&r|128,r>>>=7,o.buf[o.pos++]=127&r|128,r>>>=7,o.buf[o.pos++]=127&r|128,o.buf[o.pos]=127&(r>>>=7),function(e,t){const i=(7&e)<<4;t.buf[t.pos++]|=i|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e)))))}(n,t)}(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=e>>>7&127))))}writeSVarint(e){this.writeVarint(e<0?2*-e-1:2*e)}writeBoolean(e){this.writeVarint(+e)}writeString(e){e=String(e),this.realloc(4*e.length),this.pos++;const t=this.pos;this.pos=function(e,t,i){for(let n,r,o=0;o<t.length;o++){if(n=t.charCodeAt(o),n>55295&&n<57344){if(!r){n>56319||o+1===t.length?(e[i++]=239,e[i++]=191,e[i++]=189):r=n;continue}if(n<56320){e[i++]=239,e[i++]=191,e[i++]=189,r=n;continue}n=r-55296<<10|n-56320|65536,r=null}else r&&(e[i++]=239,e[i++]=191,e[i++]=189,r=null);n<128?e[i++]=n:(n<2048?e[i++]=n>>6|192:(n<65536?e[i++]=n>>12|224:(e[i++]=n>>18|240,e[i++]=n>>12&63|128),e[i++]=n>>6&63|128),e[i++]=63&n|128)}return i}(this.buf,e,this.pos);const i=this.pos-t;i>=128&&Iu(t,i,this),this.pos=t-1,this.writeVarint(i),this.pos+=i}writeFloat(e){this.realloc(4),this.dataView.setFloat32(this.pos,e,!0),this.pos+=4}writeDouble(e){this.realloc(8),this.dataView.setFloat64(this.pos,e,!0),this.pos+=8}writeBytes(e){const t=e.length;this.writeVarint(t),this.realloc(t);for(let i=0;i<t;i++)this.buf[this.pos++]=e[i]}writeRawMessage(e,t){this.pos++;const i=this.pos;e(t,this);const n=this.pos-i;n>=128&&Iu(i,n,this),this.pos=i-1,this.writeVarint(n),this.pos+=n}writeMessage(e,t,i){this.writeTag(e,2),this.writeRawMessage(t,i)}writePackedVarint(e,t){t.length&&this.writeMessage(e,zu,t)}writePackedSVarint(e,t){t.length&&this.writeMessage(e,Au,t)}writePackedBoolean(e,t){t.length&&this.writeMessage(e,Ru,t)}writePackedFloat(e,t){t.length&&this.writeMessage(e,Lu,t)}writePackedDouble(e,t){t.length&&this.writeMessage(e,Du,t)}writePackedFixed32(e,t){t.length&&this.writeMessage(e,Fu,t)}writePackedSFixed32(e,t){t.length&&this.writeMessage(e,Bu,t)}writePackedFixed64(e,t){t.length&&this.writeMessage(e,Ou,t)}writePackedSFixed64(e,t){t.length&&this.writeMessage(e,Nu,t)}writeBytesField(e,t){this.writeTag(e,2),this.writeBytes(t)}writeFixed32Field(e,t){this.writeTag(e,5),this.writeFixed32(t)}writeSFixed32Field(e,t){this.writeTag(e,5),this.writeSFixed32(t)}writeFixed64Field(e,t){this.writeTag(e,1),this.writeFixed64(t)}writeSFixed64Field(e,t){this.writeTag(e,1),this.writeSFixed64(t)}writeVarintField(e,t){this.writeTag(e,0),this.writeVarint(t)}writeSVarintField(e,t){this.writeTag(e,0),this.writeSVarint(t)}writeStringField(e,t){this.writeTag(e,2),this.writeString(t)}writeFloatField(e,t){this.writeTag(e,5),this.writeFloat(t)}writeDoubleField(e,t){this.writeTag(e,1),this.writeDouble(t)}writeBooleanField(e,t){this.writeVarintField(e,+t)}}function ku(e,t,i){return i?4294967296*t+(e>>>0):4294967296*(t>>>0)+(e>>>0)}function Iu(e,t,i){const n=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));i.realloc(n);for(let r=i.pos-1;r>=e;r--)i.buf[r+n]=i.buf[r]}function zu(e,t){for(let i=0;i<e.length;i++)t.writeVarint(e[i])}function Au(e,t){for(let i=0;i<e.length;i++)t.writeSVarint(e[i])}function Lu(e,t){for(let i=0;i<e.length;i++)t.writeFloat(e[i])}function Du(e,t){for(let i=0;i<e.length;i++)t.writeDouble(e[i])}function Ru(e,t){for(let i=0;i<e.length;i++)t.writeBoolean(e[i])}function Fu(e,t){for(let i=0;i<e.length;i++)t.writeFixed32(e[i])}function Bu(e,t){for(let i=0;i<e.length;i++)t.writeSFixed32(e[i])}function Ou(e,t){for(let i=0;i<e.length;i++)t.writeFixed64(e[i])}function Nu(e,t){for(let i=0;i<e.length;i++)t.writeSFixed64(e[i])}function ju(e,t,i){1===e&&i.readMessage(Vu,t)}function Vu(e,t,i){if(3===e){const{id:e,bitmap:n,width:r,height:o,left:a,top:s,advance:l}=i.readMessage(Uu,{});t.push({id:e,bitmap:new Tl({width:r+6,height:o+6},n),metrics:{width:r,height:o,left:a,top:s,advance:l}})}}function Uu(e,t,i){1===e?t.id=i.readVarint():2===e?t.bitmap=i.readBytes():3===e?t.width=i.readVarint():4===e?t.height=i.readVarint():5===e?t.left=i.readSVarint():6===e?t.top=i.readSVarint():7===e&&(t.advance=i.readVarint())}function Zu(e){let t=0,i=0;for(const a of e)t+=a.w*a.h,i=Math.max(i,a.w);e.sort((e,t)=>t.h-e.h);const n=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),i),h:1/0}];let r=0,o=0;for(const a of e)for(let e=n.length-1;e>=0;e--){const t=n[e];if(!(a.w>t.w||a.h>t.h)){if(a.x=t.x,a.y=t.y,o=Math.max(o,a.y+a.h),r=Math.max(r,a.x+a.w),a.w===t.w&&a.h===t.h){const t=n.pop();t&&e<n.length&&(n[e]=t)}else a.h===t.h?(t.x+=a.w,t.w-=a.w):a.w===t.w?(t.y+=a.h,t.h-=a.h):(n.push({x:t.x+a.w,y:t.y,w:t.w-a.w,h:a.h}),t.y+=a.h,t.h-=a.h);break}}return{w:r,h:o,fill:t/(r*o)||0}}class Gu{constructor(e,{pixelRatio:t,version:i,stretchX:n,stretchY:r,content:o,textFitWidth:a,textFitHeight:s}){this.paddedRect=e,this.pixelRatio=t,this.stretchX=n,this.stretchY=r,this.content=o,this.version=i,this.textFitWidth=a,this.textFitHeight=s}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}class qu{constructor(e,t){const i={},n={};this.haveRenderCallbacks=[];const r=[];this.addImages(e,i,r),this.addImages(t,n,r);const{w:o,h:a}=Zu(r),s=new Sl({width:o||1,height:a||1});for(const l in e){const t=e[l],n=i[l].paddedRect;Sl.copy(t.data,s,{x:0,y:0},{x:n.x+1,y:n.y+1},t.data)}for(const l in t){const e=t[l],i=n[l].paddedRect,r=i.x+1,o=i.y+1,a=e.data.width,c=e.data.height;Sl.copy(e.data,s,{x:0,y:0},{x:r,y:o},e.data),Sl.copy(e.data,s,{x:0,y:c-1},{x:r,y:o-1},{width:a,height:1}),Sl.copy(e.data,s,{x:0,y:0},{x:r,y:o+c},{width:a,height:1}),Sl.copy(e.data,s,{x:a-1,y:0},{x:r-1,y:o},{width:1,height:c}),Sl.copy(e.data,s,{x:0,y:0},{x:r+a,y:o},{width:1,height:c})}this.image=s,this.iconPositions=i,this.patternPositions=n}addImages(e,t,i){for(const n in e){const r=e[n],o={x:0,y:0,w:r.data.width+2,h:r.data.height+2};i.push(o),t[n]=new Gu(o,r),r.hasRenderCallback&&this.haveRenderCallbacks.push(n)}}patchUpdatedImages(e,t){e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const i in e.updatedImages)this.patchUpdatedImage(this.iconPositions[i],e.getImage(i),t),this.patchUpdatedImage(this.patternPositions[i],e.getImage(i),t)}patchUpdatedImage(e,t,i){if(!e||!t)return;if(e.version===t.version)return;e.version=t.version;const[n,r]=e.tl;i.update(t.data,void 0,{x:n,y:r})}}var $u;function Wu(t,i,n,r,o,a,s,l,c,u,h,d,p,f,m){const g=Su.fromFeature(t,o);let _;d===e.az.vertical&&g.verticalizePunctuation();let y=g.determineLineBreaks(u,a,i,r,f);const{processBidirectionalText:v,processStyledBidirectionalText:x}=Do;if(v&&1===g.sections.length){_=[],y=y.map(e=>g.toCodeUnitIndex(e));const e=v(g.toString(),y);for(const t of e){const e=[...t].map(()=>0);_.push(new Su(t,g.sections,e))}}else if(x){_=[],y=y.map(e=>g.toCodeUnitIndex(e));let e=0;const t=[];for(const n of g.text)t.push(...Array(n.length).fill(g.sectionIndex[e])),e++;const i=x(g.text,t,y);for(const n of i){const e=[];let t="";for(const i of n[0])e.push(n[1][t.length]),t+=i;_.push(new Su(n[0],g.sections,e))}}else _=function(e,t){const i=[];let n=0;for(const r of t)i.push(e.substring(n,r)),n=r;return n<e.length()&&i.push(e.substring(n,e.length())),i}(g,y);const b=[],w={positionedLines:b,text:g.toString(),top:h[1],bottom:h[1],left:h[0],right:h[0],writingMode:d,iconsInText:!1,verticalizable:!1};return function(e,t,i,n,r,o,a,s,l,c,u,h){let d=0,p=0,f=0,m=0;const g="right"===s?1:"left"===s?0:.5,_=mu/h;let y=0;for(const b of r){b.trim();const r=b.getMaxScale(),a={positionedGlyphs:[],lineOffset:0};e.positionedLines[y]=a;const s=a.positionedGlyphs;let h=0;if(!b.length()){p+=o,++y;continue}const v=Xu(n,b,_);let x=0;for(const o of b.text){const a=b.getSection(x),f=o.codePointAt(0),m=Ku(l,u,f),g={glyph:f,imageName:null,x:d,y:p+-17,vertical:m,scale:1,fontStack:"",sectionIndex:b.getSectionIndex(x),metrics:null,rect:null};let y;if("fontStack"in a){if(y=Qu(a,f,m,v,t,i),!y)continue;g.fontStack=a.fontStack}else{if(e.iconsInText=!0,a.scale*=_,y=Ju(a,m,r,v,n),!y)continue;h=Math.max(h,y.imageOffset),g.imageName=a.imageName}const{rect:w,metrics:T,baselineOffset:S}=y;g.y+=S,g.scale=a.scale,g.metrics=T,g.rect=w,s.push(g),m?(e.verticalizable=!0,d+=("imageName"in a?T.advance:mu)*a.scale+c):d+=T.advance*a.scale+c,x++}0!==s.length&&(f=Math.max(d-c,f),eh(s,0,s.length-1,g)),d=0,a.lineOffset=Math.max(h,(r-1)*mu);const w=o*r+h;p+=w,m=Math.max(w,m),++y}const{horizontalAlign:v,verticalAlign:x}=Hu(a);(function(e,t,i,n,r,o,a,s,l){const c=(t-i)*r;let u=0;u=o!==a?-s*n- -17:-n*l*a+.5*a;for(const h of e)for(const e of h.positionedGlyphs)e.x+=c,e.y+=u})(e.positionedLines,g,v,x,f,m,o,p,r.length),e.top+=-x*p,e.bottom=e.top+p,e.left+=-v*f,e.right=e.left+f}(w,i,n,r,_,s,l,c,d,u,p,m),!function(e){for(const t of e)if(0!==t.positionedGlyphs.length)return!1;return!0}(b)&&w}function Hu(e){let t=.5,i=.5;switch(e){case"right":case"top-right":case"bottom-right":t=1;break;case"left":case"top-left":case"bottom-left":t=0}switch(e){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:t,verticalAlign:i}}function Xu(e,t,i){const n=t.getMaxScale()*mu,{maxImageWidth:r,maxImageHeight:o}=t.getMaxImageSize(e),a=Math.max(n,o*i);return{verticalLineContentWidth:Math.max(n,r*i),horizontalLineContentHeight:a}}function Yu(e){switch(e){case"top":return 0;case"center":return.5;default:return 1}}function Ku(t,i,n){return!(t===e.az.horizontal||!i&&!wo(n)||i&&(To(n)||(r=n,/\p{sc=Arab}/u.test(String.fromCodePoint(r)))));var r}function Qu(e,t,i,n,r,o){const a=o[e.fontStack],s=function(e,t,i,n){if(e&&e.rect)return e;const r=t[i.fontStack],o=r&&r[n];return o?{rect:null,metrics:o.metrics}:null}(a&&a[t],r,e,t);if(null===s)return null;let l;if(i)l=n.verticalLineContentWidth-e.scale*mu;else{const t=Yu(e.verticalAlign);l=(n.horizontalLineContentHeight-e.scale*mu)*t}return{rect:s.rect,metrics:s.metrics,baselineOffset:l}}function Ju(e,t,i,n,r){const o=r[e.imageName];if(!o)return null;const a=o.paddedRect,s=o.displaySize,l={width:s[0],height:s[1],left:1,top:-3,advance:t?s[1]:s[0]};let c;if(t)c=n.verticalLineContentWidth-s[1]*e.scale;else{const t=Yu(e.verticalAlign);c=(n.horizontalLineContentHeight-s[1]*e.scale)*t}return{rect:a,metrics:l,baselineOffset:c,imageOffset:(t?s[0]:s[1])*e.scale-mu*i}}function eh(e,t,i,n){if(0===n)return;const r=e[i],o=(e[i].x+r.metrics.advance*r.scale)*n;for(let a=t;a<=i;a++)e[a].x-=o}function th(e,t,i){const{horizontalAlign:n,verticalAlign:r}=Hu(i),o=t[0]-e.displaySize[0]*n,a=t[1]-e.displaySize[1]*r;return{image:e,top:a,bottom:a+e.displaySize[1],left:o,right:o+e.displaySize[0]}}function ih(e){var t,i;let n=e.left,r=e.top,o=e.right-n,a=e.bottom-r;const s=null!==(t=e.image.textFitWidth)&&void 0!==t?t:"stretchOrShrink",l=null!==(i=e.image.textFitHeight)&&void 0!==i?i:"stretchOrShrink",c=(e.image.content[2]-e.image.content[0])/(e.image.content[3]-e.image.content[1]);if("proportional"===l){if("stretchOnly"===s&&o/a<c||"proportional"===s){const e=Math.ceil(a*c);n*=e/o,o=e}}else if("proportional"===s&&"stretchOnly"===l&&0!==c&&o/a>c){const e=Math.ceil(o/c);r*=e/a,a=e}return{x1:n,y1:r,x2:n+o,y2:r+a}}function nh(e,t,i,n,r,o){const a=e.image;let s;if(a.content){const e=a.content,t=a.pixelRatio||1;s=[e[0]/t,e[1]/t,a.displaySize[0]-e[2]/t,a.displaySize[1]-e[3]/t]}const l=t.left*o,c=t.right*o;let u,h,d,p;"width"===i||"both"===i?(p=r[0]+l-n[3],h=r[0]+c+n[1]):(p=r[0]+(l+c-a.displaySize[0])/2,h=p+a.displaySize[0]);const f=t.top*o,m=t.bottom*o;return"height"===i||"both"===i?(u=r[1]+f-n[0],d=r[1]+m+n[2]):(u=r[1]+(f+m-a.displaySize[1])/2,d=u+a.displaySize[1]),{image:a,top:u,right:h,bottom:d,left:p,collisionPadding:s}}fo("ImagePosition",Gu),fo("ImageAtlas",qu),e.az=void 0,($u=e.az||(e.az={}))[$u.none=0]="none",$u[$u.horizontal=1]="horizontal",$u[$u.vertical=2]="vertical",$u[$u.horizontalOnly=3]="horizontalOnly";const rh=128,oh=32640;function ah(e,t){const{expression:i}=t;if("constant"===i.kind)return{kind:"constant",layoutSize:i.evaluate(new Ro(e+1))};if("source"===i.kind)return{kind:"source"};{const{zoomStops:t,interpolationType:n}=i;let r=0;for(;r<t.length&&t[r]<=e;)r++;r=Math.max(0,r-1);let o=r;for(;o<t.length&&t[o]<e+1;)o++;o=Math.min(t.length-1,o);const a=t[r],s=t[o];return"composite"===i.kind?{kind:"composite",minZoom:a,maxZoom:s,interpolationType:n}:{kind:"camera",minZoom:a,maxZoom:s,minSize:i.evaluate(new Ro(a)),maxSize:i.evaluate(new Ro(s)),interpolationType:n}}}function sh(e,t,i){let n="never";const r=e.get(t);return r?n=r:e.get(i)&&(n="always"),n}const lh=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function ch(e,t,i,n,r,o,a,s,l,c,u,h,d){const p=s?Math.min(oh,Math.round(s[0])):0,f=s?Math.min(oh,Math.round(s[1])):0;e.emplaceBack(t,i,Math.round(32*n),Math.round(32*r),o,a,(p<<1)+(l?1:0),f,16*c,16*u,256*h,256*d)}function uh(e,t,i){e.emplaceBack(t.x,t.y,i),e.emplaceBack(t.x,t.y,i),e.emplaceBack(t.x,t.y,i),e.emplaceBack(t.x,t.y,i)}function hh(e){for(const t of e.sections)if(Lo(t.text))return!0;return!1}class dh{constructor(e){this.layoutVertexArray=new Ka,this.indexArray=new is,this.programConfigurations=e,this.segments=new as,this.dynamicLayoutVertexArray=new Qa,this.opacityVertexArray=new Ja,this.hasVisibleVertices=!1,this.placedSymbolArray=new Da}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length}upload(e,t,i,n){this.isEmpty()||(i&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,cu.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,t),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,uu.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,lh,!0),this.opacityVertexBuffer.itemSize=1),(i||n)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}fo("SymbolBuffers",dh);class ph{constructor(e,t,i){this.layoutVertexArray=new e,this.layoutAttributes=t,this.indexArray=new i,this.segments=new as,this.collisionVertexArray=new ts}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,hu.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}fo("CollisionBuffers",ph);class fh{constructor(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(e=>e.id),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasDependencies=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];const i=this.layers[0]._unevaluatedLayout._values;this.textSizeData=ah(this.zoom,i["text-size"]),this.iconSizeData=ah(this.zoom,i["icon-size"]);const n=this.layers[0].layout,r=n.get("symbol-sort-key"),o=n.get("symbol-z-order");this.canOverlap="never"!==sh(n,"text-overlap","text-allow-overlap")||"never"!==sh(n,"icon-overlap","icon-allow-overlap")||n.get("text-ignore-placement")||n.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==o&&!r.isConstant(),this.sortFeaturesByY=("viewport-y"===o||"auto"===o&&!this.sortFeaturesByKey)&&this.canOverlap,"point"===n.get("symbol-placement")&&(this.writingModes=n.get("text-writing-mode").map(t=>e.az[t])),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.sourceID=t.sourceID}createArrays(){this.text=new dh(new Fs(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new dh(new Fs(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new Ba,this.lineVertexArray=new Oa,this.symbolInstances=new Fa,this.textAnchorOffsets=new ja}calculateGlyphDependencies(e,t,i,n,r){for(const o of e)if(t[o.codePointAt(0)]=!0,(i||n)&&r){const e=gu[o];e&&(t[e.codePointAt(0)]=!0)}}populate(t,i,n){const r=this.layers[0],o=r.layout,a=o.get("text-font"),s=o.get("text-field"),l=o.get("icon-image"),c=("constant"!==s.value.kind||s.value.value instanceof At&&!s.value.value.isEmpty()||s.value.value.toString().length>0)&&("constant"!==a.value.kind||a.value.value.length>0),u="constant"!==l.value.kind||!!l.value.value||Object.keys(l.parameters).length>0,h=o.get("symbol-sort-key");if(this.features=[],!c&&!u)return;const d=i.iconDependencies,p=i.glyphDependencies,f=i.availableImages,m=new Ro(this.zoom);for(const{feature:g,id:_,index:y,sourceLayerIndex:v}of t){const t=r._featureFilter.needGeometry,i=Us(g,t);if(!r._featureFilter.filter(m,i,n))continue;let s,l;if(t||(i.geometry=Vs(g)),c){const e=r.getValueAndResolveTokens("text-field",i,n,f),t=At.factory(e),o=this.hasRTLText=this.hasRTLText||hh(t);(!o||"unavailable"===Do.getRTLTextPluginStatus()||o&&Do.isParsed())&&(s=fu(t,r,i))}if(u){const e=r.getValueAndResolveTokens("icon-image",i,n,f);l=e instanceof Nt?e:Nt.fromString(e)}if(!s&&!l)continue;const x=this.sortFeaturesByKey?h.evaluate(i,{},n):void 0;if(this.features.push({id:_,text:s,icon:l,index:y,sourceLayerIndex:v,geometry:i.geometry,properties:g.properties,type:Ic.types[g.type],sortKey:x}),l&&(d[l.name]=!0),s){const t=a.evaluate(i,{},n).join(","),r="viewport"!==o.get("text-rotation-alignment")&&"point"!==o.get("symbol-placement");this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(e.az.vertical)>=0;for(const e of s.sections)if(e.image)d[e.image.name]=!0;else{const i=So(s.toString()),n=e.fontStack||t,o=p[n]=p[n]||{};this.calculateGlyphDependencies(e.text,o,r,this.allowVerticalPlacement,i)}}}"line"===o.get("symbol-placement")&&(this.features=function(e){const t={},i={},n=[];let r=0;function o(t){n.push(e[t]),r++}function a(e,t,r){const o=i[e];return delete i[e],i[t]=o,n[o].geometry[0].pop(),n[o].geometry[0]=n[o].geometry[0].concat(r[0]),o}function s(e,i,r){const o=t[i];return delete t[i],t[e]=o,n[o].geometry[0].shift(),n[o].geometry[0]=r[0].concat(n[o].geometry[0]),o}function l(e,t,i){const n=i?t[0][t[0].length-1]:t[0][0];return`${e}:${n.x}:${n.y}`}for(let c=0;c<e.length;c++){const u=e[c],h=u.geometry,d=u.text?u.text.toString():null;if(!d){o(c);continue}const p=l(d,h),f=l(d,h,!0);if(p in i&&f in t&&i[p]!==t[f]){const e=s(p,f,h),r=a(p,f,n[e].geometry);delete t[p],delete i[f],i[l(d,n[r].geometry,!0)]=r,n[e].geometry=null}else p in i?a(p,f,h):f in t?s(p,f,h):(o(c),t[p]=r-1,i[f]=r-1)}return n.filter(e=>e.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((e,t)=>e.sortKey-t.sortKey)}update(e,t,i){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,t,this.layers,{imagePositions:i}),this.icon.programConfigurations.updatePaintArrays(e,t,this.layers,{imagePositions:i}))}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,t){const i=this.lineVertexArray.length;if(void 0!==e.segment){let i=e.dist(t[e.segment+1]),n=e.dist(t[e.segment]);const r={};for(let o=e.segment+1;o<t.length;o++)r[o]={x:t[o].x,y:t[o].y,tileUnitDistanceFromAnchor:i},o<t.length-1&&(i+=t[o+1].dist(t[o]));for(let o=e.segment||0;o>=0;o--)r[o]={x:t[o].x,y:t[o].y,tileUnitDistanceFromAnchor:n},o>0&&(n+=t[o-1].dist(t[o]));for(let e=0;e<t.length;e++){const t=r[e];this.lineVertexArray.emplaceBack(t.x,t.y,t.tileUnitDistanceFromAnchor)}}return{lineStartIndex:i,lineLength:this.lineVertexArray.length-i}}addSymbols(t,i,n,r,o,a,s,l,c,u,h,d){const p=t.indexArray,f=t.layoutVertexArray,m=t.segments.prepareSegment(4*i.length,f,p,this.canOverlap?a.sortKey:void 0),g=this.glyphOffsetArray.length,_=m.vertexLength,y=this.allowVerticalPlacement&&s===e.az.vertical?Math.PI/2:0,v=a.text&&a.text.sections;for(let e=0;e<i.length;e++){const{tl:r,tr:o,bl:s,br:c,tex:u,pixelOffsetTL:h,pixelOffsetBR:g,minFontScaleX:_,minFontScaleY:x,glyphOffset:b,isSDF:w,sectionIndex:T}=i[e],S=m.vertexLength,P=b[1];ch(f,l.x,l.y,r.x,P+r.y,u.x,u.y,n,w,h.x,h.y,_,x),ch(f,l.x,l.y,o.x,P+o.y,u.x+u.w,u.y,n,w,g.x,h.y,_,x),ch(f,l.x,l.y,s.x,P+s.y,u.x,u.y+u.h,n,w,h.x,g.y,_,x),ch(f,l.x,l.y,c.x,P+c.y,u.x+u.w,u.y+u.h,n,w,g.x,g.y,_,x),uh(t.dynamicLayoutVertexArray,l,y),p.emplaceBack(S,S+2,S+1),p.emplaceBack(S+1,S+2,S+3),m.vertexLength+=4,m.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(b[0]),e!==i.length-1&&T===i[e+1].sectionIndex||t.programConfigurations.populatePaintArrays(f.length,a,a.index,{imagePositions:{},canonical:d,formattedSection:v&&v[T]})}t.placedSymbolArray.emplaceBack(l.x,l.y,g,this.glyphOffsetArray.length-g,_,c,u,l.segment,n?n[0]:0,n?n[1]:0,r[0],r[1],s,0,!1,0,h)}_addCollisionDebugVertex(e,t,i,n,r,o){return t.emplaceBack(0,0),e.emplaceBack(i.x,i.y,n,r,Math.round(o.x),Math.round(o.y))}addCollisionDebugVertices(e,t,i,r,o,a,s){const l=o.segments.prepareSegment(4,o.layoutVertexArray,o.indexArray),c=l.vertexLength,u=o.layoutVertexArray,h=o.collisionVertexArray,d=s.anchorX,p=s.anchorY;this._addCollisionDebugVertex(u,h,a,d,p,new n(e,t)),this._addCollisionDebugVertex(u,h,a,d,p,new n(i,t)),this._addCollisionDebugVertex(u,h,a,d,p,new n(i,r)),this._addCollisionDebugVertex(u,h,a,d,p,new n(e,r)),l.vertexLength+=4;const f=o.indexArray;f.emplaceBack(c,c+1),f.emplaceBack(c+1,c+2),f.emplaceBack(c+2,c+3),f.emplaceBack(c+3,c),l.primitiveLength+=4}addDebugCollisionBoxes(e,t,i,n){for(let r=e;r<t;r++){const e=this.collisionBoxArray.get(r);this.addCollisionDebugVertices(e.x1,e.y1,e.x2,e.y2,n?this.textCollisionBox:this.iconCollisionBox,e.anchorPoint,i)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new ph(es,du.members,ns),this.iconCollisionBox=new ph(es,du.members,ns);for(let e=0;e<this.symbolInstances.length;e++){const t=this.symbolInstances.get(e);this.addDebugCollisionBoxes(t.textBoxStartIndex,t.textBoxEndIndex,t,!0),this.addDebugCollisionBoxes(t.verticalTextBoxStartIndex,t.verticalTextBoxEndIndex,t,!0),this.addDebugCollisionBoxes(t.iconBoxStartIndex,t.iconBoxEndIndex,t,!1),this.addDebugCollisionBoxes(t.verticalIconBoxStartIndex,t.verticalIconBoxEndIndex,t,!1)}}_deserializeCollisionBoxesForSymbol(e,t,i,n,r,o,a,s,l){const c={};for(let u=t;u<i;u++){const t=e.get(u);c.textBox={x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,anchorPointX:t.anchorPointX,anchorPointY:t.anchorPointY},c.textFeatureIndex=t.featureIndex;break}for(let u=n;u<r;u++){const t=e.get(u);c.verticalTextBox={x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,anchorPointX:t.anchorPointX,anchorPointY:t.anchorPointY},c.verticalTextFeatureIndex=t.featureIndex;break}for(let u=o;u<a;u++){const t=e.get(u);c.iconBox={x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,anchorPointX:t.anchorPointX,anchorPointY:t.anchorPointY},c.iconFeatureIndex=t.featureIndex;break}for(let u=s;u<l;u++){const t=e.get(u);c.verticalIconBox={x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,anchorPointX:t.anchorPointX,anchorPointY:t.anchorPointY},c.verticalIconFeatureIndex=t.featureIndex;break}return c}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let t=0;t<this.symbolInstances.length;t++){const i=this.symbolInstances.get(t);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,i.textBoxStartIndex,i.textBoxEndIndex,i.verticalTextBoxStartIndex,i.verticalTextBoxEndIndex,i.iconBoxStartIndex,i.iconBoxEndIndex,i.verticalIconBoxStartIndex,i.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(e,t){const i=e.placedSymbolArray.get(t),n=i.vertexStartIndex+4*i.numGlyphs;for(let r=i.vertexStartIndex;r<n;r+=4)e.indexArray.emplaceBack(r,r+2,r+1),e.indexArray.emplaceBack(r+1,r+2,r+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;const t=Math.sin(e),i=Math.cos(e),n=[],r=[],o=[];for(let a=0;a<this.symbolInstances.length;++a){o.push(a);const e=this.symbolInstances.get(a);n.push(0|Math.round(t*e.anchorX+i*e.anchorY)),r.push(e.featureIndex)}return o.sort((e,t)=>n[e]-n[t]||r[t]-r[e]),o}addToSortKeyRanges(e,t){const i=this.sortKeyRanges[this.sortKeyRanges.length-1];i&&i.sortKey===t?i.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:t,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const e of this.symbolInstanceIndexes){const t=this.symbolInstances.get(e);this.featureSortOrder.push(t.featureIndex),[t.rightJustifiedTextSymbolIndex,t.centerJustifiedTextSymbolIndex,t.leftJustifiedTextSymbolIndex].forEach((e,t,i)=>{e>=0&&i.indexOf(e)===t&&this.addIndicesForPlacedSymbol(this.text,e)}),t.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,t.verticalPlacedTextSymbolIndex),t.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,t.placedIconSymbolIndex),t.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,t.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let mh,gh;fo("SymbolBucket",fh,{omit:["layers","collisionBoxArray","features","compareText"]}),fh.MAX_GLYPHS=65535,fh.addDynamicAttributes=uh;var _h={get paint(){return gh=gh||new Ko({"icon-opacity":new Wo(xe.paint_symbol["icon-opacity"]),"icon-color":new Wo(xe.paint_symbol["icon-color"]),"icon-halo-color":new Wo(xe.paint_symbol["icon-halo-color"]),"icon-halo-width":new Wo(xe.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Wo(xe.paint_symbol["icon-halo-blur"]),"icon-translate":new $o(xe.paint_symbol["icon-translate"]),"icon-translate-anchor":new $o(xe.paint_symbol["icon-translate-anchor"]),"text-opacity":new Wo(xe.paint_symbol["text-opacity"]),"text-color":new Wo(xe.paint_symbol["text-color"],{runtimeType:je,getOverride:e=>e.textColor,hasOverride:e=>!!e.textColor}),"text-halo-color":new Wo(xe.paint_symbol["text-halo-color"]),"text-halo-width":new Wo(xe.paint_symbol["text-halo-width"]),"text-halo-blur":new Wo(xe.paint_symbol["text-halo-blur"]),"text-translate":new $o(xe.paint_symbol["text-translate"]),"text-translate-anchor":new $o(xe.paint_symbol["text-translate-anchor"])})},get layout(){return mh=mh||new Ko({"symbol-placement":new $o(xe.layout_symbol["symbol-placement"]),"symbol-spacing":new $o(xe.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new $o(xe.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Wo(xe.layout_symbol["symbol-sort-key"]),"symbol-z-order":new $o(xe.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new $o(xe.layout_symbol["icon-allow-overlap"]),"icon-overlap":new $o(xe.layout_symbol["icon-overlap"]),"icon-ignore-placement":new $o(xe.layout_symbol["icon-ignore-placement"]),"icon-optional":new $o(xe.layout_symbol["icon-optional"]),"icon-rotation-alignment":new $o(xe.layout_symbol["icon-rotation-alignment"]),"icon-size":new Wo(xe.layout_symbol["icon-size"]),"icon-text-fit":new $o(xe.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new $o(xe.layout_symbol["icon-text-fit-padding"]),"icon-image":new Wo(xe.layout_symbol["icon-image"]),"icon-rotate":new Wo(xe.layout_symbol["icon-rotate"]),"icon-padding":new Wo(xe.layout_symbol["icon-padding"]),"icon-keep-upright":new $o(xe.layout_symbol["icon-keep-upright"]),"icon-offset":new Wo(xe.layout_symbol["icon-offset"]),"icon-anchor":new Wo(xe.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new $o(xe.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new $o(xe.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new $o(xe.layout_symbol["text-rotation-alignment"]),"text-field":new Wo(xe.layout_symbol["text-field"]),"text-font":new Wo(xe.layout_symbol["text-font"]),"text-size":new Wo(xe.layout_symbol["text-size"]),"text-max-width":new Wo(xe.layout_symbol["text-max-width"]),"text-line-height":new $o(xe.layout_symbol["text-line-height"]),"text-letter-spacing":new Wo(xe.layout_symbol["text-letter-spacing"]),"text-justify":new Wo(xe.layout_symbol["text-justify"]),"text-radial-offset":new Wo(xe.layout_symbol["text-radial-offset"]),"text-variable-anchor":new $o(xe.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Wo(xe.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Wo(xe.layout_symbol["text-anchor"]),"text-max-angle":new $o(xe.layout_symbol["text-max-angle"]),"text-writing-mode":new $o(xe.layout_symbol["text-writing-mode"]),"text-rotate":new Wo(xe.layout_symbol["text-rotate"]),"text-padding":new $o(xe.layout_symbol["text-padding"]),"text-keep-upright":new $o(xe.layout_symbol["text-keep-upright"]),"text-transform":new Wo(xe.layout_symbol["text-transform"]),"text-offset":new Wo(xe.layout_symbol["text-offset"]),"text-allow-overlap":new $o(xe.layout_symbol["text-allow-overlap"]),"text-overlap":new $o(xe.layout_symbol["text-overlap"]),"text-ignore-placement":new $o(xe.layout_symbol["text-ignore-placement"]),"text-optional":new $o(xe.layout_symbol["text-optional"])})}};class yh{constructor(e){if(void 0===e.property.overrides)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:Fe,this.defaultValue=e}evaluate(e){if(e.formattedSection){const t=this.defaultValue.property.overrides;if(t&&t.hasOverride(e.formattedSection))return t.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}fo("FormatSectionOverride",yh,{omit:["defaultValue"]});class vh extends Qo{constructor(e,t){super(e,_h,t)}recalculate(e,t){if(super.recalculate(e,t),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]="map"===this.layout.get("text-rotation-alignment")?"map":"viewport"),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),"point"===this.layout.get("symbol-placement")){const e=this.layout.get("text-writing-mode");if(e){const t=[];for(const i of e)t.indexOf(i)<0&&t.push(i);this.layout._values["text-writing-mode"]=t}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,t,i,n){const r=this.layout.get(e).evaluate(t,{},i,n),o=this._unevaluatedLayout._values[e];return o.isDataDriven()||nr(o.value)||!r?r:(a=t.properties,r.replace(/{([^{}]+)}/g,(e,t)=>a&&t in a?String(a[t]):""));var a}createBucket(e){return new fh(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const e of _h.paint.overridableProperties){if(!vh.hasPaintOverride(this.layout,e))continue;const t=this.paint.get(e),i=new yh(t),n=new ir(i,t.property.specification);let r=null;r="constant"===t.value.kind||"source"===t.value.kind?new or("source",n):new ar("composite",n,t.value.zoomStops),this.paint._values[e]=new Go(t.property,r,t.parameters)}}_handleOverridablePaintPropertyUpdate(e,t,i){return!(!this.layout||t.isDataDriven()||i.isDataDriven())&&vh.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,t){const i=e.get("text-field"),n=_h.paint.properties[t];let r=!1;const o=e=>{for(const t of e)if(n.overrides&&n.overrides.hasOverride(t))return void(r=!0)};if("constant"===i.value.kind&&i.value.value instanceof At)o(i.value.value.sections);else if("source"===i.value.kind||"composite"===i.value.kind){const e=t=>{r||(t instanceof qt&&Zt(t.value)===qe?o(t.value.sections):t instanceof ki?o(t.sections):t.eachChild(e))},t=i.value;t._styleExpression&&e(t._styleExpression.expression)}return r}}let xh;var bh={get paint(){return xh=xh||new Ko({"background-color":new $o(xe.paint_background["background-color"]),"background-pattern":new Xo(xe.paint_background["background-pattern"]),"background-opacity":new $o(xe.paint_background["background-opacity"])})}};class wh extends Qo{constructor(e,t){super(e,bh,t)}}class Th extends Qo{constructor(e,t){super(e,{},t),this.onAdd=e=>{this.implementation.onAdd&&this.implementation.onAdd(e,e.painter.context.gl)},this.onRemove=e=>{this.implementation.onRemove&&this.implementation.onRemove(e,e.painter.context.gl)},this.implementation=e}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class Sh{constructor(e){this._methodToThrottle=e,this._triggered=!1,"undefined"!=typeof MessageChannel&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}const Ph={once:!0},Mh=6371008.8;class Eh{constructor(e,t){if(isNaN(e)||isNaN(t))throw new Error(`Invalid LngLat object: (${e}, ${t})`);if(this.lng=+e,this.lat=+t,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Eh(O(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const t=Math.PI/180,i=this.lat*t,n=e.lat*t,r=Math.sin(i)*Math.sin(n)+Math.cos(i)*Math.cos(n)*Math.cos((e.lng-this.lng)*t);return Mh*Math.acos(Math.min(r,1))}static convert(e){if(e instanceof Eh)return e;if(Array.isArray(e)&&(2===e.length||3===e.length))return new Eh(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&"object"==typeof e&&null!==e)return new Eh(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}const Ch=2*Math.PI*Mh;function kh(e){return Ch*Math.cos(e*Math.PI/180)}function Ih(e){return(180+e)/360}function zh(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function Ah(e,t){return e/kh(t)}function Lh(e){return 360*e-180}function Dh(e){return 360/Math.PI*Math.atan(Math.exp((180-360*e)*Math.PI/180))-90}function Rh(e,t){return e*kh(Dh(t))}class Fh{constructor(e,t,i=0){this.x=+e,this.y=+t,this.z=+i}static fromLngLat(e,t=0){const i=Eh.convert(e);return new Fh(Ih(i.lng),zh(i.lat),Ah(t,i.lat))}toLngLat(){return new Eh(Lh(this.x),Dh(this.y))}toAltitude(){return Rh(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/Ch*(e=Dh(this.y),1/Math.cos(e*Math.PI/180));var e}}function Bh(e,t,i){var n=2*Math.PI*6378137/256/Math.pow(2,i);return[e*n-2*Math.PI*6378137/2,t*n-2*Math.PI*6378137/2]}class Oh{constructor(e,t,i){if(r=t,o=i,(n=e)<0||n>25||o<0||o>=Math.pow(2,n)||r<0||r>=Math.pow(2,n))throw new Error(`x=${t}, y=${i}, z=${e} outside of bounds. 0<=x<${Math.pow(2,e)}, 0<=y<${Math.pow(2,e)} 0<=z<=25 `);var n,r,o;this.z=e,this.x=t,this.y=i,this.key=Vh(0,e,e,t,i)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,t,i){const n=(o=this.x,a=this.y,s=this.z,l=Bh(256*o,256*(a=Math.pow(2,s)-a-1),s),c=Bh(256*(o+1),256*(a+1),s),l[0]+","+l[1]+","+c[0]+","+c[1]),r=function(e,t,i){let n,r="";for(let o=e;o>0;o--)n=1<<o-1,r+=(t&n?1:0)+(i&n?2:0);return r}(this.z,this.x,this.y);var o,a,s,l,c;return e[(this.x+this.y)%e.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String("tms"===i?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,t>1?"@2x":"").replace(/{quadkey}/g,r).replace(/{bbox-epsg-3857}/g,n)}isChildOf(e){const t=this.z-e.z;return t>0&&e.x===this.x>>t&&e.y===this.y>>t}getTilePoint(e){const t=Math.pow(2,this.z);return new n((e.x*t-this.x)*I,(e.y*t-this.y)*I)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Nh{constructor(e,t){this.wrap=e,this.canonical=t,this.key=Vh(e,t.z,t.z,t.x,t.y)}}class jh{constructor(e,t,i,n,r){if(this.terrainRttPosMatrix32f=null,e<i)throw new Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${i}`);this.overscaledZ=e,this.wrap=t,this.canonical=new Oh(i,+n,+r),this.key=Vh(t,e,i,n,r)}clone(){return new jh(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const t=this.canonical.z-e;return e>this.canonical.z?new jh(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new jh(e,this.wrap,e,this.canonical.x>>t,this.canonical.y>>t)}isOverscaled(){return this.overscaledZ>this.canonical.z}calculateScaledKey(e,t){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const i=this.canonical.z-e;return e>this.canonical.z?Vh(this.wrap*+t,e,this.canonical.z,this.canonical.x,this.canonical.y):Vh(this.wrap*+t,e,e,this.canonical.x>>i,this.canonical.y>>i)}isChildOf(e){if(e.wrap!==this.wrap)return!1;if(this.overscaledZ-e.overscaledZ<=0)return!1;if(0===e.overscaledZ)return this.overscaledZ>0;const t=this.canonical.z-e.canonical.z;return!(t<0)&&e.canonical.x===this.canonical.x>>t&&e.canonical.y===this.canonical.y>>t}children(e){if(this.overscaledZ>=e)return[new jh(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const t=this.canonical.z+1,i=2*this.canonical.x,n=2*this.canonical.y;return[new jh(t,this.wrap,t,i,n),new jh(t,this.wrap,t,i+1,n),new jh(t,this.wrap,t,i,n+1),new jh(t,this.wrap,t,i+1,n+1)]}isLessThan(e){return this.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new jh(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new jh(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Nh(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new Fh(e.x-this.wrap,e.y))}}function Vh(e,t,i,n,r){(e*=2)<0&&(e=-1*e-1);const o=1<<i;return(o*o*e+o*r+n).toString(36)+i.toString(36)+t.toString(36)}function Uh(e,t){return t?e.properties[t]:e.id}function Zh(e,t){const i={id:e.id};if(t.removeAllProperties&&(delete e.removeProperties,delete e.addOrUpdateProperties,delete t.removeProperties),t.removeProperties)for(const n of t.removeProperties){const t=e.addOrUpdateProperties.findIndex(e=>e.key===n);t>-1&&e.addOrUpdateProperties.splice(t,1)}return(e.removeAllProperties||t.removeAllProperties)&&(i.removeAllProperties=!0),(e.removeProperties||t.removeProperties)&&(i.removeProperties=[...e.removeProperties||[],...t.removeProperties||[]]),(e.addOrUpdateProperties||t.addOrUpdateProperties)&&(i.addOrUpdateProperties=[...e.addOrUpdateProperties||[],...t.addOrUpdateProperties||[]]),(e.newGeometry||t.newGeometry)&&(i.newGeometry=t.newGeometry||e.newGeometry),i}function Gh(e){var t,i;if(!e)return{};const n={};return n.removeAll=e.removeAll,n.remove=new Set(e.remove||[]),n.add=new Map(null===(t=e.add)||void 0===t?void 0:t.map(e=>[e.id,e])),n.update=new Map(null===(i=e.update)||void 0===i?void 0:i.map(e=>[e.id,e])),n}fo("CanonicalTileID",Oh),fo("OverscaledTileID",jh,{omit:["terrainRttPosMatrix32f"]});class qh{constructor(){this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0}extend(e){return this.minX=Math.min(this.minX,e.x),this.minY=Math.min(this.minY,e.y),this.maxX=Math.max(this.maxX,e.x),this.maxY=Math.max(this.maxY,e.y),this}expandBy(e){return this.minX-=e,this.minY-=e,this.maxX+=e,this.maxY+=e,(this.minX>this.maxX||this.minY>this.maxY)&&(this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0),this}shrinkBy(e){return this.expandBy(-e)}map(e){const t=new qh;return t.extend(e(new n(this.minX,this.minY))),t.extend(e(new n(this.maxX,this.minY))),t.extend(e(new n(this.minX,this.maxY))),t.extend(e(new n(this.maxX,this.maxY))),t}static fromPoints(e){const t=new qh;for(const i of e)t.extend(i);return t}contains(e){return e.x>=this.minX&&e.x<=this.maxX&&e.y>=this.minY&&e.y<=this.maxY}empty(){return this.minX>this.maxX}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}covers(e){return!this.empty()&&!e.empty()&&e.minX>=this.minX&&e.maxX<=this.maxX&&e.minY>=this.minY&&e.maxY<=this.maxY}intersects(e){return!this.empty()&&!e.empty()&&e.minX<=this.maxX&&e.maxX>=this.minX&&e.minY<=this.maxY&&e.maxY>=this.minY}}class $h{constructor(e){this._stringToNumber={},this._numberToString=[];for(let t=0;t<e.length;t++){const i=e[t];this._stringToNumber[i]=t,this._numberToString[t]=i}}encode(e){return this._stringToNumber[e]}decode(e){if(e>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${e} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}}class Wh{constructor(e,t,i,n,r){this.type="Feature",this._vectorTileFeature=e,this._x=i,this._y=n,this._z=t,this.properties=e.properties,this.id=r}projectPoint(e,t,i,n){return[360*(e.x+t)/n-180,360/Math.PI*Math.atan(Math.exp((1-2*(e.y+i)/n)*Math.PI))-90]}projectLine(e,t,i,n){return e.map(e=>this.projectPoint(e,t,i,n))}get geometry(){if(this._geometry)return this._geometry;const e=this._vectorTileFeature,t=e.extent*Math.pow(2,this._z),i=e.extent*this._x,n=e.extent*this._y,r=e.loadGeometry();switch(e.type){case 1:{const e=[];for(const t of r)e.push(t[0]);const o=this.projectLine(e,i,n,t);this._geometry=1===e.length?{type:"Point",coordinates:o[0]}:{type:"MultiPoint",coordinates:o};break}case 2:{const e=r.map(e=>this.projectLine(e,i,n,t));this._geometry=1===e.length?{type:"LineString",coordinates:e[0]}:{type:"MultiLineString",coordinates:e};break}case 3:{const e=Ac(r),o=[];for(const r of e)o.push(r.map(e=>this.projectLine(e,i,n,t)));this._geometry=1===o.length?{type:"Polygon",coordinates:o[0]}:{type:"MultiPolygon",coordinates:o};break}default:throw new Error(`unknown feature type: ${e.type}`)}return this._geometry}set geometry(e){this._geometry=e}toJSON(){const e={geometry:this.geometry};for(const t in this)"_geometry"!==t&&"_vectorTileFeature"!==t&&"_x"!==t&&"_y"!==t&&"_z"!==t&&(e[t]=this[t]);return e}}class Hh{constructor(e,t,n){i(this,"_name"),i(this,"dataBuffer"),i(this,"nullabilityBuffer"),i(this,"_size"),this._name=e,this.dataBuffer=t,"number"==typeof n?this._size=n:(this.nullabilityBuffer=n,this._size=n.size())}getValue(e){return this.nullabilityBuffer&&!this.nullabilityBuffer.get(e)?null:this.getValueFromBuffer(e)}has(e){return this.nullabilityBuffer&&this.nullabilityBuffer.get(e)||!this.nullabilityBuffer}get name(){return this._name}get size(){return this._size}}class Xh extends Hh{}class Yh extends Xh{getValueFromBuffer(e){return this.dataBuffer[e]}}class Kh extends Xh{getValueFromBuffer(e){return this.dataBuffer[e]}}class Qh extends Hh{constructor(e,t,n,r){super(e,t,r),i(this,"delta"),this.delta=n}}class Jh extends Qh{constructor(e,t,i,n){super(e,Int32Array.of(t),i,n)}getValueFromBuffer(e){return this.dataBuffer[0]+e*this.delta}}class ed extends Hh{constructor(e,t,i){super(e,Int32Array.of(t),i)}getValueFromBuffer(e){return this.dataBuffer[0]}}class td{constructor(e,t,n,r,o=4096){i(this,"_name"),i(this,"_geometryVector"),i(this,"_idVector"),i(this,"_propertyVectors"),i(this,"_extent"),i(this,"propertyVectorsMap"),this._name=e,this._geometryVector=t,this._idVector=n,this._propertyVectors=r,this._extent=o}get name(){return this._name}get idVector(){return this._idVector}get geometryVector(){return this._geometryVector}get propertyVectors(){return this._propertyVectors}getPropertyVector(e){return this.propertyVectorsMap||(this.propertyVectorsMap=new Map(this._propertyVectors.map(e=>[e.name,e]))),this.propertyVectorsMap.get(e)}*[Symbol.iterator](){const e=this.geometryVector[Symbol.iterator]();let t=0;for(;t<this.numFeatures;){let i;this.idVector&&(i=this.containsMaxSaveIntegerValues(this.idVector)?Number(this.idVector.getValue(t)):this.idVector.getValue(t));const n=e?.next().value,r={};for(const e of this.propertyVectors){if(!e)continue;const i=e.name,n=e.getValue(t);null!==n&&(r[i]=n)}t++,yield{id:i,geometry:n,properties:r}}}get numFeatures(){return this.geometryVector.numGeometries}get extent(){return this._extent}getFeatures(){const e=[],t=this.geometryVector.getGeometries();for(let i=0;i<this.numFeatures;i++){let n;this.idVector&&(n=this.containsMaxSaveIntegerValues(this.idVector)?Number(this.idVector.getValue(i)):this.idVector.getValue(i));const r={coordinates:t[i],type:this.geometryVector.geometryType(i)},o={};for(const e of this.propertyVectors){if(!e)continue;const t=e.name,n=e.getValue(i);null!==n&&(o[t]=n)}e.push({id:n,geometry:r,properties:o})}return e}containsMaxSaveIntegerValues(e){return e instanceof Yh||e instanceof ed&&e instanceof Jh||e instanceof Kh}}class id{constructor(e){i(this,"value"),this.value=e}get(){return this.value}set(e){this.value=e}increment(){return this.value++}add(e){this.value+=e}}var nd,rd,od,ad,sd,ld,cd,ud,hd,dd,pd;function fd(e,t,i){const n=new Int32Array(i);let r=0,o=t.get();for(let a=0;a<n.length;a++){let t=e[o++],i=127&t;t<128||(t=e[o++],i|=(127&t)<<7,t<128||(t=e[o++],i|=(127&t)<<14,t<128||(t=e[o++],i|=(127&t)<<21,t<128||(t=e[o++],i|=(15&t)<<28)))),n[r++]=i}return t.set(o),n}function md(e,t,i){const n=new BigInt64Array(i);for(let r=0;r<n.length;r++)n[r]=xd(e,t);return n}function gd(e,t){let i,n;return n=e[t.get()],t.increment(),i=127&n,n<128?i:(n=e[t.get()],t.increment(),i|=(127&n)<<7,n<128?i:(n=e[t.get()],t.increment(),i|=(127&n)<<14,n<128?i:(n=e[t.get()],t.increment(),i|=(127&n)<<21,n<128?i:(n=e[t.get()],i|=(15&n)<<28,function(e,t,i){let n,r;if(r=t[i.get()],i.increment(),n=(112&r)>>4,r<128)return 4294967296*n+(e>>>0);if(r=t[i.get()],i.increment(),n|=(127&r)<<3,r<128)return 4294967296*n+(e>>>0);if(r=t[i.get()],i.increment(),n|=(127&r)<<10,r<128)return 4294967296*n+(e>>>0);if(r=t[i.get()],i.increment(),n|=(127&r)<<17,r<128)return 4294967296*n+(e>>>0);if(r=t[i.get()],i.increment(),n|=(127&r)<<24,r<128)return 4294967296*n+(e>>>0);if(r=t[i.get()],i.increment(),n|=(1&r)<<31,r<128)return 4294967296*n+(e>>>0);throw new Error("Expected varint not more than 10 bytes")}(i,e,t)))))}function _d(e,t,i,n){throw new Error("FastPFor is not implemented yet.")}function yd(e){return e>>>1^-(1&e)}function vd(e){return e>>1n^-(1n&e)}function xd(e,t){let i=0n,n=0,r=t.get();for(;r<e.length;){const t=e[r++];if(i|=BigInt(127&t)<<BigInt(n),!(128&t))break;if(n+=7,n>=64)throw new Error("Varint too long")}return t.set(r),i}function bd(e,t,i){const n=new Int32Array(i);let r=0;for(let o=0;o<t;o++){const i=e[o];n.fill(e[o+t],r,r+i),r+=i}return n}function wd(e,t,i){const n=new BigInt64Array(i);let r=0;for(let o=0;o<t;o++){const i=Number(e[o]);n.fill(e[o+t],r,r+i),r+=i}return n}function Td(e,t,i){const n=new Float64Array(i);let r=0;for(let o=0;o<t;o++){const i=e[o];n.fill(e[o+t],r,r+i),r+=i}return n}function Sd(e){const t=e.length/4*4;let i=1;if(t>=4)for(let n=e[0];i<t-4;i+=4)n=e[i]+=n,n=e[i+1]+=n,n=e[i+2]+=n,n=e[i+3]+=n;for(;i!=e.length;)e[i]+=e[i-1],++i}function Pd(e){e[0]=e[0]>>>1^-(1&e[0]),e[1]=e[1]>>>1^-(1&e[1]);const t=e.length/4*4;let i=2;if(t>=4)for(;i<t-4;i+=4){const t=e[i],n=e[i+1],r=e[i+2],o=e[i+3];e[i]=(t>>>1^-(1&t))+e[i-2],e[i+1]=(n>>>1^-(1&n))+e[i-1],e[i+2]=(r>>>1^-(1&r))+e[i],e[i+3]=(o>>>1^-(1&o))+e[i+1]}for(;i!=e.length;i+=2)e[i]=(e[i]>>>1^-(1&e[i]))+e[i-2],e[i+1]=(e[i+1]>>>1^-(1&e[i+1]))+e[i-1]}(pd=nd||(nd={})).NONE="NONE",pd.DELTA="DELTA",pd.COMPONENTWISE_DELTA="COMPONENTWISE_DELTA",pd.RLE="RLE",pd.MORTON="MORTON",pd.PDE="PDE",function(e){e.NONE="NONE",e.FAST_PFOR="FAST_PFOR",e.VARINT="VARINT",e.ALP="ALP"}(rd||(rd={})),function(e){e.PRESENT="PRESENT",e.DATA="DATA",e.OFFSET="OFFSET",e.LENGTH="LENGTH"}(od||(od={}));class Md{constructor(e,t,n){i(this,"_dictionaryType"),i(this,"_offsetType"),i(this,"_lengthType"),this._dictionaryType=e,this._offsetType=t,this._lengthType=n}get dictionaryType(){return this._dictionaryType}get offsetType(){return this._offsetType}get lengthType(){return this._lengthType}}function Ed(e,t){const i=function(e,t){const i=e[t.get()],n=Object.values(od)[i>>4];let r=null;switch(n){case od.DATA:r=new Md(Object.values(ad)[15&i]);break;case od.OFFSET:r=new Md(null,Object.values(sd)[15&i]);break;case od.LENGTH:r=new Md(null,null,Object.values(ld)[15&i])}t.increment();const o=e[t.get()],a=Object.values(nd)[o>>5],s=Object.values(nd)[o>>2&7],l=Object.values(rd)[3&o];t.increment();const c=fd(e,t,2),u=c[0];return{physicalStreamType:n,logicalStreamType:r,logicalLevelTechnique1:a,logicalLevelTechnique2:s,physicalLevelTechnique:l,numValues:u,byteLength:c[1],decompressedCount:u}}(e,t);return i.logicalLevelTechnique1===nd.MORTON?function(e,t,i){const n=fd(t,i,2);return{physicalStreamType:e.physicalStreamType,logicalStreamType:e.logicalStreamType,logicalLevelTechnique1:e.logicalLevelTechnique1,logicalLevelTechnique2:e.logicalLevelTechnique2,physicalLevelTechnique:e.physicalLevelTechnique,numValues:e.numValues,byteLength:e.byteLength,decompressedCount:e.decompressedCount,numBits:n[0],coordinateShift:n[1]}}(i,e,t):nd.RLE!==i.logicalLevelTechnique1&&nd.RLE!==i.logicalLevelTechnique2||rd.NONE===i.physicalLevelTechnique?i:function(e,t,i){const n=fd(t,i,2);return{physicalStreamType:e.physicalStreamType,logicalStreamType:e.logicalStreamType,logicalLevelTechnique1:e.logicalLevelTechnique1,logicalLevelTechnique2:e.logicalLevelTechnique2,physicalLevelTechnique:e.physicalLevelTechnique,numValues:e.numValues,byteLength:e.byteLength,decompressedCount:n[1],runs:n[0],numRleValues:n[1]}}(i,e,t)}!function(e){e.NONE="NONE",e.SINGLE="SINGLE",e.SHARED="SHARED",e.VERTEX="VERTEX",e.MORTON="MORTON",e.FSST="FSST"}(ad||(ad={})),function(e){e.VERTEX="VERTEX",e.INDEX="INDEX",e.STRING="STRING",e.KEY="KEY"}(sd||(sd={})),function(e){e.VAR_BINARY="VAR_BINARY",e.GEOMETRIES="GEOMETRIES",e.PARTS="PARTS",e.RINGS="RINGS",e.TRIANGLES="TRIANGLES",e.SYMBOL="SYMBOL",e.DICTIONARY="DICTIONARY"}(ld||(ld={})),function(e){e[e.FLAT=0]="FLAT",e[e.CONST=1]="CONST",e[e.SEQUENCE=2]="SEQUENCE",e[e.DICTIONARY=3]="DICTIONARY",e[e.FSST_DICTIONARY=4]="FSST_DICTIONARY"}(cd||(cd={}));class Cd{constructor(e,t){i(this,"values"),i(this,"_size"),this.values=e,this._size=t}get(e){const t=Math.floor(e/8);return 1==(this.values[t]>>e%8&1)}set(e,t){const i=Math.floor(e/8);this.values[i]=this.values[i]|(t?1:0)<<e%8}getInt(e){const t=Math.floor(e/8);return this.values[t]>>e%8&1}size(){return this._size}getBuffer(){return this.values}}function kd(e,t,i,n,r){return function(e,t,i){switch(t.logicalLevelTechnique1){case nd.DELTA:return t.logicalLevelTechnique2===nd.RLE?function(e,t,i){const n=new Int32Array(i);let r=0,o=0;for(let a=0;a<t;a++){const i=e[a],s=yd(e[a+t]);for(let e=0;e<i;e++)o+=s,n[r++]=o}return n}(e,t.runs,t.numRleValues):(function(e){e[0]=e[0]>>>1^-(1&e[0]);const t=e.length/4*4;let i=1;if(t>=4)for(;i<t-4;i+=4){const t=e[i],n=e[i+1],r=e[i+2],o=e[i+3];e[i]=(t>>>1^-(1&t))+e[i-1],e[i+1]=(n>>>1^-(1&n))+e[i],e[i+2]=(r>>>1^-(1&r))+e[i+1],e[i+3]=(o>>>1^-(1&o))+e[i+2]}for(;i!=e.length;++i)e[i]=(e[i]>>>1^-(1&e[i]))+e[i-1]}(e),e);case nd.RLE:return n=e,r=t,i?function(e,t,i){const n=new Int32Array(i);let r=0;for(let o=0;o<t;o++){const i=e[o];let a=e[o+t];a=a>>>1^-(1&a),n.fill(a,r,r+i),r+=i}return n}(n,r.runs,r.numRleValues):bd(n,r.runs,r.numRleValues);case nd.MORTON:return Sd(e),e;case nd.COMPONENTWISE_DELTA:return Pd(e),e;case nd.NONE:return i&&function(e){for(let t=0;t<e.length;t++){const i=e[t];e[t]=i>>>1^-(1&i)}}(e),e;default:throw new Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}var n,r}(zd(e,t,i),i,n)}function Id(e,t,i){return function(e,t){if(t.logicalLevelTechnique1===nd.DELTA&&t.logicalLevelTechnique2===nd.NONE)return function(e){const t=new Int32Array(e.length+1);t[0]=0,t[1]=yd(e[0]);let i=t[1],n=2;for(;n!=t.length;++n){const r=e[n-1];i+=r>>>1^-(1&r),t[n]=t[n-1]+i}return t}(e);if(t.logicalLevelTechnique1===nd.RLE&&t.logicalLevelTechnique2===nd.NONE)return function(e,t,i){const n=new Int32Array(i+1);n[0]=0;let r=1,o=n[0];for(let a=0;a<t;a++){const i=e[a],s=e[a+t];for(let e=r;e<r+i;e++)n[e]=s+o,o=n[e];r+=i}return n}(e,t.runs,t.numRleValues);if(t.logicalLevelTechnique1===nd.NONE&&t.logicalLevelTechnique2===nd.NONE){!function(e){let t=0;for(let i=0;i<e.length;i++)e[i]+=t,t=e[i]}(e);const i=new Int32Array(t.numValues+1);return i[0]=0,i.set(e,1),i}if(t.logicalLevelTechnique1===nd.DELTA&&t.logicalLevelTechnique2===nd.RLE){const i=function(e,t,i){const n=new Int32Array(i+1);n[0]=0;let r=1,o=n[0];for(let a=0;a<t;a++){const i=e[a];let s=e[a+t];s=s>>>1^-(1&s);for(let e=r;e<r+i;e++)n[e]=s+o,o=n[e];r+=i}return n}(e,t.runs,t.numRleValues);return Sd(i),i}throw new Error("Only delta encoding is supported for transforming length to offset streams yet.")}(zd(e,t,i),i)}function zd(e,t,i){const n=i.physicalLevelTechnique;if(n===rd.FAST_PFOR)return _d();if(n===rd.VARINT)return fd(e,t,i.numValues);if(n===rd.NONE){const n=t.get();t.add(i.byteLength);const r=e.subarray(n,t.get());return new Int32Array(r)}throw new Error("Specified physicalLevelTechnique is not supported (yet).")}function Ad(e,t,i,n){const r=zd(e,t,i);if(1===r.length){const e=r[0];return n?yd(e):e}return n?yd(r[1]):function(e){return e[1]}(r)}function Ld(e,t,i){return function(e){if(2==e.length){const t=yd(e[1]);return[t,t]}return[yd(e[2]),yd(e[3])]}(zd(e,t,i))}function Dd(e,t,i){return function(e){if(2==e.length){const t=vd(e[1]);return[t,t]}return[vd(e[2]),vd(e[3])]}(md(e,t,i.numValues))}function Rd(e,t,i,n){return function(e,t,i){switch(t.logicalLevelTechnique1){case nd.DELTA:return t.logicalLevelTechnique2===nd.RLE?function(e,t,i){const n=new BigInt64Array(i);let r=0,o=0n;for(let a=0;a<t;a++){const i=Number(e[a]),s=vd(e[a+t]);for(let e=0;e<i;e++)o+=s,n[r++]=o}return n}(e,t.runs,t.numRleValues):(function(e){e[0]=e[0]>>1n^-(1n&e[0]);const t=e.length/4*4;let i=1;if(t>=4)for(;i<t-4;i+=4){const t=e[i],n=e[i+1],r=e[i+2],o=e[i+3];e[i]=(t>>1n^-(1n&t))+e[i-1],e[i+1]=(n>>1n^-(1n&n))+e[i],e[i+2]=(r>>1n^-(1n&r))+e[i+1],e[i+3]=(o>>1n^-(1n&o))+e[i+2]}for(;i!=e.length;++i)e[i]=(e[i]>>1n^-(1n&e[i]))+e[i-1]}(e),e);case nd.RLE:return n=e,r=t,i?function(e,t,i){const n=new BigInt64Array(i);let r=0;for(let o=0;o<t;o++){const i=Number(e[o]);let a=e[o+t];a=a>>1n^-(1n&a),n.fill(a,r,r+i),r+=i}return n}(n,r.runs,r.numRleValues):wd(n,r.runs,r.numRleValues);case nd.NONE:return i&&function(e){for(let t=0;t<e.length;t++){const i=e[t];e[t]=i>>1n^-(1n&i)}}(e),e;default:throw new Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}var n,r}(md(e,t,i.numValues),i,n)}function Fd(e,t,i,n){const r=md(e,t,i.numValues);if(1===r.length){const e=r[0];return n?vd(e):e}return n?vd(r[1]):function(e){return e[1]}(r)}function Bd(e,t,i,n,r){return function(e,t,i,n){switch(t.logicalLevelTechnique1){case nd.DELTA:return t.logicalLevelTechnique2===nd.RLE&&(e=bd(e,t.runs,t.numRleValues)),function(e,t){const i=new Int32Array(e.size());let n=0;e.get(0)?(i[0]=e.get(0)?t[0]>>>1^-(1&t[0]):0,n=1):i[0]=0;let r=1;for(;r!=i.length;++r)i[r]=e.get(r)?i[r-1]+(t[n]>>>1^-(1&t[n++])):i[r-1];return i}(n,e);case nd.RLE:return function(e,t,i,n){const r=t;return i?function(e,t,i){const n=new Int32Array(e.size());let r=0;for(let o=0;o<i;o++){const a=t[o];let s=t[o+i];s=s>>>1^-(1&s);for(let t=r;t<r+a;t++)e.get(t)?n[t]=s:(n[t]=0,r++);r+=a}return n}(n,e,r.runs):function(e,t,i){const n=new Int32Array(e.size());let r=0;for(let o=0;o<i;o++){const a=t[o],s=t[o+i];for(let t=r;t<r+a;t++)e.get(t)?n[t]=s:(n[t]=0,r++);r+=a}return n}(n,e,r.runs)}(e,t,i,n);case nd.MORTON:return Sd(e),e;case nd.COMPONENTWISE_DELTA:return Pd(e),e;case nd.NONE:return e=i?function(e,t){const i=new Int32Array(e.size());let n=0,r=0;for(;r!=i.length;++r)if(e.get(r)){const e=t[n++];i[r]=e>>>1^-(1&e)}else i[r]=0;return i}(n,e):function(e,t){const i=new Int32Array(e.size());let n=0,r=0;for(;r!=i.length;++r)i[r]=e.get(r)?t[n++]:0;return i}(n,e);default:throw new Error("The specified Logical level technique is not supported")}}(i.physicalLevelTechnique===rd.FAST_PFOR?_d():fd(e,t,i.numValues),i,n,r)}function Od(e,t,i,n){const r=e.logicalLevelTechnique1;if(r===nd.RLE)return 1===e.runs?cd.CONST:cd.FLAT;const o=t instanceof Cd?t.size():t;if(r===nd.DELTA&&e.logicalLevelTechnique2===nd.RLE){const t=e.runs,r=2;if(e.numRleValues!==o)return cd.FLAT;if(1===t)return cd.SEQUENCE;if(2===t){const t=n.get();let o;if(e.physicalLevelTechnique===rd.VARINT)o=fd(i,n,4);else{const e=n.get();o=new Int32Array(i.buffer,i.byteOffset+e,4)}if(n.set(t),o[2]===r&&o[3]===r)return cd.SEQUENCE}}return 1===e.numValues?cd.CONST:cd.FLAT}class Nd extends Xh{getValueFromBuffer(e){return this.dataBuffer[e]}}class jd extends Qh{constructor(e,t,i,n){super(e,BigInt64Array.of(t),i,n)}getValueFromBuffer(e){return this.dataBuffer[0]+BigInt(e)*this.delta}}class Vd{constructor(e,t,n){i(this,"_geometryOffsets"),i(this,"_partOffsets"),i(this,"_ringOffsets"),this._geometryOffsets=e,this._partOffsets=t,this._ringOffsets=n}get geometryOffsets(){return this._geometryOffsets}get partOffsets(){return this._partOffsets}get ringOffsets(){return this._ringOffsets}}function Ud(e,t,i){return{x:Zd(e,t)-i,y:Zd(e>>1,t)-i}}function Zd(e,t){let i=0;for(let n=0;n<t;n++)i|=(e&1<<2*n)>>n;return i}!function(e){e[e.POINT=0]="POINT",e[e.LINESTRING=1]="LINESTRING",e[e.POLYGON=2]="POLYGON",e[e.MULTIPOINT=3]="MULTIPOINT",e[e.MULTILINESTRING=4]="MULTILINESTRING",e[e.MULTIPOLYGON=5]="MULTIPOLYGON"}(ud||(ud={})),function(e){e[e.POINT=0]="POINT",e[e.LINESTRING=1]="LINESTRING",e[e.POLYGON=2]="POLYGON"}(hd||(hd={})),function(e){e[e.MORTON=0]="MORTON",e[e.VEC_2=1]="VEC_2",e[e.VEC_3=2]="VEC_3"}(dd||(dd={}));class Gd{createPoint(e){return[[e]]}createMultiPoint(e){return e.map(e=>[e])}createLineString(e){return[e]}createMultiLineString(e){return e}createPolygon(e,t){return[e].concat(t)}createMultiPolygon(e){return e.flat()}}function qd(e){const t=new Array(e.numGeometries);let i=1,r=1,o=1,a=0;const s=new Gd;let l=0,c=0;const u=e.mortonSettings,h=e.topologyVector,d=h.geometryOffsets,p=h.partOffsets,f=h.ringOffsets,m=e.vertexOffsets,g=e.containsPolygonGeometry(),_=e.vertexBuffer;for(let y=0;y<e.numGeometries;y++){const h=e.geometryType(y);if(h===ud.POINT){if(m&&0!==m.length)if(e.vertexBufferType===dd.VEC_2){const e=2*m[c++],i=new n(_[e],_[e+1]);t[a++]=s.createPoint(i)}else{const e=Ud(_[m[c++]],u.numBits,u.coordinateShift),i=new n(e.x,e.y);t[a++]=s.createPoint(i)}else{const e=new n(_[l++],_[l++]);t[a++]=s.createPoint(e)}d&&o++,p&&i++,f&&r++}else if(h===ud.MULTIPOINT){const e=d[o]-d[o-1];o++;const i=new Array(e);if(m&&0!==m.length){for(let t=0;t<e;t++){const e=2*m[c++];i[t]=new n(_[e],_[e+1])}t[a++]=s.createMultiPoint(i)}else{for(let t=0;t<e;t++){const e=_[l++],r=_[l++];i[t]=new n(e,r)}t[a++]=s.createMultiPoint(i)}}else if(h===ud.LINESTRING){let n,h=0;g?(h=f[r]-f[r-1],r++):h=p[i]-p[i-1],i++,m&&0!==m.length?(n=e.vertexBufferType===dd.VEC_2?Yd(_,m,c,h,!1):Kd(_,m,c,h,!1,u),c+=h):(n=Xd(_,l,h,!1),l+=2*h),t[a++]=s.createLineString(n),d&&o++}else if(h===ud.POLYGON){const n=p[i]-p[i-1];i++;const h=new Array(n-1);let g=f[r]-f[r-1];if(r++,m&&0!==m.length){const i=e.vertexBufferType===dd.VEC_2?Wd(_,m,c,g):Hd(_,m,c,g,0,u);c+=g;for(let t=0;t<h.length;t++)g=f[r]-f[r-1],r++,h[t]=e.vertexBufferType===dd.VEC_2?Wd(_,m,c,g):Hd(_,m,c,g,0,u),c+=g;t[a++]=s.createPolygon(i,h)}else{const e=$d(_,l,g);l+=2*g;for(let t=0;t<h.length;t++)g=f[r]-f[r-1],r++,h[t]=$d(_,l,g),l+=2*g;t[a++]=s.createPolygon(e,h)}d&&o++}else if(h===ud.MULTILINESTRING){const n=d[o]-d[o-1];o++;const h=new Array(n);if(m&&0!==m.length){for(let t=0;t<n;t++){let n=0;g?(n=f[r]-f[r-1],r++):n=p[i]-p[i-1],i++;const o=e.vertexBufferType===dd.VEC_2?Yd(_,m,c,n,!1):Kd(_,m,c,n,!1,u);h[t]=o,c+=n}t[a++]=s.createMultiLineString(h)}else{for(let e=0;e<n;e++){let t=0;g?(t=f[r]-f[r-1],r++):t=p[i]-p[i-1],i++,h[e]=Xd(_,l,t,!1),l+=2*t}t[a++]=s.createMultiLineString(h)}}else{if(h!==ud.MULTIPOLYGON)throw new Error("The specified geometry type is currently not supported.");{const n=d[o]-d[o-1];o++;const h=new Array(n);let g=0;if(m&&0!==m.length){for(let t=0;t<n;t++){const n=p[i]-p[i-1];i++;const o=new Array(n-1);g=f[r]-f[r-1],r++;const a=e.vertexBufferType===dd.VEC_2?Wd(_,m,c,g):Hd(_,m,c,g,0,u);c+=g;for(let t=0;t<o.length;t++)g=f[r]-f[r-1],r++,o[t]=e.vertexBufferType===dd.VEC_2?Wd(_,m,c,g):Hd(_,m,c,g,0,u),c+=g;h[t]=s.createPolygon(a,o)}t[a++]=s.createMultiPolygon(h)}else{for(let e=0;e<n;e++){const t=p[i]-p[i-1];i++;const n=new Array(t-1);g=f[r]-f[r-1],r++;const o=$d(_,l,g);l+=2*g;for(let e=0;e<n.length;e++){const t=f[r]-f[r-1];r++,n[e]=$d(_,l,t),l+=2*t}h[e]=s.createPolygon(o,n)}t[a++]=s.createMultiPolygon(h)}}}}return t}function $d(e,t,i){return Xd(e,t,i,!0)}function Wd(e,t,i,n){return Yd(e,t,i,n,!0)}function Hd(e,t,i,n,r,o){return Kd(e,t,i,n,!0,o)}function Xd(e,t,i,r){const o=new Array(r?i+1:i);for(let a=0;a<2*i;a+=2)o[a/2]=new n(e[t+a],e[t+a+1]);return r&&(o[o.length-1]=o[0]),o}function Yd(e,t,i,r,o){const a=new Array(o?r+1:r);for(let s=0;s<2*r;s+=2){const r=2*t[i+s/2];a[s/2]=new n(e[r],e[r+1])}return o&&(a[a.length-1]=a[0]),a}function Kd(e,t,i,r,o,a){const s=new Array(o?r+1:r);for(let l=0;l<r;l++){const r=Ud(e[t[i+l]],a.numBits,a.coordinateShift);s[l]=new n(r.x,r.y)}return o&&(s[s.length-1]=s[0]),s}class Qd{constructor(e,t,n,r,o){i(this,"_vertexBufferType"),i(this,"_topologyVector"),i(this,"_vertexOffsets"),i(this,"_vertexBuffer"),i(this,"_mortonSettings"),this._vertexBufferType=e,this._topologyVector=t,this._vertexOffsets=n,this._vertexBuffer=r,this._mortonSettings=o}get vertexBufferType(){return this._vertexBufferType}get topologyVector(){return this._topologyVector}get vertexOffsets(){return this._vertexOffsets}get vertexBuffer(){return this._vertexBuffer}*[Symbol.iterator](){const e=qd(this);let t=0;for(;t<this.numGeometries;)yield{coordinates:e[t],type:this.geometryType(t)},t++}getSimpleEncodedVertex(e){const t=this.vertexOffsets?2*this.vertexOffsets[e]:2*e;return[this.vertexBuffer[t],this.vertexBuffer[t+1]]}getVertex(e){if(this.vertexOffsets&&this.mortonSettings){const t=Ud(this.vertexBuffer[this.vertexOffsets[e]],this.mortonSettings.numBits,this.mortonSettings.coordinateShift);return[t.x,t.y]}const t=this.vertexOffsets?2*this.vertexOffsets[e]:2*e;return[this.vertexBuffer[t],this.vertexBuffer[t+1]]}getGeometries(){return qd(this)}get mortonSettings(){return this._mortonSettings}}class Jd extends Qd{constructor(e,t,n,r,o,a,s){super(n,r,o,a,s),i(this,"_numGeometries"),i(this,"_geometryType"),this._numGeometries=e,this._geometryType=t}geometryType(e){return this._geometryType}get numGeometries(){return this._numGeometries}containsPolygonGeometry(){return this._geometryType===ud.POLYGON||this._geometryType===ud.MULTIPOLYGON}containsSingleGeometryType(){return!0}}class ep extends Qd{constructor(e,t,n,r,o,a){super(e,n,r,o,a),i(this,"_geometryTypes"),this._geometryTypes=t}geometryType(e){return this._geometryTypes[e]}get numGeometries(){return this._geometryTypes.length}containsPolygonGeometry(){for(let e=0;e<this.numGeometries;e++)if(this.geometryType(e)===ud.POLYGON||this.geometryType(e)===ud.MULTIPOLYGON)return!0;return!1}containsSingleGeometryType(){return!1}}class tp{constructor(e,t,n,r){i(this,"_triangleOffsets"),i(this,"_indexBuffer"),i(this,"_vertexBuffer"),i(this,"_topologyVector"),this._triangleOffsets=e,this._indexBuffer=t,this._vertexBuffer=n,this._topologyVector=r}get triangleOffsets(){return this._triangleOffsets}get indexBuffer(){return this._indexBuffer}get vertexBuffer(){return this._vertexBuffer}get topologyVector(){return this._topologyVector}getGeometries(){if(!this._topologyVector)throw new Error("Cannot convert GpuVector to coordinates without topology information");const e=new Array(this.numGeometries),t=this._topologyVector,i=t.partOffsets,r=t.ringOffsets,o=t.geometryOffsets;let a=0,s=1,l=1,c=1;for(let u=0;u<this.numGeometries;u++)switch(this.geometryType(u)){case ud.POLYGON:{const t=i[s]-i[s-1];s++;const h=[];for(let e=0;e<t;e++){const e=r[l]-r[l-1];l++;const t=[];for(let i=0;i<e;i++){const e=this._vertexBuffer[a++],i=this._vertexBuffer[a++];t.push(new n(e,i))}t.length>0&&t.push(t[0]),h.push(t)}e[u]=h,o&&c++}break;case ud.MULTIPOLYGON:{const t=o[c]-o[c-1];c++;const h=[];for(let e=0;e<t;e++){const e=i[s]-i[s-1];s++;for(let t=0;t<e;t++){const e=r[l]-r[l-1];l++;const t=[];for(let i=0;i<e;i++){const e=this._vertexBuffer[a++],i=this._vertexBuffer[a++];t.push(new n(e,i))}t.length>0&&t.push(t[0]),h.push(t)}}e[u]=h}}return e}[Symbol.iterator](){return null}}function ip(e,t,i,n,r,o){return new np(e,t,i,n,r,o)}class np extends tp{constructor(e,t,n,r,o,a){super(n,r,o,a),i(this,"_numGeometries"),i(this,"_geometryType"),this._numGeometries=e,this._geometryType=t}geometryType(e){return this._geometryType}get numGeometries(){return this._numGeometries}containsSingleGeometryType(){return!0}}function rp(e,t,i,n,r){return new op(e,t,i,n,r)}class op extends tp{constructor(e,t,n,r,o){super(t,n,r,o),i(this,"_geometryTypes"),this._geometryTypes=e}geometryType(e){return this._geometryTypes[e]}get numGeometries(){return this._geometryTypes.length}containsSingleGeometryType(){return!1}}function ap(e,t,i,n,r){const o=Ed(e,i);let a=null,s=null,l=null,c=null,u=null,h=null,d=null,p=null;if(Od(o,n,e,i)===cd.CONST){const r=Ad(e,i,o,!1);for(let n=0;n<t-1;n++){const t=Ed(e,i);switch(t.physicalStreamType){case od.LENGTH:switch(t.logicalStreamType.lengthType){case ld.GEOMETRIES:a=Id(e,i,t);break;case ld.PARTS:s=Id(e,i,t);break;case ld.RINGS:l=Id(e,i,t);break;case ld.TRIANGLES:d=Id(e,i,t)}break;case od.OFFSET:switch(t.logicalStreamType.offsetType){case sd.VERTEX:c=kd(e,i,t,!1);break;case sd.INDEX:p=kd(e,i,t,!1)}break;case od.DATA:ad.VERTEX===t.logicalStreamType.dictionaryType?u=kd(e,i,t,!0):(h={numBits:t.numBits,coordinateShift:t.coordinateShift},u=kd(e,i,t,!1))}}return null!==p?null!=a||null!=s?ip(n,r,d,p,u,new Vd(a,s,l)):ip(n,r,d,p,u):null===h?(f=n,m=r,g=new Vd(a,s,l),_=c,y=u,new Jd(f,m,dd.VEC_2,g,_,y)):function(e,t,i,n,r,o){return new Jd(e,t,dd.MORTON,i,n,r,o)}(n,r,new Vd(a,s,l),c,u,h)}var f,m,g,_,y;const v=kd(e,i,o,!1);for(let x=0;x<t-1;x++){const t=Ed(e,i);switch(t.physicalStreamType){case od.LENGTH:switch(t.logicalStreamType.lengthType){case ld.GEOMETRIES:a=kd(e,i,t,!1);break;case ld.PARTS:s=kd(e,i,t,!1);break;case ld.RINGS:l=kd(e,i,t,!1);break;case ld.TRIANGLES:d=Id(e,i,t)}break;case od.OFFSET:switch(t.logicalStreamType.offsetType){case sd.VERTEX:c=kd(e,i,t,!1);break;case sd.INDEX:p=kd(e,i,t,!1)}break;case od.DATA:ad.VERTEX===t.logicalStreamType.dictionaryType?u=kd(e,i,t,!0):(h={numBits:t.numBits,coordinateShift:t.coordinateShift},u=kd(e,i,t,!1))}}return null!==p&&null===s?rp(v,d,p,u):(null!==a?(a=sp(v,a,2),null!==s&&null!==l?(s=lp(v,a,s,!1),l=function(e,t,i,n){const r=new Int32Array(i[i.length-1]+1);let o=0;r[0]=o;let a=1,s=1,l=0;for(let c=0;c<e.length;c++){const u=e[c],h=t[c+1]-t[c];if(0!==u&&3!==u)for(let e=0;e<h;e++){const e=i[a]-i[a-1];a++;for(let t=0;t<e;t++)o=r[s++]=o+n[l++]}else for(let e=0;e<h;e++)r[s++]=++o,a++}return r}(v,a,s,l)):null!==s&&(s=function(e,t,i){const n=new Int32Array(t[t.length-1]+1);let r=0;n[0]=r;let o=1,a=0;for(let s=0;s<e.length;s++){const l=e[s],c=t[s+1]-t[s];if(4===l||1===l)for(let e=0;e<c;e++)r=n[o++]=r+i[a++];else for(let e=0;e<c;e++)n[o++]=++r}return n}(v,a,s))):null!==s&&null!==l?(s=sp(v,s,1),l=lp(v,s,l,!0)):null!==s&&(s=sp(v,s,0)),null!==p?rp(v,d,p,u,new Vd(a,s,l)):null===h?function(e,t,i,n){return new ep(dd.VEC_2,e,t,i,n)}(v,new Vd(a,s,l),c,u):function(e,t,i,n,r){return new ep(dd.MORTON,e,t,i,n,r)}(v,new Vd(a,s,l),c,u,h))}function sp(e,t,i){const n=new Int32Array(e.length+1);let r=0;n[0]=r;let o=0;for(let a=0;a<e.length;a++)r=n[a+1]=r+(e[a]>i?t[o++]:1);return n}function lp(e,t,i,n){const r=new Int32Array(t[t.length-1]+1);let o=0;r[0]=o;let a=1,s=0;for(let l=0;l<e.length;l++){const c=e[l],u=t[l+1]-t[l];if(5===c||2===c||n&&(4===c||1===c))for(let e=0;e<u;e++)o=r[a++]=o+i[s++];else for(let e=0;e<u;e++)r[a++]=++o}return r}class cp extends Hh{constructor(e,t,n){super(e,t.getBuffer(),n),i(this,"dataVector"),this.dataVector=t}getValueFromBuffer(e){return this.dataVector.get(e)}}class up extends Xh{getValueFromBuffer(e){return this.dataBuffer[e]}}class hp extends Hh{constructor(e,t,i){super(e,BigInt64Array.of(t),i)}getValueFromBuffer(e){return this.dataBuffer[0]}}function dp(e,t,i){return pp(e,Math.ceil(t/8),i)}function pp(e,t,i){const n=new Uint8Array(t);let r=0;for(;r<t;){const t=e[i.increment()];if(t<=127){const o=t+3,a=e[i.increment()],s=r+o;n.fill(a,r,s),r=s}else{const o=256-t;for(let t=0;t<o;t++)n[r++]=e[i.increment()]}}return n}const fp=new TextDecoder;function mp(e,t,i){return i-t>=12?fp.decode(e.subarray(t,i)):function(e,t,i){let n="",r=t;for(;r<i;){const t=e[r];let o,a,s,l=null,c=t>239?4:t>223?3:t>191?2:1;if(r+c>i)break;1===c?t<128&&(l=t):2===c?(o=e[r+1],128==(192&o)&&(l=(31&t)<<6|63&o,l<=127&&(l=null))):3===c?(o=e[r+1],a=e[r+2],128==(192&o)&&128==(192&a)&&(l=(15&t)<<12|(63&o)<<6|63&a,(l<=2047||l>=55296&&l<=57343)&&(l=null))):4===c&&(o=e[r+1],a=e[r+2],s=e[r+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(l=(15&t)<<18|(63&o)<<12|(63&a)<<6|63&s,(l<=65535||l>=1114112)&&(l=null))),null===l?(l=65533,c=1):l>65535&&(l-=65536,n+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),n+=String.fromCharCode(l),r+=c}return n}(e,t,i)}class gp extends Hh{constructor(e,t,n,r){super(e,n,r),i(this,"offsetBuffer"),this.offsetBuffer=t}}class _p extends gp{constructor(e,t,n,r){super(e,t,n,r??t.length-1),i(this,"textEncoder"),this.textEncoder=new TextEncoder}getValueFromBuffer(e){return mp(this.dataBuffer,this.offsetBuffer[e],this.offsetBuffer[e+1])}}class yp extends gp{constructor(e,t,n,r,o){super(e,n,r,o??t.length),i(this,"indexBuffer"),i(this,"textEncoder"),this.indexBuffer=t,this.indexBuffer=t,this.textEncoder=new TextEncoder}getValueFromBuffer(e){const t=this.indexBuffer[e];return mp(this.dataBuffer,this.offsetBuffer[t],this.offsetBuffer[t+1])}}class vp extends gp{constructor(e,t,n,r,o,a,s){super(e,n,r,s),i(this,"indexBuffer"),i(this,"symbolOffsetBuffer"),i(this,"symbolTableBuffer"),i(this,"textEncoder"),i(this,"symbolLengthBuffer"),i(this,"lengthBuffer"),i(this,"decodedDictionary"),this.indexBuffer=t,this.symbolOffsetBuffer=o,this.symbolTableBuffer=a,this.textEncoder=new TextEncoder}getValueFromBuffer(e){null==this.decodedDictionary&&(null==this.symbolLengthBuffer&&(this.symbolLengthBuffer=this.offsetToLengthBuffer(this.symbolOffsetBuffer),this.lengthBuffer=this.offsetToLengthBuffer(this.offsetBuffer)),this.decodedDictionary=function(e,t,i){const n=[],r=new Array(t.length).fill(0);for(let o=1;o<t.length;o++)r[o]=r[o-1]+t[o-1];for(let o=0;o<i.length;o++)if(255===i[o])n.push(i[++o]);else{const a=t[i[o]],s=r[i[o]];for(let t=0;t<a;t++)n.push(e[s+t])}return new Uint8Array(n)}(this.symbolTableBuffer,this.symbolLengthBuffer,this.dataBuffer));const t=this.indexBuffer[e];return mp(this.decodedDictionary,this.offsetBuffer[t],this.offsetBuffer[t+1])}offsetToLengthBuffer(e){const t=new Uint32Array(e.length-1);let i=e[0];for(let n=1;n<e.length;n++){const r=e[n];t[n-1]=r-i,i=r}return t}}function xp(e,t,i,n,r,o){return"scalarType"===i.type?function(e,t,i,n,r,o){let a=null,s=0;if(0===e)return null;if(o.nullable){const e=Ed(t,i);s=e.numValues;const n=i.get(),r=dp(t,s,i);i.set(n+e.byteLength),a=new Cd(r,e.numValues)}const l=a??n;switch(r.physicalType){case 4:case 3:return function(e,t,i,n,r){const o=Ed(e,t),a=Od(o,r,e,t),s=3===n.physicalType;if(a===cd.FLAT){const n=bp(r)?Bd(e,t,o,s,r):kd(e,t,o,s);return new Yh(i.name,n,r)}if(a===cd.SEQUENCE){const n=Ld(e,t,o);return new Jh(i.name,n[0],n[1],o.numRleValues)}{const n=Ad(e,t,o,s);return new ed(i.name,n,r)}}(t,i,o,r,l);case 9:return function(e,t,i,n,r){let o=null,a=null,s=null,l=null,c=null,u=null,h=null,d=null;for(let x=0;x<n;x++){const e=Ed(t,i);if(0!==e.byteLength)switch(e.physicalStreamType){case od.PRESENT:{const n=dp(t,e.numValues,i);u=new Cd(n,e.numValues);break}case od.OFFSET:a=null!=r||null!=u?Bd(t,i,e,!1,r??u):kd(t,i,e,!1);break;case od.LENGTH:{const n=Id(t,i,e);ld.DICTIONARY===e.logicalStreamType.lengthType?o=n:ld.SYMBOL===e.logicalStreamType.lengthType?l=n:h=n;break}case od.DATA:{const n=t.subarray(i.get(),i.get()+e.byteLength);i.add(e.byteLength);const r=e.logicalStreamType.dictionaryType;ad.FSST===r?c=n:ad.SINGLE===r||ad.SHARED===r?s=n:ad.NONE===r&&(d=n);break}}}return p=e,m=a,g=o,_=s,y=l,v=r??u,((f=c)?new vp(p,m,g,_,y,f,v):null)??function(e,t,i,n,r){return t?r?new yp(e,i,n,t,r):new yp(e,i,n,t):null}(e,s,a,o,r??u)??function(e,t,i,n,r){if(!t||!i)return null;if(n)return r?new yp(e,n,t,i,r):new yp(e,n,t,i);if(r&&r.size()!==t.length-1){const n=new Int32Array(r.size());let o=0;for(let e=0;e<r.size();e++)n[e]=r.get(e)?o++:0;return new yp(e,n,t,i,r)}return r?new _p(e,t,i,r):new _p(e,t,i)}(e,h,d,a,r??u);var p,f,m,g,_,y,v}(o.name,t,i,o.nullable?e-1:e,a);case 0:return function(e,t,i,n,r){const o=Ed(e,t),a=o.numValues,s=t.get(),l=bp(r)?function(e,t,i,n){const r=pp(e,Math.ceil(t/8),i),o=new Cd(r,t),a=n.size(),s=new Cd(new Uint8Array(a),a);let l=0;for(let c=0;c<n.size();c++){const e=!!n.get(c)&&o.get(l++);s.set(c,e)}return s.getBuffer()}(e,a,t,r):dp(e,a,t);t.set(s+o.byteLength);const c=new Cd(l,a);return new cp(i.name,c,r)}(t,i,o,0,l);case 6:case 5:return function(e,t,i,n,r){const o=Ed(e,t),a=Od(o,n,e,t),s=5===r.physicalType;if(a===cd.FLAT){const r=bp(n)?(c=s,u=n,function(e,t,i,n){switch(t.logicalLevelTechnique1){case nd.DELTA:return t.logicalLevelTechnique2===nd.RLE&&(e=wd(e,t.runs,t.numRleValues)),function(e,t){const i=new BigInt64Array(e.size());let n=0;e.get(0)?(i[0]=e.get(0)?t[0]>>1n^-(1n&t[0]):0n,n=1):i[0]=0n;let r=1;for(;r!=i.length;++r)i[r]=e.get(r)?i[r-1]+(t[n]>>1n^-(1n&t[n++])):i[r-1];return i}(n,e);case nd.RLE:return function(e,t,i,n){const r=t;return i?function(e,t,i){const n=new BigInt64Array(e.size());let r=0;for(let o=0;o<i;o++){const a=Number(t[o]);let s=t[o+i];s=s>>1n^-(1n&s);for(let t=r;t<r+a;t++)e.get(t)?n[t]=s:(n[t]=0n,r++);r+=a}return n}(n,e,r.runs):function(e,t,i){const n=new BigInt64Array(e.size());let r=0;for(let o=0;o<i;o++){const a=Number(t[o]),s=t[o+i];for(let t=r;t<r+a;t++)e.get(t)?n[t]=s:(n[t]=0n,r++);r+=a}return n}(n,e,r.runs)}(e,t,i,n);case nd.NONE:return e=i?function(e,t){const i=new BigInt64Array(e.size());let n=0,r=0;for(;r!=i.length;++r)if(e.get(r)){const e=t[n++];i[r]=e>>1n^-(1n&e)}else i[r]=0n;return i}(n,e):function(e,t){const i=new BigInt64Array(e.size());let n=0,r=0;for(;r!=i.length;++r)i[r]=e.get(r)?t[n++]:0n;return i}(n,e);default:throw new Error("The specified Logical level technique is not supported")}}(md(e,t,(l=o).numValues),l,c,u)):Rd(e,t,o,s);return new Nd(i.name,r,n)}var l,c,u;if(a===cd.SEQUENCE){const n=Dd(e,t,o);return new jd(i.name,n[0],n[1],o.numRleValues)}{const r=Fd(e,t,o,s);return new hp(i.name,r,n)}}(t,i,o,l,r);case 7:return function(e,t,i,n){const r=Ed(e,t),o=bp(n)?function(e,t,i,n){const r=t.get(),o=r+n*Float32Array.BYTES_PER_ELEMENT,a=new Uint8Array(e.subarray(r,o)).buffer,s=new Float32Array(a);t.set(o);const l=i.size(),c=new Float32Array(l);let u=0;for(let h=0;h<l;h++)c[h]=i.get(h)?s[u++]:0;return c}(e,t,n,r.numValues):function(e,t,i){const n=t.get(),r=n+i*Float32Array.BYTES_PER_ELEMENT,o=new Uint8Array(e.subarray(n,r)).buffer,a=new Float32Array(o);return t.set(r),a}(e,t,r.numValues);return new up(i.name,o,n)}(t,i,o,l);case 8:return function(e,t,i,n){const r=Ed(e,t),o=bp(n)?function(e,t,i,n){const r=t.get(),o=r+n*Float64Array.BYTES_PER_ELEMENT,a=new Uint8Array(e.subarray(r,o)).buffer,s=new Float64Array(a);t.set(o);const l=i.size(),c=new Float64Array(l);let u=0;for(let h=0;h<l;h++)c[h]=i.get(h)?s[u++]:0;return c}(e,t,n,r.numValues):function(e,t,i){const n=t.get(),r=n+i*Float64Array.BYTES_PER_ELEMENT,o=new Uint8Array(e.subarray(n,r)).buffer,a=new Float64Array(o);return t.set(r),a}(e,t,r.numValues);return new Kh(i.name,o,n)}(t,i,o,l);default:throw new Error(`The specified data type for the field is currently not supported: ${r}`)}}(n,e,t,r,i.scalarType,i):1!=n?null:function(e,t,i,n){let r=null,o=null,a=null,s=null,l=!1;for(;!l;){const i=Ed(e,t);switch(i.physicalStreamType){case od.LENGTH:ld.DICTIONARY===i.logicalStreamType.lengthType?r=Id(e,t,i):a=Id(e,t,i);break;case od.DATA:ad.SINGLE===i.logicalStreamType.dictionaryType||ad.SHARED===i.logicalStreamType.dictionaryType?(o=e.subarray(t.get(),t.get()+i.byteLength),l=!0):s=e.subarray(t.get(),t.get()+i.byteLength),t.add(i.byteLength)}}const c=i.complexType.children,u=[];let h=0;for(const d of c){const l=fd(e,t,1)[0];if(0==l)continue;const c=`${i.name}${"default"===d.name?"":":"+d.name}`;if(2!==l||"scalarField"!==d.type||9!==d.scalarField.physicalType)throw new Error("Currently only optional string fields are implemented for a struct.");const p=Ed(e,t),f=dp(e,p.numValues,t),m=Ed(e,t),g=m.decompressedCount!==n?Bd(e,t,m,!1,new Cd(f,p.numValues)):kd(e,t,m,!1);u[h++]=s?new vp(c,g,r,o,a,s,new Cd(f,p.numValues)):new yp(c,g,r,o,new Cd(f,p.numValues))}return u}(e,t,i,r)}function bp(e){return e instanceof Cd}function wp(e){if("id"===e.name)return!1;if("scalarType"===e.type){const t=e.scalarType;if("physicalType"===t.type)switch(t.physicalType){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:default:return!1;case 9:return!0}else if("logicalType"===t.type)return!1}else if("complexType"===e.type){const t=e.complexType;if("physicalType"===t.type)switch(t.physicalType){case 0:case 1:return!0;default:return!1}}return!1}const Tp=new TextDecoder;function Sp(e,t){const i=fd(e,t,1)[0];if(0===i)return"";const n=t.get(),r=e.subarray(n,n+i);return t.add(i),Tp.decode(r)}function Pp(e,t){const i=fd(e,t,1)[0]>>>0,n=!!(4&i),r=!!(2&i),o=fd(e,t,1)[0]>>>0,a={};if(1&i&&(a.nullable=!0),r){const r={};if(n?(r.type="logicalType",r.logicalType=o):(r.type="physicalType",r.physicalType=o),8&i){const i=fd(e,t,1)[0]>>>0;r.children=new Array(i);for(let n=0;n<i;n++)r.children[n]=Pp(e,t)}a.type="complexField",a.complexField=r}else{const e={};n?(e.type="logicalType",e.logicalType=o):(e.type="physicalType",e.physicalType=o),a.type="scalarField",a.scalarField=e}return a}function Mp(e,t){const i=fd(e,t,1)[0]>>>0,n=function(e){switch(e){case 0:case 1:case 2:case 3:{const t={};t.nullable=!!(1&e),t.columnScope=0;const i={};return i.physicalType=e>1?6:4,i.type="physicalType",t.scalarType=i,t.type="scalarType",t}case 4:{const e={nullable:!1,columnScope:0},t={type:"physicalType",physicalType:0};return e.type="complexType",e.complexType=t,e}case 30:{const e={nullable:!1,columnScope:0},t={type:"physicalType",physicalType:1};return e.type="complexType",e.complexType=t,e}default:return function(e){let t=null;switch(e){case 10:case 11:t=0;break;case 12:case 13:t=1;break;case 14:case 15:t=2;break;case 16:case 17:t=3;break;case 18:case 19:t=4;break;case 20:case 21:t=5;break;case 22:case 23:t=6;break;case 24:case 25:t=7;break;case 26:case 27:t=8;break;case 28:case 29:t=9;break;default:return null}const i={};i.nullable=!!(1&e),i.columnScope=0;const n={type:"physicalType"};return n.physicalType=t,i.type="scalarType",i.scalarType=n,i}(e)}}(i);if(!n)throw new Error(`Unsupported column type code: ${i}`);if(i>=10?n.name=Sp(e,t):i>=0&&i<=3?n.name="id":4===i&&(n.name="geometry"),function(e){return 30===e}(i)){const i=fd(e,t,1)[0]>>>0,r=n.complexType;r.children=new Array(i);for(let n=0;n<i;n++)r.children[n]=Pp(e,t)}return n}function Ep(e,t){const i={featureTables:[]},n={};n.name=Sp(e,t);const r=fd(e,t,1)[0]>>>0,o=fd(e,t,1)[0]>>>0;n.columns=new Array(o);for(let a=0;a<o;a++)n.columns[a]=Mp(e,t);return i.featureTables.push(n),[i,r]}function Cp(e,t,i,n,r,o,a=!1){const s=t.scalarType.physicalType,l=Od(r,o,e,i);if(4===s)switch(l){case cd.FLAT:{const t=kd(e,i,r,!1);return new Yh(n,t,o)}case cd.SEQUENCE:{const t=Ld(e,i,r);return new Jh(n,t[0],t[1],r.numRleValues)}case cd.CONST:{const t=Ad(e,i,r,!1);return new ed(n,t,o)}}else switch(l){case cd.FLAT:{if(a){const t=(c=i,function(e,t){switch(t.logicalLevelTechnique1){case nd.DELTA:return t.logicalLevelTechnique2===nd.RLE&&(e=Td(e,t.runs,t.numRleValues)),function(e){e[0]=e[0]%2==1?(e[0]+1)/-2:e[0]/2;const t=e.length/4*4;let i=1;if(t>=4)for(;i<t-4;i+=4){const t=e[i],n=e[i+1],r=e[i+2],o=e[i+3];e[i]=(t%2==1?(t+1)/-2:t/2)+e[i-1],e[i+1]=(n%2==1?(n+1)/-2:n/2)+e[i],e[i+2]=(r%2==1?(r+1)/-2:r/2)+e[i+1],e[i+3]=(o%2==1?(o+1)/-2:o/2)+e[i+2]}for(;i!=e.length;++i)e[i]=(e[i]%2==1?(e[i]+1)/-2:e[i]/2)+e[i-1]}(e),e;case nd.RLE:return Td(e,(i=t).runs,i.numRleValues);case nd.NONE:return e;default:throw new Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}var i}(function(e,t,i){const n=new Float64Array(t);for(let r=0;r<t;r++)n[r]=gd(e,i);return n}(e,(u=r).numValues,c),u));return new Kh(n,t,o)}const t=Rd(e,i,r,!1);return new Nd(n,t,o)}case cd.SEQUENCE:{const t=Dd(e,i,r);return new jd(n,t[0],t[1],r.numRleValues)}case cd.CONST:{const t=Fd(e,i,r,!1);return new hp(n,t,o)}}var c,u;throw new Error("Vector type not supported for id column.")}class kp{constructor(e,t){var i;switch(this._featureData=e,this.properties=this._featureData.properties||{},null===(i=this._featureData.geometry)||void 0===i?void 0:i.type){case ud.POINT:case ud.MULTIPOINT:this.type=1;break;case ud.LINESTRING:case ud.MULTILINESTRING:this.type=2;break;case ud.POLYGON:case ud.MULTIPOLYGON:this.type=3;break;default:this.type=0}this.extent=t,this.id=Number(this._featureData.id)}loadGeometry(){const e=[];for(const t of this._featureData.geometry.coordinates){const i=[];for(const e of t)i.push(new n(e.x,e.y));e.push(i)}return e}}class Ip{constructor(e){this.features=[],this.featureTable=e,this.name=e.name,this.extent=e.extent,this.version=2,this.features=e.getFeatures(),this.length=this.features.length}feature(e){return new kp(this.features[e],this.extent)}}class zp{constructor(e){this.layers={};const t=function(e,t,i=!0){const n=new id(0),r=[];for(;n.get()<e.length;){const t=fd(e,n,1)[0]>>>0,o=n.get()+t;if(o>e.length)throw new Error(`Block overruns tile: ${o} > ${e.length}`);if(1!=fd(e,n,1)[0]>>>0){n.set(o);continue}const a=Ep(e,n),s=a[1],l=a[0].featureTables[0];let c=null,u=null;const h=[];let d=0;for(const r of l.columns){const t=r.name;if("id"===t){let o=null;if(r.nullable){const t=Ed(e,n),i=n.get(),r=dp(e,t.numValues,n);n.set(i+t.byteLength),o=new Cd(r,t.numValues)}const a=Ed(e,n);d=a.decompressedCount,c=Cp(e,r,n,t,a,o??d,i)}else if("geometry"===t){const t=fd(e,n,1)[0];if(0===d){const t=n.get();d=Ed(e,n).decompressedCount,n.set(t)}u=ap(e,t,n,d)}else{const t=wp(r)?fd(e,n,1)[0]:1;if(0===t&&"scalarType"===r.type)continue;const i=xp(e,n,r,t,d);if(i)if(Array.isArray(i))for(const e of i)h.push(e);else h.push(i)}}const p=new td(l.name,u,c,h,s);r.push(p),n.set(o)}return r}(new Uint8Array(e));this.layers=t.reduce((e,t)=>Object.assign(Object.assign({},e),{[t.name]:new Ip(t)}),{})}}class Ap{constructor(e,t){this.feature=e,this.type=e.type,this.properties=e.tags?e.tags:{},this.extent=t,"id"in e&&("string"==typeof e.id?this.id=parseInt(e.id,10):"number"!=typeof e.id||isNaN(e.id)||(this.id=e.id))}loadGeometry(){const e=[],t=1===this.feature.type?[this.feature.geometry]:this.feature.geometry;for(const i of t){const t=[];for(const e of i)t.push(new n(e[0],e[1]));e.push(t)}return e}}const Lp="_geojsonTileLayer";function Dp(e,t){t.writeVarintField(15,e.version||1),t.writeStringField(1,e.name||""),t.writeVarintField(5,e.extent||4096);const i={keys:[],values:[],keycache:{},valuecache:{}};for(let o=0;o<e.length;o++)i.feature=e.feature(o),t.writeMessage(2,Rp,i);const n=i.keys;for(const o of n)t.writeStringField(3,o);const r=i.values;for(const o of r)t.writeMessage(4,jp,o)}function Rp(e,t){if(!e.feature)return;const i=e.feature;void 0!==i.id&&t.writeVarintField(1,i.id),t.writeMessage(2,Fp,e),t.writeVarintField(3,i.type),t.writeMessage(4,Np,i)}function Fp(e,t){for(const i in e.feature?.properties){let n=e.feature.properties[i],r=e.keycache[i];if(null==n)continue;void 0===r&&(e.keys.push(i),r=e.keys.length-1,e.keycache[i]=r),t.writeVarint(r),"string"!=typeof n&&"boolean"!=typeof n&&"number"!=typeof n&&(n=JSON.stringify(n));const o=typeof n+":"+n;let a=e.valuecache[o];void 0===a&&(e.values.push(n),a=e.values.length-1,e.valuecache[o]=a),t.writeVarint(a)}}function Bp(e,t){return(t<<3)+(7&e)}function Op(e){return e<<1^e>>31}function Np(e,t){const i=e.loadGeometry(),n=e.type;let r=0,o=0;for(const a of i){let i=1;1===n&&(i=a.length),t.writeVarint(Bp(1,i));const s=3===n?a.length-1:a.length;for(let e=0;e<s;e++){1===e&&1!==n&&t.writeVarint(Bp(2,s-1));const i=a[e].x-r,l=a[e].y-o;t.writeVarint(Op(i)),t.writeVarint(Op(l)),r+=i,o+=l}3===e.type&&t.writeVarint(Bp(7,1))}}function jp(e,t){const i=typeof e;"string"===i?t.writeStringField(1,e):"boolean"===i?t.writeBooleanField(7,e):"number"===i&&(e%1!=0?t.writeDoubleField(3,e):e<0?t.writeSVarintField(6,e):t.writeVarintField(5,e))}class Vp{constructor(e,t){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new ho(I,16,0),this.grid3D=new ho(I,16,0),this.featureIndexArray=new Ua,this.promoteId=t}insert(e,t,i,n,r,o){const a=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(i,n,r);const s=o?this.grid3D:this.grid;for(let l=0;l<t.length;l++){const e=t[l],i=[1/0,1/0,-1/0,-1/0];for(let t=0;t<e.length;t++){const n=e[t];i[0]=Math.min(i[0],n.x),i[1]=Math.min(i[1],n.y),i[2]=Math.max(i[2],n.x),i[3]=Math.max(i[3],n.y)}i[0]<I&&i[1]<I&&i[2]>=0&&i[3]>=0&&s.insert(a,i[0],i[1],i[2],i[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers="mlt"!==this.encoding?new Fc(new Cu(this.rawTileData)).layers:new zp(this.rawTileData).layers,this.sourceLayerCoder=new $h(this.vtLayers?Object.keys(this.vtLayers).sort():[Lp])),this.vtLayers}query(e,t,i,r){this.loadVTLayers();const o=e.params,a=I/e.tileSize/e.scale,s=fr(o.filter,o.globalState),l=e.queryGeometry,c=e.queryPadding*a,u=qh.fromPoints(l),h=this.grid.query(u.minX-c,u.minY-c,u.maxX+c,u.maxY+c),d=qh.fromPoints(e.cameraQueryGeometry).expandBy(c),p=this.grid3D.query(d.minX,d.minY,d.maxX,d.maxY,(t,i,r,o)=>function(e,t,i,r,o){for(const n of e)if(t<=n.x&&i<=n.y&&r>=n.x&&o>=n.y)return!0;const a=[new n(t,i),new n(t,o),new n(r,o),new n(r,i)];if(e.length>2)for(const n of a)if(tl(e,n))return!0;for(let n=0;n<e.length-1;n++)if(il(e[n],e[n+1],a))return!0;return!1}(e.cameraQueryGeometry,t-c,i-c,r+c,o+c));for(const n of p)h.push(n);h.sort(Zp);const f={};let m;for(let n=0;n<h.length;n++){const c=h[n];if(c===m)continue;m=c;const u=this.featureIndexArray.get(c);let d=null;this.loadMatchingFeature(f,u.bucketIndex,u.sourceLayerIndex,u.featureIndex,s,o.layers,o.availableImages,t,i,r,(t,i,n)=>(d||(d=Vs(t)),i.queryIntersectsFeature({queryGeometry:l,feature:t,featureState:n,geometry:d,zoom:this.z,transform:e.transform,pixelsToTileUnits:a,pixelPosMatrix:e.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:e.getElevation})))}return f}loadMatchingFeature(e,t,i,n,r,o,a,s,l,c,u){const h=this.bucketLayerIDs[t];if(o&&!h.some(e=>o.has(e)))return;const d=this.sourceLayerCoder.decode(i),p=this.vtLayers[d].feature(n);if(r.needGeometry){const e=Us(p,!0);if(!r.filter(new Ro(this.tileID.overscaledZ),e,this.tileID.canonical))return}else if(!r.filter(new Ro(this.tileID.overscaledZ),p))return;const f=this.getId(p,d);for(let m=0;m<h.length;m++){const t=h[m];if(o&&!o.has(t))continue;const i=s[t];if(!i)continue;let r={};f&&c&&(r=c.getState(i.sourceLayer||Lp,f));const d=N({},l[t]);d.paint=Up(d.paint,i.paint,p,r,a),d.layout=Up(d.layout,i.layout,p,r,a);const g=!u||u(p,i,r);if(!g)continue;const _=new Wh(p,this.z,this.x,this.y,f);_.layer=d;let y=e[t];void 0===y&&(y=e[t]=[]),y.push({featureIndex:n,feature:_,intersectionZ:g})}}lookupSymbolFeatures(e,t,i,n,r,o,a,s){const l={};this.loadVTLayers();const c=fr(r.filterSpec,r.globalState);for(const u of e)this.loadMatchingFeature(l,i,n,u,c,o,a,s,t);return l}hasLayer(e){for(const t of this.bucketLayerIDs)for(const i of t)if(e===i)return!0;return!1}getId(e,t){var i;let n=e.id;return this.promoteId&&(n=e.properties["string"==typeof this.promoteId?this.promoteId:this.promoteId[t]],"boolean"==typeof n&&(n=Number(n)),void 0===n&&(null===(i=e.properties)||void 0===i?void 0:i.cluster)&&this.promoteId&&(n=Number(e.properties.cluster_id))),n}}function Up(e,t,i,n,r){return V(e,(e,o)=>{const a=t instanceof qo?t.get(o):null;return a&&a.evaluate?a.evaluate(i,n,r):a})}function Zp(e,t){return t-e}function Gp(e,t,i,r,o){const a=[];for(let s=0;s<e.length;s++){const l=e[s];let c;for(let e=0;e<l.length-1;e++){let s=l[e],u=l[e+1];s.x<t&&u.x<t||(s.x<t?s=new n(t,s.y+(t-s.x)/(u.x-s.x)*(u.y-s.y))._round():u.x<t&&(u=new n(t,s.y+(t-s.x)/(u.x-s.x)*(u.y-s.y))._round()),s.y<i&&u.y<i||(s.y<i?s=new n(s.x+(i-s.y)/(u.y-s.y)*(u.x-s.x),i)._round():u.y<i&&(u=new n(s.x+(i-s.y)/(u.y-s.y)*(u.x-s.x),i)._round()),s.x>=r&&u.x>=r||(s.x>=r?s=new n(r,s.y+(r-s.x)/(u.x-s.x)*(u.y-s.y))._round():u.x>=r&&(u=new n(r,s.y+(r-s.x)/(u.x-s.x)*(u.y-s.y))._round()),s.y>=o&&u.y>=o||(s.y>=o?s=new n(s.x+(o-s.y)/(u.y-s.y)*(u.x-s.x),o)._round():u.y>=o&&(u=new n(s.x+(o-s.y)/(u.y-s.y)*(u.x-s.x),o)._round()),c&&s.equals(c[c.length-1])||(c=[s],a.push(c)),c.push(u)))))}}return a}function qp(e,t,i,n,r){switch(t){case 1:return function(e,t,i,n){const r=[];for(const o of e)for(const e of o){const o=0===n?e.x:e.y;o>=t&&o<=i&&r.push([e])}return r}(e,i,n,r);case 2:return Wp(e,i,n,r,!1);case 3:return Wp(e,i,n,r,!0)}return[]}function $p(e,t,i,r,o){const a=0===r?Hp:Xp;let s=[];const l=[];for(let n=0;n<e.length-1;n++){const c=e[n],u=e[n+1],h=0===r?c.x:c.y,d=0===r?u.x:u.y;let p=!1;h<t?d>t&&s.push(a(c,u,t)):h>i?d<i&&s.push(a(c,u,i)):s.push(c),d<t&&h>=t&&(s.push(a(c,u,t)),p=!0),d>i&&h<=i&&(s.push(a(c,u,i)),p=!0),!o&&p&&(l.push(s),s=[])}const c=e.length-1,u=0===r?e[c].x:e[c].y;return u>=t&&u<=i&&s.push(e[c]),o&&s.length>0&&!s[0].equals(s[s.length-1])&&s.push(new n(s[0].x,s[0].y)),s.length>0&&l.push(s),l}function Wp(e,t,i,n,r){const o=[];for(const a of e){const e=$p(a,t,i,n,r);e.length>0&&o.push(...e)}return o}function Hp(e,t,i){return new n(i,e.y+(i-e.x)/(t.x-e.x)*(t.y-e.y))}function Xp(e,t,i){return new n(e.x+(i-e.y)/(t.y-e.y)*(t.x-e.x),i)}fo("FeatureIndex",Vp,{omit:["rawTileData","sourceLayerCoder"]});class Yp extends n{constructor(e,t,i,n){super(e,t),this.angle=i,void 0!==n&&(this.segment=n)}clone(){return new Yp(this.x,this.y,this.angle,this.segment)}}function Kp(e,t,i,n,r){if(void 0===t.segment||0===i)return!0;let o=t,a=t.segment+1,s=0;for(;s>-i/2;){if(a--,a<0)return!1;s-=e[a].dist(o),o=e[a]}s+=e[a].dist(e[a+1]),a++;const l=[];let c=0;for(;s<i/2;){const t=e[a],i=e[a+1];if(!i)return!1;let o=e[a-1].angleTo(t)-t.angleTo(i);for(o=Math.abs((o+3*Math.PI)%(2*Math.PI)-Math.PI),l.push({distance:s,angleDelta:o}),c+=o;s-l[0].distance>n;)c-=l.shift().angleDelta;if(c>r)return!1;a++,s+=t.dist(i)}return!0}function Qp(e){let t=0;for(let i=0;i<e.length-1;i++)t+=e[i].dist(e[i+1]);return t}function Jp(e,t,i){return e?.6*t*i:0}function ef(e,t){return Math.max(e?e.right-e.left:0,t?t.right-t.left:0)}function tf(e,t,i,n,r,o){const a=Jp(i,r,o),s=ef(i,n)*o;let l=0;const c=Qp(e)/2;for(let u=0;u<e.length-1;u++){const i=e[u],n=e[u+1],r=i.dist(n);if(l+r>c){const o=(c-l)/r,h=gi.number(i.x,n.x,o),d=gi.number(i.y,n.y,o),p=new Yp(h,d,n.angleTo(i),u);return p._round(),!a||Kp(e,p,s,a,t)?p:void 0}l+=r}}function nf(e,t,i,n,r,o,a,s,l){const c=Jp(n,o,a),u=ef(n,r),h=u*a,d=0===e[0].x||e[0].x===l||0===e[0].y||e[0].y===l;return t-h<t/4&&(t=h+t/4),rf(e,d?t/2*s%t:(u/2+2*o)*a*s%t,t,c,i,h,d,!1,l)}function rf(e,t,i,n,r,o,a,s,l){const c=o/2,u=Qp(e);let h=0,d=t-i,p=[];for(let f=0;f<e.length-1;f++){const t=e[f],a=e[f+1],s=t.dist(a),m=a.angleTo(t);for(;d+i<h+s;){d+=i;const g=(d-h)/s,_=gi.number(t.x,a.x,g),y=gi.number(t.y,a.y,g);if(_>=0&&_<l&&y>=0&&y<l&&d-c>=0&&d+c<=u){const t=new Yp(_,y,m,f);t._round(),n&&!Kp(e,t,o,n,r)||p.push(t)}}h+=s}return s||p.length||a||(p=rf(e,h/2,i,n,r,o,a,!0,l)),p}function of(e,t,i,r){const o=[],a=e.image,s=a.pixelRatio,l=a.paddedRect.w-2,c=a.paddedRect.h-2;let u={x1:e.left,y1:e.top,x2:e.right,y2:e.bottom};const h=a.stretchX||[[0,l]],d=a.stretchY||[[0,c]],p=(e,t)=>e+t[1]-t[0],f=h.reduce(p,0),m=d.reduce(p,0),g=l-f,_=c-m;let y=0,v=f,x=0,b=m,w=0,T=g,S=0,P=_;if(a.content&&r){const t=a.content,i=t[2]-t[0],n=t[3]-t[1];(a.textFitWidth||a.textFitHeight)&&(u=ih(e)),y=af(h,0,t[0]),x=af(d,0,t[1]),v=af(h,t[0],t[2]),b=af(d,t[1],t[3]),w=t[0]-y,S=t[1]-x,T=i-v,P=n-b}const M=u.x1,E=u.y1,C=u.x2-M,k=u.y2-E,I=(e,r,o,l)=>{const c=lf(e.stretch-y,v,C,M),u=cf(e.fixed-w,T,e.stretch,f),h=lf(r.stretch-x,b,k,E),d=cf(r.fixed-S,P,r.stretch,m),p=lf(o.stretch-y,v,C,M),g=cf(o.fixed-w,T,o.stretch,f),_=lf(l.stretch-x,b,k,E),I=cf(l.fixed-S,P,l.stretch,m),z=new n(c,h),A=new n(p,h),L=new n(p,_),D=new n(c,_),R=new n(u/s,d/s),F=new n(g/s,I/s),B=t*Math.PI/180;if(B){const e=Math.sin(B),t=Math.cos(B),i=[t,-e,e,t];z._matMult(i),A._matMult(i),D._matMult(i),L._matMult(i)}const O=e.stretch+e.fixed,N=r.stretch+r.fixed;return{tl:z,tr:A,bl:D,br:L,tex:{x:a.paddedRect.x+1+O,y:a.paddedRect.y+1+N,w:o.stretch+o.fixed-O,h:l.stretch+l.fixed-N},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:R,pixelOffsetBR:F,minFontScaleX:T/s/C,minFontScaleY:P/s/k,isSDF:i}};if(r&&(a.stretchX||a.stretchY)){const e=sf(h,g,f),t=sf(d,_,m);for(let i=0;i<e.length-1;i++){const n=e[i],r=e[i+1];for(let e=0;e<t.length-1;e++)o.push(I(n,t[e],r,t[e+1]))}}else o.push(I({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:l+1},{fixed:0,stretch:c+1}));return o}function af(e,t,i){let n=0;for(const r of e)n+=Math.max(t,Math.min(i,r[1]))-Math.max(t,Math.min(i,r[0]));return n}function sf(e,t,i){const n=[{fixed:-1,stretch:0}];for(const[r,o]of e){const e=n[n.length-1];n.push({fixed:r-e.stretch,stretch:e.stretch}),n.push({fixed:r-e.stretch,stretch:e.stretch+(o-r)})}return n.push({fixed:t+1,stretch:i}),n}function lf(e,t,i,n){return e/t*i+n}function cf(e,t,i,n){return e-t*i/n}fo("Anchor",Yp);class uf{constructor(e,t,i,r,o,a,s,l,c,u){var h;if(this.boxStartIndex=e.length,c){let e=a.top,t=a.bottom;const i=a.collisionPadding;i&&(e-=i[1],t+=i[3]);let n=t-e;n>0&&(n=Math.max(10,n),this.circleDiameter=n)}else{const c=(null===(h=a.image)||void 0===h?void 0:h.content)&&(a.image.textFitWidth||a.image.textFitHeight)?ih(a):{x1:a.left,y1:a.top,x2:a.right,y2:a.bottom};c.y1=c.y1*s-l[0],c.y2=c.y2*s+l[2],c.x1=c.x1*s-l[3],c.x2=c.x2*s+l[1];const d=a.collisionPadding;if(d&&(c.x1-=d[0]*s,c.y1-=d[1]*s,c.x2+=d[2]*s,c.y2+=d[3]*s),u){const e=new n(c.x1,c.y1),t=new n(c.x2,c.y1),i=new n(c.x1,c.y2),r=new n(c.x2,c.y2),o=u*Math.PI/180;e._rotate(o),t._rotate(o),i._rotate(o),r._rotate(o),c.x1=Math.min(e.x,t.x,i.x,r.x),c.x2=Math.max(e.x,t.x,i.x,r.x),c.y1=Math.min(e.y,t.y,i.y,r.y),c.y2=Math.max(e.y,t.y,i.y,r.y)}e.emplaceBack(t.x,t.y,c.x1,c.y1,c.x2,c.y2,i,r,o)}this.boxEndIndex=e.length}}class hf{constructor(e=[],t=(e,t)=>e<t?-1:e>t?1:0){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let i=(this.length>>1)-1;i>=0;i--)this._down(i)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(0===this.length)return;const e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:t,compare:i}=this,n=t[e];for(;e>0;){const r=e-1>>1,o=t[r];if(i(n,o)>=0)break;t[e]=o,e=r}t[e]=n}_down(e){const{data:t,compare:i}=this,n=this.length>>1,r=t[e];for(;e<n;){let n=1+(e<<1);const o=n+1;if(o<this.length&&i(t[o],t[n])<0&&(n=o),i(t[n],r)>=0)break;t[e]=t[n],e=n}t[e]=r}}function df(e,t=1,i=!1){const r=qh.fromPoints(e[0]),o=Math.min(r.width(),r.height());let a=o/2;const s=new hf([],pf),{minX:l,minY:c,maxX:u,maxY:h}=r;if(0===o)return new n(l,c);for(let n=l;n<u;n+=o)for(let t=c;t<h;t+=o)s.push(new ff(n+a,t+a,a,e));let d=function(e){let t=0,i=0,n=0;const r=e[0];for(let o=0,a=r.length,s=a-1;o<a;s=o++){const e=r[o],a=r[s],l=e.x*a.y-a.x*e.y;i+=(e.x+a.x)*l,n+=(e.y+a.y)*l,t+=3*l}return new ff(i/t,n/t,0,e)}(e),p=s.length;for(;s.length;){const i=s.pop();(i.d>d.d||!d.d)&&(d=i),i.max-d.d<=t||(a=i.h/2,s.push(new ff(i.p.x-a,i.p.y-a,a,e)),s.push(new ff(i.p.x+a,i.p.y-a,a,e)),s.push(new ff(i.p.x-a,i.p.y+a,a,e)),s.push(new ff(i.p.x+a,i.p.y+a,a,e)),p+=4)}return d.p}function pf(e,t){return t.max-e.max}function ff(e,t,i,r){this.p=new n(e,t),this.h=i,this.d=function(e,t){let i=!1,n=1/0;for(let r=0;r<t.length;r++){const o=t[r];for(let t=0,r=o.length,a=r-1;t<r;a=t++){const r=o[t],s=o[a];r.y>e.y!=s.y>e.y&&e.x<(s.x-r.x)*(e.y-r.y)/(s.y-r.y)+r.x&&(i=!i),n=Math.min(n,Js(e,r,s))}}return(i?1:-1)*Math.sqrt(n)}(this.p,r),this.max=this.d+this.h*Math.SQRT2}var mf;e.aP=void 0,(mf=e.aP||(e.aP={}))[mf.center=1]="center",mf[mf.left=2]="left",mf[mf.right=3]="right",mf[mf.top=4]="top",mf[mf.bottom=5]="bottom",mf[mf["top-left"]=6]="top-left",mf[mf["top-right"]=7]="top-right",mf[mf["bottom-left"]=8]="bottom-left",mf[mf["bottom-right"]=9]="bottom-right";const gf=Number.POSITIVE_INFINITY;function _f(e,t){return t[1]!==gf?function(e,t,i){let n=0,r=0;switch(t=Math.abs(t),i=Math.abs(i),e){case"top-right":case"top-left":case"top":r=i-7;break;case"bottom-right":case"bottom-left":case"bottom":r=7-i}switch(e){case"top-right":case"bottom-right":case"right":n=-t;break;case"top-left":case"bottom-left":case"left":n=t}return[n,r]}(e,t[0],t[1]):function(e,t){let i=0,n=0;t<0&&(t=0);const r=t/Math.SQRT2;switch(e){case"top-right":case"top-left":n=r-7;break;case"bottom-right":case"bottom-left":n=7-r;break;case"bottom":n=7-t;break;case"top":n=t-7}switch(e){case"top-right":case"bottom-right":i=-r;break;case"top-left":case"bottom-left":i=r;break;case"left":i=t;break;case"right":i=-t}return[i,n]}(e,t[0])}function yf(e,t,i){var n;const r=e.layout,o=null===(n=r.get("text-variable-anchor-offset"))||void 0===n?void 0:n.evaluate(t,{},i);if(o){const e=o.values,t=[];for(let i=0;i<e.length;i+=2){const n=t[i]=e[i],r=e[i+1].map(e=>e*mu);n.startsWith("top")?r[1]-=7:n.startsWith("bottom")&&(r[1]+=7),t[i+1]=r}return new Ot(t)}const a=r.get("text-variable-anchor");if(a){let n;n=void 0!==e._unevaluatedLayout.getValue("text-radial-offset")?[r.get("text-radial-offset").evaluate(t,{},i)*mu,gf]:r.get("text-offset").evaluate(t,{},i).map(e=>e*mu);const o=[];for(const e of a)o.push(e,_f(e,n));return new Ot(o)}return null}function vf(e){switch(e){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function xf(t,i,n,r,o,a,s,l,c,u,h,d){let p=a.textMaxSize.evaluate(i,{});void 0===p&&(p=s);const f=t.layers[0].layout,m=f.get("icon-offset").evaluate(i,{},h),g=wf(n.horizontal),_=s/24,y=t.tilePixelRatio*_,v=t.tilePixelRatio*p/24,x=t.tilePixelRatio*l,b=t.tilePixelRatio*f.get("symbol-spacing"),w=f.get("text-padding")*t.tilePixelRatio,T=function(e,t,i,n=1){const r=e.get("icon-padding").evaluate(t,{},i),o=r&&r.values;return[o[0]*n,o[1]*n,o[2]*n,o[3]*n]}(f,i,h,t.tilePixelRatio),S=f.get("text-max-angle")/180*Math.PI,P="viewport"!==f.get("text-rotation-alignment")&&"point"!==f.get("symbol-placement"),M="map"===f.get("icon-rotation-alignment")&&"point"!==f.get("symbol-placement"),E=f.get("symbol-placement"),C=b/2,k=f.get("icon-text-fit");let z;r&&"none"!==k&&(t.allowVerticalPlacement&&n.vertical&&(z=nh(r,n.vertical,k,f.get("icon-text-fit-padding"),m,_)),g&&(r=nh(r,g,k,f.get("icon-text-fit-padding"),m,_)));const A=h?d.line.getGranularityForZoomLevel(h.z):1,L=(l,d)=>{d.x<0||d.x>=I||d.y<0||d.y>=I||function(t,i,n,r,o,a,s,l,c,u,h,d,p,f,m,g,_,y,v,x,b,w,T,S,P){const M=t.addToLineVertexArray(i,n);let E,C,k,I,z=0,A=0,L=0,D=0,R=-1,F=-1;const B={};let O=_s("");if(t.allowVerticalPlacement&&r.vertical){const e=l.layout.get("text-rotate").evaluate(b,{},S)+90;k=new uf(c,i,u,h,d,r.vertical,p,f,m,e),s&&(I=new uf(c,i,u,h,d,s,_,y,m,e))}if(o){const n=l.layout.get("icon-rotate").evaluate(b,{}),r="none"!==l.layout.get("icon-text-fit"),a=of(o,n,T,r),p=s?of(s,n,T,r):void 0;C=new uf(c,i,u,h,d,o,_,y,!1,n),z=4*a.length;const f=t.iconSizeData;let m=null;"source"===f.kind?(m=[rh*l.layout.get("icon-size").evaluate(b,{})],m[0]>oh&&q(`${t.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):"composite"===f.kind&&(m=[rh*w.compositeIconSizes[0].evaluate(b,{},S),rh*w.compositeIconSizes[1].evaluate(b,{},S)],(m[0]>oh||m[1]>oh)&&q(`${t.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),t.addSymbols(t.icon,a,m,x,v,b,e.az.none,i,M.lineStartIndex,M.lineLength,-1,S),R=t.icon.placedSymbolArray.length-1,p&&(A=4*p.length,t.addSymbols(t.icon,p,m,x,v,b,e.az.vertical,i,M.lineStartIndex,M.lineLength,-1,S),F=t.icon.placedSymbolArray.length-1)}const N=Object.keys(r.horizontal);for(const q of N){const n=r.horizontal[q];if(!E){O=_s(n.text);const e=l.layout.get("text-rotate").evaluate(b,{},S);E=new uf(c,i,u,h,d,n,p,f,m,e)}const o=1===n.positionedLines.length;if(L+=bf(t,i,n,a,l,m,b,g,M,r.vertical?e.az.horizontal:e.az.horizontalOnly,o?N:[q],B,R,w,S),o)break}r.vertical&&(D+=bf(t,i,r.vertical,a,l,m,b,g,M,e.az.vertical,["vertical"],B,F,w,S));const j=E?E.boxStartIndex:t.collisionBoxArray.length,V=E?E.boxEndIndex:t.collisionBoxArray.length,U=k?k.boxStartIndex:t.collisionBoxArray.length,Z=k?k.boxEndIndex:t.collisionBoxArray.length,G=C?C.boxStartIndex:t.collisionBoxArray.length,$=C?C.boxEndIndex:t.collisionBoxArray.length,W=I?I.boxStartIndex:t.collisionBoxArray.length,H=I?I.boxEndIndex:t.collisionBoxArray.length;let X=-1;const Y=(e,t)=>e&&e.circleDiameter?Math.max(e.circleDiameter,t):t;X=Y(E,X),X=Y(k,X),X=Y(C,X),X=Y(I,X);const K=X>-1?1:0;K&&(X*=P/mu),t.glyphOffsetArray.length>=fh.MAX_GLYPHS&&q("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==b.sortKey&&t.addToSortKeyRanges(t.symbolInstances.length,b.sortKey);const Q=yf(l,b,S),[J,ee]=function(t,i){const n=t.length,r=null==i?void 0:i.values;if((null==r?void 0:r.length)>0)for(let o=0;o<r.length;o+=2){const i=r[o+1];t.emplaceBack(e.aP[r[o]],i[0],i[1])}return[n,t.length]}(t.textAnchorOffsets,Q);t.symbolInstances.emplaceBack(i.x,i.y,B.right>=0?B.right:-1,B.center>=0?B.center:-1,B.left>=0?B.left:-1,B.vertical||-1,R,F,O,j,V,U,Z,G,$,W,H,u,L,D,z,A,K,0,p,X,J,ee)}(t,d,l,n,r,o,z,t.layers[0],t.collisionBoxArray,i.index,i.sourceLayerIndex,t.index,y,[w,w,w,w],P,c,x,T,M,m,i,a,u,h,s)};if("line"===E)for(const e of Gp(i.geometry,0,0,I,I)){const i=yc(e,A),o=nf(i,b,S,n.vertical||g,r,24,v,t.overscaling,I);for(const e of o)g&&Tf(t,g.text,C,e)||L(i,e)}else if("line-center"===E){for(const e of i.geometry)if(e.length>1){const t=yc(e,A),i=tf(t,S,n.vertical||g,r,24,v);i&&L(t,i)}}else if("Polygon"===i.type)for(const e of tn(i.geometry,0)){const t=df(e,16);L(yc(e[0],A,!0),new Yp(t.x,t.y,0))}else if("LineString"===i.type)for(const e of i.geometry){const t=yc(e,A);L(t,new Yp(t[0].x,t[0].y,0))}else if("Point"===i.type)for(const e of i.geometry)for(const t of e)L([t],new Yp(t.x,t.y,0))}function bf(e,t,i,r,o,a,s,l,c,u,h,d,p,f,m){const g=function(e,t,i,r,o,a,s,l){const c=r.layout.get("text-rotate").evaluate(a,{})*Math.PI/180,u=[];for(const h of t.positionedLines)for(const e of h.positionedGlyphs){if(!e.rect)continue;const r=e.rect||{};let a=4,d=!0,p=1,f=0;const m=(o||l)&&e.vertical,g=e.metrics.advance*e.scale/2;if(l&&t.verticalizable&&(f=h.lineOffset/2-(e.imageName?-(mu-e.metrics.width*e.scale)/2:(e.scale-1)*mu)),e.imageName){const t=s[e.imageName];d=t.sdf,p=t.pixelRatio,a=1/p}const _=o?[e.x+g,e.y]:[0,0];let y=o?[0,0]:[e.x+g+i[0],e.y+i[1]-f],v=[0,0];m&&(v=y,y=[0,0]);const x=e.metrics.isDoubleResolution?2:1,b=(e.metrics.left-a)*e.scale-g+y[0],w=(-e.metrics.top-a)*e.scale+y[1],T=b+r.w/x*e.scale/p,S=w+r.h/x*e.scale/p,P=new n(b,w),M=new n(T,w),E=new n(b,S),C=new n(T,S);if(m){const t=new n(-g,g- -17),i=-Math.PI/2,r=12-g,o=new n(22-r,-(e.imageName?r:0)),a=new n(...v);P._rotateAround(i,t)._add(o)._add(a),M._rotateAround(i,t)._add(o)._add(a),E._rotateAround(i,t)._add(o)._add(a),C._rotateAround(i,t)._add(o)._add(a)}if(c){const e=Math.sin(c),t=Math.cos(c),i=[t,-e,e,t];P._matMult(i),M._matMult(i),E._matMult(i),C._matMult(i)}const k=new n(0,0),I=new n(0,0);u.push({tl:P,tr:M,bl:E,br:C,tex:r,writingMode:t.writingMode,glyphOffset:_,sectionIndex:e.sectionIndex,isSDF:d,pixelOffsetTL:k,pixelOffsetBR:I,minFontScaleX:0,minFontScaleY:0})}return u}(0,i,l,o,a,s,r,e.allowVerticalPlacement),_=e.textSizeData;let y=null;"source"===_.kind?(y=[rh*o.layout.get("text-size").evaluate(s,{})],y[0]>oh&&q(`${e.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):"composite"===_.kind&&(y=[rh*f.compositeTextSizes[0].evaluate(s,{},m),rh*f.compositeTextSizes[1].evaluate(s,{},m)],(y[0]>oh||y[1]>oh)&&q(`${e.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),e.addSymbols(e.text,g,y,l,a,s,u,t,c.lineStartIndex,c.lineLength,p,m);for(const n of h)d[n]=e.text.placedSymbolArray.length-1;return 4*g.length}function wf(e){for(const t in e)return e[t];return null}function Tf(e,t,i,n){const r=e.compareText;if(t in r){const e=r[t];for(let t=e.length-1;t>=0;t--)if(n.dist(e[t])<i)return!0}else r[t]=[];return r[t].push(n),!1}const Sf=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Pf{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[t,i]=new Uint8Array(e,0,2);if(219!==t)throw new Error("Data does not appear to be in a KDBush format.");const n=i>>4;if(1!==n)throw new Error(`Got v${n} data when expected v1.`);const r=Sf[15&i];if(!r)throw new Error("Unrecognized array type.");const[o]=new Uint16Array(e,2,1),[a]=new Uint32Array(e,4,1);return new Pf(a,o,r,e)}constructor(e,t=64,i=Float64Array,n){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535),this.ArrayType=i,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const r=Sf.indexOf(this.ArrayType),o=2*e*this.ArrayType.BYTES_PER_ELEMENT,a=e*this.IndexArrayType.BYTES_PER_ELEMENT,s=(8-a%8)%8;if(r<0)throw new Error(`Unexpected typed array class: ${i}.`);n&&n instanceof ArrayBuffer?(this.data=n,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+a+s,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+o+a+s),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+a+s,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+r]),new Uint16Array(this.data,2,1)[0]=t,new Uint32Array(this.data,4,1)[0]=e)}add(e,t){const i=this._pos>>1;return this.ids[i]=i,this.coords[this._pos++]=e,this.coords[this._pos++]=t,i}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return Mf(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,i,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:r,coords:o,nodeSize:a}=this,s=[0,r.length-1,0],l=[];for(;s.length;){const c=s.pop()||0,u=s.pop()||0,h=s.pop()||0;if(u-h<=a){for(let a=h;a<=u;a++){const s=o[2*a],c=o[2*a+1];s>=e&&s<=i&&c>=t&&c<=n&&l.push(r[a])}continue}const d=h+u>>1,p=o[2*d],f=o[2*d+1];p>=e&&p<=i&&f>=t&&f<=n&&l.push(r[d]),(0===c?e<=p:t<=f)&&(s.push(h),s.push(d-1),s.push(1-c)),(0===c?i>=p:n>=f)&&(s.push(d+1),s.push(u),s.push(1-c))}return l}within(e,t,i){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:n,coords:r,nodeSize:o}=this,a=[0,n.length-1,0],s=[],l=i*i;for(;a.length;){const c=a.pop()||0,u=a.pop()||0,h=a.pop()||0;if(u-h<=o){for(let i=h;i<=u;i++)If(r[2*i],r[2*i+1],e,t)<=l&&s.push(n[i]);continue}const d=h+u>>1,p=r[2*d],f=r[2*d+1];If(p,f,e,t)<=l&&s.push(n[d]),(0===c?e-i<=p:t-i<=f)&&(a.push(h),a.push(d-1),a.push(1-c)),(0===c?e+i>=p:t+i>=f)&&(a.push(d+1),a.push(u),a.push(1-c))}return s}}function Mf(e,t,i,n,r,o){if(r-n<=i)return;const a=n+r>>1;Ef(e,t,a,n,r,o),Mf(e,t,i,n,a-1,1-o),Mf(e,t,i,a+1,r,1-o)}function Ef(e,t,i,n,r,o){for(;r>n;){if(r-n>600){const a=r-n+1,s=i-n+1,l=Math.log(a),c=.5*Math.exp(2*l/3),u=.5*Math.sqrt(l*c*(a-c)/a)*(s-a/2<0?-1:1);Ef(e,t,i,Math.max(n,Math.floor(i-s*c/a+u)),Math.min(r,Math.floor(i+(a-s)*c/a+u)),o)}const a=t[2*i+o];let s=n,l=r;for(Cf(e,t,n,i),t[2*r+o]>a&&Cf(e,t,n,r);s<l;){for(Cf(e,t,s,l),s++,l--;t[2*s+o]<a;)s++;for(;t[2*l+o]>a;)l--}t[2*n+o]===a?Cf(e,t,n,l):(l++,Cf(e,t,l,r)),l<=i&&(n=l+1),i<=l&&(r=l-1)}}function Cf(e,t,i,n){kf(e,i,n),kf(t,2*i,2*n),kf(t,2*i+1,2*n+1)}function kf(e,t,i){const n=e[t];e[t]=e[i],e[i]=n}function If(e,t,i,n){const r=e-i,o=t-n;return r*r+o*o}var zf;e.cH=void 0,(zf=e.cH||(e.cH={})).create="create",zf.load="load",zf.fullLoad="fullLoad";let Af=null,Lf=[];const Df=1e3/60,Rf="loadTime",Ff="fullLoadTime",Bf={mark(e){performance.mark(e)},frame(e){const t=e;null!=Af&&Lf.push(t-Af),Af=t},clearMetrics(){Af=null,Lf=[],performance.clearMeasures(Rf),performance.clearMeasures(Ff);for(const t in e.cH)performance.clearMarks(e.cH[t])},getPerformanceMetrics(){performance.measure(Rf,e.cH.create,e.cH.load),performance.measure(Ff,e.cH.create,e.cH.fullLoad);const t=performance.getEntriesByName(Rf)[0].duration,i=performance.getEntriesByName(Ff)[0].duration,n=Lf.length,r=1/(Lf.reduce((e,t)=>e+t,0)/n/1e3),o=Lf.filter(e=>e>Df).reduce((e,t)=>e+(t-Df)/Df,0);return{loadTime:t,fullLoadTime:i,fps:r,percentDroppedFrames:o/(n+o)*100,totalFrames:n}}};e.$=h,e.A=f,e.B=uo,e.C=oo,e.D=$o,e.E=ve,e.F=function([e,t,i]){return t+=90,t*=Math.PI/180,i*=Math.PI/180,{x:e*Math.cos(t)*Math.sin(i),y:e*Math.sin(t)*Math.sin(i),z:e*Math.cos(i)}},e.G=gi,e.H=Ro,e.I=Gu,e.J=so,e.K=function(e){if(null==H){const t=e.navigator?e.navigator.userAgent:null;H=!!e.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return H},e.L=class{constructor(e,t){this.target=e,this.mapId=t,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new Sh(()=>this.process()),this.subscription=ee(this.target,"message",e=>this.receive(e),!1),this.globalScope=W(self)?e:window}registerMessageHandler(e,t){this.messageHandlers[e]=t}unregisterMessageHandler(e){delete this.messageHandlers[e]}sendAsync(e,t){return new Promise((i,n)=>{const r=Math.round(1e18*Math.random()).toString(36).substring(0,10),o=t?ee(t.signal,"abort",()=>{null==o||o.unsubscribe(),delete this.resolveRejects[r];const t={id:r,type:"<cancel>",origin:location.origin,targetMapId:e.targetMapId,sourceMapId:this.mapId};this.target.postMessage(t)},Ph):null;this.resolveRejects[r]={resolve:e=>{null==o||o.unsubscribe(),i(e)},reject:e=>{null==o||o.unsubscribe(),n(e)}};const a=[],s=Object.assign(Object.assign({},e),{id:r,sourceMapId:this.mapId,origin:location.origin,data:yo(e.data,a)});this.target.postMessage(s,{transfer:a})})}receive(e){const t=e.data,i=t.id;if(!("file://"!==t.origin&&"file://"!==location.origin&&"resource://android"!==t.origin&&"resource://android"!==location.origin&&t.origin!==location.origin||t.targetMapId&&this.mapId!==t.targetMapId)){if("<cancel>"===t.type){delete this.tasks[i];const e=this.abortControllers[i];return delete this.abortControllers[i],void(e&&e.abort())}if(W(self)||t.mustQueue)return this.tasks[i]=t,this.taskQueue.push(i),void this.invoker.trigger();this.processTask(i,t)}}process(){if(0===this.taskQueue.length)return;const e=this.taskQueue.shift(),t=this.tasks[e];delete this.tasks[e],this.taskQueue.length>0&&this.invoker.trigger(),t&&this.processTask(e,t)}processTask(e,i){return t(this,void 0,void 0,function*(){if("<response>"===i.type){const t=this.resolveRejects[e];if(delete this.resolveRejects[e],!t)return;return void(i.error?t.reject(vo(i.error)):t.resolve(vo(i.data)))}if(!this.messageHandlers[i.type])return void this.completeTask(e,new Error(`Could not find a registered handler for ${i.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const t=vo(i.data),n=new AbortController;this.abortControllers[e]=n;try{const r=yield this.messageHandlers[i.type](i.sourceMapId,t,n);this.completeTask(e,null,r)}catch(r){this.completeTask(e,r)}})}completeTask(e,t,i){const n=[];delete this.abortControllers[e];const r={id:e,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:t?yo(t):null,data:yo(i,n)};this.target.postMessage(r,{transfer:n})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},e.M=ue,e.N=function(){var e=new f(16);return f!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e},e.O=function(e,t,i){var n,r,o,a,s,l,c,u,h,d,p,f,m=i[0],g=i[1],_=i[2];return t===e?(e[12]=t[0]*m+t[4]*g+t[8]*_+t[12],e[13]=t[1]*m+t[5]*g+t[9]*_+t[13],e[14]=t[2]*m+t[6]*g+t[10]*_+t[14],e[15]=t[3]*m+t[7]*g+t[11]*_+t[15]):(r=t[1],o=t[2],a=t[3],s=t[4],l=t[5],c=t[6],u=t[7],h=t[8],d=t[9],p=t[10],f=t[11],e[0]=n=t[0],e[1]=r,e[2]=o,e[3]=a,e[4]=s,e[5]=l,e[6]=c,e[7]=u,e[8]=h,e[9]=d,e[10]=p,e[11]=f,e[12]=n*m+s*g+h*_+t[12],e[13]=r*m+l*g+d*_+t[13],e[14]=o*m+c*g+p*_+t[14],e[15]=a*m+u*g+f*_+t[15]),e},e.P=n,e.Q=function(e,t,i){var n=i[0],r=i[1],o=i[2];return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e[8]=t[8]*o,e[9]=t[9]*o,e[10]=t[10]*o,e[11]=t[11]*o,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},e.R=Sl,e.S=function(e,t,i){var n=t[0],r=t[1],o=t[2],a=t[3],s=t[4],l=t[5],c=t[6],u=t[7],h=t[8],d=t[9],p=t[10],f=t[11],m=t[12],g=t[13],_=t[14],y=t[15],v=i[0],x=i[1],b=i[2],w=i[3];return e[0]=v*n+x*s+b*h+w*m,e[1]=v*r+x*l+b*d+w*g,e[2]=v*o+x*c+b*p+w*_,e[3]=v*a+x*u+b*f+w*y,e[4]=(v=i[4])*n+(x=i[5])*s+(b=i[6])*h+(w=i[7])*m,e[5]=v*r+x*l+b*d+w*g,e[6]=v*o+x*c+b*p+w*_,e[7]=v*a+x*u+b*f+w*y,e[8]=(v=i[8])*n+(x=i[9])*s+(b=i[10])*h+(w=i[11])*m,e[9]=v*r+x*l+b*d+w*g,e[10]=v*o+x*c+b*p+w*_,e[11]=v*a+x*u+b*f+w*y,e[12]=(v=i[12])*n+(x=i[13])*s+(b=i[14])*h+(w=i[15])*m,e[13]=v*r+x*l+b*d+w*g,e[14]=v*o+x*c+b*p+w*_,e[15]=v*a+x*u+b*f+w*y,e},e.T=Ll,e.U=function(e,t){const i={};for(let n=0;n<t.length;n++){const r=t[n];r in e&&(i[r]=e[r])}return i},e.V=Eh,e.W=O,e.X=zh,e.Y=Ih,e.Z=se,e._=t,e.a=ae,e.a$=b,e.a0=d,e.a1=K,e.a2=jh,e.a3=Lh,e.a4=Dh,e.a5=I,e.a6=function(e,t,i){if(!e)return t||{};if(!t)return e||{};const n=Gh(e),r=Gh(t);!function(e,t){t.removeAll&&(e.add.clear(),e.update.clear(),e.remove.clear(),t.remove.clear());for(const i of t.remove)e.add.delete(i),e.update.delete(i);for(const[i,n]of t.update){const r=e.update.get(i);r&&(t.update.set(i,Zh(r,n)),e.update.delete(i))}}(n,r);const o={};if((n.removeAll||r.removeAll)&&(o.removeAll=!0),o.remove=new Set([...n.remove,...r.remove]),o.add=new Map([...n.add,...r.add]),o.update=new Map([...n.update,...r.update]),o.remove.size&&o.add.size)for(const a of o.add.keys())o.remove.delete(a);return function(e){const t={};return e.removeAll&&(t.removeAll=e.removeAll),e.remove&&(t.remove=Array.from(e.remove)),e.add&&(t.add=Array.from(e.add.values())),e.update&&(t.update=Array.from(e.update.values())),t}(o)},e.a7=function(e,t){const i=new Map;if(null==e)return i;if(null==e.type)return i;if("Feature"===e.type){const n=Uh(e,t);if(null==n)return;return i.set(n,e),i}if("FeatureCollection"===e.type){const n=new Set;for(const r of e.features){const e=Uh(r,t);if(null==e)return;if(n.has(e))return;n.add(e),i.set(e,r)}return i}},e.a8=function(e,t,i){var n,r;const o=[];if(t.removeAll)e.clear();else if(t.remove)for(const a of t.remove){const t=e.get(a);t&&(o.push(t.geometry),e.delete(a))}if(t.add)for(const a of t.add){const t=Uh(a,i);if(null==t)continue;const n=e.get(t);n&&o.push(n.geometry),o.push(a.geometry),e.set(t,a)}if(t.update)for(const a of t.update){const t=e.get(a.id);if(!t)continue;const i=!!a.newGeometry,s=a.removeAllProperties||(null===(n=a.removeProperties)||void 0===n?void 0:n.length)>0||(null===(r=a.addOrUpdateProperties)||void 0===r?void 0:r.length)>0;if(!i&&!s)continue;o.push(t.geometry);const l=Object.assign({},t);if(e.set(a.id,l),i&&(o.push(a.newGeometry),l.geometry=a.newGeometry),s){if(l.properties=a.removeAllProperties?{}:Object.assign({},l.properties||{}),a.removeProperties)for(const e of a.removeProperties)delete l.properties[e];if(a.addOrUpdateProperties)for(const{key:e,value:t}of a.addOrUpdateProperties)l.properties[e]=t}}return o},e.a9=Fh,e.aA=function(e,{uSize:t,uSizeT:i},{lowerSize:n,upperSize:r}){return"source"===e.kind?n/rh:"composite"===e.kind?gi.number(n/rh,r/rh,i):t},e.aB=function(e,t){var i=t[0],n=t[1],r=t[2],o=t[3],a=t[4],s=t[5],l=t[6],c=t[7],u=t[8],h=t[9],d=t[10],p=t[11],f=t[12],m=t[13],g=t[14],_=t[15],y=i*s-n*a,v=i*l-r*a,x=i*c-o*a,b=n*l-r*s,w=n*c-o*s,T=r*c-o*l,S=u*m-h*f,P=u*g-d*f,M=u*_-p*f,E=h*g-d*m,C=h*_-p*m,k=d*_-p*g,I=y*k-v*C+x*E+b*M-w*P+T*S;return I?(e[0]=(s*k-l*C+c*E)*(I=1/I),e[1]=(r*C-n*k-o*E)*I,e[2]=(m*T-g*w+_*b)*I,e[3]=(d*w-h*T-p*b)*I,e[4]=(l*M-a*k-c*P)*I,e[5]=(i*k-r*M+o*P)*I,e[6]=(g*x-f*T-_*v)*I,e[7]=(u*T-d*x+p*v)*I,e[8]=(a*C-s*M+c*S)*I,e[9]=(n*M-i*C-o*S)*I,e[10]=(f*w-m*x+_*y)*I,e[11]=(h*x-u*w-p*y)*I,e[12]=(s*P-a*E-l*S)*I,e[13]=(i*E-n*P+r*S)*I,e[14]=(m*v-f*b-g*y)*I,e[15]=(u*b-h*v+d*y)*I,e):null},e.aC=C,e.aD=function(e){var t=e[0],i=e[1];return Math.sqrt(t*t+i*i)},e.aE=function(e){return e[0]=0,e[1]=0,e},e.aF=function(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e},e.aG=uh,e.aH=P,e.aI=function(e,t,i,r){const o=t.y-e.y,a=t.x-e.x,s=r.y-i.y,l=r.x-i.x,c=s*a-l*o;if(0===c)return null;const u=(l*(e.y-i.y)-s*(e.x-i.x))/c;return new n(e.x+u*a,e.y+u*o)},e.aJ=Gp,e.aK=$s,e.aL=function(e){let t=1/0,i=1/0,n=-1/0,r=-1/0;for(const o of e)t=Math.min(t,o.x),i=Math.min(i,o.y),n=Math.max(n,o.x),r=Math.max(r,o.y);return[t,i,n,r]},e.aM=mu,e.aN=z,e.aO=function(e,t,i,n,r=!1){if(!i[0]&&!i[1])return[0,0];const o=r?"map"===n?-e.bearingInRadians:0:"viewport"===n?e.bearingInRadians:0;if(o){const e=Math.sin(o),t=Math.cos(o);i=[i[0]*t-i[1]*e,i[0]*e+i[1]*t]}return[r?i[0]:z(t,i[0],e.zoom),r?i[1]:z(t,i[1],e.zoom)]},e.aQ=sh,e.aR=vf,e.aS=Hu,e.aT=Pf,e.aU=oa,e.aV=pc,e.aW=Za,e.aX=as,e.aY=is,e.aZ=ie,e.a_=Rh,e.aa=qh,e.ab=25,e.ac=Oh,e.ad=e=>{const t=window.document.createElement("video");return t.muted=!0,new Promise(i=>{t.onloadstart=()=>{i(t)};for(const n of e){const e=window.document.createElement("source");fe(n)||(t.crossOrigin="Anonymous"),e.src=n,t.appendChild(e)}})},e.ae=Ae,e.af=function(){return j++},e.ag=Aa,e.ah=fh,e.ai=Lp,e.aj=fr,e.ak=Us,e.al=Wh,e.am=function(e){const t={};if(e.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(e,i,n,r)=>{const o=n||r;return t[i]=!o||o.toLowerCase(),""}),t["max-age"]){const e=parseInt(t["max-age"],10);isNaN(e)?delete t["max-age"]:t["max-age"]=e}return t},e.an=B,e.ao=85.051129,e.ap=te,e.aq=function(e){return Math.pow(2,e)},e.ar=g,e.as=Ah,e.at=function(e){return Math.log(e)/Math.LN2},e.au=function(e){var t=e[0],i=e[1];return t*t+i*i},e.av=function(e){if(!e.length)return new Set;const t=Math.max(...e.map(e=>e.canonical.z));let i=1/0,n=-1/0,r=1/0,o=-1/0;const a=[];for(const l of e){const{x:e,y:s,z:c}=l.canonical,u=Math.pow(2,t-c),h=e*u,d=s*u;a.push({id:l,x:h,y:d}),h<i&&(i=h),h>n&&(n=h),d<r&&(r=d),d>o&&(o=d)}const s=new Set;for(const l of a)l.x!==i&&l.x!==n&&l.y!==r&&l.y!==o||s.add(l.id);return s},e.aw=function(e,t){const i=Math.abs(2*e.wrap)-+(e.wrap<0),n=Math.abs(2*t.wrap)-+(t.wrap<0);return e.overscaledZ-t.overscaledZ||n-i||t.canonical.y-e.canonical.y||t.canonical.x-e.canonical.x},e.ax=class{constructor(e,t){this.max=e,this.onRemove=t,this.reset()}reset(){for(const e in this.data)for(const t of this.data[e])t.timeout&&clearTimeout(t.timeout),this.onRemove(t.value);return this.data={},this.order=[],this}add(e,t,i){const n=e.wrapped().key;void 0===this.data[n]&&(this.data[n]=[]);const r={value:t,timeout:void 0};if(void 0!==i&&(r.timeout=setTimeout(()=>{this.remove(e,r)},i)),this.data[n].push(r),this.order.push(n),this.order.length>this.max){const e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){const t=this.data[e].shift();return t.timeout&&clearTimeout(t.timeout),0===this.data[e].length&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),t.value}getByKey(e){const t=this.data[e];return t?t[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,t){if(!this.has(e))return this;const i=e.wrapped().key,n=void 0===t?0:this.data[i].indexOf(t),r=this.data[i][n];return this.data[i].splice(n,1),r.timeout&&clearTimeout(r.timeout),0===this.data[i].length&&delete this.data[i],this.onRemove(r.value),this.order.splice(this.order.indexOf(i),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){const e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}filter(e){const t=[];for(const i in this.data)for(const n of this.data[i])e(n.value)||t.push(n);for(const i of t)this.remove(i.value.tileID,i)}},e.ay=function(e,t){let i=0,n=0;if("constant"===e.kind)n=e.layoutSize;else if("source"!==e.kind){const{interpolationType:r,minZoom:o,maxZoom:a}=e,s=r?B(fi.interpolationFactor(r,t,o,a),0,1):0;"camera"===e.kind?n=gi.number(e.minSize,e.maxSize,s):i=s}return{uSizeT:i,uSize:n}},e.b=X,e.b$=Ps,e.b0=x,e.b1=function(e){var t=new f(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t},e.b2=function(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e[2]=t[2]-i[2],e},e.b3=function(e,t){var i=t[0],n=t[1],r=t[2],o=i*i+n*n+r*r;return o>0&&(o=1/Math.sqrt(o)),e[0]=t[0]*o,e[1]=t[1]*o,e[2]=t[2]*o,e},e.b4=w,e.b5=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]},e.b6=function(e,t,i){return e[0]=t[0]*i[0],e[1]=t[1]*i[1],e[2]=t[2]*i[2],e[3]=t[3]*i[3],e},e.b7=y,e.b8=function(e,t,i){const n=t[0]*i[0]+t[1]*i[1]+t[2]*i[2];return 0===n?null:(-(e[0]*i[0]+e[1]*i[1]+e[2]*i[2])-i[3])/n},e.b9=S,e.bA=function(e,t,i,n){return e[0]=t[0]+i[0]*n,e[1]=t[1]+i[1]*n,e[2]=t[2]+i[2]*n,e},e.bB=E,e.bC=function(e,t,i){var n=i[0],r=i[1],o=i[2],a=i[3],s=t[0],l=t[1],c=t[2],u=r*c-o*l,h=o*s-n*c,d=n*l-r*s;return e[0]=s+a*(u+=u)+r*(d+=d)-o*(h+=h),e[1]=l+a*h+o*u-n*d,e[2]=c+a*d+n*h-r*u,e},e.bD=function(e,t,i){const n=(r=[e[0],e[1],e[2],t[0],t[1],t[2],i[0],i[1],i[2]],o=r[3],a=r[4],s=r[5],l=r[6],c=r[7],u=r[8],r[0]*(u*a-s*c)+r[1]*(-u*o+s*l)+r[2]*(c*o-a*l));var r,o,a,s,l,c,u;if(0===n)return null;const h=w([],[t[0],t[1],t[2]],[i[0],i[1],i[2]]),d=w([],[i[0],i[1],i[2]],[e[0],e[1],e[2]]),p=w([],[e[0],e[1],e[2]],[t[0],t[1],t[2]]),f=b([],h,-e[3]);return x(f,f,b([],d,-t[3])),x(f,f,b([],p,-i[3])),b(f,f,1/n),f},e.bE=Mh,e.bF=function(){return new Float64Array(4)},e.bG=function(e,t,i,n){var r=[],o=[];return r[0]=t[0]-i[0],r[1]=t[1]-i[1],r[2]=t[2]-i[2],o[0]=r[0]*Math.cos(n)-r[1]*Math.sin(n),o[1]=r[0]*Math.sin(n)+r[1]*Math.cos(n),o[2]=r[2],e[0]=o[0]+i[0],e[1]=o[1]+i[1],e[2]=o[2]+i[2],e},e.bH=function(e,t,i,n){var r=[],o=[];return r[0]=t[0]-i[0],r[1]=t[1]-i[1],r[2]=t[2]-i[2],o[0]=r[0],o[1]=r[1]*Math.cos(n)-r[2]*Math.sin(n),o[2]=r[1]*Math.sin(n)+r[2]*Math.cos(n),e[0]=o[0]+i[0],e[1]=o[1]+i[1],e[2]=o[2]+i[2],e},e.bI=function(e,t,i,n){var r=[],o=[];return r[0]=t[0]-i[0],r[1]=t[1]-i[1],r[2]=t[2]-i[2],o[0]=r[2]*Math.sin(n)+r[0]*Math.cos(n),o[1]=r[1],o[2]=r[2]*Math.cos(n)-r[0]*Math.sin(n),e[0]=o[0]+i[0],e[1]=o[1]+i[1],e[2]=o[2]+i[2],e},e.bJ=function(e,t,i){var n=Math.sin(i),r=Math.cos(i),o=t[0],a=t[1],s=t[2],l=t[3],c=t[8],u=t[9],h=t[10],d=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*r-c*n,e[1]=a*r-u*n,e[2]=s*r-h*n,e[3]=l*r-d*n,e[8]=o*n+c*r,e[9]=a*n+u*r,e[10]=s*n+h*r,e[11]=l*n+d*r,e},e.bK=function(e,t){const i=A(e,360),n=A(t,360),r=n-i,o=n>i?r-360:r+360;return Math.abs(r)<Math.abs(o)?r:o},e.bL=function(e){return e[0]=0,e[1]=0,e[2]=0,e},e.bM=function(e,t,i,n){const r=Math.sqrt(e*e+t*t),o=Math.sqrt(i*i+n*n);e/=r,t/=r,i/=o,n/=o;const a=Math.acos(e*i+t*n);return-t*i+e*n>0?a:-a},e.bN=function(e,t){const i=A(e,2*Math.PI),n=A(t,2*Math.PI);return Math.min(Math.abs(i-n),Math.abs(i-n+2*Math.PI),Math.abs(i-n-2*Math.PI))},e.bO=function(){const e={},t=xe.$version;for(const i in xe.$root){const n=xe.$root[i];if(n.required){let r=null;r="version"===i?t:"array"===n.type?[]:{},null!=r&&(e[i]=r)}}return e},e.bP=de,e.bQ=xo,e.bR=function e(t,i){if(Array.isArray(t)){if(!Array.isArray(i)||t.length!==i.length)return!1;for(let n=0;n<t.length;n++)if(!e(t[n],i[n]))return!1;return!0}if("object"==typeof t&&null!==t&&null!==i){if("object"!=typeof i)return!1;if(Object.keys(t).length!==Object.keys(i).length)return!1;for(const n in t)if(!e(t[n],i[n]))return!1;return!0}return t===i},e.bS=function(e){e=e.slice();const t=Object.create(null);for(let i=0;i<e.length;i++)t[e[i].id]=e[i];for(let i=0;i<e.length;i++)"ref"in e[i]&&(e[i]=we(e[i],t[e[i].ref]));return e},e.bT=function(e,t){if("custom"===e.type)return new Th(e,t);switch(e.type){case"background":return new wh(e,t);case"circle":return new gl(e,t);case"color-relief":return new Fl(e,t);case"fill":return new Mc(e,t);case"fill-extrusion":return new $c(e,t);case"heatmap":return new El(e,t);case"hillshade":return new Il(e,t);case"line":return new su(e,t);case"raster":return new ta(e,t);case"symbol":return new vh(e,t)}},e.bU=e=>"raster"===e.type,e.bV=Z,e.bW=function(e,t){if(!e)return[{command:"setStyle",args:[t]}];let i=[];try{if(!Te(e.version,t.version))return[{command:"setStyle",args:[t]}];Te(e.center,t.center)||i.push({command:"setCenter",args:[t.center]}),Te(e.state,t.state)||i.push({command:"setGlobalState",args:[t.state]}),Te(e.centerAltitude,t.centerAltitude)||i.push({command:"setCenterAltitude",args:[t.centerAltitude]}),Te(e.zoom,t.zoom)||i.push({command:"setZoom",args:[t.zoom]}),Te(e.bearing,t.bearing)||i.push({command:"setBearing",args:[t.bearing]}),Te(e.pitch,t.pitch)||i.push({command:"setPitch",args:[t.pitch]}),Te(e.roll,t.roll)||i.push({command:"setRoll",args:[t.roll]}),Te(e.sprite,t.sprite)||i.push({command:"setSprite",args:[t.sprite]}),Te(e.glyphs,t.glyphs)||i.push({command:"setGlyphs",args:[t.glyphs]}),Te(e.transition,t.transition)||i.push({command:"setTransition",args:[t.transition]}),Te(e.light,t.light)||i.push({command:"setLight",args:[t.light]}),Te(e.terrain,t.terrain)||i.push({command:"setTerrain",args:[t.terrain]}),Te(e.sky,t.sky)||i.push({command:"setSky",args:[t.sky]}),Te(e.projection,t.projection)||i.push({command:"setProjection",args:[t.projection]});const n={},r=[];!function(e,t,i,n){let r;for(r in t=t||{},e=e||{})Object.prototype.hasOwnProperty.call(e,r)&&(Object.prototype.hasOwnProperty.call(t,r)||Me(r,i,n));for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&(Object.prototype.hasOwnProperty.call(e,r)?Te(e[r],t[r])||("geojson"===e[r].type&&"geojson"===t[r].type&&Ce(e,t,r)?Se(i,{command:"setGeoJSONSourceData",args:[r,t[r].data]}):Ee(r,t,i,n)):Pe(r,t,i))}(e.sources,t.sources,r,n);const o=[];e.layers&&e.layers.forEach(e=>{"source"in e&&n[e.source]?i.push({command:"removeLayer",args:[e.id]}):o.push(e)}),i=i.concat(r),function(e,t,i){t=t||[];const n=(e=e||[]).map(Ie),r=t.map(Ie),o=e.reduce(ze,{}),a=t.reduce(ze,{}),s=n.slice(),l=Object.create(null);let c,u,h,d,p;for(let f=0,m=0;f<n.length;f++)c=n[f],Object.prototype.hasOwnProperty.call(a,c)?m++:(Se(i,{command:"removeLayer",args:[c]}),s.splice(s.indexOf(c,m),1));for(let f=0,m=0;f<r.length;f++)c=r[r.length-1-f],s[s.length-1-f]!==c&&(Object.prototype.hasOwnProperty.call(o,c)?(Se(i,{command:"removeLayer",args:[c]}),s.splice(s.lastIndexOf(c,s.length-m),1)):m++,d=s[s.length-f],Se(i,{command:"addLayer",args:[a[c],d]}),s.splice(s.length-f,0,c),l[c]=!0);for(let f=0;f<r.length;f++)if(c=r[f],u=o[c],h=a[c],!l[c]&&!Te(u,h))if(Te(u.source,h.source)&&Te(u["source-layer"],h["source-layer"])&&Te(u.type,h.type)){for(p in ke(u.layout,h.layout,i,c,null,"setLayoutProperty"),ke(u.paint,h.paint,i,c,null,"setPaintProperty"),Te(u.filter,h.filter)||Se(i,{command:"setFilter",args:[c,h.filter]}),Te(u.minzoom,h.minzoom)&&Te(u.maxzoom,h.maxzoom)||Se(i,{command:"setLayerZoomRange",args:[c,h.minzoom,h.maxzoom]}),u)Object.prototype.hasOwnProperty.call(u,p)&&"layout"!==p&&"paint"!==p&&"filter"!==p&&"metadata"!==p&&"minzoom"!==p&&"maxzoom"!==p&&(0===p.indexOf("paint.")?ke(u[p],h[p],i,c,p.slice(6),"setPaintProperty"):Te(u[p],h[p])||Se(i,{command:"setLayerProperty",args:[c,p,h[p]]}));for(p in h)Object.prototype.hasOwnProperty.call(h,p)&&!Object.prototype.hasOwnProperty.call(u,p)&&"layout"!==p&&"paint"!==p&&"filter"!==p&&"metadata"!==p&&"minzoom"!==p&&"maxzoom"!==p&&(0===p.indexOf("paint.")?ke(u[p],h[p],i,c,p.slice(6),"setPaintProperty"):Te(u[p],h[p])||Se(i,{command:"setLayerProperty",args:[c,p,h[p]]}))}else Se(i,{command:"removeLayer",args:[c]}),d=s[s.lastIndexOf(c)+1],Se(i,{command:"addLayer",args:[h,d]})}(o,t.layers,i)}catch(n){i=[{command:"setStyle",args:[t]}]}return i},e.bX=function(e){const t=[],i=e.id;return void 0===i&&t.push({message:`layers.${i}: missing required property "id"`}),void 0===e.render&&t.push({message:`layers.${i}: missing required method "render"`}),e.renderingMode&&"2d"!==e.renderingMode&&"3d"!==e.renderingMode&&t.push({message:`layers.${i}: property "renderingMode" must be either "2d" or "3d"`}),t},e.bY=V,e.bZ=U,e.b_=class extends ws{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1i(this.location,e))}},e.ba=function(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e},e.bb=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]},e.bc=Nh,e.bd=Vh,e.be=function(e,t,i,n,r){var o=1/Math.tan(t/2);if(e[0]=o/i,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=r&&r!==1/0){var a=1/(n-r);e[10]=(r+n)*a,e[14]=2*r*n*a}else e[10]=-1,e[14]=-2*n;return e},e.bf=function(e){var t=new f(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},e.bg=function(e,t,i){var n=Math.sin(i),r=Math.cos(i),o=t[0],a=t[1],s=t[2],l=t[3],c=t[4],u=t[5],h=t[6],d=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*r+c*n,e[1]=a*r+u*n,e[2]=s*r+h*n,e[3]=l*r+d*n,e[4]=c*r-o*n,e[5]=u*r-a*n,e[6]=h*r-s*n,e[7]=d*r-l*n,e},e.bh=function(e,t,i){var n=Math.sin(i),r=Math.cos(i),o=t[4],a=t[5],s=t[6],l=t[7],c=t[8],u=t[9],h=t[10],d=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=o*r+c*n,e[5]=a*r+u*n,e[6]=s*r+h*n,e[7]=l*r+d*n,e[8]=c*r-o*n,e[9]=u*r-a*n,e[10]=h*r-s*n,e[11]=d*r-l*n,e},e.bi=function(){const e=new Float32Array(16);return g(e),e},e.bj=function(){const e=new Float64Array(16);return g(e),e},e.bk=function(){return new Float64Array(16)},e.bl=function(e,t,i){const n=new Float64Array(4);return E(n,e,t-90,i),n},e.bm=function(e,t,i,n){var r,o,a,s,l,c=t[0],u=t[1],h=t[2],d=t[3],f=i[0],m=i[1],g=i[2],_=i[3];return(o=c*f+u*m+h*g+d*_)<0&&(o=-o,f=-f,m=-m,g=-g,_=-_),1-o>p?(r=Math.acos(o),a=Math.sin(r),s=Math.sin((1-n)*r)/a,l=Math.sin(n*r)/a):(s=1-n,l=n),e[0]=s*c+l*f,e[1]=s*u+l*m,e[2]=s*h+l*g,e[3]=s*d+l*_,e},e.bn=function(e){const t=new Float64Array(9);var i,n,r,o,a,s,l,c,u,h,d,p,f,m,g,_,y,v;i=t,r=(n=e)[0],o=n[1],a=n[2],s=n[3],h=r*(l=r+r),d=o*l,p=o*(c=o+o),f=a*l,m=a*c,g=a*(u=a+a),_=s*l,y=s*c,v=s*u,i[0]=1-p-g,i[3]=d-v,i[6]=f+y,i[1]=d+v,i[4]=1-h-g,i[7]=m-_,i[2]=f-y,i[5]=m+_,i[8]=1-h-p;const x=ie(-Math.asin(B(t[2],-1,1)));let b,w;return Math.hypot(t[5],t[8])<.001?(b=0,w=-ie(Math.atan2(t[3],t[4]))):(b=ie(0===t[5]&&0===t[8]?0:Math.atan2(t[5],t[8])),w=ie(0===t[1]&&0===t[0]?0:Math.atan2(t[1],t[0]))),{roll:b,pitch:x+90,bearing:w}},e.bo=function(e,t){return e.roll==t.roll&&e.pitch==t.pitch&&e.bearing==t.bearing},e.bp=Ct,e.bq=Ts,e.br=fc,e.bs=mc,e.bt=dc,e.bu=L,e.bv=D,e.bw=jt,e.bx=function(e,t,i,n,r){return L(n,r,B((e-t)/(i-t),0,1))},e.by=A,e.bz=function(){return new Float64Array(3)},e.c=le,e.c$=function(e,i,n,r,o){return t(this,void 0,void 0,function*(){if(d())try{return yield K(e,i,n,r,o)}catch(t){}return function(e,t,i,n,r){const o=e.width,a=e.height;Q&&J||(Q=new OffscreenCanvas(o,a),J=Q.getContext("2d",{willReadFrequently:!0})),Q.width=o,Q.height=a,J.drawImage(e,0,0,o,a);const s=J.getImageData(t,i,n,r);return J.clearRect(0,0,o,a),s.data}(e,i,n,r,o)})},e.c0=class extends ws{constructor(e,t){super(e,t),this.current=Ms}set(e){if(e[12]!==this.current[12]||e[0]!==this.current[0])return this.current=e,void this.gl.uniformMatrix4fv(this.location,!1,e);for(let t=1;t<16;t++)if(e[t]!==this.current[t]){this.current=e,this.gl.uniformMatrix4fv(this.location,!1,e);break}}},e.c1=Ss,e.c2=class extends ws{constructor(e,t){super(e,t),this.current=[0,0,0]}set(e){e[0]===this.current[0]&&e[1]===this.current[1]&&e[2]===this.current[2]||(this.current=e,this.gl.uniform3f(this.location,e[0],e[1],e[2]))}},e.c3=class extends ws{constructor(e,t){super(e,t),this.current=[0,0]}set(e){e[0]===this.current[0]&&e[1]===this.current[1]||(this.current=e,this.gl.uniform2f(this.location,e[0],e[1]))}},e.c4=m,e.c5=function(e,t){var i=Math.sin(t),n=Math.cos(t);return e[0]=n,e[1]=i,e[2]=0,e[3]=-i,e[4]=n,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},e.c6=function(e,t,i){var n=t[0],r=t[1],o=t[2];return e[0]=n*i[0]+r*i[3]+o*i[6],e[1]=n*i[1]+r*i[4]+o*i[7],e[2]=n*i[2]+r*i[5]+o*i[8],e},e.c7=function(e,t,i,n,r,o,a){var s=1/(t-i),l=1/(n-r),c=1/(o-a);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*c,e[11]=0,e[12]=(t+i)*s,e[13]=(r+n)*l,e[14]=(a+o)*c,e[15]=1,e},e.c8=class extends ws{constructor(e,t){super(e,t),this.current=new Array}set(e){if(e!=this.current){this.current=e;const t=new Float32Array(4*e.length);for(let i=0;i<e.length;i++)t[4*i]=e[i].r,t[4*i+1]=e[i].g,t[4*i+2]=e[i].b,t[4*i+3]=e[i].a;this.gl.uniform4fv(this.location,t)}}},e.c9=class extends ws{constructor(e,t){super(e,t),this.current=new Array}set(e){if(e!=this.current){this.current=e;const t=new Float32Array(e);this.gl.uniform1fv(this.location,t)}}},e.cA=function(e,t){return ne[t]&&"touches"in e},e.cB=function(e){return ne[e]||re[e]},e.cC=function(e,t,i){var n=t[0],r=t[1];return e[0]=i[0]*n+i[4]*r+i[12],e[1]=i[1]*n+i[5]*r+i[13],e},e.cD=function(e,t){const{x:i,y:n}=Fh.fromLngLat(t);return!(e<0||e>25||n<0||n>=1||i<0||i>=1)},e.cE=function(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},e.cF=class extends la{},e.cG=Bf,e.cI=he,e.cJ=function(e,t){le.REGISTERED_PROTOCOLS[e]=t},e.cK=function(e){delete le.REGISTERED_PROTOCOLS[e]},e.cL=function(e,t){const i={};for(let r=0;r<e.length;r++){const n=t&&t[e[r].id]||Tr(e[r]);t&&(t[e[r].id]=n);let o=i[n];o||(o=i[n]=[]),o.push(e[r])}const n=[];for(const r in i)n.push(i[r]);return n},e.cM=fo,e.cN=$h,e.cO=Vp,e.cP=qu,e.cQ=function(t){t.bucket.createArrays(),t.bucket.tilePixelRatio=I/(512*t.bucket.overscaling),t.bucket.compareText={},t.bucket.iconsNeedLinear=!1;const i=t.bucket.layers[0],n=i.layout,r=i._unevaluatedLayout._values,o={layoutIconSize:r["icon-size"].possiblyEvaluate(new Ro(t.bucket.zoom+1),t.canonical),layoutTextSize:r["text-size"].possiblyEvaluate(new Ro(t.bucket.zoom+1),t.canonical),textMaxSize:r["text-size"].possiblyEvaluate(new Ro(18))};if("composite"===t.bucket.textSizeData.kind){const{minZoom:e,maxZoom:i}=t.bucket.textSizeData;o.compositeTextSizes=[r["text-size"].possiblyEvaluate(new Ro(e),t.canonical),r["text-size"].possiblyEvaluate(new Ro(i),t.canonical)]}if("composite"===t.bucket.iconSizeData.kind){const{minZoom:e,maxZoom:i}=t.bucket.iconSizeData;o.compositeIconSizes=[r["icon-size"].possiblyEvaluate(new Ro(e),t.canonical),r["icon-size"].possiblyEvaluate(new Ro(i),t.canonical)]}const a=n.get("text-line-height")*mu,s="viewport"!==n.get("text-rotation-alignment")&&"point"!==n.get("symbol-placement"),l=n.get("text-keep-upright"),c=n.get("text-size");for(const u of t.bucket.features){const r=n.get("text-font").evaluate(u,{},t.canonical).join(","),h=c.evaluate(u,{},t.canonical),d=o.layoutTextSize.evaluate(u,{},t.canonical),p=o.layoutIconSize.evaluate(u,{},t.canonical),f={horizontal:{},vertical:void 0},m=u.text;let g,_=[0,0];if(m){const o=m.toString(),c=n.get("text-letter-spacing").evaluate(u,{},t.canonical)*mu,p=Po(o)?c:0,g=n.get("text-anchor").evaluate(u,{},t.canonical),y=yf(i,u,t.canonical);if(!y){const e=n.get("text-radial-offset").evaluate(u,{},t.canonical);_=e?_f(g,[e*mu,gf]):n.get("text-offset").evaluate(u,{},t.canonical).map(e=>e*mu)}let v=s?"center":n.get("text-justify").evaluate(u,{},t.canonical);const x="point"===n.get("symbol-placement")?n.get("text-max-width").evaluate(u,{},t.canonical)*mu:1/0,b=()=>{t.bucket.allowVerticalPlacement&&So(o)&&(f.vertical=Wu(m,t.glyphMap,t.glyphPositions,t.imagePositions,r,x,a,g,"left",p,_,e.az.vertical,!0,d,h))};if(!s&&y){const i=new Set;if("auto"===v)for(let e=0;e<y.values.length;e+=2)i.add(vf(y.values[e]));else i.add(v);let n=!1;for(const o of i)if(!f.horizontal[o])if(n)f.horizontal[o]=f.horizontal[0];else{const i=Wu(m,t.glyphMap,t.glyphPositions,t.imagePositions,r,x,a,"center",o,p,_,e.az.horizontal,!1,d,h);i&&(f.horizontal[o]=i,n=1===i.positionedLines.length)}b()}else{"auto"===v&&(v=vf(g));const i=Wu(m,t.glyphMap,t.glyphPositions,t.imagePositions,r,x,a,g,v,p,_,e.az.horizontal,!1,d,h);i&&(f.horizontal[v]=i),b(),So(o)&&s&&l&&(f.vertical=Wu(m,t.glyphMap,t.glyphPositions,t.imagePositions,r,x,a,g,v,p,_,e.az.vertical,!1,d,h))}}let y=!1;if(u.icon&&u.icon.name){const e=t.imageMap[u.icon.name];e&&(g=th(t.imagePositions[u.icon.name],n.get("icon-offset").evaluate(u,{},t.canonical),n.get("icon-anchor").evaluate(u,{},t.canonical)),y=!!e.sdf,void 0===t.bucket.sdfIcons?t.bucket.sdfIcons=y:t.bucket.sdfIcons!==y&&q("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(e.pixelRatio!==t.bucket.pixelRatio||0!==n.get("icon-rotate").constantOr(1))&&(t.bucket.iconsNeedLinear=!0))}const v=wf(f.horizontal)||f.vertical;t.bucket.iconsInText=!!v&&v.iconsInText,(v||g)&&xf(t.bucket,u,f,g,t.imageMap,o,d,p,_,y,t.canonical,t.subdivisionGranularity)}t.showCollisionBoxes&&t.bucket.generateCollisionDebugBuffers()},e.cR=wc,e.cS=jc,e.cT=tu,e.cU=function(e){const t=new Cu;return function(e,t){for(const i in e.layers)t.writeMessage(3,Dp,e.layers[i])}(e,t),t.finish()},e.cV=function(e,t,i,n,r,o){let a=qp(e,t,i,r,0);return a=qp(a,t,n,o,1),a},e.cW=class{constructor(e){this.maxEntries=e,this.map=new Map}get(e){const t=this.map.get(e);return void 0!==t&&(this.map.delete(e),this.map.set(e,t)),t}set(e,t){if(this.map.has(e))this.map.delete(e);else if(this.map.size>=this.maxEntries){const e=this.map.keys().next().value;this.map.delete(e)}this.map.set(e,t)}clear(){this.map.clear()}},e.cX=Fc,e.cY=Cu,e.cZ=zp,e.c_=class{constructor(e){this._marks={start:[e.url,"start"].join("#"),end:[e.url,"end"].join("#"),measure:e.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let e=performance.getEntriesByName(this._marks.measure);return 0===e.length&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),e=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),e}},e.ca=class extends xa{},e.cb=pu,e.cc=class extends wa{},e.cd=Ml,e.ce=function(e){return e<=1?1:Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},e.cf=Pl,e.cg=function(e,t,i){var n=t[0],r=t[1],o=t[2],a=i[3]*n+i[7]*r+i[11]*o+i[15];return e[0]=(i[0]*n+i[4]*r+i[8]*o+i[12])/(a=a||1),e[1]=(i[1]*n+i[5]*r+i[9]*o+i[13])/a,e[2]=(i[2]*n+i[6]*r+i[10]*o+i[14])/a,e},e.ch=class extends ca{},e.ci=class extends ka{},e.cj=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[11]===t[11]&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[15]===t[15]},e.ck=function(e,t){var i=e[0],n=e[1],r=e[2],o=e[3],a=e[4],s=e[5],l=e[6],c=e[7],u=e[8],h=e[9],d=e[10],f=e[11],m=e[12],g=e[13],_=e[14],y=e[15],v=t[0],x=t[1],b=t[2],w=t[3],T=t[4],S=t[5],P=t[6],M=t[7],E=t[8],C=t[9],k=t[10],I=t[11],z=t[12],A=t[13],L=t[14],D=t[15];return Math.abs(i-v)<=p*Math.max(1,Math.abs(i),Math.abs(v))&&Math.abs(n-x)<=p*Math.max(1,Math.abs(n),Math.abs(x))&&Math.abs(r-b)<=p*Math.max(1,Math.abs(r),Math.abs(b))&&Math.abs(o-w)<=p*Math.max(1,Math.abs(o),Math.abs(w))&&Math.abs(a-T)<=p*Math.max(1,Math.abs(a),Math.abs(T))&&Math.abs(s-S)<=p*Math.max(1,Math.abs(s),Math.abs(S))&&Math.abs(l-P)<=p*Math.max(1,Math.abs(l),Math.abs(P))&&Math.abs(c-M)<=p*Math.max(1,Math.abs(c),Math.abs(M))&&Math.abs(u-E)<=p*Math.max(1,Math.abs(u),Math.abs(E))&&Math.abs(h-C)<=p*Math.max(1,Math.abs(h),Math.abs(C))&&Math.abs(d-k)<=p*Math.max(1,Math.abs(d),Math.abs(k))&&Math.abs(f-I)<=p*Math.max(1,Math.abs(f),Math.abs(I))&&Math.abs(m-z)<=p*Math.max(1,Math.abs(m),Math.abs(z))&&Math.abs(g-A)<=p*Math.max(1,Math.abs(g),Math.abs(A))&&Math.abs(_-L)<=p*Math.max(1,Math.abs(_),Math.abs(L))&&Math.abs(y-D)<=p*Math.max(1,Math.abs(y),Math.abs(D))},e.cl=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},e.cm=e=>"symbol"===e.type,e.cn=e=>"circle"===e.type,e.co=e=>"heatmap"===e.type,e.cp=e=>"line"===e.type,e.cq=e=>"fill"===e.type,e.cr=e=>"fill-extrusion"===e.type,e.cs=e=>"hillshade"===e.type,e.ct=e=>"color-relief"===e.type,e.cu=e=>"background"===e.type,e.cv=e=>"custom"===e.type,e.cw=R,e.cx=function(e,t,i){const n=k(t.x-i.x,t.y-i.y),r=k(e.x-i.x,e.y-i.y);var o,a;return ie(Math.atan2(n[0]*r[1]-n[1]*r[0],(a=r,(o=n)[0]*a[0]+o[1]*a[1])))},e.cy=F,e.cz=function(e,t){return re[t]&&(e instanceof MouseEvent||e instanceof WheelEvent)},e.d=fe,e.d0=Dl,e.d1=r,e.d2=class{constructor(e,t){this.layers={[Lp]:this},this.name=Lp,this.version=t?t.version:1,this.extent=t?t.extent:4096,this.length=e.length,this.features=e}feature(e){return new Ap(this.features[e],this.extent)}},e.d3=rr,e.d4=Do,e.e=N,e.f=e=>t(void 0,void 0,void 0,function*(){if(0===e.byteLength)return createImageBitmap(new ImageData(1,1));const t=new Blob([new Uint8Array(e)],{type:"image/png"});try{return createImageBitmap(t)}catch(i){throw new Error(`Could not load image because of ${i.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),e.g=ce,e.h=e=>new Promise((t,i)=>{const n=new Image;n.onload=()=>{t(n),URL.revokeObjectURL(n.src),n.onload=null,window.requestAnimationFrame(()=>{n.src=Y})},n.onerror=()=>i(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 r=new Blob([new Uint8Array(e)],{type:"image/png"});n.src=e.byteLength?URL.createObjectURL(r):Y}),e.i=W,e.j=(e,t)=>pe(N(e,{type:"json"}),t),e.k=ye,e.l=_e,e.m=pe,e.n=(e,t)=>pe(N(e,{type:"arrayBuffer"}),t),e.o=function(e){return new Cu(e).readFields(ju,[])},e.p=Zu,e.q=function(e){return/[\u02EA\u02EB\u1100-\u11FF\u2E80-\u2FDF\u3000-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE4F\uFF00-\uFFEF]|\uD81B[\uDFE0-\uDFFF]|[\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFFF]|\uD82C[\uDC00-\uDEFB]|\uD83C[\uDE00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(e))},e.r=Tl,e.s=ee,e.t=Ko,e.u=xe,e.v=ro,e.w=q,e.x=jo,e.y=ao,e.z=Bo}),n("worker",["./shared"],function(e){class t{constructor(e,t){this.keyCache={},e&&this.replace(e,t)}replace(e,t){this._layerConfigs={},this._layers={},this.update(e,[],t)}update(t,i,n){for(const o of t){this._layerConfigs[o.id]=o;const t=this._layers[o.id]=e.bT(o,n);t._featureFilter=e.aj(t.filter,n),this.keyCache[o.id]&&delete this.keyCache[o.id]}for(const e of i)delete this.keyCache[e],delete this._layerConfigs[e],delete this._layers[e];this.familiesBySource={};const r=e.cL(Object.values(this._layerConfigs),this.keyCache);for(const o of r){const t=o.map(e=>this._layers[e.id]),i=t[0];if(i.isHidden())continue;const n=i.source||"";let r=this.familiesBySource[n];r||(r=this.familiesBySource[n]={});const a=i.sourceLayer||e.ai;let s=r[a];s||(s=r[a]=[]),s.push(t)}}}class i{constructor(t){const i={},n=[];for(const e in t){const r=t[e],o=i[e]={};for(const e in r){const t=r[+e];if(!t||0===t.bitmap.width||0===t.bitmap.height)continue;const i={x:0,y:0,w:t.bitmap.width+2,h:t.bitmap.height+2};n.push(i),o[e]={rect:i,metrics:t.metrics}}}const{w:r,h:o}=e.p(n),a=new e.r({width:r||1,height:o||1});for(const s in t){const n=t[s];for(const t in n){const r=n[+t];if(!r||0===r.bitmap.width||0===r.bitmap.height)continue;const o=i[s][t].rect;e.r.copy(r.bitmap,a,{x:0,y:0},{x:o.x+1,y:o.y+1},r.bitmap)}}this.image=a,this.positions=i}}e.cM("GlyphAtlas",i);class n{constructor(t){this.tileID=new e.a2(t.tileID.overscaledZ,t.tileID.wrap,t.tileID.canonical.z,t.tileID.canonical.x,t.tileID.canonical.y),this.uid=t.uid,this.zoom=t.zoom,this.pixelRatio=t.pixelRatio,this.tileSize=t.tileSize,this.source=t.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=t.showCollisionBoxes,this.collectResourceTiming=!!t.collectResourceTiming,this.returnDependencies=!!t.returnDependencies,this.promoteId=t.promoteId,this.inFlightDependencies=[]}parse(t,n,o,a,s){return e._(this,void 0,void 0,function*(){this.status="parsing",this.data=t,this.collisionBoxArray=new e.ag;const l=new e.cN(Object.keys(t.layers).sort()),c=new e.cO(this.tileID,this.promoteId);c.bucketLayerIDs=[];const u={},h={featureIndex:c,iconDependencies:{},patternDependencies:{},glyphDependencies:{},dashDependencies:{},availableImages:o,subdivisionGranularity:s},d=n.familiesBySource[this.source];for(const i in d){const n=t.layers[i];if(!n)continue;1===n.version&&e.w(`Vector tile source "${this.source}" layer "${i}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const a=l.encode(i),s=[];for(let e=0;e<n.length;e++){const t=n.feature(e),r=c.getId(t,i);s.push({feature:t,id:r,index:e,sourceLayerIndex:a})}for(const t of d[i]){const i=t[0];i.source!==this.source&&e.w(`layer.source = ${i.source} does not equal this.source = ${this.source}`),i.isHidden(this.zoom,!0)||(r(t,this.zoom,o),(u[i.id]=i.createBucket({index:c.bucketLayerIDs.length,layers:t,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:a,sourceID:this.source})).populate(s,h,this.tileID.canonical),c.bucketLayerIDs.push(t.map(e=>e.id)))}}const p=e.bY(h.glyphDependencies,e=>Object.keys(e).map(Number));this.inFlightDependencies.forEach(e=>null==e?void 0:e.abort()),this.inFlightDependencies=[];let f=Promise.resolve({});if(Object.keys(p).length){const e=new AbortController;this.inFlightDependencies.push(e),f=a.sendAsync({type:"GG",data:{stacks:p,source:this.source,tileID:this.tileID,type:"glyphs"}},e)}const m=Object.keys(h.iconDependencies);let g=Promise.resolve({});if(m.length){const e=new AbortController;this.inFlightDependencies.push(e),g=a.sendAsync({type:"GI",data:{icons:m,source:this.source,tileID:this.tileID,type:"icons"}},e)}const _=Object.keys(h.patternDependencies);let y=Promise.resolve({});if(_.length){const e=new AbortController;this.inFlightDependencies.push(e),y=a.sendAsync({type:"GI",data:{icons:_,source:this.source,tileID:this.tileID,type:"patterns"}},e)}const v=h.dashDependencies;let x=Promise.resolve({});if(Object.keys(v).length){const e=new AbortController;this.inFlightDependencies.push(e),x=a.sendAsync({type:"GDA",data:{dashes:v}},e)}const[b,w,T,S]=yield Promise.all([f,g,y,x]),P=new i(b),M=new e.cP(w,T);for(const t in u){const i=u[t];i instanceof e.ah?(r(i.layers,this.zoom,o),e.cQ({bucket:i,glyphMap:b,glyphPositions:P.positions,imageMap:w,imagePositions:M.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:h.subdivisionGranularity})):i.hasDependencies&&(i instanceof e.cR||i instanceof e.cS||i instanceof e.cT)&&(r(i.layers,this.zoom,o),i.addFeatures(h,this.tileID.canonical,M.patternPositions,S))}return this.status="done",{buckets:Object.values(u).filter(e=>!e.isEmpty()),featureIndex:c,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:P.image,imageAtlas:M,dashPositions:S,glyphMap:this.returnDependencies?b:null,iconMap:this.returnDependencies?w:null,glyphPositions:this.returnDependencies?P.positions:null}})}}function r(t,i,n){const r=new e.H(i);for(const e of t)e.recalculate(r,n)}class o{constructor(e,t,i,n,r){this.type=e,this.properties=i||{},this.extent=r,this.pointsArray=t,this.id=n}loadGeometry(){return this.pointsArray.map(t=>t.map(t=>new e.P(t.x,t.y)))}}class a{constructor(e,t,i){this.version=2,this._myFeatures=e,this.name=t,this.length=e.length,this.extent=i}feature(e){return this._myFeatures[e]}}class s{constructor(){this.layers={}}addLayer(e){this.layers[e.name]=e}}function l(t){let i=e.cU(t);return 0===i.byteOffset&&i.byteLength===i.buffer.byteLength||(i=new Uint8Array(i)),{vectorTile:t,rawData:i.buffer}}function c(t,i,n){const{extent:r}=t,s=Math.pow(2,n.z-i.z),l=(n.x-i.x*s)*r,c=(n.y-i.y*s)*r,u=[];for(let a=0;a<t.length;a++){const i=t.feature(a);let n=i.loadGeometry();for(const e of n)for(const t of e)t.x=t.x*s-l,t.y=t.y*s-c;const h=128;n=e.cV(n,i.type,-h,-h,r+h,r+h),0!==n.length&&u.push(new o(i.type,n,i.properties,i.id,r))}return new a(u,t.name,r)}class u{constructor(t,i,n){this.actor=t,this.layerIndex=i,this.availableImages=n,this.fetching={},this.loading={},this.loaded={},this.overzoomedTileResultCache=new e.cW(1e3)}loadVectorTile(t,i){return e._(this,void 0,void 0,function*(){const n=yield e.n(t.request,i);try{return{vectorTile:"mlt"!==t.encoding?new e.cX(new e.cY(n.data)):new e.cZ(n.data),rawData:n.data,cacheControl:n.cacheControl,expires:n.expires}}catch(r){const e=new Uint8Array(n.data);let i=`Unable to parse the tile at ${t.request.url}, `;throw i+=31===e[0]&&139===e[1]?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${r.message}`,new Error(i)}})}loadTile(t){return e._(this,void 0,void 0,function*(){const{uid:i,overzoomParameters:r}=t;r&&(t.request=r.overzoomRequest);const o=!!(t&&t.request&&t.request.collectResourceTiming)&&new e.c_(t.request),a=new n(t);this.loading[i]=a;const s=new AbortController;a.abort=s;try{const n=yield this.loadVectorTile(t,s);if(delete this.loading[i],!n)return null;if(r){const e=this._getOverzoomTile(t,n.vectorTile);n.rawData=e.rawData,n.vectorTile=e.vectorTile}const l=n.rawData,c={};n.expires&&(c.expires=n.expires),n.cacheControl&&(c.cacheControl=n.cacheControl);const u={};if(o){const e=o.finish();e&&(u.resourceTiming=JSON.parse(JSON.stringify(e)))}a.vectorTile=n.vectorTile;const h=a.parse(n.vectorTile,this.layerIndex,this.availableImages,this.actor,t.subdivisionGranularity);this.loaded[i]=a,this.fetching[i]={rawTileData:l,cacheControl:c,resourceTiming:u};try{const i=yield h;return e.e({rawTileData:l.slice(0),encoding:t.encoding},i,c,u)}finally{delete this.fetching[i]}}catch(l){throw delete this.loading[i],a.status="done",this.loaded[i]=a,l}})}_getOverzoomTile(e,t){const{tileID:i,source:n,overzoomParameters:r}=e,{maxZoomTileID:o}=r,a=`${o.key}_${i.key}`,u=this.overzoomedTileResultCache.get(a);if(u)return u;const h=new s,d=this.layerIndex.familiesBySource[n];for(const s in d){const e=t.layers[s];if(!e)continue;const n=c(e,o,i.canonical);n.length>0&&h.addLayer(n)}const p=l(h);return this.overzoomedTileResultCache.set(a,p),p}reloadTile(t){return e._(this,void 0,void 0,function*(){const i=t.uid;if(!this.loaded||!this.loaded[i])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const n=this.loaded[i];if(n.showCollisionBoxes=t.showCollisionBoxes,"parsing"===n.status){const r=yield n.parse(n.vectorTile,this.layerIndex,this.availableImages,this.actor,t.subdivisionGranularity);let o;if(this.fetching[i]){const{rawTileData:n,cacheControl:a,resourceTiming:s}=this.fetching[i];delete this.fetching[i],o=e.e({rawTileData:n.slice(0),encoding:t.encoding},r,a,s)}else o=r;return o}if("done"===n.status&&n.vectorTile)return n.parse(n.vectorTile,this.layerIndex,this.availableImages,this.actor,t.subdivisionGranularity)})}abortTile(t){return e._(this,void 0,void 0,function*(){const e=this.loading,i=t.uid;e&&e[i]&&e[i].abort&&(e[i].abort.abort(),delete e[i])})}removeTile(t){return e._(this,void 0,void 0,function*(){this.loaded&&this.loaded[t.uid]&&delete this.loaded[t.uid]})}}class h{constructor(){this.loaded={}}loadTile(t){return e._(this,void 0,void 0,function*(){const{uid:i,encoding:n,rawImageData:r,redFactor:o,greenFactor:a,blueFactor:s,baseShift:l}=t,c=r.width+2,u=r.height+2,h=e.b(r)?new e.R({width:c,height:u},yield e.c$(r,-1,-1,c,u)):r,d=new e.d0(i,h,n,o,a,s,l);return this.loaded=this.loaded||{},this.loaded[i]=d,d})}removeTile(e){const t=this.loaded,i=e.uid;t&&t[i]&&delete t[i]}}var d,p,f=function(){if(p)return d;function e(e,i){if(0!==e.length){t(e[0],i);for(var n=1;n<e.length;n++)t(e[n],!i)}}function t(e,t){for(var i=0,n=0,r=0,o=e.length,a=o-1;r<o;a=r++){var s=(e[r][0]-e[a][0])*(e[a][1]+e[r][1]),l=i+s;n+=Math.abs(i)>=Math.abs(s)?i-l+s:s-l+i,i=l}i+n>=0!=!!t&&e.reverse()}return p=1,d=function t(i,n){var r,o=i&&i.type;if("FeatureCollection"===o)for(r=0;r<i.features.length;r++)t(i.features[r],n);else if("GeometryCollection"===o)for(r=0;r<i.geometries.length;r++)t(i.geometries[r],n);else if("Feature"===o)t(i.geometry,n);else if("Polygon"===o)e(i.coordinates,n);else if("MultiPolygon"===o)for(r=0;r<i.coordinates.length;r++)e(i.coordinates[r],n);return i}}(),m=e.d1(f);const g={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:e=>e},_=Math.fround||(y=new Float32Array(1),e=>(y[0]=+e,y[0]));var y;class v{constructor(e){this.options=Object.assign(Object.create(g),e),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(e){const{log:t,minZoom:i,maxZoom:n}=this.options;e.length,this.points=e;const r=[];for(let a=0;a<e.length;a++){const t=e[a];if(!t.geometry)continue;const[i,n]=t.geometry.coordinates,o=_(w(i)),s=_(T(n));r.push(o,s,1/0,a,-1,1),this.options.reduce&&r.push(0)}let o=this.trees[n+1]=this._createTree(r);for(let a=n;a>=i;a--)Date.now(),o=this.trees[a]=this._createTree(this._cluster(o,a));return this}getClusters(e,t){let i=((e[0]+180)%360+360)%360-180;const n=Math.max(-90,Math.min(90,e[1]));let r=180===e[2]?180:((e[2]+180)%360+360)%360-180;const o=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)i=-180,r=180;else if(i>r){const e=this.getClusters([i,n,180,o],t),a=this.getClusters([-180,n,r,o],t);return e.concat(a)}const a=this.trees[this._limitZoom(t)],s=a.range(w(i),T(o),w(r),T(n)),l=a.data,c=[];for(const u of s){const e=this.stride*u;c.push(l[e+5]>1?x(l,e,this.clusterProps):this.points[l[e+3]])}return c}getChildren(e){const t=this._getOriginId(e),i=this._getOriginZoom(e),n="No cluster with the specified id.",r=this.trees[i];if(!r)throw new Error(n);const o=r.data;if(t*this.stride>=o.length)throw new Error(n);const a=this.options.radius/(this.options.extent*Math.pow(2,i-1)),s=r.within(o[t*this.stride],o[t*this.stride+1],a),l=[];for(const c of s){const t=c*this.stride;o[t+4]===e&&l.push(o[t+5]>1?x(o,t,this.clusterProps):this.points[o[t+3]])}if(0===l.length)throw new Error(n);return l}getLeaves(e,t,i){const n=[];return this._appendLeaves(n,e,t=t||10,i=i||0,0),n}getTile(e,t,i){const n=this.trees[this._limitZoom(e)],r=Math.pow(2,e),{extent:o,radius:a}=this.options,s=a/o,l=(i-s)/r,c=(i+1+s)/r,u={features:[]};return this._addTileFeatures(n.range((t-s)/r,l,(t+1+s)/r,c),n.data,t,i,r,u),0===t&&this._addTileFeatures(n.range(1-s/r,l,1,c),n.data,r,i,r,u),t===r-1&&this._addTileFeatures(n.range(0,l,s/r,c),n.data,-1,i,r,u),u.features.length?u:null}getClusterExpansionZoom(e){let t=this._getOriginZoom(e)-1;for(;t<=this.options.maxZoom;){const i=this.getChildren(e);if(t++,1!==i.length)break;e=i[0].properties.cluster_id}return t}_appendLeaves(e,t,i,n,r){const o=this.getChildren(t);for(const a of o){const t=a.properties;if(t&&t.cluster?r+t.point_count<=n?r+=t.point_count:r=this._appendLeaves(e,t.cluster_id,i,n,r):r<n?r++:e.push(a),e.length===i)break}return r}_createTree(t){const i=new e.aT(t.length/this.stride|0,this.options.nodeSize,Float32Array);for(let e=0;e<t.length;e+=this.stride)i.add(t[e],t[e+1]);return i.finish(),i.data=t,i}_addTileFeatures(e,t,i,n,r,o){for(const a of e){const e=a*this.stride,s=t[e+5]>1;let l,c,u;if(s)l=b(t,e,this.clusterProps),c=t[e],u=t[e+1];else{const i=this.points[t[e+3]];l=i.properties;const[n,r]=i.geometry.coordinates;c=w(n),u=T(r)}const h={type:1,geometry:[[Math.round(this.options.extent*(c*r-i)),Math.round(this.options.extent*(u*r-n))]],tags:l};let d;d=s||this.options.generateId?t[e+3]:this.points[t[e+3]].id,void 0!==d&&(h.id=d),o.features.push(h)}}_limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}_cluster(e,t){const{radius:i,extent:n,reduce:r,minPoints:o}=this.options,a=i/(n*Math.pow(2,t)),s=e.data,l=[],c=this.stride;for(let u=0;u<s.length;u+=c){if(s[u+2]<=t)continue;s[u+2]=t;const i=s[u],n=s[u+1],h=e.within(s[u],s[u+1],a),d=s[u+5];let p=d;for(const e of h){const i=e*c;s[i+2]>t&&(p+=s[i+5])}if(p>d&&p>=o){let e,o=i*d,a=n*d,f=-1;const m=(u/c<<5)+(t+1)+this.points.length;for(const i of h){const n=i*c;if(s[n+2]<=t)continue;s[n+2]=t;const l=s[n+5];o+=s[n]*l,a+=s[n+1]*l,s[n+4]=m,r&&(e||(e=this._map(s,u,!0),f=this.clusterProps.length,this.clusterProps.push(e)),r(e,this._map(s,n)))}s[u+4]=m,l.push(o/p,a/p,1/0,m,-1,p),r&&l.push(f)}else{for(let e=0;e<c;e++)l.push(s[u+e]);if(p>1)for(const e of h){const i=e*c;if(!(s[i+2]<=t)){s[i+2]=t;for(let e=0;e<c;e++)l.push(s[i+e])}}}}return l}_getOriginId(e){return e-this.points.length>>5}_getOriginZoom(e){return(e-this.points.length)%32}_map(e,t,i){if(e[t+5]>1){const n=this.clusterProps[e[t+6]];return i?Object.assign({},n):n}const n=this.points[e[t+3]].properties,r=this.options.map(n);return i&&r===n?Object.assign({},r):r}}function x(e,t,i){return{type:"Feature",id:e[t+3],properties:b(e,t,i),geometry:{type:"Point",coordinates:[(n=e[t],360*(n-.5)),S(e[t+1])]}};var n}function b(e,t,i){const n=e[t+5],r=n>=1e4?`${Math.round(n/1e3)}k`:n>=1e3?Math.round(n/100)/10+"k":n,o=e[t+6],a=-1===o?{}:Object.assign({},i[o]);return Object.assign(a,{cluster:!0,cluster_id:e[t+3],point_count:n,point_count_abbreviated:r})}function w(e){return e/360+.5}function T(e){const t=Math.sin(e*Math.PI/180),i=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return i<0?0:i>1?1:i}function S(e){const t=(180-360*e)*Math.PI/180;return 360*Math.atan(Math.exp(t))/Math.PI-90}function P(e,t,i,n){let r=n;const o=t+(i-t>>1);let a,s=i-t;const l=e[t],c=e[t+1],u=e[i],h=e[i+1];for(let d=t+3;d<i;d+=3){const t=M(e[d],e[d+1],l,c,u,h);if(t>r)a=d,r=t;else if(t===r){const e=Math.abs(d-o);e<s&&(a=d,s=e)}}r>n&&(a-t>3&&P(e,t,a,n),e[a+2]=r,i-a>3&&P(e,a,i,n))}function M(e,t,i,n,r,o){let a=r-i,s=o-n;if(0!==a||0!==s){const l=((e-i)*a+(t-n)*s)/(a*a+s*s);l>1?(i=r,n=o):l>0&&(i+=a*l,n+=s*l)}return a=e-i,s=t-n,a*a+s*s}function E(e,t,i,n){const r={id:null==e?null:e,type:t,geometry:i,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if("Point"===t||"MultiPoint"===t||"LineString"===t)C(r,i);else if("Polygon"===t)C(r,i[0]);else if("MultiLineString"===t)for(const o of i)C(r,o);else if("MultiPolygon"===t)for(const o of i)C(r,o[0]);return r}function C(e,t){for(let i=0;i<t.length;i+=3)e.minX=Math.min(e.minX,t[i]),e.minY=Math.min(e.minY,t[i+1]),e.maxX=Math.max(e.maxX,t[i]),e.maxY=Math.max(e.maxY,t[i+1])}function k(e,t,i,n){if(!t.geometry)return;const r=t.geometry.coordinates;if(r&&0===r.length)return;const o=t.geometry.type,a=Math.pow(i.tolerance/((1<<i.maxZoom)*i.extent),2);let s=[],l=t.id;if(i.promoteId?l=t.properties[i.promoteId]:i.generateId&&(l=n||0),"Point"===o)I(r,s);else if("MultiPoint"===o)for(const c of r)I(c,s);else if("LineString"===o)z(r,s,a,!1);else if("MultiLineString"===o){if(i.lineMetrics){for(const i of r)s=[],z(i,s,a,!1),e.push(E(l,"LineString",s,t.properties));return}A(r,s,a,!1)}else if("Polygon"===o)A(r,s,a,!0);else{if("MultiPolygon"!==o){if("GeometryCollection"===o){for(const r of t.geometry.geometries)k(e,{id:l,geometry:r,properties:t.properties},i,n);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const e of r){const t=[];A(e,t,a,!0),s.push(t)}}e.push(E(l,o,s,t.properties))}function I(e,t){t.push(L(e[0]),D(e[1]),0)}function z(e,t,i,n){let r,o,a=0;for(let l=0;l<e.length;l++){const i=L(e[l][0]),s=D(e[l][1]);t.push(i,s,0),l>0&&(a+=n?(r*s-i*o)/2:Math.sqrt(Math.pow(i-r,2)+Math.pow(s-o,2))),r=i,o=s}const s=t.length-3;t[2]=1,P(t,0,s,i),t[s+2]=1,t.size=Math.abs(a),t.start=0,t.end=t.size}function A(e,t,i,n){for(let r=0;r<e.length;r++){const o=[];z(e[r],o,i,n),t.push(o)}}function L(e){return e/360+.5}function D(e){const t=Math.sin(e*Math.PI/180),i=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return i<0?0:i>1?1:i}function R(e,t,i,n,r,o,a,s){if(n/=t,o>=(i/=t)&&a<n)return e;if(a<i||o>=n)return null;const l=[];for(const c of e){const e=c.geometry;let t=c.type;const o=0===r?c.minX:c.minY,a=0===r?c.maxX:c.maxY;if(o>=i&&a<n){l.push(c);continue}if(a<i||o>=n)continue;let u=[];if("Point"===t||"MultiPoint"===t)F(e,u,i,n,r);else if("LineString"===t)B(e,u,i,n,r,!1,s.lineMetrics);else if("MultiLineString"===t)N(e,u,i,n,r,!1);else if("Polygon"===t)N(e,u,i,n,r,!0);else if("MultiPolygon"===t)for(const s of e){const e=[];N(s,e,i,n,r,!0),e.length&&u.push(e)}if(u.length){if(s.lineMetrics&&"LineString"===t){for(const e of u)l.push(E(c.id,t,e,c.tags));continue}"LineString"!==t&&"MultiLineString"!==t||(1===u.length?(t="LineString",u=u[0]):t="MultiLineString"),"Point"!==t&&"MultiPoint"!==t||(t=3===u.length?"Point":"MultiPoint"),l.push(E(c.id,t,u,c.tags))}}return l.length?l:null}function F(e,t,i,n,r){for(let o=0;o<e.length;o+=3){const a=e[o+r];a>=i&&a<=n&&j(t,e[o],e[o+1],e[o+2])}}function B(e,t,i,n,r,o,a){let s=O(e);const l=0===r?V:U;let c,u,h=e.start;for(let g=0;g<e.length-3;g+=3){const d=e[g],p=e[g+1],f=e[g+2],m=e[g+3],_=e[g+4],y=0===r?d:p,v=0===r?m:_;let x=!1;a&&(c=Math.sqrt(Math.pow(d-m,2)+Math.pow(p-_,2))),y<i?v>i&&(u=l(s,d,p,m,_,i),a&&(s.start=h+c*u)):y>n?v<n&&(u=l(s,d,p,m,_,n),a&&(s.start=h+c*u)):j(s,d,p,f),v<i&&y>=i&&(u=l(s,d,p,m,_,i),x=!0),v>n&&y<=n&&(u=l(s,d,p,m,_,n),x=!0),!o&&x&&(a&&(s.end=h+c*u),t.push(s),s=O(e)),a&&(h+=c)}let d=e.length-3;const p=e[d],f=e[d+1],m=0===r?p:f;m>=i&&m<=n&&j(s,p,f,e[d+2]),d=s.length-3,o&&d>=3&&(s[d]!==s[0]||s[d+1]!==s[1])&&j(s,s[0],s[1],s[2]),s.length&&t.push(s)}function O(e){const t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function N(e,t,i,n,r,o){for(const a of e)B(a,t,i,n,r,o,!1)}function j(e,t,i,n){e.push(t,i,n)}function V(e,t,i,n,r,o){const a=(o-t)/(n-t);return j(e,o,i+(r-i)*a,1),a}function U(e,t,i,n,r,o){const a=(o-i)/(r-i);return j(e,t+(n-t)*a,o,1),a}function Z(e,t){const i=[];for(let n=0;n<e.length;n++){const r=e[n],o=r.type;let a;if("Point"===o||"MultiPoint"===o||"LineString"===o)a=G(r.geometry,t);else if("MultiLineString"===o||"Polygon"===o){a=[];for(const e of r.geometry)a.push(G(e,t))}else if("MultiPolygon"===o){a=[];for(const e of r.geometry){const i=[];for(const n of e)i.push(G(n,t));a.push(i)}}i.push(E(r.id,o,a,r.tags))}return i}function G(e,t){const i=[];i.size=e.size,void 0!==e.start&&(i.start=e.start,i.end=e.end);for(let n=0;n<e.length;n+=3)i.push(e[n]+t,e[n+1],e[n+2]);return i}function q(e,t){if(e.transformed)return e;const i=1<<e.z,n=e.x,r=e.y;for(const o of e.features){const e=o.geometry,a=o.type;if(o.geometry=[],1===a)for(let s=0;s<e.length;s+=2)o.geometry.push($(e[s],e[s+1],t,i,n,r));else for(let s=0;s<e.length;s++){const a=[];for(let o=0;o<e[s].length;o+=2)a.push($(e[s][o],e[s][o+1],t,i,n,r));o.geometry.push(a)}}return e.transformed=!0,e}function $(e,t,i,n,r,o){return[Math.round(i*(e*n-r)),Math.round(i*(t*n-o))]}function W(e,t,i,n,r){const o=t===r.maxZoom?0:r.tolerance/((1<<t)*r.extent),a={features:[],numPoints:0,numSimplified:0,numFeatures:e.length,source:null,x:i,y:n,z:t,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const s of e)H(a,s,o,r);return a}function H(e,t,i,n){const r=t.geometry,o=t.type,a=[];if(e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),"Point"===o||"MultiPoint"===o)for(let s=0;s<r.length;s+=3)a.push(r[s],r[s+1]),e.numPoints++,e.numSimplified++;else if("LineString"===o)X(a,r,e,i,!1,!1);else if("MultiLineString"===o||"Polygon"===o)for(let s=0;s<r.length;s++)X(a,r[s],e,i,"Polygon"===o,0===s);else if("MultiPolygon"===o)for(let s=0;s<r.length;s++){const t=r[s];for(let n=0;n<t.length;n++)X(a,t[n],e,i,!0,0===n)}if(a.length){let i=t.tags||null;if("LineString"===o&&n.lineMetrics){i={};for(const e in t.tags)i[e]=t.tags[e];i.mapbox_clip_start=r.start/r.size,i.mapbox_clip_end=r.end/r.size}const s={geometry:a,type:"Polygon"===o||"MultiPolygon"===o?3:"LineString"===o||"MultiLineString"===o?2:1,tags:i};null!==t.id&&(s.id=t.id),e.features.push(s)}}function X(e,t,i,n,r,o){const a=n*n;if(n>0&&t.size<(r?a:n))return void(i.numPoints+=t.length/3);const s=[];for(let l=0;l<t.length;l+=3)(0===n||t[l+2]>a)&&(i.numSimplified++,s.push(t[l],t[l+1])),i.numPoints++;r&&function(e,t){let i=0;for(let n=0,r=e.length,o=r-2;n<r;o=n,n+=2)i+=(e[n]-e[o])*(e[n+1]+e[o+1]);if(i>0===t)for(let n=0,r=e.length;n<r/2;n+=2){const t=e[n],i=e[n+1];e[n]=e[r-2-n],e[n+1]=e[r-1-n],e[r-2-n]=t,e[r-1-n]=i}}(s,o),e.push(s)}const Y={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class K{constructor(e,t){const i=(t=this.options=function(e,t){for(const i in t)e[i]=t[i];return e}(Object.create(Y),t)).debug;if(t.maxZoom<0||t.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(t.promoteId&&t.generateId)throw new Error("promoteId and generateId cannot be used together.");let n=function(e,t){const i=[];if("FeatureCollection"===e.type)for(let n=0;n<e.features.length;n++)k(i,e.features[n],t,n);else k(i,"Feature"===e.type?e:{geometry:e},t);return i}(e,t);this.tiles={},this.tileCoords=[],i&&(this.stats={},this.total=0),n=function(e,t){const i=t.buffer/t.extent;let n=e;const r=R(e,1,-1-i,i,0,-1,2,t),o=R(e,1,1-i,2+i,0,-1,2,t);return(r||o)&&(n=R(e,1,-i,1+i,0,-1,2,t)||[],r&&(n=Z(r,1).concat(n)),o&&(n=n.concat(Z(o,-1)))),n}(n,t),n.length&&this.splitTile(n,0,0,0),i&&n.length}splitTile(e,t,i,n,r,o,a){const s=[e,t,i,n],l=this.options,c=l.debug;for(;s.length;){n=s.pop(),i=s.pop(),t=s.pop(),e=s.pop();const u=1<<t,h=Q(t,i,n);let d=this.tiles[h];if(!d&&(d=this.tiles[h]=W(e,t,i,n,l),this.tileCoords.push({z:t,x:i,y:n}),c)){const e=`z${t}`;this.stats[e]=(this.stats[e]||0)+1,this.total++}if(d.source=e,null==r){if(t===l.indexMaxZoom||d.numPoints<=l.indexMaxPoints)continue}else{if(t===l.maxZoom||t===r)continue;if(null!=r){const e=r-t;if(i!==o>>e||n!==a>>e)continue}}if(d.source=null,0===e.length)continue;const p=.5*l.buffer/l.extent,f=.5-p,m=.5+p,g=1+p;let _=null,y=null,v=null,x=null,b=R(e,u,i-p,i+m,0,d.minX,d.maxX,l),w=R(e,u,i+f,i+g,0,d.minX,d.maxX,l);e=null,b&&(_=R(b,u,n-p,n+m,1,d.minY,d.maxY,l),y=R(b,u,n+f,n+g,1,d.minY,d.maxY,l),b=null),w&&(v=R(w,u,n-p,n+m,1,d.minY,d.maxY,l),x=R(w,u,n+f,n+g,1,d.minY,d.maxY,l),w=null),s.push(_||[],t+1,2*i,2*n),s.push(y||[],t+1,2*i,2*n+1),s.push(v||[],t+1,2*i+1,2*n),s.push(x||[],t+1,2*i+1,2*n+1)}}getTile(e,t,i){e=+e,t=+t,i=+i;const n=this.options,{extent:r,debug:o}=n;if(e<0||e>24)return null;const a=1<<e,s=Q(e,t=t+a&a-1,i);if(this.tiles[s])return q(this.tiles[s],r);let l,c=e,u=t,h=i;for(;!l&&c>0;)c--,u>>=1,h>>=1,l=this.tiles[Q(c,u,h)];return l&&l.source?(this.splitTile(l.source,c,u,h,e,t,i),this.tiles[s]?q(this.tiles[s],r):null):null}}function Q(e,t,i){return 32*((1<<e)*i+t)+e}class J extends u{constructor(e,t,i,n=ee){super(e,t,i),this._dataUpdateable=new Map,this._createGeoJSONIndex=n}loadVectorTile(t,i){return e._(this,void 0,void 0,function*(){const i=t.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const n=this._geoJSONIndex.getTile(i.z,i.x,i.y);return n?l(new e.d2(n.features,{version:2,extent:e.a5})):null})}loadData(t){return e._(this,void 0,void 0,function*(){var i;null===(i=this._pendingRequest)||void 0===i||i.abort();const n=this._startPerformance(t);this._pendingRequest=new AbortController;try{(!this._pendingData||t.request||t.data||t.dataDiff)&&(this._pendingData=this.loadAndProcessGeoJSON(t,this._pendingRequest));const e=yield this._pendingData;this._geoJSONIndex=this._createGeoJSONIndex(e,t),this.loaded={};const i={};return t.request&&(i.data=e),this._finishPerformance(n,t,i),i}catch(r){if(delete this._pendingRequest,e.Z(r))return{abandoned:!0};throw r}})}_startPerformance(t){var i;if(null===(i=null==t?void 0:t.request)||void 0===i?void 0:i.collectResourceTiming)return new e.c_(t.request)}_finishPerformance(e,t,i){if(!e)return;const n=e.finish();n&&(i.resourceTiming={},i.resourceTiming[t.source]=JSON.parse(JSON.stringify(n)))}getData(){return e._(this,void 0,void 0,function*(){return this._pendingData})}reloadTile(e){const t=this.loaded;return t&&t[e.uid]?super.reloadTile(e):this.loadTile(e)}loadAndProcessGeoJSON(t,i){return e._(this,void 0,void 0,function*(){let e;if(t.request?e=yield this.loadGeoJSONFromUrl(t.request,t.promoteId,i):t.data?e=this._loadGeoJSONFromObject(t.data,t.promoteId):t.dataDiff&&(e=this._loadGeoJSONFromDiff(t.dataDiff,t.promoteId,t.source)),delete this._pendingRequest,"object"!=typeof e)throw new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`);return m(e,!0),t.filter&&(e=this._filterGeoJSON(e,t.filter)),e})}loadGeoJSONFromUrl(t,i,n){return e._(this,void 0,void 0,function*(){const r=yield e.j(t,n);return this._dataUpdateable=e.a7(r.data,i),r.data})}_loadGeoJSONFromObject(t,i){return this._dataUpdateable=e.a7(t,i),t}_loadGeoJSONFromDiff(t,i,n){if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${n}`);e.a8(this._dataUpdateable,t,i);const r=Array.from(this._dataUpdateable.values());return this._toFeatureCollection(r)}_filterGeoJSON(t,i){const n=e.d3(i,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===n.result)throw new Error(n.value.map(e=>`${e.key}: ${e.message}`).join(", "));const r=t.features.filter(e=>n.value.evaluate({zoom:0},e));return this._toFeatureCollection(r)}_toFeatureCollection(e){return{type:"FeatureCollection",features:e}}removeSource(t){return e._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(e){return this._geoJSONIndex.getClusterExpansionZoom(e.clusterId)}getClusterChildren(e){return this._geoJSONIndex.getChildren(e.clusterId)}getClusterLeaves(e){return this._geoJSONIndex.getLeaves(e.clusterId,e.limit,e.offset)}}function ee(t,i){return i.cluster?new v(function({superclusterOptions:t,clusterProperties:i}){if(!i||!t)return t;const n={},r={},o={accumulated:null,zoom:0},a={properties:null},s=Object.keys(i);for(const l of s){const[t,o]=i[l],a=e.d3(o),s=e.d3("string"==typeof t?[t,["accumulated"],["get",l]]:t);n[l]=a.value,r[l]=s.value}return t.map=e=>{a.properties=e;const t={};for(const i of s)t[i]=n[i].evaluate(o,a);return t},t.reduce=(e,t)=>{a.properties=t;for(const i of s)o.accumulated=e[i],e[i]=r[i].evaluate(o,a)},t}(i)).load(t.features):(n=t,r=i.geojsonVtOptions,new K(n,r));var n,r}class te{constructor(t){this.self=t,this.actor=new e.L(t),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.globalStates=new Map,this.self.registerWorkerSource=(e,t)=>{if(this.externalWorkerSourceTypes[e])throw new Error(`Worker source with name "${e}" already registered.`);this.externalWorkerSourceTypes[e]=t},this.self.addProtocol=e.cJ,this.self.removeProtocol=e.cK,this.self.registerRTLTextPlugin=t=>{e.d4.setMethods(t)},this.actor.registerMessageHandler("LDT",(e,t)=>this._getDEMWorkerSource(e,t.source).loadTile(t)),this.actor.registerMessageHandler("RDT",(t,i)=>e._(this,void 0,void 0,function*(){this._getDEMWorkerSource(t,i.source).removeTile(i)})),this.actor.registerMessageHandler("GCEZ",(t,i)=>e._(this,void 0,void 0,function*(){return this._getWorkerSource(t,i.type,i.source).getClusterExpansionZoom(i)})),this.actor.registerMessageHandler("GCC",(t,i)=>e._(this,void 0,void 0,function*(){return this._getWorkerSource(t,i.type,i.source).getClusterChildren(i)})),this.actor.registerMessageHandler("GCL",(t,i)=>e._(this,void 0,void 0,function*(){return this._getWorkerSource(t,i.type,i.source).getClusterLeaves(i)})),this.actor.registerMessageHandler("LD",(e,t)=>this._getWorkerSource(e,t.type,t.source).loadData(t)),this.actor.registerMessageHandler("GD",(e,t)=>this._getWorkerSource(e,t.type,t.source).getData()),this.actor.registerMessageHandler("LT",(e,t)=>this._getWorkerSource(e,t.type,t.source).loadTile(t)),this.actor.registerMessageHandler("RT",(e,t)=>this._getWorkerSource(e,t.type,t.source).reloadTile(t)),this.actor.registerMessageHandler("AT",(e,t)=>this._getWorkerSource(e,t.type,t.source).abortTile(t)),this.actor.registerMessageHandler("RMT",(e,t)=>this._getWorkerSource(e,t.type,t.source).removeTile(t)),this.actor.registerMessageHandler("RS",(t,i)=>e._(this,void 0,void 0,function*(){if(!this.workerSources[t]||!this.workerSources[t][i.type]||!this.workerSources[t][i.type][i.source])return;const e=this.workerSources[t][i.type][i.source];delete this.workerSources[t][i.type][i.source],void 0!==e.removeSource&&e.removeSource(i)})),this.actor.registerMessageHandler("RM",t=>e._(this,void 0,void 0,function*(){delete this.layerIndexes[t],delete this.availableImages[t],delete this.workerSources[t],delete this.demWorkerSources[t],this.globalStates.delete(t)})),this.actor.registerMessageHandler("SR",(t,i)=>e._(this,void 0,void 0,function*(){this.referrer=i})),this.actor.registerMessageHandler("SRPS",(e,t)=>this._syncRTLPluginState(e,t)),this.actor.registerMessageHandler("IS",(t,i)=>e._(this,void 0,void 0,function*(){this.self.importScripts(i)})),this.actor.registerMessageHandler("SI",(e,t)=>this._setImages(e,t)),this.actor.registerMessageHandler("UL",(t,i)=>e._(this,void 0,void 0,function*(){this._getLayerIndex(t).update(i.layers,i.removedIds,this._getGlobalState(t))})),this.actor.registerMessageHandler("UGS",(t,i)=>e._(this,void 0,void 0,function*(){const e=this._getGlobalState(t);for(const t in i)e[t]=i[t]})),this.actor.registerMessageHandler("SL",(t,i)=>e._(this,void 0,void 0,function*(){this._getLayerIndex(t).replace(i,this._getGlobalState(t))}))}_getGlobalState(e){let t=this.globalStates.get(e);return t||(t={},this.globalStates.set(e,t)),t}_setImages(t,i){return e._(this,void 0,void 0,function*(){this.availableImages[t]=i;for(const e in this.workerSources[t]){const n=this.workerSources[t][e];for(const e in n)n[e].availableImages=i}})}_syncRTLPluginState(t,i){return e._(this,void 0,void 0,function*(){return yield e.d4.syncState(i,this.self.importScripts)})}_getAvailableImages(e){let t=this.availableImages[e];return t||(t=[]),t}_getLayerIndex(e){let i=this.layerIndexes[e];return i||(i=this.layerIndexes[e]=new t),i}_getWorkerSource(e,t,i){if(this.workerSources[e]||(this.workerSources[e]={}),this.workerSources[e][t]||(this.workerSources[e][t]={}),!this.workerSources[e][t][i]){const n={sendAsync:(t,i)=>(t.targetMapId=e,this.actor.sendAsync(t,i))};switch(t){case"vector":this.workerSources[e][t][i]=new u(n,this._getLayerIndex(e),this._getAvailableImages(e));break;case"geojson":this.workerSources[e][t][i]=new J(n,this._getLayerIndex(e),this._getAvailableImages(e));break;default:this.workerSources[e][t][i]=new this.externalWorkerSourceTypes[t](n,this._getLayerIndex(e),this._getAvailableImages(e))}}return this.workerSources[e][t][i]}_getDEMWorkerSource(e,t){return this.demWorkerSources[e]||(this.demWorkerSources[e]={}),this.demWorkerSources[e][t]||(this.demWorkerSources[e][t]=new h),this.demWorkerSources[e][t]}}return e.i(self)&&(self.worker=new te(self)),te}),n("index",["exports","./shared"],function(e,t){var i="5.16.0";function n(){var e=new t.A(4);return t.A!=Float32Array&&(e[1]=0,e[2]=0),e[0]=1,e[3]=1,e}let r,o,a;const s={frame(e,i,n){const r=requestAnimationFrame(e=>{o(),i(e)}),{unsubscribe:o}=t.s(e.signal,"abort",()=>{o(),cancelAnimationFrame(r),n(new t.a(e.signal.reason))},!1)},frameAsync(e){return new Promise((t,i)=>{this.frame(e,t,i)})},getImageData(e,t=0){return this.getImageCanvasContext(e).getImageData(-t,-t,e.width+2*t,e.height+2*t)},getImageCanvasContext(e){const t=window.document.createElement("canvas"),i=t.getContext("2d",{willReadFrequently:!0});if(!i)throw new Error("failed to create canvas 2d context");return t.width=e.width,t.height=e.height,i.drawImage(e,0,0,e.width,e.height),i},resolveURL:e=>(r||(r=document.createElement("a")),r.href=e,r.href),hardwareConcurrency:"undefined"!=typeof navigator&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return void 0!==a?a:!!matchMedia&&(null==o&&(o=matchMedia("(prefers-reduced-motion: reduce)")),o.matches)},set prefersReducedMotion(e){a=e}},l=new class{constructor(){this._realTime="undefined"!=typeof performance&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),this._frozenAt=null}getCurrentTime(){return null!==this._frozenAt?this._frozenAt:this._realTime()}setNow(e){this._frozenAt=e}restoreNow(){this._frozenAt=null}isFrozen(){return null!==this._frozenAt}};function c(){return l.getCurrentTime()}class u{static testProp(e){if(!u.docStyle)return e[0];for(let t=0;t<e.length;t++)if(e[t]in u.docStyle)return e[t];return e[0]}static create(e,t,i){const n=window.document.createElement(e);return void 0!==t&&(n.className=t),i&&i.appendChild(n),n}static createNS(e,t){return window.document.createElementNS(e,t)}static disableDrag(){u.docStyle&&u.selectProp&&(u.userSelect=u.docStyle[u.selectProp],u.docStyle[u.selectProp]="none")}static enableDrag(){u.docStyle&&u.selectProp&&(u.docStyle[u.selectProp]=u.userSelect)}static setTransform(e,t){e.style[u.transformProp]=t}static addEventListener(e,t,i,n={}){e.addEventListener(t,i,"passive"in n?n:n.capture)}static removeEventListener(e,t,i,n={}){e.removeEventListener(t,i,"passive"in n?n:n.capture)}static suppressClickInternal(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener("click",u.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",u.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",u.suppressClickInternal,!0)},0)}static getScale(e){const t=e.getBoundingClientRect();return{x:t.width/e.offsetWidth||1,y:t.height/e.offsetHeight||1,boundingClientRect:t}}static getPoint(e,i,n){const r=i.boundingClientRect;return new t.P((n.clientX-r.left)/i.x-e.clientLeft,(n.clientY-r.top)/i.y-e.clientTop)}static mousePos(e,t){const i=u.getScale(e);return u.getPoint(e,i,t)}static touchPos(e,t){const i=[],n=u.getScale(e);for(let r=0;r<t.length;r++)i.push(u.getPoint(e,n,t[r]));return i}static mouseButton(e){return e.button}static remove(e){e.parentNode&&e.parentNode.removeChild(e)}static sanitize(e){const t=(new DOMParser).parseFromString(e,"text/html").body||document.createElement("body"),i=t.querySelectorAll("script");for(const n of i)n.remove();return u.clean(t),t.innerHTML}static isPossiblyDangerous(e,t){const i=t.replace(/\s+/g,"").toLowerCase();return!(!["src","href","xlink:href"].includes(e)||!i.includes("javascript:")&&!i.includes("data:"))||!!e.startsWith("on")||void 0}static clean(e){const t=e.children;for(const i of t)u.removeAttributes(i),u.clean(i)}static removeAttributes(e){for(const{name:t,value:i}of e.attributes)u.isPossiblyDangerous(t,i)&&e.removeAttribute(t)}}u.docStyle="undefined"!=typeof window&&window.document&&window.document.documentElement.style,u.selectProp=u.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),u.transformProp=u.testProp(["transform","WebkitTransform"]);const h={supported:!1,testSupport:function(e){!f&&p&&(m?g(e):d=e)}};let d,p,f=!1,m=!1;function g(e){const t=e.createTexture();e.bindTexture(e.TEXTURE_2D,t);try{if(e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,p),e.isContextLost())return;h.supported=!0}catch(i){}e.deleteTexture(t),f=!0}var _;"undefined"!=typeof document&&(p=document.createElement("img"),p.onload=()=>{d&&g(d),d=null,m=!0},p.onerror=()=>{f=!0,d=null},p.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(e){let i,n,r,o;e.resetRequestQueue=()=>{i=[],n=0,r=0,o={}},e.addThrottleControl=e=>{const t=r++;return o[t]=e,t},e.removeThrottleControl=e=>{delete o[e],s()},e.getImage=(e,n,r=!0)=>new Promise((o,a)=>{h.supported&&(e.headers||(e.headers={}),e.headers.accept="image/webp,*/*"),t.e(e,{type:"image"}),i.push({abortController:n,requestParameters:e,supportImageRefresh:r,state:"queued",onError:e=>{a(e)},onSuccess:e=>{o(e)}}),s()});const a=e=>t._(this,void 0,void 0,function*(){e.state="running";const{requestParameters:i,supportImageRefresh:r,onError:o,onSuccess:a,abortController:c}=e,u=!1===r&&!t.i(self)&&!t.g(i.url)&&(!i.headers||Object.keys(i.headers).reduce((e,t)=>e&&"accept"===t,!0));n++;const h=u?l(i,c):t.m(i,c);try{const i=yield h;delete e.abortController,e.state="completed",i.data instanceof HTMLImageElement||t.b(i.data)?a(i):i.data&&a({data:yield(d=i.data,"function"==typeof createImageBitmap?t.f(d):t.h(d)),cacheControl:i.cacheControl,expires:i.expires})}catch(p){delete e.abortController,o(p)}finally{n--,s()}var d}),s=()=>{const e=(()=>{for(const e of Object.keys(o))if(o[e]())return!0;return!1})()?t.c.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:t.c.MAX_PARALLEL_IMAGE_REQUESTS;for(let t=n;t<e&&i.length>0;t++){const e=i.shift();e.abortController.signal.aborted?t--:a(e)}},l=(e,i)=>new Promise((n,r)=>{const o=new Image,a=e.url,s=e.credentials;s&&"include"===s?o.crossOrigin="use-credentials":(s&&"same-origin"===s||!t.d(a))&&(o.crossOrigin="anonymous"),i.signal.addEventListener("abort",()=>{o.src="",r(new t.a(i.signal.reason))}),o.fetchPriority="high",o.onload=()=>{o.onerror=o.onload=null,n({data:o})},o.onerror=()=>{o.onerror=o.onload=null,i.signal.aborted||r(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."))},o.src=a})}(_||(_={})),_.resetRequestQueue();class y{constructor(e){this._transformRequestFn=null!=e?e:null}transformRequest(e,t){return this._transformRequestFn&&this._transformRequestFn(e,t)||{url:e}}setTransformRequest(e){this._transformRequestFn=e}}function v(e){const t=[];if("string"==typeof e)t.push({id:"default",url:e});else if(e&&e.length>0){const i=[];for(const{id:n,url:r}of e){const e=`${n}${r}`;-1===i.indexOf(e)&&(i.push(e),t.push({id:n,url:r}))}}return t}function x(e,t,i){try{const n=new URL(e);return n.pathname+=`${t}${i}`,n.toString()}catch(n){throw new Error(`Invalid sprite URL "${e}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}function b(e){const{userImage:t}=e;return!!(t&&t.render&&t.render())&&(e.data.replace(new Uint8Array(t.data.buffer)),!0)}class w extends t.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new t.R({width:1,height:1}),this.dirty=!0}destroy(){this.atlasTexture&&(this.atlasTexture.destroy(),this.atlasTexture=null);for(const e of Object.keys(this.images))this.removeImage(e);this.patterns={},this.atlasImage=new t.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(const{ids:e,promiseResolve:t}of this.requestors)t(this._getImagesForIds(e));this.requestors=[]}}getImage(e){const i=this.images[e];if(i&&!i.data&&i.spriteData){const e=i.spriteData;i.data=new t.R({width:e.width,height:e.height},e.context.getImageData(e.x,e.y,e.width,e.height).data),i.spriteData=null}return i}addImage(e,t){if(this.images[e])throw new Error(`Image id ${e} already exist, use updateImage instead`);this._validate(e,t)&&(this.images[e]=t)}_validate(e,i){let n=!0;const r=i.data||i.spriteData;return this._validateStretch(i.stretchX,r&&r.width)||(this.fire(new t.k(new Error(`Image "${e}" has invalid "stretchX" value`))),n=!1),this._validateStretch(i.stretchY,r&&r.height)||(this.fire(new t.k(new Error(`Image "${e}" has invalid "stretchY" value`))),n=!1),this._validateContent(i.content,i)||(this.fire(new t.k(new Error(`Image "${e}" has invalid "content" value`))),n=!1),n}_validateStretch(e,t){if(!e)return!0;let i=0;for(const n of e){if(n[0]<i||n[1]<n[0]||t<n[1])return!1;i=n[1]}return!0}_validateContent(e,t){if(!e)return!0;if(4!==e.length)return!1;const i=t.spriteData,n=i&&i.width||t.data.width,r=i&&i.height||t.data.height;return!(e[0]<0||n<e[0]||e[1]<0||r<e[1]||e[2]<0||n<e[2]||e[3]<0||r<e[3]||e[2]<e[0]||e[3]<e[1])}updateImage(e,t,i=!0){const n=this.getImage(e);if(i&&(n.data.width!==t.data.width||n.data.height!==t.data.height))throw new Error(`size mismatch between old image (${n.data.width}x${n.data.height}) and new image (${t.data.width}x${t.data.height}).`);t.version=n.version+1,this.images[e]=t,this.updatedImages[e]=!0}removeImage(e){const t=this.images[e];delete this.images[e],delete this.patterns[e],t.userImage&&t.userImage.onRemove&&t.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(e){return new Promise((t,i)=>{let n=!0;if(!this.isLoaded())for(const r of e)this.images[r]||(n=!1);this.isLoaded()||n?t(this._getImagesForIds(e)):this.requestors.push({ids:e,promiseResolve:t})})}_getImagesForIds(e){const i={};for(const n of e){let e=this.getImage(n);e||(this.fire(new t.l("styleimagemissing",{id:n})),e=this.getImage(n)),e?i[n]={data:e.data.clone(),pixelRatio:e.pixelRatio,sdf:e.sdf,version:e.version,stretchX:e.stretchX,stretchY:e.stretchY,content:e.content,textFitWidth:e.textFitWidth,textFitHeight:e.textFitHeight,hasRenderCallback:Boolean(e.userImage&&e.userImage.render)}:t.w(`Image "${n}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}return i}getPixelSize(){const{width:e,height:t}=this.atlasImage;return{width:e,height:t}}getPattern(e){const i=this.patterns[e],n=this.getImage(e);if(!n)return null;if(i&&i.position.version===n.version)return i.position;if(i)i.position.version=n.version;else{const i={w:n.data.width+2,h:n.data.height+2,x:0,y:0},r=new t.I(i,n);this.patterns[e]={bin:i,position:r}}return this._updatePatternAtlas(),this.patterns[e].position}bind(e){const i=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new t.T(e,this.atlasImage,i.RGBA),this.atlasTexture.bind(i.LINEAR,i.CLAMP_TO_EDGE)}_updatePatternAtlas(){const e=[];for(const t in this.patterns)e.push(this.patterns[t].bin);const{w:i,h:n}=t.p(e),r=this.atlasImage;r.resize({width:i||1,height:n||1});for(const o in this.patterns){const{bin:e}=this.patterns[o],i=e.x+1,n=e.y+1,a=this.getImage(o).data,s=a.width,l=a.height;t.R.copy(a,r,{x:0,y:0},{x:i,y:n},{width:s,height:l}),t.R.copy(a,r,{x:0,y:l-1},{x:i,y:n-1},{width:s,height:1}),t.R.copy(a,r,{x:0,y:0},{x:i,y:n+l},{width:s,height:1}),t.R.copy(a,r,{x:s-1,y:0},{x:i-1,y:n},{width:1,height:l}),t.R.copy(a,r,{x:0,y:0},{x:i+s,y:n},{width:1,height:l})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(const i of e){if(this.callbackDispatchedThisFrame[i])continue;this.callbackDispatchedThisFrame[i]=!0;const e=this.getImage(i);e||t.w(`Image with ID: "${i}" was not found`),b(e)&&this.updateImage(i,e)}}cloneImages(){const e={};for(const t in this.images){const i=this.images[t];e[t]=Object.assign(Object.assign({},i),{data:i.data?i.data.clone():null})}return e}}const T=1e20;function S(e,t,i,n,r,o,a,s,l){for(let c=t;c<t+n;c++)P(e,i*o+c,o,r,a,s,l);for(let c=i;c<i+r;c++)P(e,c*o+t,1,n,a,s,l)}function P(e,t,i,n,r,o,a){o[0]=0,a[0]=-T,a[1]=T,r[0]=e[t];for(let s=1,l=0,c=0;s<n;s++){r[s]=e[t+s*i];const n=s*s;do{const e=o[l];c=(r[s]-r[e]+n-e*e)/(s-e)/2}while(c<=a[l]&&--l>-1);l++,o[l]=s,a[l]=c,a[l+1]=T}for(let s=0,l=0;s<n;s++){for(;a[l+1]<s;)l++;const n=o[l],c=s-n;e[t+s*i]=r[n]+c*c}}const M=t.v.layout_symbol["text-font"].default.join(",");class E{constructor(e,t,i){this.requestManager=e,this.localIdeographFontFamily=t,this.entries={},this.lang=i}setURL(e){this.url=e}getGlyphs(e){return t._(this,void 0,void 0,function*(){const t=[];for(const r in e)for(const i of e[r])t.push(this._getAndCacheGlyphsPromise(r,i));const i=yield Promise.all(t),n={};for(const{stack:e,id:r,glyph:o}of i)n[e]||(n[e]={}),n[e][r]=o&&{id:o.id,bitmap:o.bitmap.clone(),metrics:o.metrics};return n})}_getAndCacheGlyphsPromise(e,i){return t._(this,void 0,void 0,function*(){let t=this.entries[e];t||(t=this.entries[e]={glyphs:{},requests:{},ranges:{}});let n=t.glyphs[i];return void 0!==n?{stack:e,id:i,glyph:n}:!this.url||this._charUsesLocalIdeographFontFamily(i)?(n=t.glyphs[i]=this._drawGlyph(t,e,i),{stack:e,id:i,glyph:n}):yield this._downloadAndCacheRangePromise(e,i)})}_downloadAndCacheRangePromise(e,i){return t._(this,void 0,void 0,function*(){const t=this.entries[e],n=Math.floor(i/256);if(t.ranges[n])return{stack:e,id:i,glyph:null};if(!t.requests[n]){const i=E.loadGlyphRange(e,n,this.url,this.requestManager);t.requests[n]=i}try{const r=yield t.requests[n];for(const e in r)t.glyphs[+e]=r[+e];return t.ranges[n]=!0,{stack:e,id:i,glyph:r[i]||null}}catch(r){const o=t.glyphs[i]=this._drawGlyph(t,e,i);return this._warnOnMissingGlyphRange(o,n,i,r),{stack:e,id:i,glyph:o}}})}_warnOnMissingGlyphRange(e,i,n,r){const o=256*i,a=o+255,s=n.toString(16).padStart(4,"0").toUpperCase();t.w(`Unable to load glyph range ${i}, ${o}-${a}. Rendering codepoint U+${s} locally instead. ${r}`)}_charUsesLocalIdeographFontFamily(e){return!!this.localIdeographFontFamily&&t.q(e)}_drawGlyph(e,i,n){const r=i===M&&""!==this.localIdeographFontFamily&&this._charUsesLocalIdeographFontFamily(n),o=r?"ideographTinySDF":"tinySDF";e[o]||(e[o]=this._createTinySDF(r?this.localIdeographFontFamily:i));const a=e[o].draw(String.fromCodePoint(n)),s=/^\p{gc=Cf}+$/u.test(String.fromCodePoint(n));return{id:n,bitmap:new t.r({width:a.width||60,height:a.height||60},a.data),metrics:{width:s?0:a.glyphWidth/2||24,height:a.glyphHeight/2||24,left:a.glyphLeft/2+.5||0,top:a.glyphTop/2-27.5||-8,advance:s?0:a.glyphAdvance/2||24,isDoubleResolution:!0}}}_createTinySDF(e){const t=e?e.split(","):[];t.push("sans-serif");const i=t.map(e=>/[-\w]+/.test(e)?e:`'${CSS.escape(e)}'`).join(",");return new E.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:i,fontWeight:this._fontWeight(t[0]),fontStyle:this._fontStyle(t[0]),lang:this.lang})}_fontStyle(e){return/italic/i.test(e)?"italic":/oblique/i.test(e)?"oblique":"normal"}_fontWeight(e){const t={thin:100,hairline:100,"extra light":200,"ultra light":200,light:300,normal:400,regular:400,medium:500,semibold:600,demibold:600,bold:700,"extra bold":800,"ultra bold":800,black:900,heavy:900,"extra black":950,"ultra black":950};let i;for(const[n,r]of Object.entries(t))new RegExp(`\\b${n}\\b`,"i").test(e)&&(i=`${r}`);return i}destroy(){for(const e in this.entries){const t=this.entries[e];t.tinySDF&&(t.tinySDF=null),t.ideographTinySDF&&(t.ideographTinySDF=null),t.glyphs={},t.requests={},t.ranges={}}this.entries={}}}E.loadGlyphRange=function(e,i,n,r){return t._(this,void 0,void 0,function*(){const o=256*i,a=o+255,s=r.transformRequest(n.replace("{fontstack}",e).replace("{range}",`${o}-${a}`),"Glyphs"),l=yield t.n(s,new AbortController);if(!l||!l.data)throw new Error(`Could not load glyph range. range: ${i}, ${o}-${a}`);const c={};for(const e of t.o(l.data))c[e.id]=e;return c})},E.TinySDF=class{constructor({fontSize:e=24,buffer:t=3,radius:i=8,cutoff:n=.25,fontFamily:r="sans-serif",fontWeight:o="normal",fontStyle:a="normal",lang:s=null}={}){this.buffer=t,this.cutoff=n,this.radius=i,this.lang=s;const l=this.size=e+4*t,c=this._createCanvas(l),u=this.ctx=c.getContext("2d",{willReadFrequently:!0});u.font=`${a} ${o} ${e}px ${r}`,u.textBaseline="alphabetic",u.textAlign="left",u.fillStyle="black",this.gridOuter=new Float64Array(l*l),this.gridInner=new Float64Array(l*l),this.f=new Float64Array(l),this.z=new Float64Array(l+1),this.v=new Uint16Array(l)}_createCanvas(e){const t=document.createElement("canvas");return t.width=t.height=e,t}draw(e){const{width:t,actualBoundingBoxAscent:i,actualBoundingBoxDescent:n,actualBoundingBoxLeft:r,actualBoundingBoxRight:o}=this.ctx.measureText(e),a=Math.ceil(i),s=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(o-r))),l=Math.min(this.size-this.buffer,a+Math.ceil(n)),c=s+2*this.buffer,u=l+2*this.buffer,h=Math.max(c*u,0),d=new Uint8ClampedArray(h),p={data:d,width:c,height:u,glyphWidth:s,glyphHeight:l,glyphTop:a,glyphLeft:0,glyphAdvance:t};if(0===s||0===l)return p;const{ctx:f,buffer:m,gridInner:g,gridOuter:_}=this;this.lang&&(f.lang=this.lang),f.clearRect(m,m,s,l),f.fillText(e,m,m+a);const y=f.getImageData(m,m,s,l);_.fill(T,0,h),g.fill(0,0,h);for(let v=0;v<l;v++)for(let e=0;e<s;e++){const t=y.data[4*(v*s+e)+3]/255;if(0===t)continue;const i=(v+m)*c+e+m;if(1===t)_[i]=0,g[i]=T;else{const e=.5-t;_[i]=e>0?e*e:0,g[i]=e<0?e*e:0}}S(_,0,0,c,u,c,this.f,this.v,this.z),S(g,m,m,s,l,c,this.f,this.v,this.z);for(let v=0;v<h;v++){const e=Math.sqrt(_[v])-Math.sqrt(g[v]);d[v]=Math.round(255-255*(e/this.radius+this.cutoff))}return p}};class C{constructor(){this.specification=t.u.light.position}possiblyEvaluate(e,i){return t.F(e.expression.evaluate(i))}interpolate(e,i,n){return{x:t.G.number(e.x,i.x,n),y:t.G.number(e.y,i.y,n),z:t.G.number(e.z,i.z,n)}}}let k;class I extends t.E{constructor(e){super(),k=k||new t.t({anchor:new t.D(t.u.light.anchor),position:new C,color:new t.D(t.u.light.color),intensity:new t.D(t.u.light.intensity)}),this._transitionable=new t.x(k,void 0),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,i={}){if(!this._validate(t.y,e,i))for(const n in e){const i=e[n];n.endsWith(t.z)?this._transitionable.setTransition(n.slice(0,-t.z.length),i):this._transitionable.setValue(n,i)}}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,i,n){return(!n||!1!==n.validate)&&t.B(this,e.call(t.C,{value:i,style:{glyphs:!0,sprite:!0},styleSpec:t.u}))}}const z=new t.t({"sky-color":new t.D(t.u.sky["sky-color"]),"horizon-color":new t.D(t.u.sky["horizon-color"]),"fog-color":new t.D(t.u.sky["fog-color"]),"fog-ground-blend":new t.D(t.u.sky["fog-ground-blend"]),"horizon-fog-blend":new t.D(t.u.sky["horizon-fog-blend"]),"sky-horizon-blend":new t.D(t.u.sky["sky-horizon-blend"]),"atmosphere-blend":new t.D(t.u.sky["atmosphere-blend"])});class A extends t.E{constructor(e){super(),this._transitionable=new t.x(z,void 0),this.setSky(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new t.H(0))}setSky(e,i={}){if(!this._validate(t.J,e,i)){e||(e={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(const i in e){const n=e[i];i.endsWith(t.z)?this._transitionable.setTransition(i.slice(0,-t.z.length),n):this._transitionable.setValue(i,n)}}}getSky(){return this._transitionable.serialize()}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,i,n={}){return!1!==(null==n?void 0:n.validate)&&t.B(this,e.call(t.C,t.e({value:i,style:{glyphs:!0,sprite:!0},styleSpec:t.u})))}calculateFogBlendOpacity(e){return e<60?0:e<70?(e-60)/10:1}}class L{constructor(e,t){this.width=e,this.height=t,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(e,t){const i=e.join(",")+String(t);return this.dashEntry[i]||(this.dashEntry[i]=this.addDash(e,t)),this.dashEntry[i]}getDashRanges(e,t,i){const n=[];let r=e.length%2==1?-e[e.length-1]*i:0,o=e[0]*i,a=!0;n.push({left:r,right:o,isDash:a,zeroLength:0===e[0]});let s=e[0];for(let l=1;l<e.length;l++){a=!a;const t=e[l];r=s*i,s+=t,o=s*i,n.push({left:r,right:o,isDash:a,zeroLength:0===t})}return n}addRoundDash(e,t,i){const n=t/2;for(let r=-i;r<=i;r++){const t=this.width*(this.nextRow+i+r);let o=0,a=e[o];for(let s=0;s<this.width;s++){s/a.right>1&&(a=e[++o]);const l=Math.abs(s-a.left),c=Math.abs(s-a.right),u=Math.min(l,c);let h;const d=r/i*(n+1);if(a.isDash){const e=n-Math.abs(d);h=Math.sqrt(u*u+e*e)}else h=n-Math.sqrt(u*u+d*d);this.data[t+s]=Math.max(0,Math.min(255,h+128))}}}addRegularDash(e){for(let a=e.length-1;a>=0;--a){const t=e[a],i=e[a+1];t.zeroLength?e.splice(a,1):i&&i.isDash===t.isDash&&(i.left=t.left,e.splice(a,1))}const t=e[0],i=e[e.length-1];t.isDash===i.isDash&&(t.left=i.left-this.width,i.right=t.right+this.width);const n=this.width*this.nextRow;let r=0,o=e[r];for(let a=0;a<this.width;a++){a/o.right>1&&(o=e[++r]);const t=Math.abs(a-o.left),i=Math.abs(a-o.right),s=Math.min(t,i);this.data[n+a]=Math.max(0,Math.min(255,(o.isDash?s:-s)+128))}}addDash(e,i){const n=i?7:0,r=2*n+1;if(this.nextRow+r>this.height)return t.w("LineAtlas out of space"),null;let o=0;for(let t=0;t<e.length;t++)o+=e[t];if(0!==o){const t=this.width/o,r=this.getDashRanges(e,this.width,t);i?this.addRoundDash(r,t,n):this.addRegularDash(r)}const a={y:this.nextRow+n,height:2*n,width:o};return this.nextRow+=r,this.dirty=!0,a}bind(e){const t=e.gl;this.texture?(t.bindTexture(t.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,t.texSubImage2D(t.TEXTURE_2D,0,0,0,this.width,this.height,t.ALPHA,t.UNSIGNED_BYTE,this.data))):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texImage2D(t.TEXTURE_2D,0,t.ALPHA,this.width,this.height,0,t.ALPHA,t.UNSIGNED_BYTE,this.data))}}const D="maplibre_preloaded_worker_pool";class R{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<R.workerCount;)this.workers.push(new Worker(t.c.WORKER_URL));return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],0===this.numActive()&&(this.workers.forEach(e=>{e.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[D]}numActive(){return Object.keys(this.active).length}}const F=Math.floor(s.hardwareConcurrency/2);let B,O;function N(){return B||(B=new R),B}R.workerCount=t.K(globalThis)?Math.max(Math.min(F,3),1):1;class j{constructor(e,i){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=i;const n=this.workerPool.acquire(i);for(let r=0;r<n.length;r++){const e=new t.L(n[r],i);e.name=`Worker ${r}`,this.actors.push(e)}if(!this.actors.length)throw new Error("No actors found")}broadcast(e,t){const i=[];for(const n of this.actors)i.push(n.sendAsync({type:e,data:t}));return Promise.all(i)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(e=!0){this.actors.forEach(e=>{e.remove()}),this.actors=[],e&&this.workerPool.release(this.id)}registerMessageHandler(e,t){for(const i of this.actors)i.registerMessageHandler(e,t)}unregisterMessageHandler(e){for(const t of this.actors)t.unregisterMessageHandler(e)}}function V(){return O||(O=new j(N(),t.M),O.registerMessageHandler("GR",(e,i,n)=>t.m(i,n))),O}function U(e,i){const n=t.N();return t.O(n,n,[1,1,0]),t.Q(n,n,[.5*e.width,.5*e.height,1]),e.calculatePosMatrix?t.S(n,n,e.calculatePosMatrix(i.toUnwrapped())):n}function Z(e,t,i,n,r,o,a){var s;const l=function(e,t,i){if(e)for(const n of e){const e=t[n];if(e&&e.source===i&&"fill-extrusion"===e.type)return!0}else for(const n in t){const e=t[n];if(e.source===i&&"fill-extrusion"===e.type)return!0}return!1}(null!==(s=null==r?void 0:r.layers)&&void 0!==s?s:null,t,e.id),c=o.maxPitchScaleFactor(),u=e.tilesIn(n,c,l);u.sort(G);const h=[];for(const d of u)h.push({wrappedTileID:d.tileID.wrapped().key,queryResults:d.tile.queryRenderedFeatures(t,i,e.getState(),d.queryGeometry,d.cameraQueryGeometry,d.scale,r,o,c,U(o,d.tileID),a?(e,t)=>a(d.tileID,e,t):void 0)});return function(e,t){for(const i in e)for(const n of e[i])q(n,t);return e}(function(e){const t={},i={};for(const n of e){const e=n.queryResults,r=n.wrappedTileID,o=i[r]=i[r]||{};for(const i in e){const n=e[i],r=o[i]=o[i]||{},a=t[i]=t[i]||[];for(const e of n)r[e.featureIndex]||(r[e.featureIndex]=!0,a.push(e))}}return t}(h),e)}function G(e,t){const i=e.tileID,n=t.tileID;return i.overscaledZ-n.overscaledZ||i.canonical.y-n.canonical.y||i.wrap-n.wrap||i.canonical.x-n.canonical.x}function q(e,t){const i=e.feature,n=t.getFeatureState(i.layer["source-layer"],i.id);i.source=i.layer.source,i.layer["source-layer"]&&(i.sourceLayer=i.layer["source-layer"]),i.state=n}function $(e,i,n){return t._(this,void 0,void 0,function*(){let r=e;if(e.url?r=(yield t.j(i.transformRequest(e.url,"Source"),n)).data:yield s.frameAsync(n),!r)return null;const o=t.U(t.e(r,e),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in r&&r.vector_layers&&(o.vectorLayerIds=r.vector_layers.map(e=>e.id)),o})}class W{constructor(e,t){e&&(t?this.setSouthWest(e).setNorthEast(t):Array.isArray(e)&&(4===e.length?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1])))}setNorthEast(e){return this._ne=e instanceof t.V?new t.V(e.lng,e.lat):t.V.convert(e),this}setSouthWest(e){return this._sw=e instanceof t.V?new t.V(e.lng,e.lat):t.V.convert(e),this}extend(e){const i=this._sw,n=this._ne;let r,o;if(e instanceof t.V)r=e,o=e;else{if(!(e instanceof W))return Array.isArray(e)?4===e.length||e.every(Array.isArray)?this.extend(W.convert(e)):this.extend(t.V.convert(e)):e&&("lng"in e||"lon"in e)&&"lat"in e?this.extend(t.V.convert(e)):this;if(r=e._sw,o=e._ne,!r||!o)return this}return i||n?(i.lng=Math.min(r.lng,i.lng),i.lat=Math.min(r.lat,i.lat),n.lng=Math.max(o.lng,n.lng),n.lat=Math.max(o.lat,n.lat)):(this._sw=new t.V(r.lng,r.lat),this._ne=new t.V(o.lng,o.lat)),this}getCenter(){return new t.V((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 t.V(this.getWest(),this.getNorth())}getSouthEast(){return new t.V(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){const{lng:i,lat:n}=t.V.convert(e);let r=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(r=this._sw.lng>=i&&i>=this._ne.lng),this._sw.lat<=n&&n<=this._ne.lat&&r}intersects(e){if(!((e=W.convert(e)).getNorth()>=this.getSouth()&&e.getSouth()<=this.getNorth()))return!1;const i=Math.abs(this.getEast()-this.getWest()),n=Math.abs(e.getEast()-e.getWest());if(i>=360||n>=360)return!0;const r=t.W(this.getWest(),-180,180),o=t.W(this.getEast(),-180,180),a=t.W(e.getWest(),-180,180),s=t.W(e.getEast(),-180,180),l=r>=o,c=a>=s;return!(!l||!c)||(l?s>=r||a<=o:c?o>=a||r<=s:a<=o&&s>=r)}static convert(e){return e instanceof W?e:e?new W(e):e}static fromLngLat(e,i=0){const n=360*i/40075017,r=n/Math.cos(Math.PI/180*e.lat);return new W(new t.V(e.lng-r,e.lat-n),new t.V(e.lng+r,e.lat+n))}adjustAntiMeridian(){const e=new t.V(this._sw.lng,this._sw.lat),i=new t.V(this._ne.lng,this._ne.lat);return new W(e,e.lng>i.lng?new t.V(i.lng+360,i.lat):i)}}class H{constructor(e,t,i){this.bounds=W.convert(this.validateBounds(e)),this.minzoom=t||0,this.maxzoom=i||24}validateBounds(e){return Array.isArray(e)&&4===e.length?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}contains(e){const i=Math.pow(2,e.z),n=Math.floor(t.Y(this.bounds.getWest())*i),r=Math.floor(t.X(this.bounds.getNorth())*i),o=Math.ceil(t.Y(this.bounds.getEast())*i),a=Math.ceil(t.X(this.bounds.getSouth())*i);return e.x>=n&&e.x<o&&e.y>=r&&e.y<a}}class X extends t.E{constructor(e,i,n,r){if(super(),this.id=e,this.dispatcher=n,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,t.e(this,t.U(i,["url","scheme","tileSize","promoteId","encoding"])),this._options=t.e({type:"vector"},i),this._collectResourceTiming=i.collectResourceTiming,512!==this.tileSize)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(r)}load(){return t._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new t.l("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const e=yield $(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.tileManagers[this.id].clearTiles(),e&&(t.e(this,e),e.bounds&&(this.tileBounds=new H(e.bounds,this.minzoom,this.maxzoom)),this.fire(new t.l("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new t.l("data",{dataType:"source",sourceDataType:"content"})))}catch(de){this._tileJSONRequest=null,this._loaded=!0,t.Z(de)||this.fire(new t.k(de))}})}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}setSourceProperty(e){this._tileJSONRequest&&this._tileJSONRequest.abort(),e(),this.load()}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return t.e({},this._options)}loadTile(e){return t._(this,void 0,void 0,function*(){const t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),i={request:this.map._requestManager.transformRequest(t,"Tile"),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity,encoding:this.encoding,overzoomParameters:this._getOverzoomParameters(e)};i.request.collectResourceTiming=this._collectResourceTiming;let n="RT";if(e.actor&&"expired"!==e.state){if("loading"===e.state)return new Promise((t,i)=>{e.reloadPromise={resolve:t,reject:i}})}else e.actor=this.dispatcher.getActor(),n="LT";e.abortController=new AbortController;try{const t=yield e.actor.sendAsync({type:n,data:i},e.abortController);if(delete e.abortController,e.aborted)return;this._afterTileLoadWorkerResponse(e,t)}catch(r){if(delete e.abortController,e.aborted)return;if(r&&404!==r.status)throw r;this._afterTileLoadWorkerResponse(e,null)}})}_getOverzoomParameters(e){if(e.tileID.canonical.z<=this.maxzoom)return;if(void 0===this.map._zoomLevelsToOverscale)return;const t=e.tileID.scaledTo(this.maxzoom).canonical,i=t.url(this.tiles,this.map.getPixelRatio(),this.scheme);return{maxZoomTileID:t,overzoomRequest:this.map._requestManager.transformRequest(i,"Tile")}}_afterTileLoadWorkerResponse(e,t){if(t&&t.resourceTiming&&(e.resourceTiming=t.resourceTiming),t&&this.map._refreshExpiredTiles&&e.setExpiryData(t),e.loadVectorData(t,this.map.painter),e.reloadPromise){const t=e.reloadPromise;e.reloadPromise=null,this.loadTile(e).then(t.resolve).catch(t.reject)}}abortTile(e){return t._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.actor&&(yield e.actor.sendAsync({type:"AT",data:{uid:e.uid,type:this.type,source:this.id}}))})}unloadTile(e){return t._(this,void 0,void 0,function*(){e.unloadVectorData(),e.actor&&(yield e.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class Y extends t.E{constructor(e,i,n,r){super(),this.id=e,this.dispatcher=n,this.setEventedParent(r),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=t.e({type:"raster"},i),t.e(this,t.U(i,["url","scheme","tileSize"]))}load(){return t._(this,arguments,void 0,function*(e=!1){this._loaded=!1,this.fire(new t.l("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const i=yield $(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,i&&(t.e(this,i),i.bounds&&(this.tileBounds=new H(i.bounds,this.minzoom,this.maxzoom)),this.fire(new t.l("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new t.l("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:e})))}catch(i){this._tileJSONRequest=null,this._loaded=!0,t.Z(i)||this.fire(new t.k(i))}})}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(e){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),e(),this.load(!0)}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}serialize(){return t.e({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(e){return t._(this,void 0,void 0,function*(){const i=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.abortController=new AbortController;try{const n=yield _.getImage(this.map._requestManager.transformRequest(i,"Tile"),e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(n&&n.data){this.map._refreshExpiredTiles&&(n.cacheControl||n.expires)&&e.setExpiryData({cacheControl:n.cacheControl,expires:n.expires});const i=this.map.painter.context,r=i.gl,o=n.data;e.texture=this.map.painter.getTileTexture(o.width),e.texture?e.texture.update(o,{useMipmap:!0}):(e.texture=new t.T(i,o,r.RGBA,{useMipmap:!0}),e.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE,r.LINEAR_MIPMAP_NEAREST)),e.state="loaded"}}catch(n){if(delete e.abortController,e.aborted)e.state="unloaded";else if(n)throw e.state="errored",n}})}abortTile(e){return t._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController)})}unloadTile(e){return t._(this,void 0,void 0,function*(){e.texture&&this.map.painter.saveTileTexture(e.texture)})}hasTransition(){return!1}}class K extends Y{constructor(e,i,n,r){super(e,i,n,r),this.type="raster-dem",this.maxzoom=22,this._options=t.e({type:"raster-dem"},i),this.encoding=i.encoding||"mapbox",this.redFactor=i.redFactor,this.greenFactor=i.greenFactor,this.blueFactor=i.blueFactor,this.baseShift=i.baseShift}loadTile(e){return t._(this,void 0,void 0,function*(){const i=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),n=this.map._requestManager.transformRequest(i,"Tile");e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.abortController=new AbortController;try{const i=yield _.getImage(n,e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(i&&i.data){const n=i.data;this.map._refreshExpiredTiles&&(i.cacheControl||i.expires)&&e.setExpiryData({cacheControl:i.cacheControl,expires:i.expires});const r=t.b(n)&&t.$()?n:yield this.readImageNow(n),o={type:this.type,uid:e.uid,source:this.id,rawImageData:r,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!e.actor||"expired"===e.state){e.actor=this.dispatcher.getActor();const t=yield e.actor.sendAsync({type:"LDT",data:o});e.dem=t,e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state="loaded"}}}catch(r){if(delete e.abortController,e.aborted)e.state="unloaded";else if(r)throw e.state="errored",r}})}readImageNow(e){return t._(this,void 0,void 0,function*(){if("undefined"!=typeof VideoFrame&&t.a0()){const n=e.width+2,r=e.height+2;try{return new t.R({width:n,height:r},yield t.a1(e,-1,-1,n,r))}catch(i){}}return s.getImageData(e,1)})}_getNeighboringTiles(e){const i=e.canonical,n=Math.pow(2,i.z),r=(i.x-1+n)%n,o=0===i.x?e.wrap-1:e.wrap,a=(i.x+1+n)%n,s=i.x+1===n?e.wrap+1:e.wrap,l={};return l[new t.a2(e.overscaledZ,o,i.z,r,i.y).key]={backfilled:!1},l[new t.a2(e.overscaledZ,s,i.z,a,i.y).key]={backfilled:!1},i.y>0&&(l[new t.a2(e.overscaledZ,o,i.z,r,i.y-1).key]={backfilled:!1},l[new t.a2(e.overscaledZ,e.wrap,i.z,i.x,i.y-1).key]={backfilled:!1},l[new t.a2(e.overscaledZ,s,i.z,a,i.y-1).key]={backfilled:!1}),i.y+1<n&&(l[new t.a2(e.overscaledZ,o,i.z,r,i.y+1).key]={backfilled:!1},l[new t.a2(e.overscaledZ,e.wrap,i.z,i.x,i.y+1).key]={backfilled:!1},l[new t.a2(e.overscaledZ,s,i.z,a,i.y+1).key]={backfilled:!1}),l}unloadTile(e){return t._(this,void 0,void 0,function*(){e.demTexture&&this.map.painter.saveTileTexture(e.demTexture),e.fbo&&(e.fbo.destroy(),delete e.fbo),e.dem&&delete e.dem,delete e.neighboringTiles,e.state="unloaded",e.actor&&(yield e.actor.sendAsync({type:"RDT",data:{type:this.type,uid:e.uid,source:this.id}}))})}}function Q(e){return"GeometryCollection"===e.type?e.geometries.map(e=>e.coordinates).flat(1/0):e.coordinates.flat(1/0)}function J(e){const t=new W;let i;switch(e.type){case"FeatureCollection":i=e.features.map(e=>Q(e.geometry)).flat(1/0);break;case"Feature":i=Q(e.geometry);break;default:i=Q(e)}if(0==i.length)return t;for(let n=0;n<i.length-1;n+=2)t.extend([i[n],i[n+1]]);return t}class ee extends t.E{constructor(e,i,n,r){super(),this.id=e,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._isUpdatingWorker=!1,this._pendingWorkerUpdate={data:i.data},this.actor=n.getActor(),this.setEventedParent(r),this._data="string"==typeof i.data?{url:i.data}:{geojson:i.data},this._options=t.e({},i),this._collectResourceTiming=i.collectResourceTiming,void 0!==i.maxzoom&&(this.maxzoom=i.maxzoom),i.type&&(this.type=i.type),i.attribution&&(this.attribution=i.attribution),this.promoteId=i.promoteId,void 0!==i.clusterMaxZoom&&this.maxzoom<=i.clusterMaxZoom&&t.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${i.clusterMaxZoom}".`),this.workerOptions=t.e({source:this.id,cluster:i.cluster||!1,geojsonVtOptions:{buffer:this._pixelsToTileUnits(void 0!==i.buffer?i.buffer:128),tolerance:this._pixelsToTileUnits(void 0!==i.tolerance?i.tolerance:.375),extent:t.a5,maxZoom:this.maxzoom,lineMetrics:i.lineMetrics||!1,generateId:i.generateId||!1},superclusterOptions:{maxZoom:this._getClusterMaxZoom(i.clusterMaxZoom),minPoints:Math.max(2,i.clusterMinPoints||2),extent:t.a5,radius:this._pixelsToTileUnits(i.clusterRadius||50),log:!1,generateId:i.generateId||!1},clusterProperties:i.clusterProperties,filter:i.filter},i.workerOptions),"string"==typeof this.promoteId&&(this.workerOptions.promoteId=this.promoteId)}_hasPendingWorkerUpdate(){return void 0!==this._pendingWorkerUpdate.data||void 0!==this._pendingWorkerUpdate.diff||this._pendingWorkerUpdate.optionsChanged}_pixelsToTileUnits(e){return e*(t.a5/this.tileSize)}_getClusterMaxZoom(e){const i=e?Math.round(e):this.maxzoom-1;return Number.isInteger(e)||void 0===e||t.w(`Integer expected for option 'clusterMaxZoom': provided value "${e}" rounded to "${i}"`),i}load(){return t._(this,void 0,void 0,function*(){yield this._updateWorkerData()})}onAdd(e){this.map=e,this.load()}setData(e,t){this._data="string"==typeof e?{url:e}:{geojson:e},this._pendingWorkerUpdate={data:e};const i=this._updateWorkerData();return t?i:this}updateData(e,i){this._pendingWorkerUpdate.diff=t.a6(this._pendingWorkerUpdate.diff,e);const n=this._updateWorkerData();return i?n:this}getData(){return t._(this,void 0,void 0,function*(){const e=t.e({type:this.type},this.workerOptions);return this.actor.sendAsync({type:"GD",data:e})})}getBounds(){return t._(this,void 0,void 0,function*(){return J(yield this.getData())})}setClusterOptions(e){return this.workerOptions.cluster=e.cluster,void 0!==e.clusterRadius&&(this.workerOptions.superclusterOptions.radius=this._pixelsToTileUnits(e.clusterRadius)),void 0!==e.clusterMaxZoom&&(this.workerOptions.superclusterOptions.maxZoom=this._getClusterMaxZoom(e.clusterMaxZoom)),this._pendingWorkerUpdate.optionsChanged=!0,this._updateWorkerData(),this}getClusterExpansionZoom(e){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:e,source:this.id}})}getClusterChildren(e){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:e,source:this.id}})}getClusterLeaves(e,t,i){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:e,limit:t,offset:i}})}_updateWorkerData(){return t._(this,void 0,void 0,function*(){if(this._isUpdatingWorker)return;if(!this._hasPendingWorkerUpdate())return void t.w(`No pending worker updates for GeoJSONSource ${this.id}.`);const{data:e,diff:i}=this._pendingWorkerUpdate,n=t.e({type:this.type},this.workerOptions);void 0!==e?("string"==typeof e?(n.request=this.map._requestManager.transformRequest(s.resolveURL(e),"Source"),n.request.collectResourceTiming=this._collectResourceTiming):n.data=e,this._pendingWorkerUpdate.data=void 0):i&&(n.dataDiff=i,this._pendingWorkerUpdate.diff=void 0),this._pendingWorkerUpdate.optionsChanged=void 0,this._isUpdatingWorker=!0,this.fire(new t.l("dataloading",{dataType:"source"}));try{const e=yield this.actor.sendAsync({type:"LD",data:n});if(this._isUpdatingWorker=!1,this._removed||e.abandoned)return void this.fire(new t.l("dataabort",{dataType:"source"}));e.data&&(this._data={geojson:e.data});const r=this._applyDiffToSource(i),o=this._getShouldReloadTileOptions(r);let a=null;e.resourceTiming&&e.resourceTiming[this.id]&&(a=e.resourceTiming[this.id].slice(0));const s={dataType:"source"};this._collectResourceTiming&&a&&a.length>0&&t.e(s,{resourceTiming:a}),this.fire(new t.l("data",Object.assign(Object.assign({},s),{sourceDataType:"metadata"}))),this.fire(new t.l("data",Object.assign(Object.assign({},s),{sourceDataType:"content",shouldReloadTileOptions:o})))}catch(r){if(this._isUpdatingWorker=!1,this._removed)return void this.fire(new t.l("dataabort",{dataType:"source"}));this.fire(new t.k(r))}finally{this._hasPendingWorkerUpdate()&&this._updateWorkerData()}})}_applyDiffToSource(e){if(!e)return;const i="string"==typeof this.promoteId?this.promoteId:void 0;if(!this._data.url&&!this._data.updateable){const e=t.a7(this._data.geojson,i);if(!e)throw new Error(`GeoJSONSource "${this.id}": GeoJSON data is not compatible with updateData`);this._data={updateable:e}}if(!this._data.updateable)return;const n=t.a8(this._data.updateable,e,i);return e.removeAll||this._options.cluster?void 0:n}_getShouldReloadTileOptions(e){if(e)return{affectedBounds:e.filter(Boolean).map(e=>J(e))}}shouldReloadTile(e,{affectedBounds:i}){if("loading"===e.state)return!0;if("unloaded"===e.state)return!1;const{buffer:n,extent:r}=this.workerOptions.geojsonVtOptions,o=function({x:e,y:i,z:n},r=0){const o=t.a3((e-r)/Math.pow(2,n)),a=t.a4((i+1+r)/Math.pow(2,n)),s=t.a3((e+1+r)/Math.pow(2,n)),l=t.a4((i-r)/Math.pow(2,n));return new W([o,a],[s,l])}(e.tileID.canonical,n/r);for(const t of i)if(o.intersects(t))return!0;return!1}loaded(){return!this._isUpdatingWorker&&!this._hasPendingWorkerUpdate()}loadTile(e){return t._(this,void 0,void 0,function*(){const t=e.actor?"RT":"LT";e.actor=this.actor;const i={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity};e.abortController=new AbortController;const n=yield this.actor.sendAsync({type:t,data:i},e.abortController);delete e.abortController,e.unloadVectorData(),e.aborted||e.loadVectorData(n,this.map.painter,"RT"===t)})}abortTile(e){return t._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.aborted=!0})}unloadTile(e){return t._(this,void 0,void 0,function*(){e.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}})})}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return t.e({},this._options,{type:this.type,data:this._data.updateable?{type:"FeatureCollection",features:Array.from(this._data.updateable.values())}:this._data.url||this._data.geojson})}hasTransition(){return!1}}class te extends t.E{constructor(e,t,i,n){super(),this.flippedWindingOrder=!1,this.id=e,this.dispatcher=i,this.coordinates=t.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(n),this.options=t}load(e){return t._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new t.l("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const t=yield _.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,t&&t.data&&(this.image=t.data,e&&(this.coordinates=e),this._finishLoading())}catch(i){this._request=null,this._loaded=!0,t.Z(i)||this.fire(new t.k(i))}})}loaded(){return this._loaded}updateImage(e){return e.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=e.url,this.load(e.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new t.l("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(e){this.coordinates=e;const i=e.map(t.a9.fromLngLat);var n;return this.tileID=function(e){const i=t.aa.fromPoints(e),n=i.width(),r=i.height(),o=Math.max(n,r),a=Math.max(0,Math.floor(-Math.log(o)/Math.LN2)),s=Math.pow(2,a);return new t.ac(a,Math.floor((i.minX+i.maxX)/2*s),Math.floor((i.minY+i.maxY)/2*s))}(i),this.terrainTileRanges=this._getOverlappingTileRanges(i),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=i.map(e=>this.tileID.getTilePoint(e)._round()),this.flippedWindingOrder=((n=this.tileCoords)[1].x-n[0].x)*(n[2].y-n[0].y)-(n[1].y-n[0].y)*(n[2].x-n[0].x)<0,this.fire(new t.l("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(0===Object.keys(this.tiles).length||!this.image)return;const e=this.map.painter.context,i=e.gl;this.texture||(this.texture=new t.T(e,this.image,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let n=!1;for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture,n=!0)}n&&this.fire(new t.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(e){return t._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={}):e.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}_getOverlappingTileRanges(e){const{minX:i,minY:n,maxX:r,maxY:o}=t.aa.fromPoints(e),a={};for(let s=0;s<=t.ab;s++){const e=Math.pow(2,s),t=Math.floor(i*e),l=Math.floor(n*e),c=Math.floor(r*e),u=Math.floor(o*e),h=(t%e+e)%e,d=c%e,p=Math.floor(t/e),f=Math.floor(c/e);a[s]={minWrap:p,maxWrap:f,minTileXWrapped:h,maxTileXWrapped:d,minTileY:l,maxTileY:u}}return a}}class ie extends te{constructor(e,t,i,n){super(e,t,i,n),this.roundZoom=!0,this.type="video",this.options=t}load(){return t._(this,void 0,void 0,function*(){this._loaded=!1;const e=this.options;this.urls=[];for(const t of e.urls)this.urls.push(this.map._requestManager.transformRequest(t,"Source").url);try{const e=yield t.ad(this.urls);if(this._loaded=!0,!e)return;this.video=e,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(i){this.fire(new t.k(i))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){const i=this.video.seekable;e<i.start(0)||e>i.end(0)?this.fire(new t.k(new t.ae(`sources.${this.id}`,null,`Playback for this video can be set only between the ${i.start(0)} and ${i.end(0)}-second mark.`))):this.video.currentTime=e}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;const e=this.map.painter.context,i=e.gl;this.texture?this.video.paused||(this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE),i.texSubImage2D(i.TEXTURE_2D,0,0,0,i.RGBA,i.UNSIGNED_BYTE,this.video)):(this.texture=new t.T(e,this.video,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let n=!1;for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture,n=!0)}n&&this.fire(new t.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class ne extends te{constructor(e,i,n,r){super(e,i,n,r),i.coordinates?Array.isArray(i.coordinates)&&4===i.coordinates.length&&!i.coordinates.some(e=>!Array.isArray(e)||2!==e.length||e.some(e=>"number"!=typeof e))||this.fire(new t.k(new t.ae(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new t.k(new t.ae(`sources.${e}`,null,'missing required property "coordinates"'))),i.animate&&"boolean"!=typeof i.animate&&this.fire(new t.k(new t.ae(`sources.${e}`,null,'optional "animate" property must be a boolean value'))),i.canvas?"string"==typeof i.canvas||i.canvas instanceof HTMLCanvasElement||this.fire(new t.k(new t.ae(`sources.${e}`,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 t.k(new t.ae(`sources.${e}`,null,'missing required property "canvas"'))),this.options=i,this.animate=void 0===i.animate||i.animate}load(){return t._(this,void 0,void 0,function*(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new t.k(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(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions())return;if(0===Object.keys(this.tiles).length)return;const i=this.map.painter.context,n=i.gl;this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):(this.texture=new t.T(i,this.canvas,n.RGBA,{premultiply:!0}),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let r=!1;for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture,r=!0)}r&&this.fire(new t.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",animate:this.animate,canvas:this.options.canvas,coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}}const re={},oe=e=>{switch(e){case"geojson":return ee;case"image":return te;case"raster":return Y;case"raster-dem":return K;case"vector":return X;case"video":return ie;case"canvas":return ne}return re[e]},ae="RTLPluginLoaded";class se extends t.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=V()}_syncState(e){return this.status=e,this.dispatcher.broadcast("SRPS",{pluginStatus:e,pluginURL:this.url}).catch(e=>{throw this.status="error",e})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(e){return t._(this,arguments,void 0,function*(e,t=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=s.resolveURL(e),!this.url)throw new Error(`requested url ${e} is invalid`);if("unavailable"===this.status){if(!t)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if("requested"===this.status)return this._requestImport()})}_requestImport(){return t._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new t.l(ae))})}lazyLoad(){"unavailable"===this.status?this.status="requested":"deferred"===this.status&&this._requestImport()}}let le=null;function ce(){return le||(le=new se),le}var ue,he,de;(de=ue||(ue={}))[de.Base=0]="Base",de[de.Parent=1]="Parent",function(e){e[e.Departing=0]="Departing",e[e.Incoming=1]="Incoming"}(he||(he={}));class pe{constructor(e,i){this.timeAdded=0,this.fadeEndTime=0,this.fadeOpacity=1,this.tileID=e,this.uid=t.af(),this.uses=0,this.tileSize=i,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}isRenderable(e){return this.hasData()&&(!this.fadeEndTime||this.fadeOpacity>0)&&(e||!this.holdingForSymbolFade())}setCrossFadeLogic({fadingRole:e,fadingDirection:t,fadingParentID:i,fadeEndTime:n}){this.resetFadeLogic(),this.fadingRole=e,this.fadingDirection=t,this.fadingParentID=i,this.fadeEndTime=n}setSelfFadeLogic(e){this.resetFadeLogic(),this.selfFading=!0,this.fadeEndTime=e}resetFadeLogic(){this.fadingRole=null,this.fadingDirection=null,this.fadingParentID=null,this.selfFading=!1,this.timeAdded=c(),this.fadeEndTime=0,this.fadeOpacity=1}wasRequested(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state}clearTextures(e){this.demTexture&&e.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(e,i,n){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",e){e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestFeatureIndex.rawTileData=e.rawTileData,this.latestFeatureIndex.encoding=e.encoding):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData,this.latestFeatureIndex.encoding=this.latestEncoding)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=function(e,t){const i={};if(!t)return i;for(const n of e){const e=n.layerIds.map(e=>t.getLayer(e)).filter(Boolean);if(0!==e.length){n.layers=e,n.stateDependentLayerIds&&(n.stateDependentLayers=n.stateDependentLayerIds.map(t=>e.filter(e=>e.id===t)[0]));for(const t of e)i[t.id]=n}}return i}(e.buckets,null==i?void 0:i.style),this.hasSymbolBuckets=!1;for(const e in this.buckets){const i=this.buckets[e];if(i instanceof t.ah){if(this.hasSymbolBuckets=!0,!n)break;i.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const e in this.buckets){const i=this.buckets[e];if(i instanceof t.ah&&i.hasRTLText){this.hasRTLText=!0,ce().lazyLoad();break}}this.queryPadding=0;for(const e in this.buckets){const t=this.buckets[e];this.queryPadding=Math.max(this.queryPadding,i.style.getLayer(e).queryRadius(t))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage),this.dashPositions=e.dashPositions}else this.collisionBoxArray=new t.ag}unloadVectorData(){for(const e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.dashPositions&&(this.dashPositions=null),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(e){return this.buckets[e.id]}upload(e){for(const t in this.buckets){const i=this.buckets[t];i.uploadPending()&&i.upload(e)}const i=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new t.T(e,this.imageAtlas.image,i.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new t.T(e,this.glyphAtlasImage,i.ALPHA),this.glyphAtlasImage=null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,t,i,n,r,o,a,s,l,c,u){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:n,cameraQueryGeometry:r,scale:o,tileSize:this.tileSize,pixelPosMatrix:c,transform:s,params:a,queryPadding:this.queryPadding*l,getElevation:u},e,t,i):{}}querySourceFeatures(e,i){const n=this.latestFeatureIndex;if(!n||!n.rawTileData)return;const r=n.loadVTLayers(),o=i&&i.sourceLayer?i.sourceLayer:"",a=r[t.ai]||r[o];if(!a)return;const s=t.aj(null==i?void 0:i.filter,null==i?void 0:i.globalState),{z:l,x:c,y:u}=this.tileID.canonical,h={z:l,x:c,y:u};for(let d=0;d<a.length;d++){const i=a.feature(d);if(s.needGeometry){const e=t.ak(i,!0);if(!s.filter(new t.H(this.tileID.overscaledZ),e,this.tileID.canonical))continue}else if(!s.filter(new t.H(this.tileID.overscaledZ),i))continue;const r=n.getId(i,o),p=new t.al(i,l,c,u,r);p.tile=h,e.push(p)}}hasData(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){const i=this.expirationTime;if(e.cacheControl){const i=t.am(e.cacheControl);i["max-age"]&&(this.expirationTime=Date.now()+1e3*i["max-age"])}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){const e=Date.now();let t=!1;if(this.expirationTime>e)t=!1;else if(i)if(this.expirationTime<i)t=!0;else{const n=this.expirationTime-i;n?this.expirationTime=e+Math.max(n,3e4):t=!0}else t=!0;t?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-(new Date).getTime(),Math.pow(2,31)-1)}setFeatureState(e,i){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||0===Object.keys(e).length)return;const n=this.latestFeatureIndex.loadVTLayers();for(const r in this.buckets){if(!i.style.hasLayer(r))continue;const o=this.buckets[r],a=o.layers[0].sourceLayer||t.ai,s=n[a],l=e[a];if(!s||!l||0===Object.keys(l).length)continue;o.update(l,s,this.imageAtlas&&this.imageAtlas.patternPositions||{},this.dashPositions||{});const c=i&&i.style&&i.style.getLayer(r);c&&(this.queryPadding=Math.max(this.queryPadding,c.queryRadius(o)))}}holdingForSymbolFade(){return void 0!==this.symbolFadeHoldUntil}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<c()}clearSymbolFadeHold(){this.symbolFadeHoldUntil=void 0}setSymbolHoldDuration(e){this.symbolFadeHoldUntil=c()+e}setDependencies(e,t){const i={};for(const n of t)i[n]=!0;this.dependencies[e]=i}hasDependency(e,t){for(const i of e){const e=this.dependencies[i];if(e)for(const i of t)if(e[i])return!0}return!1}}class fe{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,i,n){const r=String(i);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][r]=this.stateChanges[e][r]||{},t.e(this.stateChanges[e][r],n),null===this.deletedStates[e]){this.deletedStates[e]={};for(const t in this.state[e])t!==r&&(this.deletedStates[e][t]=null)}else if(this.deletedStates[e]&&null===this.deletedStates[e][r]){this.deletedStates[e][r]={};for(const t in this.state[e][r])n[t]||(this.deletedStates[e][r][t]=null)}else for(const t in n)this.deletedStates[e]&&this.deletedStates[e][r]&&null===this.deletedStates[e][r][t]&&delete this.deletedStates[e][r][t]}removeFeatureState(e,t,i){if(null===this.deletedStates[e])return;const n=String(t);if(this.deletedStates[e]=this.deletedStates[e]||{},i&&void 0!==t)null!==this.deletedStates[e][n]&&(this.deletedStates[e][n]=this.deletedStates[e][n]||{},this.deletedStates[e][n][i]=null);else if(void 0!==t)if(this.stateChanges[e]&&this.stateChanges[e][n])for(i in this.deletedStates[e][n]={},this.stateChanges[e][n])this.deletedStates[e][n][i]=null;else this.deletedStates[e][n]=null;else this.deletedStates[e]=null}getState(e,i){const n=String(i),r=t.e({},(this.state[e]||{})[n],(this.stateChanges[e]||{})[n]);if(null===this.deletedStates[e])return{};if(this.deletedStates[e]){const t=this.deletedStates[e][i];if(null===t)return{};for(const e in t)delete r[e]}return r}initializeTileState(e,t){e.setFeatureState(this.state,t)}coalesceChanges(e,i){const n={};for(const r in this.stateChanges){this.state[r]=this.state[r]||{};const e={};for(const i in this.stateChanges[r])this.state[r][i]||(this.state[r][i]={}),t.e(this.state[r][i],this.stateChanges[r][i]),e[i]=this.state[r][i];n[r]=e}for(const r in this.deletedStates){this.state[r]=this.state[r]||{};const e={};if(null===this.deletedStates[r])for(const t in this.state[r])e[t]={},this.state[r][t]={};else for(const t in this.deletedStates[r]){if(null===this.deletedStates[r][t])this.state[r][t]={};else for(const e of Object.keys(this.deletedStates[r][t]))delete this.state[r][t][e];e[t]=this.state[r][t]}n[r]=n[r]||{},t.e(n[r],e)}this.stateChanges={},this.deletedStates={},0!==Object.keys(n).length&&e.setFeatureState(n,i)}}const me=89.25;function ge(e,i){const n=t.an(i.lat,-t.ao,t.ao);return new t.P(t.Y(i.lng)*e,t.X(n)*e)}function _e(e,i){return new t.a9(i.x/e,i.y/e).toLngLat()}function ye(e){return e.cameraToCenterDistance*Math.min(.85*Math.tan(t.ap(90-e.pitch)),Math.tan(t.ap(me-e.pitch)))}function ve(e,i){const n=e.canonical,r=i/t.aq(n.z),o=n.x+Math.pow(2,n.z)*e.wrap,a=t.ar(new Float64Array(16));return t.O(a,a,[o*r,n.y*r,0]),t.Q(a,a,[r/t.a5,r/t.a5,1]),a}function xe(e,i,n,r,o){const a=t.a9.fromLngLat(e,i),s=o*t.as(1,e.lat),{x:l,y:c,z:u}=be(n,r);return new t.a9(a.x+s*-l,a.y+s*-c,a.z+s*-u)}function be(e,i){const n=t.ap(e),r=t.ap(i),o=Math.cos(-n),a=Math.sin(n);return{x:a*Math.sin(r),y:-a*Math.cos(r),z:o}}function we(e,t,i){const n=t.intersectsFrustum(e);if(!i||0===n)return n;const r=t.intersectsPlane(i);return 0===r?0:2===n&&2===r?2:1}function Te(e,t,i){let n=0;const r=(i-t)/10;for(let o=0;o<10;o++)n+=r*Math.pow(Math.cos(t+(o+.5)/10*(i-t)),e);return n}function Se(e,i){return function(n,r,o,a,s){const l=2*((e-1)/t.at(Math.cos(t.ap(me-s))/Math.cos(t.ap(me)))-1),c=Math.acos(o/a),u=2*Te(l-1,0,t.ap(s/2)),h=Math.min(t.ap(me),c+t.ap(s/2)),d=Te(l-1,Math.min(h,c-t.ap(s/2)),h),p=Math.atan(r/o),f=Math.hypot(r,o);let m=n;return m+=t.at(a/f/Math.max(.5,Math.cos(t.ap(s/2)))),m+=l*t.at(Math.cos(p))/2,m-=t.at(Math.max(1,d/u/i))/2,m}}const Pe=Se(9.314,3);function Me(e,i){const n=(i.roundZoom?Math.round:Math.floor)(e.zoom+t.at(e.tileSize/i.tileSize));return Math.max(0,n)}function Ee(e,i){const n=e.getCameraFrustum(),r=e.getClippingPlane(),o=e.screenPointToMercatorCoordinate(e.getCameraPoint()),a=t.a9.fromLngLat(e.center,e.elevation);o.z=a.z+Math.cos(e.pitchInRadians)*e.cameraToCenterDistance/e.worldSize;const s=e.getCoveringTilesDetailsProvider(),l=s.allowVariableZoom(e,i),c=Me(e,i),u=i.minzoom||0,h=void 0!==i.maxzoom?i.maxzoom:e.maxZoom,d=Math.min(Math.max(0,c),h),p=Math.pow(2,d),f=[p*o.x,p*o.y,0],m=[p*a.x,p*a.y,0],g=Math.hypot(a.x-o.x,a.y-o.y),_=Math.abs(a.z-o.z),y=Math.hypot(g,_),v=e=>({zoom:0,x:0,y:0,wrap:e,fullyVisible:!1}),x=[],b=[];if(e.renderWorldCopies&&s.allowWorldCopies())for(let t=1;t<=3;t++)x.push(v(-t)),x.push(v(t));for(x.push(v(0));x.length>0;){const p=x.pop(),g=p.x,v=p.y;let w=p.fullyVisible;const T={x:g,y:v,z:p.zoom},S=s.getTileBoundingVolume(T,p.wrap,e.elevation,i);if(!w){const e=we(n,S,r);if(0===e)continue;w=2===e}const P=s.distanceToTile2d(o.x,o.y,T,S);let M=c;l&&(M=(i.calculateTileZoom||Pe)(e.zoom+t.at(e.tileSize/i.tileSize),P,_,y,e.fov)),M=(i.roundZoom?Math.round:Math.floor)(M),M=Math.max(0,M);const E=Math.min(M,h);if(p.wrap=s.getWrap(a,T,p.wrap),p.zoom>=E){if(p.zoom<u)continue;const e=d-p.zoom,n=f[0]-.5-(g<<e),r=f[1]-.5-(v<<e),o=i.reparseOverscaled?Math.max(p.zoom,M):p.zoom;b.push({tileID:new t.a2(p.zoom===h?o:p.zoom,p.wrap,p.zoom,g,v),distanceSq:t.au([m[0]-.5-g,m[1]-.5-v]),tileDistanceToCamera:Math.sqrt(n*n+r*r)})}else for(let e=0;e<4;e++)x.push({zoom:p.zoom+1,x:(g<<1)+e%2,y:(v<<1)+(e>>1),wrap:p.wrap,fullyVisible:w})}return b.sort((e,t)=>e.distanceSq-t.distanceSq).map(e=>e.tileID)}const Ce=t.aa.fromPoints([new t.P(0,0),new t.P(t.a5,t.a5)]);function ke(e){return"raster"===e||"image"===e||"video"===e}function Ie(e,t,i,n,r,o,a){if(!t.hasData())return!1;const{tileID:s,fadingRole:l,fadingDirection:c,fadingParentID:u}=t;if(l===ue.Base&&c===he.Incoming&&u)return i[u.key]=u,!0;const h=Math.max(s.overscaledZ-r,o);for(let d=s.overscaledZ-1;d>=h;d--){const r=s.scaledTo(d),o=e.getLoadedTile(r);if(o)return t.setCrossFadeLogic({fadingRole:ue.Base,fadingDirection:he.Incoming,fadingParentID:o.tileID,fadeEndTime:n+a}),o.setCrossFadeLogic({fadingRole:ue.Parent,fadingDirection:he.Departing,fadeEndTime:n+a}),i[r.key]=r,!0}return!1}function ze(e,t,i,n,r,o){if(!t.hasData())return!1;const a=t.tileID.children(r);let s=Ae(e,t,a,i,n,r,o);if(s)return!0;for(const l of a)Ae(e,t,l.children(r),i,n,r,o)&&(s=!0);return s}function Ae(e,t,i,n,r,o,a){if(i[0].overscaledZ>=o)return!1;let s=!1;for(const l of i){const i=e.getLoadedTile(l);if(!i)continue;const{fadingRole:o,fadingDirection:c,fadingParentID:u}=i;o===ue.Base&&c===he.Departing&&u||(i.setCrossFadeLogic({fadingRole:ue.Base,fadingDirection:he.Departing,fadingParentID:t.tileID,fadeEndTime:r+a}),t.setCrossFadeLogic({fadingRole:ue.Parent,fadingDirection:he.Incoming,fadeEndTime:r+a})),n[l.key]=l,s=!0}return s}function Le(e,t,i,n){const r=e.tileID;return!!e.selfFading||!e.hasData()&&!!t.has(r)&&(e.setSelfFadeLogic(i+n),!0)}function De(e,t){var i;e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0;let n=t.tileID.canonical.x-e.tileID.canonical.x;const r=t.tileID.canonical.y-e.tileID.canonical.y,o=Math.pow(2,e.tileID.canonical.z),a=t.tileID.key;0===n&&0===r||Math.abs(r)>1||(Math.abs(n)>1&&(1===Math.abs(n+o)?n+=o:1===Math.abs(n-o)&&(n-=o)),t.dem&&e.dem&&(e.dem.backfillBorder(t.dem,n,r),(null===(i=e.neighboringTiles)||void 0===i?void 0:i[a])&&(e.neighboringTiles[a].backfilled=!0)))}class Re{constructor(){this._tiles={}}handleWrapJump(e){const t={};for(const i in this._tiles){const n=this._tiles[i];n.tileID=n.tileID.unwrapTo(n.tileID.wrap+e),t[n.tileID.key]=n}this._tiles=t}setFeatureState(e,t){for(const i in this._tiles)this._tiles[i].setFeatureState(e,t)}getAllTiles(){return Object.values(this._tiles)}getAllIds(e=!1){return e?Object.values(this._tiles).map(e=>e.tileID).sort(t.aw).map(e=>e.key):Object.keys(this._tiles)}getTileById(e){return this._tiles[e]}setTile(e,t){this._tiles[e]=t}deleteTileById(e){delete this._tiles[e]}getLoadedTile(e){const t=this.getTileById(e.key);return(null==t?void 0:t.hasData())?t:null}isIdRenderable(e,t=!1){var i;return null===(i=this.getTileById(e))||void 0===i?void 0:i.isRenderable(t)}getRenderableIds(e=0,i){const n=[];for(const t of this.getAllIds())this.isIdRenderable(t,i)&&n.push(this.getTileById(t));return i?n.sort((i,n)=>{const r=i.tileID,o=n.tileID,a=new t.P(r.canonical.x,r.canonical.y)._rotate(-e),s=new t.P(o.canonical.x,o.canonical.y)._rotate(-e);return r.overscaledZ-o.overscaledZ||s.y-a.y||s.x-a.x}).map(e=>e.tileID.key):n.map(e=>e.tileID).sort(t.aw).map(e=>e.key)}}class Fe extends t.E{constructor(e,i,n){super(),this.id=e,this.dispatcher=n,this.on("data",e=>this._dataHandler(e)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((e,t,i,n)=>{const r=new(oe(t.type))(e,t,i,n);if(r.id!==e)throw new Error(`Expected Source id to be ${e} instead of ${r.id}`);return r})(e,i,n,this),this._inViewTiles=new Re,this._outOfViewCache=new t.ax(0,e=>this._unloadTile(e)),this._timers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._rasterFadeDuration=0,this._maxFadingAncestorLevels=5,this._state=new fe,this._didEmitContent=!1,this._updated=!1}onAdd(e){this.map=e,this._maxTileCacheSize=e?e._maxTileCacheSize:null,this._maxTileCacheZoomLevels=e?e._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(e)}onRemove(e){for(const t of this._inViewTiles.getAllTiles())t.unloadVectorData();this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(e),this._inViewTiles=new Re}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded)return!1;if(!this._source.loaded())return!1;if(!(void 0===this.used&&void 0===this.usedForTerrain||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(const e of this._inViewTiles.getAllTiles())if("loaded"!==e.state&&"errored"!==e.state)return!1;return!0}getSource(){return this._source}getState(){return this._state}pause(){this._paused=!0}resume(){if(!this._paused)return;const e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(e,i,n){return t._(this,void 0,void 0,function*(){try{yield this._source.loadTile(e),this._tileLoaded(e,i,n)}catch(r){e.state="errored",404!==r.status?this._source.fire(new t.k(r,{tile:e})):this.update(this.transform,this.terrain)}})}_unloadTile(e){this._source.unloadTile&&this._source.unloadTile(e)}_abortTile(e){this._source.abortTile&&this._source.abortTile(e),this._source.fire(new t.l("dataabort",{tile:e,coord:e.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._inViewTiles,this.map?this.map.painter:null);for(const t of this._inViewTiles.getAllTiles())t.upload(e),t.prepare(this.map.style.imageManager)}getIds(){return this._inViewTiles.getAllIds(!0)}getRenderableIds(e){var t;return this._inViewTiles.getRenderableIds(null===(t=this.transform)||void 0===t?void 0:t.bearingInRadians,e)}hasRenderableParent(e){const t=e.overscaledZ-1;if(t>=this._source.minzoom){const i=this.getLoadedTile(e.scaledTo(t));if(i)return this._inViewTiles.isIdRenderable(i.tileID.key)}return!1}reload(e,t=void 0){if(this._paused)this._shouldReloadOnResume=!0;else{this._outOfViewCache.reset();for(const i of this._inViewTiles.getAllIds()){const n=this._inViewTiles.getTileById(i);t&&!this._source.shouldReloadTile(n,t)||(e?this._reloadTile(i,"expired"):"errored"!==n.state&&this._reloadTile(i,"reloading"))}}}_reloadTile(e,i){return t._(this,void 0,void 0,function*(){const t=this._inViewTiles.getTileById(e);t&&("loading"!==t.state&&(t.state=i),yield this._loadTile(t,e,i))})}_tileLoaded(e,i,n){e.timeAdded=c(),e.selfFading&&(e.fadeEndTime=e.timeAdded+this._rasterFadeDuration),"expired"===n&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(i,e),"raster-dem"===this.getSource().type&&e.dem&&function(e,t){var i,n;const r=t.getRenderableIds();for(const o of r){if(!e.neighboringTiles||!e.neighboringTiles[o])continue;const r=t.getTileById(o);e.neighboringTiles[o].backfilled||De(e,r),(null===(n=null===(i=r.neighboringTiles)||void 0===i?void 0:i[e.tileID.key])||void 0===n?void 0:n.backfilled)||De(r,e)}}(e,this._inViewTiles),this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new t.l("data",{dataType:"source",tile:e,coord:e.tileID}))}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._inViewTiles.getTileById(e)}_retainLoadedChildren(e,t){const i=this._getLoadedDescendents(t),n=new Set;for(const r of t){const t=i[r.key];if(!(null==t?void 0:t.length)){n.add(r);continue}const o=r.overscaledZ+Fe.maxOverzooming,a=t.filter(e=>e.tileID.overscaledZ<=o);if(!a.length){n.add(r);continue}const s=Math.min(...a.map(e=>e.tileID.overscaledZ)),l=a.filter(e=>e.tileID.overscaledZ===s).map(e=>e.tileID);for(const i of l)e[i.key]=i;this._areDescendentsComplete(l,s,r.overscaledZ)||n.add(r)}return n}_getLoadedDescendents(e){var t;const i={};for(const n of this._inViewTiles.getAllTiles().filter(e=>e.hasData()))for(const r of e)n.tileID.isChildOf(r)&&(i[t=r.key]||(i[t]=[])).push(n);return i}_areDescendentsComplete(e,t,i){return 1===e.length&&e[0].isOverscaled()?e[0].overscaledZ===t:Math.pow(4,t-i)===e.length}getLoadedTile(e){return this._inViewTiles.getLoadedTile(e)}updateCacheSize(e){const i=Math.ceil(e.width/this._source.tileSize)+1,n=Math.ceil(e.height/this._source.tileSize)+1,r=Math.floor(i*n*(null===this._maxTileCacheZoomLevels?t.c.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),o="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,r):r;this._outOfViewCache.setMaxSize(o)}handleWrapJump(e){const t=Math.round((e-(void 0===this._prevLng?e:this._prevLng))/360);this._prevLng=e,t&&(this._inViewTiles.handleWrapJump(t),this._resetTileReloadTimers())}update(e,i){if(!this._sourceLoaded||this._paused)return;let n;this.transform=e,this.terrain=i,this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this.used||this.usedForTerrain?this._source.tileID?n=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(e=>new t.a2(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y)):(n=Ee(e,{tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:"vector"===this._source.type&&void 0!==this.map._zoomLevelsToOverscale?e.maxZoom-this.map._zoomLevelsToOverscale:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:i,calculateTileZoom:this._source.calculateTileZoom}),this._source.hasTile&&(n=n.filter(e=>this._source.hasTile(e)))):n=[],this.usedForTerrain&&(n=this._addTerrainIdealTiles(n));const r=0===n.length&&!this._updated&&this._didEmitContent;this._updated=!0,r&&this.fire(new t.l("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const o=Me(e,this._source),a=this._updateRetainedTiles(n,o),s=ke(this._source.type);s&&this._rasterFadeDuration>0&&!i&&function(e,i,n,r,o,a,s){const l=c(),u=t.av(i);for(const t of i){const i=e.getTileById(t.key);i.fadingDirection!==he.Departing&&0!==i.fadeOpacity||i.resetFadeLogic(),Ie(e,i,n,l,r,o,s)||ze(e,i,n,l,a,s)||Le(i,u,l,s)||i.resetFadeLogic()}}(this._inViewTiles,n,a,this._maxFadingAncestorLevels,this._source.minzoom,this._source.maxzoom,this._rasterFadeDuration),s?this._cleanUpRasterTiles(a):this._cleanUpVectorTiles(a)}_cleanUpRasterTiles(e){for(const t of this._inViewTiles.getAllIds())e[t]||this._removeTile(t)}_cleanUpVectorTiles(e){for(const t of this._inViewTiles.getAllIds()){const i=this._inViewTiles.getTileById(t);e[t]?i.clearSymbolFadeHold():i.hasSymbolBuckets?i.holdingForSymbolFade()?i.symbolFadeFinished()&&this._removeTile(t):i.setSymbolHoldDuration(this.map._fadeDuration):this._removeTile(t)}}_addTerrainIdealTiles(e){const t=[];for(const i of e)if(i.canonical.z>this._source.minzoom){const e=i.scaledTo(i.canonical.z-1);t.push(e);const n=i.scaledTo(Math.max(this._source.minzoom,Math.min(i.canonical.z,5)));t.push(n)}return e.concat(t)}releaseSymbolFadeTiles(){for(const e of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(e).holdingForSymbolFade()&&this._removeTile(e)}_updateRetainedTiles(e,t){var i;const n=new Set;for(const l of e)this._addTile(l).hasData()||n.add(l);const r=e.reduce((e,t)=>(e[t.key]=t,e),{}),o=this._retainLoadedChildren(r,n),a={},s=Math.max(t-Fe.maxUnderzooming,this._source.minzoom);for(const l of o){let e=this._inViewTiles.getTileById(l.key),t=null==e?void 0:e.wasRequested();for(let n=l.overscaledZ-1;n>=s;--n){const o=l.scaledTo(n);if(a[o.key])break;if(a[o.key]=!0,e=this.getTile(o),!e&&t&&(e=this._addTile(o)),e){const n=e.hasData();if((n||!(null===(i=this.map)||void 0===i?void 0:i.cancelPendingTileRequestsWhileZooming)||t)&&(r[o.key]=o),t=e.wasRequested(),n)break}}}return r}_addTile(e){let i=this._inViewTiles.getTileById(e.key);if(i)return i;i=this._outOfViewCache.getAndRemove(e),i&&(i.resetFadeLogic(),this._setTileReloadTimer(e.key,i),i.tileID=e,this._state.initializeTileState(i,this.map?this.map.painter:null));const n=i;return i||(i=new pe(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(i,e.key,i.state)),i.uses++,this._inViewTiles.setTile(e.key,i),n||this._source.fire(new t.l("dataloading",{tile:i,coord:i.tileID,dataType:"source"})),i}_setTileReloadTimer(e,t){this._clearTileReloadTimer(e);const i=t.getExpiryTimeout();i&&(this._timers[e]=setTimeout(()=>{this._reloadTile(e,"expired"),delete this._timers[e]},i))}_clearTileReloadTimer(e){const t=this._timers[e];t&&(clearTimeout(t),delete this._timers[e])}_resetTileReloadTimers(){for(const e in this._timers)clearTimeout(this._timers[e]),delete this._timers[e];for(const e of this._inViewTiles.getAllIds()){const t=this._inViewTiles.getTileById(e);this._setTileReloadTimer(e,t)}}refreshTiles(e){for(const t of this._inViewTiles.getAllIds()){const i=this._inViewTiles.getTileById(t);(this._inViewTiles.isIdRenderable(t)||"errored"==i.state)&&e.some(e=>e.equals(i.tileID.canonical))&&this._reloadTile(t,"expired")}}_removeTile(e){const t=this._inViewTiles.getTileById(e);t&&(t.uses--,this._inViewTiles.deleteTileById(e),this._clearTileReloadTimer(e),t.uses>0||(t.hasData()&&"reloading"!==t.state?this._outOfViewCache.add(t.tileID,t,t.getExpiryTimeout()):(t.aborted=!0,this._abortTile(t),this._unloadTile(t))))}_dataHandler(e){"source"===e.dataType&&("metadata"!==e.sourceDataType?"content"===e.sourceDataType&&this._sourceLoaded&&!this._paused&&(this.reload(e.sourceDataChanged,e.shouldReloadTileOptions),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0):this._sourceLoaded=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const e of this._inViewTiles.getAllIds())this._removeTile(e);this._outOfViewCache.reset()}tilesIn(e,i,n){const r=[],o=this.transform;if(!o)return r;const a=o.getCoveringTilesDetailsProvider().allowWorldCopies(),s=n?o.getCameraQueryGeometry(e):e,l=e=>o.screenPointToMercatorCoordinate(e,this.terrain),c=this.transformBbox(e,l,!a),u=this.transformBbox(s,l,!a),h=this.getIds(),d=t.aa.fromPoints(u);for(let p=0;p<h.length;p++){const e=this._inViewTiles.getTileById(h[p]);if(e.holdingForSymbolFade())continue;const n=a?[e.tileID]:[e.tileID.unwrapTo(-1),e.tileID.unwrapTo(0)],s=Math.pow(2,o.zoom-e.tileID.overscaledZ),l=i*e.queryPadding*t.a5/e.tileSize/s;for(const i of n){const n=d.map(e=>i.getTilePoint(new t.a9(e.x,e.y)));if(n.expandBy(l),n.intersects(Ce)){const t=c.map(e=>i.getTilePoint(e)),n=u.map(e=>i.getTilePoint(e));r.push({tile:e,tileID:a?i:i.unwrapTo(0),queryGeometry:t,cameraQueryGeometry:n,scale:s})}}}return r}transformBbox(e,i,n){let r=e.map(i);if(n){const n=t.aa.fromPoints(e);n.shrinkBy(.001*Math.min(n.width(),n.height()));const o=n.map(i);t.aa.fromPoints(r).covers(o)||(r=r.map(e=>e.x>.5?new t.a9(e.x-1,e.y,e.z):e))}return r}getVisibleCoordinates(e){const t=this.getRenderableIds(e).map(e=>this._inViewTiles.getTileById(e).tileID);return this.transform&&this.transform.populateCache(t),t}hasTransition(){return!!this._source.hasTransition()||!(!ke(this._source.type)||!function(e,t){if(t<=0)return!1;const i=c();for(const n of e.getAllTiles())if(n.fadeEndTime>=i)return!0;return!1}(this._inViewTiles,this._rasterFadeDuration))}setRasterFadeDuration(e){this._rasterFadeDuration=e}setFeatureState(e,i,n){this._state.updateState(e=e||t.ai,i,n)}removeFeatureState(e,i,n){this._state.removeFeatureState(e=e||t.ai,i,n)}getFeatureState(e,i){return this._state.getState(e=e||t.ai,i)}setDependencies(e,t,i){const n=this._inViewTiles.getTileById(e);n&&n.setDependencies(t,i)}reloadTilesForDependencies(e,t){for(const i of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(i).hasDependency(e,t)&&this._reloadTile(i,"reloading");this._outOfViewCache.filter(i=>!i.hasDependency(e,t))}areTilesLoaded(){for(const e of this._inViewTiles.getAllTiles())if("loaded"!==e.state&&"errored"!==e.state)return!1;return!0}}Fe.maxUnderzooming=10,Fe.maxOverzooming=3;class Be{constructor(e,t){this.reset(e,t)}reset(e,t){this.points=e||[],this._distances=[0];for(let i=1;i<this.points.length;i++)this._distances[i]=this._distances[i-1]+this.points[i].dist(this.points[i-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(t||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(e){if(1===this.points.length)return this.points[0];e=t.an(e,0,1);let i=1,n=this._distances[i];const r=e*this.paddedLength+this.padding;for(;n<r&&i<this._distances.length;)n=this._distances[++i];const o=i-1,a=this._distances[o],s=n-a,l=s>0?(r-a)/s:0;return this.points[o].mult(1-l).add(this.points[i].mult(l))}}function Oe(e,t){let i=!0;return"always"===e||"never"!==e&&"never"!==t||(i=!1),i}class Ne{constructor(e,t,i){const n=this.boxCells=[],r=this.circleCells=[];this.xCellCount=Math.ceil(e/i),this.yCellCount=Math.ceil(t/i);for(let o=0;o<this.xCellCount*this.yCellCount;o++)n.push([]),r.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=t,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/t,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,t,i,n,r){this._forEachCell(t,i,n,r,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(t),this.bboxes.push(i),this.bboxes.push(n),this.bboxes.push(r)}insertCircle(e,t,i,n){this._forEachCell(t-n,i-n,t+n,i+n,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(t),this.circles.push(i),this.circles.push(n)}_insertBoxCell(e,t,i,n,r,o){this.boxCells[r].push(o)}_insertCircleCell(e,t,i,n,r,o){this.circleCells[r].push(o)}_query(e,t,i,n,r,o,a){if(i<0||e>this.width||n<0||t>this.height)return[];const s=[];if(e<=0&&t<=0&&this.width<=i&&this.height<=n){if(r)return[{key:null,x1:e,y1:t,x2:i,y2:n}];for(let e=0;e<this.boxKeys.length;e++)s.push({key:this.boxKeys[e],x1:this.bboxes[4*e],y1:this.bboxes[4*e+1],x2:this.bboxes[4*e+2],y2:this.bboxes[4*e+3]});for(let e=0;e<this.circleKeys.length;e++){const t=this.circles[3*e],i=this.circles[3*e+1],n=this.circles[3*e+2];s.push({key:this.circleKeys[e],x1:t-n,y1:i-n,x2:t+n,y2:i+n})}}else this._forEachCell(e,t,i,n,this._queryCell,s,{hitTest:r,overlapMode:o,seenUids:{box:{},circle:{}}},a);return s}query(e,t,i,n){return this._query(e,t,i,n,!1,null)}hitTest(e,t,i,n,r,o){return this._query(e,t,i,n,!0,r,o).length>0}hitTestCircle(e,t,i,n,r){const o=e-i,a=e+i,s=t-i,l=t+i;if(a<0||o>this.width||l<0||s>this.height)return!1;const c=[];return this._forEachCell(o,s,a,l,this._queryCellCircle,c,{hitTest:!0,overlapMode:n,circle:{x:e,y:t,radius:i},seenUids:{box:{},circle:{}}},r),c.length>0}_queryCell(e,t,i,n,r,o,a,s){const{seenUids:l,hitTest:c,overlapMode:u}=a,h=this.boxCells[r];if(null!==h){const r=this.bboxes;for(const a of h)if(!l.box[a]){l.box[a]=!0;const h=4*a,d=this.boxKeys[a];if(e<=r[h+2]&&t<=r[h+3]&&i>=r[h+0]&&n>=r[h+1]&&(!s||s(d))&&(!c||!Oe(u,d.overlapMode))&&(o.push({key:d,x1:r[h],y1:r[h+1],x2:r[h+2],y2:r[h+3]}),c))return!0}}const d=this.circleCells[r];if(null!==d){const r=this.circles;for(const a of d)if(!l.circle[a]){l.circle[a]=!0;const h=3*a,d=this.circleKeys[a];if(this._circleAndRectCollide(r[h],r[h+1],r[h+2],e,t,i,n)&&(!s||s(d))&&(!c||!Oe(u,d.overlapMode))){const e=r[h],t=r[h+1],i=r[h+2];if(o.push({key:d,x1:e-i,y1:t-i,x2:e+i,y2:t+i}),c)return!0}}}return!1}_queryCellCircle(e,t,i,n,r,o,a,s){const{circle:l,seenUids:c,overlapMode:u}=a,h=this.boxCells[r];if(null!==h){const e=this.bboxes;for(const t of h)if(!c.box[t]){c.box[t]=!0;const i=4*t,n=this.boxKeys[t];if(this._circleAndRectCollide(l.x,l.y,l.radius,e[i+0],e[i+1],e[i+2],e[i+3])&&(!s||s(n))&&!Oe(u,n.overlapMode))return o.push(!0),!0}}const d=this.circleCells[r];if(null!==d){const e=this.circles;for(const t of d)if(!c.circle[t]){c.circle[t]=!0;const i=3*t,n=this.circleKeys[t];if(this._circlesCollide(e[i],e[i+1],e[i+2],l.x,l.y,l.radius)&&(!s||s(n))&&!Oe(u,n.overlapMode))return o.push(!0),!0}}}_forEachCell(e,t,i,n,r,o,a,s){const l=this._convertToXCellCoord(e),c=this._convertToYCellCoord(t),u=this._convertToXCellCoord(i),h=this._convertToYCellCoord(n);for(let d=l;d<=u;d++)for(let l=c;l<=h;l++)if(r.call(this,e,t,i,n,this.xCellCount*l+d,o,a,s))return}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,t,i,n,r,o){const a=n-e,s=r-t,l=i+o;return l*l>a*a+s*s}_circleAndRectCollide(e,t,i,n,r,o,a){const s=(o-n)/2,l=Math.abs(e-(n+s));if(l>s+i)return!1;const c=(a-r)/2,u=Math.abs(t-(r+c));if(u>c+i)return!1;if(l<=s||u<=c)return!0;const h=l-s,d=u-c;return h*h+d*d<=i*i}}function je(e,i,r){const o=t.N();if(!e){const{vecSouth:e,vecEast:t}=Ue(i),r=n();r[0]=t[0],r[1]=t[1],r[2]=e[0],r[3]=e[1],a=r,(d=(l=(s=r)[0])*(h=s[3])-(u=s[2])*(c=s[1]))&&(a[0]=h*(d=1/d),a[1]=-c*d,a[2]=-u*d,a[3]=l*d),o[0]=r[0],o[1]=r[1],o[4]=r[2],o[5]=r[3]}var a,s,l,c,u,h,d;return t.Q(o,o,[1/r,1/r,1]),o}function Ve(e,i,n,r){if(e){const e=t.N();if(!i){const{vecSouth:t,vecEast:i}=Ue(n);e[0]=i[0],e[1]=i[1],e[4]=t[0],e[5]=t[1]}return t.Q(e,e,[r,r,1]),e}return n.pixelsToClipSpaceMatrix}function Ue(e){const i=Math.cos(e.rollInRadians),n=Math.sin(e.rollInRadians),r=Math.cos(e.pitchInRadians),o=Math.cos(e.bearingInRadians),a=Math.sin(e.bearingInRadians),s=t.aC();s[0]=-o*r*n-a*i,s[1]=-a*r*n+o*i;const l=t.aD(s);l<1e-9?t.aE(s):t.aF(s,s,1/l);const c=t.aC();c[0]=o*r*i-a*n,c[1]=a*r*i+o*n;const u=t.aD(c);return u<1e-9?t.aE(c):t.aF(c,c,1/u),{vecEast:c,vecSouth:s}}function Ze(e,i,n,r){let o;r?(o=[e,i,r(e,i),1],t.aH(o,o,n)):(o=[e,i,0,1],at(o,o,n));const a=o[3];return{point:new t.P(o[0]/a,o[1]/a),signedDistanceFromCamera:a,isOccluded:!1}}function Ge(e,t){return.5+e/t*.5}function qe(e,t){return e.x>=-t[0]&&e.x<=t[0]&&e.y>=-t[1]&&e.y<=t[1]}function $e(e,i,n,r,o,a,s,l,c,u,h,d,p){const f=n?e.textSizeData:e.iconSizeData,m=t.ay(f,i.transform.zoom),g=[256/i.width*2+1,256/i.height*2+1],_=n?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;_.clear();const y=e.lineVertexArray,v=n?e.text.placedSymbolArray:e.icon.placedSymbolArray,x=i.transform.width/i.transform.height;let b=!1;for(let w=0;w<v.length;w++){const n=v.get(w);if(n.hidden||n.writingMode===t.az.vertical&&!b){ot(n.numGlyphs,_);continue}b=!1;const T=new t.P(n.anchorX,n.anchorY),S={getElevation:p,pitchedLabelPlaneMatrix:r,lineVertexArray:y,pitchWithMap:a,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:i.transform,tileAnchorPoint:T,unwrappedTileID:c,width:u,height:h,translation:d},P=et(n.anchorX,n.anchorY,S);if(!qe(P.point,g)){ot(n.numGlyphs,_);continue}const M=Ge(i.transform.cameraToCenterDistance,P.signedDistanceFromCamera),E=t.aA(f,m,n),C=a?E*i.transform.getPitchedTextCorrection(n.anchorX,n.anchorY,c)/M:E*M,k=Xe({projectionContext:S,pitchedLabelPlaneMatrixInverse:o,symbol:n,fontSize:C,flip:!1,keepUpright:s,glyphOffsetArray:e.glyphOffsetArray,dynamicLayoutVertexArray:_,aspectRatio:x,rotateToLine:l});b=k.useVertical,(k.notEnoughRoom||b||k.needsFlipping&&Xe({projectionContext:S,pitchedLabelPlaneMatrixInverse:o,symbol:n,fontSize:C,flip:!0,keepUpright:s,glyphOffsetArray:e.glyphOffsetArray,dynamicLayoutVertexArray:_,aspectRatio:x,rotateToLine:l}).notEnoughRoom)&&ot(n.numGlyphs,_)}n?e.text.dynamicLayoutVertexBuffer.updateData(_):e.icon.dynamicLayoutVertexBuffer.updateData(_)}function We(e,t,i,n,r,o,a,s){const l=o.glyphStartIndex+o.numGlyphs,c=o.lineStartIndex,u=o.lineStartIndex+o.lineLength,h=t.getoffsetX(o.glyphStartIndex),d=t.getoffsetX(l-1),p=nt(e*h,i,n,r,o.segment,c,u,s,a);if(!p)return null;const f=nt(e*d,i,n,r,o.segment,c,u,s,a);return f?s.projectionCache.anyProjectionOccluded?null:{first:p,last:f}:null}function He(e,i,n,r){return e===t.az.horizontal&&Math.abs(n.y-i.y)>Math.abs(n.x-i.x)*r?{useVertical:!0}:(e===t.az.vertical?i.y<n.y:i.x>n.x)?{needsFlipping:!0}:null}function Xe(e){const{projectionContext:i,pitchedLabelPlaneMatrixInverse:n,symbol:r,fontSize:o,flip:a,keepUpright:s,glyphOffsetArray:l,dynamicLayoutVertexArray:c,aspectRatio:u,rotateToLine:h}=e,d=o/24,p=r.lineOffsetX*d,f=r.lineOffsetY*d;let m;if(r.numGlyphs>1){const e=r.glyphStartIndex+r.numGlyphs,t=r.lineStartIndex,o=r.lineStartIndex+r.lineLength,c=We(d,l,p,f,a,r,h,i);if(!c)return{notEnoughRoom:!0};const g=Je(c.first.point.x,c.first.point.y,i,n),_=Je(c.last.point.x,c.last.point.y,i,n);if(s&&!a){const e=He(r.writingMode,g,_,u);if(e)return e}m=[c.first];for(let n=r.glyphStartIndex+1;n<e-1;n++){const e=nt(d*l.getoffsetX(n),p,f,a,r.segment,t,o,i,h);if(!e)return{notEnoughRoom:!0};m.push(e)}m.push(c.last)}else{if(s&&!a){const e=Qe(i.tileAnchorPoint.x,i.tileAnchorPoint.y,i).point,o=r.lineStartIndex+r.segment+1,a=new t.P(i.lineVertexArray.getx(o),i.lineVertexArray.gety(o)),s=Qe(a.x,a.y,i),l=s.signedDistanceFromCamera>0?s.point:Ye(i.tileAnchorPoint,a,e,1,i),c=Je(e.x,e.y,i,n),h=Je(l.x,l.y,i,n),d=He(r.writingMode,c,h,u);if(d)return d}const e=nt(d*l.getoffsetX(r.glyphStartIndex),p,f,a,r.segment,r.lineStartIndex,r.lineStartIndex+r.lineLength,i,h);if(!e||i.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};m=[e]}for(const g of m)t.aG(c,g.point,g.angle);return{}}function Ye(e,t,i,n,r){const o=e.add(e.sub(t)._unit()),a=Qe(o.x,o.y,r).point,s=i.sub(a);return i.add(s._mult(n/s.mag()))}function Ke(e,i,n){const r=i.projectionCache;if(r.projections[e])return r.projections[e];const o=new t.P(i.lineVertexArray.getx(e),i.lineVertexArray.gety(e)),a=Qe(o.x,o.y,i);if(a.signedDistanceFromCamera>0)return r.projections[e]=a.point,r.anyProjectionOccluded=r.anyProjectionOccluded||a.isOccluded,a.point;const s=e-n.direction;return Ye(0===n.distanceFromAnchor?i.tileAnchorPoint:new t.P(i.lineVertexArray.getx(s),i.lineVertexArray.gety(s)),o,n.previousVertex,n.absOffsetX-n.distanceFromAnchor+1,i)}function Qe(e,t,i){const n=e+i.translation[0],r=t+i.translation[1];let o;return i.pitchWithMap?(o=Ze(n,r,i.pitchedLabelPlaneMatrix,i.getElevation),o.isOccluded=!1):(o=i.transform.projectTileCoordinates(n,r,i.unwrappedTileID,i.getElevation),o.point.x=(.5*o.point.x+.5)*i.width,o.point.y=(.5*-o.point.y+.5)*i.height),o}function Je(e,i,n,r){if(n.pitchWithMap){const o=[e,i,0,1];return t.aH(o,o,r),n.transform.projectTileCoordinates(o[0]/o[3],o[1]/o[3],n.unwrappedTileID,n.getElevation).point}return{x:e/n.width*2-1,y:1-i/n.height*2}}function et(e,t,i){return i.transform.projectTileCoordinates(e,t,i.unwrappedTileID,i.getElevation)}function tt(e,t,i){return e._unit()._perp()._mult(t*i)}function it(e,i,n,r,o,a,s,l,c){if(l.projectionCache.offsets[e])return l.projectionCache.offsets[e];const u=n.add(i);if(e+c.direction<r||e+c.direction>=o)return l.projectionCache.offsets[e]=u,u;const h=Ke(e+c.direction,l,c),d=tt(h.sub(n),s,c.direction),p=n.add(d),f=h.add(d);return l.projectionCache.offsets[e]=t.aI(a,u,p,f)||u,l.projectionCache.offsets[e]}function nt(e,t,i,n,r,o,a,s,l){const c=n?e-t:e+t;let u=c>0?1:-1,h=0;n&&(u*=-1,h=Math.PI),u<0&&(h+=Math.PI);let d,p=u>0?o+r:o+r+1;s.projectionCache.cachedAnchorPoint?d=s.projectionCache.cachedAnchorPoint:(d=Qe(s.tileAnchorPoint.x,s.tileAnchorPoint.y,s).point,s.projectionCache.cachedAnchorPoint=d);let f,m,g=d,_=d,y=0,v=0;const x=Math.abs(c),b=[];let w;for(;y+v<=x;){if(p+=u,p<o||p>=a)return null;y+=v,_=g,m=f;const e={absOffsetX:x,direction:u,distanceFromAnchor:y,previousVertex:_};if(g=Ke(p,s,e),0===i)b.push(_),w=g.sub(_);else{let t;const n=g.sub(_);t=0===n.mag()?tt(Ke(p+u,s,e).sub(g),i,u):tt(n,i,u),m||(m=_.add(t)),f=it(p,t,g,o,a,m,i,s,e),b.push(m),w=f.sub(m)}v=w.mag()}const T=w._mult((x-y)/v)._add(m||_),S=h+Math.atan2(g.y-_.y,g.x-_.x);return b.push(T),{point:T,angle:l?S:0,path:b}}const rt=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function ot(e,t){for(let i=0;i<e;i++){const e=t.length;t.resize(e+4),t.float32.set(rt,3*e)}}function at(e,t,i){const n=t[0],r=t[1];return e[0]=i[0]*n+i[4]*r+i[12],e[1]=i[1]*n+i[5]*r+i[13],e[3]=i[3]*n+i[7]*r+i[15],e}const st=100;class lt{constructor(e,t=new Ne(e.width+200,e.height+200,25),i=new Ne(e.width+200,e.height+200,25)){this.transform=e,this.grid=t,this.ignoredGrid=i,this.pitchFactor=Math.cos(e.pitch*Math.PI/180)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+st,this.screenBottomBoundary=e.height+st,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(e,t,i,n,r,o,a,s,l,c,u,h){const d=this.projectAndGetPerspectiveRatio(e.anchorPointX+s[0],e.anchorPointY+s[1],r,c,h),p=i*d.perspectiveRatio;let f;if(o||a)f=this._projectCollisionBox(e,p,n,r,o,a,s,d,c,u,h);else{const t=d.x+(u?u.x*p:0),i=d.y+(u?u.y*p:0);f={allPointsOccluded:!1,box:[t+e.x1*p,i+e.y1*p,t+e.x2*p,i+e.y2*p]}}const[m,g,_,y]=f.box,v=o?f.allPointsOccluded:d.isOccluded;let x=v;return x||(x=d.perspectiveRatio<this.perspectiveRatioCutoff),x||(x=!this.isInsideGrid(m,g,_,y)),x||"always"!==t&&this.grid.hitTest(m,g,_,y,t,l)?{box:[m,g,_,y],placeable:!1,offscreen:!1,occluded:v}:{box:[m,g,_,y],placeable:!0,offscreen:this.isOffscreen(m,g,_,y),occluded:v}}placeCollisionCircles(e,i,n,r,o,a,s,l,c,u,h,d,p,f){const m=[],g=new t.P(i.anchorX,i.anchorY),_=this.getPerspectiveRatio(g.x,g.y,a,f),y=(c?o*this.transform.getPitchedTextCorrection(i.anchorX,i.anchorY,a)/_:o*_)/t.aM,v={getElevation:f,pitchedLabelPlaneMatrix:s,lineVertexArray:n,pitchWithMap:c,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:this.transform,tileAnchorPoint:g,unwrappedTileID:a,width:this.transform.width,height:this.transform.height,translation:p},x=We(y,r,i.lineOffsetX*y,i.lineOffsetY*y,!1,i,!1,v);let b=!1,w=!1,T=!0;if(x){const i=.5*h*_+d,n=new t.P(-100,-100),r=new t.P(this.screenRightBoundary,this.screenBottomBoundary),o=new Be,a=x.first,s=x.last;let p=[];for(let e=a.path.length-1;e>=1;e--)p.push(a.path[e]);for(let e=1;e<s.path.length;e++)p.push(s.path[e]);const f=2.5*i;if(c){const e=this.projectPathToScreenSpace(p,v);p=e.some(e=>e.signedDistanceFromCamera<=0)?[]:e.map(e=>e.point)}let g=[];if(p.length>0){const e=p[0].clone(),i=p[0].clone();for(let t=1;t<p.length;t++)e.x=Math.min(e.x,p[t].x),e.y=Math.min(e.y,p[t].y),i.x=Math.max(i.x,p[t].x),i.y=Math.max(i.y,p[t].y);g=e.x>=n.x&&i.x<=r.x&&e.y>=n.y&&i.y<=r.y?[p]:i.x<n.x||e.x>r.x||i.y<n.y||e.y>r.y?[]:t.aJ([p],n.x,n.y,r.x,r.y)}for(const t of g){o.reset(t,.25*i);let n=0;n=o.length<=.5*i?1:Math.ceil(o.paddedLength/f)+1;for(let t=0;t<n;t++){const r=t/Math.max(n-1,1),a=o.lerp(r),s=a.x+st,c=a.y+st;m.push(s,c,i,0);const h=s-i,d=c-i,p=s+i,f=c+i;if(T=T&&this.isOffscreen(h,d,p,f),w=w||this.isInsideGrid(h,d,p,f),"always"!==e&&this.grid.hitTestCircle(s,c,i,e,u)&&(b=!0,!l))return{circles:[],offscreen:!1,collisionDetected:b}}}}return{circles:!l&&b||!w||_<this.perspectiveRatioCutoff?[]:m,offscreen:T,collisionDetected:b}}projectPathToScreenSpace(e,i){return function(e){let t=0,i=0,n=0,r=0;for(let o=0;o<e.length;o++)e[o].isOccluded?(n=o+1,r=0):(r++,r>i&&(i=r,t=n));return e.slice(t,t+i)}(function(e,i){const n=t.N();return t.aB(n,i.pitchedLabelPlaneMatrix),e.map(e=>{const t=Ze(e.x,e.y,n,i.getElevation),r=i.transform.projectTileCoordinates(t.point.x,t.point.y,i.unwrappedTileID,i.getElevation);return r.point.x=(.5*r.point.x+.5)*i.width,r.point.y=(.5*-r.point.y+.5)*i.height,r})}(e,i))}queryRenderedSymbols(e){if(0===e.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};const i=[],n=new t.aa;for(const h of e){const e=new t.P(h.x+st,h.y+st);n.extend(e),i.push(e)}const{minX:r,minY:o,maxX:a,maxY:s}=n,l=this.grid.query(r,o,a,s).concat(this.ignoredGrid.query(r,o,a,s)),c={},u={};for(const h of l){const e=h.key;if(void 0===c[e.bucketInstanceId]&&(c[e.bucketInstanceId]={}),c[e.bucketInstanceId][e.featureIndex])continue;const n=[new t.P(h.x1,h.y1),new t.P(h.x2,h.y1),new t.P(h.x2,h.y2),new t.P(h.x1,h.y2)];t.aK(i,n)&&(c[e.bucketInstanceId][e.featureIndex]=!0,void 0===u[e.bucketInstanceId]&&(u[e.bucketInstanceId]=[]),u[e.bucketInstanceId].push(e.featureIndex))}return u}insertCollisionBox(e,t,i,n,r,o){(i?this.ignoredGrid:this.grid).insert({bucketInstanceId:n,featureIndex:r,collisionGroupID:o,overlapMode:t},e[0],e[1],e[2],e[3])}insertCollisionCircles(e,t,i,n,r,o){const a=i?this.ignoredGrid:this.grid,s={bucketInstanceId:n,featureIndex:r,collisionGroupID:o,overlapMode:t};for(let l=0;l<e.length;l+=4)a.insertCircle(s,e[l],e[l+1],e[l+2])}projectAndGetPerspectiveRatio(e,i,n,r,o){if(o){let n;r?(n=[e,i,r(e,i),1],t.aH(n,n,o)):(n=[e,i,0,1],at(n,n,o));const a=n[3];return{x:(n[0]/a+1)/2*this.transform.width+st,y:(-n[1]/a+1)/2*this.transform.height+st,perspectiveRatio:.5+this.transform.cameraToCenterDistance/a*.5,isOccluded:!1,signedDistanceFromCamera:a}}{const t=this.transform.projectTileCoordinates(e,i,n,r);return{x:(t.point.x+1)/2*this.transform.width+st,y:(1-t.point.y)/2*this.transform.height+st,perspectiveRatio:.5+this.transform.cameraToCenterDistance/t.signedDistanceFromCamera*.5,isOccluded:t.isOccluded,signedDistanceFromCamera:t.signedDistanceFromCamera}}}getPerspectiveRatio(e,t,i,n){const r=this.transform.projectTileCoordinates(e,t,i,n);return.5+this.transform.cameraToCenterDistance/r.signedDistanceFromCamera*.5}isOffscreen(e,t,i,n){return i<st||e>=this.screenRightBoundary||n<st||t>this.screenBottomBoundary}isInsideGrid(e,t,i,n){return i>=0&&e<this.gridRightBoundary&&n>=0&&t<this.gridBottomBoundary}getViewportMatrix(){const e=t.ar([]);return t.O(e,e,[-100,-100,0]),e}_projectCollisionBox(e,i,n,r,o,a,s,l,c,u,h){let d=1,p=0,f=0,m=1;const g=e.anchorPointX+s[0],_=e.anchorPointY+s[1];if(a&&!o){const e=this.projectAndGetPerspectiveRatio(g+1,_,r,c,h),t=e.x-l.x,i=Math.atan((e.y-l.y)/t)+(t<0?Math.PI:0),n=Math.sin(i),o=Math.cos(i);d=o,p=n,f=-n,m=o}else if(!a&&o){const e=Ue(this.transform);d=e.vecEast[0],p=e.vecEast[1],f=e.vecSouth[0],m=e.vecSouth[1]}let y=l.x,v=l.y,x=i;o&&(y=g,v=_,x=Math.pow(2,-(this.transform.zoom-n.overscaledZ)),x*=this.transform.getPitchedTextCorrection(g,_,r),u||(x*=t.an(.5+l.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))),u&&(y+=d*u.x*x+f*u.y*x,v+=p*u.x*x+m*u.y*x);const b=e.x1*x,w=e.x2*x,T=(b+w)/2,S=e.y1*x,P=e.y2*x,M=(S+P)/2,E=[{offsetX:b,offsetY:S},{offsetX:T,offsetY:S},{offsetX:w,offsetY:S},{offsetX:w,offsetY:M},{offsetX:w,offsetY:P},{offsetX:T,offsetY:P},{offsetX:b,offsetY:P},{offsetX:b,offsetY:M}];let C=[];for(const{offsetX:I,offsetY:z}of E)C.push(new t.P(y+d*I+f*z,v+p*I+m*z));let k=!1;if(o){const e=C.map(e=>this.projectAndGetPerspectiveRatio(e.x,e.y,r,c,h));k=e.some(e=>!e.isOccluded),C=e.map(e=>new t.P(e.x,e.y))}else k=!0;return{box:t.aL(C),allPointsOccluded:!k}}}class ct{constructor(e,t,i,n){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?t:-t))):n&&i?1:0,this.placed=i}isHidden(){return 0===this.opacity&&!this.placed}}class ut{constructor(e,t,i,n,r){this.text=new ct(e?e.text:null,t,i,r),this.icon=new ct(e?e.icon:null,t,n,r)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class ht{constructor(e,t,i){this.text=e,this.icon=t,this.skipFade=i}}class dt{constructor(e,t,i,n,r){this.bucketInstanceId=e,this.featureIndex=t,this.sourceLayerIndex=i,this.bucketIndex=n,this.tileID=r}}class pt{constructor(e){this.crossSourceCollisions=e,this.maxGroupID=0,this.collisionGroups={}}get(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){const t=++this.maxGroupID;this.collisionGroups[e]={ID:t,predicate:e=>e.collisionGroupID===t}}return this.collisionGroups[e]}}function ft(e,i,n,r,o){const{horizontalAlign:a,verticalAlign:s}=t.aS(e);return new t.P(-(a-.5)*i+r[0]*o,-(s-.5)*n+r[1]*o)}class mt{constructor(e,t,i,n,r){this.transform=e.clone(),this.terrain=t,this.collisionIndex=new lt(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=i,this.retainedQueryData={},this.collisionGroups=new pt(n),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=r,r&&(r.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(e){const t=this.terrain;return t?(i,n)=>t.getElevation(e,i,n):null}getBucketParts(e,i,n,r){const o=n.getBucket(i),a=n.latestFeatureIndex;if(!o||!a||i.id!==o.layerIds[0])return;const s=n.collisionBoxArray,l=o.layers[0].layout,c=o.layers[0].paint,u=Math.pow(2,this.transform.zoom-n.tileID.overscaledZ),h=n.tileSize/t.a5,d=n.tileID.toUnwrapped(),p="map"===l.get("text-rotation-alignment"),f=t.aN(n,1,this.transform.zoom),m=t.aO(this.collisionIndex.transform,n,c.get("text-translate"),c.get("text-translate-anchor")),g=t.aO(this.collisionIndex.transform,n,c.get("icon-translate"),c.get("icon-translate-anchor")),_=je(p,this.transform,f);this.retainedQueryData[o.bucketInstanceId]=new dt(o.bucketInstanceId,a,o.sourceLayerIndex,o.index,n.tileID);const y={bucket:o,layout:l,translationText:m,translationIcon:g,unwrappedTileID:d,pitchedLabelPlaneMatrix:_,scale:u,textPixelRatio:h,holdingForFade:n.holdingForSymbolFade(),collisionBoxArray:s,partiallyEvaluatedTextSize:t.ay(o.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(o.sourceID)};if(r)for(const t of o.sortKeyRanges){const{sortKey:i,symbolInstanceStart:n,symbolInstanceEnd:r}=t;e.push({sortKey:i,symbolInstanceStart:n,symbolInstanceEnd:r,parameters:y})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:o.symbolInstances.length,parameters:y})}attemptAnchorPlacement(e,i,n,r,o,a,s,l,c,u,h,d,p,f,m,g,_,y,v,x){const b=t.aP[e.textAnchor],w=[e.textOffset0,e.textOffset1],T=ft(b,n,r,w,o),S=this.collisionIndex.placeCollisionBox(i,d,l,c,u,s,a,g,h.predicate,v,T,x);if((!y||this.collisionIndex.placeCollisionBox(y,d,l,c,u,s,a,_,h.predicate,v,T,x).placeable)&&S.placeable){let e;if(this.prevPlacement&&this.prevPlacement.variableOffsets[p.crossTileID]&&this.prevPlacement.placements[p.crossTileID]&&this.prevPlacement.placements[p.crossTileID].text&&(e=this.prevPlacement.variableOffsets[p.crossTileID].anchor),0===p.crossTileID)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[p.crossTileID]={textOffset:w,width:n,height:r,anchor:b,textBoxScale:o,prevAnchor:e},this.markUsedJustification(f,b,p,m),f.allowVerticalPlacement&&(this.markUsedOrientation(f,m,p),this.placedOrientations[p.crossTileID]=m),{shift:T,placedGlyphBoxes:S}}}placeLayerBucketPart(e,i,n){const{bucket:r,layout:o,translationText:a,translationIcon:s,unwrappedTileID:l,pitchedLabelPlaneMatrix:c,textPixelRatio:u,holdingForFade:h,collisionBoxArray:d,partiallyEvaluatedTextSize:p,collisionGroup:f}=e.parameters,m=o.get("text-optional"),g=o.get("icon-optional"),_=t.aQ(o,"text-overlap","text-allow-overlap"),y="always"===_,v=t.aQ(o,"icon-overlap","icon-allow-overlap"),x="always"===v,b="map"===o.get("text-rotation-alignment"),w="map"===o.get("text-pitch-alignment"),T="none"!==o.get("icon-text-fit"),S="viewport-y"===o.get("symbol-z-order"),P=y&&(x||!r.hasIconData()||g),M=x&&(y||!r.hasTextData()||m);!r.collisionArrays&&d&&r.deserializeCollisionBoxes(d);const E=this.retainedQueryData[r.bucketInstanceId].tileID,C=this._getTerrainElevationFunc(E),k=this.transform.getFastPathSimpleProjectionMatrix(E),I=(e,d,x)=>{var S,I;if(i[e.crossTileID])return;if(h)return void(this.placements[e.crossTileID]=new ht(!1,!1,!1));let z=!1,A=!1,L=!0,D=null,R={box:null,placeable:!1,offscreen:null,occluded:!1},F={placeable:!1},B=null,O=null,N=null,j=0,V=0,U=0;d.textFeatureIndex?j=d.textFeatureIndex:e.useRuntimeCollisionCircles&&(j=e.featureIndex),d.verticalTextFeatureIndex&&(V=d.verticalTextFeatureIndex);const Z=d.textBox;if(Z){const i=i=>{let n=t.az.horizontal;if(r.allowVerticalPlacement&&!i&&this.prevPlacement){const t=this.prevPlacement.placedOrientations[e.crossTileID];t&&(this.placedOrientations[e.crossTileID]=t,n=t,this.markUsedOrientation(r,n,e))}return n},o=(i,n)=>{if(r.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&d.verticalTextBox){for(const e of r.writingModes)if(e===t.az.vertical?(R=n(),F=R):R=i(),R&&R.placeable)break}else R=i()},c=e.textAnchorOffsetStartIndex,h=e.textAnchorOffsetEndIndex;if(h===c){const n=(t,i)=>{const n=this.collisionIndex.placeCollisionBox(t,_,u,E,l,w,b,a,f.predicate,C,void 0,k);return n&&n.placeable&&(this.markUsedOrientation(r,i,e),this.placedOrientations[e.crossTileID]=i),n};o(()=>n(Z,t.az.horizontal),()=>{const i=d.verticalTextBox;return r.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&i?n(i,t.az.vertical):{box:null,offscreen:null}}),i(R&&R.placeable)}else{let p=t.aP[null===(I=null===(S=this.prevPlacement)||void 0===S?void 0:S.variableOffsets[e.crossTileID])||void 0===I?void 0:I.anchor];const m=(t,i,o)=>{const d=t.x2-t.x1,m=t.y2-t.y1,g=e.textBoxScale,y=T&&"never"===v?i:null;let x=null,S="never"===_?1:2,P="never";p&&S++;for(let n=0;n<S;n++){for(let i=c;i<h;i++){const n=r.textAnchorOffsets.get(i);if(p&&n.textAnchor!==p)continue;const c=this.attemptAnchorPlacement(n,t,d,m,g,b,w,u,E,l,f,P,e,r,o,a,s,y,C);if(c&&(x=c.placedGlyphBoxes,x&&x.placeable))return z=!0,D=c.shift,x}p?p=null:P=_}return n&&!x&&(x={box:this.collisionIndex.placeCollisionBox(Z,"always",u,E,l,w,b,a,f.predicate,C,void 0,k).box,offscreen:!1,placeable:!1,occluded:!1}),x};o(()=>m(Z,d.iconBox,t.az.horizontal),()=>{const i=d.verticalTextBox;return r.allowVerticalPlacement&&(!R||!R.placeable)&&e.numVerticalGlyphVertices>0&&i?m(i,d.verticalIconBox,t.az.vertical):{box:null,occluded:!0,offscreen:null}}),R&&(z=R.placeable,L=R.offscreen);const g=i(R&&R.placeable);if(!z&&this.prevPlacement){const t=this.prevPlacement.variableOffsets[e.crossTileID];t&&(this.variableOffsets[e.crossTileID]=t,this.markUsedJustification(r,t.anchor,e,g))}}}if(B=R,z=B&&B.placeable,L=B&&B.offscreen,e.useRuntimeCollisionCircles&&e.centerJustifiedTextSymbolIndex>=0){const i=r.text.placedSymbolArray.get(e.centerJustifiedTextSymbolIndex),s=t.aA(r.textSizeData,p,i),u=o.get("text-padding");O=this.collisionIndex.placeCollisionCircles(_,i,r.lineVertexArray,r.glyphOffsetArray,s,l,c,n,w,f.predicate,e.collisionCircleDiameter,u,a,C),O.circles.length&&O.collisionDetected&&!n&&t.w("Collisions detected, but collision boxes are not shown"),z=y||O.circles.length>0&&!O.collisionDetected,L=L&&O.offscreen}if(d.iconFeatureIndex&&(U=d.iconFeatureIndex),d.iconBox){const e=e=>this.collisionIndex.placeCollisionBox(e,v,u,E,l,w,b,s,f.predicate,C,T&&D?D:void 0,k);F&&F.placeable&&d.verticalIconBox?(N=e(d.verticalIconBox),A=N.placeable):(N=e(d.iconBox),A=N.placeable),L=L&&N.offscreen}const G=m||0===e.numHorizontalGlyphVertices&&0===e.numVerticalGlyphVertices,q=g||0===e.numIconVertices;G||q?q?G||(A=A&&z):z=A&&z:A=z=A&&z;const $=A&&N.placeable;if(z&&B.placeable&&this.collisionIndex.insertCollisionBox(B.box,_,o.get("text-ignore-placement"),r.bucketInstanceId,F&&F.placeable&&V?V:j,f.ID),$&&this.collisionIndex.insertCollisionBox(N.box,v,o.get("icon-ignore-placement"),r.bucketInstanceId,U,f.ID),O&&z&&this.collisionIndex.insertCollisionCircles(O.circles,_,o.get("text-ignore-placement"),r.bucketInstanceId,j,f.ID),n&&this.storeCollisionData(r.bucketInstanceId,x,d,B,N,O),0===e.crossTileID)throw new Error("symbolInstance.crossTileID can't be 0");if(0===r.bucketInstanceId)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[e.crossTileID]=new ht((z||P)&&!(null==B?void 0:B.occluded),(A||M)&&!(null==N?void 0:N.occluded),L||r.justReloaded),i[e.crossTileID]=!0};if(S){if(0!==e.symbolInstanceStart)throw new Error("bucket.bucketInstanceId should be 0");const t=r.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let e=t.length-1;e>=0;--e){const i=t[e];I(r.symbolInstances.get(i),r.collisionArrays[i],i)}}else for(let t=e.symbolInstanceStart;t<e.symbolInstanceEnd;t++)I(r.symbolInstances.get(t),r.collisionArrays[t],t);r.justReloaded=!1}storeCollisionData(e,t,i,n,r,o){if(i.textBox||i.iconBox){let o,a;this.collisionBoxArrays.has(e)?o=this.collisionBoxArrays.get(e):(o=new Map,this.collisionBoxArrays.set(e,o)),o.has(t)?a=o.get(t):(a={text:null,icon:null},o.set(t,a)),i.textBox&&(a.text=n.box),i.iconBox&&(a.icon=r.box)}if(o){let t=this.collisionCircleArrays[e];void 0===t&&(t=this.collisionCircleArrays[e]=[]);for(let e=0;e<o.circles.length;e+=4)t.push(o.circles[e+0]-st),t.push(o.circles[e+1]-st),t.push(o.circles[e+2]),t.push(o.collisionDetected?1:0)}}markUsedJustification(e,i,n,r){let o;o=r===t.az.vertical?n.verticalPlacedTextSymbolIndex:{left:n.leftJustifiedTextSymbolIndex,center:n.centerJustifiedTextSymbolIndex,right:n.rightJustifiedTextSymbolIndex}[t.aR(i)];const a=[n.leftJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.rightJustifiedTextSymbolIndex,n.verticalPlacedTextSymbolIndex];for(const t of a)t>=0&&(e.text.placedSymbolArray.get(t).crossTileID=o>=0&&t!==o?0:n.crossTileID)}markUsedOrientation(e,i,n){const r=i===t.az.horizontal||i===t.az.horizontalOnly?i:0,o=i===t.az.vertical?i:0,a=[n.leftJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.rightJustifiedTextSymbolIndex];for(const t of a)e.text.placedSymbolArray.get(t).placedOrientation=r;n.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(n.verticalPlacedTextSymbolIndex).placedOrientation=o)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;const t=this.prevPlacement;let i=!1;this.prevZoomAdjustment=t?t.zoomAdjustment(this.transform.zoom):0;const n=t?t.symbolFadeChange(e):1,r=t?t.opacities:{},o=t?t.variableOffsets:{},a=t?t.placedOrientations:{};for(const s in this.placements){const e=this.placements[s],t=r[s];t?(this.opacities[s]=new ut(t,n,e.text,e.icon),i=i||e.text!==t.text.placed||e.icon!==t.icon.placed):(this.opacities[s]=new ut(null,n,e.text,e.icon,e.skipFade),i=i||e.text||e.icon)}for(const s in r){const e=r[s];if(!this.opacities[s]){const t=new ut(e,n,!1,!1);t.isHidden()||(this.opacities[s]=t,i=i||e.text.placed||e.icon.placed)}}for(const s in o)this.variableOffsets[s]||!this.opacities[s]||this.opacities[s].isHidden()||(this.variableOffsets[s]=o[s]);for(const s in a)this.placedOrientations[s]||!this.opacities[s]||this.opacities[s].isHidden()||(this.placedOrientations[s]=a[s]);if(t&&void 0===t.lastPlacementChangeTime)throw new Error("Last placement time for previous placement is not defined");i?this.lastPlacementChangeTime=e:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=t?t.lastPlacementChangeTime:e)}updateLayerOpacities(e,t){const i={};for(const n of t){const t=n.getBucket(e);t&&n.latestFeatureIndex&&e.id===t.layerIds[0]&&this.updateBucketOpacities(t,n.tileID,i,n.collisionBoxArray)}}updateBucketOpacities(e,i,n,r){e.hasTextData()&&(e.text.opacityVertexArray.clear(),e.text.hasVisibleVertices=!1),e.hasIconData()&&(e.icon.opacityVertexArray.clear(),e.icon.hasVisibleVertices=!1),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();const o=e.layers[0],a=o.layout,s=new ut(null,0,!1,!1,!0),l=a.get("text-allow-overlap"),c=a.get("icon-allow-overlap"),u=o._unevaluatedLayout.hasValue("text-variable-anchor")||o._unevaluatedLayout.hasValue("text-variable-anchor-offset"),h="map"===a.get("text-rotation-alignment"),d="map"===a.get("text-pitch-alignment"),p="none"!==a.get("icon-text-fit"),f=new ut(null,0,l&&(c||!e.hasIconData()||a.get("icon-optional")),c&&(l||!e.hasTextData()||a.get("text-optional")),!0);!e.collisionArrays&&r&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(r);const m=(e,t,i)=>{for(let n=0;n<t/4;n++)e.opacityVertexArray.emplaceBack(i);e.hasVisibleVertices=e.hasVisibleVertices||i!==Pt},g=this.collisionBoxArrays.get(e.bucketInstanceId);for(let _=0;_<e.symbolInstances.length;_++){const i=e.symbolInstances.get(_),{numHorizontalGlyphVertices:r,numVerticalGlyphVertices:o,crossTileID:a}=i;let l=this.opacities[a];n[a]?l=s:l||(l=f,this.opacities[a]=l),n[a]=!0;const c=i.numIconVertices>0,y=this.placedOrientations[i.crossTileID],v=y===t.az.vertical,x=y===t.az.horizontal||y===t.az.horizontalOnly;if(r>0||o>0){const t=St(l.text);m(e.text,r,v?Pt:t),m(e.text,o,x?Pt:t);const n=l.text.isHidden();[i.rightJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.leftJustifiedTextSymbolIndex].forEach(t=>{t>=0&&(e.text.placedSymbolArray.get(t).hidden=n||v?1:0)}),i.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(i.verticalPlacedTextSymbolIndex).hidden=n||x?1:0);const a=this.variableOffsets[i.crossTileID];a&&this.markUsedJustification(e,a.anchor,i,y);const s=this.placedOrientations[i.crossTileID];s&&(this.markUsedJustification(e,"left",i,s),this.markUsedOrientation(e,s,i))}if(c){const t=St(l.icon),n=!(p&&i.verticalPlacedIconSymbolIndex&&v);i.placedIconSymbolIndex>=0&&(m(e.icon,i.numIconVertices,n?t:Pt),e.icon.placedSymbolArray.get(i.placedIconSymbolIndex).hidden=l.icon.isHidden()),i.verticalPlacedIconSymbolIndex>=0&&(m(e.icon,i.numVerticalIconVertices,n?Pt:t),e.icon.placedSymbolArray.get(i.verticalPlacedIconSymbolIndex).hidden=l.icon.isHidden())}const b=g&&g.has(_)?g.get(_):{text:null,icon:null};if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){const i=e.collisionArrays[_];if(i){let n=new t.P(0,0);if(i.textBox||i.verticalTextBox){let t=!0;if(u){const e=this.variableOffsets[a];e?(n=ft(e.anchor,e.width,e.height,e.textOffset,e.textBoxScale),h&&n._rotate(d?-this.transform.bearingInRadians:this.transform.bearingInRadians)):t=!1}if(i.textBox||i.verticalTextBox){let r;i.textBox&&(r=v),i.verticalTextBox&&(r=x),gt(e.textCollisionBox.collisionVertexArray,l.text.placed,!t||r,b.text,n.x,n.y)}}if(i.iconBox||i.verticalIconBox){const t=Boolean(!x&&i.verticalIconBox);let r;i.iconBox&&(r=t),i.verticalIconBox&&(r=!t),gt(e.iconCollisionBox.collisionVertexArray,l.icon.placed,r,b.icon,p?n.x:0,p?n.y:0)}}}}if(e.sortFeatures(-this.transform.bearingInRadians),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.text.opacityVertexArray.length!==e.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${e.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${e.text.layoutVertexArray.length}) / 4`);if(e.icon.opacityVertexArray.length!==e.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${e.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${e.icon.layoutVertexArray.length}) / 4`);e.bucketInstanceId in this.collisionCircleArrays&&(e.collisionCircleArray=this.collisionCircleArrays[e.bucketInstanceId],delete this.collisionCircleArrays[e.bucketInstanceId])}symbolFadeChange(e){return 0===this.fadeDuration?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(e,t){const i=this.zoomAtLastRecencyCheck===t?1-this.zoomAdjustment(t):1;return this.zoomAtLastRecencyCheck=t,this.commitTime+this.fadeDuration*i>e}setStale(){this.stale=!0}}function gt(e,t,i,n,r,o){n&&0!==n.length||(n=[0,0,0,0]);const a=n[0]-st,s=n[1]-st,l=n[2]-st,c=n[3]-st;e.emplaceBack(t?1:0,i?1:0,r||0,o||0,a,s),e.emplaceBack(t?1:0,i?1:0,r||0,o||0,l,s),e.emplaceBack(t?1:0,i?1:0,r||0,o||0,l,c),e.emplaceBack(t?1:0,i?1:0,r||0,o||0,a,c)}const _t=Math.pow(2,25),yt=Math.pow(2,24),vt=Math.pow(2,17),xt=Math.pow(2,16),bt=Math.pow(2,9),wt=Math.pow(2,8),Tt=Math.pow(2,1);function St(e){if(0===e.opacity&&!e.placed)return 0;if(1===e.opacity&&e.placed)return 4294967295;const t=e.placed?1:0,i=Math.floor(127*e.opacity);return i*_t+t*yt+i*vt+t*xt+i*bt+t*wt+i*Tt+t}const Pt=0;class Mt{constructor(e){this._sortAcrossTiles="viewport-y"!==e.layout.get("symbol-z-order")&&!e.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(e,t,i,n,r){const o=this._bucketParts;for(;this._currentTileIndex<e.length;)if(t.getBucketParts(o,n,e[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,r())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,o.sort((e,t)=>e.sortKey-t.sortKey));this._currentPartIndex<o.length;)if(t.placeLayerBucketPart(o[this._currentPartIndex],this._seenCrossTileIDs,i),this._currentPartIndex++,r())return!0;return!1}}class Et{constructor(e,t,i,n,r,o,a,s){this.placement=new mt(e,t,o,a,s),this._currentPlacementIndex=i.length-1,this._forceFullPlacement=n,this._showCollisionBoxes=r,this._done=!1}isDone(){return this._done}continuePlacement(e,t,i){const n=c(),r=()=>!this._forceFullPlacement&&c()-n>2;for(;this._currentPlacementIndex>=0;){const n=t[e[this._currentPlacementIndex]],o=this.placement.collisionIndex.transform.zoom;if("symbol"===n.type&&(!n.minzoom||n.minzoom<=o)&&(!n.maxzoom||n.maxzoom>o)){if(this._inProgressLayer||(this._inProgressLayer=new Mt(n)),this._inProgressLayer.continuePlacement(i[n.source],this.placement,this._showCollisionBoxes,n,r))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}}const Ct=512/t.a5/2;class kt{constructor(e,i,n){this.tileID=e,this.bucketInstanceId=n,this._symbolsByKey={};const r=new Map;for(let t=0;t<i.length;t++){const e=i.get(t),n=e.key,o=r.get(n);o?o.push(e):r.set(n,[e])}for(const[o,a]of r){const e={positions:a.map(e=>({x:Math.floor(e.anchorX*Ct),y:Math.floor(e.anchorY*Ct)})),crossTileIDs:a.map(e=>e.crossTileID)};if(e.positions.length>128){const i=new t.aT(e.positions.length,16,Uint16Array);for(const{x:t,y:n}of e.positions)i.add(t,n);i.finish(),delete e.positions,e.index=i}this._symbolsByKey[o]=e}}getScaledCoordinates(e,i){const{x:n,y:r,z:o}=this.tileID.canonical,{x:a,y:s,z:l}=i.canonical,c=Ct/Math.pow(2,l-o),u=(s*t.a5+e.anchorY)*c,h=r*t.a5*Ct;return{x:Math.floor((a*t.a5+e.anchorX)*c-n*t.a5*Ct),y:Math.floor(u-h)}}findMatches(e,t,i){const n=this.tileID.canonical.z<t.canonical.z?1:Math.pow(2,this.tileID.canonical.z-t.canonical.z);for(let r=0;r<e.length;r++){const o=e.get(r);if(o.crossTileID)continue;const a=this._symbolsByKey[o.key];if(!a)continue;const s=this.getScaledCoordinates(o,t);if(a.index){const e=a.index.range(s.x-n,s.y-n,s.x+n,s.y+n).sort();for(const t of e){const e=a.crossTileIDs[t];if(!i[e]){i[e]=!0,o.crossTileID=e;break}}}else if(a.positions)for(let e=0;e<a.positions.length;e++){const t=a.positions[e],r=a.crossTileIDs[e];if(Math.abs(t.x-s.x)<=n&&Math.abs(t.y-s.y)<=n&&!i[r]){i[r]=!0,o.crossTileID=r;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:e})=>e)}}class It{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class zt{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){const t=Math.round((e-this.lng)/360);if(0!==t)for(const i in this.indexes){const e=this.indexes[i],n={};for(const i in e){const r=e[i];r.tileID=r.tileID.unwrapTo(r.tileID.wrap+t),n[r.tileID.key]=r}this.indexes[i]=n}this.lng=e}addBucket(e,t,i){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===t.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let r=0;r<t.symbolInstances.length;r++)t.symbolInstances.get(r).crossTileID=0;this.usedCrossTileIDs[e.overscaledZ]||(this.usedCrossTileIDs[e.overscaledZ]={});const n=this.usedCrossTileIDs[e.overscaledZ];for(const r in this.indexes){const i=this.indexes[r];if(Number(r)>e.overscaledZ)for(const r in i){const o=i[r];o.tileID.isChildOf(e)&&o.findMatches(t.symbolInstances,e,n)}else{const o=i[e.scaledTo(Number(r)).key];o&&o.findMatches(t.symbolInstances,e,n)}}for(let r=0;r<t.symbolInstances.length;r++){const e=t.symbolInstances.get(r);e.crossTileID||(e.crossTileID=i.generate(),n[e.crossTileID]=!0)}return void 0===this.indexes[e.overscaledZ]&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new kt(e,t.symbolInstances,t.bucketInstanceId),!0}removeBucketCrossTileIDs(e,t){for(const i of t.getCrossTileIDsLists())for(const t of i)delete this.usedCrossTileIDs[e][t]}removeStaleBuckets(e){let t=!1;for(const i in this.indexes){const n=this.indexes[i];for(const r in n)e[n[r].bucketInstanceId]||(this.removeBucketCrossTileIDs(i,n[r]),delete n[r],t=!0)}return t}}class At{constructor(){this.layerIndexes={},this.crossTileIDs=new It,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,t,i){let n=this.layerIndexes[e.id];void 0===n&&(n=this.layerIndexes[e.id]=new zt);let r=!1;const o={};n.handleWrapJump(i);for(const a of t){const t=a.getBucket(e);t&&e.id===t.layerIds[0]&&(t.bucketInstanceId||(t.bucketInstanceId=++this.maxBucketInstanceId),n.addBucket(a.tileID,t,this.crossTileIDs)&&(r=!0),o[t.bucketInstanceId]=!0)}return n.removeStaleBuckets(o)&&(r=!0),r}pruneUnusedLayers(e){const t={};e.forEach(e=>{t[e]=!0});for(const i in this.layerIndexes)t[i]||delete this.layerIndexes[i]}}var Lt="void main() {fragColor=vec4(1.0);}";const Dt={prelude:Rt("#ifdef GL_ES\nprecision mediump float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nout highp vec4 fragColor;","#ifdef GL_ES\nprecision highp float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nvec2 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\n);}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;}mat3 rotationMatrixFromAxisAngle(vec3 u,float angle) {float c=cos(angle);float s=sin(angle);float c2=1.0-c;return mat3(u.x*u.x*c2+ c,u.x*u.y*c2-u.z*s,u.x*u.z*c2+u.y*s,u.y*u.x*c2+u.z*s,u.y*u.y*c2+ c,u.y*u.z*c2-u.x*s,u.z*u.x*c2-u.y*s,u.z*u.y*c2+u.x*s,u.z*u.z*c2+ c\n);}\n#ifdef TERRAIN3D\nuniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;\n#endif\nconst highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {\n#ifdef TERRAIN3D\nhighp float d=unpack(texture(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));\n#else\nreturn 1.0;\n#endif\n}float calculate_visibility(vec4 pos) {\n#ifdef TERRAIN3D\nvec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;\n#else\nreturn 1.0;\n#endif\n}float ele(vec2 pos) {\n#ifdef TERRAIN3D\nvec4 rgb=(texture(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;\n#else\nreturn 0.0;\n#endif\n}float get_elevation(vec2 pos) {\n#ifdef TERRAIN3D\n#ifdef GLOBE\nif ((pos.y <-32767.5) || (pos.y > 32766.5)) {return 0.0;}\n#endif\nvec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;\n#else\nreturn 0.0;\n#endif\n}const float PI=3.141592653589793;uniform mat4 u_projection_matrix;"),projectionMercator:Rt("","float projectLineThickness(float tileY) {return 1.0;}float projectCircleRadius(float tileY) {return 1.0;}vec4 projectTile(vec2 p) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);return result;}vec4 projectTile(vec2 p,vec2 rawPos) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);if (rawPos.y <-32767.5 || rawPos.y > 32766.5) {result.z=-10000000.0;}return result;}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_projection_matrix*vec4(posInTile,elevation,1.0);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {return projectTileWithElevation(posInTile,elevation);}"),projectionGlobe:Rt("","#define GLOBE_RADIUS 6371008.8\nuniform highp vec4 u_projection_tile_mercator_coords;uniform highp vec4 u_projection_clipping_plane;uniform highp float u_projection_transition;uniform mat4 u_projection_fallback_matrix;vec3 globeRotateVector(vec3 vec,vec2 angles) {vec3 axisRight=vec3(vec.z,0.0,-vec.x);vec3 axisUp=cross(axisRight,vec);axisRight=normalize(axisRight);axisUp=normalize(axisUp);vec2 t=tan(angles);return normalize(vec+axisRight*t.x+axisUp*t.y);}mat3 globeGetRotationMatrix(vec3 spherePos) {vec3 axisRight=vec3(spherePos.z,0.0,-spherePos.x);vec3 axisDown=cross(axisRight,spherePos);axisRight=normalize(axisRight);axisDown=normalize(axisDown);return mat3(axisRight,axisDown,spherePos\n);}float circumferenceRatioAtTileY(float tileY) {float mercator_pos_y=u_projection_tile_mercator_coords.y+u_projection_tile_mercator_coords.w*tileY;float spherical_y=2.0*atan(exp(PI-(mercator_pos_y*PI*2.0)))-PI*0.5;return cos(spherical_y);}float projectLineThickness(float tileY) {float thickness=1.0/circumferenceRatioAtTileY(tileY); \nif (u_projection_transition < 0.999) {return mix(1.0,thickness,u_projection_transition);} else {return thickness;}}vec3 projectToSphere(vec2 translatedPos,vec2 rawPos) {vec2 mercator_pos=u_projection_tile_mercator_coords.xy+u_projection_tile_mercator_coords.zw*translatedPos;vec2 spherical;spherical.x=mercator_pos.x*PI*2.0+PI;spherical.y=2.0*atan(exp(PI-(mercator_pos.y*PI*2.0)))-PI*0.5;float len=cos(spherical.y);vec3 pos=vec3(sin(spherical.x)*len,sin(spherical.y),cos(spherical.x)*len\n);if (rawPos.y <-32767.5) {pos=vec3(0.0,1.0,0.0);}if (rawPos.y > 32766.5) {pos=vec3(0.0,-1.0,0.0);}return pos;}vec3 projectToSphere(vec2 posInTile) {return projectToSphere(posInTile,vec2(0.0,0.0));}float globeComputeClippingZ(vec3 spherePos) {return (1.0-(dot(spherePos,u_projection_clipping_plane.xyz)+u_projection_clipping_plane.w));}vec4 interpolateProjection(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);globePosition.z=globeComputeClippingZ(elevatedPos)*globePosition.w;if (u_projection_transition > 0.999) {return globePosition;}vec4 flatPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);const float z_globeness_threshold=0.2;vec4 result=globePosition;result.z=mix(0.0,globePosition.z,clamp((u_projection_transition-z_globeness_threshold)/(1.0-z_globeness_threshold),0.0,1.0));result.xyw=mix(flatPosition.xyw,globePosition.xyw,u_projection_transition);if ((posInTile.y <-32767.5) || (posInTile.y > 32766.5)) {result=globePosition;const float poles_hidden_anim_percentage=0.02;result.z=mix(globePosition.z,100.0,pow(max((1.0-u_projection_transition)/poles_hidden_anim_percentage,0.0),8.0));}return result;}vec4 interpolateProjectionFor3D(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);if (u_projection_transition > 0.999) {return globePosition;}vec4 fallbackPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);return mix(fallbackPosition,globePosition,u_projection_transition);}vec4 projectTile(vec2 posInTile) {return interpolateProjection(posInTile,projectToSphere(posInTile),0.0);}vec4 projectTile(vec2 posInTile,vec2 rawPos) {return interpolateProjection(posInTile,projectToSphere(posInTile,rawPos),0.0);}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return interpolateProjection(posInTile,projectToSphere(posInTile),elevation);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {vec3 spherePos=projectToSphere(posInTile,posInTile);return interpolateProjectionFor3D(posInTile,spherePos,elevation);}"),background:Rt("uniform vec4 u_color;uniform float u_opacity;void main() {fragColor=u_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),backgroundPattern:Rt("uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_mix)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;void main() {gl_Position=projectTile(a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:Rt("in vec3 v_data;in float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);float antialiased_blur=v_data.z;float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));fragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);const float epsilon=0.5/255.0;if (fragColor.r < epsilon && fragColor.g < epsilon && fragColor.b < epsilon && fragColor.a < epsilon) {discard;}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform highp float u_globe_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;uniform vec2 u_translate;in vec2 a_pos;out vec3 v_data;out float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 pos_raw=a_pos+32768.0;vec2 extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);vec2 circle_center=floor(pos_raw/8.0)+u_translate;float ele=get_elevation(circle_center);v_visibility=calculate_visibility(projectTileWithElevation(circle_center,ele));if (u_pitch_with_map) {\n#ifdef GLOBE\nvec3 center_vector=projectToSphere(circle_center);\n#endif\nfloat angle_scale=u_globe_extrude_scale;vec2 corner_position=circle_center;if (u_scale_with_map) {angle_scale*=(radius+stroke_width);corner_position+=extrude*u_extrude_scale*(radius+stroke_width);} else {\n#ifdef GLOBE\nvec4 projected_center=interpolateProjection(circle_center,center_vector,ele);\n#else\nvec4 projected_center=projectTileWithElevation(circle_center,ele);\n#endif\ncorner_position+=extrude*u_extrude_scale*(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);angle_scale*=(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);}\n#ifdef GLOBE\nvec2 angles=extrude*angle_scale;vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(corner_position,corner_vector,ele);\n#else\ngl_Position=projectTileWithElevation(corner_position,ele);\n#endif\n} else {gl_Position=projectTileWithElevation(circle_center,ele);if (gl_Position.z/gl_Position.w > 1.0) {gl_Position.xy=vec2(10000.0);}if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}float antialiasblur=-max(1.0/u_device_pixel_ratio/(radius+stroke_width),blur);v_data=vec3(extrude.x,extrude.y,antialiasblur);}"),clippingMask:Rt(Lt,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),heatmap:Rt("uniform highp float u_intensity;in vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);fragColor=vec4(val,1.0,1.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;uniform highp float u_globe_extrude_scale;in vec2 a_pos;out vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 pos_raw=a_pos+32768.0;vec2 unscaled_extrude=vec2(mod(pos_raw,8.0)/7.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 circle_center=floor(pos_raw/8.0);\n#ifdef GLOBE\nvec2 angles=v_extrude*radius*u_globe_extrude_scale;vec3 center_vector=projectToSphere(circle_center);vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(circle_center+extrude,corner_vector,0.0);\n#else\ngl_Position=projectTileFor3D(circle_center+extrude,get_elevation(circle_center));\n#endif\n}"),heatmapTexture:Rt("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));fragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(0.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:Rt("in float v_placed;in float v_notUsed;void main() {float alpha=0.5;fragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {fragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {fragColor*=.1;}}","in vec2 a_anchor_pos;in vec2 a_placed;in vec2 a_box_real;uniform vec2 u_pixel_extrude_scale;out float v_placed;out float v_notUsed;void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:Rt("in float v_radius;in vec2 v_extrude;in float v_collision;void main() {float alpha=0.5;float stroke_radius=0.9;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);fragColor=color*alpha*opacity_t;}","in vec2 a_pos;in float a_radius;in vec2 a_flags;uniform vec2 u_viewport_size;out float v_radius;out vec2 v_extrude;out float v_collision;void main() {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;float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_collision=collision;gl_Position=vec4((a_pos/u_viewport_size*2.0-1.0)*vec2(1.0,-1.0),0.0,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),colorRelief:Rt("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;uniform vec4 u_unpack;uniform sampler2D u_elevation_stops;uniform sampler2D u_color_stops;uniform int u_color_ramp_size;uniform float u_opacity;in vec2 v_pos;float getElevation(vec2 coord) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}float getElevationStop(int stop) {float x=(float(stop)+0.5)/float(u_color_ramp_size);vec4 data=texture(u_elevation_stops,vec2(x,0))*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {float el=getElevation(v_pos);int r=(u_color_ramp_size-1);int l=0;float el_l=getElevationStop(l);float el_r=getElevationStop(r);while(r-l > 1){int m=(r+l)/2;float el_m=getElevationStop(m);if(el < el_m){r=m;el_r=el_m;}else\n{l=m;el_l=el_m;}}float x=(float(l)+(el-el_l)/(el_r-el_l)+0.5)/float(u_color_ramp_size);fragColor=u_opacity*texture(u_color_stops,vec2(x,0));\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_dimension;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_pos/8192.0)*scale+epsilon;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),debug:Rt("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);fragColor=mix(u_color,overlay_color,overlay_color.a);}","in vec2 a_pos;out vec2 v_uv;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=projectTileWithElevation(a_pos*u_overlay_scale,get_elevation(a_pos));}"),depth:Rt(Lt,"in vec2 a_pos;void main() {\n#ifdef GLOBE\ngl_Position=projectTileFor3D(a_pos,0.0);\n#else\ngl_Position=u_projection_matrix*vec4(a_pos,0.0,1.0);\n#endif\n}"),fill:Rt("#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\nfragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_fill_translate;in vec2 a_pos;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=projectTile(a_pos+u_fill_translate,a_pos);}"),fillOutline:Rt("in vec2 v_pos;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=outline_color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_world;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n}"),fillOutlinePattern:Rt("uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;in vec2 v_pos_a;in vec2 v_pos_b;in vec2 v_pos;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;out vec2 v_pos;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n}"),fillPattern:Rt("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}"),fillExtrusion:Rt("in vec4 v_color;void main() {fragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;in vec2 a_pos;in vec4 a_normal_ed;\n#ifdef TERRAIN3D\nin vec2 a_centroid;\n#endif\nout vec4 v_color;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec3 normal=a_normal_ed.xyz;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;\n#ifdef GLOBE\nvec3 spherePos=projectToSphere(posInTile,a_pos);gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);\n#else\ngl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);\n#endif\nfloat colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;vec3 normalForLighting=normal/16384.0;float directional=clamp(dot(normalForLighting,u_lightpos),0.0,1.0);\n#ifdef GLOBE\nmat3 rotMatrix=globeGetRotationMatrix(spherePos);normalForLighting=rotMatrix*normalForLighting;directional=mix(directional,clamp(dot(normalForLighting,u_lightpos_globe),0.0,1.0),u_projection_transition);\n#endif\ndirectional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}"),fillExtrusionPattern:Rt("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;in vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);fragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;in vec2 a_pos;in vec4 a_normal_ed;\n#ifdef TERRAIN3D\nin vec2 a_centroid;\n#endif\n#ifdef GLOBE\nout vec3 v_sphere_pos;\n#endif\nout vec2 v_pos_a;out vec2 v_pos_b;out vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;\n#ifdef GLOBE\nvec3 spherePos=projectToSphere(posInTile,a_pos);vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);v_sphere_pos=elevatedPos;gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);\n#else\ngl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);\n#endif\nvec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\n? a_pos\n: vec2(edgedistance,elevation*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}"),hillshadePrepare:Rt("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {vec2 epsilon=1.0/u_dimension;float tileSize=u_dimension.x-2.0;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))*tileSize/pow(2.0,exaggeration+(28.2562-u_zoom));fragColor=clamp(vec4(deriv.x/8.0+0.5,deriv.y/8.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out 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:Rt("uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform float u_exaggeration;uniform vec4 u_accent;uniform int u_method;uniform float u_altitudes[NUM_ILLUMINATION_SOURCES];uniform float u_azimuths[NUM_ILLUMINATION_SOURCES];uniform vec4 u_shadows[NUM_ILLUMINATION_SOURCES];uniform vec4 u_highlights[NUM_ILLUMINATION_SOURCES];\n#define PI 3.141592653589793\n#define STANDARD 0\n#define COMBINED 1\n#define IGOR 2\n#define MULTIDIRECTIONAL 3\n#define BASIC 4\nfloat get_aspect(vec2 deriv){return deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);}void igor_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float aspect=get_aspect(deriv);float azimuth=u_azimuths[0]+PI;float slope_stength=atan(length(deriv))*2.0/PI;float aspect_strength=1.0-abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);float shadow_strength=slope_stength*aspect_strength;float highlight_strength=slope_stength*(1.0-aspect_strength);fragColor=u_shadows[0]*shadow_strength+u_highlights[0]*highlight_strength;}void standard_hillshade(vec2 deriv){float azimuth=u_azimuths[0]+PI;float slope=atan(0.625*length(deriv));float aspect=get_aspect(deriv);float intensity=u_exaggeration;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_shadows[0],u_highlights[0],shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);fragColor=accent_color*(1.0-shade_color.a)+shade_color;}void basic_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor=u_highlights[0]*(2.0*shade-1.0);}else\n{fragColor=u_shadows[0]*(1.0-2.0*shade);}}void multidirectional_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;fragColor=vec4(0,0,0,0);for(int i=0; i < NUM_ILLUMINATION_SOURCES; i++){float cos_alt=cos(u_altitudes[i]);float sin_alt=sin(u_altitudes[i]);float cos_az=-cos(u_azimuths[i]);float sin_az=-sin(u_azimuths[i]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor+=u_highlights[i]*(2.0*shade-1.0)/float(NUM_ILLUMINATION_SOURCES);}else\n{fragColor+=u_shadows[i]*(1.0-2.0*shade)/float(NUM_ILLUMINATION_SOURCES);}}}void combined_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=acos((sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv)));cang=clamp(cang,0.0,PI/2.0);float shade=cang*atan(length(deriv))*4.0/PI/PI;float highlight=(PI/2.0-cang)*atan(length(deriv))*4.0/PI/PI;fragColor=u_shadows[0]*shade+u_highlights[0]*highlight;}void main() {vec4 pixel=texture(u_image,v_pos);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));vec2 deriv=((pixel.rg*8.0)-4.0)/scaleFactor;if (u_method==BASIC) {basic_hillshade(deriv);} else if (u_method==COMBINED) {combined_hillshade(deriv);} else if (u_method==IGOR) {igor_hillshade(deriv);} else if (u_method==MULTIDIRECTIONAL) {multidirectional_hillshade(deriv);} else if (u_method==STANDARD) {standard_hillshade(deriv);} else {standard_hillshade(deriv);}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);v_pos=a_pos/8192.0;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),line:Rt("uniform lowp float u_device_pixel_ratio;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat 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);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp float v_linesofar;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}"),lineGradient:Rt("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec2 v_uv;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture(u_image,v_uv);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;in float a_uv_x;in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}"),linePattern:Rt("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;in vec2 v_normal;in vec2 v_width2;in float v_linesofar;in float v_gamma_scale;in float v_width;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture(u_image,pos_a),texture(u_image,pos_b),u_fade);fragColor=color*alpha*opacity;\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nin vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_linesofar;out float v_gamma_scale;out float v_width;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}"),lineSDF:Rt("uniform lowp float u_device_pixel_ratio;uniform lowp float u_lineatlas_width;uniform sampler2D u_image;uniform float u_mix;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define mediump vec4 dasharray_from\n#pragma mapbox: define mediump vec4 dasharray_to\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 dasharray_from\n#pragma mapbox: initialize mediump vec4 dasharray_to\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture(u_image,v_tex_a).a;float sdfdist_b=texture(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);float sdfgamma=(u_lineatlas_width/256.0/u_device_pixel_ratio)/min(dasharray_from.w,dasharray_to.w);alpha*=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nin vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;out vec2 v_width2;out vec2 v_tex_a;out vec2 v_tex_b;out float v_gamma_scale;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define mediump vec4 dasharray_from\n#pragma mapbox: define mediump vec4 dasharray_to\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 dasharray_from\n#pragma mapbox: initialize mediump vec4 dasharray_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nfloat u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}"),lineGradientSDF:Rt("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform sampler2D u_image_dash;uniform float u_mix;uniform lowp float u_lineatlas_width;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;in highp vec2 v_uv;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define mediump vec4 dasharray_from\n#pragma mapbox: define mediump vec4 dasharray_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 dasharray_from\n#pragma mapbox: initialize mediump vec4 dasharray_to\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture(u_image,v_uv);float sdfdist_a=texture(u_image_dash,v_tex_a).a;float sdfdist_b=texture(u_image_dash,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);float sdfgamma=(u_lineatlas_width/256.0)/min(dasharray_from.w,dasharray_to.w);float dash_alpha=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*dash_alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nin vec2 a_pos_normal;in vec4 a_data;in float a_uv_x;in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;out vec2 v_tex_a;out vec2 v_tex_b;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define mediump vec4 dasharray_from\n#pragma mapbox: define mediump vec4 dasharray_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 dasharray_from\n#pragma mapbox: initialize mediump vec4 dasharray_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;float texel_height=1.0/u_image_height;float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nfloat u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}"),raster:Rt("uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;in vec2 v_pos0;in 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=texture(u_image0,v_pos0);vec4 color1=texture(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);fragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;uniform vec4 u_coords_top;uniform vec4 u_coords_bottom;in vec2 a_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {vec2 fractionalPos=a_pos/8192.0;vec2 position=mix(mix(u_coords_top.xy,u_coords_top.zw,fractionalPos.x),mix(u_coords_bottom.xy,u_coords_bottom.zw,fractionalPos.x),fractionalPos.y);gl_Position=projectTile(position,position);v_pos0=((fractionalPos-0.5)/u_buffer_scale)+0.5;\n#ifdef GLOBE\nif (a_pos.y <-32767.5) {v_pos0.y=0.0;}if (a_pos.y > 32766.5) {v_pos0.y=1.0;}\n#endif\nv_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),symbolIcon:Rt("uniform sampler2D u_texture;in vec2 v_tex;in float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;fragColor=texture(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_tex;out float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}"),symbolSDF:Rt("#define SDF_PX 8.0\nuniform 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;in vec2 v_data0;in vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}fragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_data0;out vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}"),symbolTextAndIcon:Rt("#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform 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;in vec4 v_data0;in vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;fragColor=texture(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\nreturn;}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=texture(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);fragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec4 a_pos_offset;in vec4 a_data;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec4 v_data0;out vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map && !u_is_along_line) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}"),terrain:Rt("uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;uniform bool u_is_globe_mode;in vec2 v_texture_pos;in float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture(u_texture,vec2(v_texture_pos.x,1.0-v_texture_pos.y));if (!u_is_globe_mode && v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);fragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {fragColor=surface_color;}}","in vec3 a_pos3d;uniform mat4 u_fog_matrix;uniform float u_ele_delta;out vec2 v_texture_pos;out float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}"),terrainDepth:Rt("in float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {fragColor=pack(v_depth);}","in vec3 a_pos3d;uniform float u_ele_delta;out float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);v_depth=gl_Position.z/gl_Position.w;}"),terrainCoords:Rt("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;in vec2 v_texture_pos;void main() {vec4 rgba=texture(u_texture,v_texture_pos);fragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}","in vec3 a_pos3d;uniform float u_ele_delta;out vec2 v_texture_pos;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);}"),projectionErrorMeasurement:Rt("in vec4 v_output_error_encoded;void main() {fragColor=v_output_error_encoded;}","in vec2 a_pos;uniform highp float u_input;uniform highp float u_output_expected;out vec4 v_output_error_encoded;void main() {float real_output=2.0*atan(exp(PI-(u_input*PI*2.0)))-PI*0.5;float error=real_output-u_output_expected;float abs_error=abs(error)*128.0;v_output_error_encoded.x=min(floor(abs_error*256.0),255.0)/255.0;abs_error-=v_output_error_encoded.x;v_output_error_encoded.y=min(floor(abs_error*65536.0),255.0)/255.0;abs_error-=v_output_error_encoded.x/255.0;v_output_error_encoded.z=min(floor(abs_error*16777216.0),255.0)/255.0;v_output_error_encoded.w=error >=0.0 ? 1.0 : 0.0;gl_Position=vec4(a_pos,0.0,1.0);}"),atmosphere:Rt("#ifdef GL_ES\nprecision highp float;\n#endif\nin vec3 view_direction;uniform vec3 u_sun_pos;uniform vec3 u_globe_position;uniform float u_globe_radius;uniform float u_atmosphere_blend;/**Shader use from https:*Made some change to adapt to MapLibre Globe geometry*/const float PI=3.141592653589793;const int iSteps=5;const int jSteps=3;/*radius of the planet*/const float EARTH_RADIUS=6371e3;/*radius of the atmosphere*/const float ATMOS_RADIUS=6471e3;vec2 rsi(vec3 r0,vec3 rd,float sr) {float a=dot(rd,rd);float b=2.0*dot(rd,r0);float c=dot(r0,r0)-(sr*sr);float d=(b*b)-4.0*a*c;if (d < 0.0) return vec2(1e5,-1e5);return vec2((-b-sqrt(d))/(2.0*a),(-b+sqrt(d))/(2.0*a));}vec4 atmosphere(vec3 r,vec3 r0,vec3 pSun,float iSun,float rPlanet,float rAtmos,vec3 kRlh,float kMie,float shRlh,float shMie,float g) {pSun=normalize(pSun);r=normalize(r);vec2 p=rsi(r0,r,rAtmos);if (p.x > p.y) {return vec4(0.0,0.0,0.0,1.0);}if (p.x < 0.0) {p.x=0.0;}vec3 pos=r0+r*p.x;vec2 p2=rsi(r0,r,rPlanet);if (p2.x <=p2.y && p2.x > 0.0) {p.y=min(p.y,p2.x);}float iStepSize=(p.y-p.x)/float(iSteps);float iTime=p.x+iStepSize*0.5;vec3 totalRlh=vec3(0,0,0);vec3 totalMie=vec3(0,0,0);float iOdRlh=0.0;float iOdMie=0.0;float mu=dot(r,pSun);float mumu=mu*mu;float gg=g*g;float pRlh=3.0/(16.0*PI)*(1.0+mumu);float pMie=3.0/(8.0*PI)*((1.0-gg)*(mumu+1.0))/(pow(1.0+gg-2.0*mu*g,1.5)*(2.0+gg));for (int i=0; i < iSteps; i++) {vec3 iPos=r0+r*iTime;float iHeight=length(iPos)-rPlanet;float odStepRlh=exp(-iHeight/shRlh)*iStepSize;float odStepMie=exp(-iHeight/shMie)*iStepSize;iOdRlh+=odStepRlh;iOdMie+=odStepMie;float jStepSize=rsi(iPos,pSun,rAtmos).y/float(jSteps);float jTime=jStepSize*0.5;float jOdRlh=0.0;float jOdMie=0.0;for (int j=0; j < jSteps; j++) {vec3 jPos=iPos+pSun*jTime;float jHeight=length(jPos)-rPlanet;jOdRlh+=exp(-jHeight/shRlh)*jStepSize;jOdMie+=exp(-jHeight/shMie)*jStepSize;jTime+=jStepSize;}vec3 attn=exp(-(kMie*(iOdMie+jOdMie)+kRlh*(iOdRlh+jOdRlh)));totalRlh+=odStepRlh*attn;totalMie+=odStepMie*attn;iTime+=iStepSize;}float opacity=exp(-(length(kRlh)*length(totalRlh)+kMie*length(totalMie)));vec3 color=iSun*(pRlh*kRlh*totalRlh+pMie*kMie*totalMie);return vec4(color,opacity);}void main() {vec3 scale_camera_pos=-u_globe_position*EARTH_RADIUS/u_globe_radius;vec4 color=atmosphere(normalize(view_direction),scale_camera_pos,u_sun_pos,22.0,EARTH_RADIUS,ATMOS_RADIUS,vec3(5.5e-6,13.0e-6,22.4e-6),21e-6,8e3,1.2e3,0.758\n);color.rgb=1.0-exp(-1.0*color.rgb);color=pow(color,vec4(1.0/2.2));fragColor=vec4(color.rgb,1.0-color.a)*u_atmosphere_blend;}","in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 view_direction;void main() {view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,0.0,1.0);}"),sky:Rt("uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform vec2 u_horizon;uniform vec2 u_horizon_normal;uniform float u_sky_horizon_blend;uniform float u_sky_blend;void main() {float x=gl_FragCoord.x;float y=gl_FragCoord.y;float blend=(y-u_horizon.y)*u_horizon_normal.y+(x-u_horizon.x)*u_horizon_normal.x;if (blend > 0.0) {if (blend < u_sky_horizon_blend) {fragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {fragColor=u_sky_color;}}fragColor=mix(fragColor,vec4(vec3(0.0),0.0),u_sky_blend);}","in vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}")};function Rt(e,t){const i=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,n=t.match(/in ([\w]+) ([\w]+)/g),r=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),o=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),a=o?o.concat(r):r,s={};return{fragmentSource:e=e.replace(i,(e,t,i,n,r)=>(s[r]=!0,"define"===t?`\n#ifndef HAS_UNIFORM_u_${r}\nin ${i} ${n} ${r};\n#else\nuniform ${i} ${n} u_${r};\n#endif\n`:`\n#ifdef HAS_UNIFORM_u_${r}\n ${i} ${n} ${r} = u_${r};\n#endif\n`)),vertexSource:t=t.replace(i,(e,t,i,n,r)=>{const o="float"===n?"vec2":"vec4",a=r.match(/color/)?"color":o;return s[r]?"define"===t?`\n#ifndef HAS_UNIFORM_u_${r}\nuniform lowp float u_${r}_t;\nin ${i} ${o} a_${r};\nout ${i} ${n} ${r};\n#else\nuniform ${i} ${n} u_${r};\n#endif\n`:"vec4"===a?`\n#ifndef HAS_UNIFORM_u_${r}\n ${r} = a_${r};\n#else\n ${i} ${n} ${r} = u_${r};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${r}\n ${r} = unpack_mix_${a}(a_${r}, u_${r}_t);\n#else\n ${i} ${n} ${r} = u_${r};\n#endif\n`:"define"===t?`\n#ifndef HAS_UNIFORM_u_${r}\nuniform lowp float u_${r}_t;\nin ${i} ${o} a_${r};\n#else\nuniform ${i} ${n} u_${r};\n#endif\n`:"vec4"===a?`\n#ifndef HAS_UNIFORM_u_${r}\n ${i} ${n} ${r} = a_${r};\n#else\n ${i} ${n} ${r} = u_${r};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${r}\n ${i} ${n} ${r} = unpack_mix_${a}(a_${r}, u_${r}_t);\n#else\n ${i} ${n} ${r} = u_${r};\n#endif\n`}),staticAttributes:n,staticUniforms:a}}class Ft{constructor(e,t,i){this.vertexBuffer=e,this.indexBuffer=t,this.segments=i}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}var Bt=t.aU([{name:"a_pos",type:"Int16",components:2}]);const Ot="#define PROJECTION_MERCATOR",Nt="mercator";class jt{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return Nt}get shaderDefine(){return Ot}get shaderPreludeCode(){return Dt.projectionMercator}get vertexShaderPreludeCode(){return Dt.projectionMercator.vertexSource}get subdivisionGranularity(){return t.aV.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}get latitudeErrorCorrectionRadians(){return 0}destroy(){}updateGPUdependent(e){}getMeshFromTileID(e,i,n,r,o){if(this._cachedMesh)return this._cachedMesh;const a=new t.aW;a.emplaceBack(0,0),a.emplaceBack(t.a5,0),a.emplaceBack(0,t.a5),a.emplaceBack(t.a5,t.a5);const s=e.createVertexBuffer(a,Bt.members),l=t.aX.simpleSegment(0,0,4,2),c=new t.aY;c.emplaceBack(1,0,2),c.emplaceBack(1,2,3);const u=e.createIndexBuffer(c);return this._cachedMesh=new Ft(s,u,l),this._cachedMesh}recalculate(){}hasTransition(){return!1}setErrorQueryLatitudeDegrees(e){}}class Vt{constructor(e=0,t=0,i=0,n=0){if(isNaN(e)||e<0||isNaN(t)||t<0||isNaN(i)||i<0||isNaN(n)||n<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=e,this.bottom=t,this.left=i,this.right=n}interpolate(e,i,n){return null!=i.top&&null!=e.top&&(this.top=t.G.number(e.top,i.top,n)),null!=i.bottom&&null!=e.bottom&&(this.bottom=t.G.number(e.bottom,i.bottom,n)),null!=i.left&&null!=e.left&&(this.left=t.G.number(e.left,i.left,n)),null!=i.right&&null!=e.right&&(this.right=t.G.number(e.right,i.right,n)),this}getCenter(e,i){const n=t.an((this.left+e-this.right)/2,0,e),r=t.an((this.top+i-this.bottom)/2,0,i);return new t.P(n,r)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new Vt(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function Ut(e,t){if(!e.renderWorldCopies||e.lngRange)return;const i=t.lng-e.center.lng;t.lng+=i>180?-360:i<-180?360:0}function Zt(e){return Math.max(0,Math.floor(e))}class Gt{constructor(e,i){var n;this.applyConstrain=(e,t)=>null!==this._constrainOverride?this._constrainOverride(e,t):this._callbacks.defaultConstrain(e,t),this._callbacks=e,this._tileSize=512,this._renderWorldCopies=void 0===(null==i?void 0:i.renderWorldCopies)||!!(null==i?void 0:i.renderWorldCopies),this._minZoom=(null==i?void 0:i.minZoom)||0,this._maxZoom=(null==i?void 0:i.maxZoom)||22,this._minPitch=null==(null==i?void 0:i.minPitch)?0:null==i?void 0:i.minPitch,this._maxPitch=null==(null==i?void 0:i.maxPitch)?60:null==i?void 0:i.maxPitch,this._constrainOverride=null!==(n=null==i?void 0:i.constrainOverride)&&void 0!==n?n:null,this.setMaxBounds(),this._width=0,this._height=0,this._center=new t.V(0,0),this._elevation=0,this._zoom=0,this._tileZoom=Zt(this._zoom),this._scale=t.aq(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new Vt,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0}apply(e,i,n){this._constrainOverride=e.constrainOverride,this._latRange=e.latRange,this._lngRange=e.lngRange,this._width=e.width,this._height=e.height,this._center=e.center,this._elevation=e.elevation,this._minElevationForCurrentTile=e.minElevationForCurrentTile,this._zoom=e.zoom,this._tileZoom=Zt(this._zoom),this._scale=t.aq(this._zoom),this._bearingInRadians=e.bearingInRadians,this._fovInRadians=e.fovInRadians,this._pitchInRadians=e.pitchInRadians,this._rollInRadians=e.rollInRadians,this._unmodified=e.unmodified,this._edgeInsets=new Vt(e.padding.top,e.padding.bottom,e.padding.left,e.padding.right),this._minZoom=e.minZoom,this._maxZoom=e.maxZoom,this._minPitch=e.minPitch,this._maxPitch=e.maxPitch,this._renderWorldCopies=e.renderWorldCopies,this._cameraToCenterDistance=e.cameraToCenterDistance,this._nearZ=e.nearZ,this._farZ=e.farZ,this._autoCalculateNearFarZ=!n&&e.autoCalculateNearFarZ,i&&this.constrainInternal(),this._calcMatrices()}get pixelsToClipSpaceMatrix(){return this._pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._clipSpaceToPixelsMatrix}get minElevationForCurrentTile(){return this._minElevationForCurrentTile}setMinElevationForCurrentTile(e){this._minElevationForCurrentTile=e}get tileSize(){return this._tileSize}get tileZoom(){return this._tileZoom}get scale(){return this._scale}get width(){return this._width}get height(){return this._height}get bearingInRadians(){return this._bearingInRadians}get lngRange(){return this._lngRange}get latRange(){return this._latRange}get pixelsToGLUnits(){return this._pixelsToGLUnits}get minZoom(){return this._minZoom}setMinZoom(e){this._minZoom!==e&&(this._minZoom=e,this.setZoom(this.applyConstrain(this._center,this.zoom).zoom))}get maxZoom(){return this._maxZoom}setMaxZoom(e){this._maxZoom!==e&&(this._maxZoom=e,this.setZoom(this.applyConstrain(this._center,this.zoom).zoom))}get minPitch(){return this._minPitch}setMinPitch(e){this._minPitch!==e&&(this._minPitch=e,this.setPitch(Math.max(this.pitch,e)))}get maxPitch(){return this._maxPitch}setMaxPitch(e){this._maxPitch!==e&&(this._maxPitch=e,this.setPitch(Math.min(this.pitch,e)))}get renderWorldCopies(){return this._renderWorldCopies}setRenderWorldCopies(e){void 0===e?e=!0:null===e&&(e=!1),this._renderWorldCopies=e}get constrainOverride(){return this._constrainOverride}setConstrainOverride(e){void 0===e&&(e=null),this._constrainOverride!==e&&(this._constrainOverride=e,this.constrainInternal(),this._calcMatrices())}get worldSize(){return this._tileSize*this._scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new t.P(this._width,this._height)}get bearing(){return this._bearingInRadians/Math.PI*180}setBearing(e){const i=t.W(e,-180,180)*Math.PI/180;var r,o,a,s,l,c,u,h,d;this._bearingInRadians!==i&&(this._unmodified=!1,this._bearingInRadians=i,this._calcMatrices(),this._rotationMatrix=n(),r=this._rotationMatrix,a=-this._bearingInRadians,s=(o=this._rotationMatrix)[0],l=o[1],c=o[2],u=o[3],h=Math.sin(a),d=Math.cos(a),r[0]=s*d+c*h,r[1]=l*d+u*h,r[2]=s*-h+c*d,r[3]=l*-h+u*d)}get rotationMatrix(){return this._rotationMatrix}get pitchInRadians(){return this._pitchInRadians}get pitch(){return this._pitchInRadians/Math.PI*180}setPitch(e){const i=t.an(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitchInRadians!==i&&(this._unmodified=!1,this._pitchInRadians=i,this._calcMatrices())}get rollInRadians(){return this._rollInRadians}get roll(){return this._rollInRadians/Math.PI*180}setRoll(e){const t=e/180*Math.PI;this._rollInRadians!==t&&(this._unmodified=!1,this._rollInRadians=t,this._calcMatrices())}get fovInRadians(){return this._fovInRadians}get fov(){return t.aZ(this._fovInRadians)}setFov(e){e=t.an(e,.1,150),this.fov!==e&&(this._unmodified=!1,this._fovInRadians=t.ap(e),this._calcMatrices())}get zoom(){return this._zoom}setZoom(e){const i=this.applyConstrain(this._center,e).zoom;this._zoom!==i&&(this._unmodified=!1,this._zoom=i,this._tileZoom=Math.max(0,Math.floor(i)),this._scale=t.aq(i),this.constrainInternal(),this._calcMatrices())}get center(){return this._center}setCenter(e){e.lat===this._center.lat&&e.lng===this._center.lng||(this._unmodified=!1,this._center=e,this.constrainInternal(),this._calcMatrices())}get elevation(){return this._elevation}setElevation(e){e!==this._elevation&&(this._elevation=e,this.constrainInternal(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}setPadding(e){this._edgeInsets.equals(e)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,e,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this._width,this._height)}get pixelsPerMeter(){return this._pixelPerMeter}get unmodified(){return this._unmodified}get cameraToCenterDistance(){return this._cameraToCenterDistance}get nearZ(){return this._nearZ}get farZ(){return this._farZ}get autoCalculateNearFarZ(){return this._autoCalculateNearFarZ}overrideNearFarZ(e,t){this._autoCalculateNearFarZ=!1,this._nearZ=e,this._farZ=t,this._calcMatrices()}clearNearFarZOverride(){this._autoCalculateNearFarZ=!0,this._calcMatrices()}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,t,i){this._unmodified=!1,this._edgeInsets.interpolate(e,t,i),this.constrainInternal(),this._calcMatrices()}resize(e,t,i=!0){this._width=e,this._height=t,i&&this.constrainInternal(),this._calcMatrices()}getMaxBounds(){return this._latRange&&2===this._latRange.length&&this._lngRange&&2===this._lngRange.length?new W([this._lngRange[0],this._latRange[0]],[this._lngRange[1],this._latRange[1]]):null}setMaxBounds(e){e?(this._lngRange=[e.getWest(),e.getEast()],this._latRange=[e.getSouth(),e.getNorth()],this.constrainInternal()):(this._lngRange=null,this._latRange=[-t.ao,t.ao])}getCameraQueryGeometry(e,i){if(1===i.length)return[i[0],e];{const{minX:n,minY:r,maxX:o,maxY:a}=t.aa.fromPoints(i).extend(e);return[new t.P(n,r),new t.P(o,r),new t.P(o,a),new t.P(n,a),new t.P(n,r)]}}constrainInternal(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;const e=this._unmodified,{center:t,zoom:i}=this.applyConstrain(this.center,this.zoom);this.setCenter(t),this.setZoom(i),this._unmodified=e,this._constraining=!1}_calcMatrices(){if(this._width&&this._height){this._pixelsToGLUnits=[2/this._width,-2/this._height];let e=t.ar(new Float64Array(16));t.Q(e,e,[this._width/2,-this._height/2,1]),t.O(e,e,[1,-1,0]),this._clipSpaceToPixelsMatrix=e,e=t.ar(new Float64Array(16)),t.Q(e,e,[1,-1,1]),t.O(e,e,[-1,-1,0]),t.Q(e,e,[2/this._width,2/this._height,1]),this._pixelsToClipSpaceMatrix=e,this._cameraToCenterDistance=.5/Math.tan(this.fovInRadians/2)*this._height}this._callbacks.calcMatrices()}calculateCenterFromCameraLngLatAlt(e,i,n,r){const o=void 0!==n?n:this.bearing,a=r=void 0!==r?r:this.pitch,{distanceToCenter:s,clampedElevation:l}=this._distanceToCenterFromAltElevationPitch(i,this.elevation,a),{x:c,y:u}=be(a,o),h=t.a9.fromLngLat(e,i);let d,p,f=t.a_(1,h.y),m=0;do{if(m+=1,m>10)break;p=s/f,d=new t.a9(h.x+c*p,h.y+u*p),f=1/d.meterInMercatorCoordinateUnits()}while(Math.abs(s-p*f)>1e-12);return{center:d.toLngLat(),elevation:l,zoom:t.at(this.height/2/Math.tan(this.fovInRadians/2)/p/this.tileSize)}}recalculateZoomAndCenter(e){if(this.elevation-e==0)return;const i=1/this.worldSize,n=t.as(1,this.center.lat)*this.worldSize,r=t.a9.fromLngLat(this.center,this.elevation),o=r.x/i,a=r.y/i,s=r.z/i,l=this.pitch,c=this.bearing,{x:u,y:h,z:d}=be(l,c),p=this.cameraToCenterDistance,f=o+p*-u,m=a+p*-h,g=s+p*d,{distanceToCenter:_,clampedElevation:y}=this._distanceToCenterFromAltElevationPitch(g/n,e,l),v=_*n,x=new t.a9((f+u*v)*i,(m+h*v)*i,0).toLngLat(),b=t.as(1,x.lat),w=t.at(this.height/2/Math.tan(this.fovInRadians/2)/_/b/this.tileSize);this._elevation=y,this._center=x,this.setZoom(w)}_distanceToCenterFromAltElevationPitch(e,i,n){const r=-Math.cos(t.ap(n)),o=e-i;let a,s=i;return r*o>=0||Math.abs(r)<.1?(a=1e4,s=e+a*r):a=-o/r,{distanceToCenter:a,clampedElevation:s}}getCameraPoint(){const e=Math.tan(this.pitchInRadians)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new t.P(e*Math.sin(this.rollInRadians),e*Math.cos(this.rollInRadians)))}getCameraAltitude(){return Math.cos(this.pitchInRadians)*this._cameraToCenterDistance/this._pixelPerMeter+this.elevation}getCameraLngLat(){const e=t.as(1,this.center.lat)*this.worldSize;return xe(this.center,this.elevation,this.pitch,this.bearing,this.cameraToCenterDistance/e).toLngLat()}getMercatorTileCoordinates(e){if(!e)return[0,0,1,1];const i=e.canonical.z>=0?1<<e.canonical.z:Math.pow(2,e.canonical.z);return[e.canonical.x/i,e.canonical.y/i,1/i/t.a5,1/i/t.a5]}}class qt{constructor(e,i){this.min=e,this.max=i,this.center=t.a$([],t.b0([],this.min,this.max),.5)}quadrant(e){const i=[e%2==0,e<2],n=t.b1(this.min),r=t.b1(this.max);for(let t=0;t<i.length;t++)n[t]=i[t]?this.min[t]:this.center[t],r[t]=i[t]?this.center[t]:this.max[t];return r[2]=this.max[2],new qt(n,r)}distanceX(e){return Math.max(Math.min(this.max[0],e[0]),this.min[0])-e[0]}distanceY(e){return Math.max(Math.min(this.max[1],e[1]),this.min[1])-e[1]}intersectsFrustum(e){let t=!0;for(let i=0;i<e.planes.length;i++){const n=this.intersectsPlane(e.planes[i]);if(0===n)return 0;1===n&&(t=!1)}return t?2:e.aabb.min[0]>this.max[0]||e.aabb.min[1]>this.max[1]||e.aabb.min[2]>this.max[2]||e.aabb.max[0]<this.min[0]||e.aabb.max[1]<this.min[1]||e.aabb.max[2]<this.min[2]?0:1}intersectsPlane(e){let t=e[3],i=e[3];for(let n=0;n<3;n++)e[n]>0?(t+=e[n]*this.min[n],i+=e[n]*this.max[n]):(i+=e[n]*this.min[n],t+=e[n]*this.max[n]);return t>=0?2:i<0?0:1}}class $t{distanceToTile2d(e,t,i,n){const r=n.distanceX([e,t]),o=n.distanceY([e,t]);return Math.hypot(r,o)}getWrap(e,t,i){return i}getTileBoundingVolume(e,i,n,r){var o,a;let s=0,l=0;if(null==r?void 0:r.terrain){const c=new t.a2(e.z,i,e.z,e.x,e.y),u=r.terrain.getMinMaxElevation(c);s=null!==(o=u.minElevation)&&void 0!==o?o:Math.min(0,n),l=null!==(a=u.maxElevation)&&void 0!==a?a:Math.max(0,n)}const c=1<<e.z;return new qt([i+e.x/c,e.y/c,s],[i+(e.x+1)/c,(e.y+1)/c,l])}allowVariableZoom(e,i){const n=e.fov*(Math.abs(Math.cos(e.rollInRadians))*e.height+Math.abs(Math.sin(e.rollInRadians))*e.width)/e.height,r=t.an(78.5-n/2,0,60);return!!i.terrain||e.pitch>r}allowWorldCopies(){return!0}prepareNextFrame(){}}class Wt{constructor(e,t,i){this.points=e,this.planes=t,this.aabb=i}static fromInvProjectionMatrix(e,i=1,n=0,r,o){const a=o?[[6,5,4],[0,1,2],[0,3,7],[2,1,5],[3,2,6],[0,4,5]]:[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]],s=Math.pow(2,n),l=[[-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(n=>function(e,i,n,r){const o=t.aH([],e,i),a=1/o[3]/n*r;return t.b6(o,o,[a,a,1/o[3],a])}(n,e,i,s));r&&function(e,i,n,r){const o=r?4:0,a=r?0:4;let s=0;const l=[],c=[];for(let d=0;d<4;d++){const i=t.b2([],e[d+a],e[d+o]),n=t.b7(i);t.a$(i,i,1/n),l.push(n),c.push(i)}for(let d=0;d<4;d++){const i=t.b8(e[d+o],c[d],n);s=null!==i&&i>=0?Math.max(s,i):Math.max(s,l[d])}const u=function(e,i){const n=t.b2([],e[i[0]],e[i[1]]),r=t.b2([],e[i[2]],e[i[1]]),o=[0,0,0,0];return t.b3(o,t.b4([],n,r)),o[3]=-t.b5(o,e[i[0]]),o}(e,i),h=function(e,i){const n=t.b9(e),r=t.ba([],e,1/n),o=t.b2([],i,t.a$([],r,t.b5(i,r))),a=t.b9(o);if(a>0){const e=Math.sqrt(1-r[3]*r[3]),n=t.a$([],r,-r[3]),s=t.b0([],n,t.a$([],o,e/a));return t.bb(i,s)}return null}(n,u);if(null!==h){const e=h/t.b5(c[0],u);s=Math.min(s,e)}for(let t=0;t<4;t++){const i=Math.min(s,l[t]);e[t+a]=[e[t+o][0]+c[t][0]*i,e[t+o][1]+c[t][1]*i,e[t+o][2]+c[t][2]*i,1]}}(l,a[0],r,o);const c=a.map(e=>{const i=t.b2([],l[e[0]],l[e[1]]),n=t.b2([],l[e[2]],l[e[1]]),r=t.b3([],t.b4([],i,n)),o=-t.b5(r,l[e[1]]);return r.concat(o)}),u=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY],h=[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];for(const t of l)for(let e=0;e<3;e++)u[e]=Math.min(u[e],t[e]),h[e]=Math.max(h[e],t[e]);return new Wt(l,c,new qt(u,h))}}class Ht{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,t,i){return this._helper.interpolatePadding(e,t,i)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,t,i=!0){this._helper.resize(e,t,i)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}setConstrainOverride(e){this._helper.setConstrainOverride(e)}overrideNearFarZ(e,t){this._helper.overrideNearFarZ(e,t)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(e,t){}constructor(e){this._posMatrixCache=new Map,this._alignedPosMatrixCache=new Map,this._fogMatrixCacheF32=new Map,this.defaultConstrain=(e,i)=>{i=t.an(+i,this.minZoom,this.maxZoom);const n={center:new t.V(e.lng,e.lat),zoom:i};let r=this._helper._lngRange;if(!this._helper._renderWorldCopies&&null===r){const e=180-1e-10;r=[-e,e]}const o=this.tileSize*t.aq(n.zoom);let a=0,s=o,l=0,c=o,u=0,h=0;const{x:d,y:p}=this.size;if(this._helper._latRange){const e=this._helper._latRange;a=t.X(e[1])*o,s=t.X(e[0])*o,s-a<p&&(u=p/(s-a))}r&&(l=t.W(t.Y(r[0])*o,0,o),c=t.W(t.Y(r[1])*o,0,o),c<l&&(c+=o),c-l<d&&(h=d/(c-l)));const{x:f,y:m}=ge(o,e);let g,_;const y=Math.max(h||0,u||0);if(y){const e=new t.P(h?(c+l)/2:f,u?(s+a)/2:m);return n.center=_e(o,e).wrap(),n.zoom+=t.at(y),n}if(this._helper._latRange){const e=p/2;m-e<a&&(_=a+e),m+e>s&&(_=s-e)}if(r){const e=(l+c)/2;let i=f;this._helper._renderWorldCopies&&(i=t.W(f,e-o/2,e+o/2));const n=d/2;i-n<l&&(g=l+n),i+n>c&&(g=c-n)}if(void 0!==g||void 0!==_){const e=new t.P(null!=g?g:f,null!=_?_:m);n.center=_e(o,e).wrap()}return n},this.applyConstrain=(e,t)=>this._helper.applyConstrain(e,t),this._helper=new Gt({calcMatrices:()=>{this._calcMatrices()},defaultConstrain:(e,t)=>this.defaultConstrain(e,t)},e),this._coveringTilesDetailsProvider=new $t}clone(){const e=new Ht;return e.apply(this,!1),e}apply(e,t,i){this._helper.apply(e,t,i)}get cameraPosition(){return this._cameraPosition}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._viewProjMatrix}get inverseProjectionMatrix(){return this._invProjMatrix}get mercatorMatrix(){return this._mercatorMatrix}getVisibleUnwrappedCoordinates(e){const i=[new t.bc(0,e)];if(this._helper._renderWorldCopies){const n=this.screenPointToMercatorCoordinate(new t.P(0,0)),r=this.screenPointToMercatorCoordinate(new t.P(this._helper._width,0)),o=this.screenPointToMercatorCoordinate(new t.P(this._helper._width,this._helper._height)),a=this.screenPointToMercatorCoordinate(new t.P(0,this._helper._height)),s=Math.floor(Math.min(n.x,r.x,o.x,a.x)),l=Math.floor(Math.max(n.x,r.x,o.x,a.x)),c=1;for(let u=s-c;u<=l+c;u++)0!==u&&i.push(new t.bc(u,e))}return i}getCameraFrustum(){return Wt.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(e){const t=this.screenPointToLocation(this.centerPoint,e),i=e?e.getElevationForLngLatZoom(t,this._helper._tileZoom):0;this._helper.recalculateZoomAndCenter(i)}setLocationAtPoint(e,i){const n=t.as(this.elevation,this.center.lat),r=this.screenPointToMercatorCoordinateAtZ(i,n),o=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,n),a=t.a9.fromLngLat(e),s=new t.a9(a.x-(r.x-o.x),a.y-(r.y-o.y));this.setCenter(null==s?void 0:s.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap())}locationToScreenPoint(e,i){return i?this.coordinatePoint(t.a9.fromLngLat(e),i.getElevationForLngLat(e,this),this._pixelMatrix3D):this.coordinatePoint(t.a9.fromLngLat(e))}screenPointToLocation(e,t){var i;return null===(i=this.screenPointToMercatorCoordinate(e,t))||void 0===i?void 0:i.toLngLat()}screenPointToMercatorCoordinate(e,t){if(t){const i=t.pointCoordinate(e);if(null!=i)return i}return this.screenPointToMercatorCoordinateAtZ(e)}screenPointToMercatorCoordinateAtZ(e,i){const n=i||0,r=[e.x,e.y,0,1],o=[e.x,e.y,1,1];t.aH(r,r,this._pixelMatrixInverse),t.aH(o,o,this._pixelMatrixInverse);const a=r[3],s=o[3],l=r[1]/a,c=o[1]/s,u=r[2]/a,h=o[2]/s,d=u===h?0:(n-u)/(h-u);return new t.a9(t.G.number(r[0]/a,o[0]/s,d)/this.worldSize,t.G.number(l,c,d)/this.worldSize,n)}coordinatePoint(e,i=0,n=this._pixelMatrix){const r=[e.x*this.worldSize,e.y*this.worldSize,i,1];return t.aH(r,r,n),new t.P(r[0]/r[3],r[1]/r[3])}getBounds(){const e=Math.max(0,this._helper._height/2-ye(this));return(new W).extend(this.screenPointToLocation(new t.P(0,e))).extend(this.screenPointToLocation(new t.P(this._helper._width,e))).extend(this.screenPointToLocation(new t.P(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new t.P(0,this._helper._height)))}isPointOnMapSurface(e,t){return t?null!=t.pointCoordinate(e):e.y>this.height/2-ye(this)}calculatePosMatrix(e,i=!1,n){var r;const o=null!==(r=e.key)&&void 0!==r?r:t.bd(e.wrap,e.canonical.z,e.canonical.z,e.canonical.x,e.canonical.y),a=i?this._alignedPosMatrixCache:this._posMatrixCache;if(a.has(o)){const e=a.get(o);return n?e.f32:e.f64}const s=ve(e,this.worldSize);t.S(s,i?this._alignedProjMatrix:this._viewProjMatrix,s);const l={f64:s,f32:new Float32Array(s)};return a.set(o,l),n?l.f32:l.f64}calculateFogMatrix(e){const i=e.key,n=this._fogMatrixCacheF32;if(n.has(i))return n.get(i);const r=ve(e,this.worldSize);return t.S(r,this._fogMatrix,r),n.set(i,new Float32Array(r)),n.get(i)}calculateCenterFromCameraLngLatAlt(e,t,i,n){return this._helper.calculateCenterFromCameraLngLatAlt(e,t,i,n)}_calculateNearFarZIfNeeded(e,i,n){if(!this._helper.autoCalculateNearFarZ)return;const r=Math.min(this.elevation,this.minElevationForCurrentTile,this.getCameraAltitude()-100),o=e-r*this._helper._pixelPerMeter/Math.cos(i),a=r<0?o:e,s=Math.PI/2+this.pitchInRadians,l=t.ap(this.fov)*(Math.abs(Math.cos(t.ap(this.roll)))*this.height+Math.abs(Math.sin(t.ap(this.roll)))*this.width)/this.height*(.5+n.y/this.height),c=Math.sin(l)*a/Math.sin(t.an(Math.PI-s-l,.01,Math.PI-.01)),u=ye(this),h=Math.atan(u/this._helper.cameraToCenterDistance),d=t.ap(.75),p=h>d?2*h*(.5+n.y/(2*u)):d,f=Math.sin(p)*a/Math.sin(t.an(Math.PI-s-p,.01,Math.PI-.01)),m=Math.min(c,f);this._helper._farZ=1.01*(Math.cos(Math.PI/2-i)*m+a),this._helper._nearZ=this._helper._height/50}_calcMatrices(){if(!this._helper._height)return;const e=this.centerOffset,i=ge(this.worldSize,this.center),n=i.x,r=i.y;this._helper._pixelPerMeter=t.as(1,this.center.lat)*this.worldSize;const o=t.ap(Math.min(this.pitch,me)),a=Math.max(this._helper.cameraToCenterDistance/2,this._helper.cameraToCenterDistance+this._helper._elevation*this._helper._pixelPerMeter/Math.cos(o));let s;this._calculateNearFarZIfNeeded(a,o,e),s=new Float64Array(16),t.be(s,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),t.aB(this._invProjMatrix,s),s[8]=2*-e.x/this._helper._width,s[9]=2*e.y/this._helper._height,this._projectionMatrix=t.bf(s),t.Q(s,s,[1,-1,1]),t.O(s,s,[0,0,-this._helper.cameraToCenterDistance]),t.bg(s,s,-this.rollInRadians),t.bh(s,s,this.pitchInRadians),t.bg(s,s,-this.bearingInRadians),t.O(s,s,[-n,-r,0]),this._mercatorMatrix=t.Q([],s,[this.worldSize,this.worldSize,this.worldSize]),t.Q(s,s,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=t.S(new Float64Array(16),this.clipSpaceToPixelsMatrix,s),t.O(s,s,[0,0,-this.elevation]),this._viewProjMatrix=s,this._invViewProjMatrix=t.aB([],s);const l=[0,0,-1,1];t.aH(l,l,this._invViewProjMatrix),this._cameraPosition=[l[0]/l[3],l[1]/l[3],l[2]/l[3]],this._fogMatrix=new Float64Array(16),t.be(this._fogMatrix,this.fovInRadians,this.width/this.height,a,this._helper._farZ),this._fogMatrix[8]=2*-e.x/this.width,this._fogMatrix[9]=2*e.y/this.height,t.Q(this._fogMatrix,this._fogMatrix,[1,-1,1]),t.O(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),t.bg(this._fogMatrix,this._fogMatrix,-this.rollInRadians),t.bh(this._fogMatrix,this._fogMatrix,this.pitchInRadians),t.bg(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),t.O(this._fogMatrix,this._fogMatrix,[-n,-r,0]),t.Q(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),t.O(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=t.S(new Float64Array(16),this.clipSpaceToPixelsMatrix,s);const c=this._helper._width%2/2,u=this._helper._height%2/2,h=Math.cos(this.bearingInRadians),d=Math.sin(-this.bearingInRadians),p=n-Math.round(n)+h*c+d*u,f=r-Math.round(r)+h*u+d*c,m=new Float64Array(s);if(t.O(m,m,[p>.5?p-1:p,f>.5?f-1:f,0]),this._alignedProjMatrix=m,s=t.aB(new Float64Array(16),this._pixelMatrix),!s)throw new Error("failed to invert matrix");this._pixelMatrixInverse=s,this._clearMatrixCaches()}_clearMatrixCaches(){this._posMatrixCache.clear(),this._alignedPosMatrixCache.clear(),this._fogMatrixCacheF32.clear()}maxPitchScaleFactor(){if(!this._pixelMatrixInverse)return 1;const e=this.screenPointToMercatorCoordinate(new t.P(0,0)),i=[e.x*this.worldSize,e.y*this.worldSize,0,1];return t.aH(i,i,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){const e=t.as(1,this.center.lat)*this.worldSize;return xe(this.center,this.elevation,this.pitch,this.bearing,this._helper.cameraToCenterDistance/e).toLngLat()}lngLatToCameraDepth(e,i){const n=t.a9.fromLngLat(e),r=[n.x*this.worldSize,n.y*this.worldSize,i,1];return t.aH(r,r,this._viewProjMatrix),r[2]/r[3]}getProjectionData(e){const{overscaledTileID:i,aligned:n,applyTerrainMatrix:r}=e,o=this._helper.getMercatorTileCoordinates(i),a=i?this.calculatePosMatrix(i,n,!0):null;let s;return s=i&&i.terrainRttPosMatrix32f&&r?i.terrainRttPosMatrix32f:a||t.bi(),{mainMatrix:s,tileMercatorCoords:o,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:s}}isLocationOccluded(e){return!1}getPixelScale(){return 1}getCircleRadiusCorrection(){return 1}getPitchedTextCorrection(e,t,i){return 1}transformLightDirection(e){return t.b1(e)}getRayDirectionFromPixel(e){throw new Error("Not implemented.")}projectTileCoordinates(e,i,n,r){const o=this.calculatePosMatrix(n);let a;r?(a=[e,i,r(e,i),1],t.aH(a,a,o)):(a=[e,i,0,1],at(a,a,o));const s=a[3];return{point:new t.P(a[0]/s,a[1]/s),signedDistanceFromCamera:s,isOccluded:!1}}populateCache(e){for(const t of e)this.calculatePosMatrix(t)}getMatrixForModel(e,i){const n=t.a9.fromLngLat(e,i),r=n.meterInMercatorCoordinateUnits(),o=t.bj();return t.O(o,o,[n.x,n.y,n.z]),t.bg(o,o,Math.PI),t.bh(o,o,Math.PI/2),t.Q(o,o,[-r,r,r]),o}getProjectionDataForCustomLayer(e=!0){const i=new t.a2(0,0,0,0,0),n=this.getProjectionData({overscaledTileID:i,applyGlobeMatrix:e}),r=ve(i,this.worldSize);t.S(r,this._viewProjMatrix,r),n.tileMercatorCoords=[0,0,1,1];const o=[t.a5,t.a5,this.worldSize/this._helper.pixelsPerMeter],a=t.bk();return t.Q(a,r,o),n.fallbackMatrix=a,n.mainMatrix=a,n}getFastPathSimpleProjectionMatrix(e){return this.calculatePosMatrix(e)}}function Xt(){t.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}function Yt(e){if(e.useSlerp)if(e.k<1){const i=t.bl(e.startEulerAngles.roll,e.startEulerAngles.pitch,e.startEulerAngles.bearing),n=t.bl(e.endEulerAngles.roll,e.endEulerAngles.pitch,e.endEulerAngles.bearing),r=new Float64Array(4);t.bm(r,i,n,e.k);const o=t.bn(r);e.tr.setRoll(o.roll),e.tr.setPitch(o.pitch),e.tr.setBearing(o.bearing)}else e.tr.setRoll(e.endEulerAngles.roll),e.tr.setPitch(e.endEulerAngles.pitch),e.tr.setBearing(e.endEulerAngles.bearing);else e.tr.setRoll(t.G.number(e.startEulerAngles.roll,e.endEulerAngles.roll,e.k)),e.tr.setPitch(t.G.number(e.startEulerAngles.pitch,e.endEulerAngles.pitch,e.k)),e.tr.setBearing(t.G.number(e.startEulerAngles.bearing,e.endEulerAngles.bearing,e.k))}function Kt(e,i,n,r,o){const a=o.padding,s=ge(o.worldSize,n.getNorthWest()),l=ge(o.worldSize,n.getNorthEast()),c=ge(o.worldSize,n.getSouthEast()),u=ge(o.worldSize,n.getSouthWest()),h=t.ap(-r),d=s.rotate(h),p=l.rotate(h),f=c.rotate(h),m=u.rotate(h),g=new t.P(Math.max(d.x,p.x,m.x,f.x),Math.max(d.y,p.y,m.y,f.y)),_=new t.P(Math.min(d.x,p.x,m.x,f.x),Math.min(d.y,p.y,m.y,f.y)),y=g.sub(_),v=(o.width-(a.left+a.right+i.left+i.right))/y.x,x=(o.height-(a.top+a.bottom+i.top+i.bottom))/y.y;if(x<0||v<0)return void Xt();const b=Math.min(t.at(o.scale*Math.min(v,x)),e.maxZoom),w=t.P.convert(e.offset),T=new t.P((i.left-i.right)/2,(i.top-i.bottom)/2).rotate(t.ap(r)),S=w.add(T).mult(o.scale/t.aq(b));return{center:_e(o.worldSize,s.add(c).div(2).sub(S)),zoom:b,bearing:r}}class Qt{get useGlobeControls(){return!1}handlePanInertia(e,t){const i=e.mag(),n=Math.abs(ye(t));return{easingOffset:e.mult(Math.min(.75*n/i,1)),easingCenter:t.center}}handleMapControlsRollPitchBearingZoom(e,t){e.bearingDelta&&t.setBearing(t.bearing+e.bearingDelta),e.pitchDelta&&t.setPitch(t.pitch+e.pitchDelta),e.rollDelta&&t.setRoll(t.roll+e.rollDelta),e.zoomDelta&&t.setZoom(t.zoom+e.zoomDelta)}handleMapControlsPan(e,t,i){e.around.distSqr(t.centerPoint)<.01||t.setLocationAtPoint(i,e.around)}cameraForBoxAndBearing(e,t,i,n,r){return Kt(e,t,i,n,r)}handleJumpToCenterZoom(e,i){e.zoom!==(void 0!==i.zoom?+i.zoom:e.zoom)&&e.setZoom(+i.zoom),void 0!==i.center&&e.setCenter(t.V.convert(i.center))}handleEaseTo(e,i){const n=e.zoom,r=e.padding,o={roll:e.roll,pitch:e.pitch,bearing:e.bearing},a={roll:void 0===i.roll?e.roll:i.roll,pitch:void 0===i.pitch?e.pitch:i.pitch,bearing:void 0===i.bearing?e.bearing:i.bearing},s=void 0!==i.zoom,l=!e.isPaddingEqual(i.padding);let c=!1;const u=s?+i.zoom:e.zoom;let h=e.centerPoint.add(i.offsetAsPoint);const d=e.screenPointToLocation(h),{center:p,zoom:f}=e.applyConstrain(t.V.convert(i.center||d),null!=u?u:n);Ut(e,p);const m=ge(e.worldSize,d),g=ge(e.worldSize,p).sub(m),_=t.aq(f-n);return c=f!==n,{easeFunc:s=>{if(c&&e.setZoom(t.G.number(n,f,s)),t.bo(o,a)||Yt({startEulerAngles:o,endEulerAngles:a,tr:e,k:s,useSlerp:o.roll!=a.roll}),l&&(e.interpolatePadding(r,i.padding,s),h=e.centerPoint.add(i.offsetAsPoint)),i.around)e.setLocationAtPoint(i.around,i.aroundPoint);else{const i=t.aq(e.zoom-n),r=f>n?Math.min(2,_):Math.max(.5,_),o=Math.pow(r,1-s),a=_e(e.worldSize,m.add(g.mult(s*o)).mult(i));e.setLocationAtPoint(e.renderWorldCopies?a.wrap():a,h)}},isZooming:c,elevationCenter:p}}handleFlyTo(e,i){const n=void 0!==i.zoom,r=e.zoom,o=e.applyConstrain(t.V.convert(i.center||i.locationAtOffset),n?+i.zoom:r),a=o.center,s=o.zoom;Ut(e,a);const l=ge(e.worldSize,i.locationAtOffset),c=ge(e.worldSize,a).sub(l),u=c.mag(),h=t.aq(s-r);let d;if(void 0!==i.minZoom){const n=Math.min(+i.minZoom,r,s),o=e.applyConstrain(a,n).zoom;d=t.aq(o-r)}return{easeFunc:(i,n,o,u)=>{e.setZoom(1===i?s:r+t.at(n));const h=1===i?a:_e(e.worldSize,l.add(c.mult(o)).mult(n));e.setLocationAtPoint(e.renderWorldCopies?h.wrap():h,u)},scaleOfZoom:h,targetCenter:a,scaleOfMinZoom:d,pixelPathLength:u}}}class Jt{constructor(e,t,i){this.blendFunction=e,this.blendColor=t,this.mask=i}}Jt.Replace=[1,0],Jt.disabled=new Jt(Jt.Replace,t.bp.transparent,[!1,!1,!1,!1]),Jt.unblended=new Jt(Jt.Replace,t.bp.transparent,[!0,!0,!0,!0]),Jt.alphaBlended=new Jt([1,771],t.bp.transparent,[!0,!0,!0,!0]);const ei=2305;class ti{constructor(e,t,i){this.enable=e,this.mode=t,this.frontFace=i}}ti.disabled=new ti(!1,1029,ei),ti.backCCW=new ti(!0,1029,ei),ti.frontCCW=new ti(!0,1028,ei);class ii{constructor(e,t,i){this.func=e,this.mask=t,this.range=i}}ii.ReadOnly=!1,ii.ReadWrite=!0,ii.disabled=new ii(519,ii.ReadOnly,[0,1]);const ni=7680;class ri{constructor(e,t,i,n,r,o){this.test=e,this.ref=t,this.mask=i,this.fail=n,this.depthFail=r,this.pass=o}}ri.disabled=new ri({func:519,mask:0},0,0,ni,ni,ni);const oi=new WeakMap;function ai(e){var t;if(oi.has(e))return oi.get(e);{const i=null===(t=e.getParameter(e.VERSION))||void 0===t?void 0:t.startsWith("WebGL 2.0");return oi.set(e,i),i}}class si{get awaitingQuery(){return!!this._readbackQueue}constructor(e){this._readbackWaitFrames=4,this._measureWaitFrames=6,this._texWidth=1,this._texHeight=1,this._measuredError=0,this._updateCount=0,this._lastReadbackFrame=-1e3,this._readbackQueue=null,this._cachedRenderContext=e;const i=e.context,n=i.gl;this._texFormat=n.RGBA,this._texType=n.UNSIGNED_BYTE;const r=new t.aW;r.emplaceBack(-1,-1),r.emplaceBack(2,-1),r.emplaceBack(-1,2);const o=new t.aY;o.emplaceBack(0,1,2),this._fullscreenTriangle=new Ft(i.createVertexBuffer(r,Bt.members),i.createIndexBuffer(o),t.aX.simpleSegment(0,0,r.length,o.length)),this._resultBuffer=new Uint8Array(4),i.activeTexture.set(n.TEXTURE1);const a=n.createTexture();n.bindTexture(n.TEXTURE_2D,a),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.NEAREST),n.texImage2D(n.TEXTURE_2D,0,this._texFormat,this._texWidth,this._texHeight,0,this._texFormat,this._texType,null),this._fbo=i.createFramebuffer(this._texWidth,this._texHeight,!1,!1),this._fbo.colorAttachment.set(a),ai(n)&&(this._pbo=n.createBuffer(),n.bindBuffer(n.PIXEL_PACK_BUFFER,this._pbo),n.bufferData(n.PIXEL_PACK_BUFFER,4,n.STREAM_READ),n.bindBuffer(n.PIXEL_PACK_BUFFER,null))}destroy(){const e=this._cachedRenderContext.context.gl;this._fullscreenTriangle.destroy(),this._fbo.destroy(),e.deleteBuffer(this._pbo),this._fullscreenTriangle=null,this._fbo=null,this._pbo=null,this._resultBuffer=null}updateErrorLoop(e,t){const i=this._updateCount;return this._readbackQueue?i>=this._readbackQueue.frameNumberIssued+this._readbackWaitFrames&&this._tryReadback():i>=this._lastReadbackFrame+this._measureWaitFrames&&this._renderErrorTexture(e,t),this._updateCount++,this._measuredError}_bindFramebuffer(){const e=this._cachedRenderContext.context,t=e.gl;e.activeTexture.set(t.TEXTURE1),t.bindTexture(t.TEXTURE_2D,this._fbo.colorAttachment.get()),e.bindFramebuffer.set(this._fbo.framebuffer)}_renderErrorTexture(e,i){const n=this._cachedRenderContext.context,r=n.gl;if(this._bindFramebuffer(),n.viewport.set([0,0,this._texWidth,this._texHeight]),n.clear({color:t.bp.transparent}),this._cachedRenderContext.useProgram("projectionErrorMeasurement").draw(n,r.TRIANGLES,ii.disabled,ri.disabled,Jt.unblended,ti.disabled,((e,t)=>({u_input:e,u_output_expected:t}))(e,i),null,null,"$clipping",this._fullscreenTriangle.vertexBuffer,this._fullscreenTriangle.indexBuffer,this._fullscreenTriangle.segments),this._pbo&&ai(r)){r.bindBuffer(r.PIXEL_PACK_BUFFER,this._pbo),r.readBuffer(r.COLOR_ATTACHMENT0),r.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,0),r.bindBuffer(r.PIXEL_PACK_BUFFER,null);const e=r.fenceSync(r.SYNC_GPU_COMMANDS_COMPLETE,0);r.flush(),this._readbackQueue={frameNumberIssued:this._updateCount,sync:e}}else this._readbackQueue={frameNumberIssued:this._updateCount,sync:null}}_tryReadback(){const e=this._cachedRenderContext.context.gl;if(this._pbo&&this._readbackQueue&&ai(e)){const i=e.clientWaitSync(this._readbackQueue.sync,0,0);if(i===e.WAIT_FAILED)return t.w("WebGL2 clientWaitSync failed."),this._readbackQueue=null,void(this._lastReadbackFrame=this._updateCount);if(i===e.TIMEOUT_EXPIRED)return;e.bindBuffer(e.PIXEL_PACK_BUFFER,this._pbo),e.getBufferSubData(e.PIXEL_PACK_BUFFER,0,this._resultBuffer,0,4),e.bindBuffer(e.PIXEL_PACK_BUFFER,null)}else this._bindFramebuffer(),e.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,this._resultBuffer);this._readbackQueue=null,this._measuredError=si._parseRGBA8float(this._resultBuffer),this._lastReadbackFrame=this._updateCount}static _parseRGBA8float(e){let t=0;return t+=e[0]/256,t+=e[1]/65536,t+=e[2]/16777216,e[3]<127&&(t=-t),t/128}}const li=t.a5/128;function ci(e,i){const n=void 0!==e.granularity?Math.max(e.granularity,1):1,r=n+(e.generateBorders?2:0),o=n+(e.extendToNorthPole||e.generateBorders?1:0)+(e.extendToSouthPole||e.generateBorders?1:0),a=r+1,s=o+1,l=e.generateBorders?-1:0,c=e.generateBorders||e.extendToNorthPole?-1:0,u=n+(e.generateBorders?1:0),h=n+(e.generateBorders||e.extendToSouthPole?1:0),d=a*s,p=r*o*6,f=a*s>65536;if(f&&"16bit"===i)throw new Error("Granularity is too large and meshes would not fit inside 16 bit vertex indices.");const m=f||"32bit"===i,g=new Int16Array(2*d);let _=0;for(let x=c;x<=h;x++)for(let i=l;i<=u;i++){let r=i/n*t.a5;-1===i&&(r=-li),i===n+1&&(r=t.a5+li);let o=x/n*t.a5;-1===x&&(o=e.extendToNorthPole?t.br:-li),x===n+1&&(o=e.extendToSouthPole?t.bs:t.a5+li),g[_++]=r,g[_++]=o}const y=m?new Uint32Array(p):new Uint16Array(p);let v=0;for(let t=0;t<o;t++)for(let e=0;e<r;e++){const i=e+1+t*a,n=e+(t+1)*a,r=e+1+(t+1)*a;y[v++]=e+t*a,y[v++]=n,y[v++]=i,y[v++]=i,y[v++]=n,y[v++]=r}return{vertices:g.buffer.slice(0),indices:y.buffer.slice(0),uses32bitIndices:m}}const ui=new t.aV({fill:new t.bt(128,2),line:new t.bt(512,0),tile:new t.bt(128,32),stencil:new t.bt(128,1),circle:3});class hi{constructor(){this._tileMeshCache={},this._errorCorrectionUsable=0,this._errorMeasurementLastValue=0,this._errorCorrectionPreviousValue=0,this._errorMeasurementLastChangeTime=-1e3}get name(){return"vertical-perspective"}get transitionState(){return 1}get useSubdivision(){return!0}get shaderVariantName(){return"globe"}get shaderDefine(){return"#define GLOBE"}get shaderPreludeCode(){return Dt.projectionGlobe}get vertexShaderPreludeCode(){return Dt.projectionMercator.vertexSource}get subdivisionGranularity(){return ui}get useGlobeControls(){return!0}get latitudeErrorCorrectionRadians(){return this._errorCorrectionUsable}destroy(){this._errorMeasurement&&this._errorMeasurement.destroy()}updateGPUdependent(e){this._errorMeasurement||(this._errorMeasurement=new si(e));const i=t.X(this._errorQueryLatitudeDegrees),n=2*Math.atan(Math.exp(Math.PI-i*Math.PI*2))-.5*Math.PI,r=this._errorMeasurement.updateErrorLoop(i,n),o=c();r!==this._errorMeasurementLastValue&&(this._errorCorrectionPreviousValue=this._errorCorrectionUsable,this._errorMeasurementLastValue=r,this._errorMeasurementLastChangeTime=o);const a=Math.min(Math.max((o-this._errorMeasurementLastChangeTime)/1e3/.5,0),1);this._errorCorrectionUsable=t.bu(this._errorCorrectionPreviousValue,-this._errorMeasurementLastValue,t.bv(a))}_getMeshKey(e){return`${e.granularity.toString(36)}_${e.generateBorders?"b":""}${e.extendToNorthPole?"n":""}${e.extendToSouthPole?"s":""}`}getMeshFromTileID(e,t,i,n,r){const o=("stencil"===r?ui.stencil:ui.tile).getGranularityForZoomLevel(t.z);return this._getMesh(e,{granularity:o,generateBorders:i,extendToNorthPole:0===t.y&&n,extendToSouthPole:t.y===(1<<t.z)-1&&n})}_getMesh(e,i){const n=this._getMeshKey(i);if(n in this._tileMeshCache)return this._tileMeshCache[n];const r=function(e,i){const n=ci(i,"16bit"),r=t.aW.deserialize({arrayBuffer:n.vertices,length:n.vertices.byteLength/2/2}),o=t.aY.deserialize({arrayBuffer:n.indices,length:n.indices.byteLength/2/3});return new Ft(e.createVertexBuffer(r,Bt.members),e.createIndexBuffer(o),t.aX.simpleSegment(0,0,r.length,o.length))}(e,i);return this._tileMeshCache[n]=r,r}recalculate(e){}hasTransition(){const e=c();let t=!1;return t=t||(e-this._errorMeasurementLastChangeTime)/1e3<.7,t=t||this._errorMeasurement&&this._errorMeasurement.awaitingQuery,t}setErrorQueryLatitudeDegrees(e){this._errorQueryLatitudeDegrees=e}}const di=new t.t({type:new t.D(t.u.projection.type)});class pi extends t.E{constructor(e){super(),this._transitionable=new t.x(di,void 0),this.setProjection(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new t.H(0)),this._mercatorProjection=new jt,this._verticalPerspectiveProjection=new hi}get transitionState(){const e=this.properties.get("type");if("string"==typeof e&&"mercator"===e)return 0;if("string"==typeof e&&"vertical-perspective"===e)return 1;if(e instanceof t.bw){if("vertical-perspective"===e.from&&"mercator"===e.to)return 1-e.transition;if("mercator"===e.from&&"vertical-perspective"===e.to)return e.transition}return 1}get useGlobeRendering(){return this.transitionState>0}get latitudeErrorCorrectionRadians(){return this._verticalPerspectiveProjection.latitudeErrorCorrectionRadians}get currentProjection(){return this.useGlobeRendering?this._verticalPerspectiveProjection:this._mercatorProjection}get name(){return"globe"}get useSubdivision(){return this.currentProjection.useSubdivision}get shaderVariantName(){return this.currentProjection.shaderVariantName}get shaderDefine(){return this.currentProjection.shaderDefine}get shaderPreludeCode(){return this.currentProjection.shaderPreludeCode}get vertexShaderPreludeCode(){return this.currentProjection.vertexShaderPreludeCode}get subdivisionGranularity(){return this.currentProjection.subdivisionGranularity}get useGlobeControls(){return this.transitionState>0}destroy(){this._mercatorProjection.destroy(),this._verticalPerspectiveProjection.destroy()}updateGPUdependent(e){this._mercatorProjection.updateGPUdependent(e),this._verticalPerspectiveProjection.updateGPUdependent(e)}getMeshFromTileID(e,t,i,n,r){return this.currentProjection.getMeshFromTileID(e,t,i,n,r)}setProjection(e){this._transitionable.setValue("type",(null==e?void 0:e.type)||"mercator")}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()||this.currentProjection.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}setErrorQueryLatitudeDegrees(e){this._verticalPerspectiveProjection.setErrorQueryLatitudeDegrees(e),this._mercatorProjection.setErrorQueryLatitudeDegrees(e)}}function fi(e){const t=_i(e.worldSize,e.center.lat);return 2*Math.PI*t}function mi(e,i,n,r,o){const a=1/(1<<o),s=i/t.a5*a+r*a,l=t.by((e/t.a5*a+n*a)*Math.PI*2+Math.PI,2*Math.PI),c=2*Math.atan(Math.exp(Math.PI-s*Math.PI*2))-.5*Math.PI,u=Math.cos(c),h=new Float64Array(3);return h[0]=Math.sin(l)*u,h[1]=Math.sin(c),h[2]=Math.cos(l)*u,h}function gi(e){return function(e,t){const i=Math.cos(t),n=new Float64Array(3);return n[0]=Math.sin(e)*i,n[1]=Math.sin(t),n[2]=Math.cos(e)*i,n}(e.lng*Math.PI/180,e.lat*Math.PI/180)}function _i(e,t){return e/(2*Math.PI)/Math.cos(t*Math.PI/180)}function yi(e){const i=Math.asin(e[1])/Math.PI*180,n=Math.sqrt(e[0]*e[0]+e[2]*e[2]);if(n>1e-6){const r=e[0]/n,o=Math.acos(e[2]/n),a=(r>0?o:-o)/Math.PI*180;return new t.V(t.W(a,-180,180),i)}return new t.V(0,i)}function vi(e){return Math.cos(e*Math.PI/180)}function xi(e,i){const n=vi(e),r=vi(i);return t.at(r/n)}function bi(e,i){const n=e.rotate(i.bearingInRadians),r=i.zoom+xi(i.center.lat,0),o=t.bu(1/vi(i.center.lat),1/vi(Math.min(Math.abs(i.center.lat),60)),t.bx(r,7,3,0,1)),a=360/fi({worldSize:i.worldSize,center:{lat:i.center.lat}});return new t.V(i.center.lng-n.x*a*o,t.an(i.center.lat+n.y*a,-t.ao,t.ao))}function wi(e){const t=.5*e,i=Math.sin(t),n=Math.cos(t);return Math.log(i+n)-Math.log(n-i)}function Ti(e,i,n,r){const o=e.lat+n*r;if(Math.abs(n)>1){const a=(Math.sign(e.lat+n)!==Math.sign(e.lat)?-Math.abs(e.lat):Math.abs(e.lat))*Math.PI/180,s=Math.abs(e.lat+n)*Math.PI/180,l=wi(a+r*(s-a)),c=wi(a),u=wi(s);return new t.V(e.lng+i*((l-c)/(u-c)),o)}return new t.V(e.lng+i*r,o)}class Si{constructor(e){this._cachePrevious=new Map,this._cache=new Map,this._hadAnyChanges=!1,this._boundingVolumeFactory=e}swapBuffers(){if(!this._hadAnyChanges)return;const e=this._cachePrevious;this._cachePrevious=this._cache,this._cache=e,this._cache.clear(),this._hadAnyChanges=!1}getTileBoundingVolume(e,t,i,n){const r=`${e.z}_${e.x}_${e.y}_${(null==n?void 0:n.terrain)?"t":""}`,o=this._cache.get(r);if(o)return o;const a=this._cachePrevious.get(r);if(a)return this._cache.set(r,a),a;const s=this._boundingVolumeFactory(e,t,i,n);return this._cache.set(r,s),this._hadAnyChanges=!0,s}}class Pi{constructor(e,t,i,n){this.min=i,this.max=n,this.points=e,this.planes=t}static fromAabb(e,t){const i=[];for(let n=0;n<8;n++)i.push([1&~n?e[0]:t[0],1==(n>>1&1)?t[1]:e[1],1==(n>>2&1)?t[2]:e[2]]);return new Pi(i,[[-1,0,0,t[0]],[1,0,0,-e[0]],[0,-1,0,t[1]],[0,1,0,-e[1]],[0,0,-1,t[2]],[0,0,1,-e[2]]],e,t)}static fromCenterSizeAngles(e,i,n){const r=t.bB([],n[0],n[1],n[2]),o=t.bC([],[i[0],0,0],r),a=t.bC([],[0,i[1],0],r),s=t.bC([],[0,0,i[2]],r),l=[...e],c=[...e];for(let t=0;t<8;t++)for(let i=0;i<3;i++){const n=e[i]+o[i]*(1&~t?-1:1)+a[i]*(1==(t>>1&1)?1:-1)+s[i]*(1==(t>>2&1)?1:-1);l[i]=Math.min(l[i],n),c[i]=Math.max(c[i],n)}const u=[];for(let h=0;h<8;h++){const i=[...e];t.b0(i,i,t.a$([],o,1&~h?-1:1)),t.b0(i,i,t.a$([],a,1==(h>>1&1)?1:-1)),t.b0(i,i,t.a$([],s,1==(h>>2&1)?1:-1)),u.push(i)}return new Pi(u,[[...o,-t.b5(o,u[0])],[...a,-t.b5(a,u[0])],[...s,-t.b5(s,u[0])],[-o[0],-o[1],-o[2],-t.b5(o,u[7])],[-a[0],-a[1],-a[2],-t.b5(a,u[7])],[-s[0],-s[1],-s[2],-t.b5(s,u[7])]],l,c)}intersectsFrustum(e){let t=!0;const i=this.points.length,n=this.planes.length,r=e.planes.length,o=e.points.length;for(let a=0;a<r;a++){const n=e.planes[a];let r=0;for(let e=0;e<i;e++){const t=this.points[e];n[0]*t[0]+n[1]*t[1]+n[2]*t[2]+n[3]>=0&&r++}if(0===r)return 0;r<i&&(t=!1)}if(t)return 2;for(let a=0;a<n;a++){const t=this.planes[a];let i=0;for(let n=0;n<o;n++){const r=e.points[n];t[0]*r[0]+t[1]*r[1]+t[2]*r[2]+t[3]>=0&&i++}if(0===i)return 0}return 1}intersectsPlane(e){const t=this.points.length;let i=0;for(let n=0;n<t;n++){const t=this.points[n];e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]>=0&&i++}return i===t?2:0===i?0:1}}function Mi(e,t,i){const n=e-t;return n<0?-n:Math.max(0,n-i)}function Ei(e,t,i,n,r){const o=e-i;let a;return a=o<0?Math.min(-o,1+o-r):o>1?Math.min(Math.max(o-r,0),1-o):0,Math.max(a,Mi(t,n,r))}class Ci{constructor(){this._boundingVolumeCache=new Si(this._computeTileBoundingVolume)}prepareNextFrame(){this._boundingVolumeCache.swapBuffers()}distanceToTile2d(e,t,i,n){const r=1<<i.z,o=1/r,a=i.x/r,s=i.y/r;let l=2;return l=Math.min(l,Ei(e,t,a,s,o)),l=Math.min(l,Ei(e,t,a+.5,-s-o,o)),l=Math.min(l,Ei(e,t,a+.5,2-s-o,o)),l}getWrap(e,t,i){const n=1<<t.z,r=1/n,o=t.x/n,a=Mi(e.x,o,r),s=Mi(e.x,o-1,r),l=Mi(e.x,o+1,r),c=Math.min(a,s,l);return c===l?1:c===s?-1:0}allowVariableZoom(e,t){return Me(e,t)>4}allowWorldCopies(){return!1}getTileBoundingVolume(e,t,i,n){return this._boundingVolumeCache.getTileBoundingVolume(e,t,i,n)}_computeTileBoundingVolume(e,i,n,r){var o,a;let s=0,l=0;if(null==r?void 0:r.terrain){const c=new t.a2(e.z,i,e.z,e.x,e.y),u=r.terrain.getMinMaxElevation(c);s=null!==(o=u.minElevation)&&void 0!==o?o:Math.min(0,n),l=null!==(a=u.maxElevation)&&void 0!==a?a:Math.max(0,n)}if(s/=t.bE,l/=t.bE,s+=1,l+=1,e.z<=0)return Pi.fromAabb([-l,-l,-l],[l,l,l]);if(1===e.z)return Pi.fromAabb([0===e.x?-l:0,0===e.y?0:-l,-l],[0===e.x?0:l,0===e.y?l:0,l]);{const i=[mi(0,0,e.x,e.y,e.z),mi(t.a5,0,e.x,e.y,e.z),mi(t.a5,t.a5,e.x,e.y,e.z),mi(0,t.a5,e.x,e.y,e.z)],n=[];for(const e of i)n.push(t.a$([],e,l));if(l!==s)for(const e of i)n.push(t.a$([],e,s));0===e.y&&n.push([0,1,0]),e.y===(1<<e.z)-1&&n.push([0,-1,0]);const r=[1,1,1],o=[-1,-1,-1];for(const e of n)for(let t=0;t<3;t++)r[t]=Math.min(r[t],e[t]),o[t]=Math.max(o[t],e[t]);const a=mi(t.a5/2,t.a5/2,e.x,e.y,e.z),c=t.b4([],[0,1,0],a);t.b3(c,c);const u=t.b4([],a,c);t.b3(u,u);const h=t.b4([],i[2],i[1]);t.b3(h,h);const d=t.b4([],i[0],i[3]);t.b3(d,d),n.push(t.a$([],a,l)),e.y>=(1<<e.z)/2&&n.push(t.a$([],mi(t.a5/2,0,e.x,e.y,e.z),l)),e.y<(1<<e.z)/2&&n.push(t.a$([],mi(t.a5/2,t.a5,e.x,e.y,e.z),l));const p=ki(a,n),f=ki(u,n),m=[-a[0],-a[1],-a[2],p.max],g=[a[0],a[1],a[2],-p.min],_=[-u[0],-u[1],-u[2],f.max],y=[u[0],u[1],u[2],-f.min],v=[...h,0],x=[...d,0],b=[];return 0===e.y?b.push(t.bD(x,v,m),t.bD(x,v,g)):b.push(t.bD(_,v,m),t.bD(_,v,g),t.bD(_,x,m),t.bD(_,x,g)),e.y===(1<<e.z)-1?b.push(t.bD(x,v,m),t.bD(x,v,g)):b.push(t.bD(y,v,m),t.bD(y,v,g),t.bD(y,x,m),t.bD(y,x,g)),new Pi(b,[m,g,_,y,v,x],r,o)}}}function ki(e,i){let n=1/0,r=-1/0;for(const o of i){const i=t.b5(e,o);n=Math.min(n,i),r=Math.max(r,i)}return{min:n,max:r}}class Ii{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,t,i){return this._helper.interpolatePadding(e,t,i)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,t){this._helper.resize(e,t)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}setConstrainOverride(e){this._helper.setConstrainOverride(e)}overrideNearFarZ(e,t){this._helper.overrideNearFarZ(e,t)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(e){}constructor(e){this._cachedClippingPlane=t.bF(),this._projectionMatrix=t.bj(),this._globeViewProjMatrix32f=t.bi(),this._globeViewProjMatrixNoCorrection=t.bj(),this._globeViewProjMatrixNoCorrectionInverted=t.bj(),this._globeProjMatrixInverted=t.bj(),this._cameraPosition=t.bz(),this._globeLatitudeErrorCorrectionRadians=0,this.defaultConstrain=(e,i)=>{const n=t.an(e.lat,-t.ao,t.ao),r=t.an(+i,this.minZoom+xi(0,n),this.maxZoom);return{center:new t.V(e.lng,n),zoom:r}},this.applyConstrain=(e,t)=>this._helper.applyConstrain(e,t),this._helper=new Gt({calcMatrices:()=>{this._calcMatrices()},defaultConstrain:(e,t)=>this.defaultConstrain(e,t)},e),this._coveringTilesDetailsProvider=new Ci}clone(){const e=new Ii;return e.apply(this,!1),e}apply(e,t,i){this._globeLatitudeErrorCorrectionRadians=i||0,this._helper.apply(e,t)}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._globeViewProjMatrixNoCorrection}get inverseProjectionMatrix(){return this._globeProjMatrixInverted}get cameraPosition(){const e=t.bz();return e[0]=this._cameraPosition[0],e[1]=this._cameraPosition[1],e[2]=this._cameraPosition[2],e}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}getProjectionData(e){const{overscaledTileID:t,applyGlobeMatrix:i}=e,n=this._helper.getMercatorTileCoordinates(t);return{mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:n,clippingPlane:this._cachedClippingPlane,projectionTransition:i?1:0,fallbackMatrix:this._globeViewProjMatrix32f}}_computeClippingPlane(e){const i=this.pitchInRadians,n=this.cameraToCenterDistance/e,r=Math.sin(i)*n,o=Math.cos(i)*n+1,a=1/Math.sqrt(r*r+o*o)*1;let s=-r,l=o;const c=Math.sqrt(s*s+l*l);s/=c,l/=c;const u=[0,s,l];t.bG(u,u,[0,0,0],-this.bearingInRadians),t.bH(u,u,[0,0,0],-1*this.center.lat*Math.PI/180),t.bI(u,u,[0,0,0],this.center.lng*Math.PI/180);const h=1/t.b7(u);return t.a$(u,u,h),[...u,-a*h]}isLocationOccluded(e){return!this.isSurfacePointVisible(gi(e))}transformLightDirection(e){const i=this._helper._center.lng*Math.PI/180,n=this._helper._center.lat*Math.PI/180,r=Math.cos(n),o=[Math.sin(i)*r,Math.sin(n),Math.cos(i)*r],a=[o[2],0,-o[0]],s=[0,0,0];t.b4(s,a,o),t.b3(a,a),t.b3(s,s);const l=[0,0,0];return t.b3(l,[a[0]*e[0]+s[0]*e[1]+o[0]*e[2],a[1]*e[0]+s[1]*e[1]+o[1]*e[2],a[2]*e[0]+s[2]*e[1]+o[2]*e[2]]),l}getPixelScale(){return 1/Math.cos(this._helper._center.lat*Math.PI/180)}getCircleRadiusCorrection(){return Math.cos(this._helper._center.lat*Math.PI/180)}getPitchedTextCorrection(e,i,n){const r=function(e,i,n){const r=1/(1<<n.z);return new t.a9(e/t.a5*r+n.x*r,i/t.a5*r+n.y*r)}(e,i,n.canonical),o=(a=r.y,[t.by(r.x*Math.PI*2+Math.PI,2*Math.PI),2*Math.atan(Math.exp(Math.PI-a*Math.PI*2))-.5*Math.PI]);var a;return this.getCircleRadiusCorrection()/Math.cos(o[1])}projectTileCoordinates(e,i,n,r){const o=n.canonical,a=mi(e,i,o.x,o.y,o.z),s=1+(r?r(e,i):0)/t.bE,l=[a[0]*s,a[1]*s,a[2]*s,1];t.aH(l,l,this._globeViewProjMatrixNoCorrection);const c=this._cachedClippingPlane,u=c[0]*a[0]+c[1]*a[1]+c[2]*a[2]+c[3]<0;return{point:new t.P(l[0]/l[3],l[1]/l[3]),signedDistanceFromCamera:l[3],isOccluded:u}}_calcMatrices(){if(!this._helper._width||!this._helper._height)return;const e=_i(this.worldSize,this.center.lat),i=t.bk(),n=t.bk();this._helper.autoCalculateNearFarZ&&(this._helper._nearZ=.5,this._helper._farZ=this.cameraToCenterDistance+2*e),t.be(i,this.fovInRadians,this.width/this.height,this._helper._nearZ,this._helper._farZ);const r=this.centerOffset;i[8]=2*-r.x/this._helper._width,i[9]=2*r.y/this._helper._height,this._projectionMatrix=t.bf(i),this._globeProjMatrixInverted=t.bk(),t.aB(this._globeProjMatrixInverted,i),t.O(i,i,[0,0,-this.cameraToCenterDistance]),t.bg(i,i,this.rollInRadians),t.bh(i,i,-this.pitchInRadians),t.bg(i,i,this.bearingInRadians),t.O(i,i,[0,0,-e]);const o=t.bz();o[0]=e,o[1]=e,o[2]=e,t.bh(n,i,this.center.lat*Math.PI/180),t.bJ(n,n,-this.center.lng*Math.PI/180),t.Q(n,n,o),this._globeViewProjMatrixNoCorrection=n,t.bh(i,i,this.center.lat*Math.PI/180-this._globeLatitudeErrorCorrectionRadians),t.bJ(i,i,-this.center.lng*Math.PI/180),t.Q(i,i,o),this._globeViewProjMatrix32f=new Float32Array(i),this._globeViewProjMatrixNoCorrectionInverted=t.bk(),t.aB(this._globeViewProjMatrixNoCorrectionInverted,n);const a=t.bz();this._cameraPosition=t.bz(),this._cameraPosition[2]=this.cameraToCenterDistance/e,t.bG(this._cameraPosition,this._cameraPosition,a,-this.rollInRadians),t.bH(this._cameraPosition,this._cameraPosition,a,this.pitchInRadians),t.bG(this._cameraPosition,this._cameraPosition,a,-this.bearingInRadians),t.b0(this._cameraPosition,this._cameraPosition,[0,0,1]),t.bH(this._cameraPosition,this._cameraPosition,a,-this.center.lat*Math.PI/180),t.bI(this._cameraPosition,this._cameraPosition,a,this.center.lng*Math.PI/180),this._cachedClippingPlane=this._computeClippingPlane(e);const s=t.bf(this._globeViewProjMatrixNoCorrectionInverted);t.Q(s,s,[1,1,-1]),this._cachedFrustum=Wt.fromInvProjectionMatrix(s,1,0,this._cachedClippingPlane,!0)}calculateFogMatrix(e){t.w("calculateFogMatrix is not supported on globe projection.");const i=t.bk();return t.ar(i),i}getVisibleUnwrappedCoordinates(e){return[new t.bc(0,e)]}getCameraFrustum(){return this._cachedFrustum}getClippingPlane(){return this._cachedClippingPlane}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(e){e&&t.w("terrain is not fully supported on vertical perspective projection."),this._helper.recalculateZoomAndCenter(0)}maxPitchScaleFactor(){return 1}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(e,i){if(!this._globeViewProjMatrixNoCorrection)return 1;const n=gi(e);t.a$(n,n,1+i/t.bE);const r=t.bF();return t.aH(r,[n[0],n[1],n[2],1],this._globeViewProjMatrixNoCorrection),r[2]/r[3]}populateCache(e){}getBounds(){const e=.5*this.width,i=.5*this.height,n=[new t.P(0,0),new t.P(e,0),new t.P(this.width,0),new t.P(this.width,i),new t.P(this.width,this.height),new t.P(e,this.height),new t.P(0,this.height),new t.P(0,i)],r=[];for(const t of n)r.push(this.unprojectScreenPoint(t));let o=0,a=0,s=0,l=0;const c=this.center;for(const h of r){const e=t.bK(c.lng,h.lng),i=t.bK(c.lat,h.lat);e<a&&(a=e),e>o&&(o=e),i<l&&(l=i),i>s&&(s=i)}const u=[c.lng+a,c.lat+l,c.lng+o,c.lat+s];return this.isSurfacePointOnScreen([0,1,0])&&(u[3]=90,u[0]=-180,u[2]=180),this.isSurfacePointOnScreen([0,-1,0])&&(u[1]=-90,u[0]=-180,u[2]=180),new W(u)}calculateCenterFromCameraLngLatAlt(e,t,i,n){return this._helper.calculateCenterFromCameraLngLatAlt(e,t,i,n)}setLocationAtPoint(e,i){const n=gi(this.unprojectScreenPoint(i)),r=gi(e),o=t.bz();t.bL(o);const a=t.bz();t.bI(a,n,o,-this.center.lng*Math.PI/180),t.bH(a,a,o,this.center.lat*Math.PI/180);const s=r[0]*r[0]+r[2]*r[2],l=a[0]*a[0];if(s<l)return;const c=Math.sqrt(s-l),u=-c,h=t.bM(r[0],r[2],a[0],c),d=t.bM(r[0],r[2],a[0],u),p=t.bz();t.bI(p,r,o,-h);const f=t.bM(p[1],p[2],a[1],a[2]),m=t.bz();t.bI(m,r,o,-d);const g=t.bM(m[1],m[2],a[1],a[2]),_=.5*Math.PI,y=f>=-_&&f<=_,v=g>=-_&&g<=_;let x,b;if(y&&v){const e=this.center.lng*Math.PI/180,i=this.center.lat*Math.PI/180;t.bN(h,e)+t.bN(f,i)<t.bN(d,e)+t.bN(g,i)?(x=h,b=f):(x=d,b=g)}else if(y)x=h,b=f;else{if(!v)return;x=d,b=g}const w=x/Math.PI*180,T=b/Math.PI*180,S=this.center.lat;this.setCenter(new t.V(w,t.an(T,-90,90))),this.setZoom(this.zoom+xi(S,this.center.lat))}locationToScreenPoint(e,i){const n=gi(e);if(i){const r=i.getElevationForLngLatZoom(e,this._helper._tileZoom);t.a$(n,n,1+r/t.bE)}return this._projectSurfacePointToScreen(n)}_projectSurfacePointToScreen(e){const i=t.bF();return t.aH(i,[...e,1],this._globeViewProjMatrixNoCorrection),i[0]/=i[3],i[1]/=i[3],new t.P((.5*i[0]+.5)*this.width,(.5*-i[1]+.5)*this.height)}screenPointToMercatorCoordinate(e,i){if(i){const t=i.pointCoordinate(e);if(t)return t}return t.a9.fromLngLat(this.unprojectScreenPoint(e))}screenPointToLocation(e,t){var i;return null===(i=this.screenPointToMercatorCoordinate(e,t))||void 0===i?void 0:i.toLngLat()}isPointOnMapSurface(e,t){const i=this._cameraPosition,n=this.getRayDirectionFromPixel(e);return!!this.rayPlanetIntersection(i,n)}getRayDirectionFromPixel(e){const i=t.bF();i[0]=e.x/this.width*2-1,i[1]=-1*(e.y/this.height*2-1),i[2]=1,i[3]=1,t.aH(i,i,this._globeViewProjMatrixNoCorrectionInverted),i[0]/=i[3],i[1]/=i[3],i[2]/=i[3];const n=t.bz();n[0]=i[0]-this._cameraPosition[0],n[1]=i[1]-this._cameraPosition[1],n[2]=i[2]-this._cameraPosition[2];const r=t.bz();return t.b3(r,n),r}isSurfacePointVisible(e){const t=this._cachedClippingPlane;return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]>=0}isSurfacePointOnScreen(e){if(!this.isSurfacePointVisible(e))return!1;const i=t.bF();return t.aH(i,[...e,1],this._globeViewProjMatrixNoCorrection),i[0]/=i[3],i[1]/=i[3],i[2]/=i[3],i[0]>-1&&i[0]<1&&i[1]>-1&&i[1]<1&&i[2]>-1&&i[2]<1}rayPlanetIntersection(e,i){const n=t.b5(e,i),r=t.bz(),o=t.bz();t.a$(o,i,n),t.b2(r,e,o);const a=1-t.b5(r,r);if(a<0)return null;const s=t.b5(e,e)-1,l=-n+(n<0?1:-1)*Math.sqrt(a),c=s/l,u=l;return{tMin:Math.min(c,u),tMax:Math.max(c,u)}}unprojectScreenPoint(e){const i=this._cameraPosition,n=this.getRayDirectionFromPixel(e),r=this.rayPlanetIntersection(i,n);if(r){const e=t.bz();t.b0(e,i,[n[0]*r.tMin,n[1]*r.tMin,n[2]*r.tMin]);const o=t.bz();return t.b3(o,e),yi(o)}const o=this._cachedClippingPlane,a=o[0]*n[0]+o[1]*n[1]+o[2]*n[2],s=-t.bb(o,i)/a,l=t.bz();if(s>0)t.b0(l,i,[n[0]*s,n[1]*s,n[2]*s]);else{const e=t.bz();t.b0(e,i,[2*n[0],2*n[1],2*n[2]]);const r=t.bb(this._cachedClippingPlane,e);t.b2(l,e,[this._cachedClippingPlane[0]*r,this._cachedClippingPlane[1]*r,this._cachedClippingPlane[2]*r])}const c=function(e){const i=t.bz();return i[0]=e[0]*-e[3],i[1]=e[1]*-e[3],i[2]=e[2]*-e[3],{center:i,radius:Math.sqrt(1-e[3]*e[3])}}(o);return yi(function(e,i,n){const r=t.bz();t.b2(r,n,e);const o=t.bz();return t.bA(o,e,r,i/t.b9(r)),o}(c.center,c.radius,l))}getMatrixForModel(e,i){const n=t.V.convert(e),r=1/t.bE,o=t.bj();return t.bJ(o,o,n.lng/180*Math.PI),t.bh(o,o,-n.lat/180*Math.PI),t.O(o,o,[0,0,1+i/t.bE]),t.bh(o,o,.5*Math.PI),t.Q(o,o,[r,r,r]),o}getProjectionDataForCustomLayer(e=!0){const i=this.getProjectionData({overscaledTileID:new t.a2(0,0,0,0,0),applyGlobeMatrix:e});return i.tileMercatorCoords=[0,0,1,1],i}getFastPathSimpleProjectionMatrix(e){}}class zi{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,t,i){return this._helper.interpolatePadding(e,t,i)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,t,i=!0){this._helper.resize(e,t,i)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}setConstrainOverride(e){this._helper.setConstrainOverride(e)}overrideNearFarZ(e,t){this._helper.overrideNearFarZ(e,t)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}get isGlobeRendering(){return this._globeness>0}setTransitionState(e,t){this._globeness=e,this._globeLatitudeErrorCorrectionRadians=t,this._calcMatrices(),this._verticalPerspectiveTransform.getCoveringTilesDetailsProvider().prepareNextFrame(),this._mercatorTransform.getCoveringTilesDetailsProvider().prepareNextFrame()}get currentTransform(){return this.isGlobeRendering?this._verticalPerspectiveTransform:this._mercatorTransform}constructor(e){this._globeLatitudeErrorCorrectionRadians=0,this._globeness=1,this.defaultConstrain=(e,t)=>this.currentTransform.defaultConstrain(e,t),this.applyConstrain=(e,t)=>this._helper.applyConstrain(e,t),this._helper=new Gt({calcMatrices:()=>{this._calcMatrices()},defaultConstrain:(e,t)=>this.defaultConstrain(e,t)},e),this._globeness=1,this._mercatorTransform=new Ht,this._verticalPerspectiveTransform=new Ii}clone(){const e=new zi;return e._globeness=this._globeness,e._globeLatitudeErrorCorrectionRadians=this._globeLatitudeErrorCorrectionRadians,e.apply(this,!1),e}apply(e,t){this._helper.apply(e,t),this._mercatorTransform.apply(this,!1),this._verticalPerspectiveTransform.apply(this,!1,this._globeLatitudeErrorCorrectionRadians)}get projectionMatrix(){return this.currentTransform.projectionMatrix}get modelViewProjectionMatrix(){return this.currentTransform.modelViewProjectionMatrix}get inverseProjectionMatrix(){return this.currentTransform.inverseProjectionMatrix}get cameraPosition(){return this.currentTransform.cameraPosition}getProjectionData(e){const t=this._mercatorTransform.getProjectionData(e),i=this._verticalPerspectiveTransform.getProjectionData(e);return{mainMatrix:this.isGlobeRendering?i.mainMatrix:t.mainMatrix,clippingPlane:i.clippingPlane,tileMercatorCoords:i.tileMercatorCoords,projectionTransition:e.applyGlobeMatrix?this._globeness:0,fallbackMatrix:t.fallbackMatrix}}isLocationOccluded(e){return this.currentTransform.isLocationOccluded(e)}transformLightDirection(e){return this.currentTransform.transformLightDirection(e)}getPixelScale(){return t.bu(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return t.bu(this._mercatorTransform.getCircleRadiusCorrection(),this._verticalPerspectiveTransform.getCircleRadiusCorrection(),this._globeness)}getPitchedTextCorrection(e,i,n){const r=this._mercatorTransform.getPitchedTextCorrection(e,i,n),o=this._verticalPerspectiveTransform.getPitchedTextCorrection(e,i,n);return t.bu(r,o,this._globeness)}projectTileCoordinates(e,t,i,n){return this.currentTransform.projectTileCoordinates(e,t,i,n)}_calcMatrices(){this._helper._width&&this._helper._height&&(this._verticalPerspectiveTransform.apply(this,!1,this._globeLatitudeErrorCorrectionRadians),this._helper._nearZ=this._verticalPerspectiveTransform.nearZ,this._helper._farZ=this._verticalPerspectiveTransform.farZ,this._mercatorTransform.apply(this,!0,this.isGlobeRendering),this._helper._nearZ=this._mercatorTransform.nearZ,this._helper._farZ=this._mercatorTransform.farZ)}calculateFogMatrix(e){return this.currentTransform.calculateFogMatrix(e)}getVisibleUnwrappedCoordinates(e){return this.currentTransform.getVisibleUnwrappedCoordinates(e)}getCameraFrustum(){return this.currentTransform.getCameraFrustum()}getClippingPlane(){return this.currentTransform.getClippingPlane()}getCoveringTilesDetailsProvider(){return this.currentTransform.getCoveringTilesDetailsProvider()}recalculateZoomAndCenter(e){this._mercatorTransform.recalculateZoomAndCenter(e),this._verticalPerspectiveTransform.recalculateZoomAndCenter(e)}maxPitchScaleFactor(){return this._mercatorTransform.maxPitchScaleFactor()}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(e,t){return this.currentTransform.lngLatToCameraDepth(e,t)}populateCache(e){this._mercatorTransform.populateCache(e),this._verticalPerspectiveTransform.populateCache(e)}getBounds(){return this.currentTransform.getBounds()}calculateCenterFromCameraLngLatAlt(e,t,i,n){return this._helper.calculateCenterFromCameraLngLatAlt(e,t,i,n)}setLocationAtPoint(e,t){if(!this.isGlobeRendering)return this._mercatorTransform.setLocationAtPoint(e,t),void this.apply(this._mercatorTransform,!1);this._verticalPerspectiveTransform.setLocationAtPoint(e,t),this.apply(this._verticalPerspectiveTransform,!1)}locationToScreenPoint(e,t){return this.currentTransform.locationToScreenPoint(e,t)}screenPointToMercatorCoordinate(e,t){return this.currentTransform.screenPointToMercatorCoordinate(e,t)}screenPointToLocation(e,t){return this.currentTransform.screenPointToLocation(e,t)}isPointOnMapSurface(e,t){return this.currentTransform.isPointOnMapSurface(e,t)}getRayDirectionFromPixel(e){return this._verticalPerspectiveTransform.getRayDirectionFromPixel(e)}getMatrixForModel(e,t){return this.currentTransform.getMatrixForModel(e,t)}getProjectionDataForCustomLayer(e=!0){const t=this._mercatorTransform.getProjectionDataForCustomLayer(e);if(!this.isGlobeRendering)return t;const i=this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(e);return i.fallbackMatrix=t.mainMatrix,i}getFastPathSimpleProjectionMatrix(e){return this.currentTransform.getFastPathSimpleProjectionMatrix(e)}}class Ai{get useGlobeControls(){return!0}handlePanInertia(e,i){const n=bi(e,i);return Math.abs(n.lng-i.center.lng)>180&&(n.lng=i.center.lng+179.5*Math.sign(n.lng-i.center.lng)),{easingCenter:n,easingOffset:new t.P(0,0)}}handleMapControlsRollPitchBearingZoom(e,i){const n=e.around,r=i.screenPointToLocation(n);e.bearingDelta&&i.setBearing(i.bearing+e.bearingDelta),e.pitchDelta&&i.setPitch(i.pitch+e.pitchDelta),e.rollDelta&&i.setRoll(i.roll+e.rollDelta);const o=i.zoom;e.zoomDelta&&i.setZoom(i.zoom+e.zoomDelta);const a=i.zoom-o;if(0===a)return;const s=t.bK(i.center.lng,r.lng),l=s/(Math.abs(s/180)+1),c=t.bK(i.center.lat,r.lat),u=i.getRayDirectionFromPixel(n),h=i.cameraPosition,d=-1*t.b5(h,u),p=t.bz();t.b0(p,h,[u[0]*d,u[1]*d,u[2]*d]);const f=t.b7(p)-1,m=Math.exp(.5*-Math.max(f-.3,0)),g=_i(i.worldSize,i.center.lat)/Math.min(i.width,i.height),_=t.bx(g,.9,.5,1,.25),y=(1-t.aq(-a))*Math.min(m,_),v=i.center.lat,x=i.zoom,b=new t.V(i.center.lng+l*y,t.an(i.center.lat+c*y,-t.ao,t.ao));i.setLocationAtPoint(r,n);const w=i.center,T=t.bx(Math.abs(s),45,85,0,1),S=t.bx(g,.75,.35,0,1),P=Math.pow(Math.max(T,S),.25),M=t.bK(w.lng,b.lng),E=t.bK(w.lat,b.lat);i.setCenter(new t.V(w.lng+M*P,w.lat+E*P).wrap()),i.setZoom(x+xi(v,i.center.lat))}handleMapControlsPan(e,t,i){if(!e.panDelta)return;const n=t.center.lat,r=t.zoom;t.setCenter(bi(e.panDelta,t).wrap()),t.setZoom(r+xi(n,t.center.lat))}cameraForBoxAndBearing(e,i,n,r,o){const a=Kt(e,i,n,r,o),s=i.left/o.width*2-1,l=(o.width-i.right)/o.width*2-1,c=i.top/o.height*-2+1,u=(o.height-i.bottom)/o.height*-2+1,h=t.bK(n.getWest(),n.getEast())<0,d=h?n.getEast():n.getWest(),p=h?n.getWest():n.getEast(),f=Math.max(n.getNorth(),n.getSouth()),m=Math.min(n.getNorth(),n.getSouth()),g=d+.5*t.bK(d,p),_=f+.5*t.bK(f,m),y=o.clone();y.setCenter(a.center),y.setBearing(a.bearing),y.setPitch(0),y.setRoll(0),y.setZoom(a.zoom);const v=y.modelViewProjectionMatrix,x=[gi(n.getNorthWest()),gi(n.getNorthEast()),gi(n.getSouthWest()),gi(n.getSouthEast()),gi(new t.V(p,_)),gi(new t.V(d,_)),gi(new t.V(g,f)),gi(new t.V(g,m))],b=gi(a.center);let w=Number.POSITIVE_INFINITY;for(const t of x)s<0&&(w=Ai.getLesserNonNegativeNonNull(w,Ai.solveVectorScale(t,b,v,"x",s))),l>0&&(w=Ai.getLesserNonNegativeNonNull(w,Ai.solveVectorScale(t,b,v,"x",l))),c>0&&(w=Ai.getLesserNonNegativeNonNull(w,Ai.solveVectorScale(t,b,v,"y",c))),u<0&&(w=Ai.getLesserNonNegativeNonNull(w,Ai.solveVectorScale(t,b,v,"y",u)));if(Number.isFinite(w)&&0!==w)return a.zoom=y.zoom+t.at(w),a;Xt()}handleJumpToCenterZoom(e,i){const n=e.center.lat,r=e.applyConstrain(i.center?t.V.convert(i.center):e.center,e.zoom).center;e.setCenter(r.wrap());const o=void 0!==i.zoom?+i.zoom:e.zoom+xi(n,r.lat);e.zoom!==o&&e.setZoom(o)}handleEaseTo(e,i){const n=e.zoom,r=e.center,o=e.padding,a={roll:e.roll,pitch:e.pitch,bearing:e.bearing},s={roll:void 0===i.roll?e.roll:i.roll,pitch:void 0===i.pitch?e.pitch:i.pitch,bearing:void 0===i.bearing?e.bearing:i.bearing},l=void 0!==i.zoom,c=!e.isPaddingEqual(i.padding);let u=!1;const h=i.center?t.V.convert(i.center):r,d=e.applyConstrain(h,n).center;Ut(e,d);const p=e.clone();p.setCenter(d),p.setZoom(l?+i.zoom:n+xi(r.lat,h.lat)),p.setBearing(i.bearing);const f=new t.P(t.an(e.centerPoint.x+i.offsetAsPoint.x,0,e.width),t.an(e.centerPoint.y+i.offsetAsPoint.y,0,e.height));p.setLocationAtPoint(d,f);const m=(i.offset&&i.offsetAsPoint.mag())>0?p.center:d,g=l?+i.zoom:n+xi(r.lat,m.lat),_=n+xi(r.lat,0),y=g+xi(m.lat,0),v=t.bK(r.lng,m.lng),x=t.bK(r.lat,m.lat),b=t.aq(y-_);return u=g!==n,{easeFunc:n=>{if(t.bo(a,s)||Yt({startEulerAngles:a,endEulerAngles:s,tr:e,k:n,useSlerp:a.roll!=s.roll}),c&&e.interpolatePadding(o,i.padding,n),i.around)t.w("Easing around a point is not supported under globe projection."),e.setLocationAtPoint(i.around,i.aroundPoint);else{const t=y>_?Math.min(2,b):Math.max(.5,b),i=Math.pow(t,1-n),o=Ti(r,v,x,n*i);e.setCenter(o.wrap())}if(u){const i=t.G.number(_,y,n)+xi(0,e.center.lat);e.setZoom(i)}},isZooming:u,elevationCenter:m}}handleFlyTo(e,i){const n=void 0!==i.zoom,r=e.center,o=e.zoom,a=e.padding,s=!e.isPaddingEqual(i.padding),l=e.applyConstrain(t.V.convert(i.center||i.locationAtOffset),o).center,c=n?+i.zoom:e.zoom+xi(e.center.lat,l.lat),u=e.clone();u.setCenter(l),u.setZoom(c),u.setBearing(i.bearing);const h=new t.P(t.an(e.centerPoint.x+i.offsetAsPoint.x,0,e.width),t.an(e.centerPoint.y+i.offsetAsPoint.y,0,e.height));u.setLocationAtPoint(l,h);const d=u.center;Ut(e,d);const p=function(e,i,n){const r=gi(i),o=gi(n),a=t.b5(r,o),s=Math.acos(a),l=fi(e);return s/(2*Math.PI)*l}(e,r,d),f=o+xi(r.lat,0),m=c+xi(d.lat,0),g=t.aq(m-f);let _;if("number"==typeof i.minZoom){const n=+i.minZoom+xi(d.lat,0),r=Math.min(n,f,m)+xi(0,d.lat),o=e.applyConstrain(d,r).zoom+xi(d.lat,0);_=t.aq(o-f)}const y=t.bK(r.lng,d.lng),v=t.bK(r.lat,d.lat);return{easeFunc:(n,o,l,u)=>{const h=Ti(r,y,v,l);s&&e.interpolatePadding(a,i.padding,n);const p=1===n?d:h;e.setCenter(p.wrap());const m=f+t.at(o);e.setZoom(1===n?c:m+xi(0,p.lat))},scaleOfZoom:g,targetCenter:d,scaleOfMinZoom:_,pixelPathLength:p}}static solveVectorScale(e,t,i,n,r){const o="x"===n?[i[0],i[4],i[8],i[12]]:[i[1],i[5],i[9],i[13]],a=[i[3],i[7],i[11],i[15]],s=e[0]*o[0]+e[1]*o[1]+e[2]*o[2],l=e[0]*a[0]+e[1]*a[1]+e[2]*a[2],c=t[0]*o[0]+t[1]*o[1]+t[2]*o[2],u=t[0]*a[0]+t[1]*a[1]+t[2]*a[2];return c+r*l===s+r*u||a[3]*(s-c)+o[3]*(u-l)+s*u==c*l?null:(c+o[3]-r*u-r*a[3])/(c-s-r*u+r*l)}static getLesserNonNegativeNonNull(e,t){return null!==t&&t>=0&&t<e?t:e}}class Li{constructor(e){this._globe=e,this._mercatorCameraHelper=new Qt,this._verticalPerspectiveCameraHelper=new Ai}get useGlobeControls(){return this._globe.useGlobeRendering}get currentHelper(){return this.useGlobeControls?this._verticalPerspectiveCameraHelper:this._mercatorCameraHelper}handlePanInertia(e,t){return this.currentHelper.handlePanInertia(e,t)}handleMapControlsRollPitchBearingZoom(e,t){return this.currentHelper.handleMapControlsRollPitchBearingZoom(e,t)}handleMapControlsPan(e,t,i){this.currentHelper.handleMapControlsPan(e,t,i)}cameraForBoxAndBearing(e,t,i,n,r){return this.currentHelper.cameraForBoxAndBearing(e,t,i,n,r)}handleJumpToCenterZoom(e,t){this.currentHelper.handleJumpToCenterZoom(e,t)}handleEaseTo(e,t){return this.currentHelper.handleEaseTo(e,t)}handleFlyTo(e,t){return this.currentHelper.handleFlyTo(e,t)}}const Di=(e,i)=>t.B(e,i&&i.filter(e=>"source.canvas"!==e.identifier)),Ri=t.bO();class Fi extends t.E{constructor(e,i={}){var n,r;super(),this._rtlPluginLoaded=()=>{for(const e in this.tileManagers){const t=this.tileManagers[e].getSource().type;"vector"!==t&&"geojson"!==t||this.tileManagers[e].reload()}},this.map=e,this.dispatcher=new j(N(),e._getMapId()),this.dispatcher.registerMessageHandler("GG",(e,t)=>this.getGlyphs(e,t)),this.dispatcher.registerMessageHandler("GI",(e,t)=>this.getImages(e,t)),this.dispatcher.registerMessageHandler("GDA",(e,t)=>this.getDashes(e,t)),this.imageManager=new w,this.imageManager.setEventedParent(this);const o=(null===(n=e._container)||void 0===n?void 0:n.lang)||"undefined"!=typeof document&&(null===(r=document.documentElement)||void 0===r?void 0:r.lang)||void 0;this.glyphManager=new E(e._requestManager,i.localIdeographFontFamily,o),this.lineAtlas=new L(256,512),this.crossTileSymbolIndex=new At,this._setInitialValues(),this._resetUpdates(),this.dispatcher.broadcast("SR",t.bP()),ce().on(ae,this._rtlPluginLoaded),this.on("data",e=>{if("source"!==e.dataType||"metadata"!==e.sourceDataType)return;const t=this.tileManagers[e.sourceId];if(!t)return;const i=t.getSource();if(i&&i.vectorLayerIds)for(const n in this._layers){const e=this._layers[n];e.source===i.id&&this._validateLayer(e)}})}_setInitialValues(){var e;this._spritesImagesIds={},this._layers={},this._order=[],this.tileManagers={},this.zoomHistory=new t.bQ,this._availableImages=[],this._globalState={},this._serializedLayers={},this.stylesheet=null,this.light=null,this.sky=null,this.projection&&(this.projection.destroy(),delete this.projection),this._loaded=!1,this._changed=!1,this._updatedLayers={},this._updatedSources={},this._changedImages={},this._glyphsDidChange=!1,this._updatedPaintProps={},this._layerOrderChanged=!1,this.crossTileSymbolIndex=new((null===(e=this.crossTileSymbolIndex)||void 0===e?void 0:e.constructor)||Object),this.pauseablePlacement=void 0,this.placement=void 0,this.z=0}setGlobalStateProperty(e,i){var n,r,o;this._checkLoaded();const a=null===i?null!==(o=null===(r=null===(n=this.stylesheet.state)||void 0===n?void 0:n[e])||void 0===r?void 0:r.default)&&void 0!==o?o:null:i;if(t.bR(a,this._globalState[e]))return this;this._globalState[e]=a,this._applyGlobalStateChanges([e])}getGlobalState(){return this._globalState}setGlobalState(e){this._checkLoaded();const i=[];for(const n in e)!t.bR(this._globalState[n],e[n].default)&&(i.push(n),this._globalState[n]=e[n].default);this._applyGlobalStateChanges(i)}_applyGlobalStateChanges(e){if(0===e.length)return;const t=new Set,i={};for(const n of e){i[n]=this._globalState[n];for(const e in this._layers){const i=this._layers[e],r=i.getLayoutAffectingGlobalStateRefs(),o=i.getPaintAffectingGlobalStateRefs(),a=i.getVisibilityAffectingGlobalStateRefs();if(r.has(n)&&t.add(i.source),o.has(n))for(const{name:e,value:t}of o.get(n))this._updatePaintProperty(i,e,t);(null==a?void 0:a.has(n))&&(i.recalculateVisibility(),this._updateLayer(i))}}this.dispatcher.broadcast("UGS",i);for(const n in this.tileManagers)t.has(n)&&(this._reloadSource(n),this._changed=!0)}loadURL(e,i={},n){this.fire(new t.l("dataloading",{dataType:"style"})),i.validate="boolean"!=typeof i.validate||i.validate;const r=this.map._requestManager.transformRequest(e,"Style");this._loadStyleRequest=new AbortController;const o=this._loadStyleRequest;t.j(r,this._loadStyleRequest).then(e=>{this._loadStyleRequest=null,this._load(e.data,i,n)}).catch(e=>{this._loadStyleRequest=null,e&&!o.signal.aborted&&this.fire(new t.k(e))})}loadJSON(e,i={},n){this.fire(new t.l("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,s.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,i.validate=!1!==i.validate,this._load(e,i,n)}).catch(()=>{})}loadEmpty(){this.fire(new t.l("dataloading",{dataType:"style"})),this._load(Ri,{validate:!1})}_load(e,i,n){var r,o;let a=i.transformStyle?i.transformStyle(n,e):e;if(!i.validate||!Di(this,t.C(a))){a=Object.assign({},a),this._loaded=!0,this.stylesheet=a;for(const e in a.sources)this.addSource(e,a.sources[e],{validate:!1});a.sprite?this._loadSprite(a.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(a.glyphs),this._createLayers(),this.light=new I(this.stylesheet.light),this._setProjectionInternal((null===(r=this.stylesheet.projection)||void 0===r?void 0:r.type)||"mercator"),this.sky=new A(this.stylesheet.sky),this.map.setTerrain(null!==(o=this.stylesheet.terrain)&&void 0!==o?o:null),this.fire(new t.l("data",{dataType:"style"})),this.fire(new t.l("style.load"))}}_createLayers(){var e,i,n;const r=t.bS(this.stylesheet.layers);this.setGlobalState(null!==(e=this.stylesheet.state)&&void 0!==e?e:null),this.dispatcher.broadcast("SL",r),this._order=r.map(e=>e.id),this._layers={},this._serializedLayers=null;for(const o of r){const e=t.bT(o,this._globalState);if(e.setEventedParent(this,{layer:{id:o.id}}),this._layers[o.id]=e,t.bU(e)&&this.tileManagers[e.source]){const t=null!==(n=null===(i=o.paint)||void 0===i?void 0:i["raster-fade-duration"])&&void 0!==n?n:e.paint.get("raster-fade-duration");this.tileManagers[e.source].setRasterFadeDuration(t)}}}_loadSprite(e,i=!1,n=void 0){this.imageManager.setLoaded(!1);const r=new AbortController;let o;this._spriteRequest=r,function(e,i,n,r){return t._(this,void 0,void 0,function*(){const o=v(e),a=n>1?"@2x":"",l={},c={};for(const{id:e,url:n}of o){const o=i.transformRequest(x(n,a,".json"),"SpriteJSON");l[e]=t.j(o,r);const s=i.transformRequest(x(n,a,".png"),"SpriteImage");c[e]=_.getImage(s,r)}return yield Promise.all([...Object.values(l),...Object.values(c)]),function(e,i){return t._(this,void 0,void 0,function*(){const t={};for(const n in e){t[n]={};const r=s.getImageCanvasContext((yield i[n]).data),o=(yield e[n]).data;for(const e in o){const{width:i,height:a,x:s,y:l,sdf:c,pixelRatio:u,stretchX:h,stretchY:d,content:p,textFitWidth:f,textFitHeight:m}=o[e];t[n][e]={data:null,pixelRatio:u,sdf:c,stretchX:h,stretchY:d,content:p,textFitWidth:f,textFitHeight:m,spriteData:{width:i,height:a,x:s,y:l,context:r}}}}return t})}(l,c)})}(e,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(e=>{if(this._spriteRequest=null,e)for(const t in e){this._spritesImagesIds[t]=[];const n=this._spritesImagesIds[t]?this._spritesImagesIds[t].filter(t=>!(t in e)):[];for(const e of n)this.imageManager.removeImage(e),this._changedImages[e]=!0;for(const r in e[t]){const n="default"===t?r:`${t}:${r}`;this._spritesImagesIds[t].push(n),n in this.imageManager.images?this.imageManager.updateImage(n,e[t][r],!1):this.imageManager.addImage(n,e[t][r]),i&&(this._changedImages[n]=!0)}}}).catch(e=>{this._spriteRequest=null,o=e,r.signal.aborted||this.fire(new t.k(o))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),i&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new t.l("data",{dataType:"style"})),n&&n(o)})}_unloadSprite(){for(const e of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(e),this._changedImages[e]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new t.l("data",{dataType:"style"}))}_validateLayer(e){const i=this.tileManagers[e.source];if(!i)return;const n=e.sourceLayer;if(!n)return;const r=i.getSource();("geojson"===r.type||r.vectorLayerIds&&-1===r.vectorLayerIds.indexOf(n))&&this.fire(new t.k(new Error(`Source layer "${n}" does not exist on source "${r.id}" as specified by style layer "${e.id}".`)))}loaded(){if(!this._loaded)return!1;if(Object.keys(this._updatedSources).length)return!1;for(const e in this.tileManagers)if(!this.tileManagers[e].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(e,i=!1){const n=this._serializedAllLayers();if(!e||0===e.length)return Object.values(i?t.bV(n):n);const r=[];for(const o of e)if(n[o]){const e=i?t.bV(n[o]):n[o];r.push(e)}return r}_serializedAllLayers(){let e=this._serializedLayers;if(e)return e;e=this._serializedLayers={};const t=Object.keys(this._layers);for(const i of t){const t=this._layers[i];"custom"!==t.type&&(e[i]=t.serialize())}return e}hasTransitions(){var e,t,i;if(null===(e=this.light)||void 0===e?void 0:e.hasTransition())return!0;if(null===(t=this.sky)||void 0===t?void 0:t.hasTransition())return!0;if(null===(i=this.projection)||void 0===i?void 0:i.hasTransition())return!0;for(const n in this.tileManagers)if(this.tileManagers[n].hasTransition())return!0;for(const n in this._layers)if(this._layers[n].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(e){if(!this._loaded)return;const i=this._changed;if(i){const t=Object.keys(this._updatedLayers),i=Object.keys(this._removedLayers);(t.length||i.length)&&this._updateWorkerLayers(t,i);for(const e in this._updatedSources){const t=this._updatedSources[e];if("reload"===t)this._reloadSource(e);else{if("clear"!==t)throw new Error(`Invalid action ${t}`);this._clearSource(e)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const n in this._updatedPaintProps)this._layers[n].updateTransitions(e);this.light.updateTransitions(e),this.sky.updateTransitions(e),this._resetUpdates()}const n={};for(const t in this.tileManagers){const e=this.tileManagers[t];n[t]=e.used,e.used=!1}for(const t of this._order){const i=this._layers[t];i.recalculate(e,this._availableImages),!i.isHidden(e.zoom)&&i.source&&(this.tileManagers[i.source].used=!0)}for(const r in n){const e=this.tileManagers[r];!!n[r]!=!!e.used&&e.fire(new t.l("data",{sourceDataType:"visibility",dataType:"source",sourceId:r}))}this.light.recalculate(e),this.sky.recalculate(e),this.projection.recalculate(e),this.z=e.zoom,i&&this.fire(new t.l("data",{dataType:"style"}))}_updateTilesForChangedImages(){const e=Object.keys(this._changedImages);if(e.length){for(const t in this.tileManagers)this.tileManagers[t].reloadTilesForDependencies(["icons","patterns"],e);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const e in this.tileManagers)this.tileManagers[e].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(e,t){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(e,!1),removedIds:t})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(e,i={}){var n;this._checkLoaded();const r=this.serialize();if(e=i.transformStyle?i.transformStyle(r,e):e,(null===(n=i.validate)||void 0===n||n)&&Di(this,t.C(e)))return!1;(e=t.bV(e)).layers=t.bS(e.layers);const o=t.bW(r,e),a=this._getOperationsToPerform(o);if(a.unimplemented.length>0)throw new Error(`Unimplemented: ${a.unimplemented.join(", ")}.`);if(0===a.operations.length)return!1;for(const t of a.operations)t();return this.stylesheet=e,this._serializedLayers=null,this.fire(new t.l("style.load",{style:this})),!0}_getOperationsToPerform(e){const t=[],i=[];for(const n of e)switch(n.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":case"setRoll":continue;case"addLayer":t.push(()=>this.addLayer.apply(this,n.args));break;case"removeLayer":t.push(()=>this.removeLayer.apply(this,n.args));break;case"setPaintProperty":t.push(()=>this.setPaintProperty.apply(this,n.args));break;case"setLayoutProperty":t.push(()=>this.setLayoutProperty.apply(this,n.args));break;case"setFilter":t.push(()=>this.setFilter.apply(this,n.args));break;case"addSource":t.push(()=>this.addSource.apply(this,n.args));break;case"removeSource":t.push(()=>this.removeSource.apply(this,n.args));break;case"setLayerZoomRange":t.push(()=>this.setLayerZoomRange.apply(this,n.args));break;case"setLight":t.push(()=>this.setLight.apply(this,n.args));break;case"setGeoJSONSourceData":t.push(()=>this.setGeoJSONSourceData.apply(this,n.args));break;case"setGlyphs":t.push(()=>this.setGlyphs.apply(this,n.args));break;case"setSprite":t.push(()=>this.setSprite.apply(this,n.args));break;case"setTerrain":t.push(()=>this.map.setTerrain.apply(this,n.args));break;case"setSky":t.push(()=>this.setSky.apply(this,n.args));break;case"setProjection":this.setProjection.apply(this,n.args);break;case"setGlobalState":t.push(()=>this.setGlobalState.apply(this,n.args));break;case"setTransition":t.push(()=>{});break;default:i.push(n.command)}return{operations:t,unimplemented:i}}addImage(e,i){if(this.getImage(e))return this.fire(new t.k(new Error(`An image named "${e}" already exists.`)));this.imageManager.addImage(e,i),this._afterImageUpdated(e)}updateImage(e,t){this.imageManager.updateImage(e,t)}getImage(e){return this.imageManager.getImage(e)}removeImage(e){if(!this.getImage(e))return this.fire(new t.k(new Error(`An image named "${e}" does not exist.`)));this.imageManager.removeImage(e),this._afterImageUpdated(e)}_afterImageUpdated(e){this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new t.l("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,i,n={}){if(this._checkLoaded(),void 0!==this.tileManagers[e])throw new Error(`Source "${e}" already exists.`);if(!i.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(i).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(i.type)>=0&&this._validate(t.C.source,`sources.${e}`,i,null,n))return;this.map&&this.map._collectResourceTiming&&(i.collectResourceTiming=!0);const r=this.tileManagers[e]=new Fe(e,i,this.dispatcher);r.style=this,r.setEventedParent(this,()=>({isSourceLoaded:r.loaded(),source:r.serialize(),sourceId:e})),r.onAdd(this.map),this._changed=!0}removeSource(e){if(this._checkLoaded(),void 0===this.tileManagers[e])throw new Error("There is no source with this ID");for(const n in this._layers)if(this._layers[n].source===e)return this.fire(new t.k(new Error(`Source "${e}" cannot be removed while layer "${n}" is using it.`)));const i=this.tileManagers[e];delete this.tileManagers[e],delete this._updatedSources[e],i.fire(new t.l("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),i.setEventedParent(null),i.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(e,t){if(this._checkLoaded(),void 0===this.tileManagers[e])throw new Error(`There is no source with this ID=${e}`);const i=this.tileManagers[e].getSource();if("geojson"!==i.type)throw new Error(`geojsonSource.type is ${i.type}, which is !== 'geojson`);i.setData(t),this._changed=!0}getSource(e){return this.tileManagers[e]&&this.tileManagers[e].getSource()}addLayer(e,i,n={}){this._checkLoaded();const r=e.id;if(this.getLayer(r))return void this.fire(new t.k(new Error(`Layer "${r}" already exists on this map.`)));let o;if("custom"===e.type){if(Di(this,t.bX(e)))return;o=t.bT(e,this._globalState)}else{if("source"in e&&"object"==typeof e.source&&(this.addSource(r,e.source),e=t.bV(e),e=t.e(e,{source:r})),this._validate(t.C.layer,`layers.${r}`,e,{arrayIndex:-1},n))return;o=t.bT(e,this._globalState),this._validateLayer(o),o.setEventedParent(this,{layer:{id:r}})}const a=i?this._order.indexOf(i):this._order.length;if(i&&-1===a)this.fire(new t.k(new Error(`Cannot add layer "${r}" before non-existing layer "${i}".`)));else{if(this._order.splice(a,0,r),this._layerOrderChanged=!0,this._layers[r]=o,this._removedLayers[r]&&o.source&&"custom"!==o.type){const e=this._removedLayers[r];delete this._removedLayers[r],e.type!==o.type?this._updatedSources[o.source]="clear":(this._updatedSources[o.source]="reload",this.tileManagers[o.source].pause())}this._updateLayer(o),o.onAdd&&o.onAdd(this.map)}}moveLayer(e,i){if(this._checkLoaded(),this._changed=!0,!this._layers[e])return void this.fire(new t.k(new Error(`The layer '${e}' does not exist in the map's style and cannot be moved.`)));if(e===i)return;const n=this._order.indexOf(e);this._order.splice(n,1);const r=i?this._order.indexOf(i):this._order.length;i&&-1===r?this.fire(new t.k(new Error(`Cannot move layer "${e}" before non-existing layer "${i}".`))):(this._order.splice(r,0,e),this._layerOrderChanged=!0)}removeLayer(e){this._checkLoaded();const i=this._layers[e];if(!i)return void this.fire(new t.k(new Error(`Cannot remove non-existing layer "${e}".`)));i.setEventedParent(null);const n=this._order.indexOf(e);this._order.splice(n,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=i,delete this._layers[e],this._serializedLayers&&delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],i.onRemove&&i.onRemove(this.map)}getLayer(e){return this._layers[e]}getLayersOrder(){return[...this._order]}hasLayer(e){return e in this._layers}setLayerZoomRange(e,i,n){this._checkLoaded();const r=this.getLayer(e);r?r.minzoom===i&&r.maxzoom===n||(null!=i&&(r.minzoom=i),null!=n&&(r.maxzoom=n),this._updateLayer(r)):this.fire(new t.k(new Error(`Cannot set the zoom range of non-existing layer "${e}".`)))}setFilter(e,i,n={}){this._checkLoaded();const r=this.getLayer(e);if(r){if(!t.bR(r.filter,i))return null==i?(r.setFilter(void 0),void this._updateLayer(r)):void(this._validate(t.C.filter,`layers.${r.id}.filter`,i,null,n)||(r.setFilter(t.bV(i)),this._updateLayer(r)))}else this.fire(new t.k(new Error(`Cannot filter non-existing layer "${e}".`)))}getFilter(e){return t.bV(this.getLayer(e).filter)}setLayoutProperty(e,i,n,r={}){this._checkLoaded();const o=this.getLayer(e);o?t.bR(o.getLayoutProperty(i),n)||(o.setLayoutProperty(i,n,r),this._updateLayer(o)):this.fire(new t.k(new Error(`Cannot style non-existing layer "${e}".`)))}getLayoutProperty(e,i){const n=this.getLayer(e);if(n)return n.getLayoutProperty(i);this.fire(new t.k(new Error(`Cannot get style of non-existing layer "${e}".`)))}setPaintProperty(e,i,n,r={}){this._checkLoaded();const o=this.getLayer(e);o?t.bR(o.getPaintProperty(i),n)||this._updatePaintProperty(o,i,n,r):this.fire(new t.k(new Error(`Cannot style non-existing layer "${e}".`)))}_updatePaintProperty(e,i,n,r={}){e.setPaintProperty(i,n,r)&&this._updateLayer(e),t.bU(e)&&"raster-fade-duration"===i&&this.tileManagers[e.source].setRasterFadeDuration(n),this._changed=!0,this._updatedPaintProps[e.id]=!0,this._serializedLayers=null}getPaintProperty(e,t){return this.getLayer(e).getPaintProperty(t)}setFeatureState(e,i){this._checkLoaded();const n=e.source,r=e.sourceLayer,o=this.tileManagers[n];if(void 0===o)return void this.fire(new t.k(new Error(`The source '${n}' does not exist in the map's style.`)));const a=o.getSource().type;"geojson"===a&&r?this.fire(new t.k(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):"vector"!==a||r?(void 0===e.id&&this.fire(new t.k(new Error("The feature id parameter must be provided."))),o.setFeatureState(r,e.id,i)):this.fire(new t.k(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(e,i){this._checkLoaded();const n=e.source,r=this.tileManagers[n];if(void 0===r)return void this.fire(new t.k(new Error(`The source '${n}' does not exist in the map's style.`)));const o=r.getSource().type,a="vector"===o?e.sourceLayer:void 0;"vector"!==o||a?i&&"string"!=typeof e.id&&"number"!=typeof e.id?this.fire(new t.k(new Error("A feature id is required to remove its specific state property."))):r.removeFeatureState(a,e.id,i):this.fire(new t.k(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(e){this._checkLoaded();const i=e.source,n=e.sourceLayer,r=this.tileManagers[i];if(void 0!==r)return"vector"!==r.getSource().type||n?(void 0===e.id&&this.fire(new t.k(new Error("The feature id parameter must be provided."))),r.getFeatureState(n,e.id)):void this.fire(new t.k(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new t.k(new Error(`The source '${i}' does not exist in the map's style.`)))}getTransition(){return t.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const e=t.bY(this.tileManagers,e=>e.serialize()),i=this._serializeByIds(this._order,!0),n=this.map.getTerrain()||void 0,r=this.stylesheet;return t.bZ({version:r.version,name:r.name,metadata:r.metadata,light:r.light,sky:r.sky,center:r.center,zoom:r.zoom,bearing:r.bearing,pitch:r.pitch,sprite:r.sprite,glyphs:r.glyphs,transition:r.transition,projection:r.projection,sources:e,layers:i,terrain:n},e=>void 0!==e)}_updateLayer(e){this._updatedLayers[e.id]=!0,e.source&&!this._updatedSources[e.source]&&"raster"!==this.tileManagers[e.source].getSource().type&&(this._updatedSources[e.source]="reload",this.tileManagers[e.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(e){const t=e=>"fill-extrusion"===this._layers[e].type,i={},n=[];for(let o=this._order.length-1;o>=0;o--){const r=this._order[o];if(t(r)){i[r]=o;for(const t of e){const e=t[r];if(e)for(const t of e)n.push(t)}}}n.sort((e,t)=>t.intersectionZ-e.intersectionZ);const r=[];for(let o=this._order.length-1;o>=0;o--){const a=this._order[o];if(t(a))for(let e=n.length-1;e>=0;e--){const t=n[e].feature;if(i[t.layer.id]<o)break;r.push(t),n.pop()}else for(const t of e){const e=t[a];if(e)for(const t of e)r.push(t.feature)}}return r}queryRenderedFeatures(e,i,n){i&&i.filter&&this._validate(t.C.filter,"queryRenderedFeatures.filter",i.filter,null,i);const r={};if(i&&i.layers){if(!(Array.isArray(i.layers)||i.layers instanceof Set))return this.fire(new t.k(new Error("parameters.layers must be an Array or a Set of strings"))),[];for(const e of i.layers){const i=this._layers[e];if(!i)return this.fire(new t.k(new Error(`The layer '${e}' does not exist in the map's style and cannot be queried for features.`))),[];r[i.source]=!0}}const o=[];i.availableImages=this._availableImages;const a=this._serializedAllLayers(),s=i.layers instanceof Set?i.layers:Array.isArray(i.layers)?new Set(i.layers):null,l=Object.assign(Object.assign({},i),{layers:s,globalState:this._globalState});for(const t in this.tileManagers)i.layers&&!r[t]||o.push(Z(this.tileManagers[t],this._layers,a,e,l,n,this.map.terrain?(e,t,i)=>this.map.terrain.getElevation(e,t,i):void 0));return this.placement&&o.push(function(e,t,i,n,r,o,a){const s={},l=o.queryRenderedSymbols(n),c=[];for(const u of Object.keys(l).map(Number))c.push(a[u]);c.sort(G);for(const u of c){const i=u.featureIndex.lookupSymbolFeatures(l[u.bucketInstanceId],t,u.bucketIndex,u.sourceLayerIndex,{filterSpec:r.filter,globalState:r.globalState},r.layers,r.availableImages,e);for(const e in i){const t=s[e]=s[e]||[],n=i[e];n.sort((e,t)=>{const i=u.featureSortOrder;if(i){const n=i.indexOf(e.featureIndex);return i.indexOf(t.featureIndex)-n}return t.featureIndex-e.featureIndex});for(const e of n)t.push(e)}}return function(e,t,i){for(const n in e)for(const r of e[n])q(r,i[t[n].source]);return e}(s,e,i)}(this._layers,a,this.tileManagers,e,l,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(o)}querySourceFeatures(e,i){(null==i?void 0:i.filter)&&this._validate(t.C.filter,"querySourceFeatures.filter",i.filter,null,i);const n=this.tileManagers[e];return n?function(e,t){const i=e.getRenderableIds().map(t=>e.getTileByID(t)),n=[],r={};for(let o=0;o<i.length;o++){const e=i[o],a=e.tileID.canonical.key;r[a]||(r[a]=!0,e.querySourceFeatures(n,t))}return n}(n,i?Object.assign(Object.assign({},i),{globalState:this._globalState}):{globalState:this._globalState}):[]}getLight(){return this.light.getLight()}setLight(e,i={}){this._checkLoaded();const n=this.light.getLight();let r=!1;for(const a in e)if(!t.bR(e[a],n[a])){r=!0;break}if(!r)return;const o={now:c(),transition:t.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,i),this.light.updateTransitions(o)}getProjection(){var e;return null===(e=this.stylesheet)||void 0===e?void 0:e.projection}setProjection(e){if(this._checkLoaded(),this.projection){if(this.projection.name===e.type)return;this.projection.destroy(),delete this.projection}this.stylesheet.projection=e,this._setProjectionInternal(e.type)}getSky(){var e;return null===(e=this.stylesheet)||void 0===e?void 0:e.sky}setSky(e,i={}){this._checkLoaded();const n=this.getSky();let r=!1;if(!e&&!n)return;if(e&&!n)r=!0;else if(!e&&n)r=!0;else for(const a in e)if(!t.bR(e[a],n[a])){r=!0;break}if(!r)return;const o={now:c(),transition:t.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=e,this.sky.setSky(e,i),this.sky.updateTransitions(o)}_setProjectionInternal(e){const i=function(e,i){const n={constrainOverride:i};if(Array.isArray(e)){const t=new pi({type:e});return{projection:t,transform:new zi(n),cameraHelper:new Li(t)}}switch(e){case"mercator":return{projection:new jt,transform:new Ht(n),cameraHelper:new Qt};case"globe":{const e=new pi({type:["interpolate",["linear"],["zoom"],11,"vertical-perspective",12,"mercator"]});return{projection:e,transform:new zi(n),cameraHelper:new Li(e)}}case"vertical-perspective":return{projection:new hi,transform:new Ii(n),cameraHelper:new Ai};default:return t.w(`Unknown projection name: ${e}. Falling back to mercator projection.`),{projection:new jt,transform:new Ht(n),cameraHelper:new Qt}}}(e,this.map.transformConstrain);this.projection=i.projection,this.map.migrateProjection(i.transform,i.cameraHelper);for(const t in this.tileManagers)this.tileManagers[t].reload()}_validate(e,i,n,r,o={}){return(!o||!1!==o.validate)&&Di(this,e.call(t.C,t.e({key:i,style:this.serialize(),value:n,styleSpec:t.u},r)))}_remove(e=!0){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null),ce().off(ae,this._rtlPluginLoaded);for(const t in this._layers)this._layers[t].setEventedParent(null);for(const t in this.tileManagers){const e=this.tileManagers[t];e.setEventedParent(null),e.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),e&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(e)}_clearSource(e){this.tileManagers[e].clearTiles()}_reloadSource(e){this.tileManagers[e].resume(),this.tileManagers[e].reload()}_updateSources(e){for(const t in this.tileManagers)this.tileManagers[t].update(e,this.map.terrain)}_generateCollisionBoxes(){for(const e in this.tileManagers)this._reloadSource(e)}_updatePlacement(e,t,i,n,r=!1){let o=!1,a=!1;const s={};for(const l of this._order){const t=this._layers[l];if("symbol"!==t.type)continue;if(!s[t.source]){const e=this.tileManagers[t.source];s[t.source]=e.getRenderableIds(!0).map(t=>e.getTileByID(t)).sort((e,t)=>t.tileID.overscaledZ-e.tileID.overscaledZ||(e.tileID.isLessThan(t.tileID)?-1:1))}const i=this.crossTileSymbolIndex.addLayer(t,s[t.source],e.center.lng);o=o||i}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((r=r||this._layerOrderChanged||0===i)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(c(),e.zoom))&&(this.pauseablePlacement=new Et(e,this.map.terrain,this._order,r,t,i,n,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,s),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(c()),a=!0),o&&this.pauseablePlacement.placement.setStale()),a||o)for(const l of this._order){const e=this._layers[l];"symbol"===e.type&&this.placement.updateLayerOpacities(e,s[e.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(c())}_releaseSymbolFadeTiles(){for(const e in this.tileManagers)this.tileManagers[e].releaseSymbolFadeTiles()}getImages(e,i){return t._(this,void 0,void 0,function*(){const e=yield this.imageManager.getImages(i.icons);this._updateTilesForChangedImages();const t=this.tileManagers[i.source];return t&&t.setDependencies(i.tileID.key,i.type,i.icons),e})}getGlyphs(e,i){return t._(this,void 0,void 0,function*(){const e=yield this.glyphManager.getGlyphs(i.stacks),t=this.tileManagers[i.source];return t&&t.setDependencies(i.tileID.key,i.type,[""]),e})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(e,i={}){this._checkLoaded(),e&&this._validate(t.C.glyphs,"glyphs",e,null,i)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=e,this.glyphManager.entries={},this.glyphManager.setURL(e))}getDashes(e,i){return t._(this,void 0,void 0,function*(){const e={};for(const[t,n]of Object.entries(i.dashes))e[t]=this.lineAtlas.getDash(n.dasharray,n.round);return e})}addSprite(e,i,n={},r){this._checkLoaded();const o=[{id:e,url:i}],a=[...v(this.stylesheet.sprite),...o];this._validate(t.C.sprite,"sprite",a,null,n)||(this.stylesheet.sprite=a,this._loadSprite(o,!0,r))}removeSprite(e){this._checkLoaded();const i=v(this.stylesheet.sprite);if(i.find(t=>t.id===e)){if(this._spritesImagesIds[e])for(const t of this._spritesImagesIds[e])this.imageManager.removeImage(t),this._changedImages[t]=!0;i.splice(i.findIndex(t=>t.id===e),1),this.stylesheet.sprite=i.length>0?i:void 0,delete this._spritesImagesIds[e],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new t.l("data",{dataType:"style"}))}else this.fire(new t.k(new Error(`Sprite "${e}" doesn't exists on this map.`)))}getSprite(){return v(this.stylesheet.sprite)}setSprite(e,i={},n){this._checkLoaded(),e&&this._validate(t.C.sprite,"sprite",e,null,i)||(this.stylesheet.sprite=e,e?this._loadSprite(e,!0,n):(this._unloadSprite(),n&&n(null)))}destroy(){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null);for(const e in this.tileManagers){const t=this.tileManagers[e];t.setEventedParent(null),t.onRemove(this.map)}this.tileManagers={},this.imageManager&&(this.imageManager.setEventedParent(null),this.imageManager.destroy(),this._availableImages=[],this._spritesImagesIds={}),this.glyphManager&&this.glyphManager.destroy();for(const e in this._layers){const t=this._layers[e];t.setEventedParent(null),t.onRemove&&t.onRemove(this.map)}this._setInitialValues(),this.setEventedParent(null),this.dispatcher.unregisterMessageHandler("GG"),this.dispatcher.unregisterMessageHandler("GI"),this.dispatcher.unregisterMessageHandler("GDA"),this.dispatcher.remove(!0),this._listeners={},this._oneTimeListeners={}}}var Bi=t.aU([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Oi{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(e,t,i,n,r,o,a,s,l){this.context=e;let c=this.boundPaintVertexBuffers.length!==n.length;for(let u=0;!c&&u<n.length;u++)this.boundPaintVertexBuffers[u]!==n[u]&&(c=!0);!this.vao||this.boundProgram!==t||this.boundLayoutVertexBuffer!==i||c||this.boundIndexBuffer!==r||this.boundVertexOffset!==o||this.boundDynamicVertexBuffer!==a||this.boundDynamicVertexBuffer2!==s||this.boundDynamicVertexBuffer3!==l?this.freshBind(t,i,n,r,o,a,s,l):(e.bindVertexArray.set(this.vao),a&&a.bind(),r&&r.dynamicDraw&&r.bind(),s&&s.bind(),l&&l.bind())}freshBind(e,t,i,n,r,o,a,s){const l=e.numAttributes,c=this.context,u=c.gl;this.vao&&this.destroy(),this.vao=c.createVertexArray(),c.bindVertexArray.set(this.vao),this.boundProgram=e,this.boundLayoutVertexBuffer=t,this.boundPaintVertexBuffers=i,this.boundIndexBuffer=n,this.boundVertexOffset=r,this.boundDynamicVertexBuffer=o,this.boundDynamicVertexBuffer2=a,this.boundDynamicVertexBuffer3=s,t.enableAttributes(u,e);for(const h of i)h.enableAttributes(u,e);o&&o.enableAttributes(u,e),a&&a.enableAttributes(u,e),s&&s.enableAttributes(u,e),t.bind(),t.setVertexAttribPointers(u,e,r);for(const h of i)h.bind(),h.setVertexAttribPointers(u,e,r);o&&(o.bind(),o.setVertexAttribPointers(u,e,r)),n&&n.bind(),a&&(a.bind(),a.setVertexAttribPointers(u,e,r)),s&&(s.bind(),s.setVertexAttribPointers(u,e,r)),c.currentNumAttributes=l}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}const Ni=(e,i,n,r,o)=>({u_texture:0,u_ele_delta:e,u_fog_matrix:i,u_fog_color:n?n.properties.get("fog-color"):t.bp.white,u_fog_ground_blend:n?n.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:o?0:n?n.calculateFogBlendOpacity(r):0,u_horizon_color:n?n.properties.get("horizon-color"):t.bp.white,u_horizon_fog_blend:n?n.properties.get("horizon-fog-blend"):1,u_is_globe_mode:o?1:0}),ji={mainMatrix:"u_projection_matrix",tileMercatorCoords:"u_projection_tile_mercator_coords",clippingPlane:"u_projection_clipping_plane",projectionTransition:"u_projection_transition",fallbackMatrix:"u_projection_fallback_matrix"};function Vi(e){const t=[];for(let i=0;i<e.length;i++){if(null===e[i])continue;const n=e[i].split(" ");t.push(n.pop())}return t}class Ui{constructor(e,i,n,r,o,a,s,l,c=[]){const u=e.gl;this.program=u.createProgram();const h=Vi(i.staticAttributes),d=n?n.getBinderAttributes():[],p=h.concat(d),f=Dt.prelude.staticUniforms?Vi(Dt.prelude.staticUniforms):[],m=s.staticUniforms?Vi(s.staticUniforms):[],g=i.staticUniforms?Vi(i.staticUniforms):[],_=n?n.getBinderUniforms():[],y=f.concat(m).concat(g).concat(_),v=[];for(const t of y)v.indexOf(t)<0&&v.push(t);const x=n?n.defines():[];ai(u)&&x.unshift("#version 300 es"),o&&x.push("#define OVERDRAW_INSPECTOR;"),a&&x.push("#define TERRAIN3D;"),l&&x.push(l),c&&x.push(...c);let b=x.concat(Dt.prelude.fragmentSource,s.fragmentSource,i.fragmentSource).join("\n"),w=x.concat(Dt.prelude.vertexSource,s.vertexSource,i.vertexSource).join("\n");ai(u)||(b=b.replace(/\bin\s/g,"varying ").replace("out highp vec4 fragColor;","").replace(/fragColor/g,"gl_FragColor").replace(/texture\(/g,"texture2D("),w=function(e){return e.replace(/\bin\s/g,"attribute ").replace(/\bout\s/g,"varying ").replace(/texture\(/g,"texture2D(")}(w));const T=u.createShader(u.FRAGMENT_SHADER);if(u.isContextLost())return void(this.failedToCreate=!0);if(u.shaderSource(T,b),u.compileShader(T),!u.getShaderParameter(T,u.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${u.getShaderInfoLog(T)}`);u.attachShader(this.program,T);const S=u.createShader(u.VERTEX_SHADER);if(u.isContextLost())return void(this.failedToCreate=!0);if(u.shaderSource(S,w),u.compileShader(S),!u.getShaderParameter(S,u.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${u.getShaderInfoLog(S)}`);u.attachShader(this.program,S),this.attributes={};const P={};this.numAttributes=p.length;for(let t=0;t<this.numAttributes;t++)p[t]&&(u.bindAttribLocation(this.program,t,p[t]),this.attributes[p[t]]=t);if(u.linkProgram(this.program),!u.getProgramParameter(this.program,u.LINK_STATUS))throw new Error(`Program failed to link: ${u.getProgramInfoLog(this.program)}`);u.deleteShader(S),u.deleteShader(T);for(let t=0;t<v.length;t++){const e=v[t];if(e&&!P[e]){const t=u.getUniformLocation(this.program,e);t&&(P[e]=t)}}this.fixedUniforms=r(e,P),this.terrainUniforms=((e,i)=>({u_depth:new t.b_(e,i.u_depth),u_terrain:new t.b_(e,i.u_terrain),u_terrain_dim:new t.bq(e,i.u_terrain_dim),u_terrain_matrix:new t.c0(e,i.u_terrain_matrix),u_terrain_unpack:new t.c1(e,i.u_terrain_unpack),u_terrain_exaggeration:new t.bq(e,i.u_terrain_exaggeration)}))(e,P),this.projectionUniforms=((e,i)=>({u_projection_matrix:new t.c0(e,i.u_projection_matrix),u_projection_tile_mercator_coords:new t.c1(e,i.u_projection_tile_mercator_coords),u_projection_clipping_plane:new t.c1(e,i.u_projection_clipping_plane),u_projection_transition:new t.bq(e,i.u_projection_transition),u_projection_fallback_matrix:new t.c0(e,i.u_projection_fallback_matrix)}))(e,P),this.binderUniforms=n?n.getUniforms(e,P):[]}draw(e,t,i,n,r,o,a,s,l,c,u,h,d,p,f,m,g,_,y){const v=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.setDepthMode(i),e.setStencilMode(n),e.setColorMode(r),e.setCullFace(o),s){e.activeTexture.set(v.TEXTURE2),v.bindTexture(v.TEXTURE_2D,s.depthTexture),e.activeTexture.set(v.TEXTURE3),v.bindTexture(v.TEXTURE_2D,s.texture);for(const e in this.terrainUniforms)this.terrainUniforms[e].set(s[e])}if(l)for(const b in l)this.projectionUniforms[ji[b]].set(l[b]);if(a)for(const b in this.fixedUniforms)this.fixedUniforms[b].set(a[b]);m&&m.setUniforms(e,this.binderUniforms,p,{zoom:f});let x=0;switch(t){case v.LINES:x=2;break;case v.TRIANGLES:x=3;break;case v.LINE_STRIP:x=1}for(const b of d.get()){const i=b.vaos||(b.vaos={});(i[c]||(i[c]=new Oi)).bind(e,this,u,m?m.getPaintVertexBuffers():[],h,b.vertexOffset,g,_,y),v.drawElements(t,b.primitiveLength*x,v.UNSIGNED_SHORT,b.primitiveOffset*x*2)}}}function Zi(e,i,n){const r=1/t.aN(n,1,i.transform.tileZoom),o=Math.pow(2,n.tileID.overscaledZ),a=n.tileSize*Math.pow(2,i.transform.tileZoom)/o,s=a*(n.tileID.canonical.x+n.tileID.wrap*o),l=a*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[r,e.fromScale,e.toScale],u_fade:e.t,u_pixel_coord_upper:[s>>16,l>>16],u_pixel_coord_lower:[65535&s,65535&l]}}const Gi=(e,i,n,r)=>{const o=e.style.light,a=o.properties.get("position"),s=[a.x,a.y,a.z],l=t.c4();"viewport"===o.properties.get("anchor")&&t.c5(l,e.transform.bearingInRadians),t.c6(s,s,l);const c=e.transform.transformLightDirection(s),u=o.properties.get("color");return{u_lightpos:s,u_lightpos_globe:c,u_lightintensity:o.properties.get("intensity"),u_lightcolor:[u.r,u.g,u.b],u_vertical_gradient:+i,u_opacity:n,u_fill_translate:r}},qi=(e,i,n,r,o,a,s)=>t.e(Gi(e,i,n,r),Zi(a,e,s),{u_height_factor:-Math.pow(2,o.overscaledZ)/s.tileSize/8}),$i=(e,i,n,r)=>t.e(Zi(i,e,n),{u_fill_translate:r}),Wi=(e,t)=>({u_world:e,u_fill_translate:t}),Hi=(e,i,n,r,o)=>t.e($i(e,i,n,o),{u_world:r}),Xi=(e,i,n,r,o)=>{const a=e.transform;let s,l,c=0;if("map"===n.paint.get("circle-pitch-alignment")){const e=t.aN(i,1,a.zoom);s=!0,l=[e,e],c=e/(t.a5*Math.pow(2,i.tileID.overscaledZ))*2*Math.PI*o}else s=!1,l=a.pixelsToGLUnits;return{u_camera_to_center_distance:a.cameraToCenterDistance,u_scale_with_map:+("map"===n.paint.get("circle-pitch-scale")),u_pitch_with_map:+s,u_device_pixel_ratio:e.pixelRatio,u_extrude_scale:l,u_globe_extrude_scale:c,u_translate:r}},Yi=e=>({u_pixel_extrude_scale:[1/e.width,1/e.height]}),Ki=e=>({u_viewport_size:[e.width,e.height]}),Qi=(e,t=1)=>({u_color:e,u_overlay:0,u_overlay_scale:t}),Ji=(e,i,n,r)=>{const o=t.aN(e,1,i)/(t.a5*Math.pow(2,e.tileID.overscaledZ))*2*Math.PI*r;return{u_extrude_scale:t.aN(e,1,i),u_intensity:n,u_globe_extrude_scale:o}},en=(e,i,n,r)=>{const o=t.N();t.c7(o,0,e.width,e.height,0,0,1);const a=e.context.gl;return{u_matrix:o,u_world:[a.drawingBufferWidth,a.drawingBufferHeight],u_image:n,u_color_ramp:r,u_opacity:i.paint.get("heatmap-opacity")}},tn=(e,t,i)=>{const n=i.paint.get("hillshade-accent-color");let r;switch(i.paint.get("hillshade-method")){case"basic":r=4;break;case"combined":r=1;break;case"igor":r=2;break;case"multidirectional":r=3;break;default:r=0}const o=i.getIlluminationProperties();for(let a=0;a<o.directionRadians.length;a++)"viewport"===i.paint.get("hillshade-illumination-anchor")&&(o.directionRadians[a]+=e.transform.bearingInRadians);return{u_image:0,u_latrange:rn(0,t.tileID),u_exaggeration:i.paint.get("hillshade-exaggeration"),u_altitudes:o.altitudeRadians,u_azimuths:o.directionRadians,u_accent:n,u_method:r,u_highlights:o.highlightColor,u_shadows:o.shadowColor}},nn=(e,i)=>{const n=i.stride,r=t.N();return t.c7(r,0,t.a5,-t.a5,0,0,1),t.O(r,r,[0,-t.a5,0]),{u_matrix:r,u_image:1,u_dimension:[n,n],u_zoom:e.overscaledZ,u_unpack:i.getUnpackVector()}};function rn(e,i){const n=Math.pow(2,i.canonical.z),r=i.canonical.y;return[new t.a9(0,r/n).toLngLat().lat,new t.a9(0,(r+1)/n).toLngLat().lat]}const on=(e,t,i=0)=>({u_image:0,u_unpack:t.getUnpackVector(),u_dimension:[t.stride,t.stride],u_elevation_stops:1,u_color_stops:4,u_color_ramp_size:i,u_opacity:e.paint.get("color-relief-opacity")}),an=(e,i,n,r)=>{const o=e.transform;return{u_translation:dn(e,i,n),u_ratio:r/t.aN(i,1,o.zoom),u_device_pixel_ratio:e.pixelRatio,u_units_to_pixels:[1/o.pixelsToGLUnits[0],1/o.pixelsToGLUnits[1]]}},sn=(e,i,n,r,o)=>t.e(an(e,i,n,r),{u_image:0,u_image_height:o}),ln=(e,i,n,r,o)=>{const a=e.transform,s=hn(i,a);return{u_translation:dn(e,i,n),u_texsize:i.imageAtlasTexture.size,u_ratio:r/t.aN(i,1,a.zoom),u_device_pixel_ratio:e.pixelRatio,u_image:0,u_scale:[s,o.fromScale,o.toScale],u_fade:o.t,u_units_to_pixels:[1/a.pixelsToGLUnits[0],1/a.pixelsToGLUnits[1]]}},cn=(e,i,n,r,o)=>{const a=hn(i,e.transform);return t.e(an(e,i,n,r),{u_tileratio:a,u_crossfade_from:o.fromScale,u_crossfade_to:o.toScale,u_image:0,u_mix:o.t,u_lineatlas_width:e.lineAtlas.width,u_lineatlas_height:e.lineAtlas.height})},un=(e,i,n,r,o,a)=>{const s=hn(i,e.transform);return t.e(an(e,i,n,r),{u_image:0,u_image_height:a,u_tileratio:s,u_crossfade_from:o.fromScale,u_crossfade_to:o.toScale,u_image_dash:1,u_mix:o.t,u_lineatlas_width:e.lineAtlas.width,u_lineatlas_height:e.lineAtlas.height})};function hn(e,i){return 1/t.aN(e,1,i.tileZoom)}function dn(e,i,n){return t.aO(e.transform,i,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}const pn=(e,t,i,n,r)=>{return{u_tl_parent:e,u_scale_parent:t,u_buffer_scale:1,u_fade_t:i.mix,u_opacity:i.opacity*n.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:n.paint.get("raster-brightness-min"),u_brightness_high:n.paint.get("raster-brightness-max"),u_saturation_factor:(a=n.paint.get("raster-saturation"),a>0?1-1/(1.001-a):-a),u_contrast_factor:(o=n.paint.get("raster-contrast"),o>0?1/(1-o):1+o),u_spin_weights:fn(n.paint.get("raster-hue-rotate")),u_coords_top:[r[0].x,r[0].y,r[1].x,r[1].y],u_coords_bottom:[r[3].x,r[3].y,r[2].x,r[2].y]};var o,a};function fn(e){e*=Math.PI/180;const t=Math.sin(e),i=Math.cos(e);return[(2*i+1)/3,(-Math.sqrt(3)*t-i+1)/3,(Math.sqrt(3)*t-i+1)/3]}const mn=(e,t,i,n,r,o,a,s,l,c,u,h,d)=>{const p=a.transform;return{u_is_size_zoom_constant:+("constant"===e||"source"===e),u_is_size_feature_constant:+("constant"===e||"camera"===e),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:p.cameraToCenterDistance,u_pitch:p.pitch/360*2*Math.PI,u_rotate_symbol:+i,u_aspect_ratio:p.width/p.height,u_fade_change:a.options.fadeDuration?a.symbolFadeChange:1,u_label_plane_matrix:s,u_coord_matrix:l,u_is_text:+u,u_pitch_with_map:+n,u_is_along_line:r,u_is_variable_anchor:o,u_texsize:h,u_texture:0,u_translation:c,u_pitched_scale:d}},gn=(e,i,n,r,o,a,s,l,c,u,h,d,p,f)=>{const m=s.transform;return t.e(mn(e,i,n,r,o,a,s,l,c,u,h,d,f),{u_gamma_scale:r?Math.cos(m.pitch*Math.PI/180)*m.cameraToCenterDistance:1,u_device_pixel_ratio:s.pixelRatio,u_is_halo:1})},_n=(e,i,n,r,o,a,s,l,c,u,h,d,p)=>t.e(gn(e,i,n,r,o,a,s,l,c,u,!0,h,0,p),{u_texsize_icon:d,u_texture_icon:1}),yn=(e,t)=>({u_opacity:e,u_color:t}),vn=(e,i,n,r,o)=>t.e(function(e,i,n,r){const o=n.imageManager.getPattern(e.from.toString()),a=n.imageManager.getPattern(e.to.toString()),{width:s,height:l}=n.imageManager.getPixelSize(),c=Math.pow(2,r.tileID.overscaledZ),u=r.tileSize*Math.pow(2,n.transform.tileZoom)/c,h=u*(r.tileID.canonical.x+r.tileID.wrap*c),d=u*r.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:o.tl,u_pattern_br_a:o.br,u_pattern_tl_b:a.tl,u_pattern_br_b:a.br,u_texsize:[s,l],u_mix:i.t,u_pattern_size_a:o.displaySize,u_pattern_size_b:a.displaySize,u_scale_a:i.fromScale,u_scale_b:i.toScale,u_tile_units_to_pixels:1/t.aN(r,1,n.transform.tileZoom),u_pixel_coord_upper:[h>>16,d>>16],u_pixel_coord_lower:[65535&h,65535&d]}}(n,o,i,r),{u_opacity:e}),xn=(e,t)=>{},bn={fillExtrusion:(e,i)=>({u_lightpos:new t.c2(e,i.u_lightpos),u_lightpos_globe:new t.c2(e,i.u_lightpos_globe),u_lightintensity:new t.bq(e,i.u_lightintensity),u_lightcolor:new t.c2(e,i.u_lightcolor),u_vertical_gradient:new t.bq(e,i.u_vertical_gradient),u_opacity:new t.bq(e,i.u_opacity),u_fill_translate:new t.c3(e,i.u_fill_translate)}),fillExtrusionPattern:(e,i)=>({u_lightpos:new t.c2(e,i.u_lightpos),u_lightpos_globe:new t.c2(e,i.u_lightpos_globe),u_lightintensity:new t.bq(e,i.u_lightintensity),u_lightcolor:new t.c2(e,i.u_lightcolor),u_vertical_gradient:new t.bq(e,i.u_vertical_gradient),u_height_factor:new t.bq(e,i.u_height_factor),u_opacity:new t.bq(e,i.u_opacity),u_fill_translate:new t.c3(e,i.u_fill_translate),u_image:new t.b_(e,i.u_image),u_texsize:new t.c3(e,i.u_texsize),u_pixel_coord_upper:new t.c3(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.c3(e,i.u_pixel_coord_lower),u_scale:new t.c2(e,i.u_scale),u_fade:new t.bq(e,i.u_fade)}),fill:(e,i)=>({u_fill_translate:new t.c3(e,i.u_fill_translate)}),fillPattern:(e,i)=>({u_image:new t.b_(e,i.u_image),u_texsize:new t.c3(e,i.u_texsize),u_pixel_coord_upper:new t.c3(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.c3(e,i.u_pixel_coord_lower),u_scale:new t.c2(e,i.u_scale),u_fade:new t.bq(e,i.u_fade),u_fill_translate:new t.c3(e,i.u_fill_translate)}),fillOutline:(e,i)=>({u_world:new t.c3(e,i.u_world),u_fill_translate:new t.c3(e,i.u_fill_translate)}),fillOutlinePattern:(e,i)=>({u_world:new t.c3(e,i.u_world),u_image:new t.b_(e,i.u_image),u_texsize:new t.c3(e,i.u_texsize),u_pixel_coord_upper:new t.c3(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.c3(e,i.u_pixel_coord_lower),u_scale:new t.c2(e,i.u_scale),u_fade:new t.bq(e,i.u_fade),u_fill_translate:new t.c3(e,i.u_fill_translate)}),circle:(e,i)=>({u_camera_to_center_distance:new t.bq(e,i.u_camera_to_center_distance),u_scale_with_map:new t.b_(e,i.u_scale_with_map),u_pitch_with_map:new t.b_(e,i.u_pitch_with_map),u_extrude_scale:new t.c3(e,i.u_extrude_scale),u_device_pixel_ratio:new t.bq(e,i.u_device_pixel_ratio),u_globe_extrude_scale:new t.bq(e,i.u_globe_extrude_scale),u_translate:new t.c3(e,i.u_translate)}),collisionBox:(e,i)=>({u_pixel_extrude_scale:new t.c3(e,i.u_pixel_extrude_scale)}),collisionCircle:(e,i)=>({u_viewport_size:new t.c3(e,i.u_viewport_size)}),debug:(e,i)=>({u_color:new t.b$(e,i.u_color),u_overlay:new t.b_(e,i.u_overlay),u_overlay_scale:new t.bq(e,i.u_overlay_scale)}),depth:xn,clippingMask:xn,heatmap:(e,i)=>({u_extrude_scale:new t.bq(e,i.u_extrude_scale),u_intensity:new t.bq(e,i.u_intensity),u_globe_extrude_scale:new t.bq(e,i.u_globe_extrude_scale)}),heatmapTexture:(e,i)=>({u_matrix:new t.c0(e,i.u_matrix),u_world:new t.c3(e,i.u_world),u_image:new t.b_(e,i.u_image),u_color_ramp:new t.b_(e,i.u_color_ramp),u_opacity:new t.bq(e,i.u_opacity)}),hillshade:(e,i)=>({u_image:new t.b_(e,i.u_image),u_latrange:new t.c3(e,i.u_latrange),u_exaggeration:new t.bq(e,i.u_exaggeration),u_altitudes:new t.c9(e,i.u_altitudes),u_azimuths:new t.c9(e,i.u_azimuths),u_accent:new t.b$(e,i.u_accent),u_method:new t.b_(e,i.u_method),u_shadows:new t.c8(e,i.u_shadows),u_highlights:new t.c8(e,i.u_highlights)}),hillshadePrepare:(e,i)=>({u_matrix:new t.c0(e,i.u_matrix),u_image:new t.b_(e,i.u_image),u_dimension:new t.c3(e,i.u_dimension),u_zoom:new t.bq(e,i.u_zoom),u_unpack:new t.c1(e,i.u_unpack)}),colorRelief:(e,i)=>({u_image:new t.b_(e,i.u_image),u_unpack:new t.c1(e,i.u_unpack),u_dimension:new t.c3(e,i.u_dimension),u_elevation_stops:new t.b_(e,i.u_elevation_stops),u_color_stops:new t.b_(e,i.u_color_stops),u_color_ramp_size:new t.b_(e,i.u_color_ramp_size),u_opacity:new t.bq(e,i.u_opacity)}),line:(e,i)=>({u_translation:new t.c3(e,i.u_translation),u_ratio:new t.bq(e,i.u_ratio),u_device_pixel_ratio:new t.bq(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.c3(e,i.u_units_to_pixels)}),lineGradient:(e,i)=>({u_translation:new t.c3(e,i.u_translation),u_ratio:new t.bq(e,i.u_ratio),u_device_pixel_ratio:new t.bq(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.c3(e,i.u_units_to_pixels),u_image:new t.b_(e,i.u_image),u_image_height:new t.bq(e,i.u_image_height)}),linePattern:(e,i)=>({u_translation:new t.c3(e,i.u_translation),u_texsize:new t.c3(e,i.u_texsize),u_ratio:new t.bq(e,i.u_ratio),u_device_pixel_ratio:new t.bq(e,i.u_device_pixel_ratio),u_image:new t.b_(e,i.u_image),u_units_to_pixels:new t.c3(e,i.u_units_to_pixels),u_scale:new t.c2(e,i.u_scale),u_fade:new t.bq(e,i.u_fade)}),lineSDF:(e,i)=>({u_translation:new t.c3(e,i.u_translation),u_ratio:new t.bq(e,i.u_ratio),u_device_pixel_ratio:new t.bq(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.c3(e,i.u_units_to_pixels),u_image:new t.b_(e,i.u_image),u_mix:new t.bq(e,i.u_mix),u_tileratio:new t.bq(e,i.u_tileratio),u_crossfade_from:new t.bq(e,i.u_crossfade_from),u_crossfade_to:new t.bq(e,i.u_crossfade_to),u_lineatlas_width:new t.bq(e,i.u_lineatlas_width),u_lineatlas_height:new t.bq(e,i.u_lineatlas_height)}),lineGradientSDF:(e,i)=>({u_translation:new t.c3(e,i.u_translation),u_ratio:new t.bq(e,i.u_ratio),u_device_pixel_ratio:new t.bq(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.c3(e,i.u_units_to_pixels),u_image:new t.b_(e,i.u_image),u_image_height:new t.bq(e,i.u_image_height),u_tileratio:new t.bq(e,i.u_tileratio),u_crossfade_from:new t.bq(e,i.u_crossfade_from),u_crossfade_to:new t.bq(e,i.u_crossfade_to),u_image_dash:new t.b_(e,i.u_image_dash),u_mix:new t.bq(e,i.u_mix),u_lineatlas_width:new t.bq(e,i.u_lineatlas_width),u_lineatlas_height:new t.bq(e,i.u_lineatlas_height)}),raster:(e,i)=>({u_tl_parent:new t.c3(e,i.u_tl_parent),u_scale_parent:new t.bq(e,i.u_scale_parent),u_buffer_scale:new t.bq(e,i.u_buffer_scale),u_fade_t:new t.bq(e,i.u_fade_t),u_opacity:new t.bq(e,i.u_opacity),u_image0:new t.b_(e,i.u_image0),u_image1:new t.b_(e,i.u_image1),u_brightness_low:new t.bq(e,i.u_brightness_low),u_brightness_high:new t.bq(e,i.u_brightness_high),u_saturation_factor:new t.bq(e,i.u_saturation_factor),u_contrast_factor:new t.bq(e,i.u_contrast_factor),u_spin_weights:new t.c2(e,i.u_spin_weights),u_coords_top:new t.c1(e,i.u_coords_top),u_coords_bottom:new t.c1(e,i.u_coords_bottom)}),symbolIcon:(e,i)=>({u_is_size_zoom_constant:new t.b_(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.b_(e,i.u_is_size_feature_constant),u_size_t:new t.bq(e,i.u_size_t),u_size:new t.bq(e,i.u_size),u_camera_to_center_distance:new t.bq(e,i.u_camera_to_center_distance),u_pitch:new t.bq(e,i.u_pitch),u_rotate_symbol:new t.b_(e,i.u_rotate_symbol),u_aspect_ratio:new t.bq(e,i.u_aspect_ratio),u_fade_change:new t.bq(e,i.u_fade_change),u_label_plane_matrix:new t.c0(e,i.u_label_plane_matrix),u_coord_matrix:new t.c0(e,i.u_coord_matrix),u_is_text:new t.b_(e,i.u_is_text),u_pitch_with_map:new t.b_(e,i.u_pitch_with_map),u_is_along_line:new t.b_(e,i.u_is_along_line),u_is_variable_anchor:new t.b_(e,i.u_is_variable_anchor),u_texsize:new t.c3(e,i.u_texsize),u_texture:new t.b_(e,i.u_texture),u_translation:new t.c3(e,i.u_translation),u_pitched_scale:new t.bq(e,i.u_pitched_scale)}),symbolSDF:(e,i)=>({u_is_size_zoom_constant:new t.b_(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.b_(e,i.u_is_size_feature_constant),u_size_t:new t.bq(e,i.u_size_t),u_size:new t.bq(e,i.u_size),u_camera_to_center_distance:new t.bq(e,i.u_camera_to_center_distance),u_pitch:new t.bq(e,i.u_pitch),u_rotate_symbol:new t.b_(e,i.u_rotate_symbol),u_aspect_ratio:new t.bq(e,i.u_aspect_ratio),u_fade_change:new t.bq(e,i.u_fade_change),u_label_plane_matrix:new t.c0(e,i.u_label_plane_matrix),u_coord_matrix:new t.c0(e,i.u_coord_matrix),u_is_text:new t.b_(e,i.u_is_text),u_pitch_with_map:new t.b_(e,i.u_pitch_with_map),u_is_along_line:new t.b_(e,i.u_is_along_line),u_is_variable_anchor:new t.b_(e,i.u_is_variable_anchor),u_texsize:new t.c3(e,i.u_texsize),u_texture:new t.b_(e,i.u_texture),u_gamma_scale:new t.bq(e,i.u_gamma_scale),u_device_pixel_ratio:new t.bq(e,i.u_device_pixel_ratio),u_is_halo:new t.b_(e,i.u_is_halo),u_translation:new t.c3(e,i.u_translation),u_pitched_scale:new t.bq(e,i.u_pitched_scale)}),symbolTextAndIcon:(e,i)=>({u_is_size_zoom_constant:new t.b_(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.b_(e,i.u_is_size_feature_constant),u_size_t:new t.bq(e,i.u_size_t),u_size:new t.bq(e,i.u_size),u_camera_to_center_distance:new t.bq(e,i.u_camera_to_center_distance),u_pitch:new t.bq(e,i.u_pitch),u_rotate_symbol:new t.b_(e,i.u_rotate_symbol),u_aspect_ratio:new t.bq(e,i.u_aspect_ratio),u_fade_change:new t.bq(e,i.u_fade_change),u_label_plane_matrix:new t.c0(e,i.u_label_plane_matrix),u_coord_matrix:new t.c0(e,i.u_coord_matrix),u_is_text:new t.b_(e,i.u_is_text),u_pitch_with_map:new t.b_(e,i.u_pitch_with_map),u_is_along_line:new t.b_(e,i.u_is_along_line),u_is_variable_anchor:new t.b_(e,i.u_is_variable_anchor),u_texsize:new t.c3(e,i.u_texsize),u_texsize_icon:new t.c3(e,i.u_texsize_icon),u_texture:new t.b_(e,i.u_texture),u_texture_icon:new t.b_(e,i.u_texture_icon),u_gamma_scale:new t.bq(e,i.u_gamma_scale),u_device_pixel_ratio:new t.bq(e,i.u_device_pixel_ratio),u_is_halo:new t.b_(e,i.u_is_halo),u_translation:new t.c3(e,i.u_translation),u_pitched_scale:new t.bq(e,i.u_pitched_scale)}),background:(e,i)=>({u_opacity:new t.bq(e,i.u_opacity),u_color:new t.b$(e,i.u_color)}),backgroundPattern:(e,i)=>({u_opacity:new t.bq(e,i.u_opacity),u_image:new t.b_(e,i.u_image),u_pattern_tl_a:new t.c3(e,i.u_pattern_tl_a),u_pattern_br_a:new t.c3(e,i.u_pattern_br_a),u_pattern_tl_b:new t.c3(e,i.u_pattern_tl_b),u_pattern_br_b:new t.c3(e,i.u_pattern_br_b),u_texsize:new t.c3(e,i.u_texsize),u_mix:new t.bq(e,i.u_mix),u_pattern_size_a:new t.c3(e,i.u_pattern_size_a),u_pattern_size_b:new t.c3(e,i.u_pattern_size_b),u_scale_a:new t.bq(e,i.u_scale_a),u_scale_b:new t.bq(e,i.u_scale_b),u_pixel_coord_upper:new t.c3(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.c3(e,i.u_pixel_coord_lower),u_tile_units_to_pixels:new t.bq(e,i.u_tile_units_to_pixels)}),terrain:(e,i)=>({u_texture:new t.b_(e,i.u_texture),u_ele_delta:new t.bq(e,i.u_ele_delta),u_fog_matrix:new t.c0(e,i.u_fog_matrix),u_fog_color:new t.b$(e,i.u_fog_color),u_fog_ground_blend:new t.bq(e,i.u_fog_ground_blend),u_fog_ground_blend_opacity:new t.bq(e,i.u_fog_ground_blend_opacity),u_horizon_color:new t.b$(e,i.u_horizon_color),u_horizon_fog_blend:new t.bq(e,i.u_horizon_fog_blend),u_is_globe_mode:new t.bq(e,i.u_is_globe_mode)}),terrainDepth:(e,i)=>({u_ele_delta:new t.bq(e,i.u_ele_delta)}),terrainCoords:(e,i)=>({u_texture:new t.b_(e,i.u_texture),u_terrain_coords_id:new t.bq(e,i.u_terrain_coords_id),u_ele_delta:new t.bq(e,i.u_ele_delta)}),projectionErrorMeasurement:(e,i)=>({u_input:new t.bq(e,i.u_input),u_output_expected:new t.bq(e,i.u_output_expected)}),atmosphere:(e,i)=>({u_sun_pos:new t.c2(e,i.u_sun_pos),u_atmosphere_blend:new t.bq(e,i.u_atmosphere_blend),u_globe_position:new t.c2(e,i.u_globe_position),u_globe_radius:new t.bq(e,i.u_globe_radius),u_inv_proj_matrix:new t.c0(e,i.u_inv_proj_matrix)}),sky:(e,i)=>({u_sky_color:new t.b$(e,i.u_sky_color),u_horizon_color:new t.b$(e,i.u_horizon_color),u_horizon:new t.c3(e,i.u_horizon),u_horizon_normal:new t.c3(e,i.u_horizon_normal),u_sky_horizon_blend:new t.bq(e,i.u_sky_horizon_blend),u_sky_blend:new t.bq(e,i.u_sky_blend)})};class wn{constructor(e,t,i){this.context=e;const n=e.gl;this.buffer=n.createBuffer(),this.dynamicDraw=Boolean(i),this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||delete t.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){const t=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),t.bufferSubData(t.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Tn={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Sn{constructor(e,t,i,n){this.length=t.length,this.attributes=i,this.itemSize=t.bytesPerElement,this.dynamicDraw=n,this.context=e;const r=e.gl;this.buffer=r.createBuffer(),e.bindVertexBuffer.set(this.buffer),r.bufferData(r.ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?r.DYNAMIC_DRAW:r.STATIC_DRAW),this.dynamicDraw||delete t.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){if(e.length!==this.length)throw new Error(`Length of new data is ${e.length}, which doesn't match current length of ${this.length}`);const t=this.context.gl;this.bind(),t.bufferSubData(t.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,t){for(let i=0;i<this.attributes.length;i++){const n=t.attributes[this.attributes[i].name];void 0!==n&&e.enableVertexAttribArray(n)}}setVertexAttribPointers(e,t,i){for(let n=0;n<this.attributes.length;n++){const r=this.attributes[n],o=t.attributes[r.name];void 0!==o&&e.vertexAttribPointer(o,r.components,e[Tn[r.type]],!1,this.itemSize,r.offset+this.itemSize*(i||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class Pn{constructor(e){this.gl=e.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(e){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class Mn extends Pn{getDefault(){return t.bp.transparent}set(e){const t=this.current;(e.r!==t.r||e.g!==t.g||e.b!==t.b||e.a!==t.a||this.dirty)&&(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class En extends Pn{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}}class Cn extends Pn{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}}class kn extends Pn{getDefault(){return[!0,!0,!0,!0]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3]||this.dirty)&&(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class In extends Pn{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}}class zn extends Pn{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}}class An extends Pn{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(e){const t=this.current;(e.func!==t.func||e.ref!==t.ref||e.mask!==t.mask||this.dirty)&&(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=!1)}}class Ln extends Pn{getDefault(){const e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||this.dirty)&&(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=!1)}}class Dn extends Pn{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;e?t.enable(t.STENCIL_TEST):t.disable(t.STENCIL_TEST),this.current=e,this.dirty=!1}}class Rn extends Pn{getDefault(){return[0,1]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||this.dirty)&&(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=!1)}}class Fn extends Pn{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;e?t.enable(t.DEPTH_TEST):t.disable(t.DEPTH_TEST),this.current=e,this.dirty=!1}}class Bn extends Pn{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}}class On extends Pn{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;e?t.enable(t.BLEND):t.disable(t.BLEND),this.current=e,this.dirty=!1}}class Nn extends Pn{getDefault(){const e=this.gl;return[e.ONE,e.ZERO]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||this.dirty)&&(this.gl.blendFunc(e[0],e[1]),this.current=e,this.dirty=!1)}}class jn extends Pn{getDefault(){return t.bp.transparent}set(e){const t=this.current;(e.r!==t.r||e.g!==t.g||e.b!==t.b||e.a!==t.a||this.dirty)&&(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class Vn extends Pn{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}}class Un extends Pn{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;e?t.enable(t.CULL_FACE):t.disable(t.CULL_FACE),this.current=e,this.dirty=!1}}class Zn extends Pn{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}}class Gn extends Pn{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}}class qn extends Pn{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}}class $n extends Pn{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}}class Wn extends Pn{getDefault(){const e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3]||this.dirty)&&(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class Hn extends Pn{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,e),this.current=e,this.dirty=!1}}class Xn extends Pn{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.bindRenderbuffer(t.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class Yn extends Pn{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.bindTexture(t.TEXTURE_2D,e),this.current=e,this.dirty=!1}}class Kn extends Pn{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.bindBuffer(t.ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class Qn extends Pn{getDefault(){return null}set(e){const t=this.gl;t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class Jn extends Pn{getDefault(){return null}set(e){var t;if(e===this.current&&!this.dirty)return;const i=this.gl;ai(i)?i.bindVertexArray(e):null===(t=i.getExtension("OES_vertex_array_object"))||void 0===t||t.bindVertexArrayOES(e),this.current=e,this.dirty=!1}}class er extends Pn{getDefault(){return 4}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.pixelStorei(t.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1}}class tr extends Pn{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1}}class ir extends Pn{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1}}class nr extends Pn{constructor(e,t){super(e),this.context=e,this.parent=t}getDefault(){return null}}class rr extends nr{setDirty(){this.dirty=!0}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const t=this.gl;t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}}class or extends nr{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const t=this.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class ar extends nr{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const t=this.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,e),this.current=e,this.dirty=!1}}const sr="Framebuffer is not complete";class lr{constructor(e,t,i,n,r){this.context=e,this.width=t,this.height=i;const o=e.gl,a=this.framebuffer=o.createFramebuffer();if(this.colorAttachment=new rr(e,a),n)this.depthAttachment=r?new ar(e,a):new or(e,a);else if(r)throw new Error("Stencil cannot be set without depth");if(o.checkFramebufferStatus(o.FRAMEBUFFER)!==o.FRAMEBUFFER_COMPLETE)throw new Error(sr)}destroy(){const e=this.context.gl,t=this.colorAttachment.get();if(t&&e.deleteTexture(t),this.depthAttachment){const t=this.depthAttachment.get();t&&e.deleteRenderbuffer(t)}e.deleteFramebuffer(this.framebuffer)}}class cr{constructor(e){var t,i;if(this.gl=e,this.clearColor=new Mn(this),this.clearDepth=new En(this),this.clearStencil=new Cn(this),this.colorMask=new kn(this),this.depthMask=new In(this),this.stencilMask=new zn(this),this.stencilFunc=new An(this),this.stencilOp=new Ln(this),this.stencilTest=new Dn(this),this.depthRange=new Rn(this),this.depthTest=new Fn(this),this.depthFunc=new Bn(this),this.blend=new On(this),this.blendFunc=new Nn(this),this.blendColor=new jn(this),this.blendEquation=new Vn(this),this.cullFace=new Un(this),this.cullFaceSide=new Zn(this),this.frontFace=new Gn(this),this.program=new qn(this),this.activeTexture=new $n(this),this.viewport=new Wn(this),this.bindFramebuffer=new Hn(this),this.bindRenderbuffer=new Xn(this),this.bindTexture=new Yn(this),this.bindVertexBuffer=new Kn(this),this.bindElementBuffer=new Qn(this),this.bindVertexArray=new Jn(this),this.pixelStoreUnpack=new er(this),this.pixelStoreUnpackPremultiplyAlpha=new tr(this),this.pixelStoreUnpackFlipY=new ir(this),this.extTextureFilterAnisotropic=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=e.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE),ai(e)){this.HALF_FLOAT=e.HALF_FLOAT;const n=e.getExtension("EXT_color_buffer_half_float");this.RGBA16F=null!==(t=e.RGBA16F)&&void 0!==t?t:null==n?void 0:n.RGBA16F_EXT,this.RGB16F=null!==(i=e.RGB16F)&&void 0!==i?i:null==n?void 0:n.RGB16F_EXT,e.getExtension("EXT_color_buffer_float")}else{e.getExtension("EXT_color_buffer_half_float"),e.getExtension("OES_texture_half_float_linear");const t=e.getExtension("OES_texture_half_float");this.HALF_FLOAT=null==t?void 0:t.HALF_FLOAT_OES}}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(e,t){return new wn(this,e,t)}createVertexBuffer(e,t,i){return new Sn(this,e,t,i)}createRenderbuffer(e,t,i){const n=this.gl,r=n.createRenderbuffer();return this.bindRenderbuffer.set(r),n.renderbufferStorage(n.RENDERBUFFER,e,t,i),this.bindRenderbuffer.set(null),r}createFramebuffer(e,t,i,n){return new lr(this,e,t,i,n)}clear({color:e,depth:t,stencil:i}){const n=this.gl;let r=0;e&&(r|=n.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),void 0!==t&&(r|=n.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(t),this.depthMask.set(!0)),void 0!==i&&(r|=n.STENCIL_BUFFER_BIT,this.clearStencil.set(i),this.stencilMask.set(255)),n.clear(r)}setCullFace(e){!1===e.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(e.mode),this.frontFace.set(e.frontFace))}setDepthMode(e){e.func!==this.gl.ALWAYS||e.mask?(this.depthTest.set(!0),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range)):this.depthTest.set(!1)}setStencilMode(e){e.test.func!==this.gl.ALWAYS||e.mask?(this.stencilTest.set(!0),this.stencilMask.set(e.mask),this.stencilOp.set([e.fail,e.depthFail,e.pass]),this.stencilFunc.set({func:e.test.func,ref:e.ref,mask:e.test.mask})):this.stencilTest.set(!1)}setColorMode(e){t.bR(e.blendFunction,Jt.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor)),this.colorMask.set(e.mask)}createVertexArray(){var e;return ai(this.gl)?this.gl.createVertexArray():null===(e=this.gl.getExtension("OES_vertex_array_object"))||void 0===e?void 0:e.createVertexArrayOES()}deleteVertexArray(e){var t;return ai(this.gl)?this.gl.deleteVertexArray(e):null===(t=this.gl.getExtension("OES_vertex_array_object"))||void 0===t?void 0:t.deleteVertexArrayOES(e)}unbindVAO(){this.bindVertexArray.set(null)}}let ur;function hr(e,i,n,r,o){const a=e.context,s=e.transform,l=a.gl,c=e.useProgram("collisionBox"),u=[];let h=0,d=0;for(let t=0;t<r.length;t++){const p=r[t],f=i.getTile(p).getBucket(n);if(!f)continue;const m=o?f.textCollisionBox:f.iconCollisionBox,g=f.collisionCircleArray;g.length>0&&(u.push({circleArray:g,circleOffset:d,coord:p}),h+=g.length/4,d=h),m&&c.draw(a,l.LINES,ii.disabled,ri.disabled,e.colorModeForRenderPass(),ti.disabled,Yi(e.transform),e.style.map.terrain&&e.style.map.terrain.getTerrainData(p),s.getProjectionData({overscaledTileID:p,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),n.id,m.layoutVertexBuffer,m.indexBuffer,m.segments,null,e.transform.zoom,null,null,m.collisionVertexBuffer)}if(!o||!u.length)return;const p=e.useProgram("collisionCircle"),f=new t.ca;f.resize(4*h),f._trim();let m=0;for(const t of u)for(let e=0;e<t.circleArray.length/4;e++){const i=4*e,n=t.circleArray[i+0],r=t.circleArray[i+1],o=t.circleArray[i+2],a=t.circleArray[i+3];f.emplace(m++,n,r,o,a,0),f.emplace(m++,n,r,o,a,1),f.emplace(m++,n,r,o,a,2),f.emplace(m++,n,r,o,a,3)}(!ur||ur.length<2*h)&&(ur=function(e){const i=2*e,n=new t.cc;n.resize(i),n._trim();for(let t=0;t<i;t++){const e=6*t;n.uint16[e+0]=4*t+0,n.uint16[e+1]=4*t+1,n.uint16[e+2]=4*t+2,n.uint16[e+3]=4*t+2,n.uint16[e+4]=4*t+3,n.uint16[e+5]=4*t+0}return n}(h));const g=a.createIndexBuffer(ur,!0),_=a.createVertexBuffer(f,t.cb.members,!0);for(const y of u){const i=Ki(e.transform);p.draw(a,l.TRIANGLES,ii.disabled,ri.disabled,e.colorModeForRenderPass(),ti.disabled,i,e.style.map.terrain&&e.style.map.terrain.getTerrainData(y.coord),null,n.id,_,g,t.aX.simpleSegment(0,2*y.circleOffset,y.circleArray.length,y.circleArray.length/2),null,e.transform.zoom,null,null,null)}_.destroy(),g.destroy()}const dr=t.ar(new Float32Array(16));function pr(e,i,n,r,o,a){const{horizontalAlign:s,verticalAlign:l}=t.aS(e);return new t.P((-(s-.5)*i/o+r[0])*a,(-(l-.5)*n/o+r[1])*a)}function fr(e,i,n,r,o,a){const s=i.tileAnchorPoint.add(new t.P(i.translation[0],i.translation[1]));if(i.pitchWithMap){let e=r.mult(a);n||(e=e.rotate(-o));const t=s.add(e);return Ze(t.x,t.y,i.pitchedLabelPlaneMatrix,i.getElevation).point}if(n){const t=Qe(i.tileAnchorPoint.x+1,i.tileAnchorPoint.y,i).point.sub(e),n=Math.atan(t.y/t.x)+(t.x<0?Math.PI:0);return e.add(r.rotate(n))}return e.add(r)}function mr(e,i,n,r,o,a,s,l,c,u,h,d){const p=e.text.placedSymbolArray,f=e.text.dynamicLayoutVertexArray,m=e.icon.dynamicLayoutVertexArray,g={};f.clear();for(let _=0;_<p.length;_++){const m=p.get(_),y=m.hidden||!m.crossTileID||e.allowVerticalPlacement&&!m.placedOrientation?null:r[m.crossTileID];if(y){const r=new t.P(m.anchorX,m.anchorY),p={getElevation:d,width:o.width,height:o.height,pitchedLabelPlaneMatrix:a,pitchWithMap:n,transform:o,tileAnchorPoint:r,translation:u,unwrappedTileID:h},_=n?et(r.x,r.y,p):Qe(r.x,r.y,p),v=Ge(o.cameraToCenterDistance,_.signedDistanceFromCamera);let x=t.aA(e.textSizeData,l,m)*v/t.aM;n&&(x*=e.tilePixelRatio/s);const{width:b,height:w,anchor:T,textOffset:S,textBoxScale:P}=y,M=pr(T,b,w,S,P,x),E=o.getPitchedTextCorrection(r.x+u[0],r.y+u[1],h),C=fr(_.point,p,i,M,-o.bearingInRadians,E),k=e.allowVerticalPlacement&&m.placedOrientation===t.az.vertical?Math.PI/2:0;for(let e=0;e<m.numGlyphs;e++)t.aG(f,C,k);c&&m.associatedIconIndex>=0&&(g[m.associatedIconIndex]={shiftedAnchor:C,angle:k})}else ot(m.numGlyphs,f)}if(c){m.clear();const i=e.icon.placedSymbolArray;for(let e=0;e<i.length;e++){const n=i.get(e);if(n.hidden)ot(n.numGlyphs,m);else{const i=g[e];if(i)for(let e=0;e<n.numGlyphs;e++)t.aG(m,i.shiftedAnchor,i.angle);else ot(n.numGlyphs,m)}}e.icon.dynamicLayoutVertexBuffer.updateData(m)}e.text.dynamicLayoutVertexBuffer.updateData(f)}function gr(e,t,i){return i.iconsInText&&t?"symbolTextAndIcon":e?"symbolSDF":"symbolIcon"}function _r(e,i,n,r,o,a,s,l,c,u,h,d,p){const f=e.context,m=f.gl,g=e.transform,_="map"===l,y="map"===c,v="viewport"!==l&&"point"!==n.layout.get("symbol-placement"),x=_&&!y&&!v,b=!n.layout.get("symbol-sort-key").isConstant();let w=!1;const T=e.getDepthModeForSublayer(0,ii.ReadOnly),S=n._unevaluatedLayout.hasValue("text-variable-anchor")||n._unevaluatedLayout.hasValue("text-variable-anchor-offset"),P=[],M=g.getCircleRadiusCorrection();for(const E of r){const r=i.getTile(E),l=r.getBucket(n);if(!l)continue;const c=o?l.text:l.icon;if(!c||!c.segments.get().length||!c.hasVisibleVertices)continue;const h=c.programConfigurations.get(n.id),d=o||l.sdfIcons,f=o?l.textSizeData:l.iconSizeData,T=y||0!==g.pitch,C=e.useProgram(gr(d,o,l),h),k=t.ay(f,g.zoom),I=e.style.map.terrain&&e.style.map.terrain.getTerrainData(E);let z,A,L,D,R=[0,0],F=null;if(o)A=r.glyphAtlasTexture,L=m.LINEAR,z=r.glyphAtlasTexture.size,l.iconsInText&&(R=r.imageAtlasTexture.size,F=r.imageAtlasTexture,D=T||e.options.rotating||e.options.zooming||"composite"===f.kind||"camera"===f.kind?m.LINEAR:m.NEAREST);else{const t=1!==n.layout.get("icon-size").constantOr(0)||l.iconsNeedLinear;A=r.imageAtlasTexture,L=d||e.options.rotating||e.options.zooming||t||T?m.LINEAR:m.NEAREST,z=r.imageAtlasTexture.size}const B=t.aN(r,1,e.transform.zoom),O=je(_,e.transform,B),N=t.N();t.aB(N,O);const j=Ve(y,_,e.transform,B),V=t.aO(g,r,a,s),U=g.getProjectionData({overscaledTileID:E,applyGlobeMatrix:!p,applyTerrainMatrix:!0}),Z=S&&l.hasTextData(),G="none"!==n.layout.get("icon-text-fit")&&Z&&l.hasIconData();if(v){const t=e.style.map.terrain?(t,i)=>e.style.map.terrain.getElevation(E,t,i):null,i="map"===n.layout.get("text-rotation-alignment");$e(l,e,o,O,N,y,u,i,E.toUnwrapped(),g.width,g.height,V,t)}const q=o&&S||G,$=v||q?dr:y?O:e.transform.clipSpaceToPixelsMatrix,W=d&&0!==n.paint.get(o?"text-halo-width":"icon-halo-width").constantOr(1);let H;H=d?l.iconsInText?_n(f.kind,k,x,y,v,q,e,$,j,V,z,R,M):gn(f.kind,k,x,y,v,q,e,$,j,V,o,z,0,M):mn(f.kind,k,x,y,v,q,e,$,j,V,o,z,M);const X={program:C,buffers:c,uniformValues:H,projectionData:U,atlasTexture:A,atlasTextureIcon:F,atlasInterpolation:L,atlasInterpolationIcon:D,isSDF:d,hasHalo:W};if(b&&l.canOverlap){w=!0;const e=c.segments.get();for(const i of e)P.push({segments:new t.aX([i]),sortKey:i.sortKey,state:X,terrainData:I})}else P.push({segments:c.segments,sortKey:0,state:X,terrainData:I})}w&&P.sort((e,t)=>e.sortKey-t.sortKey);for(const t of P){const i=t.state;if(f.activeTexture.set(m.TEXTURE0),i.atlasTexture.bind(i.atlasInterpolation,m.CLAMP_TO_EDGE),i.atlasTextureIcon&&(f.activeTexture.set(m.TEXTURE1),i.atlasTextureIcon&&i.atlasTextureIcon.bind(i.atlasInterpolationIcon,m.CLAMP_TO_EDGE)),i.isSDF){const r=i.uniformValues;i.hasHalo&&(r.u_is_halo=1,yr(i.buffers,t.segments,n,e,i.program,T,h,d,r,i.projectionData,t.terrainData)),r.u_is_halo=0}yr(i.buffers,t.segments,n,e,i.program,T,h,d,i.uniformValues,i.projectionData,t.terrainData)}}function yr(e,t,i,n,r,o,a,s,l,c,u){const h=n.context;r.draw(h,h.gl.TRIANGLES,o,a,s,ti.backCCW,l,u,c,i.id,e.layoutVertexBuffer,e.indexBuffer,t,i.paint,n.transform.zoom,e.programConfigurations.get(i.id),e.dynamicLayoutVertexBuffer,e.opacityVertexBuffer)}function vr(e,i,n,r,o){const a=e.context,s=a.gl,l=ri.disabled,c=new Jt([s.ONE,s.ONE],t.bp.transparent,[!0,!0,!0,!0]),u=i.getBucket(n);if(!u)return;const h=r.key;let d=n.heatmapFbos.get(h);d||(d=br(a,i.tileSize,i.tileSize),n.heatmapFbos.set(h,d)),a.bindFramebuffer.set(d.framebuffer),a.viewport.set([0,0,i.tileSize,i.tileSize]),a.clear({color:t.bp.transparent});const p=u.programConfigurations.get(n.id),f=e.useProgram("heatmap",p,!o),m=e.transform.getProjectionData({overscaledTileID:i.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),g=e.style.map.terrain.getTerrainData(r);f.draw(a,s.TRIANGLES,ii.disabled,l,c,ti.disabled,Ji(i,e.transform.zoom,n.paint.get("heatmap-intensity"),1),g,m,n.id,u.layoutVertexBuffer,u.indexBuffer,u.segments,n.paint,e.transform.zoom,p)}function xr(e,t,i,n,r){const o=e.context,a=o.gl,s=e.transform;o.setColorMode(e.colorModeForRenderPass());const l=wr(o,t),c=i.key,u=t.heatmapFbos.get(c);if(!u)return;o.activeTexture.set(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,u.colorAttachment.get()),o.activeTexture.set(a.TEXTURE1),l.bind(a.LINEAR,a.CLAMP_TO_EDGE);const h=s.getProjectionData({overscaledTileID:i,applyTerrainMatrix:r,applyGlobeMatrix:!n});e.useProgram("heatmapTexture").draw(o,a.TRIANGLES,ii.disabled,ri.disabled,e.colorModeForRenderPass(),ti.disabled,en(e,t,0,1),null,h,t.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments,t.paint,s.zoom),u.destroy(),t.heatmapFbos.delete(c)}function br(e,t,i){var n,r;const o=e.gl,a=o.createTexture();o.bindTexture(o.TEXTURE_2D,a),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,o.LINEAR),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,o.LINEAR);const s=null!==(n=e.HALF_FLOAT)&&void 0!==n?n:o.UNSIGNED_BYTE,l=null!==(r=e.RGBA16F)&&void 0!==r?r:o.RGBA;o.texImage2D(o.TEXTURE_2D,0,l,t,i,0,o.RGBA,s,null);const c=e.createFramebuffer(t,i,!1,!1);return c.colorAttachment.set(a),c}function wr(e,i){return i.colorRampTexture||(i.colorRampTexture=new t.T(e,i.colorRamp,e.gl.RGBA)),i.colorRampTexture}function Tr(e,i,n,r,o,a,s,l){let c=256;if(o.stepInterpolant){const r=i.getSource().maxzoom,o=s.canonical.z===r?Math.ceil(1<<e.transform.maxZoom-s.canonical.z):1;c=t.an(t.ce(a.maxLineLength/t.a5*1024*o),256,n.maxTextureSize)}return l.gradient=t.cf({expression:o.gradientExpression(),evaluationKey:"lineProgress",resolution:c,image:l.gradient||void 0,clips:a.lineClipsArray}),l.texture?l.texture.update(l.gradient):l.texture=new t.T(n,l.gradient,r.RGBA),l.version=o.gradientVersion,l.texture}function Sr(e,t,i,n,r){e.activeTexture.set(t.TEXTURE0),i.imageAtlasTexture.bind(t.LINEAR,t.CLAMP_TO_EDGE),n.updatePaintBuffers(r)}function Pr(e,t,i,n,r,o){(r||e.lineAtlas.dirty)&&(t.activeTexture.set(i.TEXTURE0),e.lineAtlas.bind(t)),n.updatePaintBuffers(o)}function Mr(e,t,i,n,r,o,a){const s=o.gradients[r.id];let l=s.texture;r.gradientVersion!==s.version&&(l=Tr(e,t,i,n,r,o,a,s)),i.activeTexture.set(n.TEXTURE0),l.bind(r.stepInterpolant?n.NEAREST:n.LINEAR,n.CLAMP_TO_EDGE)}function Er(e,t,i,n,r,o,a,s,l){const c=o.gradients[r.id];let u=c.texture;r.gradientVersion!==c.version&&(u=Tr(e,t,i,n,r,o,a,c)),i.activeTexture.set(n.TEXTURE0),u.bind(r.stepInterpolant?n.NEAREST:n.LINEAR,n.CLAMP_TO_EDGE),i.activeTexture.set(n.TEXTURE1),e.lineAtlas.bind(i),s.updatePaintBuffers(l)}function Cr(e,t,i,n,r){if(!i||!n||!n.imageAtlas)return;const o=n.imageAtlas.patternPositions;let a=o[i.to.toString()],s=o[i.from.toString()];if(!a&&s&&(a=s),!s&&a&&(s=a),!a||!s){const e=r.getPaintProperty(t);a=o[e],s=o[e]}a&&s&&e.setConstantPatternPositions(a,s)}function kr(e,i,n,r,o,a,s,l){const c=e.context.gl,u="fill-pattern",h=n.paint.get(u),d=h&&h.constantOr(1),p=n.getCrossfadeParameters();let f,m,g,_,y;const v=e.transform,x=n.paint.get("fill-translate"),b=n.paint.get("fill-translate-anchor");s?(m=d&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",f=c.LINES):(m=d?"fillPattern":"fill",f=c.TRIANGLES);const w=h.constantOr(null);for(const T of r){const r=i.getTile(T);if(d&&!r.patternsLoaded())continue;const h=r.getBucket(n);if(!h)continue;const S=h.programConfigurations.get(n.id),P=e.useProgram(m,S),M=e.style.map.terrain&&e.style.map.terrain.getTerrainData(T);d&&(e.context.activeTexture.set(c.TEXTURE0),r.imageAtlasTexture.bind(c.LINEAR,c.CLAMP_TO_EDGE),S.updatePaintBuffers(p)),Cr(S,u,w,r,n);const E=v.getProjectionData({overscaledTileID:T,applyGlobeMatrix:!l,applyTerrainMatrix:!0}),C=t.aO(v,r,x,b);if(s){_=h.indexBuffer2,y=h.segments2;const t=[c.drawingBufferWidth,c.drawingBufferHeight];g="fillOutlinePattern"===m&&d?Hi(e,p,r,t,C):Wi(t,C)}else _=h.indexBuffer,y=h.segments,g=d?$i(e,p,r,C):{u_fill_translate:C};const k=e.stencilModeForClipping(T);P.draw(e.context,f,o,k,a,ti.backCCW,g,M,E,n.id,h.layoutVertexBuffer,_,y,n.paint,e.transform.zoom,S)}}function Ir(e,i,n,r,o,a,s,l){const c=e.context,u=c.gl,h="fill-extrusion-pattern",d=n.paint.get(h),p=d.constantOr(1),f=n.getCrossfadeParameters(),m=n.paint.get("fill-extrusion-opacity"),g=d.constantOr(null),_=e.transform;for(const y of r){const r=i.getTile(y),d=r.getBucket(n);if(!d)continue;const v=e.style.map.terrain&&e.style.map.terrain.getTerrainData(y),x=d.programConfigurations.get(n.id),b=e.useProgram(p?"fillExtrusionPattern":"fillExtrusion",x);p&&(e.context.activeTexture.set(u.TEXTURE0),r.imageAtlasTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE),x.updatePaintBuffers(f));const w=_.getProjectionData({overscaledTileID:y,applyGlobeMatrix:!l,applyTerrainMatrix:!0});Cr(x,h,g,r,n);const T=t.aO(_,r,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),S=n.paint.get("fill-extrusion-vertical-gradient"),P=p?qi(e,S,m,T,y,f,r):Gi(e,S,m,T);b.draw(c,c.gl.TRIANGLES,o,a,s,ti.backCCW,P,v,w,n.id,d.layoutVertexBuffer,d.indexBuffer,d.segments,n.paint,e.transform.zoom,x,e.style.map.terrain&&d.centroidVertexBuffer)}}function zr(e,t,i,n,r,o,a,s,l){var c;const u=e.style.projection,h=e.context,d=e.transform,p=h.gl,f=[`#define NUM_ILLUMINATION_SOURCES ${i.paint.get("hillshade-highlight-color").values.length}`],m=e.useProgram("hillshade",null,!1,f),g=!e.options.moving;for(const _ of n){const n=t.getTile(_),f=n.fbo;if(!f)continue;const y=u.getMeshFromTileID(h,_.canonical,s,!0,"raster"),v=null===(c=e.style.map.terrain)||void 0===c?void 0:c.getTerrainData(_);h.activeTexture.set(p.TEXTURE0),p.bindTexture(p.TEXTURE_2D,f.colorAttachment.get());const x=d.getProjectionData({overscaledTileID:_,aligned:g,applyGlobeMatrix:!l,applyTerrainMatrix:!0});m.draw(h,p.TRIANGLES,o,r[_.overscaledZ],a,ti.backCCW,tn(e,n,i),v,x,i.id,y.vertexBuffer,y.indexBuffer,y.segments)}}function Ar(e,i,n,r,o,a,s,l,c){var u;const h=e.style.projection,d=e.context,p=e.transform,f=d.gl,m=e.useProgram("colorRelief"),g=!e.options.moving;let _=!0,y=0;for(const v of r){const r=i.getTile(v),x=r.dem;if(_){const e=f.getParameter(f.MAX_TEXTURE_SIZE),{elevationTexture:t,colorTexture:i}=n.getColorRampTextures(d,e,x.getUnpackVector());d.activeTexture.set(f.TEXTURE1),t.bind(f.NEAREST,f.CLAMP_TO_EDGE),d.activeTexture.set(f.TEXTURE4),i.bind(f.LINEAR,f.CLAMP_TO_EDGE),_=!1,y=t.size[0]}if(!x||!x.data)continue;const b=x.stride,w=x.getPixels();if(d.activeTexture.set(f.TEXTURE0),d.pixelStoreUnpackPremultiplyAlpha.set(!1),r.demTexture=r.demTexture||e.getTileTexture(b),r.demTexture){const e=r.demTexture;e.update(w,{premultiply:!1}),e.bind(f.LINEAR,f.CLAMP_TO_EDGE)}else r.demTexture=new t.T(d,w,f.RGBA,{premultiply:!1}),r.demTexture.bind(f.LINEAR,f.CLAMP_TO_EDGE);const T=h.getMeshFromTileID(d,v.canonical,l,!0,"raster"),S=null===(u=e.style.map.terrain)||void 0===u?void 0:u.getTerrainData(v),P=p.getProjectionData({overscaledTileID:v,aligned:g,applyGlobeMatrix:!c,applyTerrainMatrix:!0});m.draw(d,f.TRIANGLES,a,o[v.overscaledZ],s,ti.backCCW,on(n,r.dem,y),S,P,n.id,T.vertexBuffer,T.indexBuffer,T.segments)}}const Lr=[new t.P(0,0),new t.P(t.a5,0),new t.P(t.a5,t.a5),new t.P(0,t.a5)];function Dr(e,t,i,n,r,o,a,s,l=!1,c=!1){const u=n[n.length-1].overscaledZ,h=e.context,d=h.gl,p=e.useProgram("raster"),f=e.transform,m=e.style.projection,g=e.colorModeForRenderPass(),_=!e.options.moving,y=i.paint.get("raster-opacity"),v=i.paint.get("raster-resampling"),x=i.paint.get("raster-fade-duration"),b=!!e.style.map.terrain;for(const w of n){const n=e.getDepthModeForSublayer(w.overscaledZ-u,1===y?ii.ReadWrite:ii.ReadOnly,d.LESS),T=t.getTile(w),S="nearest"===v?d.NEAREST:d.LINEAR;h.activeTexture.set(d.TEXTURE0),T.texture.bind(S,d.CLAMP_TO_EDGE,d.LINEAR_MIPMAP_NEAREST),h.activeTexture.set(d.TEXTURE1);const{parentTile:P,parentScaleBy:M,parentTopLeft:E,fadeValues:C}=Rr(T,t,x,b);T.fadeOpacity=C.tileOpacity,P?(P.fadeOpacity=C.parentTileOpacity,P.texture.bind(S,d.CLAMP_TO_EDGE,d.LINEAR_MIPMAP_NEAREST)):T.texture.bind(S,d.CLAMP_TO_EDGE,d.LINEAR_MIPMAP_NEAREST),T.texture.useMipmap&&h.extTextureFilterAnisotropic&&e.transform.pitch>20&&d.texParameterf(d.TEXTURE_2D,h.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,h.extTextureFilterAnisotropicMax);const k=e.style.map.terrain&&e.style.map.terrain.getTerrainData(w),I=f.getProjectionData({overscaledTileID:w,aligned:_,applyGlobeMatrix:!c,applyTerrainMatrix:!0}),z=pn(E,M,C.fadeMix,i,s),A=m.getMeshFromTileID(h,w.canonical,o,a,"raster");p.draw(h,d.TRIANGLES,n,r?r[w.overscaledZ]:ri.disabled,g,l?ti.frontCCW:ti.backCCW,z,k,I,i.id,A.vertexBuffer,A.indexBuffer,A.segments)}}function Rr(e,i,n,r){const o={parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:{tileOpacity:1,parentTileOpacity:1,fadeMix:{opacity:1,mix:0}}};if(0===n||r)return o;if(e.fadingParentID){const r=i.getLoadedTile(e.fadingParentID);if(!r)return o;const a=Math.pow(2,r.tileID.overscaledZ-e.tileID.overscaledZ);return{parentTile:r,parentScaleBy:a,parentTopLeft:[e.tileID.canonical.x*a%1,e.tileID.canonical.y*a%1],fadeValues:function(e,i,n){const r=c(),o=(r-i.timeAdded)/n,a=e.fadingDirection===he.Incoming,s=t.an((r-e.timeAdded)/n,0,1),l=t.an(1-o,0,1),u=a?s:l;return{tileOpacity:u,parentTileOpacity:a?l:s,fadeMix:{opacity:1,mix:1-u}}}(e,r,n)}}return e.selfFading?{parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:function(e,i){const n=(c()-e.timeAdded)/i,r=t.an(n,0,1);return{tileOpacity:r,fadeMix:{opacity:r,mix:0}}}(e,n)}:o}const Fr=new t.bp(1,0,0,1),Br=new t.bp(0,1,0,1),Or=new t.bp(0,0,1,1),Nr=new t.bp(1,0,1,1),jr=new t.bp(0,1,1,1);function Vr(e,t,i,n){Zr(e,0,t+i/2,e.transform.width,i,n)}function Ur(e,t,i,n){Zr(e,t-i/2,0,i,e.transform.height,n)}function Zr(e,t,i,n,r,o){const a=e.context,s=a.gl;s.enable(s.SCISSOR_TEST),s.scissor(t*e.pixelRatio,i*e.pixelRatio,n*e.pixelRatio,r*e.pixelRatio),a.clear({color:o}),s.disable(s.SCISSOR_TEST)}function Gr(e,i,n){const r=e.context,o=r.gl,a=e.useProgram("debug"),s=ii.disabled,l=ri.disabled,c=e.colorModeForRenderPass(),u="$debug",h=e.style.map.terrain&&e.style.map.terrain.getTerrainData(n);r.activeTexture.set(o.TEXTURE0);const d=i.getTileByID(n.key).latestRawTileData,p=Math.floor((d&&d.byteLength||0)/1024),f=i.getTile(n).tileSize,m=512/Math.min(f,512)*(n.overscaledZ/e.transform.zoom)*.5;let g=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(g+=` => ${n.overscaledZ}`),function(e,t){e.initDebugOverlayCanvas();const i=e.debugOverlayCanvas,n=e.context.gl,r=e.debugOverlayCanvas.getContext("2d");r.clearRect(0,0,i.width,i.height),r.shadowColor="white",r.shadowBlur=2,r.lineWidth=1.5,r.strokeStyle="white",r.textBaseline="top",r.font="bold 36px Open Sans, sans-serif",r.fillText(t,5,5),r.strokeText(t,5,5),e.debugOverlayTexture.update(i),e.debugOverlayTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}(e,`${g} ${p}kB`);const _=e.transform.getProjectionData({overscaledTileID:n,applyGlobeMatrix:!0,applyTerrainMatrix:!0});a.draw(r,o.TRIANGLES,s,l,Jt.alphaBlended,ti.disabled,Qi(t.bp.transparent,m),null,_,u,e.debugBuffer,e.quadTriangleIndexBuffer,e.debugSegments),a.draw(r,o.LINE_STRIP,s,l,c,ti.disabled,Qi(t.bp.red),h,_,u,e.debugBuffer,e.tileBorderIndexBuffer,e.debugSegments)}function qr(e,t,i,n){const{isRenderingGlobe:r}=n,o=e.context,a=o.gl,s=e.transform,l=e.colorModeForRenderPass(),c=e.getDepthModeFor3D(),u=e.useProgram("terrain");o.bindFramebuffer.set(null),o.viewport.set([0,0,e.width,e.height]);for(const h of i){const i=t.getTerrainMesh(h.tileID),n=e.renderToTexture.getTexture(h),d=t.getTerrainData(h.tileID);o.activeTexture.set(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,n.texture);const p=t.getMeshFrameDelta(s.zoom),f=s.calculateFogMatrix(h.tileID.toUnwrapped()),m=Ni(p,f,e.style.sky,s.pitch,r),g=s.getProjectionData({overscaledTileID:h.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});u.draw(o,a.TRIANGLES,c,ri.disabled,l,ti.backCCW,m,d,g,"terrain",i.vertexBuffer,i.indexBuffer,i.segments)}}function $r(e,i){if(!i.mesh){const n=new t.aW;n.emplaceBack(-1,-1),n.emplaceBack(1,-1),n.emplaceBack(1,1),n.emplaceBack(-1,1);const r=new t.aY;r.emplaceBack(0,1,2),r.emplaceBack(0,2,3),i.mesh=new Ft(e.createVertexBuffer(n,Bt.members),e.createIndexBuffer(r),t.aX.simpleSegment(0,0,n.length,r.length))}return i.mesh}class Wr{constructor(e,i){this.context=new cr(e),this.transform=i,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:t.ar(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Fe.maxOverzooming+Fe.maxUnderzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new At}resize(e,t,i){if(this.width=Math.floor(e*i),this.height=Math.floor(t*i),this.pixelRatio=i,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const n of this.style._order)this.style._layers[n].resize()}setup(){const e=this.context,i=new t.aW;i.emplaceBack(0,0),i.emplaceBack(t.a5,0),i.emplaceBack(0,t.a5),i.emplaceBack(t.a5,t.a5),this.tileExtentBuffer=e.createVertexBuffer(i,Bt.members),this.tileExtentSegments=t.aX.simpleSegment(0,0,4,2);const n=new t.aW;n.emplaceBack(0,0),n.emplaceBack(t.a5,0),n.emplaceBack(0,t.a5),n.emplaceBack(t.a5,t.a5),this.debugBuffer=e.createVertexBuffer(n,Bt.members),this.debugSegments=t.aX.simpleSegment(0,0,4,5);const r=new t.ch;r.emplaceBack(0,0,0,0),r.emplaceBack(t.a5,0,t.a5,0),r.emplaceBack(0,t.a5,0,t.a5),r.emplaceBack(t.a5,t.a5,t.a5,t.a5),this.rasterBoundsBuffer=e.createVertexBuffer(r,Bi.members),this.rasterBoundsSegments=t.aX.simpleSegment(0,0,4,2);const o=new t.aW;o.emplaceBack(0,0),o.emplaceBack(t.a5,0),o.emplaceBack(0,t.a5),o.emplaceBack(t.a5,t.a5),this.rasterBoundsBufferPosOnly=e.createVertexBuffer(o,Bt.members),this.rasterBoundsSegmentsPosOnly=t.aX.simpleSegment(0,0,4,5);const a=new t.aW;a.emplaceBack(0,0),a.emplaceBack(1,0),a.emplaceBack(0,1),a.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(a,Bt.members),this.viewportSegments=t.aX.simpleSegment(0,0,4,2);const s=new t.ci;s.emplaceBack(0),s.emplaceBack(1),s.emplaceBack(3),s.emplaceBack(2),s.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(s);const l=new t.aY;l.emplaceBack(1,0,2),l.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(l);const c=this.context.gl;this.stencilClearMode=new ri({func:c.ALWAYS,mask:0},0,255,c.ZERO,c.ZERO,c.ZERO),this.tileExtentMesh=new Ft(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){const e=this.context,i=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const n=t.N();t.c7(n,0,this.width,this.height,0,0,1),t.Q(n,n,[i.drawingBufferWidth,i.drawingBufferHeight,0]);const r={mainMatrix:n,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:n};this.useProgram("clippingMask",null,!0).draw(e,i.TRIANGLES,ii.disabled,this.stencilClearMode,Jt.disabled,ti.disabled,null,null,r,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(e,t,i){if(this.currentStencilSource===e.source||!e.isTileClipped()||!t||!t.length)return;this.currentStencilSource=e.source,this.nextStencilID+t.length>256&&this.clearStencil();const n=this.context;n.setColorMode(Jt.disabled),n.setDepthMode(ii.disabled);const r={};for(const o of t)r[o.key]=this.nextStencilID++;this._renderTileMasks(r,t,i,!0),this._renderTileMasks(r,t,i,!1),this._tileClippingMaskIDs=r}_renderTileMasks(e,t,i,n){const r=this.context,o=r.gl,a=this.style.projection,s=this.transform,l=this.useProgram("clippingMask");for(const c of t){const t=e[c.key],u=this.style.map.terrain&&this.style.map.terrain.getTerrainData(c),h=a.getMeshFromTileID(this.context,c.canonical,n,!0,"stencil"),d=s.getProjectionData({overscaledTileID:c,applyGlobeMatrix:!i,applyTerrainMatrix:!0});l.draw(r,o.TRIANGLES,ii.disabled,new ri({func:o.ALWAYS,mask:0},t,255,o.KEEP,o.KEEP,o.REPLACE),Jt.disabled,i?ti.disabled:ti.backCCW,null,u,d,"$clipping",h.vertexBuffer,h.indexBuffer,h.segments)}}_renderTilesDepthBuffer(){const e=this.context,t=e.gl,i=this.style.projection,n=this.transform,r=this.useProgram("depth"),o=this.getDepthModeFor3D(),a=Ee(n,{tileSize:n.tileSize});for(const s of a){const a=this.style.map.terrain&&this.style.map.terrain.getTerrainData(s),l=i.getMeshFromTileID(this.context,s.canonical,!0,!0,"raster"),c=n.getProjectionData({overscaledTileID:s,applyGlobeMatrix:!0,applyTerrainMatrix:!0});r.draw(e,t.TRIANGLES,o,ri.disabled,Jt.disabled,ti.backCCW,null,a,c,"$clipping",l.vertexBuffer,l.indexBuffer,l.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const e=this.nextStencilID++,t=this.context.gl;return new ri({func:t.NOTEQUAL,mask:255},e,255,t.KEEP,t.KEEP,t.REPLACE)}stencilModeForClipping(e){const t=this.context.gl;return new ri({func:t.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,t.KEEP,t.KEEP,t.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(e){const t=this.context.gl,i=e.sort((e,t)=>t.overscaledZ-e.overscaledZ),n=i[i.length-1].overscaledZ,r=i[0].overscaledZ-n+1;if(r>1){this.currentStencilSource=void 0,this.nextStencilID+r>256&&this.clearStencil();const e={};for(let i=0;i<r;i++)e[i+n]=new ri({func:t.GEQUAL,mask:255},i+this.nextStencilID,255,t.KEEP,t.KEEP,t.REPLACE);return this.nextStencilID+=r,[e,i]}return[{[n]:ri.disabled},i]}stencilConfigForOverlapTwoPass(e){const t=this.context.gl,i=e.sort((e,t)=>t.overscaledZ-e.overscaledZ),n=i[i.length-1].overscaledZ,r=i[0].overscaledZ-n+1;if(this.clearStencil(),r>1){const e={},o={};for(let i=0;i<r;i++)e[i+n]=new ri({func:t.GREATER,mask:255},r+1+i,255,t.KEEP,t.KEEP,t.REPLACE),o[i+n]=new ri({func:t.GREATER,mask:255},1+i,255,t.KEEP,t.KEEP,t.REPLACE);return this.nextStencilID=2*r+1,[e,o,i]}return this.nextStencilID=3,[{[n]:new ri({func:t.GREATER,mask:255},2,255,t.KEEP,t.KEEP,t.REPLACE)},{[n]:new ri({func:t.GREATER,mask:255},1,255,t.KEEP,t.KEEP,t.REPLACE)},i]}colorModeForRenderPass(){const e=this.context.gl;if(this._showOverdrawInspector){const i=1/8;return new Jt([e.CONSTANT_COLOR,e.ONE],new t.bp(i,i,i,0),[!0,!0,!0,!0])}return"opaque"===this.renderPass?Jt.unblended:Jt.alphaBlended}getDepthModeForSublayer(e,t,i){if(!this.opaquePassEnabledForLayer())return ii.disabled;const n=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new ii(i||this.context.gl.LEQUAL,t,[n,n])}getDepthModeFor3D(){return new ii(this.context.gl.LEQUAL,ii.ReadWrite,this.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(e,i){var n,r;this.style=e,this.options=i,this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(c()),this.imageManager.beginFrame();const o=this.style._order,a=this.style.tileManagers,s={},l={},u={},h={isRenderingToTexture:!1,isRenderingGlobe:(null===(n=e.projection)||void 0===n?void 0:n.transitionState)>0};for(const t in a){const e=a[t];e.used&&e.prepare(this.context),s[t]=e.getVisibleCoordinates(!1),l[t]=s[t].slice().reverse(),u[t]=e.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let t=0;t<o.length;t++)if(this.style._layers[o[t]].is3D()){this.opaquePassCutoff=t;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const t of o){const e=this.style._layers[t];if(!e.hasOffscreenPass()||e.isHidden(this.transform.zoom))continue;const i=l[e.source];("custom"===e.type||i.length)&&this.renderLayer(this,a[e.source],e,i,h)}if(null===(r=this.style.projection)||void 0===r||r.updateGPUdependent({context:this.context,useProgram:e=>this.useProgram(e)}),this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:i.showOverdrawInspector?t.bp.black:t.bp.transparent,depth:1}),this.clearStencil(),this.style.sky&&function(e,t){const i=e.context,n=i.gl,r=((e,t,i)=>{const n=Math.cos(t.rollInRadians),r=Math.sin(t.rollInRadians),o=ye(t),a=t.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:e.properties.get("sky-color"),u_horizon_color:e.properties.get("horizon-color"),u_horizon:[(t.width/2-o*r)*i,(t.height/2+o*n)*i],u_horizon_normal:[-r,n],u_sky_horizon_blend:e.properties.get("sky-horizon-blend")*t.height/2*i,u_sky_blend:a}})(t,e.style.map.transform,e.pixelRatio),o=new ii(n.LEQUAL,ii.ReadWrite,[0,1]),a=ri.disabled,s=e.colorModeForRenderPass(),l=e.useProgram("sky"),c=$r(i,t);l.draw(i,n.TRIANGLES,o,a,s,ti.disabled,r,null,void 0,"sky",c.vertexBuffer,c.indexBuffer,c.segments)}(this,this.style.sky),this._showOverdrawInspector=i.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=o.length-1;this.currentLayer>=0;this.currentLayer--){const e=this.style._layers[o[this.currentLayer]],t=a[e.source],i=s[e.source];this._renderTileClippingMasks(e,i,!1),this.renderLayer(this,t,e,i,h)}this.renderPass="translucent";let d=!1;for(this.currentLayer=0;this.currentLayer<o.length;this.currentLayer++){const e=this.style._layers[o[this.currentLayer]],t=a[e.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(e,h))continue;this.opaquePassEnabledForLayer()||d||(d=!0,h.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());const i=("symbol"===e.type?u:l)[e.source];this._renderTileClippingMasks(e,s[e.source],!!this.renderToTexture),this.renderLayer(this,t,e,i,h)}if(h.isRenderingGlobe&&function(e,i,n){const r=e.context,o=r.gl,a=e.useProgram("atmosphere"),s=new ii(o.LEQUAL,ii.ReadOnly,[0,1]),l=e.transform,c=function(e,i){const n=e.properties.get("position"),r=[-n.x,-n.y,-n.z],o=t.ar(new Float64Array(16));return"map"===e.properties.get("anchor")&&(t.bg(o,o,i.rollInRadians),t.bh(o,o,-i.pitchInRadians),t.bg(o,o,i.bearingInRadians),t.bh(o,o,i.center.lat*Math.PI/180),t.bJ(o,o,-i.center.lng*Math.PI/180)),t.cg(r,r,o),r}(n,e.transform),u=l.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),h=i.properties.get("atmosphere-blend")*u.projectionTransition;if(0===h)return;const d=_i(l.worldSize,l.center.lat),p=l.inverseProjectionMatrix,f=new Float64Array(4);f[3]=1,t.aH(f,f,l.modelViewProjectionMatrix),f[0]/=f[3],f[1]/=f[3],f[2]/=f[3],f[3]=1,t.aH(f,f,p),f[0]/=f[3],f[1]/=f[3],f[2]/=f[3],f[3]=1;const m=((e,t,i,n,r)=>({u_sun_pos:e,u_atmosphere_blend:t,u_globe_position:i,u_globe_radius:n,u_inv_proj_matrix:r}))(c,h,[f[0],f[1],f[2]],d,p),g=$r(r,i);a.draw(r,o.TRIANGLES,s,ri.disabled,Jt.alphaBlended,ti.disabled,m,null,null,"atmosphere",g.vertexBuffer,g.indexBuffer,g.segments)}(this,this.style.sky,this.style.light),this.options.showTileBoundaries){const e=function(e,t){let i=null;const n=Object.values(e._layers).flatMap(i=>i.source&&!i.isHidden(t)?[e.tileManagers[i.source]]:[]),r=n.filter(e=>"vector"===e.getSource().type),o=n.filter(e=>"vector"!==e.getSource().type),a=e=>{(!i||i.getSource().maxzoom<e.getSource().maxzoom)&&(i=e)};return r.forEach(e=>a(e)),i||o.forEach(e=>a(e)),i}(this.style,this.transform.zoom);e&&function(e,t,i){for(let n=0;n<i.length;n++)Gr(e,t,i[n])}(this,e,e.getVisibleCoordinates())}this.options.showPadding&&function(e){const t=e.transform.padding;Vr(e,e.transform.height-(t.top||0),3,Fr),Vr(e,t.bottom||0,3,Br),Ur(e,t.left||0,3,Or),Ur(e,e.transform.width-(t.right||0),3,Nr);const i=e.transform.centerPoint;var n,r,o,a;n=e,r=i.x,o=e.transform.height-i.y,Zr(n,r-1,o-10,2,20,a=jr),Zr(n,r-10,o-1,20,2,a)}(this),this.context.setDefault()}maybeDrawDepthAndCoords(e){if(!this.style||!this.style.map||!this.style.map.terrain)return;const i=this.terrainFacilitator.matrix,n=this.transform.modelViewProjectionMatrix;let r=this.terrainFacilitator.dirty;r||(r=e?!t.cj(i,n):!t.ck(i,n)),r||(r=this.style.map.terrain.tileManager.anyTilesAfterTime(this.terrainFacilitator.renderTime)),r&&(t.cl(i,n),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(e,i){const n=e.context,r=n.gl,o=e.transform,a=Jt.unblended,s=new ii(r.LEQUAL,ii.ReadWrite,[0,1]),l=i.tileManager.getRenderableTiles(),c=e.useProgram("terrainDepth");n.bindFramebuffer.set(i.getFramebuffer("depth").framebuffer),n.viewport.set([0,0,e.width/devicePixelRatio,e.height/devicePixelRatio]),n.clear({color:t.bp.transparent,depth:1});for(const t of l){const e=i.getTerrainMesh(t.tileID),l=i.getTerrainData(t.tileID),u=o.getProjectionData({overscaledTileID:t.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),h={u_ele_delta:i.getMeshFrameDelta(o.zoom)};c.draw(n,r.TRIANGLES,s,ri.disabled,a,ti.backCCW,h,l,u,"terrain",e.vertexBuffer,e.indexBuffer,e.segments)}n.bindFramebuffer.set(null),n.viewport.set([0,0,e.width,e.height])}(this,this.style.map.terrain),function(e,i){const n=e.context,r=n.gl,o=e.transform,a=Jt.unblended,s=new ii(r.LEQUAL,ii.ReadWrite,[0,1]),l=i.getCoordsTexture(),c=i.tileManager.getRenderableTiles(),u=e.useProgram("terrainCoords");n.bindFramebuffer.set(i.getFramebuffer("coords").framebuffer),n.viewport.set([0,0,e.width/devicePixelRatio,e.height/devicePixelRatio]),n.clear({color:t.bp.transparent,depth:1}),i.coordsIndex=[];for(const t of c){const e=i.getTerrainMesh(t.tileID),c=i.getTerrainData(t.tileID);n.activeTexture.set(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,l.texture);const h={u_terrain_coords_id:(255-i.coordsIndex.length)/255,u_texture:0,u_ele_delta:i.getMeshFrameDelta(o.zoom)},d=o.getProjectionData({overscaledTileID:t.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});u.draw(n,r.TRIANGLES,s,ri.disabled,a,ti.backCCW,h,c,d,"terrain",e.vertexBuffer,e.indexBuffer,e.segments),i.coordsIndex.push(t.tileID.key)}n.bindFramebuffer.set(null),n.viewport.set([0,0,e.width,e.height])}(this,this.style.map.terrain))}renderLayer(e,i,n,r,o){n.isHidden(this.transform.zoom)||("background"===n.type||"custom"===n.type||(r||[]).length)&&(this.id=n.id,t.cm(n)?function(e,i,n,r,o,a){if("translucent"!==e.renderPass)return;const{isRenderingToTexture:s}=a,l=ri.disabled,c=e.colorModeForRenderPass();(n._unevaluatedLayout.hasValue("text-variable-anchor")||n._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(e,i,n,r,o,a,s,l,c){const u=i.transform,h=i.style.map.terrain,d="map"===o,p="map"===a;for(const f of e){const e=r.getTile(f),o=e.getBucket(n);if(!o||!o.text||!o.text.segments.get().length)continue;const a=t.ay(o.textSizeData,u.zoom),m=t.aN(e,1,i.transform.zoom),g=je(d,i.transform,m),_="none"!==n.layout.get("icon-text-fit")&&o.hasIconData();if(a){const i=Math.pow(2,u.zoom-e.tileID.overscaledZ),n=h?(e,t)=>h.getElevation(f,e,t):null;mr(o,d,p,c,u,g,i,a,_,t.aO(u,e,s,l),f.toUnwrapped(),n)}}}(r,e,n,i,n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),o),0!==n.paint.get("icon-opacity").constantOr(1)&&_r(e,i,n,r,!1,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),n.layout.get("icon-rotation-alignment"),n.layout.get("icon-pitch-alignment"),n.layout.get("icon-keep-upright"),l,c,s),0!==n.paint.get("text-opacity").constantOr(1)&&_r(e,i,n,r,!0,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),n.layout.get("text-keep-upright"),l,c,s),i.map.showCollisionBoxes&&(hr(e,i,n,r,!0),hr(e,i,n,r,!1))}(e,i,n,r,this.style.placement.variableOffsets,o):t.cn(n)?function(e,i,n,r,o){if("translucent"!==e.renderPass)return;const{isRenderingToTexture:a}=o,s=n.paint.get("circle-opacity"),l=n.paint.get("circle-stroke-width"),c=n.paint.get("circle-stroke-opacity"),u=!n.layout.get("circle-sort-key").isConstant();if(0===s.constantOr(1)&&(0===l.constantOr(1)||0===c.constantOr(1)))return;const h=e.context,d=h.gl,p=e.transform,f=e.getDepthModeForSublayer(0,ii.ReadOnly),m=ri.disabled,g=e.colorModeForRenderPass(),_=[],y=p.getCircleRadiusCorrection();for(let v=0;v<r.length;v++){const o=r[v],s=i.getTile(o),l=s.getBucket(n);if(!l)continue;const c=n.paint.get("circle-translate"),h=n.paint.get("circle-translate-anchor"),d=t.aO(p,s,c,h),f=l.programConfigurations.get(n.id),m=e.useProgram("circle",f),g=l.layoutVertexBuffer,x=l.indexBuffer,b=e.style.map.terrain&&e.style.map.terrain.getTerrainData(o),w={programConfiguration:f,program:m,layoutVertexBuffer:g,indexBuffer:x,uniformValues:Xi(e,s,n,d,y),terrainData:b,projectionData:p.getProjectionData({overscaledTileID:o,applyGlobeMatrix:!a,applyTerrainMatrix:!0})};if(u){const e=l.segments.get();for(const i of e)_.push({segments:new t.aX([i]),sortKey:i.sortKey,state:w})}else _.push({segments:l.segments,sortKey:0,state:w})}u&&_.sort((e,t)=>e.sortKey-t.sortKey);for(const t of _){const{programConfiguration:i,program:r,layoutVertexBuffer:o,indexBuffer:a,uniformValues:s,terrainData:l,projectionData:c}=t.state;r.draw(h,d.TRIANGLES,f,m,g,ti.backCCW,s,l,c,n.id,o,a,t.segments,n.paint,e.transform.zoom,i)}}(e,i,n,r,o):t.co(n)?function(e,i,n,r,o){if(0===n.paint.get("heatmap-opacity"))return;const a=e.context,{isRenderingToTexture:s,isRenderingGlobe:l}=o;if(e.style.map.terrain){for(const t of r){const r=i.getTile(t);i.hasRenderableParent(t)||("offscreen"===e.renderPass?vr(e,r,n,t,l):"translucent"===e.renderPass&&xr(e,n,t,s,l))}a.viewport.set([0,0,e.width,e.height])}else"offscreen"===e.renderPass?function(e,i,n,r){const o=e.context,a=o.gl,s=e.transform,l=ri.disabled,c=new Jt([a.ONE,a.ONE],t.bp.transparent,[!0,!0,!0,!0]);(function(e,i,n){const r=e.gl;e.activeTexture.set(r.TEXTURE1),e.viewport.set([0,0,i.width/4,i.height/4]);let o=n.heatmapFbos.get(t.cd);o?(r.bindTexture(r.TEXTURE_2D,o.colorAttachment.get()),e.bindFramebuffer.set(o.framebuffer)):(o=br(e,i.width/4,i.height/4),n.heatmapFbos.set(t.cd,o))})(o,e,n),o.clear({color:t.bp.transparent});for(let t=0;t<r.length;t++){const u=r[t];if(i.hasRenderableParent(u))continue;const h=i.getTile(u),d=h.getBucket(n);if(!d)continue;const p=d.programConfigurations.get(n.id),f=e.useProgram("heatmap",p),m=s.getProjectionData({overscaledTileID:u,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),g=s.getCircleRadiusCorrection();f.draw(o,a.TRIANGLES,ii.disabled,l,c,ti.backCCW,Ji(h,s.zoom,n.paint.get("heatmap-intensity"),g),null,m,n.id,d.layoutVertexBuffer,d.indexBuffer,d.segments,n.paint,s.zoom,p)}o.viewport.set([0,0,e.width,e.height])}(e,i,n,r):"translucent"===e.renderPass&&function(e,i){const n=e.context,r=n.gl;n.setColorMode(e.colorModeForRenderPass());const o=i.heatmapFbos.get(t.cd);o&&(n.activeTexture.set(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,o.colorAttachment.get()),n.activeTexture.set(r.TEXTURE1),wr(n,i).bind(r.LINEAR,r.CLAMP_TO_EDGE),e.useProgram("heatmapTexture").draw(n,r.TRIANGLES,ii.disabled,ri.disabled,e.colorModeForRenderPass(),ti.disabled,en(e,i,0,1),null,null,i.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,i.paint,e.transform.zoom))}(e,n)}(e,i,n,r,o):t.cp(n)?function(e,t,i,n,r){if("translucent"!==e.renderPass)return;const{isRenderingToTexture:o}=r,a=i.paint.get("line-opacity"),s=i.paint.get("line-width");if(0===a.constantOr(1)||0===s.constantOr(1))return;const l=e.getDepthModeForSublayer(0,ii.ReadOnly),c=e.colorModeForRenderPass(),u=i.paint.get("line-dasharray"),h=u.constantOr(1),d=i.paint.get("line-pattern"),p=d.constantOr(1),f=i.paint.get("line-gradient"),m=i.getCrossfadeParameters();let g;g=p?"linePattern":h&&f?"lineGradientSDF":h?"lineSDF":f?"lineGradient":"line";const _=e.context,y=_.gl,v=e.transform;let x=!0;for(const b of n){const n=t.getTile(b);if(p&&!n.patternsLoaded())continue;const r=n.getBucket(i);if(!r)continue;const a=r.programConfigurations.get(i.id),s=e.context.program.get(),w=e.useProgram(g,a),T=x||w.program!==s,S=e.style.map.terrain&&e.style.map.terrain.getTerrainData(b),P=d.constantOr(null),M=u&&u.constantOr(null);if(P&&n.imageAtlas){const e=n.imageAtlas,t=e.patternPositions[P.to.toString()],i=e.patternPositions[P.from.toString()];t&&i&&a.setConstantPatternPositions(t,i)}else if(M){const t="round"===i.layout.get("line-cap"),n=e.lineAtlas.getDash(M.to,t),r=e.lineAtlas.getDash(M.from,t);a.setConstantDashPositions(n,r)}const E=v.getProjectionData({overscaledTileID:b,applyGlobeMatrix:!o,applyTerrainMatrix:!0}),C=v.getPixelScale();let k;p?(k=ln(e,n,i,C,m),Sr(_,y,n,a,m)):h&&f?(k=un(e,n,i,C,m,r.lineClipsArray.length),Er(e,t,_,y,i,r,b,a,m)):h?(k=cn(e,n,i,C,m),Pr(e,_,y,a,T,m)):f?(k=sn(e,n,i,C,r.lineClipsArray.length),Mr(e,t,_,y,i,r,b)):k=an(e,n,i,C);const I=e.stencilModeForClipping(b);w.draw(_,y.TRIANGLES,l,I,c,ti.disabled,k,S,E,i.id,r.layoutVertexBuffer,r.indexBuffer,r.segments,i.paint,e.transform.zoom,a,r.layoutVertexBuffer2),x=!1}}(e,i,n,r,o):t.cq(n)?function(e,i,n,r,o){const a=n.paint.get("fill-color"),s=n.paint.get("fill-opacity");if(0===s.constantOr(1))return;const{isRenderingToTexture:l}=o,c=e.colorModeForRenderPass(),u=n.paint.get("fill-pattern"),h=e.opaquePassEnabledForLayer()&&!u.constantOr(1)&&1===a.constantOr(t.bp.transparent).a&&1===s.constantOr(0)?"opaque":"translucent";if(e.renderPass===h){const t=e.getDepthModeForSublayer(1,"opaque"===e.renderPass?ii.ReadWrite:ii.ReadOnly);kr(e,i,n,r,t,c,!1,l)}if("translucent"===e.renderPass&&n.paint.get("fill-antialias")){const t=e.getDepthModeForSublayer(n.getPaintProperty("fill-outline-color")?2:0,ii.ReadOnly);kr(e,i,n,r,t,c,!0,l)}}(e,i,n,r,o):t.cr(n)?function(e,t,i,n,r){const o=i.paint.get("fill-extrusion-opacity");if(0===o)return;const{isRenderingToTexture:a}=r;if("translucent"===e.renderPass){const r=new ii(e.context.gl.LEQUAL,ii.ReadWrite,e.depthRangeFor3D);if(1!==o||i.paint.get("fill-extrusion-pattern").constantOr(1))Ir(e,t,i,n,r,ri.disabled,Jt.disabled,a),Ir(e,t,i,n,r,e.stencilModeFor3D(),e.colorModeForRenderPass(),a);else{const o=e.colorModeForRenderPass();Ir(e,t,i,n,r,ri.disabled,o,a)}}}(e,i,n,r,o):t.cs(n)?function(e,i,n,r,o){if("offscreen"!==e.renderPass&&"translucent"!==e.renderPass)return;const{isRenderingToTexture:a}=o,s=e.context,l=e.style.projection.useSubdivision,c=e.getDepthModeForSublayer(0,ii.ReadOnly),u=e.colorModeForRenderPass();if("offscreen"===e.renderPass)!function(e,i,n,r,o,a,s){const l=e.context,c=l.gl;for(const u of n){const n=i.getTile(u),h=n.dem;if(!h||!h.data)continue;if(!n.needsHillshadePrepare)continue;const d=h.dim,p=h.stride,f=h.getPixels();if(l.activeTexture.set(c.TEXTURE1),l.pixelStoreUnpackPremultiplyAlpha.set(!1),n.demTexture=n.demTexture||e.getTileTexture(p),n.demTexture){const e=n.demTexture;e.update(f,{premultiply:!1}),e.bind(c.NEAREST,c.CLAMP_TO_EDGE)}else n.demTexture=new t.T(l,f,c.RGBA,{premultiply:!1}),n.demTexture.bind(c.NEAREST,c.CLAMP_TO_EDGE);l.activeTexture.set(c.TEXTURE0);let m=n.fbo;if(!m){const e=new t.T(l,{width:d,height:d,data:null},c.RGBA);e.bind(c.LINEAR,c.CLAMP_TO_EDGE),m=n.fbo=l.createFramebuffer(d,d,!0,!1),m.colorAttachment.set(e.texture)}l.bindFramebuffer.set(m.framebuffer),l.viewport.set([0,0,d,d]),e.useProgram("hillshadePrepare").draw(l,c.TRIANGLES,o,a,s,ti.disabled,nn(n.tileID,h),null,null,r.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments),n.needsHillshadePrepare=!1}}(e,i,r,n,c,ri.disabled,u),s.viewport.set([0,0,e.width,e.height]);else if("translucent"===e.renderPass)if(l){const[t,o,s]=e.stencilConfigForOverlapTwoPass(r);zr(e,i,n,s,t,c,u,!1,a),zr(e,i,n,s,o,c,u,!0,a)}else{const[t,o]=e.getStencilConfigForOverlapAndUpdateStencilID(r);zr(e,i,n,o,t,c,u,!1,a)}}(e,i,n,r,o):t.ct(n)?function(e,t,i,n,r){if("translucent"!==e.renderPass)return;if(!n.length)return;const{isRenderingToTexture:o}=r,a=e.style.projection.useSubdivision,s=e.getDepthModeForSublayer(0,ii.ReadOnly),l=e.colorModeForRenderPass();if(a){const[r,a,c]=e.stencilConfigForOverlapTwoPass(n);Ar(e,t,i,c,r,s,l,!1,o),Ar(e,t,i,c,a,s,l,!0,o)}else{const[r,a]=e.getStencilConfigForOverlapAndUpdateStencilID(n);Ar(e,t,i,a,r,s,l,!1,o)}}(e,i,n,r,o):t.bU(n)?function(e,t,i,n,r){if("translucent"!==e.renderPass)return;if(0===i.paint.get("raster-opacity"))return;if(!n.length)return;const{isRenderingToTexture:o}=r,a=t.getSource(),s=e.style.projection.useSubdivision;if(a instanceof te)Dr(e,t,i,n,null,!1,!1,a.tileCoords,a.flippedWindingOrder,o);else if(s){const[r,a,s]=e.stencilConfigForOverlapTwoPass(n);Dr(e,t,i,s,r,!1,!0,Lr,!1,o),Dr(e,t,i,s,a,!0,!0,Lr,!1,o)}else{const[r,a]=e.getStencilConfigForOverlapAndUpdateStencilID(n);Dr(e,t,i,a,r,!1,!0,Lr,!1,o)}}(e,i,n,r,o):t.cu(n)?function(e,t,i,n,r){const o=i.paint.get("background-color"),a=i.paint.get("background-opacity");if(0===a)return;const{isRenderingToTexture:s}=r,l=e.context,c=l.gl,u=e.style.projection,h=e.transform,d=h.tileSize,p=i.paint.get("background-pattern");if(e.isPatternMissing(p))return;const f=!p&&1===o.a&&1===a&&e.opaquePassEnabledForLayer()?"opaque":"translucent";if(e.renderPass!==f)return;const m=ri.disabled,g=e.getDepthModeForSublayer(0,"opaque"===f?ii.ReadWrite:ii.ReadOnly),_=e.colorModeForRenderPass(),y=e.useProgram(p?"backgroundPattern":"background"),v=n||Ee(h,{tileSize:d,terrain:e.style.map.terrain});p&&(l.activeTexture.set(c.TEXTURE0),e.imageManager.bind(e.context));const x=i.getCrossfadeParameters();for(const b of v){const t=h.getProjectionData({overscaledTileID:b,applyGlobeMatrix:!s,applyTerrainMatrix:!0}),n=p?vn(a,e,p,{tileID:b,tileSize:d},x):yn(a,o),r=e.style.map.terrain&&e.style.map.terrain.getTerrainData(b),f=u.getMeshFromTileID(l,b.canonical,!1,!0,"raster");y.draw(l,c.TRIANGLES,g,m,_,ti.backCCW,n,r,t,i.id,f.vertexBuffer,f.indexBuffer,f.segments)}}(e,0,n,r,o):t.cv(n)&&function(e,t,i,n){const{isRenderingGlobe:r}=n,o=e.context,a=i.implementation,s=e.style.projection,l=e.transform,c=l.getProjectionDataForCustomLayer(r),u={farZ:l.farZ,nearZ:l.nearZ,fov:l.fov*Math.PI/180,modelViewProjectionMatrix:l.modelViewProjectionMatrix,projectionMatrix:l.projectionMatrix,shaderData:{variantName:s.shaderVariantName,vertexShaderPrelude:`const float PI = 3.141592653589793;\nuniform mat4 u_projection_matrix;\n${s.shaderPreludeCode.vertexSource}`,define:s.shaderDefine},defaultProjectionData:c},h=a.renderingMode?a.renderingMode:"2d";if("offscreen"===e.renderPass){const t=a.prerender;t&&(e.setCustomLayerDefaults(),o.setColorMode(e.colorModeForRenderPass()),t.call(a,o.gl,u),o.setDirty(),e.setBaseState())}else if("translucent"===e.renderPass){e.setCustomLayerDefaults(),o.setColorMode(e.colorModeForRenderPass()),o.setStencilMode(ri.disabled);const t="3d"===h?e.getDepthModeFor3D():e.getDepthModeForSublayer(0,ii.ReadOnly);o.setDepthMode(t),a.render(o.gl,u),o.setDirty(),e.setBaseState(),o.bindFramebuffer.set(null)}}(e,0,n,o))}saveTileTexture(e){const t=this._tileTextures[e.size[0]];t?t.push(e):this._tileTextures[e.size[0]]=[e]}getTileTexture(e){const t=this._tileTextures[e];return t&&t.length>0?t.pop():null}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;const t=this.imageManager.getPattern(e.from.toString()),i=this.imageManager.getPattern(e.to.toString());return!t||!i}useProgram(e,t,i=!1,n=[]){this.cache=this.cache||{};const r=!!this.style.map.terrain,o=this.style.projection,a=i?Dt.projectionMercator:o.shaderPreludeCode,s=i?Ot:o.shaderDefine,l=e+(t?t.cacheKey:"")+`/${i?Nt:o.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(r?"/terrain":"")+(n?`/${n.join("/")}`:"");return this.cache[l]||(this.cache[l]=new Ui(this.context,Dt[e],t,bn[e],this._showOverdrawInspector,r,a,s,n)),this.cache[l]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new t.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){var e,t;if(this._tileTextures){for(const e in this._tileTextures){const t=this._tileTextures[e];if(t)for(const e of t)e.destroy()}this._tileTextures={}}if(this.tileExtentBuffer&&this.tileExtentBuffer.destroy(),this.debugBuffer&&this.debugBuffer.destroy(),this.rasterBoundsBuffer&&this.rasterBoundsBuffer.destroy(),this.rasterBoundsBufferPosOnly&&this.rasterBoundsBufferPosOnly.destroy(),this.viewportBuffer&&this.viewportBuffer.destroy(),this.tileBorderIndexBuffer&&this.tileBorderIndexBuffer.destroy(),this.quadTriangleIndexBuffer&&this.quadTriangleIndexBuffer.destroy(),this.tileExtentMesh&&(null===(e=this.tileExtentMesh.vertexBuffer)||void 0===e||e.destroy()),this.tileExtentMesh&&(null===(t=this.tileExtentMesh.indexBuffer)||void 0===t||t.destroy()),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this.cache){for(const e in this.cache){const t=this.cache[e];t&&t.program&&this.context.gl.deleteProgram(t.program)}this.cache={}}this.context&&this.context.setDefault()}overLimit(){const{drawingBufferWidth:e,drawingBufferHeight:t}=this.context.gl;return this.width!==e||this.height!==t}}function Hr(e,t){let i,n=!1,r=null,o=null;const a=()=>{r=null,n&&(e.apply(o,i),r=setTimeout(a,t),n=!1)};return(...e)=>(n=!0,o=this,i=e,r||a(),r)}class Xr{constructor(e){this._getCurrentHash=()=>{const e=window.location.hash.replace("#","");if(this._hashName){let t;return e.split("&").map(e=>e.split("=")).forEach(e=>{e[0]===this._hashName&&(t=e)}),(t&&t[1]||"").split("/")}return e.split("/")},this._onHashChange=()=>{const e=this._getCurrentHash();if(!this._isValidHash(e))return!1;const t=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(e[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+e[2],+e[1]],zoom:+e[0],bearing:t,pitch:+(e[4]||0)}),!0},this._updateHashUnthrottled=()=>{const e=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,e)},this._removeHash=()=>{const e=this._getCurrentHash();if(0===e.length)return;const t=e.join("/");let i=t;i.split("&").length>0&&(i=i.split("&")[0]),this._hashName&&(i=`${this._hashName}=${t}`);let n=window.location.hash.replace(i,"");n.startsWith("#&")?n=n.slice(0,1)+n.slice(2):"#"===n&&(n="");let r=window.location.href.replace(/(#.+)?$/,n);r=r.replace("&&","&"),window.history.replaceState(window.history.state,null,r)},this._updateHash=Hr(this._updateHashUnthrottled,300),this._hashName=e&&encodeURIComponent(e)}addTo(e){return this._map=e,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(e){const t=this._map.getCenter(),i=Math.round(100*this._map.getZoom())/100,n=Math.ceil((i*Math.LN2+Math.log(512/360/.5))/Math.LN10),r=Math.pow(10,n),o=Math.round(t.lng*r)/r,a=Math.round(t.lat*r)/r,s=this._map.getBearing(),l=this._map.getPitch();let c="";if(c+=e?`/${o}/${a}/${i}`:`${i}/${a}/${o}`,(s||l)&&(c+="/"+Math.round(10*s)/10),l&&(c+=`/${Math.round(l)}`),this._hashName){const e=this._hashName;let t=!1;const i=window.location.hash.slice(1).split("&").map(i=>{const n=i.split("=")[0];return n===e?(t=!0,`${n}=${c}`):i}).filter(e=>e);return t||i.push(`${e}=${c}`),`#${i.join("&")}`}return`#${c}`}_isValidHash(e){if(e.length<3||e.some(isNaN))return!1;try{new t.V(+e[2],+e[1])}catch(o){return!1}const i=+e[0],n=+(e[3]||0),r=+(e[4]||0);return i>=this._map.getMinZoom()&&i<=this._map.getMaxZoom()&&n>=-180&&n<=180&&r>=this._map.getMinPitch()&&r<=this._map.getMaxPitch()}}const Yr={linearity:.3,easing:t.cw(0,0,.3,1)},Kr=t.e({deceleration:2500,maxSpeed:1400},Yr),Qr=t.e({deceleration:20,maxSpeed:1400},Yr),Jr=t.e({deceleration:1e3,maxSpeed:360},Yr),eo=t.e({deceleration:1e3,maxSpeed:90},Yr),to=t.e({deceleration:1e3,maxSpeed:360},Yr);class io{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:c(),settings:e})}_drainInertiaBuffer(){const e=this._inertiaBuffer,t=c();for(;e.length>0&&t-e[0].time>160;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const i={zoom:0,bearing:0,pitch:0,roll:0,pan:new t.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:t}of this._inertiaBuffer)i.zoom+=t.zoomDelta||0,i.bearing+=t.bearingDelta||0,i.pitch+=t.pitchDelta||0,i.roll+=t.rollDelta||0,t.panDelta&&i.pan._add(t.panDelta),t.around&&(i.around=t.around),t.pinchAround&&(i.pinchAround=t.pinchAround);const n=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,r={};if(i.pan.mag()){const o=ro(i.pan.mag(),n,t.e({},Kr,e||{})),a=i.pan.mult(o.amount/i.pan.mag()),s=this._map.cameraHelper.handlePanInertia(a,this._map.transform);r.center=s.easingCenter,r.offset=s.easingOffset,no(r,o)}if(i.zoom){const e=ro(i.zoom,n,Qr);r.zoom=this._map.transform.zoom+e.amount,no(r,e)}if(i.bearing){const e=ro(i.bearing,n,Jr);r.bearing=this._map.transform.bearing+t.an(e.amount,-179,179),no(r,e)}if(i.pitch){const e=ro(i.pitch,n,eo);r.pitch=this._map.transform.pitch+e.amount,no(r,e)}if(i.roll){const e=ro(i.roll,n,to);r.roll=this._map.transform.roll+t.an(e.amount,-179,179),no(r,e)}if(r.zoom||r.bearing){const e=void 0===i.pinchAround?i.around:i.pinchAround;r.around=e?this._map.unproject(e):this._map.getCenter()}return this.clear(),t.e(r,{noMoveStart:!0})}}function no(e,t){(!e.duration||e.duration<t.duration)&&(e.duration=t.duration,e.easing=t.easing)}function ro(e,i,n){const{maxSpeed:r,linearity:o,deceleration:a}=n,s=t.an(e*o/(i/1e3),-r,r),l=Math.abs(s)/(a*o);return{easing:n.easing,duration:1e3*l,amount:s*(l/2)}}class oo extends t.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,n,r={}){n=n instanceof MouseEvent?n:new MouseEvent(e,n);const o=u.mousePos(i.getCanvas(),n),a=i.unproject(o);super(e,t.e({point:o,lngLat:a,originalEvent:n},r)),this._defaultPrevented=!1,this.target=i}}class ao extends t.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,n){const r="touchend"===e?n.changedTouches:n.touches,o=u.touchPos(i.getCanvasContainer(),r),a=o.map(e=>i.unproject(e)),s=o.reduce((e,t,i,n)=>e.add(t.div(n.length)),new t.P(0,0));super(e,{points:o,point:s,lngLats:a,lngLat:i.unproject(s),originalEvent:n}),this._defaultPrevented=!1}}class so extends t.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,i){super(e,{originalEvent:i}),this._defaultPrevented=!1}}class lo{constructor(e,t){this._map=e,this._clickTolerance=t.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new so(e.type,this._map,e))}mousedown(e,t){return this._mousedownPos=t,this._firePreventable(new oo(e.type,this._map,e))}mouseup(e){this._map.fire(new oo(e.type,this._map,e))}click(e,t){this._mousedownPos&&this._mousedownPos.dist(t)>=this._clickTolerance||this._map.fire(new oo(e.type,this._map,e))}dblclick(e){return this._firePreventable(new oo(e.type,this._map,e))}mouseover(e){this._map.fire(new oo(e.type,this._map,e))}mouseout(e){this._map.fire(new oo(e.type,this._map,e))}touchstart(e){return this._firePreventable(new ao(e.type,this._map,e))}touchmove(e){this._map.fire(new ao(e.type,this._map,e))}touchend(e){this._map.fire(new ao(e.type,this._map,e))}touchcancel(e){this._map.fire(new ao(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class co{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new oo(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new oo("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new oo(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class uo{constructor(e){this._map=e}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(e){return this.transform.screenPointToLocation(t.P.convert(e),this._map.terrain)}}class ho{constructor(e,t){this._map=e,this._tr=new uo(e),this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=t.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,t){this.isEnabled()&&e.shiftKey&&0===e.button&&(u.disableDrag(),this._startPos=this._lastPos=t,this._active=!0)}mousemoveWindow(e,t){if(!this._active)return;const i=t;if(this._lastPos.equals(i)||!this._box&&i.dist(this._startPos)<this._clickTolerance)return;const n=this._startPos;this._lastPos=i,this._box||(this._box=u.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",e));const r=Math.min(n.x,i.x),o=Math.max(n.x,i.x),a=Math.min(n.y,i.y),s=Math.max(n.y,i.y);u.setTransform(this._box,`translate(${r}px,${a}px)`),this._box.style.width=o-r+"px",this._box.style.height=s-a+"px"}mouseupWindow(e,i){if(!this._active)return;if(0!==e.button)return;const n=this._startPos,r=i;if(this.reset(),u.suppressClick(),n.x!==r.x||n.y!==r.y)return this._map.fire(new t.l("boxzoomend",{originalEvent:e})),{cameraAnimation:e=>e.fitScreenCoordinates(n,r,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",e)}keydown(e){this._active&&27===e.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",e))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(u.remove(this._box),this._box=null),u.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,i){return this._map.fire(new t.l(e,{originalEvent:i}))}}function po(e,t){if(e.length!==t.length)throw new Error(`The number of touches and points are not equal - touches ${e.length}, points ${t.length}`);const i={};for(let n=0;n<e.length;n++)i[e[n].identifier]=t[n];return i}class fo{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,i,n){(this.centroid||n.length>this.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=e.timeStamp),n.length===this.numTouches&&(this.centroid=function(e){const i=new t.P(0,0);for(const t of e)i._add(t);return i.div(e.length)}(i),this.touches=po(n,i)))}touchmove(e,t,i){if(this.aborted||!this.centroid)return;const n=po(i,t);for(const r in this.touches){const e=n[r];(!e||e.dist(this.touches[r])>30)&&(this.aborted=!0)}}touchend(e,t,i){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),0===i.length){const e=!this.aborted&&this.centroid;if(this.reset(),e)return e}}}class mo{constructor(e){this.singleTap=new fo(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,t,i){this.singleTap.touchstart(e,t,i)}touchmove(e,t,i){this.singleTap.touchmove(e,t,i)}touchend(e,t,i){const n=this.singleTap.touchend(e,t,i);if(n){const t=e.timeStamp-this.lastTime<500,i=!this.lastTap||this.lastTap.dist(n)<30;if(t&&i||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=n,this.count===this.numTaps)return this.reset(),n}}}class go{constructor(e){this._tr=new uo(e),this._zoomIn=new mo({numTouches:1,numTaps:2}),this._zoomOut=new mo({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,t,i){this._zoomIn.touchstart(e,t,i),this._zoomOut.touchstart(e,t,i)}touchmove(e,t,i){this._zoomIn.touchmove(e,t,i),this._zoomOut.touchmove(e,t,i)}touchend(e,t,i){const n=this._zoomIn.touchend(e,t,i),r=this._zoomOut.touchend(e,t,i),o=this._tr;return n?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:t=>t.easeTo({duration:300,zoom:o.zoom+1,around:o.unproject(n)},{originalEvent:e})}):r?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:t=>t.easeTo({duration:300,zoom:o.zoom-1,around:o.unproject(r)},{originalEvent:e})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class _o{constructor(e){this._enabled=!!e.enable,this._moveStateManager=e.moveStateManager,this._clickTolerance=e.clickTolerance||1,this._moveFunction=e.move,this._activateOnStart=!!e.activateOnStart,e.assignEvents(this),this.reset()}reset(e){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(e)}_move(...e){const t=this._moveFunction(...e);if(t.bearingDelta||t.pitchDelta||t.rollDelta||t.around||t.panDelta)return this._active=!0,t}dragStart(e,t){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(e)&&(this._moveStateManager.startMove(e),this._lastPoint=Array.isArray(t)?t[0]:t,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(e,t){if(!this.isEnabled())return;const i=this._lastPoint;if(!i)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e))return void this.reset(e);const n=Array.isArray(t)?t[0]:t;return!this._moved&&n.dist(i)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=n,this._move(i,n))}dragEnd(e){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(e)&&(this._moved&&u.suppressClick(),this.reset(e))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const yo=0,vo=2,xo={[yo]:1,[vo]:2};class bo{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){const t=u.mouseButton(e);this._eventButton=t}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!function(e,t){const i=xo[t];return void 0===e.buttons||(e.buttons&i)!==i}(e,this._eventButton)}isValidEndEvent(e){return u.mouseButton(e)===this._eventButton}}class wo{constructor(){this._firstTouch=void 0}_isOneFingerTouch(e){return 1===e.targetTouches.length}_isSameTouchEvent(e){return e.targetTouches[0].identifier===this._firstTouch}startMove(e){this._firstTouch=e.targetTouches[0].identifier}endMove(e){delete this._firstTouch}isValidStartEvent(e){return this._isOneFingerTouch(e)}isValidMoveEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}isValidEndEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}}class To{constructor(e=new bo({checkCorrectEvent:()=>!0}),t=new wo){this.mouseMoveStateManager=e,this.oneFingerTouchMoveStateManager=t}_executeRelevantHandler(e,t,i){return e instanceof MouseEvent?t(e):"undefined"!=typeof TouchEvent&&e instanceof TouchEvent?i(e):void 0}startMove(e){this._executeRelevantHandler(e,e=>this.mouseMoveStateManager.startMove(e),e=>this.oneFingerTouchMoveStateManager.startMove(e))}endMove(e){this._executeRelevantHandler(e,e=>this.mouseMoveStateManager.endMove(e),e=>this.oneFingerTouchMoveStateManager.endMove(e))}isValidStartEvent(e){return this._executeRelevantHandler(e,e=>this.mouseMoveStateManager.isValidStartEvent(e),e=>this.oneFingerTouchMoveStateManager.isValidStartEvent(e))}isValidMoveEvent(e){return this._executeRelevantHandler(e,e=>this.mouseMoveStateManager.isValidMoveEvent(e),e=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(e))}isValidEndEvent(e){return this._executeRelevantHandler(e,e=>this.mouseMoveStateManager.isValidEndEvent(e),e=>this.oneFingerTouchMoveStateManager.isValidEndEvent(e))}}const So=e=>{e.mousedown=e.dragStart,e.mousemoveWindow=e.dragMove,e.mouseup=e.dragEnd,e.contextmenu=e=>{e.preventDefault()}};class Po{constructor(e,t){this._clickTolerance=e.clickTolerance||1,this._map=t,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new t.P(0,0)}_shouldBePrevented(e){return e<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(e,t,i){return this._calculateTransform(e,t,i)}touchmove(e,t,i){if(this._active){if(!this._shouldBePrevented(i.length))return e.preventDefault(),this._calculateTransform(e,t,i);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",e)}}touchend(e,t,i){this._calculateTransform(e,t,i),this._active&&this._shouldBePrevented(i.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,i,n){n.length>0&&(this._active=!0);const r=po(n,i),o=new t.P(0,0),a=new t.P(0,0);let s=0;for(const t in r){const e=r[t],i=this._touches[t];i&&(o._add(e),a._add(e.sub(i)),s++,r[t]=e)}if(this._touches=r,this._shouldBePrevented(s)||!a.mag())return;const l=a.div(s);return this._sum._add(l),this._sum.mag()<this._clickTolerance?void 0:{around:o.div(s),panDelta:l}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Mo{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(e,t,i){this._firstTwoTouches||i.length<2||(this._firstTwoTouches=[i[0].identifier,i[1].identifier],this._start([t[0],t[1]]))}touchmove(e,t,i){if(!this._firstTwoTouches)return;e.preventDefault();const[n,r]=this._firstTwoTouches,o=Eo(i,t,n),a=Eo(i,t,r);if(!o||!a)return;const s=this._aroundCenter?null:o.add(a).div(2);return this._move([o,a],s,e)}touchend(e,t,i){if(!this._firstTwoTouches)return;const[n,r]=this._firstTwoTouches,o=Eo(i,t,n),a=Eo(i,t,r);o&&a||(this._active&&u.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&"center"===e.around}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function Eo(e,t,i){for(let n=0;n<e.length;n++)if(e[n].identifier===i)return t[n]}function Co(e,t){return Math.log(e/t)/Math.LN2}class ko extends Mo{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,t){const i=this._distance;if(this._distance=e[0].dist(e[1]),this._active||!(Math.abs(Co(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Co(this._distance,i),pinchAround:t}}}function Io(e,t){return 180*e.angleWith(t)/Math.PI}class zo extends Mo{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(e){this._startVector=this._vector=e[0].sub(e[1]),this._minDiameter=e[0].dist(e[1])}_move(e,t,i){const n=this._vector;if(this._vector=e[0].sub(e[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:Io(this._vector,n),pinchAround:t}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());const t=25/(Math.PI*this._minDiameter)*360,i=Io(e,this._startVector);return Math.abs(i)<t}}function Ao(e){return Math.abs(e.y)>Math.abs(e.x)}class Lo extends Mo{constructor(e){super(),this._currentTouchCount=0,this._map=e}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(e,t,i){super.touchstart(e,t,i),this._currentTouchCount=i.length}_start(e){this._lastPoints=e,Ao(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,t,i){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const n=e[0].sub(this._lastPoints[0]),r=e[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(n,r,i.timeStamp),this._valid?(this._lastPoints=e,this._active=!0,{pitchDelta:(n.y+r.y)/2*-.5}):void 0}gestureBeginsVertically(e,t,i){if(void 0!==this._valid)return this._valid;const n=e.mag()>=2,r=t.mag()>=2;if(!n&&!r)return;if(!n||!r)return void 0===this._firstMove&&(this._firstMove=i),i-this._firstMove<100&&void 0;const o=e.y>0==t.y>0;return Ao(e)&&Ao(t)&&o}}const Do={panStep:100,bearingStep:15,pitchStep:10};class Ro{constructor(e){this._tr=new uo(e);const t=Do;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let t=0,i=0,n=0,r=0,o=0;switch(e.keyCode){case 61:case 107:case 171:case 187:t=1;break;case 189:case 109:case 173:t=-1;break;case 37:e.shiftKey?i=-1:(e.preventDefault(),r=-1);break;case 39:e.shiftKey?i=1:(e.preventDefault(),r=1);break;case 38:e.shiftKey?n=1:(e.preventDefault(),o=-1);break;case 40:e.shiftKey?n=-1:(e.preventDefault(),o=1);break;default:return}return this._rotationDisabled&&(i=0,n=0),{cameraAnimation:a=>{const s=this._tr;a.easeTo({duration:300,easeId:"keyboardHandler",easing:Fo,zoom:t?Math.round(s.zoom)+t*(e.shiftKey?2:1):s.zoom,bearing:s.bearing+i*this._bearingStep,pitch:s.pitch+n*this._pitchStep,offset:[-r*this._panStep,-o*this._panStep],center:s.center},{originalEvent:e})}}}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 Fo(e){return e*(2-e)}const Bo=4.000244140625,Oo=1/450;class No{constructor(e,t){this._onTimeout=e=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(e)},this._map=e,this._tr=new uo(e),this._triggerRenderFrame=t,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=Oo}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return!!this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&"center"===e.around)}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(e){return!!this._map.cooperativeGestures.isEnabled()&&!(e.ctrlKey||this._map.cooperativeGestures.isBypassed(e))}wheel(e){if(!this.isEnabled())return;if(this._shouldBePrevented(e))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",e);let t=e.deltaMode===WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY;const i=c(),n=i-(this._lastWheelEventTime||0);this._lastWheelEventTime=i,0!==t&&t%Bo==0?this._type="wheel":0!==t&&Math.abs(t)<4?this._type="trackpad":n>400?(this._type=null,this._lastValue=t,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(n*t)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,t+=this._lastValue)),e.shiftKey&&t&&(t/=4),this._type&&(this._lastWheelEvent=e,this._delta-=t,this._active||this._start(e)),e.preventDefault()}_start(e){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 i=u.mousePos(this._map.getCanvas(),e),n=this._tr;this._aroundPoint=this._aroundCenter?n.transform.locationToScreenPoint(t.V.convert(n.center)):i,this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId)return;if(this._frameId=null,!this.isActive())return;const e=this._tr.transform;if("number"==typeof this._lastExpectedZoom){const t=e.zoom-this._lastExpectedZoom;"number"==typeof this._startZoom&&(this._startZoom+=t),"number"==typeof this._targetZoom&&(this._targetZoom+=t)}if(0!==this._delta){const i="wheel"===this._type&&Math.abs(this._delta)>Bo?this._wheelZoomRate:this._defaultZoomRate;let n=2/(1+Math.exp(-Math.abs(this._delta*i)));this._delta<0&&0!==n&&(n=1/n);const r="number"!=typeof this._targetZoom?e.scale:t.aq(this._targetZoom);this._targetZoom=e.applyConstrain(e.getCameraLngLat(),t.at(r*n)).zoom,"wheel"===this._type&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const i="number"!=typeof this._targetZoom?e.zoom:this._targetZoom,n=this._startZoom,r=this._easing;let o,a=!1;if("wheel"===this._type&&n&&r){const e=c()-this._lastWheelEventTime,s=Math.min((e+5)/200,1),l=r(s);o=t.G.number(n,i,l),s<1?this._frameId||(this._frameId=!0):a=!0}else o=i,a=!0;return this._active=!0,a&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout},200)),this._lastExpectedZoom=o,{noInertia:!0,needsRenderFrame:!a,zoomDelta:o-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let i=t.cy;if(this._prevEase){const e=this._prevEase,n=(c()-e.start)/e.duration,r=e.easing(n+.01)-e.easing(n),o=.27/Math.sqrt(r*r+1e-4)*.01,a=Math.sqrt(.0729-o*o);i=t.cw(o,a,.25,1)}return this._prevEase={start:c(),duration:e,easing:i},i}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class jo{constructor(e,t){this._clickZoom=e,this._tapZoom=t}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 Vo{constructor(e){this._tr=new uo(e),this.reset()}reset(){this._active=!1}dblclick(e,t){return e.preventDefault(),{cameraAnimation:i=>{i.easeTo({duration:300,zoom:this._tr.zoom+(e.shiftKey?-1:1),around:this._tr.unproject(t)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Uo{constructor(){this._tap=new mo({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(e,t,i){if(!this._swipePoint)if(this._tapTime){const n=t[0],r=e.timeStamp-this._tapTime<500,o=this._tapPoint.dist(n)<30;r&&o?i.length>0&&(this._swipePoint=n,this._swipeTouch=i[0].identifier):this.reset()}else this._tap.touchstart(e,t,i)}touchmove(e,t,i){if(this._tapTime){if(this._swipePoint){if(i[0].identifier!==this._swipeTouch)return;const n=t[0],r=n.y-this._swipePoint.y;return this._swipePoint=n,e.preventDefault(),this._active=!0,{zoomDelta:r/128}}}else this._tap.touchmove(e,t,i)}touchend(e,t,i){if(this._tapTime)this._swipePoint&&0===i.length&&this.reset();else{const n=this._tap.touchend(e,t,i);n&&(this._tapTime=e.timeStamp,this._tapPoint=n)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Zo{constructor(e,t,i){this._el=e,this._mousePan=t,this._touchPan=i}enable(e){this._inertiaOptions=e||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class Go{constructor(e,t,i,n){this._pitchWithRotate=e.pitchWithRotate,this._rollEnabled=e.rollEnabled,this._mouseRotate=t,this._mousePitch=i,this._mouseRoll=n}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}}class qo{constructor(e,t,i,n){this._el=e,this._touchZoom=t,this._touchRotate=i,this._tapDragZoom=n,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class $o{constructor(e,t){this._bypassKey=-1!==navigator.userAgent.indexOf("Mac")?"metaKey":"ctrlKey",this._map=e,this._options=t,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const e=this._map.getCanvasContainer();e.classList.add("maplibregl-cooperative-gestures"),this._container=u.create("div","maplibregl-cooperative-gesture-screen",e);let t=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");"metaKey"===this._bypassKey&&(t=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const i=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),n=document.createElement("div");n.className="maplibregl-desktop-message",n.textContent=t,this._container.appendChild(n);const r=document.createElement("div");r.className="maplibregl-mobile-message",r.textContent=i,this._container.appendChild(r),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(u.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(e){return e[this._bypassKey]}notifyGestureBlocked(e,i){this._enabled&&(this._map.fire(new t.l("cooperativegestureprevented",{gestureType:e,originalEvent:i})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const Wo=e=>e.zoom||e.drag||e.roll||e.pitch||e.rotate;class Ho extends t.l{}function Xo(e){return e.panDelta&&e.panDelta.mag()||e.zoomDelta||e.bearingDelta||e.pitchDelta||e.rollDelta}class Yo{constructor(e,i){this.handleWindowEvent=e=>{this.handleEvent(e,`${e.type}Window`)},this.handleEvent=(e,i)=>{if("blur"===e.type)return void this.stop(!0);this._updatingCamera=!0;const n="renderFrame"===e.type?void 0:e,r={needsRenderFrame:!1},o={},a={};for(const{handlerName:c,handler:h,allowed:d}of this._handlers){if(!h.isEnabled())continue;let s;if(this._blockedByActive(a,d,c))h.reset();else if(h[i||e.type]){if(t.cz(e,i||e.type)){const t=u.mousePos(this._map.getCanvas(),e);s=h[i||e.type](e,t)}else if(t.cA(e,i||e.type)){const t=this._getMapTouches(e.touches),n=u.touchPos(this._map.getCanvas(),t);s=h[i||e.type](e,n,t)}else t.cB(i||e.type)||(s=h[i||e.type](e));this.mergeHandlerResult(r,o,s,c,n),s&&s.needsRenderFrame&&this._triggerRenderFrame()}(s||h.isActive())&&(a[c]=h)}const s={};for(const t in this._previousActiveHandlers)a[t]||(s[t]=n);this._previousActiveHandlers=a,(Object.keys(s).length||Xo(r))&&(this._changes.push([r,o,s]),this._triggerRenderFrame()),(Object.keys(a).length||Xo(r))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:l}=r;l&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],l(this._map))},this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new io(e),this._bearingSnap=i.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(i);const n=this._el;this._listeners=[[n,"touchstart",{passive:!0}],[n,"touchmove",{passive:!1}],[n,"touchend",void 0],[n,"touchcancel",void 0],[n,"mousedown",void 0],[n,"mousemove",void 0],[n,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[n,"mouseover",void 0],[n,"mouseout",void 0],[n,"dblclick",void 0],[n,"click",void 0],[n,"keydown",{capture:!1}],[n,"keyup",void 0],[n,"wheel",{passive:!1}],[n,"contextmenu",void 0],[window,"blur",void 0]];for(const[t,r,o]of this._listeners)u.addEventListener(t,r,t===document?this.handleWindowEvent:this.handleEvent,o)}destroy(){for(const[e,t,i]of this._listeners)u.removeEventListener(e,t,e===document?this.handleWindowEvent:this.handleEvent,i)}_addDefaultHandlers(e){const i=this._map,n=i.getCanvasContainer();this._add("mapEvent",new lo(i,e));const r=i.boxZoom=new ho(i,e);this._add("boxZoom",r),e.interactive&&e.boxZoom&&r.enable();const o=i.cooperativeGestures=new $o(i,e.cooperativeGestures);this._add("cooperativeGestures",o),e.cooperativeGestures&&o.enable();const a=new go(i),s=new Vo(i);i.doubleClickZoom=new jo(s,a),this._add("tapZoom",a),this._add("clickZoom",s),e.interactive&&e.doubleClickZoom&&i.doubleClickZoom.enable();const l=new Uo;this._add("tapDragZoom",l);const c=i.touchPitch=new Lo(i);this._add("touchPitch",c),e.interactive&&e.touchPitch&&i.touchPitch.enable(e.touchPitch);const h=()=>i.project(i.getCenter()),d=function({enable:e,clickTolerance:i,aroundCenter:n=!0,minPixelCenterThreshold:r=100,rotateDegreesPerPixelMoved:o=.8},a){const s=new bo({checkCorrectEvent:e=>0===u.mouseButton(e)&&e.ctrlKey||2===u.mouseButton(e)&&!e.ctrlKey});return new _o({clickTolerance:i,move:(e,i)=>{const s=a();if(n&&Math.abs(s.y-e.y)>r)return{bearingDelta:t.cx(new t.P(e.x,i.y),i,s)};let l=(i.x-e.x)*o;return n&&i.y<s.y&&(l=-l),{bearingDelta:l}},moveStateManager:s,enable:e,assignEvents:So})}(e,h),p=function({enable:e,clickTolerance:t,pitchDegreesPerPixelMoved:i=-.5}){const n=new bo({checkCorrectEvent:e=>0===u.mouseButton(e)&&e.ctrlKey||2===u.mouseButton(e)});return new _o({clickTolerance:t,move:(e,t)=>({pitchDelta:(t.y-e.y)*i}),moveStateManager:n,enable:e,assignEvents:So})}(e),f=function({enable:e,clickTolerance:t,rollDegreesPerPixelMoved:i=.3},n){const r=new bo({checkCorrectEvent:e=>2===u.mouseButton(e)&&e.ctrlKey});return new _o({clickTolerance:t,move:(e,t)=>{const r=n();let o=(t.x-e.x)*i;return t.y<r.y&&(o=-o),{rollDelta:o}},moveStateManager:r,enable:e,assignEvents:So})}(e,h);i.dragRotate=new Go(e,d,p,f),this._add("mouseRotate",d,["mousePitch"]),this._add("mousePitch",p,["mouseRotate","mouseRoll"]),this._add("mouseRoll",f,["mousePitch"]),e.interactive&&e.dragRotate&&i.dragRotate.enable();const m=function({enable:e,clickTolerance:t}){const i=new bo({checkCorrectEvent:e=>0===u.mouseButton(e)&&!e.ctrlKey});return new _o({clickTolerance:t,move:(e,t)=>({around:t,panDelta:t.sub(e)}),activateOnStart:!0,moveStateManager:i,enable:e,assignEvents:So})}(e),g=new Po(e,i);i.dragPan=new Zo(n,m,g),this._add("mousePan",m),this._add("touchPan",g,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&i.dragPan.enable(e.dragPan);const _=new zo,y=new ko;i.touchZoomRotate=new qo(n,y,_,l),this._add("touchRotate",_,["touchPan","touchZoom"]),this._add("touchZoom",y,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&i.touchZoomRotate.enable(e.touchZoomRotate),this._add("blockableMapEvent",new co(i));const v=i.scrollZoom=new No(i,()=>this._triggerRenderFrame());this._add("scrollZoom",v,["mousePan"]),e.interactive&&e.scrollZoom&&i.scrollZoom.enable(e.scrollZoom);const x=i.keyboard=new Ro(i);this._add("keyboard",x),e.interactive&&e.keyboard&&i.keyboard.enable()}_add(e,t,i){this._handlers.push({handlerName:e,handler:t,allowed:i}),this._handlersById[e]=t}stop(e){if(!this._updatingCamera){for(const{handler:e}of this._handlers)e.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}isActive(){for(const{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return Boolean(Wo(this._eventsInProgress))||this.isZooming()}_blockedByActive(e,t,i){for(const n in e)if(n!==i&&(!t||t.indexOf(n)<0))return!0;return!1}_getMapTouches(e){const t=[];for(const i of e)this._el.contains(i.target)&&t.push(i);return t}mergeHandlerResult(e,i,n,r,o){if(!n)return;t.e(e,n);const a={handlerName:r,originalEvent:n.originalEvent||o};void 0!==n.zoomDelta&&(i.zoom=a),void 0!==n.panDelta&&(i.drag=a),void 0!==n.rollDelta&&(i.roll=a),void 0!==n.pitchDelta&&(i.pitch=a),void 0!==n.bearingDelta&&(i.rotate=a)}_applyChanges(){const e={},i={},n={};for(const[r,o,a]of this._changes)r.panDelta&&(e.panDelta=(e.panDelta||new t.P(0,0))._add(r.panDelta)),r.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+r.zoomDelta),r.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+r.bearingDelta),r.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+r.pitchDelta),r.rollDelta&&(e.rollDelta=(e.rollDelta||0)+r.rollDelta),void 0!==r.around&&(e.around=r.around),void 0!==r.pinchAround&&(e.pinchAround=r.pinchAround),r.noInertia&&(e.noInertia=r.noInertia),t.e(i,o),t.e(n,a);this._updateMapTransform(e,i,n),this._changes=[]}_updateMapTransform(e,t,i){const n=this._map,r=n._getTransformForUpdate(),o=n.terrain;if(!(Xo(e)||o&&this._terrainMovement))return this._fireEvents(t,i,!0);n._stop(!0);let{panDelta:a,zoomDelta:s,bearingDelta:l,pitchDelta:c,rollDelta:u,around:h,pinchAround:d}=e;void 0!==d&&(h=d),h=h||n.transform.centerPoint,o&&!r.isPointOnMapSurface(h)&&(h=r.centerPoint);const p={panDelta:a,zoomDelta:s,rollDelta:u,pitchDelta:c,bearingDelta:l,around:h};this._map.cameraHelper.useGlobeControls&&!r.isPointOnMapSurface(h)&&(h=r.centerPoint);const f=h.distSqr(r.centerPoint)<.01?r.center:r.screenPointToLocation(a?h.sub(a):h);this._handleMapControls({terrain:o,tr:r,deltasForHelper:p,preZoomAroundLoc:f,combinedEventsInProgress:t,panDelta:a}),n._applyUpdatedTransform(r),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(t,i,!0)}_handleMapControls({terrain:e,tr:t,deltasForHelper:i,preZoomAroundLoc:n,combinedEventsInProgress:r,panDelta:o}){const a=this._map.cameraHelper;if(a.handleMapControlsRollPitchBearingZoom(i,t),e)return a.useGlobeControls?(this._terrainMovement||!r.drag&&!r.zoom||(this._terrainMovement=!0,this._map._elevationFreeze=!0),void a.handleMapControlsPan(i,t,n)):this._terrainMovement||!r.drag&&!r.zoom?void(r.drag&&this._terrainMovement&&o?t.setCenter(t.screenPointToLocation(t.centerPoint.sub(o))):a.handleMapControlsPan(i,t,n)):(this._terrainMovement=!0,this._map._elevationFreeze=!0,void a.handleMapControlsPan(i,t,n));a.handleMapControlsPan(i,t,n)}_fireEvents(e,i,n){const r=Wo(this._eventsInProgress),o=Wo(e),a={};for(const t in e){const{originalEvent:i}=e[t];this._eventsInProgress[t]||(a[`${t}start`]=i),this._eventsInProgress[t]=e[t]}!r&&o&&this._fireEvent("movestart",o.originalEvent);for(const t in a)this._fireEvent(t,a[t]);o&&this._fireEvent("move",o.originalEvent);for(const t in e){const{originalEvent:i}=e[t];this._fireEvent(t,i)}const l={};let c;for(const t in this._eventsInProgress){const{handlerName:e,originalEvent:n}=this._eventsInProgress[t];this._handlersById[e].isActive()||(delete this._eventsInProgress[t],c=i[e]||n,l[`${t}end`]=c)}for(const t in l)this._fireEvent(t,l[t]);const u=Wo(this._eventsInProgress),h=(r||o)&&!u;if(h&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const e=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&e.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(e)}if(n&&h){this._updatingCamera=!0;const e=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),i=e=>0!==e&&-this._bearingSnap<e&&e<this._bearingSnap;!e||!e.essential&&s.prefersReducedMotion?(this._map.fire(new t.l("moveend",{originalEvent:c})),i(this._map.getBearing())&&this._map.resetNorth()):(i(e.bearing||this._map.getBearing())&&(e.bearing=0),e.freezeElevation=!0,this._map.easeTo(e,{originalEvent:c})),this._updatingCamera=!1}}_fireEvent(e,i){this._map.fire(new t.l(e,i?{originalEvent:i}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(e=>{delete this._frameId,this.handleEvent(new Ho("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}class Ko extends t.E{constructor(e,t,i){super(),this._renderFrameCallback=()=>{const e=Math.min((c()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(e)),e<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=i.bearingSnap,this.cameraHelper=t,this.on("moveend",()=>{delete this._requestedCameraState})}migrateProjection(e,t){e.apply(this.transform,!0),this.transform=e,this.cameraHelper=t}getCenter(){return new t.V(this.transform.center.lng,this.transform.center.lat)}setCenter(e,t){return this.jumpTo({center:e},t)}getCenterElevation(){return this.transform.elevation}setCenterElevation(e,t){return this.jumpTo({elevation:e},t),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(e){this._centerClampedToGround=e}panBy(e,i,n){return e=t.P.convert(e).mult(-1),this.panTo(this.transform.center,t.e({offset:e},i),n)}panTo(e,i,n){return this.easeTo(t.e({center:e},i),n)}getZoom(){return this.transform.zoom}setZoom(e,t){return this.jumpTo({zoom:e},t),this}zoomTo(e,i,n){return this.easeTo(t.e({zoom:e},i),n)}zoomIn(e,t){return this.zoomTo(this.getZoom()+1,e,t),this}zoomOut(e,t){return this.zoomTo(this.getZoom()-1,e,t),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(e,i){return e!=this.transform.fov&&(this.transform.setFov(e),this.fire(new t.l("movestart",i)).fire(new t.l("move",i)).fire(new t.l("moveend",i))),this}getBearing(){return this.transform.bearing}setBearing(e,t){return this.jumpTo({bearing:e},t),this}getPadding(){return this.transform.padding}setPadding(e,t){return this.jumpTo({padding:e},t),this}rotateTo(e,i,n){return this.easeTo(t.e({bearing:e},i),n)}resetNorth(e,i){return this.rotateTo(0,t.e({duration:1e3},e),i),this}resetNorthPitch(e,i){return this.easeTo(t.e({bearing:0,pitch:0,roll:0,duration:1e3},e),i),this}snapToNorth(e,t){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,t):this}getPitch(){return this.transform.pitch}setPitch(e,t){return this.jumpTo({pitch:e},t),this}getRoll(){return this.transform.roll}setRoll(e,t){return this.jumpTo({roll:e},t),this}cameraForBounds(e,t){e=W.convert(e).adjustAntiMeridian();const i=t&&t.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),i,t)}_cameraForBoxAndBearing(e,i,n,r){const o={top:0,bottom:0,right:0,left:0};if("number"==typeof(r=t.e({padding:o,offset:[0,0],maxZoom:this.transform.maxZoom},r)).padding){const e=r.padding;r.padding={top:e,bottom:e,right:e,left:e}}const a=t.e(o,r.padding);r.padding=a;const s=this.transform,l=new W(e,i);return this.cameraHelper.cameraForBoxAndBearing(r,a,l,n,s)}fitBounds(e,t,i){return this._fitInternal(this.cameraForBounds(e,t),t,i)}fitScreenCoordinates(e,i,n,r,o){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(t.P.convert(e)),this.transform.screenPointToLocation(t.P.convert(i)),n,r),r,o)}_fitInternal(e,i,n){return e?(delete(i=t.e(e,i)).padding,i.linear?this.easeTo(i,n):this.flyTo(i,n)):this}jumpTo(e,i){this.stop();const n=this._getTransformForUpdate();let r=!1,o=!1,a=!1;const s=n.zoom;this.cameraHelper.handleJumpToCenterZoom(n,e);const l=n.zoom!==s;return"elevation"in e&&n.elevation!==+e.elevation&&n.setElevation(+e.elevation),"bearing"in e&&n.bearing!==+e.bearing&&(r=!0,n.setBearing(+e.bearing)),"pitch"in e&&n.pitch!==+e.pitch&&(o=!0,n.setPitch(+e.pitch)),"roll"in e&&n.roll!==+e.roll&&(a=!0,n.setRoll(+e.roll)),null==e.padding||n.isPaddingEqual(e.padding)||n.setPadding(e.padding),this._applyUpdatedTransform(n),this.fire(new t.l("movestart",i)).fire(new t.l("move",i)),l&&this.fire(new t.l("zoomstart",i)).fire(new t.l("zoom",i)).fire(new t.l("zoomend",i)),r&&this.fire(new t.l("rotatestart",i)).fire(new t.l("rotate",i)).fire(new t.l("rotateend",i)),o&&this.fire(new t.l("pitchstart",i)).fire(new t.l("pitch",i)).fire(new t.l("pitchend",i)),a&&this.fire(new t.l("rollstart",i)).fire(new t.l("roll",i)).fire(new t.l("rollend",i)),this.fire(new t.l("moveend",i))}calculateCameraOptionsFromTo(e,i,n,r=0){const o=t.a9.fromLngLat(e,i),a=t.a9.fromLngLat(n,r),s=a.x-o.x,l=a.y-o.y,c=a.z-o.z,u=Math.hypot(s,l,c);if(0===u)throw new Error("Can't calculate camera options with same From and To");const h=Math.hypot(s,l),d=t.at(this.transform.cameraToCenterDistance/u/this.transform.tileSize),p=180*Math.atan2(s,-l)/Math.PI;let f=180*Math.acos(h/u)/Math.PI;return f=c<0?90-f:90+f,{center:a.toLngLat(),elevation:r,zoom:d,pitch:f,bearing:p}}calculateCameraOptionsFromCameraLngLatAltRotation(e,t,i,n,r){const o=this.transform.calculateCenterFromCameraLngLatAlt(e,t,i,n);return{center:o.center,elevation:o.elevation,zoom:o.zoom,bearing:i,pitch:n,roll:r}}easeTo(e,i){this._stop(!1,e.easeId),(!1===(e=t.e({offset:[0,0],duration:500,easing:t.cy},e)).animate||!e.essential&&s.prefersReducedMotion)&&(e.duration=0);const n=this._getTransformForUpdate(),r=this.getBearing(),o=n.pitch,a=n.roll,l="bearing"in e?this._normalizeBearing(e.bearing,r):r,c="pitch"in e?+e.pitch:o,u="roll"in e?this._normalizeBearing(e.roll,a):a,h="padding"in e?e.padding:n.padding,d=t.P.convert(e.offset);let p,f;e.around&&(p=t.V.convert(e.around),f=n.locationToScreenPoint(p));const m={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},g=this.cameraHelper.handleEaseTo(n,{bearing:l,pitch:c,roll:u,padding:h,around:p,aroundPoint:f,offsetAsPoint:d,offset:e.offset,zoom:e.zoom,center:e.center});return this._rotating=this._rotating||r!==l,this._pitching=this._pitching||c!==o,this._rolling=this._rolling||u!==a,this._padding=!n.isPaddingEqual(h),this._zooming=this._zooming||g.isZooming,this._easeId=e.easeId,this._prepareEase(i,e.noMoveStart,m),this.terrain&&this._prepareElevation(g.elevationCenter),this._ease(t=>{g.easeFunc(t),this.terrain&&!e.freezeElevation&&this._updateElevation(t),this._applyUpdatedTransform(n),this._fireMoveEvents(i)},t=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(i,t)},e),this}_prepareEase(e,i,n={}){this._moving=!0,i||n.moving||this.fire(new t.l("movestart",e)),this._zooming&&!n.zooming&&this.fire(new t.l("zoomstart",e)),this._rotating&&!n.rotating&&this.fire(new t.l("rotatestart",e)),this._pitching&&!n.pitching&&this.fire(new t.l("pitchstart",e)),this._rolling&&!n.rolling&&this.fire(new t.l("rollstart",e))}_prepareElevation(e){this._elevationCenter=e,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(e,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(e){void 0!==this._elevationStart&&void 0!==this._elevationCenter||this._prepareElevation(this.transform.center),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));const i=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(e<1&&i!==this._elevationTarget){const t=this._elevationTarget-this._elevationStart;this._elevationStart+=e*(t-(i-(t*e+this._elevationStart))/(1-e)),this._elevationTarget=i}this.transform.setElevation(t.G.number(this._elevationStart,this._elevationTarget,e))}_finalizeElevation(){this._elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(e){if(!this.terrain&&e.elevation>=0&&e.pitch<=90)return{};const t=e.getCameraLngLat(),i=e.getCameraAltitude(),n=this.terrain?this.terrain.getElevationForLngLatZoom(t,e.zoom):0;if(i<n){const i=this.calculateCameraOptionsFromTo(t,n,e.center,e.elevation);return{pitch:i.pitch,zoom:i.zoom}}return{}}_applyUpdatedTransform(e){const t=[];if(t.push(e=>this._elevateCameraIfInsideTerrain(e)),this.transformCameraUpdate&&t.push(e=>this.transformCameraUpdate(e)),!t.length)return;const i=e.clone();for(const n of t){const e=i.clone(),{center:t,zoom:r,roll:o,pitch:a,bearing:s,elevation:l}=n(e);t&&e.setCenter(t),void 0!==l&&e.setElevation(l),void 0!==r&&e.setZoom(r),void 0!==o&&e.setRoll(o),void 0!==a&&e.setPitch(a),void 0!==s&&e.setBearing(s),i.apply(e,!1)}this.transform.apply(i,!1)}_fireMoveEvents(e){this.fire(new t.l("move",e)),this._zooming&&this.fire(new t.l("zoom",e)),this._rotating&&this.fire(new t.l("rotate",e)),this._pitching&&this.fire(new t.l("pitch",e)),this._rolling&&this.fire(new t.l("roll",e))}_afterEase(e,i){if(this._easeId&&i&&this._easeId===i)return;delete this._easeId;const n=this._zooming,r=this._rotating,o=this._pitching,a=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,n&&this.fire(new t.l("zoomend",e)),r&&this.fire(new t.l("rotateend",e)),o&&this.fire(new t.l("pitchend",e)),a&&this.fire(new t.l("rollend",e)),this.fire(new t.l("moveend",e))}flyTo(e,i){if(!e.essential&&s.prefersReducedMotion){const n=t.U(e,["center","zoom","bearing","pitch","roll","elevation","padding"]);return this.jumpTo(n,i)}this.stop(),e=t.e({offset:[0,0],speed:1.2,curve:1.42,easing:t.cy},e);const n=this._getTransformForUpdate(),r=n.bearing,o=n.pitch,a=n.roll,l=n.padding,c="bearing"in e?this._normalizeBearing(e.bearing,r):r,u="pitch"in e?+e.pitch:o,h="roll"in e?this._normalizeBearing(e.roll,a):a,d="padding"in e?e.padding:n.padding,p=t.P.convert(e.offset);let f=n.centerPoint.add(p);const m=n.screenPointToLocation(f),g=this.cameraHelper.handleFlyTo(n,{bearing:c,pitch:u,roll:h,padding:d,locationAtOffset:m,offsetAsPoint:p,center:e.center,minZoom:e.minZoom,zoom:e.zoom});let _=e.curve;const y=Math.max(n.width,n.height),v=y/g.scaleOfZoom,x=g.pixelPathLength;"number"==typeof g.scaleOfMinZoom&&(_=Math.sqrt(y/g.scaleOfMinZoom/x*2));const b=_*_;function w(e){const t=(v*v-y*y+(e?-1:1)*b*b*x*x)/(2*(e?v:y)*b*x);return Math.log(Math.sqrt(t*t+1)-t)}function T(e){return(Math.exp(e)-Math.exp(-e))/2}function S(e){return(Math.exp(e)+Math.exp(-e))/2}const P=w(!1);let M=function(e){return S(P)/S(P+_*e)},E=function(e){return y*((S(P)*(T(t=P+_*e)/S(t))-T(P))/b)/x;var t},C=(w(!0)-P)/_;if(Math.abs(x)<2e-6||!isFinite(C)){if(Math.abs(y-v)<1e-6)return this.easeTo(e,i);const t=v<y?-1:1;C=Math.abs(Math.log(v/y))/_,E=()=>0,M=e=>Math.exp(t*_*e)}return e.duration="duration"in e?+e.duration:1e3*C/("screenSpeed"in e?+e.screenSpeed/_:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=r!==c,this._pitching=u!==o,this._rolling=h!==a,this._padding=!n.isPaddingEqual(d),this._prepareEase(i,!1),this.terrain&&this._prepareElevation(g.targetCenter),this._ease(s=>{const m=s*C,_=1/M(m),y=E(m);this._rotating&&n.setBearing(t.G.number(r,c,s)),this._pitching&&n.setPitch(t.G.number(o,u,s)),this._rolling&&n.setRoll(t.G.number(a,h,s)),this._padding&&(n.interpolatePadding(l,d,s),f=n.centerPoint.add(p)),g.easeFunc(s,_,y,f),this.terrain&&!e.freezeElevation&&this._updateElevation(s),this._applyUpdatedTransform(n),this._fireMoveEvents(i)},()=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(i)},e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,t){var i;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const e=this._onEaseEnd;delete this._onEaseEnd,e.call(this,t)}return e||null===(i=this.handlers)||void 0===i||i.stop(!1),this}_ease(e,t,i){!1===i.animate||0===i.duration?(e(1),t()):(this._easeStart=c(),this._easeOptions=i,this._onEaseFrame=e,this._onEaseEnd=t,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,i){e=t.W(e,-180,180);const n=Math.abs(e-i);return Math.abs(e-360-i)<n&&(e-=360),Math.abs(e+360-i)<n&&(e+=360),e}queryTerrainElevation(e){return this.terrain?this.terrain.getElevationForLngLat(t.V.convert(e),this.transform):null}}const Qo={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class Jo{constructor(e=Qo){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=e=>{!e||"metadata"!==e.sourceDataType&&"visibility"!==e.sourceDataType&&"style"!==e.dataType&&"terrain"!==e.type||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1===this._compact?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=e}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=this.options.compact,this._container=u.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=u.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=u.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){u.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(e,t){const i=this._map._getUIString(`AttributionControl.${t}`);e.title=i,e.setAttribute("aria-label",i)}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map(e=>"string"!=typeof e?"":e)):"string"==typeof this.options.customAttribution&&e.push(this.options.customAttribution)),this._map.style.stylesheet){const e=this._map.style.stylesheet;this.styleOwner=e.owner,this.styleId=e.id}const t=this._map.style.tileManagers;for(const n in t){const i=t[n];if(i.used||i.usedForTerrain){const t=i.getSource();t.attribution&&e.indexOf(t.attribution)<0&&e.push(t.attribution)}}e=e.filter(e=>String(e).trim()),e.sort((e,t)=>e.length-t.length),e=e.filter((t,i)=>{for(let n=i+1;n<e.length;n++)if(e[n].indexOf(t)>=0)return!1;return!0});const i=e.join(" | ");i!==this._attribHTML&&(this._attribHTML=i,e.length?(this._innerContainer.innerHTML=u.sanitize(i),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class ea{constructor(e={}){this._updateCompact=()=>{const e=this._container.children;if(e.length){const t=e[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1!==this._compact&&t.classList.add("maplibregl-compact"):t.classList.remove("maplibregl-compact")}},this.options=e}getDefaultPosition(){return"bottom-left"}onAdd(e){this._map=e,this._compact=this.options&&this.options.compact,this._container=u.create("div","maplibregl-ctrl");const t=u.create("a","maplibregl-ctrl-logo");return t.target="_blank",t.rel="noopener nofollow",t.href="https://maplibre.org/",t.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),t.setAttribute("rel","noopener nofollow"),this._container.appendChild(t),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){u.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class ta{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){const t=++this._id;return this._queue.push({callback:e,id:t,cancelled:!1}),t}remove(e){const t=this._currentlyRunning,i=t?this._queue.concat(t):this._queue;for(const n of i)if(n.id===e)return void(n.cancelled=!0)}run(e=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const t=this._currentlyRunning=this._queue;this._queue=[];for(const i of t)if(!i.cancelled&&(i.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var ia=t.aU([{name:"a_pos3d",type:"Int16",components:3}]);class na extends t.E{constructor(e){super(),this._lastTilesetChange=c(),this.tileManager=e,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=e._source.tileSize*2**this.deltaZoom,e.usedForTerrain=!0,e.tileSize=this.tileSize}destruct(){this.tileManager.usedForTerrain=!1,this.tileManager.tileSize=null}getSource(){return this.tileManager._source}update(e,i){this.tileManager.update(e,i),this._renderableTilesKeys=[];const n={};for(const r of Ee(e,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:i,calculateTileZoom:this.tileManager._source.calculateTileZoom}))n[r.key]=!0,this._renderableTilesKeys.push(r.key),this._tiles[r.key]||(r.terrainRttPosMatrix32f=new Float64Array(16),t.c7(r.terrainRttPosMatrix32f,0,t.a5,t.a5,0,0,1),this._tiles[r.key]=new pe(r,this.tileSize),this._lastTilesetChange=c());for(const t in this._tiles)n[t]||delete this._tiles[t]}freeRtt(e){for(const t in this._tiles){const i=this._tiles[t];(!e||i.tileID.equals(e)||i.tileID.isChildOf(e)||e.isChildOf(i.tileID))&&(i.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(e=>this.getTileByID(e))}getTileByID(e){return this._tiles[e]}getTerrainCoords(e,t){return t?this._getTerrainCoordsForTileRanges(e,t):this._getTerrainCoordsForRegularTile(e)}_getTerrainCoordsForRegularTile(e){const i={};for(const n of this._renderableTilesKeys){const r=this._tiles[n].tileID,o=e.clone(),a=t.bk();if(r.canonical.equals(e.canonical))t.c7(a,0,t.a5,t.a5,0,0,1);else if(r.canonical.isChildOf(e.canonical)){const i=r.canonical.z-e.canonical.z,n=r.canonical.x-(r.canonical.x>>i<<i),o=r.canonical.y-(r.canonical.y>>i<<i),s=t.a5>>i;t.c7(a,0,s,s,0,0,1),t.O(a,a,[-n*s,-o*s,0])}else{if(!e.canonical.isChildOf(r.canonical))continue;{const i=e.canonical.z-r.canonical.z,n=e.canonical.x-(e.canonical.x>>i<<i),o=e.canonical.y-(e.canonical.y>>i<<i),s=t.a5>>i;t.c7(a,0,t.a5,t.a5,0,0,1),t.O(a,a,[n*s,o*s,0]),t.Q(a,a,[1/2**i,1/2**i,0])}}o.terrainRttPosMatrix32f=new Float32Array(a),i[n]=o}return i}_getTerrainCoordsForTileRanges(e,i){const n={};for(const r of this._renderableTilesKeys){const o=this._tiles[r].tileID;if(!this._isWithinTileRanges(o,i))continue;const a=e.clone(),s=t.bk();if(o.canonical.z===e.canonical.z){const i=e.canonical.x-o.canonical.x+e.wrap*(1<<e.canonical.z),n=e.canonical.y-o.canonical.y;t.c7(s,0,t.a5,t.a5,0,0,1),t.O(s,s,[i*t.a5,n*t.a5,0])}else if(o.canonical.z>e.canonical.z){const i=o.canonical.z-e.canonical.z,n=o.canonical.x-(o.canonical.x>>i<<i)+e.wrap*(1<<o.canonical.z),r=o.canonical.y-(o.canonical.y>>i<<i),a=e.canonical.x-(o.canonical.x>>i),l=e.canonical.y-(o.canonical.y>>i),c=t.a5>>i;t.c7(s,0,c,c,0,0,1),t.O(s,s,[-n*c+a*t.a5,-r*c+l*t.a5,0])}else{const i=e.canonical.z-o.canonical.z,n=e.canonical.x-(e.canonical.x>>i<<i)+e.wrap*(1<<e.canonical.z),r=e.canonical.y-(e.canonical.y>>i<<i),a=(e.canonical.x>>i)-o.canonical.x,l=(e.canonical.y>>i)-o.canonical.y,c=t.a5<<i;t.c7(s,0,c,c,0,0,1),t.O(s,s,[n*t.a5+a*c,r*t.a5+l*c,0])}a.terrainRttPosMatrix32f=new Float32Array(s),n[r]=a}return n}getSourceTile(e,t){const i=this.tileManager._source;let n=e.overscaledZ-this.deltaZoom;if(n>i.maxzoom&&(n=i.maxzoom),n<i.minzoom)return;this._sourceTileCache[e.key]||(this._sourceTileCache[e.key]=e.scaledTo(n).key);let r=this.findTileInCaches(this._sourceTileCache[e.key]);if(!(null==r?void 0:r.dem)&&t)for(;n>=i.minzoom&&!(null==r?void 0:r.dem);)r=this.findTileInCaches(e.scaledTo(n--).key);return r}findTileInCaches(e){let t=this.tileManager.getTileByID(e);return t||(t=this.tileManager._outOfViewCache.getByKey(e),t)}anyTilesAfterTime(e=Date.now()){return this._lastTilesetChange>=e}_isWithinTileRanges(e,t){const i=t[e.canonical.z];return!!i&&(e.wrap>i.minWrap||e.wrap<i.maxWrap||e.canonical.x>=i.minTileXWrapped&&e.canonical.x<=i.maxTileXWrapped&&e.canonical.y>=i.minTileY&&e.canonical.y<=i.maxTileY)}}class ra{constructor(e,t,i){this._meshCache={},this.painter=e,this.tileManager=new na(t),this.options=i,this.exaggeration="number"==typeof i.exaggeration?i.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(e,i,n,r=t.a5){var o;if(!(i>=0&&i<r&&n>=0&&n<r))return 0;const a=this.getTerrainData(e),s=null===(o=a.tile)||void 0===o?void 0:o.dem;if(!s)return 0;const l=t.cC([],[i/r*t.a5,n/r*t.a5],a.u_terrain_matrix),c=[l[0]*s.dim,l[1]*s.dim],u=Math.floor(c[0]),h=Math.floor(c[1]),d=c[0]-u,p=c[1]-h;return s.get(u,h)*(1-d)*(1-p)+s.get(u+1,h)*d*(1-p)+s.get(u,h+1)*(1-d)*p+s.get(u+1,h+1)*d*p}getElevationForLngLatZoom(e,i){if(!t.cD(i,e.wrap()))return 0;const{tileID:n,mercatorX:r,mercatorY:o}=this._getOverscaledTileIDFromLngLatZoom(e,i);return this.getElevation(n,r%t.a5,o%t.a5,t.a5)}getElevationForLngLat(e,t){const i=Ee(t,{maxzoom:this.tileManager.maxzoom,minzoom:this.tileManager.minzoom,tileSize:512,terrain:this});let n=0;for(const r of i)r.canonical.z>n&&(n=Math.min(r.canonical.z,this.tileManager.maxzoom));return this.getElevationForLngLatZoom(e,n)}getElevation(e,i,n,r=t.a5){return this.getDEMElevation(e,i,n,r)*this.exaggeration}getTerrainData(e){if(!this._emptyDemTexture){const e=this.painter.context,i=new t.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new t.T(e,i,e.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new t.T(e,new t.R({width:1,height:1}),e.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=t.ar([])}const i=this.tileManager.getSourceTile(e,!0);if(i&&i.dem&&(!i.demTexture||i.needsTerrainPrepare)){const e=this.painter.context;i.demTexture=this.painter.getTileTexture(i.dem.stride),i.demTexture?i.demTexture.update(i.dem.getPixels(),{premultiply:!1}):i.demTexture=new t.T(e,i.dem.getPixels(),e.gl.RGBA,{premultiply:!1}),i.demTexture.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),i.needsTerrainPrepare=!1}const n=i&&i.toString()+i.tileID.key+e.key;if(n&&!this._demMatrixCache[n]){const n=this.tileManager.getSource().maxzoom;let r=e.canonical.z-i.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=n?r=e.canonical.z-n:t.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const o=e.canonical.x-(e.canonical.x>>r<<r),a=e.canonical.y-(e.canonical.y>>r<<r),s=t.cE(new Float64Array(16),[1/(t.a5<<r),1/(t.a5<<r),0]);t.O(s,s,[o*t.a5,a*t.a5,0]),this._demMatrixCache[e.key]={matrix:s,coord:e}}return{u_depth:2,u_terrain:3,u_terrain_dim:i&&i.dem&&i.dem.dim||1,u_terrain_matrix:n?this._demMatrixCache[e.key].matrix:this._emptyDemMatrix,u_terrain_unpack:i&&i.dem&&i.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(i&&i.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:i}}getFramebuffer(e){const i=this.painter,n=i.width/devicePixelRatio,r=i.height/devicePixelRatio;return!this._fbo||this._fbo.width===n&&this._fbo.height===r||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new t.T(i.context,{width:n,height:r,data:null},i.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(i.context.gl.NEAREST,i.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new t.T(i.context,{width:n,height:r,data:null},i.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(i.context.gl.NEAREST,i.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=i.context.createFramebuffer(n,r,!0,!1),this._fbo.depthAttachment.set(i.context.createRenderbuffer(i.context.gl.DEPTH_COMPONENT16,n,r))),this._fbo.colorAttachment.set("coords"===e?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const e=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const i=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let t=0,o=0;t<this._coordsTextureSize;t++)for(let e=0;e<this._coordsTextureSize;e++,o+=4)i[o+0]=255&e,i[o+1]=255&t,i[o+2]=e>>8<<4|t>>8,i[o+3]=0;const n=new t.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(i.buffer)),r=new t.T(e,n,e.gl.RGBA,{premultiply:!1});return r.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=r,r}pointCoordinate(e){this.painter.maybeDrawDepthAndCoords(!0);const i=new Uint8Array(4),n=this.painter.context,r=n.gl,o=Math.round(e.x*this.painter.pixelRatio/devicePixelRatio),a=Math.round(e.y*this.painter.pixelRatio/devicePixelRatio),s=Math.round(this.painter.height/devicePixelRatio);n.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),r.readPixels(o,s-a-1,1,1,r.RGBA,r.UNSIGNED_BYTE,i),n.bindFramebuffer.set(null);const l=i[0]+(i[2]>>4<<8),c=i[1]+((15&i[2])<<8),u=this.coordsIndex[255-i[3]],h=u&&this.tileManager.getTileByID(u);if(!h)return null;const d=this._coordsTextureSize,p=(1<<h.tileID.canonical.z)*d;return new t.a9((h.tileID.canonical.x*d+l)/p+h.tileID.wrap,(h.tileID.canonical.y*d+c)/p,this.getElevation(h.tileID,l,c,d))}depthAtPoint(e){const t=new Uint8Array(4),i=this.painter.context,n=i.gl;return i.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),n.readPixels(e.x,this.painter.height/devicePixelRatio-e.y-1,1,1,n.RGBA,n.UNSIGNED_BYTE,t),i.bindFramebuffer.set(null),(t[0]/16777216+t[1]/65536+t[2]/256+t[3])/256}getTerrainMesh(e){var i;const n=(null===(i=this.painter.style.projection)||void 0===i?void 0:i.transitionState)>0,r=n&&0===e.canonical.y,o=n&&e.canonical.y===(1<<e.canonical.z)-1,a=`m_${r?"n":""}_${o?"s":""}`;if(this._meshCache[a])return this._meshCache[a];const s=this.painter.context,l=new t.cF,c=new t.aY,u=this.meshSize,h=t.a5/u,d=u*u;for(let t=0;t<=u;t++)for(let e=0;e<=u;e++)l.emplaceBack(e*h,t*h,0);for(let t=0;t<d;t+=u+1)for(let e=0;e<u;e++)c.emplaceBack(e+t,u+e+t+1,u+e+t+2),c.emplaceBack(e+t,u+e+t+2,e+t+1);const p=l.length,f=p+(u+1),m=(u+1)*u,g=r?t.br:0,_=r?0:1,y=o?t.bs:t.a5,v=o?0:1;for(let t=0;t<=u;t++)l.emplaceBack(t*h,g,_);for(let t=0;t<=u;t++)l.emplaceBack(t*h,y,v);for(let t=0;t<u;t++)c.emplaceBack(m+t,f+t,f+t+1),c.emplaceBack(m+t,f+t+1,m+t+1),c.emplaceBack(0+t,p+t+1,p+t),c.emplaceBack(0+t,0+t+1,p+t+1);const x=l.length,b=x+2*(u+1);for(const T of[0,1])for(let e=0;e<=u;e++)for(const i of[0,1])l.emplaceBack(T*t.a5,e*h,i);for(let t=0;t<2*u;t+=2)c.emplaceBack(x+t,x+t+1,x+t+3),c.emplaceBack(x+t,x+t+3,x+t+2),c.emplaceBack(b+t,b+t+3,b+t+1),c.emplaceBack(b+t,b+t+2,b+t+3);const w=new Ft(s.createVertexBuffer(l,ia.members),s.createIndexBuffer(c),t.aX.simpleSegment(0,0,l.length,c.length));return this._meshCache[a]=w,w}getMeshFrameDelta(e){return 2*Math.PI*t.bE/Math.pow(2,Math.max(e,0))/5}getMinTileElevationForLngLatZoom(e,i){var n;if(!t.cD(i,e.wrap()))return 0;const{tileID:r}=this._getOverscaledTileIDFromLngLatZoom(e,i);return null!==(n=this.getMinMaxElevation(r).minElevation)&&void 0!==n?n:0}getMinMaxElevation(e){const t=this.getTerrainData(e).tile,i={minElevation:null,maxElevation:null};return t&&t.dem&&(i.minElevation=t.dem.min*this.exaggeration,i.maxElevation=t.dem.max*this.exaggeration),i}_getOverscaledTileIDFromLngLatZoom(e,i){const n=t.a9.fromLngLat(e.wrap()),r=(1<<i)*t.a5,o=n.x*r,a=n.y*r,s=Math.floor(o/t.a5),l=Math.floor(a/t.a5);return{tileID:new t.a2(i,0,i,s,l),mercatorX:o,mercatorY:a}}}class oa{constructor(e,t,i){this._context=e,this._size=t,this._tileSize=i,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const e of this._objects)e.texture.destroy(),e.fbo.destroy()}_createObject(e){const i=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),n=new t.T(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return n.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),this._context.extTextureFilterAnisotropic&&this._context.gl.texParameterf(this._context.gl.TEXTURE_2D,this._context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this._context.extTextureFilterAnisotropicMax),i.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),i.colorAttachment.set(n.texture),{id:e,fbo:i,texture:n,stamp:-1,inUse:!1}}getObjectForId(e){return this._objects[e]}useObject(e){e.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(t=>e.id!==t),this._recentlyUsed.push(e.id)}stampObject(e){e.stamp=++this._stamp}getOrCreateFreeObject(){for(const t of this._recentlyUsed)if(!this._objects[t].inUse)return this._objects[t];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const e=this._createObject(this._objects.length);return this._objects.push(e),e}freeObject(e){e.inUse=!1}freeAllObjects(){for(const e of this._objects)this.freeObject(e)}isFull(){return!(this._objects.length<this._size)&&!1===this._objects.some(e=>!e.inUse)}}const aa={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0};class sa{constructor(e,t){this.painter=e,this.terrain=t,this.pool=new oa(e.context,30,t.tileManager.tileSize*t.qualityFactor)}destruct(){this.pool.destruct()}getTexture(e){return this.pool.getObjectForId(e.rtt[this._stacks.length-1].id).texture}prepareForRender(e,t){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.tileManager.getRenderableTiles(),this._renderableLayerIds=e._order.filter(i=>!e._layers[i].isHidden(t)),this._coordsAscending={};for(const i in e.tileManagers){this._coordsAscending[i]={};const t=e.tileManagers[i].getVisibleCoordinates(),n=e.tileManagers[i].getSource(),r=n instanceof te?n.terrainTileRanges:null;for(const e of t){const t=this.terrain.tileManager.getTerrainCoords(e,r);for(const e in t)this._coordsAscending[i][e]||(this._coordsAscending[i][e]=[]),this._coordsAscending[i][e].push(t[e])}}this._coordsAscendingStr={};for(const i of e._order){const t=e._layers[i],n=t.source;if(aa[t.type]&&!this._coordsAscendingStr[n]){this._coordsAscendingStr[n]={};for(const e in this._coordsAscending[n])this._coordsAscendingStr[n][e]=this._coordsAscending[n][e].map(e=>e.key).sort().join()}}for(const i of this._renderableTiles)for(const e in this._coordsAscendingStr){const t=this._coordsAscendingStr[e][i.tileID.key];t&&t!==i.rttCoords[e]&&(i.rtt=[])}}renderLayer(e,i){if(e.isHidden(this.painter.transform.zoom))return!1;const n=Object.assign(Object.assign({},i),{isRenderingToTexture:!0}),r=e.type,o=this.painter,a=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(aa[r]&&(this._prevType&&aa[this._prevType]||this._stacks.push([]),this._prevType=r,this._stacks[this._stacks.length-1].push(e.id),!a))return!0;if(aa[this._prevType]||aa[r]&&a){this._prevType=r;const e=this._stacks.length-1,i=this._stacks[e]||[];for(const r of this._renderableTiles){if(this.pool.isFull()&&(qr(this.painter,this.terrain,this._rttTiles,n),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(r),r.rtt[e]){const t=this.pool.getObjectForId(r.rtt[e].id);if(t.stamp===r.rtt[e].stamp){this.pool.useObject(t);continue}}const a=this.pool.getOrCreateFreeObject();this.pool.useObject(a),this.pool.stampObject(a),r.rtt[e]={id:a.id,stamp:a.stamp},o.context.bindFramebuffer.set(a.fbo.framebuffer),o.context.clear({color:t.bp.transparent,stencil:0}),o.currentStencilSource=void 0;for(let e=0;e<i.length;e++){const t=o.style._layers[i[e]],s=t.source?this._coordsAscending[t.source][r.tileID.key]:[r.tileID];o.context.viewport.set([0,0,a.fbo.width,a.fbo.height]),o._renderTileClippingMasks(t,s,!0),o.renderLayer(o,o.style.tileManagers[t.source],t,s,n),t.source&&(r.rttCoords[t.source]=this._coordsAscendingStr[t.source][r.tileID.key])}}return qr(this.painter,this.terrain,this._rttTiles,n),this._rttTiles=[],this.pool.freeAllObjects(),aa[r]}return!1}}const la={"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":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","GlobeControl.Enable":"Enable globe","GlobeControl.Disable":"Disable globe","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use ⌘ + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},ca=i,ua={hash:!1,interactive:!0,bearingSnap:7,attributionControl:Qo,maplibreLogo:!1,refreshExpiredTiles:!0,canvasContextAttributes:{antialias:!1,preserveDrawingBuffer:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,desynchronized:!1,contextType:void 0},scrollZoom:!0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],elevation:0,zoom:0,bearing:0,pitch:0,roll:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:t.c.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,transformConstrain:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,reduceMotion:void 0,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0,experimentalZoomLevelsToOverscale:void 0},ha={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};class da{constructor(e,i,n=!1){this.mousedown=e=>{this.startMove(e,u.mousePos(this.element,e)),u.addEventListener(window,"mousemove",this.mousemove),u.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=e=>{this.move(e,u.mousePos(this.element,e))},this.mouseup=e=>{this._rotatePitchHandler.dragEnd(e),this.offTemp()},this.touchstart=e=>{1!==e.targetTouches.length?this.reset():(this._startPos=this._lastPos=u.touchPos(this.element,e.targetTouches)[0],this.startMove(e,this._startPos),u.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),u.addEventListener(window,"touchend",this.touchend))},this.touchmove=e=>{1!==e.targetTouches.length?this.reset():(this._lastPos=u.touchPos(this.element,e.targetTouches)[0],this.move(e,this._lastPos))},this.touchend=e=>{0===e.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()},this.reset=()=>{this._rotatePitchHandler.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10,this.element=i;const r=new To;this._rotatePitchHandler=new _o({clickTolerance:3,move:(e,r)=>{const o=i.getBoundingClientRect(),a=new t.P((o.bottom-o.top)/2,(o.right-o.left)/2);return{bearingDelta:t.cx(new t.P(e.x,r.y),r,a),pitchDelta:n?-.5*(r.y-e.y):void 0}},moveStateManager:r,enable:!0,assignEvents:()=>{}}),this.map=e,u.addEventListener(i,"mousedown",this.mousedown),u.addEventListener(i,"touchstart",this.touchstart,{passive:!1}),u.addEventListener(i,"touchcancel",this.reset)}startMove(e,t){this._rotatePitchHandler.dragStart(e,t),u.disableDrag()}move(e,t){const i=this.map,{bearingDelta:n,pitchDelta:r}=this._rotatePitchHandler.dragMove(e,t)||{};n&&i.setBearing(i.getBearing()+n),r&&i.setPitch(i.getPitch()+r)}off(){const e=this.element;u.removeEventListener(e,"mousedown",this.mousedown),u.removeEventListener(e,"touchstart",this.touchstart,{passive:!1}),u.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),u.removeEventListener(window,"touchend",this.touchend),u.removeEventListener(e,"touchcancel",this.reset),this.offTemp()}offTemp(){u.enableDrag(),u.removeEventListener(window,"mousemove",this.mousemove),u.removeEventListener(window,"mouseup",this.mouseup),u.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),u.removeEventListener(window,"touchend",this.touchend)}}let pa;function fa(e,i,n,r=!1){if(r||!n.getCoveringTilesDetailsProvider().allowWorldCopies())return null==e?void 0:e.wrap();const o=new t.V(e.lng,e.lat);if(e=new t.V(e.lng,e.lat),i){const r=new t.V(e.lng-360,e.lat),o=new t.V(e.lng+360,e.lat),a=n.locationToScreenPoint(e).distSqr(i);n.locationToScreenPoint(r).distSqr(i)<a?e=r:n.locationToScreenPoint(o).distSqr(i)<a&&(e=o)}for(;Math.abs(e.lng-n.center.lng)>180;){const t=n.locationToScreenPoint(e);if(t.x>=0&&t.y>=0&&t.x<=n.width&&t.y<=n.height)break;e.lng>n.center.lng?e.lng-=360:e.lng+=360}return e.lng!==o.lng&&n.isPointOnMapSurface(n.locationToScreenPoint(e))?e:o}const ma={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function ga(e,t,i){const n=e.classList;for(const r in ma)n.remove(`maplibregl-${i}-anchor-${r}`);n.add(`maplibregl-${i}-anchor-${t}`)}class _a extends t.E{constructor(e){if(super(),this._onKeyPress=e=>{const t=e.code,i=e.charCode||e.keyCode;"Space"!==t&&"Enter"!==t&&32!==i&&13!==i||this.togglePopup()},this._onMapClick=e=>{const t=e.originalEvent.target,i=this._element;this._popup&&(t===i||i.contains(t))&&this.togglePopup()},this._update=e=>{if(!this._map)return;const t=this._map.loaded()&&!this._map.isMoving();("terrain"===(null==e?void 0:e.type)||"render"===(null==e?void 0:e.type)&&!t)&&this._map.once("render",this._update),this._lngLat=fa(this._lngLat,this._flatPos,this._map.transform),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationToScreenPoint(this._lngLat)._add(this._offset));let i="";"viewport"===this._rotationAlignment||"auto"===this._rotationAlignment?i=`rotateZ(${this._rotation}deg)`:"map"===this._rotationAlignment&&(i=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let n="";"viewport"===this._pitchAlignment||"auto"===this._pitchAlignment?n="rotateX(0deg)":"map"===this._pitchAlignment&&(n=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||e&&"moveend"!==e.type||(this._pos=this._pos.round()),u.setTransform(this._element,`${ma[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${n} ${i}`),s.frameAsync(new AbortController).then(()=>{this._updateOpacity(e&&"moveend"===e.type)}).catch(()=>{})},this._onMove=e=>{if(!this._isDragging){const t=this._clickTolerance||this._map._clickTolerance;this._isDragging=e.point.dist(this._pointerdownPos)>=t}this._isDragging&&(this._pos=e.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new t.l("dragstart"))),this.fire(new t.l("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),"active"===this._state&&this.fire(new t.l("dragend")),this._state="inactive"},this._addDragHandler=e=>{this._element.contains(e.originalEvent.target)&&(e.preventDefault(),this._positionDelta=e.point.sub(this._pos).add(this._offset),this._pointerdownPos=e.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=e&&e.anchor||"center",this._color=e&&e.color||"#3FB1CE",this._scale=e&&e.scale||1,this._draggable=e&&e.draggable||!1,this._clickTolerance=e&&e.clickTolerance||0,this._subpixelPositioning=e&&e.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=e&&e.rotation||0,this._rotationAlignment=e&&e.rotationAlignment||"auto",this._pitchAlignment=e&&e.pitchAlignment&&"auto"!==e.pitchAlignment?e.pitchAlignment:this._rotationAlignment,this.setOpacity(null==e?void 0:e.opacity,null==e?void 0:e.opacityWhenCovered),e&&e.element)this._element=e.element,this._offset=t.P.convert(e&&e.offset||[0,0]);else{this._defaultMarker=!0,this._element=u.create("div");const i=u.createNS("http://www.w3.org/2000/svg","svg"),n=41,r=27;i.setAttributeNS(null,"display","block"),i.setAttributeNS(null,"height",`${n}px`),i.setAttributeNS(null,"width",`${r}px`),i.setAttributeNS(null,"viewBox",`0 0 ${r} ${n}`);const o=u.createNS("http://www.w3.org/2000/svg","g");o.setAttributeNS(null,"stroke","none"),o.setAttributeNS(null,"stroke-width","1"),o.setAttributeNS(null,"fill","none"),o.setAttributeNS(null,"fill-rule","evenodd");const a=u.createNS("http://www.w3.org/2000/svg","g");a.setAttributeNS(null,"fill-rule","nonzero");const s=u.createNS("http://www.w3.org/2000/svg","g");s.setAttributeNS(null,"transform","translate(3.0, 29.0)"),s.setAttributeNS(null,"fill","#000000");const l=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const e of l){const t=u.createNS("http://www.w3.org/2000/svg","ellipse");t.setAttributeNS(null,"opacity","0.04"),t.setAttributeNS(null,"cx","10.5"),t.setAttributeNS(null,"cy","5.80029008"),t.setAttributeNS(null,"rx",e.rx),t.setAttributeNS(null,"ry",e.ry),s.appendChild(t)}const c=u.createNS("http://www.w3.org/2000/svg","g");c.setAttributeNS(null,"fill",this._color);const h=u.createNS("http://www.w3.org/2000/svg","path");h.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),c.appendChild(h);const d=u.createNS("http://www.w3.org/2000/svg","g");d.setAttributeNS(null,"opacity","0.25"),d.setAttributeNS(null,"fill","#000000");const p=u.createNS("http://www.w3.org/2000/svg","path");p.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),d.appendChild(p);const f=u.createNS("http://www.w3.org/2000/svg","g");f.setAttributeNS(null,"transform","translate(6.0, 7.0)"),f.setAttributeNS(null,"fill","#FFFFFF");const m=u.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"transform","translate(8.0, 8.0)");const g=u.createNS("http://www.w3.org/2000/svg","circle");g.setAttributeNS(null,"fill","#000000"),g.setAttributeNS(null,"opacity","0.25"),g.setAttributeNS(null,"cx","5.5"),g.setAttributeNS(null,"cy","5.5"),g.setAttributeNS(null,"r","5.4999962");const _=u.createNS("http://www.w3.org/2000/svg","circle");_.setAttributeNS(null,"fill","#FFFFFF"),_.setAttributeNS(null,"cx","5.5"),_.setAttributeNS(null,"cy","5.5"),_.setAttributeNS(null,"r","5.4999962"),m.appendChild(g),m.appendChild(_),a.appendChild(s),a.appendChild(c),a.appendChild(d),a.appendChild(f),a.appendChild(m),i.appendChild(a),i.setAttributeNS(null,"height",n*this._scale+"px"),i.setAttributeNS(null,"width",r*this._scale+"px"),this._element.appendChild(i),this._offset=t.P.convert(e&&e.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",e=>{e.preventDefault()}),this._element.addEventListener("mousedown",e=>{e.preventDefault()}),ga(this._element,this._anchor,"marker"),e&&e.className)for(const t of e.className.split(" "))this._element.classList.add(t);this._popup=null}addTo(e){return this.remove(),this._map=e,this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label",e._getUIString("Marker.Title")),this._element.hasAttribute("role")||this._element.setAttribute("role","button"),e.getCanvasContainer().appendChild(this._element),e.on("move",this._update),e.on("moveend",this._update),e.on("terrain",this._update),e.on("projectiontransition",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),u.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=t.V.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),e){if(!("offset"in e.options)){const t=38.1,i=13.5,n=Math.abs(i)/Math.SQRT2;e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-t],"bottom-left":[n,-1*(t-i+n)],"bottom-right":[-n,-1*(t-i+n)],left:[i,-1*(t-i)],right:[-i,-1*(t-i)]}:this._offset}this._popup=e,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(e){return this._subpixelPositioning=e,this}getPopup(){return this._popup}togglePopup(){const e=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:e?(e.isOpen()?e.remove():(e.setLngLat(this._lngLat),e.addTo(this._map)),this):this}_updateOpacity(e=!1){var i,n;const r=null===(i=this._map)||void 0===i?void 0:i.terrain,o=this._map.transform.isLocationOccluded(this._lngLat);if(!r||o){const e=o?this._opacityWhenCovered:this._opacity;return void(this._element.style.opacity!==e&&(this._element.style.opacity=e))}if(e)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const a=this._map,s=a.terrain.depthAtPoint(this._pos),l=a.terrain.getElevationForLngLat(this._lngLat,a.transform);if(a.transform.lngLatToCameraDepth(this._lngLat,l)-s<.006)return void(this._element.style.opacity=this._opacity);const c=-this._offset.y/a.transform.pixelsPerMeter,u=Math.sin(a.getPitch()*Math.PI/180)*c,h=a.terrain.depthAtPoint(new t.P(this._pos.x,this._pos.y-this._offset.y)),d=a.transform.lngLatToCameraDepth(this._lngLat,l+u)-h>.006;(null===(n=this._popup)||void 0===n?void 0:n.isOpen())&&d&&this._popup.remove(),this._element.style.opacity=d?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(e){return this._offset=t.P.convert(e),this._update(),this}addClassName(e){this._element.classList.add(e)}removeClassName(e){this._element.classList.remove(e)}toggleClassName(e){return this._element.classList.toggle(e)}setDraggable(e){return this._draggable=!!e,this._map&&(e?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(e){return this._rotation=e||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e&&"auto"!==e?e:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(e,t){return(void 0===this._opacity||void 0===e&&void 0===t)&&(this._opacity="1",this._opacityWhenCovered="0.2"),void 0!==e&&(this._opacity=e),void 0!==t&&(this._opacityWhenCovered=t),this._map&&this._updateOpacity(!0),this}}const ya={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let va=0,xa=!1;const ba={maxWidth:100,unit:"metric"};function wa(e,t,i){const n=i&&i.maxWidth||100,r=e._container.clientHeight/2,o=e._container.clientWidth/2,a=e.unproject([o-n/2,r]),s=e.unproject([o+n/2,r]),l=Math.round(e.project(s).x-e.project(a).x),c=Math.min(n,l,e._container.clientWidth),u=a.distanceTo(s);if(i&&"imperial"===i.unit){const i=3.2808*u;i>5280?Ta(t,c,i/5280,e._getUIString("ScaleControl.Miles")):Ta(t,c,i,e._getUIString("ScaleControl.Feet"))}else i&&"nautical"===i.unit?Ta(t,c,u/1852,e._getUIString("ScaleControl.NauticalMiles")):u>=1e3?Ta(t,c,u/1e3,e._getUIString("ScaleControl.Kilometers")):Ta(t,c,u,e._getUIString("ScaleControl.Meters"))}function Ta(e,t,i,n){const r=function(e){const t=Math.pow(10,`${Math.floor(e)}`.length-1);let i=e/t;return i=i>=10?10:i>=5?5:i>=3?3:i>=2?2:i>=1?1:function(e){const t=Math.pow(10,Math.ceil(-Math.log(e)/Math.LN10));return Math.round(e*t)/t}(i),t*i}(i);e.style.width=t*(r/i)+"px",e.innerHTML=`${r} ${n}`}const Sa={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0,padding:void 0},Pa=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Ma(e){if(e){if("number"==typeof e){const i=Math.round(Math.abs(e)/Math.SQRT2);return{center:new t.P(0,0),top:new t.P(0,e),"top-left":new t.P(i,i),"top-right":new t.P(-i,i),bottom:new t.P(0,-e),"bottom-left":new t.P(i,-i),"bottom-right":new t.P(-i,-i),left:new t.P(e,0),right:new t.P(-e,0)}}if(e instanceof t.P||Array.isArray(e)){const i=t.P.convert(e);return{center:i,top:i,"top-left":i,"top-right":i,bottom:i,"bottom-left":i,"bottom-right":i,left:i,right:i}}return{center:t.P.convert(e.center||[0,0]),top:t.P.convert(e.top||[0,0]),"top-left":t.P.convert(e["top-left"]||[0,0]),"top-right":t.P.convert(e["top-right"]||[0,0]),bottom:t.P.convert(e.bottom||[0,0]),"bottom-left":t.P.convert(e["bottom-left"]||[0,0]),"bottom-right":t.P.convert(e["bottom-right"]||[0,0]),left:t.P.convert(e.left||[0,0]),right:t.P.convert(e.right||[0,0])}}return Ma(new t.P(0,0))}const Ea=i;e.AJAXError=t.cI,e.Event=t.l,e.Evented=t.E,e.LngLat=t.V,e.MercatorCoordinate=t.a9,e.Point=t.P,e.addProtocol=t.cJ,e.config=t.c,e.removeProtocol=t.cK,e.AttributionControl=Jo,e.BoxZoomHandler=ho,e.CanvasSource=ne,e.CooperativeGesturesHandler=$o,e.DoubleClickZoomHandler=jo,e.DragPanHandler=Zo,e.DragRotateHandler=Go,e.EdgeInsets=Vt,e.FullscreenControl=class extends t.E{constructor(e={}){super(),this._onFullscreenChange=()=>{var e;let t=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;null===(e=null==t?void 0:t.shadowRoot)||void 0===e?void 0:e.fullscreenElement;)t=t.shadowRoot.fullscreenElement;t===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,e&&e.container&&(e.container instanceof HTMLElement?this._container=e.container:t.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(e){return this._map=e,this._container||(this._container=this._map.getContainer()),this._controlContainer=u.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){u.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const e=this._fullscreenButton=u.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);u.create("span","maplibregl-ctrl-icon",e).setAttribute("aria-hidden","true"),e.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const e=this._getTitle();this._fullscreenButton.setAttribute("aria-label",e),this._fullscreenButton.title=e}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new t.l("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new t.l("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},e.GeoJSONSource=ee,e.GeolocateControl=class extends t.E{constructor(e){super(),this._onSuccess=e=>{if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new t.l("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(e),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new t.l("geolocate",e)),this._finish()}},this._updateCamera=e=>{const i=new t.V(e.coords.longitude,e.coords.latitude),n=e.coords.accuracy,r=this._map.getBearing(),o=t.e({bearing:r},this.options.fitBoundsOptions),a=W.fromLngLat(i,n);this._map.fitBounds(a,o,{geolocateSource:!0})},this._updateMarker=e=>{if(e){const i=new t.V(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).addTo(this._map),this._accuracy=e.coords.accuracy,this._updateCircleRadiusIfNeeded()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onUpdate=()=>{this._updateCircleRadiusIfNeeded()},this._onError=e=>{if(this._map){if(1===e.code){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===e.code&&xa)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new t.l("error",e)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",e=>e.preventDefault()),this._geolocateButton=u.create("button","maplibregl-ctrl-geolocate",this._container),u.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=e=>{if(this._map){if(!1===e){t.w("Geolocation support is not available so the GeolocateControl will be disabled.");const e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e)}else{const e=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=u.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new _a({element:this._dotElement}),this._circleElement=u.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new _a({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onUpdate),this._map.on("move",this._onUpdate),this._map.on("rotate",this._onUpdate),this._map.on("pitch",this._onUpdate)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",e=>{const i=(null==e?void 0:e[0])instanceof ResizeObserverEntry;e.geolocateSource||"ACTIVE_LOCK"!==this._watchState||i||this._map.isZooming()||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new t.l("trackuserlocationend")),this.fire(new t.l("userlocationlostfocus")))})}},this.options=t.e({},ya,e)}onAdd(e){return this._map=e,this._container=u.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return t._(this,arguments,void 0,function*(e=!1){if(void 0!==pa&&!e)return pa;if(void 0===window.navigator.permissions)return pa=!!window.navigator.geolocation,pa;try{const e=yield window.navigator.permissions.query({name:"geolocation"});pa="denied"!==e.state}catch(t){pa=!!window.navigator.geolocation}return pa})}().then(e=>this._finishSetupUI(e)),this._container}onRemove(){void 0!==this._geolocationWatchID&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),u.remove(this._container),this._map.off("zoom",this._onUpdate),this._map.off("move",this._onUpdate),this._map.off("rotate",this._onUpdate),this._map.off("pitch",this._onUpdate),this._map=void 0,va=0,xa=!1}_isOutOfMapMaxBounds(e){const t=this._map.getMaxBounds(),i=e.coords;return t&&(i.longitude<t.getWest()||i.longitude>t.getEast()||i.latitude<t.getSouth()||i.latitude>t.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":case"BACKGROUND_ERROR":case"OFF":case void 0:break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadiusIfNeeded(){const e=this._userLocationDotMarker.getLngLat();if(!(this.options.showUserLocation&&this.options.showAccuracyCircle&&this._accuracy&&e))return;const t=this._map.project(e),i=this._map.unproject([t.x+100,t.y]),n=e.distanceTo(i)/100,r=2*this._accuracy/n;this._circleElement.style.width=`${r.toFixed(2)}px`,this._circleElement.style.height=`${r.toFixed(2)}px`}trigger(){if(!this._setup)return t.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new t.l("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":va--,xa=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new t.l("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new t.l("trackuserlocationstart")),this.fire(new t.l("userlocationfocus"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let e;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),va++,va>1?(e={maximumAge:6e5,timeout:0},xa=!0):(e=this.options.positionOptions,xa=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,e)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},e.GlobeControl=class{constructor(){this._toggleProjection=()=>{var e;const t=null===(e=this._map.getProjection())||void 0===e?void 0:e.type;this._map.setProjection("mercator"!==t&&t?{type:"mercator"}:{type:"globe"}),this._updateGlobeIcon()},this._updateGlobeIcon=()=>{var e;this._globeButton.classList.remove("maplibregl-ctrl-globe"),this._globeButton.classList.remove("maplibregl-ctrl-globe-enabled"),"globe"===(null===(e=this._map.getProjection())||void 0===e?void 0:e.type)?(this._globeButton.classList.add("maplibregl-ctrl-globe-enabled"),this._globeButton.title=this._map._getUIString("GlobeControl.Disable")):(this._globeButton.classList.add("maplibregl-ctrl-globe"),this._globeButton.title=this._map._getUIString("GlobeControl.Enable"))}}onAdd(e){return this._map=e,this._container=u.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=u.create("button","maplibregl-ctrl-globe",this._container),u.create("span","maplibregl-ctrl-icon",this._globeButton).setAttribute("aria-hidden","true"),this._globeButton.type="button",this._globeButton.addEventListener("click",this._toggleProjection),this._updateGlobeIcon(),this._map.on("styledata",this._updateGlobeIcon),this._container}onRemove(){u.remove(this._container),this._map.off("styledata",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},e.Hash=Xr,e.ImageSource=te,e.KeyboardHandler=Ro,e.LngLatBounds=W,e.LogoControl=ea,e.Map=class extends Ko{constructor(e){var i,n;t.cG.mark(t.cH.create);const r=Object.assign(Object.assign(Object.assign({},ua),e),{canvasContextAttributes:Object.assign(Object.assign({},ua.canvasContextAttributes),e.canvasContextAttributes)});if(null!=r.minZoom&&null!=r.maxZoom&&r.minZoom>r.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(null!=r.minPitch&&null!=r.maxPitch&&r.minPitch>r.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(null!=r.minPitch&&r.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(null!=r.maxPitch&&r.maxPitch>180)throw new Error("maxPitch must be less than or equal to 180");const o=new Ht,a=new Qt;if(void 0!==r.minZoom&&o.setMinZoom(r.minZoom),void 0!==r.maxZoom&&o.setMaxZoom(r.maxZoom),void 0!==r.minPitch&&o.setMinPitch(r.minPitch),void 0!==r.maxPitch&&o.setMaxPitch(r.maxPitch),void 0!==r.renderWorldCopies&&o.setRenderWorldCopies(r.renderWorldCopies),null!==r.transformConstrain&&o.setConstrainOverride(r.transformConstrain),super(o,a,{bearingSnap:r.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new ta,this._controls=[],this._mapId=t.af(),this._lostContextStyle={style:null,images:null},this._contextLost=e=>{e.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.painter.destroy();for(const t of Object.values(this.style._layers))if(t.type,t._listeners)for(const[e]of Object.entries(t._listeners));this._lostContextStyle=this._getStyleAndImages(),this.style.destroy(),this.style=null,this.fire(new t.l("webglcontextlost",{originalEvent:e}))},this._contextRestored=e=>{this._lostContextStyle.style&&this.setStyle(this._lostContextStyle.style,{diff:!1}),this._lostContextStyle.images&&(this.style.imageManager.images=this._lostContextStyle.images),this._lostContextStyle={style:null,images:null},this._setupPainter(),this.resize(),this._update(),this._resizeInternal(),this.fire(new t.l("webglcontextrestored",{originalEvent:e}))},this._onMapScroll=e=>{if(e.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=r.interactive,this._maxTileCacheSize=r.maxTileCacheSize,this._maxTileCacheZoomLevels=r.maxTileCacheZoomLevels,this._canvasContextAttributes=Object.assign({},r.canvasContextAttributes),this._trackResize=!0===r.trackResize,this._bearingSnap=r.bearingSnap,this._centerClampedToGround=r.centerClampedToGround,this._refreshExpiredTiles=!0===r.refreshExpiredTiles,this._fadeDuration=r.fadeDuration,this._crossSourceCollisions=!0===r.crossSourceCollisions,this._collectResourceTiming=!0===r.collectResourceTiming,this._locale=Object.assign(Object.assign({},la),r.locale),this._clickTolerance=r.clickTolerance,this._overridePixelRatio=r.pixelRatio,this._maxCanvasSize=r.maxCanvasSize,this._zoomLevelsToOverscale=r.experimentalZoomLevelsToOverscale,this.transformCameraUpdate=r.transformCameraUpdate,this.transformConstrain=r.transformConstrain,this.cancelPendingTileRequestsWhileZooming=!0===r.cancelPendingTileRequestsWhileZooming,void 0!==r.reduceMotion&&(s.prefersReducedMotion=r.reduceMotion),this._imageQueueHandle=_.addThrottleControl(()=>this.isMoving()),this._requestManager=new y(r.transformRequest),"string"==typeof r.container){if(this._container=document.getElementById(r.container),!this._container)throw new Error(`Container '${r.container}' not found.`)}else{if(!(r.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=r.container}if(r.maxBounds&&this.setMaxBounds(r.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),this.once("idle",()=>{this._idleTriggered=!0}),"undefined"!=typeof window){addEventListener("online",this._onWindowOnline,!1);let e=!1;const t=Hr(e=>{this._trackResize&&!this._removed&&(this.resize(e),this.redraw())},50);this._resizeObserver=new ResizeObserver(i=>{e?t(i):e=!0}),this._resizeObserver.observe(this._container)}this.handlers=new Yo(this,r),this._hash=r.hash&&new Xr("string"==typeof r.hash&&r.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:r.center,elevation:r.elevation,zoom:r.zoom,bearing:r.bearing,pitch:r.pitch,roll:r.roll}),r.bounds&&(this.resize(),this.fitBounds(r.bounds,t.e({},r.fitBoundsOptions,{duration:0}))));const l="string"==typeof r.style||!("globe"===(null===(n=null===(i=r.style)||void 0===i?void 0:i.projection)||void 0===n?void 0:n.type));this.resize(null,l),this._localIdeographFontFamily=r.localIdeographFontFamily,this._validateStyle=r.validateStyle,r.style&&this.setStyle(r.style,{localIdeographFontFamily:r.localIdeographFontFamily}),r.attributionControl&&this.addControl(new Jo("boolean"==typeof r.attributionControl?void 0:r.attributionControl)),r.maplibreLogo&&this.addControl(new ea,r.logoPosition),this.on("style.load",()=>{if(l||this._resizeTransform(),this.transform.unmodified){const e=t.U(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(e)}}),this.on("data",e=>{this._update("style"===e.dataType),this.fire(new t.l(`${e.dataType}data`,e))}),this.on("dataloading",e=>{this.fire(new t.l(`${e.dataType}dataloading`,e))}),this.on("dataabort",e=>{this.fire(new t.l("sourcedataabort",e))})}_getMapId(){return this._mapId}setGlobalStateProperty(e,t){return this.style.setGlobalStateProperty(e,t),this._update(!0)}getGlobalState(){return this.style.getGlobalState()}addControl(e,i){if(void 0===i&&(i=e.getDefaultPosition?e.getDefaultPosition():"top-right"),!e||!e.onAdd)return this.fire(new t.k(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const n=e.onAdd(this);this._controls.push(e);const r=this._controlPositions[i];return-1!==i.indexOf("bottom")?r.insertBefore(n,r.firstChild):r.appendChild(n),this}removeControl(e){if(!e||!e.onRemove)return this.fire(new t.k(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const i=this._controls.indexOf(e);return i>-1&&this._controls.splice(i,1),e.onRemove(this),this}hasControl(e){return this._controls.indexOf(e)>-1}coveringTiles(e){return Ee(this.transform,e)}calculateCameraOptionsFromTo(e,t,i,n){return null==n&&this.terrain&&(n=this.terrain.getElevationForLngLat(i,this.transform)),super.calculateCameraOptionsFromTo(e,t,i,n)}resize(e,i=!0){if(null!==this._lostContextStyle.style)return this;this._resizeInternal(i);const n=!this._moving;return n&&(this.stop(),this.fire(new t.l("movestart",e)).fire(new t.l("move",e))),this.fire(new t.l("resize",e)),n&&this.fire(new t.l("moveend",e)),this}_resizeInternal(e=!0){const[t,i]=this._containerDimensions(),n=this._getClampedPixelRatio(t,i);if(this._resizeCanvas(t,i,n),this.painter.resize(t,i,n),this.painter.overLimit()){const e=this.painter.context.gl;this._maxCanvasSize=[e.drawingBufferWidth,e.drawingBufferHeight];const n=this._getClampedPixelRatio(t,i);this._resizeCanvas(t,i,n),this.painter.resize(t,i,n)}this._resizeTransform(e)}_resizeTransform(e=!0){var t;const[i,n]=this._containerDimensions();this.transform.resize(i,n,e),null===(t=this._requestedCameraState)||void 0===t||t.resize(i,n,e)}_getClampedPixelRatio(e,t){const{0:i,1:n}=this._maxCanvasSize,r=this.getPixelRatio(),o=e*r,a=t*r;return Math.min(o>i?i/o:1,a>n?n/a:1)*r}getPixelRatio(){var e;return null!==(e=this._overridePixelRatio)&&void 0!==e?e:devicePixelRatio}setPixelRatio(e){this._overridePixelRatio=e,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(e){return this.transform.setMaxBounds(W.convert(e)),this._update()}setMinZoom(e){if((e=null==e?-2:e)>=-2&&e<=this.transform.maxZoom){const t=this._getTransformForUpdate();return t.setMinZoom(e),this._applyUpdatedTransform(t),this._update(),this}throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(e){if((e=null==e?22:e)>=this.transform.minZoom){const t=this._getTransformForUpdate();return t.setMaxZoom(e),this._applyUpdatedTransform(t),this._update(),this}throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(e){if((e=null==e?0:e)<0)throw new Error("minPitch must be greater than or equal to 0");if(e>=0&&e<=this.transform.maxPitch)return this.transform.setMinPitch(e),this._update(),this.getPitch()<e&&this.setPitch(e),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(e){if((e=null==e?60:e)>180)throw new Error("maxPitch must be less than or equal to 180");if(e>=this.transform.minPitch)return this.transform.setMaxPitch(e),this._update(),this.getPitch()>e&&this.setPitch(e),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(e){return this.transform.setRenderWorldCopies(e),this._update()}setTransformConstrain(e){return this.transform.setConstrainOverride(e),this._update()}project(e){return this.transform.locationToScreenPoint(t.V.convert(e),this.style&&this.terrain)}unproject(e){return this.transform.screenPointToLocation(t.P.convert(e),this.terrain)}isMoving(){var e;return this._moving||(null===(e=this.handlers)||void 0===e?void 0:e.isMoving())}isZooming(){var e;return this._zooming||(null===(e=this.handlers)||void 0===e?void 0:e.isZooming())}isRotating(){var e;return this._rotating||(null===(e=this.handlers)||void 0===e?void 0:e.isRotating())}_createDelegatedListener(e,t,i){if("mouseenter"===e||"mouseover"===e){let n=!1;const r=r=>{const o=t.filter(e=>this.getLayer(e)),a=0!==o.length?this.queryRenderedFeatures(r.point,{layers:o}):[];a.length?n||(n=!0,i.call(this,new oo(e,this,r.originalEvent,{features:a}))):n=!1};return{layers:t,listener:i,delegates:{mousemove:r,mouseout:()=>{n=!1}}}}if("mouseleave"===e||"mouseout"===e){let n=!1;const r=r=>{const o=t.filter(e=>this.getLayer(e));(0!==o.length?this.queryRenderedFeatures(r.point,{layers:o}):[]).length?n=!0:n&&(n=!1,i.call(this,new oo(e,this,r.originalEvent)))},o=t=>{n&&(n=!1,i.call(this,new oo(e,this,t.originalEvent)))};return{layers:t,listener:i,delegates:{mousemove:r,mouseout:o}}}{const n=e=>{const n=t.filter(e=>this.getLayer(e)),r=0!==n.length?this.queryRenderedFeatures(e.point,{layers:n}):[];r.length&&(e.features=r,i.call(this,e),delete e.features)};return{layers:t,listener:i,delegates:{[e]:n}}}}_saveDelegatedListener(e,t){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[e]=this._delegatedListeners[e]||[],this._delegatedListeners[e].push(t)}_removeDelegatedListener(e,t,i){if(!this._delegatedListeners||!this._delegatedListeners[e])return;const n=this._delegatedListeners[e];for(let r=0;r<n.length;r++){const e=n[r];if(e.listener===i&&e.layers.length===t.length&&e.layers.every(e=>t.includes(e))){for(const t in e.delegates)this.off(t,e.delegates[t]);return void n.splice(r,1)}}}on(e,t,i){if(void 0===i)return super.on(e,t);const n="string"==typeof t?[t]:t,r=this._createDelegatedListener(e,n,i);this._saveDelegatedListener(e,r);for(const o in r.delegates)this.on(o,r.delegates[o]);return{unsubscribe:()=>{this._removeDelegatedListener(e,n,i)}}}once(e,t,i){if(void 0===i)return super.once(e,t);const n="string"==typeof t?[t]:t,r=this._createDelegatedListener(e,n,i);for(const o in r.delegates){const t=r.delegates[o];r.delegates[o]=(...r)=>{this._removeDelegatedListener(e,n,i),t(...r)}}this._saveDelegatedListener(e,r);for(const o in r.delegates)this.once(o,r.delegates[o]);return this}off(e,t,i){return void 0===i?super.off(e,t):(this._removeDelegatedListener(e,"string"==typeof t?[t]:t,i),this)}queryRenderedFeatures(e,i){if(!this.style)return[];let n;const r=e instanceof t.P||Array.isArray(e),o=r?e:[[0,0],[this.transform.width,this.transform.height]];if(i=i||(r?{}:e)||{},o instanceof t.P||"number"==typeof o[0])n=[t.P.convert(o)];else{const e=t.P.convert(o[0]),i=t.P.convert(o[1]);n=[e,new t.P(i.x,e.y),i,new t.P(e.x,i.y),e]}return this.style.queryRenderedFeatures(n,i,this.transform)}querySourceFeatures(e,t){return this.style.querySourceFeatures(e,t)}setStyle(e,i){return!1!==(i=t.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},i)).diff&&i.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&e?(this._diffStyle(e,i),this):(this._localIdeographFontFamily=i.localIdeographFontFamily,this._updateStyle(e,i))}setTransformRequest(e){return this._requestManager.setTransformRequest(e),this}_getUIString(e){const t=this._locale[e];if(null==t)throw new Error(`Missing UI string '${e}'`);return t}_updateStyle(e,t){var i,n;if(t.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(e,t));const r=this.style&&t.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!e)),e?(this.style=new Fi(this,t||{}),this.style.setEventedParent(this,{style:this.style}),"string"==typeof e?this.style.loadURL(e,t,r):this.style.loadJSON(e,t,r),this):(null===(n=null===(i=this.style)||void 0===i?void 0:i.projection)||void 0===n||n.destroy(),delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Fi(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(e,i){if("string"==typeof e){const n=this._requestManager.transformRequest(e,"Style");t.j(n,new AbortController).then(e=>{this._updateDiff(e.data,i)}).catch(e=>{e&&this.fire(new t.k(e))})}else"object"==typeof e&&this._updateDiff(e,i)}_updateDiff(e,i){try{this.style.setState(e,i)&&this._update(!0)}catch(n){t.w(`Unable to perform style diff: ${n.message||n.error||n}. Rebuilding the style from scratch.`),this._updateStyle(e,i)}}getStyle(){if(this.style)return this.style.serialize()}_getStyleAndImages(){return this.style?{style:this.style.serialize(),images:this.style.imageManager.cloneImages()}:{style:null,images:{}}}isStyleLoaded(){return this.style?this.style.loaded():t.w("There is no style added to the map.")}addSource(e,t){return this._lazyInitEmptyStyle(),this.style.addSource(e,t),this._update(!0)}isSourceLoaded(e){const i=this.style&&this.style.tileManagers[e];if(void 0!==i)return i.loaded();this.fire(new t.k(new Error(`There is no tile manager with ID '${e}'`)))}setTerrain(e){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),e){const i=this.style.tileManagers[e.source];if(!i)throw new Error(`cannot load terrain, because there exists no source with ID: ${e.source}`);null===this.terrain&&i.reload();for(const n in this.style._layers){const i=this.style._layers[n];"hillshade"===i.type&&i.source===e.source&&t.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality."),"color-relief"===i.type&&i.source===e.source&&t.w("You are using the same source for a color-relief layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new ra(this.painter,i,e),this.painter.renderToTexture=new sa(this.painter,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._terrainDataCallback=t=>{var i;"style"===t.dataType?this.terrain.tileManager.freeRtt():"source"===t.dataType&&t.tile&&(t.sourceId!==e.source||this._elevationFreeze||(this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))),"image"===(null===(i=t.source)||void 0===i?void 0:i.type)?this.terrain.tileManager.freeRtt():this.terrain.tileManager.freeRtt(t.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.tileManager.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0);return this.fire(new t.l("terrain",{terrain:e})),this}getTerrain(){var e,t;return null!==(t=null===(e=this.terrain)||void 0===e?void 0:e.options)&&void 0!==t?t:null}areTilesLoaded(){const e=this.style&&this.style.tileManagers;for(const t of Object.values(e))if(!t.areTilesLoaded())return!1;return!0}removeSource(e){return this.style.removeSource(e),this._update(!0)}getSource(e){return this.style.getSource(e)}setSourceTileLodParams(e,t,i){if(i){const n=this.getSource(i);if(!n)throw new Error(`There is no source with ID "${i}", cannot set LOD parameters`);n.calculateTileZoom=Se(Math.max(1,e),Math.max(1,t))}else for(const n in this.style.tileManagers)this.style.tileManagers[n].getSource().calculateTileZoom=Se(Math.max(1,e),Math.max(1,t));return this._update(!0),this}refreshTiles(e,i){const n=this.style.tileManagers[e];if(!n)throw new Error(`There is no tile manager with ID "${e}", cannot refresh tile`);void 0===i?n.reload(!0):n.refreshTiles(i.map(e=>new t.ac(e.z,e.x,e.y)))}addImage(e,i,n={}){const{pixelRatio:r=1,sdf:o=!1,stretchX:a,stretchY:l,content:c,textFitWidth:u,textFitHeight:h}=n;if(this._lazyInitEmptyStyle(),!(i instanceof HTMLImageElement||t.b(i))){if(void 0===i.width||void 0===i.height)return this.fire(new t.k(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:n,height:s,data:d}=i,p=i;return this.style.addImage(e,{data:new t.R({width:n,height:s},new Uint8Array(d)),pixelRatio:r,stretchX:a,stretchY:l,content:c,textFitWidth:u,textFitHeight:h,sdf:o,version:0,userImage:p}),p.onAdd&&p.onAdd(this,e),this}}{const{width:n,height:d,data:p}=s.getImageData(i);this.style.addImage(e,{data:new t.R({width:n,height:d},p),pixelRatio:r,stretchX:a,stretchY:l,content:c,textFitWidth:u,textFitHeight:h,sdf:o,version:0})}}updateImage(e,i){const n=this.style.getImage(e);if(!n)return this.fire(new t.k(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const r=i instanceof HTMLImageElement||t.b(i)?s.getImageData(i):i,{width:o,height:a,data:l}=r;if(void 0===o||void 0===a)return this.fire(new t.k(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(o!==n.data.width||a!==n.data.height)return this.fire(new t.k(new Error("The width and height of the updated image must be that same as the previous version of the image")));const c=!(i instanceof HTMLImageElement||t.b(i));return n.data.replace(l,c),this.style.updateImage(e,n),this}getImage(e){return this.style.getImage(e)}hasImage(e){return e?!!this.style.getImage(e):(this.fire(new t.k(new Error("Missing required image id"))),!1)}removeImage(e){this.style.removeImage(e)}loadImage(e){return _.getImage(this._requestManager.transformRequest(e,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(e,t){return this._lazyInitEmptyStyle(),this.style.addLayer(e,t),this._update(!0)}moveLayer(e,t){return this.style.moveLayer(e,t),this._update(!0)}removeLayer(e){return this.style.removeLayer(e),this._update(!0)}getLayer(e){return this.style.getLayer(e)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(e,t,i){return this.style.setLayerZoomRange(e,t,i),this._update(!0)}setFilter(e,t,i={}){return this.style.setFilter(e,t,i),this._update(!0)}getFilter(e){return this.style.getFilter(e)}setPaintProperty(e,t,i,n={}){return this.style.setPaintProperty(e,t,i,n),this._update(!0)}getPaintProperty(e,t){return this.style.getPaintProperty(e,t)}setLayoutProperty(e,t,i,n={}){return this.style.setLayoutProperty(e,t,i,n),this._update(!0)}getLayoutProperty(e,t){return this.style.getLayoutProperty(e,t)}setGlyphs(e,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(e,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(e,t,i={}){return this._lazyInitEmptyStyle(),this.style.addSprite(e,t,i,e=>{e||this._update(!0)}),this}removeSprite(e){return this._lazyInitEmptyStyle(),this.style.removeSprite(e),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(e,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(e,t,e=>{e||this._update(!0)}),this}setLight(e,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(e,t),this._update(!0)}getLight(){return this.style.getLight()}setSky(e,t={}){return this._lazyInitEmptyStyle(),this.style.setSky(e,t),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(e,t){return this.style.setFeatureState(e,t),this._update()}removeFeatureState(e,t){return this.style.removeFeatureState(e,t),this._update()}getFeatureState(e){return this.style.getFeatureState(e)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let e=0,t=0;return this._container&&(e=this._container.clientWidth||400,t=this._container.clientHeight||300),[e,t]}_setupContainer(){const e=this._container;e.classList.add("maplibregl-map");const t=this._canvasContainer=u.create("div","maplibregl-canvas-container",e);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=u.create("canvas","maplibregl-canvas",t),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");const i=this._containerDimensions(),n=this._getClampedPixelRatio(i[0],i[1]);this._resizeCanvas(i[0],i[1],n);const r=this._controlContainer=u.create("div","maplibregl-control-container",e),o=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(e=>{o[e]=u.create("div",`maplibregl-ctrl-${e} `,r)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(e,t,i){this._canvas.width=Math.floor(i*e),this._canvas.height=Math.floor(i*t),this._canvas.style.width=`${e}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const e=Object.assign(Object.assign({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0});let t=null;this._canvas.addEventListener("webglcontextcreationerror",i=>{t={requestedAttributes:e},i&&(t.statusMessage=i.statusMessage,t.type=i.type)},{once:!0});let i=null;if(i=this._canvasContextAttributes.contextType?this._canvas.getContext(this._canvasContextAttributes.contextType,e):this._canvas.getContext("webgl2",e)||this._canvas.getContext("webgl",e),!i){const e="Failed to initialize WebGL";throw t?(t.message=e,new Error(JSON.stringify(t))):new Error(e)}this.painter=new Wr(i,this.transform),h.testSupport(i)}migrateProjection(e,i){super.migrateProjection(e,i),this.painter.transform=e,this.fire(new t.l("projectiontransition",{newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(e){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||e,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(e){return this._update(),this._renderTaskQueue.add(e)}_cancelRenderFrame(e){this._renderTaskQueue.remove(e)}_render(e){var i,n,r,o,a;const s=this._idleTriggered?this._fadeDuration:0,l=(null===(i=this.style.projection)||void 0===i?void 0:i.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(e),this._removed)return;let u=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const e=this.transform.zoom,i=c();this.style.zoomHistory.update(e,i);const n=new t.H(e,{now:i,fadeDuration:s,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),r=n.crossFadingFactor();1===r&&r===this._crossFadingFactor||(u=!0,this._crossFadingFactor=r),this.style.update(n)}const h=(null===(n=this.style.projection)||void 0===n?void 0:n.transitionState)>0!==l;null===(r=this.style.projection)||void 0===r||r.setErrorQueryLatitudeDegrees(this.transform.center.lat),this.transform.setTransitionState(null===(o=this.style.projection)||void 0===o?void 0:o.transitionState,null===(a=this.style.projection)||void 0===a?void 0:a.latitudeErrorCorrectionRadians),this.style&&(this._sourcesDirty||h)&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.tileManager.update(this.transform,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),!this._elevationFreeze&&this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0)),this._placementDirty=this.style&&this.style._updatePlacement(this.transform,this.showCollisionBoxes,s,this._crossSourceCollisions,h),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:s,showPadding:this.showPadding}),this.fire(new t.l("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,t.cG.mark(t.cH.load),this.fire(new t.l("load"))),this.style&&(this.style.hasTransitions()||u)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const d=this._sourcesDirty||this._styleDirty||this._placementDirty;return d||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new t.l("idle")),!this._loaded||this._fullyLoaded||d||(this._fullyLoaded=!0,t.cG.mark(t.cH.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var e;this._hash&&this._hash.remove();for(const t of this._controls)t.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),"undefined"!=typeof window&&removeEventListener("online",this._onWindowOnline,!1),_.removeThrottleControl(this._imageQueueHandle),null===(e=this._resizeObserver)||void 0===e||e.disconnect();const i=this.painter.context.gl.getExtension("WEBGL_lose_context");(null==i?void 0:i.loseContext)&&i.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),u.remove(this._canvasContainer),u.remove(this._controlContainer),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),t.cG.clearMetrics(),this._removed=!0,this.fire(new t.l("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,s.frame(this._frameRequest,e=>{t.cG.frame(e),this._frameRequest=null;try{this._render(e)}catch(i){if(!t.Z(i)&&i.message!==sr)throw i}},()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(e){this._showTileBoundaries!==e&&(this._showTileBoundaries=e,this._update())}get showPadding(){return!!this._showPadding}set showPadding(e){this._showPadding!==e&&(this._showPadding=e,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(e){this._showCollisionBoxes!==e&&(this._showCollisionBoxes=e,e?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(e){this._showOverdrawInspector!==e&&(this._showOverdrawInspector=e,this._update())}get repaint(){return!!this._repaint}set repaint(e){this._repaint!==e&&(this._repaint=e,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(e){this._vertices=e,this._update()}get version(){return ca}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(e){return this._lazyInitEmptyStyle(),this.style.setProjection(e),this._update(!0)}},e.MapMouseEvent=oo,e.MapTouchEvent=ao,e.MapWheelEvent=so,e.Marker=_a,e.NavigationControl=class{constructor(e){this._updateZoomButtons=()=>{const e=this._map.getZoom(),t=e===this._map.getMaxZoom(),i=e===this._map.getMinZoom();this._zoomInButton.disabled=t,this._zoomOutButton.disabled=i,this._zoomInButton.setAttribute("aria-disabled",t.toString()),this._zoomOutButton.setAttribute("aria-disabled",i.toString())},this._rotateCompassArrow=()=>{this._compassIcon.style.transform=this.options.visualizePitch&&this.options.visualizeRoll?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateZ(${-this._map.transform.roll}deg) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizeRoll?`rotate(${-this._map.transform.bearing-this._map.transform.roll}deg)`:`rotate(${-this._map.transform.bearing}deg)`},this._setButtonTitle=(e,t)=>{const i=this._map._getUIString(`NavigationControl.${t}`);e.title=i,e.setAttribute("aria-label",i)},this.options=t.e({},ha,e),this._container=u.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",e=>e.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",e=>this._map.zoomIn({},{originalEvent:e})),u.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",e=>this._map.zoomOut({},{originalEvent:e})),u.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",e=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:e}):this._map.resetNorth({},{originalEvent:e})}),this._compassIcon=u.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(e){return this._map=e,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.on("roll",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new da(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){u.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.off("roll",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(e,t){const i=u.create("button",e,this._container);return i.type="button",i.addEventListener("click",t),i}},e.Popup=class extends t.E{constructor(e){super(),this._updateOpacity=()=>{void 0!==this.options.locationOccludedOpacity&&(this._container.style.opacity=this._map.transform.isLocationOccluded(this.getLngLat())?`${this.options.locationOccludedOpacity}`:"")},this.remove=()=>(this._content&&u.remove(this._content),this._container&&(u.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new t.l("close"))),this),this._onMouseUp=e=>{this._update(e.point)},this._onMouseMove=e=>{this._update(e.point)},this._onDrag=e=>{this._update(e.point)},this._update=e=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=u.create("div","maplibregl-popup",this._map.getContainer()),this._tip=u.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const e of this.options.className.split(" "))this._container.classList.add(e);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=fa(this._lngLat,this._flatPos,this._map.transform,this._trackPointer),this._trackPointer&&!e)return;const t=this._flatPos=this._pos=this._trackPointer&&e?e:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&e?e:this._map.transform.locationToScreenPoint(this._lngLat));let i=this.options.anchor;const n=Ma(this.options.offset);if(!i){const e=this._container.offsetWidth,c=this._container.offsetHeight,u=(r=this.options.padding)?{top:null!==(o=r.top)&&void 0!==o?o:0,right:null!==(a=r.right)&&void 0!==a?a:0,bottom:null!==(s=r.bottom)&&void 0!==s?s:0,left:null!==(l=r.left)&&void 0!==l?l:0}:{top:0,right:0,bottom:0,left:0};let h;h=t.y+n.bottom.y<c+u.top?["top"]:t.y>this._map.transform.height-c-u.bottom?["bottom"]:[],t.x<e/2+u.left?h.push("left"):t.x>this._map.transform.width-e/2-u.right&&h.push("right"),i=0===h.length?"bottom":h.join("-")}var r,o,a,s,l;let c=t.add(n[i]);this.options.subpixelPositioning||(c=c.round()),u.setTransform(this._container,`${ma[i]} translate(${c.x}px,${c.y}px)`),ga(this._container,i,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=t.e(Object.create(Sa),e)}addTo(e){return this._map&&this.remove(),this._map=e,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new t.l("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=t.V.convert(e),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(e){return this.setDOMContent(document.createTextNode(e))}setHTML(e){const t=document.createDocumentFragment(),i=document.createElement("body");let n;for(i.innerHTML=e;n=i.firstChild,n;)t.appendChild(n);return this.setDOMContent(t)}getMaxWidth(){var e;return null===(e=this._container)||void 0===e?void 0:e.style.maxWidth}setMaxWidth(e){return this.options.maxWidth=e,this._update(),this}setDOMContent(e){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=u.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(e),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(e){return this._container&&this._container.classList.add(e),this}removeClassName(e){return this._container&&this._container.classList.remove(e),this}setOffset(e){return this.options.offset=e,this._update(),this}toggleClassName(e){if(this._container)return this._container.classList.toggle(e)}setSubpixelPositioning(e){this.options.subpixelPositioning=e}setPadding(e){this.options.padding=e,this._update()}_createCloseButton(){this.options.closeButton&&(this._closeButton=u.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const e=this._container.querySelector(Pa);e&&e.focus()}},e.RasterDEMTileSource=K,e.RasterTileSource=Y,e.ScaleControl=class{constructor(e){this._onMove=()=>{wa(this._map,this._container,this.options)},this.setUnit=e=>{this.options.unit=e,wa(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},ba),e)}getDefaultPosition(){return"bottom-left"}onAdd(e){return this._map=e,this._container=u.create("div","maplibregl-ctrl maplibregl-ctrl-scale",e.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){u.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},e.ScrollZoomHandler=No,e.Style=Fi,e.TerrainControl=class{constructor(e){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=e}onAdd(e){return this._map=e,this._container=u.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=u.create("button","maplibregl-ctrl-terrain",this._container),u.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){u.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},e.TwoFingersTouchPitchHandler=Lo,e.TwoFingersTouchRotateHandler=zo,e.TwoFingersTouchZoomHandler=ko,e.TwoFingersTouchZoomRotateHandler=qo,e.VectorTileSource=X,e.VideoSource=ie,e.addSourceType=(e,i)=>t._(void 0,void 0,void 0,function*(){if(oe(e))throw new Error(`A source type called "${e}" already exists.`);var t;t=i,re[e]=t}),e.clearPrewarmedResources=function(){const e=B;e&&e.isPreloaded()&&1===e.numActive()&&(e.release(D),B=null)},e.createTileMesh=ci,e.getMaxParallelImageRequests=function(){return t.c.MAX_PARALLEL_IMAGE_REQUESTS},e.getRTLTextPluginStatus=function(){return ce().getRTLTextPluginStatus()},e.getVersion=function(){return Ea},e.getWorkerCount=function(){return R.workerCount},e.getWorkerUrl=function(){return t.c.WORKER_URL},e.importScriptInWorkers=function(e){return V().broadcast("IS",e)},e.isTimeFrozen=function(){return l.isFrozen()},e.now=c,e.prewarm=function(){N().acquire(D)},e.restoreNow=function(){l.restoreNow()},e.setMaxParallelImageRequests=function(e){t.c.MAX_PARALLEL_IMAGE_REQUESTS=e},e.setNow=function(e){l.setNow(e)},e.setRTLTextPlugin=function(e,t){return ce().setRTLTextPlugin(e,t)},e.setWorkerCount=function(e){R.workerCount=e},e.setWorkerUrl=function(e){t.c.WORKER_URL=e}}),e}()),ue.exports);const de=n(he),pe={osm:'© <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors',swisstopo:'<a href="https://www.swisstopo.admin.ch" target="_blank">swisstopo</a>',combined:'<a href="https://www.swisstopo.admin.ch" target="_blank">swisstopo</a> | <a href="https://www.swissenergyplanning.ch/" target="_blank">©SEP</a>'};function fe(e){const t="light"===e?"rgb(32, 32, 32)":"rgb(220, 220, 220)",i="light"===e?"rgb(255, 255, 255)":"rgb(40, 40, 40)";return{version:8,name:`Swisstopo Vector ${e}`,sources:{"base_v1.0.0":{url:"https://vectortiles.geo.admin.ch/tiles/ch.swisstopo.base.vt/v1.0.0/tiles.json",type:"vector"}},glyphs:"https://vectortiles.geo.admin.ch/fonts/{fontstack}/{range}.pbf",sprite:"https://vectortiles.geo.admin.ch/styles/ch.swisstopo.lightbasemap_world.vt/sprite/sprite",layers:[{id:"place_village",type:"symbol",source:"base_v1.0.0","source-layer":"place",minzoom:7,maxzoom:18,layout:{"text-font":["Frutiger Neue Condensed Medium"],"text-size":["interpolate",["cubic-bezier",.5,.1,.7,1],["zoom"],4,11,10,["case",["<=",3e3,["get","population"]],16,14],16,["case",["<=",3e3,["get","population"]],28,24]],"text-field":["get","name:latin"],"text-justify":"auto","text-padding":10,"text-max-width":10,"text-letter-spacing":.025},paint:{"text-color":t,"text-halo-color":i,"text-halo-width":.9},filter:["==","class","village"]},{id:"place_town",type:"symbol",source:"base_v1.0.0","source-layer":"place",minzoom:6,maxzoom:16,layout:{"text-font":["Frutiger Neue Condensed Bold"],"text-size":["interpolate",["cubic-bezier",.5,.1,.7,1],["zoom"],4,11,16,["case",["<=",3e4,["get","population"]],32,28]],"text-field":["get","name:latin"],"text-justify":"auto","text-padding":10,"text-max-width":10,"text-transform":"uppercase","text-letter-spacing":.025},paint:{"text-color":t,"text-halo-color":i,"text-halo-width":.9},filter:["==","class","town"]},{id:"place_city",type:"symbol",source:"base_v1.0.0","source-layer":"place",minzoom:2,maxzoom:14,layout:{"text-font":["Frutiger Neue Condensed Bold"],"text-size":["interpolate",["cubic-bezier",.5,.1,.7,1],["zoom"],1,11,4,12,16,48],"text-field":["get","name:latin"],"text-anchor":"bottom-left","text-justify":"auto","text-padding":10,"text-max-width":10,"text-transform":"uppercase","text-letter-spacing":.025},paint:{"text-color":t,"text-halo-color":i,"text-halo-width":.9},filter:["==","class","city"]},{id:"water_name_label",type:"symbol",source:"base_v1.0.0","source-layer":"water_name",minzoom:7,maxzoom:24,layout:{"text-font":["Frutiger Neue Italic"],"text-size":["interpolate",["linear"],["zoom"],8,12,14,20],"text-field":"{name:latin}","text-rotate":["get","direction"],"text-padding":2,"text-max-width":20,"text-allow-overlap":!1,"text-pitch-alignment":"map"},paint:{"text-color":"light"===e?"rgb(39, 173, 250)":"rgb(30, 130, 200)","text-halo-color":"light"===e?"rgba(0, 0, 0, 0.6)":"rgba(255, 255, 255, 0.4)","text-halo-width":.5},filter:["all",["==","$type","Point"],["==","class","lake"]]},{id:"place_hamlet",type:"symbol",source:"base_v1.0.0","source-layer":"place",minzoom:11,maxzoom:24,layout:{"text-font":["Frutiger Neue Condensed Medium"],"text-size":["interpolate",["cubic-bezier",.5,.1,.7,1],["zoom"],4,6,16,18],"text-field":["get","name:latin"],"text-justify":"auto","text-padding":2,"text-max-width":10,"text-letter-spacing":.025},paint:{"text-color":t,"text-halo-color":i,"text-halo-width":.9,"text-opacity":["step",["zoom"],0,11,["case",[">",30,["get","rank"]],1,0],14,1]},filter:["in","class","hamlet","isolated_dwelling"]},{id:"glacier_label",type:"symbol",source:"base_v1.0.0","source-layer":"area_name",minzoom:12,layout:{"text-font":["Frutiger Neue Italic"],"text-size":["interpolate",["linear"],["zoom"],10,11,16,20],"text-field":"{name:latin}","symbol-placement":"line-center","text-keep-upright":!0,"text-letter-spacing":.15,"text-pitch-alignment":"map"},paint:{"text-color":"rgba(55, 146, 201, 1)","text-halo-color":"rgba(242, 242, 242, 0.6)","text-halo-width":.9},filter:["in","subclass","glacier"]}]}}const me={"osm-standard":{id:"osm-standard",name:"OpenStreetMap",description:"Standard OpenStreetMap tiles",config:{id:"osm-standard",name:"layers.osm.standard",type:"raster-tile",category:"base",url:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",subdomains:["a","b","c"],maxZoom:19,attribution:pe.osm}},"osm-humanitarian":{id:"osm-humanitarian",name:"OSM Humanitarian",description:"Humanitarian focused map style",config:{id:"osm-humanitarian",name:"layers.osm.humanitarian",type:"raster-tile",category:"base",url:"https://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png",subdomains:["a","b"],maxZoom:19,attribution:`${pe.osm} | Humanitarian OSM Team`}},"osm-topo":{id:"osm-topo",name:"OpenTopoMap",description:"Topographic map based on OSM",config:{id:"osm-topo",name:"layers.osm.topo",type:"raster-tile",category:"base",url:"https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png",subdomains:["a","b","c"],maxZoom:17,attribution:`${pe.osm} | OpenTopoMap`}},"swisstopo-color":{id:"swisstopo-color",name:"Swisstopo Color",description:"Official Swiss topographic map in color",config:{id:"swisstopo-color",name:"layers.swisstopo.color",type:"raster-tile",category:"base",url:"https://wmts.geo.admin.ch/1.0.0/ch.swisstopo.pixelkarte-farbe/default/current/3857/{z}/{x}/{y}.jpeg",maxZoom:21,maxNativeZoom:18,attribution:pe.combined}},"swisstopo-grey":{id:"swisstopo-grey",name:"Swisstopo Grey",description:"Official Swiss topographic map in greyscale",config:{id:"swisstopo-grey",name:"layers.swisstopo.grey",type:"raster-tile",category:"base",url:"https://wmts.geo.admin.ch/1.0.0/ch.swisstopo.pixelkarte-grau/default/current/3857/{z}/{x}/{y}.jpeg",maxZoom:21,maxNativeZoom:18,attribution:pe.combined}},"swisstopo-satellite":{id:"swisstopo-satellite",name:"Swisstopo Satellite",description:"Swiss aerial imagery (SWISSIMAGE)",config:{id:"swisstopo-satellite",name:"layers.swisstopo.satellite",type:"raster-tile",category:"base",url:"https://wmts.geo.admin.ch/1.0.0/ch.swisstopo.swissimage/default/current/3857/{z}/{x}/{y}.jpeg",maxZoom:21,maxNativeZoom:20,attribution:pe.combined}},"swisstopo-cadastral":{id:"swisstopo-cadastral",name:"Cadastral Survey",description:"Official cadastral survey data",config:{id:"swisstopo-cadastral",name:"layers.swisstopo.cadastral",type:"wms",category:"overlay",url:"https://wms.geo.admin.ch/",layers:"ch.swisstopo-vd.amtliche-vermessung",format:"image/png",transparent:!0,maxZoom:21,maxNativeZoom:18,minZoom:14,opacity:.8,attribution:pe.swisstopo}},"swisstopo-streets":{id:"swisstopo-streets",name:"Street Directory",description:"Official street names and numbers",config:{id:"swisstopo-streets",name:"layers.swisstopo.streets",type:"wms",category:"overlay",url:"https://wms.geo.admin.ch/",layers:"ch.swisstopo.amtliches-strassenverzeichnis",format:"image/png",transparent:!0,opacity:.6,maxZoom:21,maxNativeZoom:18,minZoom:17,attribution:pe.swisstopo}},"swisstopo-addresses":{id:"swisstopo-addresses",name:"Building Addresses",description:"Official building address points",config:{id:"swisstopo-addresses",name:"layers.swisstopo.addresses",type:"wms",category:"overlay",url:"https://wms.geo.admin.ch/",layers:"ch.swisstopo.amtliches-gebaeudeadressverzeichnis",format:"image/png",transparent:!0,maxZoom:21,maxNativeZoom:18,minZoom:18,attribution:pe.swisstopo}},"swisstopo-vector-light":{id:"swisstopo-vector-light",name:"Swisstopo Labels (Light)",description:"Vector tile labels for light backgrounds",config:{id:"swisstopo-vector-light",name:"layers.swisstopo.vectorLight",type:"vector-tile",category:"label",style:fe("light"),interactive:!1,zIndex:400}},"swisstopo-vector-dark":{id:"swisstopo-vector-dark",name:"Swisstopo Labels (Dark)",description:"Vector tile labels for dark backgrounds",config:{id:"swisstopo-vector-dark",name:"layers.swisstopo.vectorDark",type:"vector-tile",category:"label",style:fe("dark"),interactive:!1,zIndex:400}}};function ge(e){return"string"==typeof e?me[e]?.config:e}const _e={baseLayer:"swisstopo-satellite",overlays:["swisstopo-vector-light"],showLayerControl:!0,availableBaseLayers:["swisstopo-satellite","swisstopo-color","swisstopo-grey","osm-standard"],availableOverlays:["swisstopo-cadastral","swisstopo-streets","swisstopo-addresses"]};class ye{constructor(e={}){i(this,"map",null),i(this,"layers",new Map),i(this,"baseLayerId",null),i(this,"config"),this.config={..._e,...e}}initialize(e){this.map=e,this.config.baseLayer&&this.setBaseLayer(this.config.baseLayer),this.config.overlays&&this.config.overlays.forEach(e=>{this.addLayer(e)}),this.config.customLayers&&this.config.customLayers.forEach(e=>{this.addLayer(e)})}setBaseLayer(e){const t=ge(e);t&&(this.baseLayerId&&this.removeLayer(this.baseLayerId),t.zIndex=t.zIndex??1,this.addLayer(t),this.baseLayerId=t.id)}addLayer(e){if(!this.map)return;const t=ge(e);if(!t)return;if(this.layers.has(t.id))return;const i=this.createLayerInstance(t);i&&(this.layers.set(t.id,i),i.visible&&i.leafletLayer&&i.leafletLayer.addTo(this.map),i.visible&&i.maplibreLayer&&i.maplibreLayer.addTo(this.map))}removeLayer(e){const t=this.layers.get(e);t&&(t.leafletLayer&&this.map&&this.map.removeLayer(t.leafletLayer),t.maplibreLayer&&this.map&&this.map.removeLayer(t.maplibreLayer),this.layers.delete(e),this.baseLayerId===e&&(this.baseLayerId=null))}setLayerVisibility(e,t){const i=this.layers.get(e);i&&this.map&&(i.visible=t,t?(i.leafletLayer&&!this.map.hasLayer(i.leafletLayer)&&i.leafletLayer.addTo(this.map),i.maplibreLayer&&!this.map.hasLayer(i.maplibreLayer)&&i.maplibreLayer.addTo(this.map)):(i.leafletLayer&&this.map.hasLayer(i.leafletLayer)&&this.map.removeLayer(i.leafletLayer),i.maplibreLayer&&this.map.hasLayer(i.maplibreLayer)&&this.map.removeLayer(i.maplibreLayer)))}setLayerOpacity(e,t){const i=this.layers.get(e);i&&(i.config.opacity=t,i.leafletLayer&&"setOpacity"in i.leafletLayer&&i.leafletLayer.setOpacity(t))}isLayerVisible(e){return this.layers.get(e)?.visible??!1}getLayerIds(){return Array.from(this.layers.keys())}getLayerConfig(e){return this.layers.get(e)?.config}getBaseLayerId(){return this.baseLayerId}getAllLayers(){return Array.from(this.layers.values()).map(e=>e.config)}toggleLayer(e,t){const i=this.layers.get(e);if(!i)return;const n=void 0!==t?t:!i.visible;this.setLayerVisibility(e,n),this.config.onLayerVisibilityChange?.(e,n)}addCustomLayer(e){this.addLayer(e),this.config.onLayerAdd?.(e)}removeCustomLayer(e){const t=this.getLayerConfig(e);this.removeLayer(e),t&&this.config.onLayerRemove?.(t)}destroy(){this.layers.forEach((e,t)=>{this.removeLayer(t)}),this.map=null}createLayerInstance(e){switch(e.type){case"raster-tile":return this.createRasterTileLayer(e);case"wms":return this.createWMSLayer(e);case"vector-tile":return this.createVectorTileLayer(e);case"geojson":return this.createGeoJSONLayer(e);default:return null}}createRasterTileLayer(e){const t={minZoom:e.minZoom,maxZoom:e.maxZoom,maxNativeZoom:e.maxNativeZoom,attribution:e.attribution,opacity:e.opacity??1,tileSize:e.tileSize??256,subdomains:e.subdomains,detectRetina:e.retina};Object.keys(t).forEach(e=>{void 0===t[e]&&delete t[e]});return{config:e,leafletLayer:re.tileLayer(e.url,t),visible:!1!==e.visible}}createWMSLayer(e){const t={layers:e.layers,format:e.format??"image/png",transparent:e.transparent??!0,version:e.version??"1.3.0",minZoom:e.minZoom,maxZoom:e.maxZoom,attribution:e.attribution,opacity:e.opacity??1,...e.params};Object.keys(t).forEach(e=>{void 0===t[e]&&delete t[e]});return{config:e,leafletLayer:re.tileLayer.wms(e.url,t),visible:!1!==e.visible}}createVectorTileLayer(e){return{config:e,maplibreLayer:re.mapboxGL({style:e.style,interactive:e.interactive??!1,pane:"overlayPane"}),visible:!1!==e.visible}}createGeoJSONLayer(e){const t={color:e.style?.color??"#3388ff",weight:e.style?.weight??3,opacity:e.style?.opacity??1,fillColor:e.style?.fillColor??"#3388ff",fillOpacity:e.style?.fillOpacity??.2},i={style:()=>t,onEachFeature:e.onClick?(t,i)=>{i.on("click",()=>e.onClick?.(t))}:void 0};let n;return"string"==typeof e.data?(n=re.geoJSON(void 0,i),fetch(e.data).then(e=>e.json()).then(e=>n.addData(e)).catch(e=>{})):n=re.geoJSON(e.data,i),{config:e,leafletLayer:n,visible:!1!==e.visible}}}function ve({perimeterService:e,addressService:t,onPerimeterClick:i,onAddressClick:n,onMapReady:r,enableAddressClick:o=!1,enablePerimeterClick:a=!0}){const s=M.useRef(i),l=M.useRef(n),c=M.useRef(e),u=M.useRef(t),h=M.useRef(r);M.useEffect(()=>{s.current=i},[i]),M.useEffect(()=>{l.current=n},[n]),M.useEffect(()=>{c.current=e},[e]),M.useEffect(()=>{u.current=t},[t]),M.useEffect(()=>{h.current=r},[r]);const d=function(e){const t=oe();return M.useEffect(function(){return t.on(e),function(){t.off(e)}},[t,e]),t}({click:async e=>{const{lat:t,lng:i}=e.latlng;if(o&&u.current&&l.current)try{const e=await u.current.getByCoordinates(t,i);if(e)return void l.current(e)}catch(n){}if(a&&s.current)try{const e=await c.current.getClosest(t,i,.1);e&&s.current(e)}catch(n){}}});return M.useEffect(()=>{h.current?.(d)},[d]),null}function xe({layers:e}){const t=oe(),{setLayerManager:i}=H(),n=M.useRef(!1);return M.useEffect(()=>{n.current||(n.current=!0,e.initialize(t),i(e.layerManager))},[t,e.initialize,e.layerManager,i]),null}function be(){const e=oe(),{setMap:t}=Y();return M.useEffect(()=>(t(e),()=>{t(null)}),[e,t]),null}function we({attribution:e}){const t=oe();return M.useEffect(()=>{if(!t.attributionControl)return;if(e)if("string"==typeof e)t.attributionControl.setPrefix(""),t.attributionControl.setPosition("bottomleft"),t.attributionControl.addAttribution(e);else{const i=e.position||"bottomleft",n=void 0===e.prefix?"":e.prefix;t.attributionControl.setPosition(i),!1===n?t.attributionControl.setPrefix(""):t.attributionControl.setPrefix(n),t.attributionControl.addAttribution(e.text)}else t.attributionControl.setPrefix(""),t.attributionControl.setPosition("bottomleft"),t.attributionControl.addAttribution('<a href="https://www.swisstopo.admin.ch" target="_blank">swisstopo</a> | <a href="https://www.bfe.admin.ch/bfe/de/home.html" target="_blank">BFE</a> | <a href="https://www.cadastre.ch/de" target="_blank">Amtliche Vermessung Schweiz / FL</a> | <a href="https://www.swissenergyplanning.ch/impressum" target="_blank">Impressum</a> | <a href="https://www.swissenergyplanning.ch/" target="_blank">©SEP</a> by <a href="https://geoimpact.ch/" target="_blank">geoimpact</a>');return()=>{}},[t,e]),null}const Te=M.memo(function({onReady:e,onPerimeterClick:t,onAddressClick:i,layersConfig:n,showLayerControl:r=!0,layerControlPosition:o,children:a}){const{config:s,services:l}=H(),c=o||s.ui?.layerControlPosition||"top-right",u=function(e={}){const{config:t,onLayerChange:i}=e,n=M.useRef(null),[r,o]=M.useState(null),[a,s]=M.useState({}),l=M.useMemo(()=>(t?.availableBaseLayers||["swisstopo-satellite","swisstopo-color","swisstopo-grey","osm-standard"]).map(e=>"string"==typeof e?me[e]:{id:e.id,name:e.name,config:e}).filter(Boolean),[t?.availableBaseLayers]),c=M.useMemo(()=>(t?.availableOverlays||["swisstopo-cadastral","swisstopo-streets","swisstopo-addresses","swisstopo-vector-light"]).map(e=>"string"==typeof e?me[e]:{id:e.id,name:e.name,config:e}).filter(Boolean),[t?.availableOverlays]),u=M.useCallback(e=>{const i=new ye(t);i.initialize(e),n.current=i;const r=i.getBaseLayerId();o(r);const a={};c.forEach(e=>{a[e.id]=i.isLayerVisible(e.id)}),s(a)},[t,c]),h=M.useCallback(e=>{if(!n.current)return;n.current.setBaseLayer(e);const t="string"==typeof e?e:e.id;o(t),i?.(t,!0)},[i]),d=M.useCallback(e=>{if(!n.current)return;const t=!a[e];n.current.getLayerConfig(e)||n.current.addLayer(e),n.current.setLayerVisibility(e,t),s(i=>({...i,[e]:t})),i?.(e,t)},[a,i]),p=M.useCallback((e,t)=>{n.current&&(n.current.getLayerConfig(e)||n.current.addLayer(e),n.current.setLayerVisibility(e,t),s(i=>({...i,[e]:t})),i?.(e,t))},[i]),f=M.useCallback(e=>{n.current&&(n.current.addLayer(e),"overlay"===e.category&&s(t=>({...t,[e.id]:!1!==e.visible})))},[]),m=M.useCallback(e=>{n.current&&(n.current.removeLayer(e),s(t=>{const i={...t};return delete i[e],i}))},[]),g=M.useCallback((e,t)=>{n.current&&n.current.setLayerOpacity(e,t)},[]);return M.useEffect(()=>()=>{n.current?.destroy(),n.current=null},[]),{layerManager:n.current,initialize:u,baseLayerId:r,setBaseLayer:h,availableBaseLayers:l,overlayStates:a,toggleOverlay:d,setOverlayVisibility:p,availableOverlays:c,addCustomLayer:f,removeLayer:m,setOpacity:g}}({config:n,onLayerChange:(e,t)=>{}}),h=s.map||{};return A.jsxs("div",{className:"sep-map-view",children:[A.jsxs(se,{center:h.center||[46.8,8.2],zoom:h.zoom||8,minZoom:h.minZoom||7,maxZoom:h.maxZoom||21,maxBounds:h.maxBounds||[[45.817995,5.95608],[47.808455,10.49203]],zoomControl:!1,doubleClickZoom:!1,attributionControl:!0,preferCanvas:!0,className:"sep-map-view__container",children:[A.jsx(be,{}),A.jsx(we,{attribution:h.attribution}),A.jsx(xe,{layers:u}),A.jsx(ve,{perimeterService:l.perimeter,addressService:l.address,onPerimeterClick:t,onAddressClick:i,onMapReady:e,enableAddressClick:!0===s.features?.mapClickSelect,enablePerimeterClick:!1!==s.features?.perimeterSelection}),a]}),r&&u.layerManager&&A.jsx(le,{layers:u,position:c})]})});class Se extends re.Layer{constructor(e){super(e),i(this,"options"),i(this,"_map",null),i(this,"_container",null),i(this,"_glMap",null),i(this,"_glMapCanvas",null),i(this,"_throttledUpdate",null),i(this,"_zooming",!1),i(this,"_offset",re.point(0,0)),this.options={updateInterval:32,padding:.1,interactive:!1,pane:"tilePane",...e}}initialize(e){re.setOptions(this,e)}onAdd(e){this._container||this._initContainer(),this._map=e;const t=this.getPaneName();return e.getPane(t)?.appendChild(this._container),this._initGL(),this._offset=this._map.containerPointToLayerPoint([0,0]),this._throttledUpdate=re.Util.throttle(this._update,this.options.updateInterval,this),e.options.zoomAnimation&&re.DomEvent.on(e._proxy,re.DomUtil.TRANSITION_END,this._transitionEnd,this),e.on("move",this._throttledUpdate,this),e.on("zoomanim",this._animateZoom,this),e.on("zoom",this._pinchZoom,this),e.on("zoomstart",this._zoomStart,this),e.on("zoomend",this._zoomEnd,this),e.on("resize",this._resize,this),this}onRemove(e){this._map&&this._map._proxy&&this._map.options.zoomAnimation&&re.DomEvent.off(this._map._proxy,re.DomUtil.TRANSITION_END,this._transitionEnd,this);const t=this.getPaneName(),i=e.getPane(t);return i&&this._container&&i.removeChild(this._container),this._glMap&&(this._glMap.remove(),this._glMap=null),this._throttledUpdate&&e.off("move",this._throttledUpdate,this),e.off("zoomanim",this._animateZoom,this),e.off("zoom",this._pinchZoom,this),e.off("zoomstart",this._zoomStart,this),e.off("zoomend",this._zoomEnd,this),e.off("resize",this._resize,this),this._container=null,this._map=null,this}getEvents(){return{}}getMapboxMap(){return this._glMap}getCanvas(){return this._glMap?this._glMap.getCanvas():null}getSize(){return this._map?this._map.getSize().multiplyBy(1+2*(this.options.padding||0)):re.point(0,0)}getBounds(){if(!this._map)return re.latLngBounds(re.latLng(0,0),re.latLng(0,0));const e=this.getSize().multiplyBy(.5),t=this._map.latLngToContainerPoint(this._map.getCenter());return re.latLngBounds(this._map.containerPointToLatLng(t.subtract(e)),this._map.containerPointToLatLng(t.add(e)))}getContainer(){return this._container}getPaneName(){return this._map&&this._map.getPane(this.options.pane)?this.options.pane:"tilePane"}_initContainer(){const e=this._container=re.DomUtil.create("div","leaflet-gl-layer");if(!this._map)return;const t=this.getSize(),i=this._map.getSize().multiplyBy(this.options.padding||0);e.style.width=t.x+"px",e.style.height=t.y+"px";const n=this._map.containerPointToLayerPoint([0,0]).subtract(i);re.DomUtil.setPosition(e,n)}_initGL(){if(!this._map||!this._container)return;const e=this._map.getCenter(),t={...this.options,container:this._container,center:[e.lng,e.lat],zoom:this._map.getZoom()-1,attributionControl:!1,interactive:this.options.interactive,trackResize:!1,style:this.options.style};this._map.scrollWheelZoom&&(t.scrollZoom=!1),this._glMap?(this._glMap.setCenter(t.center),this._glMap.setZoom(t.zoom),this._glMap.setStyle(t.style)):this._glMap=new de.Map(t),this._glMapCanvas=this._glMap.getCanvas(),re.DomUtil.addClass(this._glMapCanvas,"leaflet-image-layer"),re.DomUtil.addClass(this._glMapCanvas,"leaflet-zoom-animated"),this.options.interactive&&re.DomUtil.addClass(this._glMapCanvas,"leaflet-interactive"),this.options.className&&re.DomUtil.addClass(this._glMapCanvas,this.options.className)}_update(e){if(!this._map||!this._glMap||!this._container)return;if(this._offset=this._map.containerPointToLayerPoint([0,0]),this._zooming)return;const t=this.getSize(),i=this._map.getSize().multiplyBy(this.options.padding||0),n=this._map.containerPointToLayerPoint([0,0]).subtract(i);re.DomUtil.setPosition(this._container,n),this._transformGL(this._glMap);const r=Math.round(t.x),o=Math.round(t.y);this._glMap.transform.width!==r||this._glMap.transform.height!==o?(this._container.style.width=r+"px",this._container.style.height=o+"px",this._glMap.resize()):this._glMap.triggerRepaint()}_transformGL(e){if(!this._map)return;const t=this._map.getCenter();e.jumpTo({center:[t.lng,t.lat],zoom:this._map.getZoom()-1})}_pinchZoom(e){this._map&&this._glMap&&this._glMap.jumpTo({zoom:this._map.getZoom()-1,center:[this._map.getCenter().lng,this._map.getCenter().lat]})}_animateZoom(e){if(!this._map||!this._glMapCanvas||!this._container)return;const t=e,i=this._map.getZoomScale(t.zoom,this._map.getZoom()),n=this._map.getSize().multiplyBy((this.options.padding||0)*i),r=this.getSize().divideBy(2),o=this._map.project(t.center,t.zoom).subtract(r).add(this._map._getMapPanePos()).add(n),a=this._map.getBounds(),s=this._map.project(a.getNorthWest(),t.zoom).subtract(o);re.DomUtil.setTransform(this._glMapCanvas,s.subtract(this._offset||re.point(0,0)),i)}_zoomStart(e){this._zooming=!0}_zoomEnd(e){if(!this._map||!this._glMapCanvas||!this._container)return;const t=this._map.containerPointToLayerPoint([0,0]).subtract(this._map.getSize().multiplyBy(this.options.padding||0));re.DomUtil.setPosition(this._container,t),re.DomUtil.setTransform(this._glMapCanvas,re.point(0,0),1),this._zooming=!1,this._update()}_transitionEnd(e){this._map&&this._glMap&&re.Util.requestAnimFrame(()=>{if(!this._map||!this._glMap)return;const e=this._map.getZoom(),t=this._map.getCenter();this._glMapCanvas&&re.DomUtil.setTransform(this._glMapCanvas,re.point(0,0),1),this._glMap.jumpTo({center:[t.lng,t.lat],zoom:e-1}),this._zooming=!1,this._update()})}_resize(e){if(!this._map||!this._glMap||!this._container)return;const t=this.getSize(),i=this._map.getSize().multiplyBy(this.options.padding||0);this._container.style.width=t.x+"px",this._container.style.height=t.y+"px";const n=this._map.containerPointToLayerPoint([0,0]).subtract(i);re.DomUtil.setPosition(this._container,n),this._glMap.resize(),this._update()}}function Pe(){const e=oe(),{selectionStore:t,config:i}=H(),n=M.useMemo(()=>{return e=i.ui?.marker,e?.iconUrl?re.icon({iconUrl:e.iconUrl,iconSize:e.iconSize||[25,41],iconAnchor:e.iconAnchor||[12,41],popupAnchor:e.popupAnchor||[1,-34],shadowUrl:e.shadowUrl,shadowSize:e.shadowSize,shadowAnchor:e.shadowAnchor,className:e.className}):new re.Icon.Default;var e},[i.ui?.marker]);return M.useEffect(()=>{const i=re.layerGroup().addTo(e),r=t.subscribe(e=>e.items,()=>{i.clearLayers();t.getState().getAll().forEach(e=>{"address"===e.type?re.marker(e.data.coordinates,{icon:n}).addTo(i):e.type})});return()=>{r(),i.remove()}},[e,t,n]),null}re.MapboxGL=Se,re.mapboxGL=function(e){return new Se(e)};const Me=M.forwardRef(function(e,t){const{onAddressSelected:i,onPerimeterSelected:n,onSelectionChanged:r,onReady:o,onError:a}=e,{config:s,services:l,selectionStore:c,layerManager:u}=H(),{map:h,setMap:d}=Y();M.useImperativeHandle(t,()=>({selectAddress:async e=>{try{const t="number"==typeof e?await l.address.getById(e):e;return t&&(c.getState().add({type:"address",data:t}),h&&h.flyTo(t.coordinates,16,s.map?.flyTo)),t}catch(t){return a?.({type:"selectAddress",message:t.message}),null}},selectPerimeter:async e=>{try{const t="string"==typeof e?await l.perimeter.getById(e):e;return t&&(c.getState().add({type:"perimeter",data:t}),h&&h.flyTo(t.centroid,14,s.map?.flyTo)),t}catch(t){return a?.({type:"selectPerimeter",message:t.message}),null}},getSelection:()=>c.getState().getAll(),clearSelection:()=>c.getState().clear(),addToSelection:e=>{const t="street"in e?{type:"address",data:e}:{type:"perimeter",data:e};return c.getState().add(t)},removeFromSelection:e=>{c.getState().remove(String(e))},flyTo:(e,t,i,n)=>{const r={...s.map?.flyTo,...n};h?.flyTo([e,t],i,r)},fitBounds:e=>{h?.fitBounds(e)},startPolygonDraw:()=>{},cancelPolygonDraw:()=>{},getLeafletMap:()=>h,addLayer:e=>{u?.addCustomLayer(e)},addWMSLayer:e=>{const t={id:e.id,name:e.name,type:"wms",category:"overlay",url:e.url,layers:e.layers,format:e.format||"image/png",transparent:e.transparent??!0,visible:e.visible??!0,opacity:e.opacity,minZoom:e.minZoom,maxZoom:e.maxZoom,attribution:e.attribution,params:e.params};u?.addCustomLayer(t)},addTileLayer:e=>{const t={id:e.id,name:e.name,type:"raster-tile",category:"overlay",url:e.url,visible:e.visible??!0,maxZoom:e.maxZoom,minZoom:e.minZoom,subdomains:e.subdomains,attribution:e.attribution,opacity:e.opacity};u?.addCustomLayer(t)},addGeoJSONLayer:e=>{const t={id:e.id,name:e.name,type:"geojson",category:"overlay",data:e.data,visible:e.visible??!0,style:e.style,cluster:e.cluster,onClick:e.onClick};u?.addCustomLayer(t)},removeLayer:e=>{u?.removeCustomLayer(e)},toggleLayer:(e,t)=>{u?.toggleLayer(e,t)},getLayers:()=>u?.getAllLayers()??[],getLayer:e=>u?.getLayerConfig(e)}),[h,l,c,u,a]),M.useEffect(()=>{if(!r)return;return c.subscribe(e=>{r(e.getAll())})},[c,r]);const p=M.useCallback(e=>{c.getState().add({type:"address",data:e}),i?.(e),h&&h.flyTo(e.coordinates,17,s.map?.flyTo)},[c,i,h]),f=M.useCallback(e=>{c.getState().add({type:"perimeter",data:e}),n?.(e)},[c,n]),m=M.useCallback(e=>{d(e),o?.(e)},[d,o]);return A.jsxs("div",{className:"sep-map-root",children:[s.features?.addressSearch&&A.jsx(J,{onSelect:p,onPerimeterSelect:f,placement:s.ui?.searchPlacement||"top-left",includePerimeters:!0,autoFocus:!1,className:s.ui?.search?.className,placeholder:s.ui?.search?.placeholder,style:{...s.ui?.search?.style,...s.ui?.search?.width?{"--sep-search-width":s.ui.search.width}:{}}}),A.jsx(Te,{onReady:m,onPerimeterClick:f,onAddressClick:p,showLayerControl:s.ui?.showLayerControl,layersConfig:s.map?.layers,children:A.jsx(Pe,{})})]})});class Ee{constructor(e){i(this,"root",null),i(this,"mapRef"),i(this,"config"),i(this,"events",new Map),i(this,"shadowRoot",null),i(this,"i18n"),i(this,"services"),this.config=this.normalizeConfig(e),this.mapRef=M.createRef(),this.i18n=new R(this.config.language);const t=this.config.apiUrl??"https://services.swissenergyplanning.ch",n=this.config.clientId||"unknown",r=this.config.token||"";this.services={address:new F(t,r),perimeter:new O(t,r),config:new N(t,n)},e.container&&this.mount(e.container)}normalizeConfig(e){return{...e,features:{addressSearch:!0,perimeterSelection:!0,...e.features},map:{center:[46.8,8.2],zoom:8,minZoom:7,maxZoom:21,...e.map}}}mount(e){const t="string"==typeof e?document.querySelector(e):e;if(!t)throw new Error(`[SEPMap] Container not found: ${e}`);return this.root||(!1!==this.config.useShadowDom&&t.attachShadow?(t.shadowRoot?(this.shadowRoot=t.shadowRoot,this.shadowRoot.innerHTML=""):this.shadowRoot=t.attachShadow({mode:"open"}),function(e,t){const i=document.createElement("style");i.textContent=`\n /* CSS Variables */\n :root{--sep-primary: #0066cc;--sep-primary-hover: #0052a3;--sep-text: #333333;--sep-text-secondary: #666666;--sep-text-muted: #999999;--sep-bg: #ffffff;--sep-bg-secondary: #f5f5f5;--sep-bg-hover: #f0f0f0;--sep-border: #dddddd;--sep-border-focus: rgba(0, 102, 204, .4);--sep-space-xs: 4px;--sep-space-sm: 8px;--sep-space-md: 16px;--sep-space-lg: 24px;--sep-space-xl: 32px;--sep-radius: 4px;--sep-radius-sm: 2px;--sep-radius-lg: 8px;--sep-shadow: 0 1px 3px rgba(0, 0, 0, .1);--sep-shadow-md: 0 4px 6px rgba(0, 0, 0, .1);--sep-shadow-lg: 0 8px 16px rgba(0, 0, 0, .1);--sep-z-map: 1;--sep-z-overlay: 100;--sep-z-controls: 1000;--sep-z-search: 1500;--sep-z-popup: 2000;--sep-z-modal: 3000;--sep-font-size-sm: .875rem;--sep-font-size-md: 1rem;--sep-font-size-lg: 1.125rem;--sep-chip-address-bg: #e6f4dd;--sep-chip-address-text: #5c9429;--sep-chip-address-border: #99d066;--sep-chip-parcel-bg: #e1f0fa;--sep-chip-parcel-text: #0b5a8e;--sep-chip-parcel-border: #0e72b5;--sep-chip-region-bg: #e8f5e9;--sep-chip-region-text: #388e3c;--sep-chip-region-border: #689f38;--sep-chip-egid-bg: #fff3e0;--sep-chip-egid-text: #e65100;--sep-chip-egid-border: #ff9800;--sep-chip-egrid-bg: #f3e5f5;--sep-chip-egrid-text: #7b1fa2;--sep-chip-egrid-border: #9c27b0}\n\n /* Global Styles */\n :root{--sep-primary: #0066cc;--sep-primary-hover: #0052a3;--sep-secondary: #6c757d;--sep-success: #28a745;--sep-danger: #dc3545;--sep-warning: #ffc107;--sep-bg: #ffffff;--sep-bg-secondary: #f8f9fa;--sep-bg-hover: #e9ecef;--sep-text: #212529;--sep-text-secondary: #6c757d;--sep-text-muted: #adb5bd;--sep-border: #dee2e6;--sep-border-focus: #80bdff;--sep-shadow-sm: 0 1px 2px rgba(0, 0, 0, .05);--sep-shadow: 0 2px 4px rgba(0, 0, 0, .1);--sep-shadow-lg: 0 4px 12px rgba(0, 0, 0, .15);--sep-radius-sm: 4px;--sep-radius: 6px;--sep-radius-lg: 8px;--sep-space-xs: 4px;--sep-space-sm: 8px;--sep-space-md: 16px;--sep-space-lg: 24px;--sep-space-xl: 32px;--sep-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;--sep-font-size-sm: .875rem;--sep-font-size: 1rem;--sep-font-size-lg: 1.125rem;--sep-z-map: 1;--sep-z-controls: 100;--sep-z-search: 200;--sep-z-dropdown: 300;--sep-z-modal: 400}[data-theme=dark]{--sep-bg: #1a1a2e;--sep-bg-secondary: #252542;--sep-bg-hover: #333355;--sep-text: #e9ecef;--sep-text-secondary: #adb5bd;--sep-border: #444466}\n\n /* Leaflet Core Styles */\n .leaflet-pane,.leaflet-tile,.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-tile-container,.leaflet-pane>svg,.leaflet-pane>canvas,.leaflet-zoom-box,.leaflet-image-layer,.leaflet-layer{position:absolute;left:0;top:0}.leaflet-container{overflow:hidden}.leaflet-tile,.leaflet-marker-icon,.leaflet-marker-shadow{-webkit-user-select:none;-moz-user-select:none;user-select:none;-webkit-user-drag:none}.leaflet-tile::selection{background:transparent}.leaflet-safari .leaflet-tile{image-rendering:-webkit-optimize-contrast}.leaflet-safari .leaflet-tile-container{width:1600px;height:1600px;-webkit-transform-origin:0 0}.leaflet-marker-icon,.leaflet-marker-shadow{display:block}.leaflet-container .leaflet-overlay-pane svg{max-width:none!important;max-height:none!important}.leaflet-container .leaflet-marker-pane img,.leaflet-container .leaflet-shadow-pane img,.leaflet-container .leaflet-tile-pane img,.leaflet-container img.leaflet-image-layer,.leaflet-container .leaflet-tile{max-width:none!important;max-height:none!important;width:auto;padding:0}.leaflet-container img.leaflet-tile{mix-blend-mode:plus-lighter}.leaflet-container.leaflet-touch-zoom{-ms-touch-action:pan-x pan-y;touch-action:pan-x pan-y}.leaflet-container.leaflet-touch-drag{-ms-touch-action:pinch-zoom;touch-action:none;touch-action:pinch-zoom}.leaflet-container.leaflet-touch-drag.leaflet-touch-zoom{-ms-touch-action:none;touch-action:none}.leaflet-container{-webkit-tap-highlight-color:transparent}.leaflet-container a{-webkit-tap-highlight-color:rgba(51,181,229,.4)}.leaflet-tile{filter:inherit;visibility:hidden}.leaflet-tile-loaded{visibility:inherit}.leaflet-zoom-box{width:0;height:0;-moz-box-sizing:border-box;box-sizing:border-box;z-index:800}.leaflet-overlay-pane svg{-moz-user-select:none}.leaflet-pane{z-index:400}.leaflet-tile-pane{z-index:200}.leaflet-overlay-pane{z-index:400}.leaflet-shadow-pane{z-index:500}.leaflet-marker-pane{z-index:600}.leaflet-tooltip-pane{z-index:650}.leaflet-popup-pane{z-index:700}.leaflet-map-pane canvas{z-index:100}.leaflet-map-pane svg{z-index:200}.leaflet-vml-shape{width:1px;height:1px}.lvml{behavior:url(#default#VML);display:inline-block;position:absolute}.leaflet-control{position:relative;z-index:800;pointer-events:visiblePainted;pointer-events:auto}.leaflet-top,.leaflet-bottom{position:absolute;z-index:1000;pointer-events:none}.leaflet-top{top:0}.leaflet-right{right:0}.leaflet-bottom{bottom:0}.leaflet-left{left:0}.leaflet-control{float:left;clear:both}.leaflet-right .leaflet-control{float:right}.leaflet-top .leaflet-control{margin-top:10px}.leaflet-bottom .leaflet-control{margin-bottom:10px}.leaflet-left .leaflet-control{margin-left:10px}.leaflet-right .leaflet-control{margin-right:10px}.leaflet-fade-anim .leaflet-popup{opacity:0;-webkit-transition:opacity .2s linear;-moz-transition:opacity .2s linear;transition:opacity .2s linear}.leaflet-fade-anim .leaflet-map-pane .leaflet-popup{opacity:1}.leaflet-zoom-animated{-webkit-transform-origin:0 0;-ms-transform-origin:0 0;transform-origin:0 0}svg.leaflet-zoom-animated{will-change:transform}.leaflet-zoom-anim .leaflet-zoom-animated{-webkit-transition:-webkit-transform .25s cubic-bezier(0,0,.25,1);-moz-transition:-moz-transform .25s cubic-bezier(0,0,.25,1);transition:transform .25s cubic-bezier(0,0,.25,1)}.leaflet-zoom-anim .leaflet-tile,.leaflet-pan-anim .leaflet-tile{-webkit-transition:none;-moz-transition:none;transition:none}.leaflet-zoom-anim .leaflet-zoom-hide{visibility:hidden}.leaflet-interactive{cursor:pointer}.leaflet-grab{cursor:-webkit-grab;cursor:-moz-grab;cursor:grab}.leaflet-crosshair,.leaflet-crosshair .leaflet-interactive{cursor:crosshair}.leaflet-popup-pane,.leaflet-control{cursor:auto}.leaflet-dragging .leaflet-grab,.leaflet-dragging .leaflet-grab .leaflet-interactive,.leaflet-dragging .leaflet-marker-draggable{cursor:move;cursor:-webkit-grabbing;cursor:-moz-grabbing;cursor:grabbing}.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-image-layer,.leaflet-pane>svg path,.leaflet-tile-container{pointer-events:none}.leaflet-marker-icon.leaflet-interactive,.leaflet-image-layer.leaflet-interactive,.leaflet-pane>svg path.leaflet-interactive,svg.leaflet-image-layer.leaflet-interactive path{pointer-events:visiblePainted;pointer-events:auto}.leaflet-container{background:#ddd;outline-offset:1px}.leaflet-container a{color:#0078a8}.leaflet-zoom-box{border:2px dotted #38f;background:#ffffff80}.leaflet-container{font-family:Helvetica Neue,Arial,Helvetica,sans-serif;font-size:12px;font-size:.75rem;line-height:1.5}.leaflet-bar{box-shadow:0 1px 5px #000000a6;border-radius:4px}.leaflet-bar a{background-color:#fff;border-bottom:1px solid #ccc;width:26px;height:26px;line-height:26px;display:block;text-align:center;text-decoration:none;color:#000}.leaflet-bar a,.leaflet-control-layers-toggle{background-position:50% 50%;background-repeat:no-repeat;display:block}.leaflet-bar a:hover,.leaflet-bar a:focus{background-color:#f4f4f4}.leaflet-bar a:first-child{border-top-left-radius:4px;border-top-right-radius:4px}.leaflet-bar a:last-child{border-bottom-left-radius:4px;border-bottom-right-radius:4px;border-bottom:none}.leaflet-bar a.leaflet-disabled{cursor:default;background-color:#f4f4f4;color:#bbb}.leaflet-touch .leaflet-bar a{width:30px;height:30px;line-height:30px}.leaflet-touch .leaflet-bar a:first-child{border-top-left-radius:2px;border-top-right-radius:2px}.leaflet-touch .leaflet-bar a:last-child{border-bottom-left-radius:2px;border-bottom-right-radius:2px}.leaflet-control-zoom-in,.leaflet-control-zoom-out{font:700 18px Lucida Console,Monaco,monospace;text-indent:1px}.leaflet-touch .leaflet-control-zoom-in,.leaflet-touch .leaflet-control-zoom-out{font-size:22px}.leaflet-control-layers{box-shadow:0 1px 5px #0006;background:#fff;border-radius:5px}.leaflet-control-layers-toggle{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAQAAAADQ4RFAAACf0lEQVR4AY1UM3gkARTePdvdoTxXKc+qTl3aU5U6b2Kbkz3Gtq3Zw6ziLGNPzrYx7946Tr6/ee/XeCQ4D3ykPtL5tHno4n0d/h3+xfuWHGLX81cn7r0iTNzjr7LrlxCqPtkbTQEHeqOrTy4Yyt3VCi/IOB0v7rVC7q45Q3Gr5K6jt+3Gl5nCoDD4MtO+j96Wu8atmhGqcNGHObuf8OM/x3AMx38+4Z2sPqzCxRFK2aF2e5Jol56XTLyggAMTL56XOMoS1W4pOyjUcGGQdZxU6qRh7B9Zp+PfpOFlqt0zyDZckPi1ttmIp03jX8gyJ8a/PG2yutpS/Vol7peZIbZcKBAEEheEIAgFbDkz5H6Zrkm2hVWGiXKiF4Ycw0RWKdtC16Q7qe3X4iOMxruonzegJzWaXFrU9utOSsLUmrc0YjeWYjCW4PDMADElpJSSQ0vQvA1Tm6/JlKnqFs1EGyZiFCqnRZTEJJJiKRYzVYzJck2Rm6P4iH+cmSY0YzimYa8l0EtTODFWhcMIMVqdsI2uiTvKmTisIDHJ3od5GILVhBCarCfVRmo4uTjkhrhzkiBV7SsaqS+TzrzM1qpGGUFt28pIySQHR6h7F6KSwGWm97ay+Z+ZqMcEjEWebE7wxCSQwpkhJqoZA5ivCdZDjJepuJ9IQjGGUmuXJdBFUygxVqVsxFsLMbDe8ZbDYVCGKxs+W080max1hFCarCfV+C1KATwcnvE9gRRuMP2prdbWGowm1KB1y+zwMMENkM755cJ2yPDtqhTI6ED1M/82yIDtC/4j4BijjeObflpO9I9MwXTCsSX8jWAFeHr05WoLTJ5G8IQVS/7vwR6ohirYM7f6HzYpogfS3R2OAAAAAElFTkSuQmCC);width:36px;height:36px}.leaflet-retina .leaflet-control-layers-toggle{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADQAAAA0CAQAAABvcdNgAAAEsklEQVR4AWL4TydIhpZK1kpWOlg0w3ZXP6D2soBtG42jeI6ZmQTHzAxiTbSJsYLjO9HhP+WOmcuhciVnmHVQcJnp7DFvScowZorad/+V/fVzMdMT2g9Cv9guXGv/7pYOrXh2U+RRR3dSd9JRx6bIFc/ekqHI29JC6pJ5ZEh1yWkhkbcFeSjxgx3L2m1cb1C7bceyxA+CNjT/Ifff+/kDk2u/w/33/IeCMOSaWZ4glosqT3DNnNZQ7Cs58/3Ce5HL78iZH/vKVIaYlqzfdLu8Vi7dnvUbEza5Idt36tquZFldl6N5Z/POLof0XLK61mZCmJSWjVF9tEjUluu74IUXvgttuVIHE7YxSkaYhJZam7yiM9Pv82JYfl9nptxZaxMJE4YSPty+vF0+Y2up9d3wwijfjZbabqm/3bZ9ecKHsiGmRflnn1MW4pjHf9oLufyn2z3y1D6n8g8TZhxyzipLNPnAUpsOiuWimg52psrTZYnOWYNDTMuWBWa0tJb4rgq1UvmutpaYEbZlwU3CLJm/ayYjHW5/h7xWLn9Hh1vepDkyf7dE7MtT5LR4e7yYpHrkhOUpEfssBLq2pPhAqoSWKUkk7EDqkmK6RrCEzqDjhNDWNE+XSMvkJRDWlZTmCW0l0PHQGRZY5t1L83kT0Y3l2SItk5JAWHl2dCOBm+fPu3fo5/3v61RMCO9Jx2EEYYhb0rmNQMX/vm7gqOEJLcXTGw3CAuRNeyaPWwjR8PRqKQ1PDA/dpv+on9Shox52WFnx0KY8onHayrJzm87i5h9xGw/tfkev0jGsQizqezUKjk12hBMKJ4kbCqGPVNXudyyrShovGw5CgxsRICxF6aRmSjlBnHRzg7Gx8fKqEubI2rahQYdR1YgDIRQO7JvQyD52hoIQx0mxa0ODtW2Iozn1le2iIRdzwWewedyZzewidueOGqlsn1MvcnQpuVwLGG3/IR1hIKxCjelIDZ8ldqWz25jWAsnldEnK0Zxro19TGVb2ffIZEsIO89EIEDvKMPrzmBOQcKQ+rroye6NgRRxqR4U8EAkz0CL6uSGOm6KQCdWjvjRiSP1BPalCRS5iQYiEIvxuBMJEWgzSoHADcVMuN7IuqqTeyUPq22qFimFtxDyBBJEwNyt6TM88blFHao/6tWWhuuOM4SAK4EI4QmFHA+SEyWlp4EQoJ13cYGzMu7yszEIBOm2rVmHUNqwAIQabISNMRstmdhNWcFLsSm+0tjJH1MdRxO5Nx0WDMhCtgD6OKgZeljJqJKc9po8juskR9XN0Y1lZ3mWjLR9JCO1jRDMd0fpYC2VnvjBSEFg7wBENc0R9HFlb0xvF1+TBEpF68d+DHR6IOWVv2BECtxo46hOFUBd/APU57WIoEwJhIi2CdpyZX0m93BZicktMj1AS9dClteUFAUNUIEygRZCtik5zSxI9MubTBH1GOiHsiLJ3OCoSZkILa9PxiN0EbvhsAo8tdAf9Seepd36lGWHmtNANTv5Jd0z4QYyeo/UEJqxKRpg5LZx6btLPsOaEmdMyxYdlc8LMaJnikDlhclqmPiQnTEpLUIZEwkRagjYkEibQErwhkTAKCLQEbUgkzJQWc/0PstHHcfEdQ+UAAAAASUVORK5CYII=);background-size:26px 26px}.leaflet-touch .leaflet-control-layers-toggle{width:44px;height:44px}.leaflet-control-layers .leaflet-control-layers-list,.leaflet-control-layers-expanded .leaflet-control-layers-toggle{display:none}.leaflet-control-layers-expanded .leaflet-control-layers-list{display:block;position:relative}.leaflet-control-layers-expanded{padding:6px 10px 6px 6px;color:#333;background:#fff}.leaflet-control-layers-scrollbar{overflow-y:scroll;overflow-x:hidden;padding-right:5px}.leaflet-control-layers-selector{margin-top:2px;position:relative;top:1px}.leaflet-control-layers label{display:block;font-size:13px;font-size:1.08333em}.leaflet-control-layers-separator{height:0;border-top:1px solid #ddd;margin:5px -10px 5px -6px}.leaflet-default-icon-path{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAApCAYAAADAk4LOAAAFgUlEQVR4Aa1XA5BjWRTN2oW17d3YaZtr2962HUzbDNpjszW24mRt28p47v7zq/bXZtrp/lWnXr337j3nPCe85NcypgSFdugCpW5YoDAMRaIMqRi6aKq5E3YqDQO3qAwjVWrD8Ncq/RBpykd8oZUb/kaJutow8r1aP9II0WmLKLIsJyv1w/kqw9Ch2MYdB++12Onxee/QMwvf4/Dk/Lfp/i4nxTXtOoQ4pW5Aj7wpici1A9erdAN2OH64x8OSP9j3Ft3b7aWkTg/Fm91siTra0f9on5sQr9INejH6CUUUpavjFNq1B+Oadhxmnfa8RfEmN8VNAsQhPqF55xHkMzz3jSmChWU6f7/XZKNH+9+hBLOHYozuKQPxyMPUKkrX/K0uWnfFaJGS1QPRtZsOPtr3NsW0uyh6NNCOkU3Yz+bXbT3I8G3xE5EXLXtCXbbqwCO9zPQYPRTZ5vIDXD7U+w7rFDEoUUf7ibHIR4y6bLVPXrz8JVZEql13trxwue/uDivd3fkWRbS6/IA2bID4uk0UpF1N8qLlbBlXs4Ee7HLTfV1j54APvODnSfOWBqtKVvjgLKzF5YdEk5ewRkGlK0i33Eofffc7HT56jD7/6U+qH3Cx7SBLNntH5YIPvODnyfIXZYRVDPqgHtLs5ABHD3YzLuespb7t79FY34DjMwrVrcTuwlT55YMPvOBnRrJ4VXTdNnYug5ucHLBjEpt30701A3Ts+HEa73u6dT3FNWwflY86eMHPk+Yu+i6pzUpRrW7SNDg5JHR4KapmM5Wv2E8Tfcb1HoqqHMHU+uWDD7zg54mz5/2BSnizi9T1Dg4QQXLToGNCkb6tb1NU+QAlGr1++eADrzhn/u8Q2YZhQVlZ5+CAOtqfbhmaUCS1ezNFVm2imDbPmPng5wmz+gwh+oHDce0eUtQ6OGDIyR0uUhUsoO3vfDmmgOezH0mZN59x7MBi++WDL1g/eEiU3avlidO671bkLfwbw5XV2P8Pzo0ydy4t2/0eu33xYSOMOD8hTf4CrBtGMSoXfPLchX+J0ruSePw3LZeK0juPJbYzrhkH0io7B3k164hiGvawhOKMLkrQLyVpZg8rHFW7E2uHOL888IBPlNZ1FPzstSJM694fWr6RwpvcJK60+0HCILTBzZLFNdtAzJaohze60T8qBzyh5ZuOg5e7uwQppofEmf2++DYvmySqGBuKaicF1blQjhuHdvCIMvp8whTTfZzI7RldpwtSzL+F1+wkdZ2TBOW2gIF88PBTzD/gpeREAMEbxnJcaJHNHrpzji0gQCS6hdkEeYt9DF/2qPcEC8RM28Hwmr3sdNyht00byAut2k3gufWNtgtOEOFGUwcXWNDbdNbpgBGxEvKkOQsxivJx33iow0Vw5S6SVTrpVq11ysA2Rp7gTfPfktc6zhtXBBC+adRLshf6sG2RfHPZ5EAc4sVZ83yCN00Fk/4kggu40ZTvIEm5g24qtU4KjBrx/BTTH8ifVASAG7gKrnWxJDcU7x8X6Ecczhm3o6YicvsLXWfh3Ch1W0k8x0nXF+0fFxgt4phz8QvypiwCCFKMqXCnqXExjq10beH+UUA7+nG6mdG/Pu0f3LgFcGrl2s0kNNjpmoJ9o4B29CMO8dMT4Q5ox8uitF6fqsrJOr8qnwNbRzv6hSnG5wP+64C7h9lp30hKNtKdWjtdkbuPA19nJ7Tz3zR/ibgARbhb4AlhavcBebmTHcFl2fvYEnW0ox9xMxKBS8btJ+KiEbq9zA4RthQXDhPa0T9TEe69gWupwc6uBUphquXgf+/FrIjweHQS4/pduMe5ERUMHUd9xv8ZR98CxkS4F2n3EUrUZ10EYNw7BWm9x1GiPssi3GgiGRDKWRYZfXlON+dfNbM+GgIwYdwAAAAASUVORK5CYII=)}.leaflet-container .leaflet-control-attribution{background:#fff;background:#fffc;margin:0}.leaflet-control-attribution,.leaflet-control-scale-line{padding:0 5px;color:#333;line-height:1.4}.leaflet-control-attribution a{text-decoration:none}.leaflet-control-attribution a:hover,.leaflet-control-attribution a:focus{text-decoration:underline}.leaflet-attribution-flag{display:inline!important;vertical-align:baseline!important;width:1em;height:.6669em}.leaflet-left .leaflet-control-scale{margin-left:5px}.leaflet-bottom .leaflet-control-scale{margin-bottom:5px}.leaflet-control-scale-line{border:2px solid #777;border-top:none;line-height:1.1;padding:2px 5px 1px;white-space:nowrap;-moz-box-sizing:border-box;box-sizing:border-box;background:#fffc;text-shadow:1px 1px #fff}.leaflet-control-scale-line:not(:first-child){border-top:2px solid #777;border-bottom:none;margin-top:-2px}.leaflet-control-scale-line:not(:first-child):not(:last-child){border-bottom:2px solid #777}.leaflet-touch .leaflet-control-attribution,.leaflet-touch .leaflet-control-layers,.leaflet-touch .leaflet-bar{box-shadow:none}.leaflet-touch .leaflet-control-layers,.leaflet-touch .leaflet-bar{border:2px solid rgba(0,0,0,.2);background-clip:padding-box}.leaflet-popup{position:absolute;text-align:center;margin-bottom:20px}.leaflet-popup-content-wrapper{padding:1px;text-align:left;border-radius:12px}.leaflet-popup-content{margin:13px 24px 13px 20px;line-height:1.3;font-size:13px;font-size:1.08333em;min-height:1px}.leaflet-popup-content p{margin:1.3em 0}.leaflet-popup-tip-container{width:40px;height:20px;position:absolute;left:50%;margin-top:-1px;margin-left:-20px;overflow:hidden;pointer-events:none}.leaflet-popup-tip{width:17px;height:17px;padding:1px;margin:-10px auto 0;pointer-events:auto;-webkit-transform:rotate(45deg);-moz-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg)}.leaflet-popup-content-wrapper,.leaflet-popup-tip{background:#fff;color:#333;box-shadow:0 3px 14px #0006}.leaflet-container a.leaflet-popup-close-button{position:absolute;top:0;right:0;border:none;text-align:center;width:24px;height:24px;font:16px/24px Tahoma,Verdana,sans-serif;color:#757575;text-decoration:none;background:transparent}.leaflet-container a.leaflet-popup-close-button:hover,.leaflet-container a.leaflet-popup-close-button:focus{color:#585858}.leaflet-popup-scrolled{overflow:auto}.leaflet-oldie .leaflet-popup-content-wrapper{-ms-zoom:1}.leaflet-oldie .leaflet-popup-tip{width:24px;margin:0 auto;-ms-filter:"progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)";filter:progid:DXImageTransform.Microsoft.Matrix(M11=.70710678,M12=.70710678,M21=-.70710678,M22=.70710678)}.leaflet-oldie .leaflet-control-zoom,.leaflet-oldie .leaflet-control-layers,.leaflet-oldie .leaflet-popup-content-wrapper,.leaflet-oldie .leaflet-popup-tip{border:1px solid #999}.leaflet-div-icon{background:#fff;border:1px solid #666}.leaflet-tooltip{position:absolute;padding:6px;background-color:#fff;border:1px solid #fff;border-radius:3px;color:#222;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;pointer-events:none;box-shadow:0 1px 3px #0006}.leaflet-tooltip.leaflet-interactive{cursor:pointer;pointer-events:auto}.leaflet-tooltip-top:before,.leaflet-tooltip-bottom:before,.leaflet-tooltip-left:before,.leaflet-tooltip-right:before{position:absolute;pointer-events:none;border:6px solid transparent;background:transparent;content:""}.leaflet-tooltip-bottom{margin-top:6px}.leaflet-tooltip-top{margin-top:-6px}.leaflet-tooltip-bottom:before,.leaflet-tooltip-top:before{left:50%;margin-left:-6px}.leaflet-tooltip-top:before{bottom:0;margin-bottom:-12px;border-top-color:#fff}.leaflet-tooltip-bottom:before{top:0;margin-top:-12px;margin-left:-6px;border-bottom-color:#fff}.leaflet-tooltip-left{margin-left:-6px}.leaflet-tooltip-right{margin-left:6px}.leaflet-tooltip-left:before,.leaflet-tooltip-right:before{top:50%;margin-top:-6px}.leaflet-tooltip-left:before{right:0;margin-right:-12px;border-left-color:#fff}.leaflet-tooltip-right:before{left:0;margin-left:-12px;border-right-color:#fff}@media print{.leaflet-control{-webkit-print-color-adjust:exact;print-color-adjust:exact}}\n\n /* Component Styles */\n .sep-map-view{position:relative;width:100%;height:100%}.sep-map-view__container{width:100%;height:100%}.sep-map-view__container .leaflet-control-attribution{background:#ffffffe6;padding:4px 8px;font-size:11px;line-height:1.4}.sep-map-view__container .leaflet-control-attribution a{color:#036;text-decoration:none;font-weight:500}.sep-map-view__container .leaflet-control-attribution a:hover{color:#0052a3;text-decoration:underline}.sep-map-view .leaflet-pane,.sep-map-view .leaflet-tile-pane{z-index:1}.sep-map-view .leaflet-overlay-pane{z-index:2}.sep-map-view .leaflet-marker-pane{z-index:3}.sep-map-view .leaflet-tooltip-pane{z-index:4}.sep-map-view .leaflet-popup-pane{z-index:5}.sep-map-view .leaflet-gl-layer{position:relative;z-index:400!important}.sep-map-view .leaflet-control-zoom{display:none}\n .sep-map-root{position:relative;width:100%;height:100%}\n .sep-search{position:relative;width:var(--sep-search-width, 100%);max-width:400px;font-family:var(--sep-font-family);font-size:var(--sep-font-size)}.sep-search--top-left{position:absolute;top:var(--sep-space-md);left:var(--sep-space-md);z-index:var(--sep-z-search)}.sep-search--top-right{position:absolute;top:var(--sep-space-md);right:var(--sep-space-md);z-index:var(--sep-z-search)}.sep-search__input-container{position:relative;display:flex;align-items:center;background:var(--sep-bg);border:1px solid var(--sep-border);border-radius:var(--sep-radius);box-shadow:var(--sep-shadow);transition:border-color .2s,box-shadow .2s}.sep-search__input-container:focus-within{border-color:var(--sep-border-focus);box-shadow:var(--sep-shadow),0 0 0 3px #0066cc26}.sep-search__icon{display:flex;align-items:center;justify-content:center;padding-left:var(--sep-space-sm);color:var(--sep-text-muted);pointer-events:none}.sep-search__input{flex:1;width:100%;padding:var(--sep-space-sm) var(--sep-space-sm);border:none;background:transparent;font-family:inherit;font-size:inherit;color:var(--sep-text);outline:none}.sep-search__input::placeholder{color:var(--sep-text-muted)}.sep-search__spinner{display:flex;align-items:center;justify-content:center;padding-right:var(--sep-space-xs);color:var(--sep-primary)}.sep-search__spinner-icon{animation:sep-spin 1s linear infinite}@keyframes sep-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.sep-search__clear{display:flex;align-items:center;justify-content:center;width:28px;height:28px;margin-right:var(--sep-space-xs);padding:0;border:none;border-radius:var(--sep-radius-sm);background:transparent;color:var(--sep-text-muted);cursor:pointer;transition:background-color .2s,color .2s}.sep-search__clear:hover{background:var(--sep-bg-hover);color:var(--sep-text)}.sep-search__clear:focus{outline:2px solid var(--sep-border-focus);outline-offset:-2px}.sep-search__dropdown{position:absolute;top:calc(100% + 4px);left:0;right:0;max-height:360px;overflow-y:auto;background:var(--sep-bg);border:1px solid var(--sep-border);border-radius:var(--sep-radius);box-shadow:var(--sep-shadow-lg);z-index:var(--sep-z-dropdown)}.sep-search-results{padding:var(--sep-space-xs) 0}.sep-search-status{display:flex;align-items:center;justify-content:center;gap:var(--sep-space-sm);padding:var(--sep-space-lg) var(--sep-space-md);color:var(--sep-text-secondary);font-size:var(--sep-font-size-sm)}.sep-search-status--loading{color:var(--sep-primary)}.sep-search-status--error{color:var(--sep-danger)}.sep-search-status--empty{font-style:italic}.sep-search-group{padding:var(--sep-space-xs) 0}.sep-search-group+.sep-search-group{border-top:1px solid var(--sep-border)}.sep-search-group__header{padding:var(--sep-space-sm) var(--sep-space-md);font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.05em;color:var(--sep-text-muted);background:var(--sep-bg-secondary);position:sticky;top:0;z-index:1}.sep-search-item{display:flex;align-items:flex-start;gap:var(--sep-space-sm);width:100%;padding:var(--sep-space-sm) var(--sep-space-md);border:none;background:transparent;text-align:left;font-family:inherit;font-size:inherit;color:var(--sep-text);cursor:pointer;transition:background-color .15s}.sep-search-item:hover,.sep-search-item--highlighted{background:var(--sep-bg-hover)}.sep-search-item:focus{outline:none;background:var(--sep-bg-hover)}.sep-search-chip{display:inline-flex;align-items:center;justify-content:center;padding:2px 8px;border-radius:12px;font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.05em;white-space:nowrap;border:1px solid transparent;flex-shrink:0;min-width:70px}.sep-search-chip--address{background-color:var(--sep-chip-address-bg);color:var(--sep-chip-address-text);border-color:var(--sep-chip-address-border)}.sep-search-chip--parcel{background-color:var(--sep-chip-parcel-bg);color:var(--sep-chip-parcel-text);border-color:var(--sep-chip-parcel-border)}.sep-search-chip--region{background-color:var(--sep-chip-region-bg);color:var(--sep-chip-region-text);border-color:var(--sep-chip-region-border)}.sep-search-chip--egid{background-color:var(--sep-chip-egid-bg);color:var(--sep-chip-egid-text);border-color:var(--sep-chip-egid-border)}.sep-search-chip--egrid{background-color:var(--sep-chip-egrid-bg);color:var(--sep-chip-egrid-text);border-color:var(--sep-chip-egrid-border)}.sep-search-item__content{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}.sep-search-item__label{font-weight:500;color:var(--sep-text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.sep-search-item__description{font-size:var(--sep-font-size-sm);color:var(--sep-text-secondary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}[data-theme=dark] .sep-search__input-container,[data-theme=dark] .sep-search__dropdown{background:var(--sep-bg);border-color:var(--sep-border)}[data-theme=dark] .sep-search-group__header{background:var(--sep-bg-secondary)}@media(max-width:480px){.sep-search--top-left,.sep-search--top-right{left:var(--sep-space-sm);right:var(--sep-space-sm);max-width:none}.sep-search__dropdown{max-height:50vh}}\n .sep-layer-control{position:absolute;z-index:var(--sep-z-controls);display:flex;flex-direction:column;align-items:flex-end}.sep-layer-control--top-left{top:var(--sep-space-md);left:var(--sep-space-md);align-items:flex-start}.sep-layer-control--top-right{top:var(--sep-space-md);right:var(--sep-space-md)}.sep-layer-control--bottom-left{bottom:var(--sep-space-xl);left:var(--sep-space-md);align-items:flex-start}.sep-layer-control--bottom-right{bottom:var(--sep-space-xl);right:var(--sep-space-md)}.sep-layer-control__toggle{width:36px;height:36px;padding:0;display:flex;align-items:center;justify-content:center;background:var(--sep-bg);border:1px solid var(--sep-border);border-radius:var(--sep-radius);box-shadow:var(--sep-shadow);cursor:pointer;transition:background-color .2s,border-color .2s}.sep-layer-control__toggle:hover{background:var(--sep-bg-hover)}.sep-layer-control__toggle:focus{outline:2px solid var(--sep-border-focus);outline-offset:2px}.sep-layer-control__panel{margin-top:var(--sep-space-sm);background:var(--sep-bg);border:1px solid var(--sep-border);border-radius:var(--sep-radius);box-shadow:var(--sep-shadow-lg);min-width:220px;max-width:280px;overflow:hidden}.sep-layer-control__tabs{display:flex;border-bottom:1px solid var(--sep-border)}.sep-layer-control__tab{flex:1;padding:var(--sep-space-sm) var(--sep-space-md);background:transparent;border:none;font-size:var(--sep-font-size-sm);font-weight:500;color:var(--sep-text-secondary);cursor:pointer;transition:background-color .2s,color .2s}.sep-layer-control__tab:hover{background:var(--sep-bg-hover)}.sep-layer-control__tab.active{color:var(--sep-primary);background:var(--sep-bg-secondary)}.sep-layer-control__content{max-height:300px;overflow-y:auto}.sep-layer-control__list{padding:var(--sep-space-xs) 0}.sep-layer-control__item{display:flex;align-items:flex-start;gap:var(--sep-space-sm);padding:var(--sep-space-sm) var(--sep-space-md);cursor:pointer;transition:background-color .15s}.sep-layer-control__item:hover{background:var(--sep-bg-hover)}.sep-layer-control__item.active{background:#0066cc14}.sep-layer-control__item input[type=radio],.sep-layer-control__item input[type=checkbox]{margin-top:2px;cursor:pointer}.sep-layer-control__item-content{display:flex;flex-direction:column;gap:2px;min-width:0}.sep-layer-control__item-name{font-size:var(--sep-font-size-sm);font-weight:500;color:var(--sep-text)}.sep-layer-control__item-desc{font-size:11px;color:var(--sep-text-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.sep-layer-control__empty{padding:var(--sep-space-lg) var(--sep-space-md);text-align:center;color:var(--sep-text-muted);font-size:var(--sep-font-size-sm)}@media(max-width:480px){.sep-layer-control__panel{min-width:180px}}\n\n /* Custom Styles */\n ${t||""}\n `,e.prepend(i)}(this.shadowRoot,this.config.ui?.customCss),this.root=P.createRoot(this.shadowRoot)):this.root=P.createRoot(t),this.render()),this}mountSearch(e){const t="string"==typeof e?document.querySelector(e):e;return t&&(this.config={...this.config,ui:{...this.config.ui,externalSearchContainer:t}},this.render()),this}render(){if(!this.root)return;const e=M.createElement(Me,{ref:this.mapRef,onReady:e=>this.emit("ready",{map:e}),onAddressSelected:e=>this.emit("addressSelected",e),onPerimeterSelected:e=>this.emit("perimeterSelected",e),onSelectionChanged:e=>this.emit("selectionChanged",e),onPolygonDrawn:e=>this.emit("polygonDrawn",e),onError:e=>this.emit("error",e)}),t=M.createElement(W,{config:this.config,children:e});this.root.render(t)}on(e,t){return this.events.has(e)||this.events.set(e,new Set),this.events.get(e).add(t),()=>this.off(e,t)}off(e,t){this.events.get(e)?.delete(t)}once(e,t){const i=n=>{this.off(e,i),t(n)};return this.on(e,i)}emit(e,t){this.events.get(e)?.forEach(e=>{try{e(t)}catch(i){}})}async selectAddress(e){const t="number"==typeof e?await this.services.address.getById(e):e;return t&&this.mapRef.current?.selectAddress(t),t}async selectPerimeter(e){const t="string"==typeof e?await this.services.perimeter.getById(e):e;return t&&this.mapRef.current?.selectPerimeter(t),t}getSelection(){return this.mapRef.current?.getSelection()??[]}clearSelection(){this.mapRef.current?.clearSelection()}addToSelection(e){return this.mapRef.current?.addToSelection(e)??!1}removeFromSelection(e){this.mapRef.current?.removeFromSelection(e)}async getDecisionTree(e){const t=e??this.getSelection();return this.services.config.evaluateDecisionTree(t)}async searchAddress(e){return this.services.address.search(e)}async getAddressesInPolygon(e){return this.services.address.getInPolygon(e)}flyTo(e,t,i,n){this.mapRef.current?.flyTo(e,t,i,n)}fitBounds(e){this.mapRef.current?.fitBounds(e)}setLanguage(e){this.i18n.setLocale(e),this.emit("languageChanged",{locale:e})}getLanguage(){return this.i18n.getLocale()}setFeature(e,t){this.config={...this.config,features:{...this.config.features,[e]:t}},this.render()}startPolygonDraw(){this.mapRef.current?.startPolygonDraw()}cancelPolygonDraw(){this.mapRef.current?.cancelPolygonDraw()}getLeafletMap(){return this.mapRef.current?.getLeafletMap()}addLayer(e){this.mapRef.current?.addLayer(e)}addWMSLayer(e){this.mapRef.current?.addWMSLayer(e)}addTileLayer(e){this.mapRef.current?.addTileLayer(e)}addGeoJSONLayer(e){this.mapRef.current?.addGeoJSONLayer(e)}removeLayer(e){this.mapRef.current?.removeLayer(e)}toggleLayer(e,t){this.mapRef.current?.toggleLayer(e,t)}getLayers(){return this.mapRef.current?.getLayers()??[]}getLayer(e){return this.mapRef.current?.getLayer(e)}destroy(){this.root?.unmount(),this.root=null,this.shadowRoot=null,this.events.clear()}}class Ce extends HTMLElement{constructor(){super(),i(this,"sdk",null)}static get observedAttributes(){return["client-id","language","token","features","api-url"]}connectedCallback(){const e=document.createElement("div");e.style.width="100%",e.style.height="100%",this.appendChild(e);const t=this.buildConfig();this.sdk=new Ee({...t,container:e,useShadowDom:!1}),this.forwardEvents()}disconnectedCallback(){this.sdk?.destroy(),this.sdk=null}attributeChangedCallback(e,t,i){if(t!==i&&this.sdk&&"language"===e)i&&this.sdk.setLanguage(i)}buildConfig(){const e=this.getAttribute("client-id");if(!e)throw new Error("[sep-map] client-id attribute is required");return{clientId:e,token:this.getAttribute("token")||void 0,apiUrl:this.getAttribute("api-url")||void 0,language:this.getAttribute("language")||void 0,features:this.parseFeatures(),map:this.parseMapConfig()}}parseFeatures(){const e=this.getAttribute("features");if(!e)return{addressSearch:!0,perimeterSelection:!0};if(e.startsWith("{"))try{return JSON.parse(e)}catch{return{addressSearch:!0,perimeterSelection:!0}}const t=e.split(",").map(e=>e.trim().toLowerCase());return{addressSearch:t.includes("address")||t.includes("address-search"),perimeterSelection:t.includes("perimeter")||t.includes("perimeter-selection"),multiSelect:t.includes("multi")||t.includes("multi-select"),polygonDraw:t.includes("polygon")||t.includes("polygon-draw")}}parseMapConfig(){const e=this.getAttribute("center"),t=this.getAttribute("zoom"),i=this.getAttribute("bounds");return{center:e?JSON.parse(e):void 0,zoom:t?parseInt(t,10):void 0,bounds:i?JSON.parse(i):void 0}}forwardEvents(){if(!this.sdk)return;["ready","addressSelected","perimeterSelected","selectionChanged","polygonDrawn","error","languageChanged"].forEach(e=>{this.sdk.on(e,t=>{this.dispatchEvent(new CustomEvent(`sep:${this.toKebabCase(e)}`,{detail:t,bubbles:!0,composed:!0}))})})}toKebabCase(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}get map(){return this.sdk}selectAddress(e){return this.sdk?.selectAddress(e)}selectPerimeter(e){return this.sdk?.selectPerimeter(e)}getSelection(){return this.sdk?.getSelection()??[]}clearSelection(){this.sdk?.clearSelection()}setLanguage(e){this.sdk?.setLanguage(e)}}return"undefined"==typeof window||customElements.get("sep-map")||customElements.define("sep-map",Ce),e.AddressService=F,e.I18nManager=R,e.PerimeterService=O,e.SEPMapSDK=Ee,e.default=Ee,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),e}({});"undefined"!=typeof window&&void 0!==SEPMapLib&&(window.SEPMapSDK=SEPMapLib.SEPMapSDK);
|
|
2
|
+
//# sourceMappingURL=sep-map.js.map
|