PageSourceSearch

https://gebeta-geogussr.onrender.com/assets/index-BcN9zRWV.js

js gebeta-geogussr.onrender.com collected 2026-10-03 11:40:31 UTC 1,284,085 bytes, 958 lines download raw bytes

vendor: 10,482 bytes, lines 1-17
1function P_(R,E){for(var z=0;z<E.length;z++){const I=E[z];if(typeof I!="string"&&!Array.isArray(I)){for(const V in I)if(V!=="default"&&!(V in R)){const X=Object.getOwnPropertyDescriptor(I,V);X&&Object.defineProperty(R,V,X.get?X:{enumerable:!0,get:()=>I[V]})}}}return Object.freeze(Object.defineProperty(R,Symbol.toStringTag,{value:"Module"}))}(function(){const E=document.createElement("link").relList;if(E&&E.supports&&E.supports("modulepreload"))return;for(const V of document.querySelectorAll('link[rel="modulepreload"]'))I(V);new MutationObserver(V=>{for(const X of V)if(X.type==="childList")for(const A of X.addedNodes)A.tagName==="LINK"&&A.rel==="modulepreload"&&I(A)}).observe(document,{childList:!0,subtree:!0});function z(V){const X={};return V.integrity&&(X.integrity=V.integrity),V.referrerPolicy&&(X.referrerPolicy=V.referrerPolicy),V.crossOrigin==="use-credentials"?X.credentials="include":V.crossOrigin==="anonymous"?X.credentials="omit":X.credentials="same-origin",X}function I(V){if(V.ep)return;V.ep=!0;const X=z(V);fetch(V.href,X)}})();function z_(R){return R&&R.__esModule&&Object.prototype.hasOwnProperty.call(R,"default")?R.default:R}var dm={exports:{}},Zf={};/**
2 * @license React
3 * react-jsx-runtime.production.js
4 *
5 * Copyright (c) Meta Platforms, Inc. and affiliates.
6 *
7 * This source code is licensed under the MIT license found in the
8 * LICENSE file in the root directory of this source tree.
9 */var Zm;function k_(){if(Zm)return Zf;Zm=1;var R=Symbol.for("react.transitional.element"),E=Symbol.for("react.fragment");function z(I,V,X){var A=null;if(X!==void 0&&(A=""+X),V.key!==void 0&&(A=""+V.key),"key"in V){X={};for(var u in V)u!=="key"&&(X[u]=V[u])}else X=V;return V=X.ref,{$$typeof:R,type:I,key:A,ref:V!==void 0?V:null,props:X}}return Zf.Fragment=E,Zf.jsx=z,Zf.jsxs=z,Zf}var qm;function I_(){return qm||(qm=1,dm.exports=k_()),dm.exports}var q=I_(),fm={exports:{}},pi={};/**
10 * @license React
11 * react.production.js
12 *
13 * Copyright (c) Meta Platforms, Inc. and affiliates.
14 *
15 * This source code is licensed under the MIT license found in the
16 * LICENSE file in the root directory of this source tree.
17 */var $m;function R_(){if($m)return pi;$m=1;var R=Symbol.for("react.transitional.element"),E=Symbol.for("react.portal"),z=Symbol.for("react.fragment"),I=Symbol.for("react.strict_mode"),V=Symbol.for("react.profiler"),X=Symbol.for("react.consumer"),A=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),H=Symbol.for("react.suspense"),ne=Symbol.for("react.memo"),se=Symbol.for("react.lazy"),we=Symbol.iterator;function Ce(_e){return _e===null||typeof _e!="object"?null:(_e=we&&_e[we]||_e["@@iterator"],typeof _e=="function"?_e:null)}var ie={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Fe=Object.assign,He={};function xe(_e,Xe,vt){this.props=_e,this.context=Xe,this.refs=He,this.updater=vt||ie}xe.prototype.isReactComponent={},xe.prototype.setState=function(_e,Xe){if(typeof _e!="object"&&typeof _e!="function"&&_e!=null)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,Xe,"setState")},xe.prototype.forceUpdate=function(_e){this.updater.enqueueForceUpdate(this,_e,"forceUpdate")};function et(){}et.prototype=xe.prototype;function qe(_e,Xe,vt){this.props=_e,this.context=Xe,this.refs=He,this.updater=vt||ie}var tt=qe.prototype=new et;tt.constructor=qe,Fe(tt,xe.prototype),tt.isPureReactComponent=!0;var ut=Array.isArray,Ze={H:null,A:null,T:null,S:null,V:null},_t=Object.prototype.hasOwnProperty;function Tt(_e,Xe,vt,at,wt,Ft){return vt=Ft.ref,{$$typeof:R,type:_e,key:Xe,ref:vt!==void 0?vt:null,props:Ft}}function xt(_e,Xe){return Tt(_e.type,Xe,void 0,void 0,void 0,_e.props)}function Gt(_e){return typeof _e=="object"&&_e!==null&&_e.$$typeof===R}function hi(_e){var Xe={"=":"=0",":":"=2"};return"$"+_e.replace(/[=:]/g,function(vt){return Xe[vt]})}var mi=/\/+/g;function Jt(_e,Xe){return typeof _e=="object"&&_e!==null&&_e.key!=null?hi(""+_e.key):Xe.toString(36)}function fr(){}function Ir(_e){switch(_e.status){case"fulfilled":return _e.value;case"rejected":throw _e.reason;default:switch(typeof _e.status=="string"?_e.then(fr,fr):(_e.status="pending",_e.then(function(Xe){_e.status==="pending"&&(_e.status="fulfilled",_e.value=Xe)},function(Xe){_e.status==="pending"&&(_e.status="rejected",_e.reason=Xe)})),_e.status){case"fulfilled":return _e.value;case"rejected":throw _e.reason}}throw _e}function yi(_e,Xe,vt,at,wt){var Ft=typeof _e;(Ft==="undefined"||Ft==="boolean")&&(_e=null);var zt=!1;if(_e===null)zt=!0;else switch(Ft){case"bigint":case"string":case"number":zt=!0;break;case"object":switch(_e.$$typeof){case R:case E:zt=!0;break;case se:return zt=_e._init,yi(zt(_e._payload),Xe,vt,at,wt)}}if(zt)return wt=wt(_e),zt=at===""?"."+Jt(_e,0):at,ut(wt)?(vt="",zt!=null&&(vt=zt.replace(mi,"$&/")+"/"),yi(wt,Xe,vt,"",function(Ji){return Ji})):wt!=null&&(Gt(wt)&&(wt=xt(wt,vt+(wt.key==null||_e&&_e.key===wt.key?"":(""+wt.key).replace(mi,"$&/")+"/")+zt)),Xe.push(wt)),1;zt=0;var di=at===""?".":at+":";if(ut(_e))for(var si=0;si<_e.length;si++)at=_e[si],Ft=di+Jt(at,si),zt+=yi(at,Xe,vt,Ft,wt);else if(si=Ce(_e),typeof si=="function")for(_e=si.call(_e),si=0;!(at=_e.next()).done;)at=at.value,Ft=di+Jt(at,si++),zt+=yi(at,Xe,vt,Ft,wt);else if(Ft==="object"){if(typeof _e.then=="function")return yi(Ir(_e),Xe,vt,at,wt);throw Xe=String(_e),Error("Objects are not valid as a React child (found: "+(Xe==="[object Object]"?"object with keys {"+Object.keys(_e).join(", ")+"}":Xe)+"). If you meant to render a collection of children, use an array instead.")}return zt}function Ve(_e,Xe,vt){if(_e==null)return _e;var at=[],wt=0;return yi(_e,at,"","",function(Ft){return Xe.call(vt,Ft,wt++)}),at}function ht(_e){if(_e._status===-1){var Xe=_e._result;Xe=Xe(),Xe.then(function(vt){(_e._status===0||_e._status===-1)&&(_e._status=1,_e._result=vt)},function(vt){(_e._status===0||_e._status===-1)&&(_e._status=2,_e._result=vt)}),_e._status===-1&&(_e._status=0,_e._result=Xe)}if(_e._status===1)return _e._result.default;throw _e._result}var nt=typeof reportError=="function"?reportError:function(_e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Xe=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof _e=="object"&&_e!==null&&typeof _e.message=="string"?String(_e.message):String(_e),error:_e});if(!window.dispatchEvent(Xe))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",_e);return}console.error(_e)};function bt(){}return pi.Children={map:Ve,forEach:function(_e,Xe,vt){Ve(_e,function(){Xe.apply(this,arguments)},vt)},count:function(_e){var Xe=0;return Ve(_e,function(){Xe++}),Xe},toArray:function(_e){return Ve(_e,function(Xe){return Xe})||[]},only:function(_e){if(!Gt(_e))throw Error("React.Children.only expected to receive a single React element child.");return _e}},pi.Component=xe,pi.Fragment=z,pi.Profiler=V,pi.PureComponent=qe,pi.StrictMode=I,pi.Suspense=H,pi.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Ze,pi.__COMPILER_RUNTIME={__proto__:null,c:function(_e){return Ze.H.useMemoCache(_e)}},pi.cache=function(_e){return function(){return _e.apply(null,arguments)}},pi.cloneElement=function(_e,Xe,vt){if(_e==null)throw Error("The argument must be a React element, but you passed "+_e+".");var at=Fe({},_e.props),wt=_e.key,Ft=void 0;if(Xe!=null)for(zt in Xe.ref!==void 0&&(Ft=void 0),Xe.key!==void 0&&(wt=""+Xe.key),Xe)!_t.call(Xe,zt)||zt==="key"||zt==="__self"||zt==="__source"||zt==="ref"&&Xe.ref===void 0||(at[zt]=Xe[zt]);var zt=arguments.length-2;if(zt===1)at.children=vt;else if(1<zt){for(var di=Array(zt),si=0;si<zt;si++)di[si]=arguments[si+2];at.children=di}return Tt(_e.type,wt,void 0,void 0,Ft,at)},pi.createContext=function(_e){return _e={$$typeof:A,_currentValue:_e,_currentValue2:_e,_threadCount:0,Provider:null,Consumer:null},_e.Provider=_e,_e.Consumer={$$typeof:X,_context:_e},_e},pi.createElement=function(_e,Xe,vt){var at,wt={},Ft=null;if(Xe!=null)for(at in Xe.key!==void 0&&(Ft=""+Xe.key),Xe)_t.call(Xe,at)&&at!=="key"&&at!=="__self"&&at!=="__source"&&(wt[at]=Xe[at]);var zt=arguments.length-2;if(zt===1)wt.children=vt;else if(1<zt){for(var di=Array(zt),si=0;si<zt;si++)di[si]=arguments[si+2];wt.children=di}if(_e&&_e.defaultProps)for(at in zt=_e.defaultProps,zt)wt[at]===void 0&&(wt[at]=zt[at]);return Tt(_e,Ft,void 0,void 0,null,wt)},pi.createRef=function(){return{current:null}},pi.forwardRef=function(_e){return{$$typeof:u,render:_e}},pi.isValidElement=Gt,pi.lazy=function(_e){return{$$typeof:se,_payload:{_status:-1,_result:_e},_init:ht}},pi.memo=function(_e,Xe){return{$$typeof:ne,type:_e,compare:Xe===void 0?null:Xe}},pi.startTransition=function(_e){var Xe=Ze.T,vt={};Ze.T=vt;try{var at=_e(),wt=Ze.S;wt!==null&&wt(vt,at),typeof at=="object"&&at!==null&&typeof at.then=="function"&&at.then(bt,nt)}catch(Ft){nt(Ft)}finally{Ze.T=Xe}},pi.unstable_useCacheRefresh=function(){return Ze.H.useCacheRefresh()},pi.use=function(_e){return Ze.H.use(_e)},pi.useActionState=function(_e,Xe,vt){return Ze.H.useActionState(_e,Xe,vt)},pi.useCallback=function(_e,Xe){return Ze.H.useCallback(_e,Xe)},pi.useContext=function(_e){return Ze.H.useContext(_e)},pi.useDebugValue=function(){},pi.useDeferredValue=function(_e,Xe){return Ze.H.useDeferredValue(_e,Xe)},pi.useEffect=function(_e,Xe,vt){var at=Ze.H;if(typeof vt=="function")throw Error("useEffect CRUD overload is not enabled in this build of React.");return at.useEffect(_e,Xe)},pi.useId=function(){return Ze.H.useId()},pi.useImperativeHandle=function(_e,Xe,vt){return Ze.H.useImperativeHandle(_e,Xe,vt)},pi.useInsertionEffect=function(_e,Xe){return Ze.H.useInsertionEffect(_e,Xe)},pi.useLayoutEffect=function(_e,Xe){return Ze.H.useLayoutEffect(_e,Xe)},pi.useMemo=function(_e,Xe){return Ze.H.useMemo(_e,Xe)},pi.useOptimistic=function(_e,Xe){return Ze.H.useOptimistic(_e,Xe)},pi.useReducer=function(_e,Xe,vt){return Ze.H.useReducer(_e,Xe,vt)},pi.useRef=function(_e){return Ze.H.useRef(_e)},pi.useState=function(_e){return Ze.H.useState(_e)},pi.useSyncExternalStore=function(_e,Xe,vt){return Ze.H.useSyncExternalStore(_e,Xe,vt)},pi.useTransition=function(){return Ze.H.useTransition()},pi.version="19.1.1",pi}var Hm;function Im(){return Hm||(Hm=1,fm.exports=R_()),fm.exports}var Ae=Im();const Kc=z_(Ae),D_=P_({__proto__:null,default:Kc},[Ae]);var pm={exports:{}},qf={},mm={exports:{}},gm={};
vendor: 9,286 bytes, lines 17-41
17/**
18 * @license React
19 * scheduler.production.js
20 *
21 * Copyright (c) Meta Platforms, Inc. and affiliates.
22 *
23 * This source code is licensed under the MIT license found in the
24 * LICENSE file in the root directory of this source tree.
25 */var Xm;function L_(){return Xm||(Xm=1,(function(R){function E(Ve,ht){var nt=Ve.length;Ve.push(ht);e:for(;0<nt;){var bt=nt-1>>>1,_e=Ve[bt];if(0<V(_e,ht))Ve[bt]=ht,Ve[nt]=_e,nt=bt;else break e}}function z(Ve){return Ve.length===0?null:Ve[0]}function I(Ve){if(Ve.length===0)return null;var ht=Ve[0],nt=Ve.pop();if(nt!==ht){Ve[0]=nt;e:for(var bt=0,_e=Ve.length,Xe=_e>>>1;bt<Xe;){var vt=2*(bt+1)-1,at=Ve[vt],wt=vt+1,Ft=Ve[wt];if(0>V(at,nt))wt<_e&&0>V(Ft,at)?(Ve[bt]=Ft,Ve[wt]=nt,bt=wt):(Ve[bt]=at,Ve[vt]=nt,bt=vt);else if(wt<_e&&0>V(Ft,nt))Ve[bt]=Ft,Ve[wt]=nt,bt=wt;else break e}}return ht}function V(Ve,ht){var nt=Ve.sortIndex-ht.sortIndex;return nt!==0?nt:Ve.id-ht.id}if(R.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var X=performance;R.unstable_now=function(){return X.now()}}else{var A=Date,u=A.now();R.unstable_now=function(){return A.now()-u}}var H=[],ne=[],se=1,we=null,Ce=3,ie=!1,Fe=!1,He=!1,xe=!1,et=typeof setTimeout=="function"?setTimeout:null,qe=typeof clearTimeout=="function"?clearTimeout:null,tt=typeof setImmediate<"u"?setImmediate:null;function ut(Ve){for(var ht=z(ne);ht!==null;){if(ht.callback===null)I(ne);else if(ht.startTime<=Ve)I(ne),ht.sortIndex=ht.expirationTime,E(H,ht);else break;ht=z(ne)}}function Ze(Ve){if(He=!1,ut(Ve),!Fe)if(z(H)!==null)Fe=!0,_t||(_t=!0,Jt());else{var ht=z(ne);ht!==null&&yi(Ze,ht.startTime-Ve)}}var _t=!1,Tt=-1,xt=5,Gt=-1;function hi(){return xe?!0:!(R.unstable_now()-Gt<xt)}function mi(){if(xe=!1,_t){var Ve=R.unstable_now();Gt=Ve;var ht=!0;try{e:{Fe=!1,He&&(He=!1,qe(Tt),Tt=-1),ie=!0;var nt=Ce;try{t:{for(ut(Ve),we=z(H);we!==null&&!(we.expirationTime>Ve&&hi());){var bt=we.callback;if(typeof bt=="function"){we.callback=null,Ce=we.priorityLevel;var _e=bt(we.expirationTime<=Ve);if(Ve=R.unstable_now(),typeof _e=="function"){we.callback=_e,ut(Ve),ht=!0;break t}we===z(H)&&I(H),ut(Ve)}else I(H);we=z(H)}if(we!==null)ht=!0;else{var Xe=z(ne);Xe!==null&&yi(Ze,Xe.startTime-Ve),ht=!1}}break e}finally{we=null,Ce=nt,ie=!1}ht=void 0}}finally{ht?Jt():_t=!1}}}var Jt;if(typeof tt=="function")Jt=function(){tt(mi)};else if(typeof MessageChannel<"u"){var fr=new MessageChannel,Ir=fr.port2;fr.port1.onmessage=mi,Jt=function(){Ir.postMessage(null)}}else Jt=function(){et(mi,0)};function yi(Ve,ht){Tt=et(function(){Ve(R.unstable_now())},ht)}R.unstable_IdlePriority=5,R.unstable_ImmediatePriority=1,R.unstable_LowPriority=4,R.unstable_NormalPriority=3,R.unstable_Profiling=null,R.unstable_UserBlockingPriority=2,R.unstable_cancelCallback=function(Ve){Ve.callback=null},R.unstable_forceFrameRate=function(Ve){0>Ve||125<Ve?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):xt=0<Ve?Math.floor(1e3/Ve):5},R.unstable_getCurrentPriorityLevel=function(){return Ce},R.unstable_next=function(Ve){switch(Ce){case 1:case 2:case 3:var ht=3;break;default:ht=Ce}var nt=Ce;Ce=ht;try{return Ve()}finally{Ce=nt}},R.unstable_requestPaint=function(){xe=!0},R.unstable_runWithPriority=function(Ve,ht){switch(Ve){case 1:case 2:case 3:case 4:case 5:break;default:Ve=3}var nt=Ce;Ce=Ve;try{return ht()}finally{Ce=nt}},R.unstable_scheduleCallback=function(Ve,ht,nt){var bt=R.unstable_now();switch(typeof nt=="object"&&nt!==null?(nt=nt.delay,nt=typeof nt=="number"&&0<nt?bt+nt:bt):nt=bt,Ve){case 1:var _e=-1;break;case 2:_e=250;break;case 5:_e=1073741823;break;case 4:_e=1e4;break;default:_e=5e3}return _e=nt+_e,Ve={id:se++,callback:ht,priorityLevel:Ve,startTime:nt,expirationTime:_e,sortIndex:-1},nt>bt?(Ve.sortIndex=nt,E(ne,Ve),z(H)===null&&Ve===z(ne)&&(He?(qe(Tt),Tt=-1):He=!0,yi(Ze,nt-bt))):(Ve.sortIndex=_e,E(H,Ve),Fe||ie||(Fe=!0,_t||(_t=!0,Jt()))),Ve},R.unstable_shouldYield=hi,R.unstable_wrapCallback=function(Ve){var ht=Ce;return function(){var nt=Ce;Ce=ht;try{return Ve.apply(this,arguments)}finally{Ce=nt}}}})(gm)),gm}var Ym;function B_(){return Ym||(Ym=1,mm.exports=L_()),mm.exports}var _m={exports:{}},ka={};/**
26 * @license React
27 * react-dom.production.js
28 *
29 * Copyright (c) Meta Platforms, Inc. and affiliates.
30 *
31 * This source code is licensed under the MIT license found in the
32 * LICENSE file in the root directory of this source tree.
33 */var Km;function O_(){if(Km)return ka;Km=1;var R=Im();function E(H){var ne="https://react.dev/errors/"+H;if(1<arguments.length){ne+="?args[]="+encodeURIComponent(arguments[1]);for(var se=2;se<arguments.length;se++)ne+="&args[]="+encodeURIComponent(arguments[se])}return"Minified React error #"+H+"; visit "+ne+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function z(){}var I={d:{f:z,r:function(){throw Error(E(522))},D:z,C:z,L:z,m:z,X:z,S:z,M:z},p:0,findDOMNode:null},V=Symbol.for("react.portal");function X(H,ne,se){var we=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:V,key:we==null?null:""+we,children:H,containerInfo:ne,implementation:se}}var A=R.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function u(H,ne){if(H==="font")return"";if(typeof ne=="string")return ne==="use-credentials"?ne:""}return ka.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=I,ka.createPortal=function(H,ne){var se=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!ne||ne.nodeType!==1&&ne.nodeType!==9&&ne.nodeType!==11)throw Error(E(299));return X(H,ne,null,se)},ka.flushSync=function(H){var ne=A.T,se=I.p;try{if(A.T=null,I.p=2,H)return H()}finally{A.T=ne,I.p=se,I.d.f()}},ka.preconnect=function(H,ne){typeof H=="string"&&(ne?(ne=ne.crossOrigin,ne=typeof ne=="string"?ne==="use-credentials"?ne:"":void 0):ne=null,I.d.C(H,ne))},ka.prefetchDNS=function(H){typeof H=="string"&&I.d.D(H)},ka.preinit=function(H,ne){if(typeof H=="string"&&ne&&typeof ne.as=="string"){var se=ne.as,we=u(se,ne.crossOrigin),Ce=typeof ne.integrity=="string"?ne.integrity:void 0,ie=typeof ne.fetchPriority=="string"?ne.fetchPriority:void 0;se==="style"?I.d.S(H,typeof ne.precedence=="string"?ne.precedence:void 0,{crossOrigin:we,integrity:Ce,fetchPriority:ie}):se==="script"&&I.d.X(H,{crossOrigin:we,integrity:Ce,fetchPriority:ie,nonce:typeof ne.nonce=="string"?ne.nonce:void 0})}},ka.preinitModule=function(H,ne){if(typeof H=="string")if(typeof ne=="object"&&ne!==null){if(ne.as==null||ne.as==="script"){var se=u(ne.as,ne.crossOrigin);I.d.M(H,{crossOrigin:se,integrity:typeof ne.integrity=="string"?ne.integrity:void 0,nonce:typeof ne.nonce=="string"?ne.nonce:void 0})}}else ne==null&&I.d.M(H)},ka.preload=function(H,ne){if(typeof H=="string"&&typeof ne=="object"&&ne!==null&&typeof ne.as=="string"){var se=ne.as,we=u(se,ne.crossOrigin);I.d.L(H,se,{crossOrigin:we,integrity:typeof ne.integrity=="string"?ne.integrity:void 0,nonce:typeof ne.nonce=="string"?ne.nonce:void 0,type:typeof ne.type=="string"?ne.type:void 0,fetchPriority:typeof ne.fetchPriority=="string"?ne.fetchPriority:void 0,referrerPolicy:typeof ne.referrerPolicy=="string"?ne.referrerPolicy:void 0,imageSrcSet:typeof ne.imageSrcSet=="string"?ne.imageSrcSet:void 0,imageSizes:typeof ne.imageSizes=="string"?ne.imageSizes:void 0,media:typeof ne.media=="string"?ne.media:void 0})}},ka.preloadModule=function(H,ne){if(typeof H=="string")if(ne){var se=u(ne.as,ne.crossOrigin);I.d.m(H,{as:typeof ne.as=="string"&&ne.as!=="script"?ne.as:void 0,crossOrigin:se,integrity:typeof ne.integrity=="string"?ne.integrity:void 0})}else I.d.m(H)},ka.requestFormReset=function(H){I.d.r(H)},ka.unstable_batchedUpdates=function(H,ne){return H(ne)},ka.useFormState=function(H,ne,se){return A.H.useFormState(H,ne,se)},ka.useFormStatus=function(){return A.H.useHostTransitionStatus()},ka.version="19.1.1",ka}var Wm;function bg(){if(Wm)return _m.exports;Wm=1;function R(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(R)}catch(E){console.error(E)}}return R(),_m.exports=O_(),_m.exports}/**
34 * @license React
35 * react-dom-client.production.js
36 *
37 * Copyright (c) Meta Platforms, Inc. and affiliates.
38 *
39 * This source code is licensed under the MIT license found in the
40 * LICENSE file in the root directory of this source tree.
41 */var Qm;function j_(){if(Qm)return qf;Qm=1;var R=B_(),E=Im(),z=bg();function I(i){var s="https://react.dev/errors/"+i;if(1<arguments.length){s+="?args[]="+encodeURIComponent(arguments[1]);for(var c=2;c<arguments.length;c++)s+="&args[]="+encodeURIComponent(arguments[c])}return"Minified React error #"+i+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function V(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function X(i){var s=i,c=i;if(i.alternate)for(;s.return;)s=s.return;else{i=s;do s=i,(s.flags&4098)!==0&&(c=s.return),i=s.return;while(i)}return s.tag===3?c:null}function A(i){if(i.tag===13){var s=i.memoizedState;if(s===null&&(i=i.alternate,i!==null&&(s=i.memoizedState)),s!==null)return s.dehydrated}return null}function u(i){if(X(i)!==i)throw Error(I(188))}function H(i){var s=i.alternate;
vendor: 17,159 bytes, lines 41-48
41if(!s){if(s=X(i),s===null)throw Error(I(188));return s!==i?null:i}for(var c=i,p=s;;){var v=c.return;if(v===null)break;var M=v.alternate;if(M===null){if(p=v.return,p!==null){c=p;continue}break}if(v.child===M.child){for(M=v.child;M;){if(M===c)return u(v),i;if(M===p)return u(v),s;M=M.sibling}throw Error(I(188))}if(c.return!==p.return)c=v,p=M;else{for(var N=!1,K=v.child;K;){if(K===c){N=!0,c=v,p=M;break}if(K===p){N=!0,p=v,c=M;break}K=K.sibling}if(!N){for(K=M.child;K;){if(K===c){N=!0,c=M,p=v;break}if(K===p){N=!0,p=M,c=v;break}K=K.sibling}if(!N)throw Error(I(189))}}if(c.alternate!==p)throw Error(I(190))}if(c.tag!==3)throw Error(I(188));return c.stateNode.current===c?i:s}function ne(i){var s=i.tag;if(s===5||s===26||s===27||s===6)return i;for(i=i.child;i!==null;){if(s=ne(i),s!==null)return s;i=i.sibling}return null}var se=Object.assign,we=Symbol.for("react.element"),Ce=Symbol.for("react.transitional.element"),ie=Symbol.for("react.portal"),Fe=Symbol.for("react.fragment"),He=Symbol.for("react.strict_mode"),xe=Symbol.for("react.profiler"),et=Symbol.for("react.provider"),qe=Symbol.for("react.consumer"),tt=Symbol.for("react.context"),ut=Symbol.for("react.forward_ref"),Ze=Symbol.for("react.suspense"),_t=Symbol.for("react.suspense_list"),Tt=Symbol.for("react.memo"),xt=Symbol.for("react.lazy"),Gt=Symbol.for("react.activity"),hi=Symbol.for("react.memo_cache_sentinel"),mi=Symbol.iterator;function Jt(i){return i===null||typeof i!="object"?null:(i=mi&&i[mi]||i["@@iterator"],typeof i=="function"?i:null)}var fr=Symbol.for("react.client.reference");function Ir(i){if(i==null)return null;if(typeof i=="function")return i.$$typeof===fr?null:i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case Fe:return"Fragment";case xe:return"Profiler";case He:return"StrictMode";case Ze:return"Suspense";case _t:return"SuspenseList";case Gt:return"Activity"}if(typeof i=="object")switch(i.$$typeof){case ie:return"Portal";case tt:return(i.displayName||"Context")+".Provider";case qe:return(i._context.displayName||"Context")+".Consumer";case ut:var s=i.render;return i=i.displayName,i||(i=s.displayName||s.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case Tt:return s=i.displayName||null,s!==null?s:Ir(i.type)||"Memo";case xt:s=i._payload,i=i._init;try{return Ir(i(s))}catch{}}return null}var yi=Array.isArray,Ve=E.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ht=z.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,nt={pending:!1,data:null,method:null,action:null},bt=[],_e=-1;function Xe(i){return{current:i}}function vt(i){0>_e||(i.current=bt[_e],bt[_e]=null,_e--)}function at(i,s){_e++,bt[_e]=i.current,i.current=s}var wt=Xe(null),Ft=Xe(null),zt=Xe(null),di=Xe(null);function si(i,s){switch(at(zt,s),at(Ft,i),at(wt,null),s.nodeType){case 9:case 11:i=(i=s.documentElement)&&(i=i.namespaceURI)?Dp(i):0;break;default:if(i=s.tagName,s=s.namespaceURI)s=Dp(s),i=Df(s,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}vt(wt),at(wt,i)}function Ji(){vt(wt),vt(Ft),vt(zt)}function zn(i){i.memoizedState!==null&&at(di,i);var s=wt.current,c=Df(s,i.type);s!==c&&(at(Ft,i),at(wt,c))}function kn(i){Ft.current===i&&(vt(wt),vt(Ft)),di.current===i&&(vt(di),be._currentValue=nt)}var xr=Object.prototype.hasOwnProperty,qi=R.unstable_scheduleCallback,$i=R.unstable_cancelCallback,Kn=R.unstable_shouldYield,ha=R.unstable_requestPaint,Kr=R.unstable_now,da=R.unstable_getCurrentPriorityLevel,Wn=R.unstable_ImmediatePriority,ms=R.unstable_UserBlockingPriority,Qn=R.unstable_NormalPriority,Qa=R.unstable_LowPriority,Da=R.unstable_IdlePriority,gs=R.log,Yt=R.unstable_setDisableYieldValue,Ti=null,sr=null;function In(i){if(typeof gs=="function"&&Yt(i),sr&&typeof sr.setStrictMode=="function")try{sr.setStrictMode(Ti,i)}catch{}}var ye=Math.clz32?Math.clz32:W,Z=Math.log,Y=Math.LN2;function W(i){return i>>>=0,i===0?32:31-(Z(i)/Y|0)|0}var ce=256,me=4194304;function ve(i){var s=i&42;if(s!==0)return s;switch(i&-i){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:case 262144:case 524288:case 1048576:case 2097152:return i&4194048;case 4194304:case 8388608:case 16777216:case 33554432:return i&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return i}}function Re(i,s,c){var p=i.pendingLanes;if(p===0)return 0;var v=0,M=i.suspendedLanes,N=i.pingedLanes;i=i.warmLanes;var K=p&134217727;return K!==0?(p=K&~M,p!==0?v=ve(p):(N&=K,N!==0?v=ve(N):c||(c=K&~i,c!==0&&(v=ve(c))))):(K=p&~M,K!==0?v=ve(K):N!==0?v=ve(N):c||(c=p&~i,c!==0&&(v=ve(c)))),v===0?0:s!==0&&s!==v&&(s&M)===0&&(M=v&-v,c=s&-s,M>=c||M===32&&(c&4194048)!==0)?s:v}function Te(i,s){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&s)===0}function Ge(i,s){switch(i){case 1:case 2:case 4:case 8:case 64:return s+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 s+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function rt(){var i=ce;return ce<<=1,(ce&4194048)===0&&(ce=256),i}function Ye(){var i=me;return me<<=1,(me&62914560)===0&&(me=4194304),i}function Ct(i){for(var s=[],c=0;31>c;c++)s.push(i);return s}function Me(i,s){i.pendingLanes|=s,s!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function Zt(i,s,c,p,v,M){var N=i.pendingLanes;i.pendingLanes=c,i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0,i.expiredLanes&=c,i.entangledLanes&=c,i.errorRecoveryDisabledLanes&=c,i.shellSuspendCounter=0;var K=i.entanglements,fe=i.expirationTimes,Be=i.hiddenUpdates;for(c=N&~c;0<c;){var Ke=31-ye(c),it=1<<Ke;K[Ke]=0,fe[Ke]=-1;var je=Be[Ke];if(je!==null)for(Be[Ke]=null,Ke=0;Ke<je.length;Ke++){var Ue=je[Ke];Ue!==null&&(Ue.lane&=-536870913)}c&=~it}p!==0&&oi(i,p,0),M!==0&&v===0&&i.tag!==0&&(i.suspendedLanes|=M&~(N&~s))}function oi(i,s,c){i.pendingLanes|=s,i.suspendedLanes&=~s;var p=31-ye(s);i.entangledLanes|=s,i.entanglements[p]=i.entanglements[p]|1073741824|c&4194090}function kt(i,s){var c=i.entangledLanes|=s;for(i=i.entanglements;c;){var p=31-ye(c),v=1<<p;v&s|i[p]&s&&(i[p]|=s),c&=~v}}function Kt(i){switch(i){case 2:i=1;break;case 8:i=4;break;case 32:i=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:i=128;break;case 268435456:i=134217728;break;default:i=0}return i}function Bi(i){return i&=-i,2<i?8<i?(i&134217727)!==0?32:268435456:8:2}function jr(){var i=ht.p;return i!==0?i:(i=window.event,i===void 0?32:Rt(i.type))}function Zr(i,s){var c=ht.p;try{return ht.p=i,s()}finally{ht.p=c}}var Fi=Math.random().toString(36).slice(2),Nt="__reactFiber$"+Fi,qt="__reactProps$"+Fi,er="__reactContainer$"+Fi,st="__reactEvents$"+Fi,mn="__reactListeners$"+Fi,pr="__reactHandles$"+Fi,_s="__reactResources$"+Fi,Ja="__reactMarker$"+Fi;function gt(i){delete i[Nt],delete i[qt],delete i[st],delete i[mn],delete i[pr]}function ei(i){var s=i[Nt];if(s)return s;for(var c=i.parentNode;c;){if(s=c[er]||c[Nt]){if(c=s.alternate,s.child!==null||c!==null&&c.child!==null)for(i=$c(i);i!==null;){if(c=i[Nt])return c;i=$c(i)}return s}i=c,c=i.parentNode}return null}function Ht(i){if(i=i[Nt]||i[er]){var s=i.tag;if(s===5||s===6||s===13||s===26||s===27||s===3)return i}return null}function Rr(i){var s=i.tag;if(s===5||s===26||s===27||s===6)return i.stateNode;throw Error(I(33))}function fa(i){var s=i[_s];return s||(s=i[_s]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function tr(i){i[Ja]=!0}var ti=new Set,Wl={};function qn(i,s){ys(i,s),ys(i+"Capture",s)}function ys(i,s){for(Wl[i]=s,i=0;i<s.length;i++)ti.add(s[i])}var es=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]*$"),So={},mr={};function Wc(i){return xr.call(mr,i)?!0:xr.call(So,i)?!1:es.test(i)?mr[i]=!0:(So[i]=!0,!1)}function tn(i,s,c){if(Wc(s))if(c===null)i.removeAttribute(s);else{switch(typeof c){case"undefined":case"function":case"symbol":i.removeAttribute(s);return;case"boolean":var p=s.toLowerCase().slice(0,5);if(p!=="data-"&&p!=="aria-"){i.removeAttribute(s);return}}i.setAttribute(s,""+c)}}function Ei(i,s,c){if(c===null)i.removeAttribute(s);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(s);return}i.setAttribute(s,""+c)}}function ts(i,s,c,p){if(p===null)i.removeAttribute(c);else{switch(typeof p){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(c);return}i.setAttributeNS(s,c,""+p)}}var To,Qc;function Jn(i){if(To===void 0)try{throw Error()}catch(c){var s=c.stack.trim().match(/\n( *(at )?)/);To=s&&s[1]||"",Qc=-1<c.stack.indexOf(`
42    at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return`
43`+To+i+Qc}var is=!1;function Ql(i,s){if(!i||is)return"";is=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var p={DetermineComponentFrameRoot:function(){try{if(s){var it=function(){throw Error()};if(Object.defineProperty(it.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(it,[])}catch(Ue){var je=Ue}Reflect.construct(i,[],it)}else{try{it.call()}catch(Ue){je=Ue}i.call(it.prototype)}}else{try{throw Error()}catch(Ue){je=Ue}(it=i())&&typeof it.catch=="function"&&it.catch(function(){})}}catch(Ue){if(Ue&&je&&typeof Ue.stack=="string")return[Ue.stack,je.stack]}return[null,null]}};p.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var v=Object.getOwnPropertyDescriptor(p.DetermineComponentFrameRoot,"name");v&&v.configurable&&Object.defineProperty(p.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var M=p.DetermineComponentFrameRoot(),N=M[0],K=M[1];if(N&&K){var fe=N.split(`
44`),Be=K.split(`
45`);for(v=p=0;p<fe.length&&!fe[p].includes("DetermineComponentFrameRoot");)p++;for(;v<Be.length&&!Be[v].includes("DetermineComponentFrameRoot");)v++;if(p===fe.length||v===Be.length)for(p=fe.length-1,v=Be.length-1;1<=p&&0<=v&&fe[p]!==Be[v];)v--;for(;1<=p&&0<=v;p--,v--)if(fe[p]!==Be[v]){if(p!==1||v!==1)do if(p--,v--,0>v||fe[p]!==Be[v]){var Ke=`
46`+fe[p].replace(" at new "," at ");return i.displayName&&Ke.includes("<anonymous>")&&(Ke=Ke.replace("<anonymous>",i.displayName)),Ke}while(1<=p&&0<=v);break}}}finally{is=!1,Error.prepareStackTrace=c}return(c=i?i.displayName||i.name:"")?Jn(c):""}function Hh(i){switch(i.tag){case 26:case 27:case 5:return Jn(i.type);case 16:return Jn("Lazy");case 13:return Jn("Suspense");case 19:return Jn("SuspenseList");case 0:case 15:return Ql(i.type,!1);case 11:return Ql(i.type.render,!1);case 1:return Ql(i.type,!0);case 31:return Jn("Activity");default:return""}}function Hu(i){try{var s="";do s+=Hh(i),i=i.return;while(i);return s}catch(c){return`
47Error generating stack: `+c.message+`
48`+c.stack}}function rn(i){switch(typeof i){case"bigint":case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function Xu(i){var s=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function Xd(i){var s=Xu(i)?"checked":"value",c=Object.getOwnPropertyDescriptor(i.constructor.prototype,s),p=""+i[s];if(!i.hasOwnProperty(s)&&typeof c<"u"&&typeof c.get=="function"&&typeof c.set=="function"){var v=c.get,M=c.set;return Object.defineProperty(i,s,{configurable:!0,get:function(){return v.call(this)},set:function(N){p=""+N,M.call(this,N)}}),Object.defineProperty(i,s,{enumerable:c.enumerable}),{getValue:function(){return p},setValue:function(N){p=""+N},stopTracking:function(){i._valueTracker=null,delete i[s]}}}}function Jc(i){i._valueTracker||(i._valueTracker=Xd(i))}function Xh(i){if(!i)return!1;var s=i._valueTracker;if(!s)return!0;var c=s.getValue(),p="";return i&&(p=Xu(i)?i.checked?"true":"false":i.value),i=p,i!==c?(s.setValue(i),!0):!1}function cl(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}var ul=/[\n"\\]/g;function $n(i){return i.replace(ul,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function Jl(i,s,c,p,v,M,N,K){i.name="",N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"?i.type=N:i.removeAttribute("type"),s!=null?N==="number"?(s===0&&i.value===""||i.value!=s)&&(i.value=""+rn(s)):i.value!==""+rn(s)&&(i.value=""+rn(s)):N!=="submit"&&N!=="reset"||i.removeAttribute("value"),s!=null?ec(i,N,rn(s)):c!=null?ec(i,N,rn(c)):p!=null&&i.removeAttribute("value"),v==null&&M!=null&&(i.defaultChecked=!!M),v!=null&&(i.checked=v&&typeof v!="function"&&typeof v!="symbol"),K!=null&&typeof K!="function"&&typeof K!="symbol"&&typeof K!="boolean"?i.name=""+rn(K):i.removeAttribute("name")}function Mo(i,s,c,p,v,M,N,K){if(M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"&&(i.type=M),s!=null||c!=null){if(!(M!=="submit"&&M!=="reset"||s!=null))return;c=c!=null?""+rn(c):"",s=s!=null?""+rn(s):c,K||s===i.value||(i.value=s),i.defaultValue=s}p=p??v,p=typeof p!="function"&&typeof p!="symbol"&&!!p,i.checked=K?i.checked:!!p,i.defaultChecked=!!p,N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"&&(i.name=N)}function ec(i,s,c){s==="number"&&cl(i.ownerDocument)===i||i.defaultValue===""+c||(i.defaultValue=""+c)}function Vs(i,s,c,p){if(i=i.options,s){s={};for(var v=0;v<c.length;v++)s["$"+c[v]]=!0;for(c=0;c<i.length;c++)v=s.hasOwnProperty("$"+i[c].value),i[c].selected!==v&&(i[c].selected=v),v&&p&&(i[c].defaultSelected=!0)}else{for(c=""+rn(c),s=null,v=0;v<i.length;v++){if(i[v].value===c){i[v].selected=!0,p&&(i[v].defaultSelected=!0);return}s!==null||i[v].disabled||(s=i[v])}s!==null&&(s.selected=!0)}}function Yh(i,s,c){if(s!=null&&(s=""+rn(s),s!==i.value&&(i.value=s),c==null)){i.defaultValue!==s&&(i.defaultValue=s);return}i.defaultValue=c!=null?""+rn(c):""}function Co(i,s,c,p){if(s==null){if(p!=null){if(c!=null)throw Error(I(92));if(yi(p)){if(1<p.length)throw Error(I(93));p=p[0]}c=p}c==null&&(c=""),s=c}c=rn(s),i.defaultValue=c,p=i.textContent,p===c&&p!==""&&p!==null&&(i.value=p)}function rs(i,s){if(s){var c=i.firstChild;if(c&&c===i.lastChild&&c.nodeType===3){c.nodeValue=s;return}}i.textContent=s}var La=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 li(i,s,c){var p=s.indexOf("--")===0;c==null||typeof c=="boolean"||c===""?p?i.setProperty(s,""):s==="float"?i.cssFloat="":i[s]="":p?i.setProperty(s,c):typeof c!="number"||c===0||La.has(s)?s==="float"?i.cssFloat=c:i[s]=(""+c).trim():i[s]=c+"px"}function Gs(i,s,c){if(s!=null&&typeof s!="object")throw Error(I(62));if(i=i.style,c!=null){for(var p in c)!c.hasOwnProperty(p)||s!=null&&s.hasOwnProperty(p)||(p.indexOf("--")===0?i.setProperty(p,""):p==="float"?i.cssFloat="":i[p]="");for(var v in s)p=s[v],s.hasOwnProperty(v)&&c[v]!==p&&li(i,v,p)}else for(var M in s)s.hasOwnProperty(M)&&li(i,M,s[M])}function ns(i){if(i.indexOf("-")===-1)return!1;switch(i){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 xs=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"],["colorRen
48dering","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"]]),Eo=/^[\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 ai(i){return Eo.test(""+i)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":i}var vs=null;function hl(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var bs=null,Nr=null;function qr(i){var s=Ht(i);if(s&&(i=s.stateNode)){var c=i[qt]||null;e:switch(i=s.stateNode,s.type){case"input":if(Jl(i,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name),s=c.name,c.type==="radio"&&s!=null){for(c=i;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll('input[name="'+$n(""+s)+'"][type="radio"]'),s=0;s<c.length;s++){var p=c[s];if(p!==i&&p.form===i.form){var v=p[qt]||null;if(!v)throw Error(I(90));Jl(p,v.value,v.defaultValue,v.defaultValue,v.checked,v.defaultChecked,v.type,v.name)}}for(s=0;s<c.length;s++)p=c[s],p.form===i.form&&Xh(p)}break e;case"textarea":Yh(i,c.value,c.defaultValue);break e;case"select":s=c.value,s!=null&&Vs(i,!!c.multiple,s,!1)}}}var nn=!1;function Dr(i,s,c){if(nn)return i(s,c);nn=!0;try{var p=i(s);return p}finally{if(nn=!1,(bs!==null||Nr!==null)&&(Ed(),bs&&(s=bs,i=Nr,Nr=bs=null,qr(s),i)))for(s=0;s<i.length;s++)qr(i[s])}}function Mi(i,s){var c=i.stateNode;if(c===null)return null;var p=c[qt]||null;if(p===null)return null;c=p[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(p=!p.disabled)||(i=i.type,p=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!p;break e;default:i=!1}if(i)return null;if(c&&typeof c!="function")throw Error(I(231,s,typeof c));return c}var as=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),an=!1;if(as)try{var sn={};Object.defineProperty(sn,"passive",{get:function(){an=!0}}),window.addEventListener("test",sn,sn),window.removeEventListener("test",sn,sn)}catch{an=!1}var gr=null,Ui=null,ss=null;function jt(){if(ss)return ss;var i,s=Ui,c=s.length,p,v="value"in gr?gr.value:gr.textContent,M=v.length;for(i=0;i<c&&s[i]===v[i];i++);var N=c-i;for(p=1;p<=N&&s[c-p]===v[M-p];p++);return ss=v.slice(i,1<p?1-p:void 0)}function $t(i){var s=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&s===13&&(i=13)):i=s,i===10&&(i=13),32<=i||i===13?i:0}function pa(){return!0}function fi(){return!1}function Hi(i){function s(c,p,v,M,N){this._reactName=c,this._targetInst=v,this.type=p,this.nativeEvent=M,this.target=N,this.currentTarget=null;for(var K in i)i.hasOwnProperty(K)&&(c=i[K],this[K]=c?c(M):M[K]);return this.isDefaultPrevented=(M.defaultPrevented!=null?M.defaultPrevented:M.returnValue===!1)?pa:fi,this.isPropagationStopped=fi,this}return se(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=pa)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=pa)},persist:function(){},isPersistent:pa}),s}var gn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ea=Hi(gn),Zs=se({},gn,{view:0,detail:0}),Yu=Hi(Zs),qs,Ao,$s,Po=se({},Zs,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Io,button:0,buttons:0,relatedTarget:function(i){return i.relatedTarget===void 0?i.fromElement===i.srcElement?i.toElement:i.fromElement:i.relatedTarget},movementX:function(i){return"movementX"in i?i.movementX:(i!==$s&&($s&&i.type==="mousemove"?(qs=i.screenX-$s.screenX,Ao=i.screenY-$s.screenY):Ao=qs=0,$s=i),qs)},movementY:function(i){return"movementY"in i?i.movementY:Ao}}),tc=Hi(Po),Ba=se({},Po,{dataTransfer:0}),Wr=Hi(Ba),dl=se({},Zs,{relatedTarget:0}),zo=Hi(dl),ko=se({},gn,{animationName:0,elapsedTime:0,pseudoElement:0}),vr=Hi(ko),Kh=se({},gn,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}
vendor: 1,039 bytes, line 48
48),ic=Hi(Kh),Ku=se({},gn,{data:0}),Wh=Hi(Ku),fl={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},on={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"},rc={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function os(i){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(i):(i=rc[i])?!!s[i]:!1}function Io(){return os}var nc=se({},Zs,{key:function(i){if(i.key){var s=fl[i.key]||i.key;if(s!=="Unidentified")return s}return i.type==="keypress"?(i=$t(i),i===13?"Enter":String.fromCharCode(i)):i.type==="
48keydown"||i.type==="keyup"?on[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Io,charCode:function(i){return i.type==="keypress"?$t(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?$t(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),ac=Hi(nc),_n=se({},Po,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Wu=Hi(_n),eu=se({},Zs,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Io}),Yd=Hi(eu),Qu=se({},gn,{propertyName:0,elapsedTime:0,pseudoElement:0}),Kd=Hi(Qu),Wd=se({},Po,{deltaX:function(i){return"deltaX"in i?i.deltaX:"wheelDeltaX"in i?-i.wheelDeltaX:0},deltaY:function(i){return"deltaY"in i?i.deltaY:"wheelDeltaY"in i?-i.wheelDeltaY:"wheelDelta"in i?-i.wheelDelta:0},deltaZ:0,deltaMode:0}),tu=Hi(Wd),Ju=se({},gn,{newState:0,oldState:0}),Ro=Hi(Ju),eh=[9,13,27,32],pl=as&&"CompositionEvent"in window,Rn=null;as&&"documentMode"in document&&(Rn=document.documentMode);var Qd=as&&"TextEvent"in window&&!Rn,sc=as&&(!pl||Rn&&8<Rn&&11>=Rn),ml=" ",gl=!1;function Qh(i,s){switch(i){case"keyup":return eh.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function oc(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var _l=!1;function Do(i,s){switch(i){case"compositionend":return oc(s);case"keypress":return s.which!==32?null:(gl=!0,ml);case"textInput":return i=s.data,i===ml&&gl?null:i;default:return null}}function Jh(i,s){if(_l)return i==="compositionend"||!pl&&Qh(i,s)?(i=jt(),ss=Ui=gr=null,_l=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return sc&&s.locale!=="ko"?null:s.data;default:return null}}var th={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 ed(i){var s=i&&i.nodeName&&i.nodeName.toLowerCase();return s==="input"?!!th[i.type]:s==="textarea"}function ih(i,s,c,p){bs?Nr?Nr.push(p):Nr=[p]:bs=p,s=Bh(s,"onChange"),0<s.length&&(c=new ea("onChange","change",null,c,p),i.push({event:c,listeners:s}))}var Lo=null,yl=null;function iu(i){kp(i,0)}function lc(i){var s=Rr(i);if(Xh(s))return i}function rh(i,s){if(i==="change")return s}var Hs=!1;if(as){var cc;if(as){var uc="oninput"in document;if(!uc){var xl=document.createElement("div");xl.setAttribute("oninput","return;"),uc=typeof xl.oninput=="function"}cc=uc}else cc=!1;Hs=cc&&(!document.documentMode||9<document.documentMode)}function td(){Lo&&(Lo.detachEvent("onpropertychange",vl),yl=Lo=null)}function vl(i){if(i.propertyName==="value"&&lc(yl)){var s=[];ih(s,yl,i,hl(i)),Dr(iu,s)}}function id(i,s,c){i==="focusin"?(td(),Lo=s,yl=c,Lo.attachEvent("onpropertychange",vl)):i==="focusout"&&td()}function Jd(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return lc(yl)}function rd(i,s){if(i==="click")return lc(s)}function nd(i,s){if(i==="input"||i==="change")return lc(s)}function nh(i,s){return i===s&&(i!==0||1/i===1/s)||i!==i&&s!==s}var Dn=typeof Object.is=="function"?Object.is:nh;function bl(i,s){if(Dn(i,s))return!0;if(typeof i!="object"||i===null||typeof s!="object"||s===null)return!1;var c=Object.keys(i),p=Object.keys(s);if(c.length!==p.length)return!1;for(p=0;p<c.length;p++){var v=c[p];if(!xr.call(s,v)||!Dn(i[v],s[v]))return!1}return!0}function hc(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function ls(i,s){var c=hc(i);i=0;for(var p;c;){if(c.nodeType===3){if(p=i+c.textContent.length,i<=s&&p>=s)return{node:c,offset:s-i};i=p}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=hc(c)}}function xi(i,s){return i&&s?i===s?!0:i&&i.nodeType===3?!1:s&&s.nodeType===3?xi(i,s.parentNode):"contains"in i?i.contains(s):i.
vendor: 76,667 bytes, line 48
48compareDocumentPosition?!!(i.compareDocumentPosition(s)&16):!1:!1}function ru(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var s=cl(i.document);s instanceof i.HTMLIFrameElement;){try{var c=typeof s.contentWindow.location.href=="string"}catch{c=!1}if(c)i=s.contentWindow;else break;s=cl(i.document)}return s}function dc(i){var s=i&&i.nodeName&&i.nodeName.toLowerCase();return s&&(s==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||s==="textarea"||i.contentEditable==="true")}var ad=as&&"documentMode"in document&&11>=document.documentMode,Xs=null,ws=null,Bo=null,ah=!1;function sd(i,s,c){var p=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;ah||Xs==null||Xs!==cl(p)||(p=Xs,"selectionStart"in p&&dc(p)?p={start:p.selectionStart,end:p.selectionEnd}:(p=(p.ownerDocument&&p.ownerDocument.defaultView||window).getSelection(),p={anchorNode:p.anchorNode,anchorOffset:p.anchorOffset,focusNode:p.focusNode,focusOffset:p.focusOffset}),Bo&&bl(Bo,p)||(Bo=p,p=Bh(ws,"onSelect"),0<p.length&&(s=new ea("onSelect","select",null,s,c),i.push({event:s,listeners:p}),s.target=Xs)))}function Oo(i,s){var c={};return c[i.toLowerCase()]=s.toLowerCase(),c["Webkit"+i]="webkit"+s,c["Moz"+i]="moz"+s,c}var wl={animationend:Oo("Animation","AnimationEnd"),animationiteration:Oo("Animation","AnimationIteration"),animationstart:Oo("Animation","AnimationStart"),transitionrun:Oo("Transition","TransitionRun"),transitionstart:Oo("Transition","TransitionStart"),transitioncancel:Oo("Transition","TransitionCancel"),transitionend:Oo("Transition","TransitionEnd")},nu={},od={};as&&(od=document.createElement("div").style,"AnimationEvent"in window||(delete wl.animationend.animation,delete wl.animationiteration.animation,delete wl.animationstart.animation),"TransitionEvent"in window||delete wl.transitionend.transition);function Ys(i){if(nu[i])return nu[i];if(!wl[i])return i;var s=wl[i],c;for(c in s)if(s.hasOwnProperty(c)&&c in od)return nu[i]=s[c];return i}var fc=Ys("animationend"),pc=Ys("animationiteration"),mc=Ys("animationstart"),sh=Ys("transitionrun"),jo=Ys("transitionstart"),gc=Ys("transitioncancel"),No=Ys("transitionend"),ta=new Map,au="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(" ");au.push("scrollEnd");function ma(i,s){ta.set(i,s),qn(s,[i])}var su=new WeakMap;function Qr(i,s){if(typeof i=="object"&&i!==null){var c=su.get(i);return c!==void 0?c:(s={value:i,source:s,stack:Hu(s)},su.set(i,s),s)}return{value:i,source:s,stack:Hu(s)}}var Ln=[],Ss=0,Fo=0;function Uo(){for(var i=Ss,s=Fo=Ss=0;s<i;){var c=Ln[s];Ln[s++]=null;var p=Ln[s];Ln[s++]=null;var v=Ln[s];Ln[s++]=null;var M=Ln[s];if(Ln[s++]=null,p!==null&&v!==null){var N=p.pending;N===null?v.next=v:(v.next=N.next,N.next=v),p.pending=v}M!==0&&oh(c,v,M)}}function _c(i,s,c,p){Ln[Ss++]=i,Ln[Ss++]=s,Ln[Ss++]=c,Ln[Ss++]=p,Fo|=p,i.lanes|=p,i=i.alternate,i!==null&&(i.lanes|=p)}function Ks(i,s,c,p){return _c(i,s,c,p),Sl(i)}function ia(i,s){return _c(i,null,null,s),Sl(i)}function oh(i,s,c){i.lanes|=c;var p=i.alternate;p!==null&&(p.lanes|=c);for(var v=!1,M=i.return;M!==null;)M.childLanes|=c,p=M.alternate,p!==null&&(p.childLanes|=c),M.tag===22&&(i=M.stateNode,i===null||i._visibility&1||(v=!0)),i=M,M=M.return;return i.tag===3?(M=i.stateNode,v&&s!==null&&(v=31-ye(c),i=M.hiddenUpdates,p=i[v],p===null?i[v]=[s]:p.push(s),s.lane=c|536870912),M):null}function Sl(i){if(50<Fc)throw Fc=0,Zl=null,Error(I(185));for(var s=i.return;s!==null;)i=s,s=i.return;return i.tag===3?i.stateNode:null}var ni={};function yc(i,s,c,p){this.tag=i,this.key=c,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=p,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ra(i,s,c,p){return new yc(i,s,c,p)}function ou(i){return i=i.prototype,!(!i||!i.isReactComponent)}function yn(i,s){var c=i.alternate;return c===null?(c=ra(i.tag,s,i.key,i.mode),c.elementType=i.elementType,c.type=i.type,c.stateNode=i.stateNode,c.alternate=i,i.alternate=c):(c.pendingProps=s,c.type=i.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=i.flags&65011712,c.childLanes=i.childLanes,c.lanes=i.lanes,c.child=i.child,c.memoizedProps=i.memoizedProps,c.memoizedState=i.memoizedState,c.updateQueue=i.updateQueue,s=i.dependencies,c.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},c.sibling=i.sibling,c.index=i.index,c.ref=i.ref,c.refCleanup=i.refCleanup,c}function lh(i,s){i.flags&=65011714;var c=i.alternate;return c===null?(i.childLanes=0,i.lanes=s,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=c.childLanes,i.lanes=c.lanes,i.child=c.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=c.memoizedProps,i.memoizedState=c.memoizedState,i.updateQueue=c.updateQueue,i.type=c.type,s=c.dependencies,i.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),i}function lu(i,s,c,p,v,M){var N=0;if(p=i,typeof i=="function")ou(i)&&(N=1);else if(typeof i=="string")N=b(i,c,wt.current)?26:i==="html"||i==="head"||i==="body"?27:5;else e:switch(i){case Gt:return i=ra(31,c,s,v),i.elementType=Gt,i.lanes=M,i;case Fe:return Ws(c.children,v,M,s);case He:N=8,v|=24;break;case xe:return i=ra(12,c,s,v|2),i.elementType=xe,i.lanes=M,i;case Ze:return i=ra(13,c,s,v),i.elementType=Ze,i.lanes=M,i;case _t:return i=ra(19,c,s,v),i.elementType=_t,i.lanes=M,i;default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case et:case tt:N=10;break e;case qe:N=9;break e;case ut:N=11;break e;case Tt:N=14;break e;case xt:N=16,p=null;break e}N=29,c=Error(I(130,i===null?"null":typeof i,"")),p=null}return s=ra(N,c,s,v),s.elementType=i,s.type=p,s.lanes=M,s}function Ws(i,s,c,p){return i=ra(7,i,p,s),i.lanes=c,i}function ch(i,s,c){return i=ra(6,i,null,s),i.lanes=c,i}function xc(i,s,c){return s=ra(4,i.children!==null?i.children:[],i.key,s),s.lanes=c,s.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},s}var Ts=[],cs=0,Qs=null,Tl=0,na=[],xn=0,Oa=null,aa=1,ga="";function Ms(i,s){Ts[cs++]=Tl,Ts[cs++]=Qs,Qs=i,Tl=s}function Js(i,s,c){na[xn++]=aa,na[xn++]=ga,na[xn++]=Oa,Oa=i;var p=aa;i=ga;var v=32-ye(p)-1;p&=~(1<<v),c+=1;var M=32-ye(s)+v;if(30<M){var N=v-v%5;M=(p&(1<<N)-1).toString(32),p>>=N,v-=N,aa=1<<32-ye(s)+v|c<<v|p,ga=M+i}else aa=1<<M|c<<v|p,ga=i}function vc(i){i.return!==null&&(Ms(i,1),Js(i,1,0))}function Ml(i){for(;i===Qs;)Qs=Ts[--cs],Ts[cs]=null,Tl=Ts[--cs],Ts[cs]=null;for(;i===Oa;)Oa=na[--xn],na[xn]=null,ga=na[--xn],na[xn]=null,aa=na[--xn],na[xn]=null}var Lr=null,or=null,Ci=!1,eo=null,sa=!1,bc=Error(I(519));function Vo(i){var s=Error(I(418,""));throw Cs(Qr(s,i)),bc}function cu(i){var s=i.stateNode,c=i.type,p=i.memoizedProps;switch(s[Nt]=i,s[qt]=p,c){case"dialog":wi("cancel",s),wi("close",s);break;case"iframe":case"object":case"embed":wi("load",s);break;case"video":case"audio":for(c=0;c<Dh.length;c++)wi(Dh[c],s);break;case"source":wi("error",s);break;case"img":case"image":case"link":wi("error",s),wi("load",s);break;case"details":wi("toggle",s);break;case"input":wi("invalid",s),Mo(s,p.value,p.defaultValue,p.checked,p.defaultChecked,p.type,p.name,!0),Jc(s);break;case"select":wi("invalid",s);break;case"textarea":wi("invalid",s),Co(s,p.value,p.defaultValue,p.children),Jc(s)}c=p.children,typeof c!="string"&&typeof c!="number"&&typeof c!="bigint"||s.textContent===""+c||p.suppressHydrationWarning===!0||Rf(s.textContent,c)?(p.popover!=null&&(wi("beforetoggle",s),wi("toggle",s)),p.onScroll!=null&&wi("scroll",s),p.onScrollEnd!=null&&wi("scrollend",s),p.onClick!=null&&(s.onclick=Yn),s=!0):s=!1,s||Vo(i)}function lr(i){for(Lr=i.return;Lr;)switch(Lr.tag){case 5:case 13:sa=!1;return;case 27:case 3:sa=!0;return;default:Lr=Lr.return}}function Hn(i){if(i!==Lr)return!1;if(!Ci)return lr(i),Ci=!0,!1;var s=i.tag,c;if((c=s!==3&&s!==27)&&((c=s===5)&&(c=i.type,c=!(c!=="form"&&c!=="button")||yo(i.type,i.memoizedProps)),c=!c),c&&or&&Vo(i),lr(i),s===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(I(317));e:{for(i=i.nextSibling,s=0;i;){if(i.nodeType===8)if(c=i.data,c==="/$"){if(s===0){or=Fs(i.nextSibling);break e}s--}else c!=="$"&&c!=="$!"&&c!=="$?"||s++;i=i.nextSibling}or=null}}else s===27?(s=or,nl(i.type)?(i=Bf,Bf=null,or=i):or=s):or=Lr?Fs(i.stateNode.nextSibling):null;return!0}function vn(){or=Lr=null,Ci=!1}function wc(){var i=eo;return i!==null&&(Ca===null?Ca=i:Ca.push.apply(Ca,i),eo=null),i}function Cs(i){eo===null?eo=[i]:eo.push(i)}var uu=Xe(null),oa=null,_a=null;function bn(i,s,c){at(uu,s._currentValue),s._currentValue=c}function ja(i){i._currentValue=uu.current,vt(uu)}function hu(i,s,c){for(;i!==null;){var p=i.alternate;if((i.childLanes&s)!==s?(i.childLanes|=s,p!==null&&(p.childLanes|=s)):p!==null&&(p.childLanes&s)!==s&&(p.childLanes|=s),i===c)break;i=i.return}}function du(i,s,c,p){var v=i.child;for(v!==null&&(v.return=i);v!==null;){var M=v.dependencies;if(M!==null){var N=v.child;M=M.firstContext;e:for(;M!==null;){var K=M;M=v;for(var fe=0;fe<s.length;fe++)if(K.context===s[fe]){M.lanes|=c,K=M.alternate,K!==null&&(K.lanes|=c),hu(M.return,c,i),p||(N=null);break e}M=K.next}}else if(v.tag===18){if(N=v.return,N===null)throw Error(I(341));N.lanes|=c,M=N.alternate,M!==null&&(M.lanes|=c),hu(N,c,i),N=null}else N=v.child;if(N!==null)N.return=v;else for(N=v;N!==null;){if(N===i){N=null;break}if(v=N.sibling,v!==null){v.return=N.return,N=v;break}N=N.return}v=N}}function Cl(i,s,c,p){i=null;for(var v=s,M=!1;v!==null;){if(!M){if((v.flags&524288)!==0)M=!0;else if((v.flags&262144)!==0)break}if(v.tag===10){var N=v.alternate;if(N===null)throw Error(I(387));if(N=N.memoizedProps,N!==null){var K=v.type;Dn(v.pendingProps.value,N.value)||(i!==null?i.push(K):i=[K])}}else if(v===di.current){if(N=v.alternate,N===null)throw Error(I(387));N.memoizedState.memoizedState!==v.memoizedState.memoizedState&&(i!==null?i.push(be):i=[be])}v=v.return}i!==null&&du(s,i,c,p),s.flags|=262144}function Sc(i){for(i=i.firstContext;i!==null;){if(!Dn(i.context._currentValue,i.memoizedValue))return!0;i=i.next}return!1}function to(i){oa=i,_a=null,i=i.dependencies,i!==null&&(i.firstContext=null)}function Xi(i){return Bn(oa,i)}function Es(i,s){return oa===null&&to(i),Bn(i,s)}function Bn(i,s){var c=s._currentValue;if(s={context:s,memoizedValue:c,next:null},_a===null){if(i===null)throw Error(I(308));_a=s,i.dependencies={lanes:0,firstContext:s},i.flags|=524288}else _a=_a.next=s;return c}var El=typeof AbortController<"u"?AbortController:function(){var i=[],s=this.signal={aborted:!1,addEventListener:function(c,p){i.push(p)}};this.abort=function(){s.aborted=!0,i.forEach(function(c){return c()})}},uh=R.unstable_scheduleCallback,ld=R.unstable_NormalPriority,Fr={$$typeof:tt,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function io(){return{controller:new El,data:new Map,refCount:0}}function Go(i){i.refCount--,i.refCount===0&&uh(ld,function(){i.controller.abort()})}var us=null,fu=0,$r=0,wn=null;function Al(i,s){if(us===null){var c=us=[];fu=0,$r=Ih(),wn={status:"pending",value:void 0,then:function(p){c.push(p)}}}return fu++,s.then(ya,ya),s}function ya(){if(--fu===0&&us!==null){wn!==null&&(wn.status="fulfilled");var i=us;us=null,$r=0,wn=null;for(var s=0;s<i.length;s++)(0,i[s])()}}function Pl(i,s){var c=[],p={status:"pending",value:null,reason:null,then:function(v){c.push(v)}};return i.then(function(){p.status="fulfilled",p.value=s;for(var v=0;v<c.length;v++)(0,c[v])(s)},function(v){for(p.status="rejected",p.reason=v,v=0;v<c.length;v++)(0,c[v])(void 0)}),p}var cd=Ve.S;Ve.S=function(i,s){typeof s=="object"&&s!==null&&typeof s.then=="function"&&Al(i,s),cd!==null&&cd(i,s)};var Na=Xe(null);function hh(){var i=Na.current;return i!==null?i:dr.pooledCache}function pu(i,s){s===null?at(Na,Na.current):at(Na,s.pool)}function zl(){var i=hh();return i===null?null:{parent:Fr._currentValue,pool:i}}var As=Error(I(460)),xa=Error(I(474)),yt=Error(I(542)),Tc={then:function(){}};function Mc(i){return i=i.status,i==="fulfilled"||i==="rejected"}function kl(){}function Zo(i,s,c){switch(c=i[c],c===void 0?i.push(s):c!==s&&(s.then(kl,kl),s=c),s.status){case"fulfilled":return s.value;case"rejected":throw i=s.reason,ui(i),i;default:if(typeof s.status=="string")s.then(kl,kl);else{if(i=dr,i!==null&&100<i.shellSuspendCounter)throw Error(I(482));i=s,i.status="pending",i.then(function(p){if(s.status==="pending"){var v=s;v.status="fulfilled",v.value=p}},function(p){if(s.status==="pending"){var v=s;v.status="rejected",v.reason=p}})}switch(s.status){case"fulfilled":return s.value;case"rejected":throw i=s.reason,ui(i),i}throw Fa=s,As}}var Fa=null;function Cc(){if(Fa===null)throw Error(I(459));var i=Fa;return Fa=null,i}function ui(i){if(i===As||i===yt)throw Error(I(483))}var Ua=!1;function dh(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Il(i,s){i=i.updateQueue,s.updateQueue===i&&(s.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,callbacks:null})}function ro(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function Ps(i,s,c){var p=i.updateQueue;if(p===null)return null;if(p=p.shared,(Vi&2)!==0){var v=p.pending;return v===null?s.next=s:(s.next=v.next,v.next=s),p.pending=s,s=Sl(i),oh(i,null,c),s}return _c(i,p,s,c),Sl(i)}function qo(i,s,c){if(s=s.updateQueue,s!==null&&(s=s.shared,(c&4194048)!==0)){var p=s.lanes;p&=i.pendingLanes,c|=p,s.lanes=c,kt(i,c)}}function Ec(i,s){var c=i.updateQueue,p=i.alternate;if(p!==null&&(p=p.updateQueue,c===p)){var v=null,M=null;if(c=c.firstBaseUpdate,c!==null){do{var N={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};M===null?v=M=N:M=M.next=N,c=c.next}while(c!==null);M===null?v=M=s:M=M.next=s}else v=M=s;c={baseState:p.baseState,firstBaseUpdate:v,lastBaseUpdate:M,shared:p.shared,callbacks:p.callbacks},i.updateQueue=c;return}i=c.lastBaseUpdate,i===null?c.firstBaseUpdate=s:i.next=s,c.lastBaseUpdate=s}var mu=!1;function Rl(){if(mu){var i=wn;if(i!==null)throw i}}function $o(i,s,c,p){mu=!1;var v=i.updateQueue;Ua=!1;var M=v.firstBaseUpdate,N=v.lastBaseUpdate,K=v.shared.pending;if(K!==null){v.shared.pending=null;var fe=K,Be=fe.next;fe.next=null,N===null?M=Be:N.next=Be,N=fe;var Ke=i.alternate;Ke!==null&&(Ke=Ke.updateQueue,K=Ke.lastBaseUpdate,K!==N&&(K===null?Ke.firstBaseUpdate=Be:K.next=Be,Ke.lastBaseUpdate=fe))}if(M!==null){var it=v.baseState;N=0,Ke=Be=fe=null,K=M;do{var je=K.lane&-536870913,Ue=je!==K.lane;if(Ue?(gi&je)===je:(p&je)===je){je!==0&&je===$r&&(mu=!0),Ke!==null&&(Ke=Ke.next={lane:0,tag:K.tag,payload:K.payload,callback:null,next:null});e:{var Qt=i,Xt=K;je=s;var Qi=c;switch(Xt.tag){case 1:if(Qt=Xt.payload,typeof Qt=="function"){it=Qt.call(Qi,it,je);break e}it=Qt;break e;case 3:Qt.flags=Qt.flags&-65537|128;case 0:if(Qt=Xt.payload,je=typeof Qt=="function"?Qt.call(Qi,it,je):Qt,je==null)break e;it=se({},it,je);break e;case 2:Ua=!0}}je=K.callback,je!==null&&(i.flags|=64,Ue&&(i.flags|=8192),Ue=v.callbacks,Ue===null?v.callbacks=[je]:Ue.push(je))}else Ue={lane:je,tag:K.tag,payload:K.payload,callback:K.callback,next:null},Ke===null?(Be=Ke=Ue,fe=it):Ke=Ke.next=Ue,N|=je;if(K=K.next,K===null){if(K=v.shared.pending,K===null)break;Ue=K,K=Ue.next,Ue.next=null,v.lastBaseUpdate=Ue,v.shared.pending=null}}while(!0);Ke===null&&(fe=it),v.baseState=fe,v.firstBaseUpdate=Be,v.lastBaseUpdate=Ke,M===null&&(v.shared.lanes=0),mo|=N,i.lanes=N,i.memoizedState=it}}function fh(i,s){if(typeof i!="function")throw Error(I(191,i));i.call(s)}function ph(i,s){var c=i.callbacks;if(c!==null)for(i.callbacks=null,i=0;i<c.length;i++)fh(c[i],s)}var Sn=Xe(null),Ai=Xe(0);function Ho(i,s){i=tl,at(Ai,i),at(Sn,s),tl=i|s.baseLanes}function Ac(){at(Ai,tl),at(Sn,Sn.current)}function gu(){tl=Ai.current,vt(Sn),vt(Ai)}var hs=0,ci=null,Oi=null,ji=null,Xo=!1,St=!1,It=!1,Yo=0,va=0,zs=null,On=0;function br(){throw Error(I(321))}function Xn(i,s){if(s===null)return!1;for(var c=0;c<s.length&&c<i.length;c++)if(!Dn(i[c],s[c]))return!1;return!0}function mh(i,s,c,p,v,M){return hs=M,ci=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,Ve.H=i===null||i.memoizedState===null?wa:Mn,It=!1,M=c(p,v),It=!1,St&&(M=ki(s,c,p,v)),Dl(i),M}function Dl(i){Ve.H=ln;var s=Oi!==null&&Oi.next!==null;if(hs=0,ji=Oi=ci=null,Xo=!1,va=0,zs=null,s)throw Error(I(300));i===null||Xr||(i=i.dependencies,i!==null&&Sc(i)&&(Xr=!0))}function ki(i,s,c,p){ci=i;var v=0;do{if(St&&(zs=null),va=0,St=!1,25<=v)throw Error(I(301));if(v+=1,ji=Oi=null,i.updateQueue!=null){var M=i.updateQueue;M.lastEffect=null,M.events=null,M.stores=null,M.memoCache!=null&&(M.memoCache.index=0)}Ve.H=co,M=s(c,p)}while(St);return M}function wr(){var i=Ve.H,s=i.useState()[0];return s=typeof s.then=="function"?Is(s):s,i=i.useState()[0],(Oi!==null?Oi.memoizedState:null)!==i&&(ci.flags|=1024),s}function Ll(){var i=Yo!==0;return Yo=0,i}function no(i,s,c){s.updateQueue=i.updateQueue,s.flags&=-2053,i.lanes&=~c}function ao(i){if(Xo){for(i=i.memoizedState;i!==null;){var s=i.queue;s!==null&&(s.pending=null),i=i.next}Xo=!1}hs=0,ji=Oi=ci=null,St=!1,va=Yo=0,zs=null}function Tn(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ji===null?ci.memoizedState=ji=i:ji=ji.next=i,ji}function ir(){if(Oi===null){var i=ci.alternate;i=i!==null?i.memoizedState:null}else i=Oi.next;var s=ji===null?ci.memoizedState:ji.next;if(s!==null)ji=s,Oi=i;else{if(i===null)throw ci.alternate===null?Error(I(467)):Error(I(310));Oi=i,i={memoizedState:Oi.memoizedState,baseState:Oi.baseState,baseQueue:Oi.baseQueue,queue:Oi.queue,next:null},ji===null?ci.memoizedState=ji=i:ji=ji.next=i}return ji}function ks(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Is(i){var s=va;return va+=1,zs===null&&(zs=[]),i=Zo(zs,i,s),s=ci,(ji===null?s.memoizedState:ji.next)===null&&(s=s.alternate,Ve.H=s===null||s.memoizedState===null?wa:Mn),i}function Ko(i){if(i!==null&&typeof i=="object"){if(typeof i.then=="function")return Is(i);if(i.$$typeof===tt)return Xi(i)}throw Error(I(438,String(i)))}function Rs(i){var s=null,c=ci.updateQueue;if(c!==null&&(s=c.memoCache),s==null){var p=ci.alternate;p!==null&&(p=p.updateQueue,p!==null&&(p=p.memoCache,p!=null&&(s={data:p.data.map(function(v){return v.slice()}),index:0})))}if(s==null&&(s={data:[],index:0}),c===null&&(c=ks(),ci.updateQueue=c),c.memoCache=s,c=s.data[s.index],c===void 0)for(c=s.data[s.index]=Array(i),p=0;p<i;p++)c[p]=hi;return s.index++,c}function Va(i,s){return typeof s=="function"?s(i):s}function Bl(i){var s=ir();return Ol(s,Oi,i)}function Ol(i,s,c){var p=i.queue;if(p===null)throw Error(I(311));p.lastRenderedReducer=c;var v=i.baseQueue,M=p.pending;if(M!==null){if(v!==null){var N=v.next;v.next=M.next,M.next=N}s.baseQueue=v=M,p.pending=null}if(M=i.baseState,v===null)i.memoizedState=M;else{s=v.next;var K=N=null,fe=null,Be=s,Ke=!1;do{var it=Be.lane&-536870913;if(it!==Be.lane?(gi&it)===it:(hs&it)===it){var je=Be.revertLane;if(je===0)fe!==null&&(fe=fe.next={lane:0,revertLane:0,action:Be.action,hasEagerState:Be.hasEagerState,eagerState:Be.eagerState,next:null}),it===$r&&(Ke=!0);else if((hs&je)===je){Be=Be.next,je===$r&&(Ke=!0);continue}else it={lane:0,revertLane:Be.revertLane,action:Be.action,hasEagerState:Be.hasEagerState,eagerState:Be.eagerState,next:null},fe===null?(K=fe=it,N=M):fe=fe.next=it,ci.lanes|=je,mo|=je;it=Be.action,It&&c(M,it),M=Be.hasEagerState?Be.eagerState:c(M,it)}else je={lane:it,revertLane:Be.revertLane,action:Be.action,hasEagerState:Be.hasEagerState,eagerState:Be.eagerState,next:null},fe===null?(K=fe=je,N=M):fe=fe.next=je,ci.lanes|=it,mo|=it;Be=Be.next}while(Be!==null&&Be!==s);if(fe===null?N=M:fe.next=K,!Dn(M,i.memoizedState)&&(Xr=!0,Ke&&(c=wn,c!==null)))throw c;i.memoizedState=M,i.baseState=N,i.baseQueue=fe,p.lastRenderedState=M}return v===null&&(p.lanes=0),[i.memoizedState,p.dispatch]}function Pc(i){var s=ir(),c=s.queue;if(c===null)throw Error(I(311));c.lastRenderedReducer=i;var p=c.dispatch,v=c.pending,M=s.memoizedState;if(v!==null){c.pending=null;var N=v=v.next;do M=i(M,N.action),N=N.next;while(N!==v);Dn(M,s.memoizedState)||(Xr=!0),s.memoizedState=M,s.baseQueue===null&&(s.baseState=M),c.lastRenderedState=M}return[M,p]}function f(i,s,c){var p=ci,v=ir(),M=Ci;if(M){if(c===void 0)throw Error(I(407));c=c()}else c=s();var N=!Dn((Oi||v).memoizedState,c);N&&(v.memoizedState=c,Xr=!0),v=v.queue;var K=l.bind(null,p,v,i);if(Se(2048,8,K,[i]),v.getSnapshot!==s||N||ji!==null&&ji.memoizedState.tag&1){if(p.flags|=2048,oe(9,de(),a.bind(null,p,v,c,s),null),dr===null)throw Error(I(349));M||(hs&124)!==0||e(p,s,c)}return c}function e(i,s,c){i.flags|=16384,i={getSnapshot:s,value:c},s=ci.updateQueue,s===null?(s=ks(),ci.updateQueue=s,s.stores=[i]):(c=s.stores,c===null?s.stores=[i]:c.push(i))}function a(i,s,c,p){s.value=c,s.getSnapshot=p,d(s)&&m(i)}function l(i,s,c){return c(function(){d(s)&&m(i)})}function d(i){var s=i.getSnapshot;i=i.value;try{var c=s();return!Dn(i,c)}catch{return!0}}function m(i){var s=ia(i,2);s!==null&&Xa(s,i,2)}function y(i){var s=Tn();if(typeof i=="function"){var c=i;if(i=c(),It){In(!0);try{c()}finally{In(!1)}}}return s.memoizedState=s.baseState=i,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Va,lastRenderedState:i},s}function w(i,s,c,p){return i.baseState=c,Ol(i,Oi,typeof p=="function"?p:Va)}function S(i,s,c,p,v){if(Ls(i))throw Error(I(485));if(i=s.action,i!==null){var M={payload:v,action:i,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(N){M.listeners.push(N)}};Ve.T!==null?c(!0):M.isTransition=!1,p(M),c=s.pending,c===null?(M.next=s.pending=M,P(s,M)):(M.next=c.next,s.pending=c.next=M)}}function P(i,s){var c=s.action,p=s.payload,v=i.state;if(s.isTransition){var M=Ve.T,N={};Ve.T=N;try{var K=c(v,p),fe=Ve.S;fe!==null&&fe(N,K),k(i,s,K)}catch(Be){L(i,s,Be)}finally{Ve.T=M}}else try{M=c(v,p),k(i,s,M)}catch(Be){L(i,s,Be)}}function k(i,s,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(p){B(i,s,p)},function(p){return L(i,s,p)}):B(i,s,c)}function B(i,s,c){s.status="fulfilled",s.value=c,j(s),i.state=c,s=i.pending,s!==null&&(c=s.next,c===s?i.pending=null:(c=c.next,s.next=c,P(i,c)))}function L(i,s,c){var p=i.pending;if(i.pending=null,p!==null){p=p.next;do s.status="rejected",s.reason=c,j(s),s=s.next;while(s!==p)}i.action=null}function j(i){i=i.listeners;for(var s=0;s<i.length;s++)(0,i[s])()}function G(i,s){return s}function ee(i,s){if(Ci){var c=dr.formState;if(c!==null){e:{var p=ci;if(Ci){if(or){t:{for(var v=or,M=sa;v.nodeType!==8;){if(!M){v=null;break t}if(v=Fs(v.nextSibling),v===null){v=null;break t}}M=v.data,v=M==="F!"||M==="F"?v:null}if(v){or=Fs(v.nextSibling),p=v.data==="F!";break e}}Vo(p)}p=!1}p&&(s=c[0])}}return c=Tn(),c.memoizedState=c.baseState=s,p={pending:null,lanes:0,dispatch:null,lastRenderedReducer:G,lastRenderedState:s},c.queue=p,c=Ds.bind(null,ci,p),p.dispatch=c,p=y(!1),M=so.bind(null,ci,!1,p.queue),p=Tn(),v={state:s,dispatch:null,action:i,pending:null},p.queue=v,c=S.bind(null,ci,v,M,c),v.dispatch=c,p.memoizedState=i,[s,c,!1]}function J(i){var s=ir();return te(s,Oi,i)}function te(i,s,c){if(s=Ol(i,s,G)[0],i=Bl(Va)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var p=Is(s)}catch(N){throw N===As?yt:N}else p=s;s=ir();var v=s.queue,M=v.dispatch;return c!==s.memoizedState&&(ci.flags|=2048,oe(9,de(),ae.bind(null,v,c),null)),[p,M,i]}function ae(i,s){i.action=s}function ue(i){var s=ir(),c=Oi;if(c!==null)return te(s,c,i);ir(),s=s.memoizedState,c=ir();var p=c.queue.dispatch;return c.memoizedState=i,[s,p,!1]}function oe(i,s,c,p){return i={tag:i,create:c,deps:p,inst:s,next:null},s=ci.updateQueue,s===null&&(s=ks(),ci.updateQueue=s),c=s.lastEffect,c===null?s.lastEffect=i.next=i:(p=c.next,c.next=i,i.next=p,s.lastEffect=i),i}function de(){return{destroy:void 0,resource:void 0}}function ge(){return ir().memoizedState}function le(i,s,c,p){var v=Tn();p=p===void 0?null:p,ci.flags|=i,v.memoizedState=oe(1|s,de(),c,p)}function Se(i,s,c,p){var v=ir();p=p===void 0?null:p;var M=v.memoizedState.inst;Oi!==null&&p!==null&&Xn(p,Oi.memoizedState.deps)?v.memoizedState=oe(s,M,c,p):(ci.flags|=i,v.memoizedState=oe(1|s,M,c,p))}function Oe(i,s){le(8390656,8,i,s)}function ze(i,s){Se(2048,8,i,s)}function ke(i,s){return Se(4,2,i,s)}function Le(i,s){return Se(4,4,i,s)}function ot(i,s){if(typeof s=="function"){i=i();var c=s(i);return function(){typeof c=="function"?c():s(null)}}if(s!=null)return i=i(),s.current=i,function(){s.current=null}}function ct(i,s,c){c=c!=null?c.concat([i]):null,Se(4,4,ot.bind(null,s,i),c)}function We(){}function Et(i,s){var c=ir();s=s===void 0?null:s;var p=c.memoizedState;return s!==null&&Xn(s,p[1])?p[0]:(c.memoizedState=[i,s],i)}function ii(i,s){var c=ir();s=s===void 0?null:s;var p=c.memoizedState;if(s!==null&&Xn(s,p[1]))return p[0];if(p=i(),It){In(!0);try{i()}finally{In(!1)}}return c.memoizedState=[p,s],p}function vi(i,s,c){return c===void 0||(hs&1073741824)!==0?i.memoizedState=s:(i.memoizedState=c,i=gp(),ci.lanes|=i,mo|=i,c)}function Ii(i,s,c,p){return Dn(c,s)?c:Sn.current!==null?(i=vi(i,c,p),Dn(i,s)||(Xr=!0),i):(hs&42)===0?(Xr=!0,i.memoizedState=c):(i=gp(),ci.lanes|=i,mo|=i,s)}function Pi(i,s,c,p,v){var M=ht.p;ht.p=M!==0&&8>M?M:8;var N=Ve.T,K={};Ve.T=K,so(i,!1,s,c);try{var fe=v(),Be=Ve.S;if(Be!==null&&Be(K,fe),fe!==null&&typeof fe=="object"&&typeof fe.then=="function"){var Ke=Pl(fe,p);ba(i,s,Ke,Ea(i))}else ba(i,s,p,Ea(i))}catch(it){ba(i,s,{then:function(){},status:"rejected",reason:it},Ea())}finally{ht.p=M,Ve.T=N}}function cr(){}function rr(i,s,c,p){if(i.tag!==5)throw Error(I(476));var v=Wt(i).queue;Pi(i,v,s,nt,c===null?cr:function(){return Ri(i),c(p)})}function Wt(i){var s=i.memoizedState;if(s!==null)return s;s={memoizedState:nt,baseState:nt,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Va,lastRenderedState:nt},next:null};var c={};return s.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Va,lastRenderedState:c},next:null},i.memoizedState=s,i=i.alternate,i!==null&&(i.memoizedState=s),s}function Ri(i){var s=Wt(i).next.queue;ba(i,s,{},Ea())}function Sr(){return Xi(be)}function Ur(){return ir().memoizedState}function Hr(){return ir().memoizedState}function jn(i){for(var s=i.return;s!==null;){switch(s.tag){case 24:case 3:var c=Ea();i=ro(c);var p=Ps(s,i,c);p!==null&&(Xa(p,s,c),qo(p,s,c)),s={cache:io()},i.payload=s;return}s=s.return}}function Ga(i,s,c){var p=Ea();c={lane:p,revertLane:0,action:c,hasEagerState:!1,eagerState:null,next:null},Ls(i)?oo(s,c):(c=Ks(i,s,c,p),c!==null&&(Xa(c,i,p),lo(c,s,p)))}function Ds(i,s,c){var p=Ea();ba(i,s,c,p)}function ba(i,s,c,p){var v={lane:p,revertLane:0,action:c,hasEagerState:!1,eagerState:null,next:null};if(Ls(i))oo(s,v);else{var M=i.alternate;if(i.lanes===0&&(M===null||M.lanes===0)&&(M=s.lastRenderedReducer,M!==null))try{var N=s.lastRenderedState,K=M(N,c);if(v.hasEagerState=!0,v.eagerState=K,Dn(K,N))return _c(i,s,v,0),dr===null&&Uo(),!1}catch{}finally{}if(c=Ks(i,s,v,p),c!==null)return Xa(c,i,p),lo(c,s,p),!0}return!1}function so(i,s,c,p){if(p={lane:2,revertLane:Ih(),action:p,hasEagerState:!1,eagerState:null,next:null},Ls(i)){if(s)throw Error(I(479))}else s=Ks(i,c,p,2),s!==null&&Xa(s,i,2)}function Ls(i){var s=i.alternate;return i===ci||s!==null&&s===ci}function oo(i,s){St=Xo=!0;var c=i.pending;c===null?s.next=s:(s.next=c.next,c.next=s),i.pending=s}function lo(i,s,c){if((c&4194048)!==0){var p=s.lanes;p&=i.pendingLanes,c|=p,s.lanes=c,kt(i,c)}}var ln={readContext:Xi,use:Ko,useCallback:br,useContext:br,useEffect:br,useImperativeHandle:br,useLayoutEffect:br,useInsertionEffect:br,useMemo:br,useReducer:br,useRef:br,useState:br,useDebugValue:br,useDeferredValue:br,useTransition:br,useSyncExternalStore:br,useId:br,useHostTransitionStatus:br,useFormState:br,useActionState:br,useOptimistic:br,useMemoCache:br,useCacheRefresh:br},wa={readContext:Xi,use:Ko,useCallback:function(i,s){return Tn().memoizedState=[i,s===void 0?null:s],i},useContext:Xi,useEffect:Oe,useImperativeHandle:function(i,s,c){c=c!=null?c.concat([i]):null,le(4194308,4,ot.bind(null,s,i),c)},useLayoutEffect:function(i,s){return le(4194308,4,i,s)},useInsertionEffect:function(i,s){le(4,2,i,s)},useMemo:function(i,s){var c=Tn();s=s===void 0?null:s;var p=i();if(It){In(!0);try{i()}finally{In(!1)}}return c.memoizedState=[p,s],p},useReducer:function(i,s,c){var p=Tn();if(c!==void 0){var v=c(s);if(It){In(!0);try{c(s)}finally{In(!1)}}}else v=s;return p.memoizedState=p.baseState=v,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:v},p.queue=i,i=i.dispatch=Ga.bind(null,ci,i),[p.memoizedState,i]},useRef:function(i){var s=Tn();return i={current:i},s.memoizedState=i},useState:function(i){i=y(i);var s=i.queue,c=Ds.bind(null,ci,s);return s.dispatch=c,[i.memoizedState,c]},useDebugValue:We,useDeferredValue:function(i,s){var c=Tn();return vi(c,i,s)},useTransition:function(){var i=y(!1);return i=Pi.bind(null,ci,i.queue,!0,!1),Tn().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,s,c){var p=ci,v=Tn();if(Ci){if(c===void 0)throw Error(I(407));c=c()}else{if(c=s(),dr===null)throw Error(I(349));(gi&124)!==0||e(p,s,c)}v.memoizedState=c;var M={value:c,getSnapshot:s};return v.queue=M,Oe(l.bind(null,p,M,i),[i]),p.flags|=2048,oe(9,de(),a.bind(null,p,M,c,s),null),c},useId:function(){var i=Tn(),s=dr.identifierPrefix;if(Ci){var c=ga,p=aa;c=(p&~(1<<32-ye(p)-1)).toString(32)+c,s="«"+s+"R"+c,c=Yo++,0<c&&(s+="H"+c.toString(32)),s+="»"}else c=On++,s="«"+s+"r"+c.toString(32)+"»";return i.memoizedState=s},useHostTransitionStatus:Sr,useFormState:ee,useActionState:ee,useOptimistic:function(i){var s=Tn();s.memoizedState=s.baseState=i;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return s.queue=c,s=so.bind(null,ci,!0,c),c.dispatch=s,[i,s]},useMemoCache:Rs,useCacheRefresh:function(){return Tn().memoizedState=jn.bind(null,ci)}},Mn={readContext:Xi,use:Ko,useCallback:Et,useContext:Xi,useEffect:ze,useImperativeHandle:ct,useInsertionEffect:ke,useLayoutEffect:Le,useMemo:ii,useReducer:Bl,useRef:ge,useState:function(){return Bl(Va)},useDebugValue:We,useDeferredValue:function(i,s){var c=ir();return Ii(c,Oi.memoizedState,i,s)},useTransition:function(){var i=Bl(Va)[0],s=ir().memoizedState;return[typeof i=="boolean"?i:Is(i),s]},useSyncExternalStore:f,useId:Ur,useHostTransitionStatus:Sr,useFormState:J,useActionState:J,useOptimistic:function(i,s){var c=ir();return w(c,Oi,i,s)},useMemoCache:Rs,useCacheRefresh:Hr},co={readContext:Xi,use:Ko,useCallback:Et,useContext:Xi,useEffect:ze,useImperativeHandle:ct,useInsertionEffect:ke,useLayoutEffect:Le,useMemo:ii,useReducer:Pc,useRef:ge,useState:function(){return Pc(Va)},useDebugValue:We,useDeferredValue:function(i,s){var c=ir();return Oi===null?vi(c,i,s):Ii(c,Oi.memoizedState,i,s)},useTransition:function(){var i=Pc(Va)[0],s=ir().memoizedState;return[typeof i=="boolean"?i:Is(i),s]},useSyncExternalStore:f,useId:Ur,useHostTransitionStatus:Sr,useFormState:ue,useActionState:ue,useOptimistic:function(i,s){var c=ir();return Oi!==null?w(c,Oi,i,s):(c.baseState=i,[i,c.queue.dispatch])},useMemoCache:Rs,useCacheRefresh:Hr},nr=null,_r=0;function Nn(i){var s=_r;return _r+=1,nr===null&&(nr=[]),Zo(nr,i,s)}function ur(i,s){s=s.props.ref,i.ref=s!==void 0?s:null}function uo(i,s){throw s.$$typeof===we?Error(I(525)):(i=Object.prototype.toString.call(s),Error(I(31,i==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":i)))}function Wo(i){var s=i._init;return s(i._payload)}function ds(i){function s(Pe,Ee){if(i){var De=Pe.deletions;De===null?(Pe.deletions=[Ee],Pe.flags|=16):De.push(Ee)}}function c(Pe,Ee){if(!i)return null;for(;Ee!==null;)s(Pe,Ee),Ee=Ee.sibling;return null}function p(Pe){for(var Ee=new Map;Pe!==null;)Pe.key!==null?Ee.set(Pe.key,Pe):Ee.set(Pe.index,Pe),Pe=Pe.sibling;return Ee}function v(Pe,Ee){return Pe=yn(Pe,Ee),Pe.index=0,Pe.sibling=null,Pe}function M(Pe,Ee,De){return Pe.index=De,i?(De=Pe.alternate,De!==null?(De=De.index,De<Ee?(Pe.flags|=67108866,Ee):De):(Pe.flags|=67108866,Ee)):(Pe.flags|=1048576,Ee)}function N(Pe){return i&&Pe.alternate===null&&(Pe.flags|=67108866),Pe}function K(Pe,Ee,De,Je){return Ee===null||Ee.tag!==6?(Ee=ch(De,Pe.mode,Je),Ee.return=Pe,Ee):(Ee=v(Ee,De),Ee.return=Pe,Ee)}function fe(Pe,Ee,De,Je){var Dt=De.type;return Dt===Fe?Ke(Pe,Ee,De.props.children,Je,De.key):Ee!==null&&(Ee.elementType===Dt||typeof Dt=="object"&&Dt!==null&&Dt.$$typeof===xt&&Wo(Dt)===Ee.type)?(Ee=v(Ee,De.props),ur(Ee,De),Ee.return=Pe,Ee):(Ee=lu(De.type,De.key,De.props,null,Pe.mode,Je),ur(Ee,De),Ee.return=Pe,Ee)}function Be(Pe,Ee,De,Je){return Ee===null||Ee.tag!==4||Ee.stateNode.containerInfo!==De.containerInfo||Ee.stateNode.implementation!==De.implementation?(Ee=xc(De,Pe.mode,Je),Ee.return=Pe,Ee):(Ee=v(Ee,De.children||[]),Ee.return=Pe,Ee)}function Ke(Pe,Ee,De,Je,Dt){return Ee===null||Ee.tag!==7?(Ee=Ws(De,Pe.mode,Je,Dt),Ee.return=Pe,Ee):(Ee=v(Ee,De),Ee.return=Pe,Ee)}function it(Pe,Ee,De){if(typeof Ee=="string"&&Ee!==""||typeof Ee=="number"||typeof Ee=="bigint")return Ee=ch(""+Ee,Pe.mode,De),Ee.return=Pe,Ee;if(typeof Ee=="object"&&Ee!==null){switch(Ee.$$typeof){case Ce:return De=lu(Ee.type,Ee.key,Ee.props,null,Pe.mode,De),ur(De,Ee),De.return=Pe,De;case ie:return Ee=xc(Ee,Pe.mode,De),Ee.return=Pe,Ee;case xt:var Je=Ee._init;return Ee=Je(Ee._payload),it(Pe,Ee,De)}if(yi(Ee)||Jt(Ee))return Ee=Ws(Ee,Pe.mode,De,null),Ee.return=Pe,Ee;if(typeof Ee.then=="function")return it(Pe,Nn(Ee),De);if(Ee.$$typeof===tt)return it(Pe,Es(Pe,Ee),De);uo(Pe,Ee)}return null}function je(Pe,Ee,De,Je){var Dt=Ee!==null?Ee.key:null;if(typeof De=="string"&&De!==""||typeof De=="number"||typeof De=="bigint")return Dt!==null?null:K(Pe,Ee,""+De,Je);if(typeof De=="object"&&De!==null){switch(De.$$typeof){case Ce:return De.key===Dt?fe(Pe,Ee,De,Je):null;case ie:return De.key===Dt?Be(Pe,Ee,De,Je):null;case xt:return Dt=De._init,De=Dt(De._payload),je(Pe,Ee,De,Je)}if(yi(De)||Jt(De))return Dt!==null?null:Ke(Pe,Ee,De,Je,null);if(typeof De.then=="function")return je(Pe,Ee,Nn(De),Je);if(De.$$typeof===tt)return je(Pe,Ee,Es(Pe,De),Je);uo(Pe,De)}return null}function Ue(Pe,Ee,De,Je,Dt){if(typeof Je=="string"&&Je!==""||typeof Je=="number"||typeof Je=="bigint")return Pe=Pe.get(De)||null,K(Ee,Pe,""+Je,Dt);if(typeof Je=="object"&&Je!==null){switch(Je.$$typeof){case Ce:return Pe=Pe.get(Je.key===null?De:Je.key)||null,fe(Ee,Pe,Je,Dt);case ie:return Pe=Pe.get(Je.key===null?De:Je.key)||null,Be(Ee,Pe,Je,Dt);case xt:var _i=Je._init;return Je=_i(Je._payload),Ue(Pe,Ee,De,Je,Dt)}if(yi(Je)||Jt(Je))return Pe=Pe.get(De)||null,Ke(Ee,Pe,Je,Dt,null);if(typeof Je.then=="function")return Ue(Pe,Ee,De,Nn(Je),Dt);if(Je.$$typeof===tt)return Ue(Pe,Ee,De,Es(Ee,Je),Dt);uo(Ee,Je)}return null}function Qt(Pe,Ee,De,Je){for(var Dt=null,_i=null,Pt=Ee,Vt=Ee=0,pn=null;Pt!==null&&Vt<De.length;Vt++){Pt.index>Vt?(pn=Pt,Pt=null):pn=Pt.sibling;var Li=je(Pe,Pt,De[Vt],Je);if(Li===null){Pt===null&&(Pt=pn);break}i&&Pt&&Li.alternate===null&&s(Pe,Pt),Ee=M(Li,Ee,Vt),_i===null?Dt=Li:_i.sibling=Li,_i=Li,Pt=pn}if(Vt===De.length)return c(Pe,Pt),Ci&&Ms(Pe,Vt),Dt;if(Pt===null){for(;Vt<De.length;Vt++)Pt=it(Pe,De[Vt],Je),Pt!==null&&(Ee=M(Pt,Ee,Vt),_i===null?Dt=Pt:_i.sibling=Pt,_i=Pt);return Ci&&Ms(Pe,Vt),Dt}for(Pt=p(Pt);Vt<De.length;Vt++)pn=Ue(Pt,Pe,Vt,De[Vt],Je),pn!==null&&(i&&pn.alternate!==null&&Pt.delete(pn.key===null?Vt:pn.key),Ee=M(pn,Ee,Vt),_i===null?Dt=pn:_i.sibling=pn,_i=pn);return i&&Pt.forEach(function(Xl){return s(Pe,Xl)}),Ci&&Ms(Pe,Vt),Dt}function Xt(Pe,Ee,De,Je){if(De==null)throw Error(I(151));for(var Dt=null,_i=null,Pt=Ee,Vt=Ee=0,pn=null,Li=De.next();Pt!==null&&!Li.done;Vt++,Li=De.next()){Pt.index>Vt?(pn=Pt,Pt=null):pn=Pt.sibling;var Xl=je(Pe,Pt,Li.value,Je);if(Xl===null){Pt===null&&(Pt=pn);break}i&&Pt&&Xl.alternate===null&&s(Pe,Pt),Ee=M(Xl,Ee,Vt),_i===null?Dt=Xl:_i.sibling=Xl,_i=Xl,Pt=pn}if(Li.done)return c(Pe,Pt),Ci&&Ms(Pe,Vt),Dt;if(Pt===null){for(;!Li.done;Vt++,Li=De.next())Li=it(Pe,Li.value,Je),Li!==null&&(Ee=M(Li,Ee,Vt),_i===null?Dt=Li:_i.sibling=Li,_i=Li);return Ci&&Ms(Pe,Vt),Dt}for(Pt=p(Pt);!Li.done;Vt++,Li=De.next())Li=Ue(Pt,Pe,Vt,Li.value,Je),Li!==null&&(i&&Li.alternate!==null&&Pt.delete(Li.key===null?Vt:Li.key),Ee=M(Li,Ee,Vt),_i===null?Dt=Li:_i.sibling=Li,_i=Li);return i&&Pt.forEach(function(hm){return s(Pe,hm)}),Ci&&Ms(Pe,Vt),Dt}function Qi(Pe,Ee,De,Je){if(typeof De=="object"&&De!==null&&De.type===Fe&&De.key===null&&(De=De.props.children),typeof De=="object"&&De!==null){switch(De.$$typeof){case Ce:e:{for(var Dt=De.key;Ee!==null;){if(Ee.key===Dt){if(Dt=De.type,Dt===Fe){if(Ee.tag===7){c(Pe,Ee.sibling),Je=v(Ee,De.props.children),Je.return=Pe,Pe=Je;break e}}else if(Ee.elementType===Dt||typeof Dt=="object"&&Dt!==null&&Dt.$$typeof===xt&&Wo(Dt)===Ee.type){c(Pe,Ee.sibling),Je=v(Ee,De.props),ur(Je,De),Je.return=Pe,Pe=Je;break e}c(Pe,Ee);break}else s(Pe,Ee);Ee=Ee.sibling}De.type===Fe?(Je=Ws(De.props.children,Pe.mode,Je,De.key),Je.return=Pe,Pe=Je):(Je=lu(De.type,De.key,De.props,null,Pe.mode,Je),ur(Je,De),Je.return=Pe,Pe=Je)}return N(Pe);case ie:e:{for(Dt=De.key;Ee!==null;){if(Ee.key===Dt)if(Ee.tag===4&&Ee.stateNode.containerInfo===De.containerInfo&&Ee.stateNode.implementation===De.implementation){c(Pe,Ee.sibling),Je=v(Ee,De.children||[]),Je.return=Pe,Pe=Je;break e}else{c(Pe,Ee);break}else s(Pe,Ee);Ee=Ee.sibling}Je=xc(De,Pe.mode,Je),Je.return=Pe,Pe=Je}return N(Pe);case xt:return Dt=De._init,De=Dt(De._payload),Qi(Pe,Ee,De,Je)}if(yi(De))return Qt(Pe,Ee,De,Je);if(Jt(De)){if(Dt=Jt(De),typeof Dt!="function")throw Error(I(150));return De=Dt.call(De),Xt(Pe,Ee,De,Je)}if(typeof De.then=="function")return Qi(Pe,Ee,Nn(De),Je);if(De.$$typeof===tt)return Qi(Pe,Ee,Es(Pe,De),Je);uo(Pe,De)}return typeof De=="string"&&De!==""||typeof De=="number"||typeof De=="bigint"?(De=""+De,Ee!==null&&Ee.tag===6?(c(Pe,Ee.sibling),Je=v(Ee,De),Je.return=Pe,Pe=Je):(c(Pe,Ee),Je=ch(De,Pe.mode,Je),Je.return=Pe,Pe=Je),N(Pe)):c(Pe,Ee)}return function(Pe,Ee,De,Je){try{_r=0;var Dt=Qi(Pe,Ee,De,Je);return nr=null,Dt}catch(Pt){if(Pt===As||Pt===yt)throw Pt;var _i=ra(29,Pt,null,Pe.mode);return _i.lanes=Je,_i.return=Pe,_i}finally{}}}var Cn=ds(!0),Bs=ds(!1),la=Xe(null),Tr=null;function Os(i){var s=i.alternate;at(Yi,Yi.current&1),at(la,i),Tr===null&&(s===null||Sn.current!==null||s.memoizedState!==null)&&(Tr=i)}function _u(i){if(i.tag===22){if(at(Yi,Yi.current),at(la,i),Tr===null){var s=i.alternate;s!==null&&s.memoizedState!==null&&(Tr=i)}}else Za()}function Za(){at(Yi,Yi.current),at(la,la.current)}function Sa(i){vt(la),Tr===i&&(Tr=null),vt(Yi)}var Yi=Xe(0);function Ta(i){for(var s=i;s!==null;){if(s.tag===13){var c=s.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||c.data==="$?"||Lu(c)))return s}else if(s.tag===19&&s.memoizedProps.revealOrder!==void 0){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===i)break;for(;s.sibling===null;){if(s.return===null||s.return===i)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}function ud(i,s,c,p){s=i.memoizedState,c=c(p,s),c=c==null?s:se({},s,c),i.memoizedState=c,i.lanes===0&&(i.updateQueue.baseState=c)}var ef={enqueueSetState:function(i,s,c){i=i._reactInternals;var p=Ea(),v=ro(p);v.payload=s,c!=null&&(v.callback=c),s=Ps(i,v,p),s!==null&&(Xa(s,i,p),qo(s,i,p))},enqueueReplaceState:function(i,s,c){i=i._reactInternals;var p=Ea(),v=ro(p);v.tag=1,v.payload=s,c!=null&&(v.callback=c),s=Ps(i,v,p),s!==null&&(Xa(s,i,p),qo(s,i,p))},enqueueForceUpdate:function(i,s){i=i._reactInternals;var c=Ea(),p=ro(c);p.tag=2,s!=null&&(p.callback=s),s=Ps(i,p,c),s!==null&&(Xa(s,i,c),qo(s,i,c))}};function hd(i,s,c,p,v,M,N){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(p,M,N):s.prototype&&s.prototype.isPureReactComponent?!bl(c,p)||!bl(v,M):!0}function tf(i,s,c,p){i=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(c,p),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(c,p),s.state!==i&&ef.enqueueReplaceState(s,s.state,null)}function zc(i,s){var c=s;if("ref"in s){c={};for(var p in s)p!=="ref"&&(c[p]=s[p])}if(i=i.defaultProps){c===s&&(c=se({},c));for(var v in i)c[v]===void 0&&(c[v]=i[v])}return c}var gh=typeof reportError=="function"?reportError:function(i){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var s=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof i=="object"&&i!==null&&typeof i.message=="string"?String(i.message):String(i),error:i});if(!window.dispatchEvent(s))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",i);return}console.error(i)};function Wf(i){gh(i)}function dd(i){console.error(i)}function Qf(i){gh(i)}function yu(i,s){try{var c=i.onUncaughtError;c(s.value,{componentStack:s.stack})}catch(p){setTimeout(function(){throw p})}}function rf(i,s,c){try{var p=i.onCaughtError;p(c.value,{componentStack:c.stack,errorBoundary:s.tag===1?s.stateNode:null})}catch(v){setTimeout(function(){throw v})}}function fd(i,s,c){return c=ro(c),c.tag=3,c.payload={element:null},c.callback=function(){yu(i,s)},c}function kc(i){return i=ro(i),i.tag=3,i}function Jf(i,s,c,p){var v=c.type.getDerivedStateFromError;if(typeof v=="function"){var M=p.value;i.payload=function(){return v(M)},i.callback=function(){rf(s,c,p)}}var N=c.stateNode;N!==null&&typeof N.componentDidCatch=="function"&&(i.callback=function(){rf(s,c,p),typeof v!="function"&&(il===null?il=new Set([this]):il.add(this));var K=p.stack;this.componentDidCatch(p.value,{componentStack:K!==null?K:""})})}function _h(i,s,c,p,v){if(c.flags|=32768,p!==null&&typeof p=="object"&&typeof p.then=="function"){if(s=c.alternate,s!==null&&Cl(s,c,v,!0),c=la.current,c!==null){switch(c.tag){case 13:return Tr===null?Ad():c.alternate===null&&Br===0&&(Br=3),c.flags&=-257,c.flags|=65536,c.lanes=v,p===Tc?c.flags|=16384:(s=c.updateQueue,s===null?c.updateQueue=new Set([p]):s.add(p),Cf(i,p,v)),!1;case 22:return c.flags|=65536,p===Tc?c.flags|=16384:(s=c.updateQueue,s===null?(s={transitions:null,markerInstances:null,retryQueue:new Set([p])},c.updateQueue=s):(c=s.retryQueue,c===null?s.retryQueue=new Set([p]):c.add(p)),Cf(i,p,v)),!1}throw Error(I(435,c.tag))}return Cf(i,p,v),Ad(),!1}if(Ci)return s=la.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=v,p!==bc&&(i=Error(I(422),{cause:p}),Cs(Qr(i,c)))):(p!==bc&&(s=Error(I(423),{cause:p}),Cs(Qr(s,c))),i=i.current.alternate,i.flags|=65536,v&=-v,i.lanes|=v,p=Qr(p,c),v=fd(i.stateNode,p,v),Ec(i,v),Br!==4&&(Br=2)),!1;var M=Error(I(520),{cause:p});if(M=Qr(M,c),Vl===null?Vl=[M]:Vl.push(M),Br!==4&&(Br=2),s===null)return!0;p=Qr(p,c),c=s;do{switch(c.tag){case 3:return c.flags|=65536,i=v&-v,c.lanes|=i,i=fd(c.stateNode,p,i),Ec(c,i),!1;case 1:if(s=c.type,M=c.stateNode,(c.flags&128)===0&&(typeof s.getDerivedStateFromError=="function"||M!==null&&typeof M.componentDidCatch=="function"&&(il===null||!il.has(M))))return c.flags|=65536,v&=-v,c.lanes|=v,v=kc(v),Jf(v,i,c,p),Ec(c,v),!1}c=c.return}while(c!==null);return!1}var yh=Error(I(461)),Xr=!1;function En(i,s,c,p){s.child=i===null?Bs(s,null,c,p):Cn(s,i.child,c,p)}function nf(i,s,c,p,v){c=c.render;var M=s.ref;if("ref"in p){var N={};for(var K in p)K!=="ref"&&(N[K]=p[K])}else N=p;return to(s),p=mh(i,s,c,N,M,v),K=Ll(),i!==null&&!Xr?(no(i,s,v),js(i,s,v)):(Ci&&K&&vc(s),s.flags|=1,En(i,s,p,v),s.child)}function ep(i,s,c,p,v){if(i===null){var M=c.type;return typeof M=="function"&&!ou(M)&&M.defaultProps===void 0&&c.compare===null?(s.tag=15,s.type=M,tp(i,s,M,p,v)):(i=lu(c.type,null,p,s,s.mode,v),i.ref=s.ref,i.return=s,s.child=i)}if(M=i.child,!xd(i,v)){var N=M.memoizedProps;if(c=c.compare,c=c!==null?c:bl,c(N,p)&&i.ref===s.ref)return js(i,s,v)}return s.flags|=1,i=yn(M,p),i.ref=s.ref,i.return=s,s.child=i}function tp(i,s,c,p,v){if(i!==null){var M=i.memoizedProps;if(bl(M,p)&&i.ref===s.ref)if(Xr=!1,s.pendingProps=p=M,xd(i,v))(i.flags&131072)!==0&&(Xr=!0);else return s.lanes=i.lanes,js(i,s,v)}return of(i,s,c,p,v)}function af(i,s,c){var p=s.pendingProps,v=p.children,M=i!==null?i.memoizedState:null;if(p.mode==="hidden"){if((s.flags&128)!==0){if(p=M!==null?M.baseLanes|c:c,i!==null){for(v=s.child=i.child,M=0;v!==null;)M=M|v.lanes|v.childLanes,v=v.sibling;s.childLanes=M&~p}else s.childLanes=0,s.child=null;return sf(i,s,p,c)}if((c&536870912)!==0)s.memoizedState={baseLanes:0,cachePool:null},i!==null&&pu(s,M!==null?M.cachePool:null),M!==null?Ho(s,M):Ac(),_u(s);else return s.lanes=s.childLanes=536870912,sf(i,s,M!==null?M.baseLanes|c:c,c)}else M!==null?(pu(s,M.cachePool),Ho(s,M),Za(),s.memoizedState=null):(i!==null&&pu(s,null),Ac(),Za());return En(i,s,v,c),s.child}function sf(i,s,c,p){var v=hh();return v=v===null?null:{parent:Fr._currentValue,pool:v},s.memoizedState={baseLanes:c,cachePool:v},i!==null&&pu(s,null),Ac(),_u(s),i!==null&&Cl(i,s,p,!0),null}function xh(i,s){var c=s.ref;if(c===null)i!==null&&i.ref!==null&&(s.flags|=4194816);else{if(typeof c!="function"&&typeof c!="object")throw Error(I(284));(i===null||i.ref!==c)&&(s.flags|=4194816)}}function of(i,s,c,p,v){return to(s),c=mh(i,s,c,p,void 0,v),p=Ll(),i!==null&&!Xr?(no(i,s,v),js(i,s,v)):(Ci&&p&&vc(s),s.flags|=1,En(i,s,c,v),s.child)}function pd(i,s,c,p,v,M){return to(s),s.updateQueue=null,c=ki(s,p,c,v),Dl(i),p=Ll(),i!==null&&!Xr?(no(i,s,M),js(i,s,M)):(Ci&&p&&vc(s),s.flags|=1,En(i,s,c,M),s.child)}function lf(i,s,c,p,v){if(to(s),s.stateNode===null){var M=ni,N=c.contextType;typeof N=="object"&&N!==null&&(M=Xi(N)),M=new c(p,M),s.memoizedState=M.state!==null&&M.state!==void 0?M.state:null,M.updater=ef,s.stateNode=M,M._reactInternals=s,M=s.stateNode,M.props=p,M.state=s.memoizedState,M.refs={},dh(s),N=c.contextType,M.context=typeof N=="object"&&N!==null?Xi(N):ni,M.state=s.memoizedState,N=c.getDerivedStateFromProps,typeof N=="function"&&(ud(s,c,N,p),M.state=s.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof M.getSnapshotBeforeUpdate=="function"||typeof M.UNSAFE_componentWillMount!="function"&&typeof M.componentWillMount!="function"||(N=M.state,typeof M.componentWillMount=="function"&&M.componentWillMount(),typeof M.UNSAFE_componentWillMount=="function"&&M.UNSAFE_componentWillMount(),N!==M.state&&ef.enqueueReplaceState(M,M.state,null),$o(s,p,M,v),Rl(),M.state=s.memoizedState),typeof M.componentDidMount=="function"&&(s.flags|=4194308),p=!0}else if(i===null){M=s.stateNode;var K=s.memoizedProps,fe=zc(c,K);M.props=fe;var Be=M.context,Ke=c.contextType;N=ni,typeof Ke=="object"&&Ke!==null&&(N=Xi(Ke));var it=c.getDerivedStateFromProps;Ke=typeof it=="function"||typeof M.getSnapshotBeforeUpdate=="function",K=s.pendingProps!==K,Ke||typeof M.UNSAFE_componentWillReceiveProps!="function"&&typeof M.componentWillReceiveProps!="function"||(K||Be!==N)&&tf(s,M,p,N),Ua=!1;var je=s.memoizedState;M.state=je,$o(s,p,M,v),Rl(),Be=s.memoizedState,K||je!==Be||Ua?(typeof it=="function"&&(ud(s,c,it,p),Be=s.memoizedState),(fe=Ua||hd(s,c,fe,p,je,Be,N))?(Ke||typeof M.UNSAFE_componentWillMount!="function"&&typeof M.componentWillMount!="function"||(typeof M.componentWillMount=="function"&&M.componentWillMount(),typeof M.UNSAFE_componentWillMount=="function"&&M.UNSAFE_componentWillMount()),typeof M.componentDidMount=="function"&&(s.flags|=4194308)):(typeof M.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=p,s.memoizedState=Be),M.props=p,M.state=Be,M.context=N,p=fe):(typeof M.componentDidMount=="function"&&(s.flags|=4194308),p=!1)}else{M=s.stateNode,Il(i,s),N=s.memoizedProps,Ke=zc(c,N),M.props=Ke,it=s.pendingProps,je=M.context,Be=c.contextType,fe=ni,typeof Be=="object"&&Be!==null&&(fe=Xi(Be)),K=c.getDerivedStateFromProps,(Be=typeof K=="function"||typeof M.getSnapshotBeforeUpdate=="function")||typeof M.UNSAFE_componentWillReceiveProps!="function"&&typeof M.componentWillReceiveProps!="function"||(N!==it||je!==fe)&&tf(s,M,p,fe),Ua=!1,je=s.memoizedState,M.state=je,$o(s,p,M,v),Rl();var Ue=s.memoizedState;N!==it||je!==Ue||Ua||i!==null&&i.dependencies!==null&&Sc(i.dependencies)?(typeof K=="function"&&(ud(s,c,K,p),Ue=s.memoizedState),(Ke=Ua||hd(s,c,Ke,p,je,Ue,fe)||i!==null&&i.dependencies!==null&&Sc(i.dependencies))?(Be||typeof M.UNSAFE_componentWillUpdate!="function"&&typeof M.componentWillUpdate!="function"||(typeof M.componentWillUpdate=="function"&&M.componentWillUpdate(p,Ue,fe),typeof M.UNSAFE_componentWillUpdate=="function"&&M.UNSAFE_componentWillUpdate(p,Ue,fe)),typeof M.componentDidUpdate=="function"&&(s.flags|=4),typeof M.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof M.componentDidUpdate!="function"||N===i.memoizedProps&&je===i.memoizedState||(s.flags|=4),typeof M.getSnapshotBeforeUpdate!="function"||N===i.memoizedProps&&je===i.memoizedState||(s.flags|=1024),s.memoizedProps=p,s.memoizedState=Ue),M.props=p,M.state=Ue,M.context=fe,p=Ke):(typeof M.componentDidUpdate!="function"||N===i.memoizedProps&&je===i.memoizedState||(s.flags|=4),typeof M.getSnapshotBeforeUpdate!="function"||N===i.memoizedProps&&je===i.memoizedState||(s.flags|=1024),p=!1)}return M=p,xh(i,s),p=(s.flags&128)!==0,M||p?(M=s.stateNode,c=p&&typeof c.getDerivedStateFromError!="function"?null:M.render(),s.flags|=1,i!==null&&p?(s.child=Cn(s,i.child,null,v),s.child=Cn(s,null,c,v)):En(i,s,c,v),s.memoizedState=M.state,i=s.child):i=js(i,s,v),i}function md(i,s,c,p){return vn(),s.flags|=256,En(i,s,c,p),s.child}var Ic={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Fn(i){return{baseLanes:i,cachePool:zl()}}function gd(i,s,c){return i=i!==null?i.childLanes&~c:0,s&&(i|=Ha),i}function _d(i,s,c){var p=s.pendingProps,v=!1,M=(s.flags&128)!==0,N;if((N=M)||(N=i!==null&&i.memoizedState===null?!1:(Yi.current&2)!==0),N&&(v=!0,s.flags&=-129),N=(s.flags&32)!==0,s.flags&=-33,i===null){if(Ci){if(v?Os(s):Za(),Ci){var K=or,fe;if(fe=K){e:{for(fe=K,K=sa;fe.nodeType!==8;){if(!K){K=null;break e}if(fe=Fs(fe.nextSibling),fe===null){K=null;break e}}K=fe}K!==null?(s.memoizedState={dehydrated:K,treeContext:Oa!==null?{id:aa,overflow:ga}:null,retryLane:536870912,hydrationErrors:null},fe=ra(18,null,null,0),fe.stateNode=K,fe.return=s,s.child=fe,Lr=s,or=null,fe=!0):fe=!1}fe||Vo(s)}if(K=s.memoizedState,K!==null&&(K=K.dehydrated,K!==null))return Lu(K)?s.lanes=32:s.lanes=536870912,null;Sa(s)}return K=p.children,p=p.fallback,v?(Za(),v=s.mode,K=vh({mode:"hidden",children:K},v),p=Ws(p,v,c,null),K.return=s,p.return=s,K.sibling=p,s.child=K,v=s.child,v.memoizedState=Fn(c),v.childLanes=gd(i,N,c),s.memoizedState=Ic,p):(Os(s),cf(s,K))}if(fe=i.memoizedState,fe!==null&&(K=fe.dehydrated,K!==null)){if(M)s.flags&256?(Os(s),s.flags&=-257,s=uf(i,s,c)):s.memoizedState!==null?(Za(),s.child=i.child,s.flags|=128,s=null):(Za(),v=p.fallback,K=s.mode,p=vh({mode:"visible",children:p.children},K),v=Ws(v,K,c,null),v.flags|=2,p.return=s,v.return=s,p.sibling=v,s.child=p,Cn(s,i.child,null,c),p=s.child,p.memoizedState=Fn(c),p.childLanes=gd(i,N,c),s.memoizedState=Ic,s=v);else if(Os(s),Lu(K)){if(N=K.nextSibling&&K.nextSibling.dataset,N)var Be=N.dgst;N=Be,p=Error(I(419)),p.stack="",p.digest=N,Cs({value:p,source:null,stack:null}),s=uf(i,s,c)}else if(Xr||Cl(i,s,c,!1),N=(c&i.childLanes)!==0,Xr||N){if(N=dr,N!==null&&(p=c&-c,p=(p&42)!==0?1:Kt(p),p=(p&(N.suspendedLanes|c))!==0?0:p,p!==0&&p!==fe.retryLane))throw fe.retryLane=p,ia(i,p),Xa(N,i,p),yh;K.data==="$?"||Ad(),s=uf(i,s,c)}else K.data==="$?"?(s.flags|=192,s.child=i.child,s=null):(i=fe.treeContext,or=Fs(K.nextSibling),Lr=s,Ci=!0,eo=null,sa=!1,i!==null&&(na[xn++]=aa,na[xn++]=ga,na[xn++]=Oa,aa=i.id,ga=i.overflow,Oa=s),s=cf(s,p.children),s.flags|=4096);return s}return v?(Za(),v=p.fallback,K=s.mode,fe=i.child,Be=fe.sibling,p=yn(fe,{mode:"hidden",children:p.children}),p.subtreeFlags=fe.subtreeFlags&65011712,Be!==null?v=yn(Be,v):(v=Ws(v,K,c,null),v.flags|=2),v.return=s,p.return=s,p.sibling=v,s.child=p,p=v,v=s.child,K=i.child.memoizedState,K===null?K=Fn(c):(fe=K.cachePool,fe!==null?(Be=Fr._currentValue,fe=fe.parent!==Be?{parent:Be,pool:Be}:fe):fe=zl(),K={baseLanes:K.baseLanes|c,cachePool:fe}),v.memoizedState=K,v.childLanes=gd(i,N,c),s.memoizedState=Ic,p):(Os(s),c=i.child,i=c.sibling,c=yn(c,{mode:"visible",children:p.children}),c.return=s,c.sibling=null,i!==null&&(N=s.deletions,N===null?(s.deletions=[i],s.flags|=16):N.push(i)),s.child=c,s.memoizedState=null,c)}function cf(i,s){return s=vh({mode:"visible",children:s},i.mode),s.return=i,i.child=s}function vh(i,s){return i=ra(22,i,null,s),i.lanes=0,i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null},i}function uf(i,s,c){return Cn(s,i.child,null,c),i=cf(s,s.pendingProps.children),i.flags|=2,s.memoizedState=null,i}function ip(i,s,c){i.lanes|=s;var p=i.alternate;p!==null&&(p.lanes|=s),hu(i.return,s,c)}function yd(i,s,c,p,v){var M=i.memoizedState;M===null?i.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:p,tail:c,tailMode:v}:(M.isBackwards=s,M.rendering=null,M.renderingStartTime=0,M.last=p,M.tail=c,M.tailMode=v)}function rp(i,s,c){var p=s.pendingProps,v=p.revealOrder,M=p.tail;if(En(i,s,p.children,c),p=Yi.current,(p&2)!==0)p=p&1|2,s.flags|=128;else{if(i!==null&&(i.flags&128)!==0)e:for(i=s.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&ip(i,c,s);else if(i.tag===19)ip(i,c,s);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===s)break e;for(;i.sibling===null;){if(i.return===null||i.return===s)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}p&=1}switch(at(Yi,p),v){case"forwards":for(c=s.child,v=null;c!==null;)i=c.alternate,i!==null&&Ta(i)===null&&(v=c),c=c.sibling;c=v,c===null?(v=s.child,s.child=null):(v=c.sibling,c.sibling=null),yd(s,!1,v,c,M);break;case"backwards":for(c=null,v=s.child,s.child=null;v!==null;){if(i=v.alternate,i!==null&&Ta(i)===null){s.child=v;break}i=v.sibling,v.sibling=c,c=v,v=i}yd(s,!0,c,null,M);break;case"together":yd(s,!1,null,null,void 0);break;default:s.memoizedState=null}return s.child}function js(i,s,c){if(i!==null&&(s.dependencies=i.dependencies),mo|=s.lanes,(c&s.childLanes)===0)if(i!==null){if(Cl(i,s,c,!1),(c&s.childLanes)===0)return null}else return null;if(i!==null&&s.child!==i.child)throw Error(I(153));if(s.child!==null){for(i=s.child,c=yn(i,i.pendingProps),s.child=c,c.return=s;i.sibling!==null;)i=i.sibling,c=c.sibling=yn(i,i.pendingProps),c.return=s;c.sibling=null}return s.child}function xd(i,s){return(i.lanes&s)!==0?!0:(i=i.dependencies,!!(i!==null&&Sc(i)))}function np(i,s,c){switch(s.tag){case 3:si(s,s.stateNode.containerInfo),bn(s,Fr,i.memoizedState.cache),vn();break;case 27:case 5:zn(s);break;case 4:si(s,s.stateNode.containerInfo);break;case 10:bn(s,s.type,s.memoizedProps.value);break;case 13:var p=s.memoizedState;if(p!==null)return p.dehydrated!==null?(Os(s),s.flags|=128,null):(c&s.child.childLanes)!==0?_d(i,s,c):(Os(s),i=js(i,s,c),i!==null?i.sibling:null);Os(s);break;case 19:var v=(i.flags&128)!==0;if(p=(c&s.childLanes)!==0,p||(Cl(i,s,c,!1),p=(c&s.childLanes)!==0),v){if(p)return rp(i,s,c);s.flags|=128}if(v=s.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),at(Yi,Yi.current),p)break;return null;case 22:case 23:return s.lanes=0,af(i,s,c);case 24:bn(s,Fr,i.memoizedState.cache)}return js(i,s,c)}function ap(i,s,c){if(i!==null)if(i.memoizedProps!==s.pendingProps)Xr=!0;else{if(!xd(i,c)&&(s.flags&128)===0)return Xr=!1,np(i,s,c);Xr=(i.flags&131072)!==0}else Xr=!1,Ci&&(s.flags&1048576)!==0&&Js(s,Tl,s.index);switch(s.lanes=0,s.tag){case 16:e:{i=s.pendingProps;var p=s.elementType,v=p._init;if(p=v(p._payload),s.type=p,typeof p=="function")ou(p)?(i=zc(p,i),s.tag=1,s=lf(null,s,p,i,c)):(s.tag=0,s=of(null,s,p,i,c));else{if(p!=null){if(v=p.$$typeof,v===ut){s.tag=11,s=nf(null,s,p,i,c);break e}else if(v===Tt){s.tag=14,s=ep(null,s,p,i,c);break e}}throw s=Ir(p)||p,Error(I(306,s,""))}}return s;case 0:return of(i,s,s.type,s.pendingProps,c);case 1:return p=s.type,v=zc(p,s.pendingProps),lf(i,s,p,v,c);case 3:e:{if(si(s,s.stateNode.containerInfo),i===null)throw Error(I(387));p=s.pendingProps;var M=s.memoizedState;v=M.element,Il(i,s),$o(s,p,null,c);var N=s.memoizedState;if(p=N.cache,bn(s,Fr,p),p!==M.cache&&du(s,[Fr],c,!0),Rl(),p=N.element,M.isDehydrated)if(M={element:p,isDehydrated:!1,cache:N.cache},s.updateQueue.baseState=M,s.memoizedState=M,s.flags&256){s=md(i,s,p,c);break e}else if(p!==v){v=Qr(Error(I(424)),s),Cs(v),s=md(i,s,p,c);break e}else{switch(i=s.stateNode.containerInfo,i.nodeType){case 9:i=i.body;break;default:i=i.nodeName==="HTML"?i.ownerDocument.body:i}for(or=Fs(i.firstChild),Lr=s,Ci=!0,eo=null,sa=!0,c=Bs(s,null,p,c),s.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling}else{if(vn(),p===v){s=js(i,s,c);break e}En(i,s,p,c)}s=s.child}return s;case 26:return xh(i,s),i===null?(c=Uh(s.type,null,s.pendingProps,null))?s.memoizedState=c:Ci||(c=s.type,i=s.pendingProps,p=jh(zt.current).createElement(c),p[Nt]=s,p[qt]=i,Or(p,c,i),tr(p),s.stateNode=p):s.memoizedState=Uh(s.type,i.memoizedProps,s.pendingProps,i.memoizedState),null;case 27:return zn(s),i===null&&Ci&&(p=s.stateNode=un(s.type,s.pendingProps,zt.current),Lr=s,sa=!0,v=or,nl(s.type)?(Bf=v,or=Fs(p.firstChild)):or=v),En(i,s,s.pendingProps.children,c),xh(i,s),i===null&&(s.flags|=4194304),s.child;case 5:return i===null&&Ci&&((v=p=or)&&(p=Fd(p,s.type,s.pendingProps,sa),p!==null?(s.stateNode=p,Lr=s,or=Fs(p.firstChild),sa=!1,v=!0):v=!1),v||Vo(s)),zn(s),v=s.type,M=s.pendingProps,N=i!==null?i.memoizedProps:null,p=M.children,yo(v,M)?p=null:N!==null&&yo(v,N)&&(s.flags|=32),s.memoizedState!==null&&(v=mh(i,s,wr,null,null,c),be._currentValue=v),xh(i,s),En(i,s,p,c),s.child;case 6:return i===null&&Ci&&((i=c=or)&&(c=Ud(c,s.pendingProps,sa),c!==null?(s.stateNode=c,Lr=s,or=null,i=!0):i=!1),i||Vo(s)),null;case 13:return _d(i,s,c);case 4:return si(s,s.stateNode.containerInfo),p=s.pendingProps,i===null?s.child=Cn(s,null,p,c):En(i,s,p,c),s.child;case 11:return nf(i,s,s.type,s.pendingProps,c);case 7:return En(i,s,s.pendingProps,c),s.child;case 8:return En(i,s,s.pendingProps.children,c),s.child;case 12:return En(i,s,s.pendingProps.children,c),s.child;case 10:return p=s.pendingProps,bn(s,s.type,p.value),En(i,s,p.children,c),s.child;case 9:return v=s.type._context,p=s.pendingProps.children,to(s),v=Xi(v),p=p(v),s.flags|=1,En(i,s,p,c),s.child;case 14:return ep(i,s,s.type,s.pendingProps,c);case 15:return tp(i,s,s.type,s.pendingProps,c);case 19:return rp(i,s,c);case 31:return p=s.pendingProps,c=s.mode,p={mode:p.mode,children:p.children},i===null?(c=vh(p,c),c.ref=s.ref,s.child=c,c.return=s,s=c):(c=yn(i.child,p),c.ref=s.ref,s.child=c,c.return=s,s=c),s;case 22:return af(i,s,c);case 24:return to(s),p=Xi(Fr),i===null?(v=hh(),v===null&&(v=dr,M=io(),v.pooledCache=M,M.refCount++,M!==null&&(v.pooledCacheLanes|=c),v=M),s.memoizedState={parent:p,cache:v},dh(s),bn(s,Fr,v)):((i.lanes&c)!==0&&(Il(i,s),$o(s,null,null,c),Rl()),v=i.memoizedState,M=s.memoizedState,v.parent!==p?(v={parent:p,cache:p},s.memoizedState=v,s.lanes===0&&(s.memoizedState=s.updateQueue.baseState=v),bn(s,Fr,p)):(p=M.cache,bn(s,Fr,p),p!==v.cache&&du(s,[Fr],c,!0))),En(i,s,s.pendingProps.children,c),s.child;case 29:throw s.pendingProps}throw Error(I(156,s.tag))}function Qo(i){i.flags|=4}function sp(i,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)i.flags&=-16777217;else if(i.flags|=16777216,!T(s)){if(s=la.current,s!==null&&((gi&4194048)===gi?Tr!==null:(gi&62914560)!==gi&&(gi&536870912)===0||s!==Tr))throw Fa=Tc,xa;i.flags|=8192}}function xu(i,s){s!==null&&(i.flags|=4),i.flags&16384&&(s=i.tag!==22?Ye():536870912,i.lanes|=s,ku|=s)}function Rc(i,s){if(!Ci)switch(i.tailMode){case"hidden":s=i.tail;for(var c=null;s!==null;)s.alternate!==null&&(c=s),s=s.sibling;c===null?i.tail=null:c.sibling=null;break;case"collapsed":c=i.tail;for(var p=null;c!==null;)c.alternate!==null&&(p=c),c=c.sibling;p===null?s||i.tail===null?i.tail=null:i.tail.sibling=null:p.sibling=null}}function Mr(i){var s=i.alternate!==null&&i.alternate.child===i.child,c=0,p=0;if(s)for(var v=i.child;v!==null;)c|=v.lanes|v.childLanes,p|=v.subtreeFlags&65011712,p|=v.flags&65011712,v.return=i,v=v.sibling;else for(v=i.child;v!==null;)c|=v.lanes|v.childLanes,p|=v.subtreeFlags,p|=v.flags,v.return=i,v=v.sibling;return i.subtreeFlags|=p,i.childLanes=c,s}function Dc(i,s,c){var p=s.pendingProps;switch(Ml(s),s.tag){case 31:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Mr(s),null;case 1:return Mr(s),null;case 3:return c=s.stateNode,p=null,i!==null&&(p=i.memoizedState.cache),s.memoizedState.cache!==p&&(s.flags|=2048),ja(Fr),Ji(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(i===null||i.child===null)&&(Hn(s)?Qo(s):i===null||i.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,wc())),Mr(s),null;case 26:return c=s.memoizedState,i===null?(Qo(s),c!==null?(Mr(s),sp(s,c)):(Mr(s),s.flags&=-16777217)):c?c!==i.memoizedState?(Qo(s),Mr(s),sp(s,c)):(Mr(s),s.flags&=-16777217):(i.memoizedProps!==p&&Qo(s),Mr(s),s.flags&=-16777217),null;case 27:kn(s),c=zt.current;var v=s.type;if(i!==null&&s.stateNode!=null)i.memoizedProps!==p&&Qo(s);else{if(!p){if(s.stateNode===null)throw Error(I(166));return Mr(s),null}i=wt.current,Hn(s)?cu(s):(i=un(v,p,c),s.stateNode=i,Qo(s))}return Mr(s),null;case 5:if(kn(s),c=s.type,i!==null&&s.stateNode!=null)i.memoizedProps!==p&&Qo(s);else{if(!p){if(s.stateNode===null)throw Error(I(166));return Mr(s),null}if(i=wt.current,Hn(s))cu(s);else{switch(v=jh(zt.current),i){case 1:i=v.createElementNS("http://www.w3.org/2000/svg",c);break;case 2:i=v.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;default:switch(c){case"svg":i=v.createElementNS("http://www.w3.org/2000/svg",c);break;case"math":i=v.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;case"script":i=v.createElement("div"),i.innerHTML="<script><\/script>",i=i.removeChild(i.firstChild);break;case"select":i=typeof p.is=="string"?v.createElement("select",{is:p.is}):v.createElement("select"),p.multiple?i.multiple=!0:p.size&&(i.size=p.size);break;default:i=typeof p.is=="string"?v.createElement(c,{is:p.is}):v.createElement(c)}}i[Nt]=s,i[qt]=p;e:for(v=s.child;v!==null;){if(v.tag===5||v.tag===6)i.appendChild(v.stateNode);else if(v.tag!==4&&v.tag!==27&&v.child!==null){v.child.return=v,v=v.child;continue}if(v===s)break e;for(;v.sibling===null;){if(v.return===null||v.return===s)break e;v=v.return}v.sibling.return=v.return,v=v.sibling}s.stateNode=i;e:switch(Or(i,c,p),c){case"button":case"input":case"select":case"textarea":i=!!p.autoFocus;break e;case"img":i=!0;break e;default:i=!1}i&&Qo(s)}}return Mr(s),s.flags&=-16777217,null;case 6:if(i&&s.stateNode!=null)i.memoizedProps!==p&&Qo(s);else{if(typeof p!="string"&&s.stateNode===null)throw Error(I(166));if(i=zt.current,Hn(s)){if(i=s.stateNode,c=s.memoizedProps,p=null,v=Lr,v!==null)switch(v.tag){case 27:case 5:p=v.memoizedProps}i[Nt]=s,i=!!(i.nodeValue===c||p!==null&&p.suppressHydrationWarning===!0||Rf(i.nodeValue,c)),i||Vo(s)}else i=jh(i).createTextNode(p),i[Nt]=s,s.stateNode=i}return Mr(s),null;case 13:if(p=s.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(v=Hn(s),p!==null&&p.dehydrated!==null){if(i===null){if(!v)throw Error(I(318));if(v=s.memoizedState,v=v!==null?v.dehydrated:null,!v)throw Error(I(317));v[Nt]=s}else vn(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Mr(s),v=!1}else v=wc(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=v),v=!0;if(!v)return s.flags&256?(Sa(s),s):(Sa(s),null)}if(Sa(s),(s.flags&128)!==0)return s.lanes=c,s;if(c=p!==null,i=i!==null&&i.memoizedState!==null,c){p=s.child,v=null,p.alternate!==null&&p.alternate.memoizedState!==null&&p.alternate.memoizedState.cachePool!==null&&(v=p.alternate.memoizedState.cachePool.pool);var M=null;p.memoizedState!==null&&p.memoizedState.cachePool!==null&&(M=p.memoizedState.cachePool.pool),M!==v&&(p.flags|=2048)}return c!==i&&c&&(s.child.flags|=8192),xu(s,s.updateQueue),Mr(s),null;case 4:return Ji(),i===null&&Rd(s.stateNode.containerInfo),Mr(s),null;case 10:return ja(s.type),Mr(s),null;case 19:if(vt(Yi),v=s.memoizedState,v===null)return Mr(s),null;if(p=(s.flags&128)!==0,M=v.rendering,M===null)if(p)Rc(v,!1);else{if(Br!==0||i!==null&&(i.flags&128)!==0)for(i=s.child;i!==null;){if(M=Ta(i),M!==null){for(s.flags|=128,Rc(v,!1),i=M.updateQueue,s.updateQueue=i,xu(s,i),s.subtreeFlags=0,i=c,c=s.child;c!==null;)lh(c,i),c=c.sibling;return at(Yi,Yi.current&1|2),s.child}i=i.sibling}v.tail!==null&&Kr()>Td&&(s.flags|=128,p=!0,Rc(v,!1),s.lanes=4194304)}else{if(!p)if(i=Ta(M),i!==null){if(s.flags|=128,p=!0,i=i.updateQueue,s.updateQueue=i,xu(s,i),Rc(v,!0),v.tail===null&&v.tailMode==="hidden"&&!M.alternate&&!Ci)return Mr(s),null}else 2*Kr()-v.renderingStartTime>Td&&c!==536870912&&(s.flags|=128,p=!0,Rc(v,!1),s.lanes=4194304);v.isBackwards?(M.sibling=s.child,s.child=M):(i=v.last,i!==null?i.sibling=M:s.child=M,v.last=M)}return v.tail!==null?(s=v.tail,v.rendering=s,v.tail=s.sibling,v.renderingStartTime=Kr(),s.sibling=null,i=Yi.current,at(Yi,p?i&1|2:i&1),s):(Mr(s),null);case 22:case 23:return Sa(s),gu(),p=s.memoizedState!==null,i!==null?i.memoizedState!==null!==p&&(s.flags|=8192):p&&(s.flags|=8192),p?(c&536870912)!==0&&(s.flags&128)===0&&(Mr(s),s.subtreeFlags&6&&(s.flags|=8192)):Mr(s),c=s.updateQueue,c!==null&&xu(s,c.retryQueue),c=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(c=i.memoizedState.cachePool.pool),p=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(p=s.memoizedState.cachePool.pool),p!==c&&(s.flags|=2048),i!==null&&vt(Na),null;case 24:return c=null,i!==null&&(c=i.memoizedState.cache),s.memoizedState.cache!==c&&(s.flags|=2048),ja(Fr),Mr(s),null;case 25:return null;case 30:return null}throw Error(I(156,s.tag))}function bh(i,s){switch(Ml(s),s.tag){case 1:return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 3:return ja(Fr),Ji(),i=s.flags,(i&65536)!==0&&(i&128)===0?(s.flags=i&-65537|128,s):null;case 26:case 27:case 5:return kn(s),null;case 13:if(Sa(s),i=s.memoizedState,i!==null&&i.dehydrated!==null){if(s.alternate===null)throw Error(I(340));vn()}return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 19:return vt(Yi),null;case 4:return Ji(),null;case 10:return ja(s.type),null;case 22:case 23:return Sa(s),gu(),i!==null&&vt(Na),i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 24:return ja(Fr),null;case 25:return null;default:return null}}function op(i,s){switch(Ml(s),s.tag){case 3:ja(Fr),Ji();break;case 26:case 27:case 5:kn(s);break;case 4:Ji();break;case 13:Sa(s);break;case 19:vt(Yi);break;case 10:ja(s.type);break;case 22:case 23:Sa(s),gu(),i!==null&&vt(Na);break;case 24:ja(Fr)}}function wh(i,s){try{var c=s.updateQueue,p=c!==null?c.lastEffect:null;if(p!==null){var v=p.next;c=v;do{if((c.tag&i)===i){p=void 0;var M=c.create,N=c.inst;p=M(),N.destroy=p}c=c.next}while(c!==v)}}catch(K){Ki(s,s.return,K)}}function jl(i,s,c){try{var p=s.updateQueue,v=p!==null?p.lastEffect:null;if(v!==null){var M=v.next;p=M;do{if((p.tag&i)===i){var N=p.inst,K=N.destroy;if(K!==void 0){N.destroy=void 0,v=s;var fe=c,Be=K;try{Be()}catch(Ke){Ki(v,fe,Ke)}}}p=p.next}while(p!==M)}}catch(Ke){Ki(s,s.return,Ke)}}function lp(i){var s=i.updateQueue;if(s!==null){var c=i.stateNode;try{ph(s,c)}catch(p){Ki(i,i.return,p)}}}function cp(i,s,c){c.props=zc(i.type,i.memoizedProps),c.state=i.memoizedState;try{c.componentWillUnmount()}catch(p){Ki(i,s,p)}}function Sh(i,s){try{var c=i.ref;if(c!==null){switch(i.tag){case 26:case 27:case 5:var p=i.stateNode;break;case 30:p=i.stateNode;break;default:p=i.stateNode}typeof c=="function"?i.refCleanup=c(p):c.current=p}}catch(v){Ki(i,s,v)}}function ho(i,s){var c=i.ref,p=i.refCleanup;if(c!==null)if(typeof p=="function")try{p()}catch(v){Ki(i,s,v)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(v){Ki(i,s,v)}else c.current=null}function vd(i){var s=i.type,c=i.memoizedProps,p=i.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":c.autoFocus&&p.focus();break e;case"img":c.src?p.src=c.src:c.srcSet&&(p.srcset=c.srcSet)}}catch(v){Ki(i,i.return,v)}}function hf(i,s,c){try{var p=i.stateNode;Rp(p,i.type,c,s),p[qt]=s}catch(v){Ki(i,i.return,v)}}function df(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&nl(i.type)||i.tag===4}function Lc(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||df(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.tag===27&&nl(i.type)||i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function ff(i,s,c){var p=i.tag;if(p===5||p===6)i=i.stateNode,s?(c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c).insertBefore(i,s):(s=c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c,s.appendChild(i),c=c._reactRootContainer,c!=null||s.onclick!==null||(s.onclick=Yn));else if(p!==4&&(p===27&&nl(i.type)&&(c=i.stateNode,s=null),i=i.child,i!==null))for(ff(i,s,c),i=i.sibling;i!==null;)ff(i,s,c),i=i.sibling}function hr(i,s,c){var p=i.tag;if(p===5||p===6)i=i.stateNode,s?c.insertBefore(i,s):c.appendChild(i);else if(p!==4&&(p===27&&nl(i.type)&&(c=i.stateNode),i=i.child,i!==null))for(hr(i,s,c),i=i.sibling;i!==null;)hr(i,s,c),i=i.sibling}function Bc(i){var s=i.stateNode,c=i.memoizedProps;try{for(var p=i.type,v=s.attributes;v.length;)s.removeAttributeNode(v[0]);Or(s,p,c),s[Nt]=i,s[qt]=c}catch(M){Ki(i,i.return,M)}}var fo=!1,Cr=!1,vu=!1,bu=typeof WeakSet=="function"?WeakSet:Set,cn=null;function up(i,s){if(i=i.containerInfo,Bd=dt,i=ru(i),dc(i)){if("selectionStart"in i)var c={start:i.selectionStart,end:i.selectionEnd};else e:{c=(c=i.ownerDocument)&&c.defaultView||window;var p=c.getSelection&&c.getSelection();if(p&&p.rangeCount!==0){c=p.anchorNode;var v=p.anchorOffset,M=p.focusNode;p=p.focusOffset;try{c.nodeType,M.nodeType}catch{c=null;break e}var N=0,K=-1,fe=-1,Be=0,Ke=0,it=i,je=null;t:for(;;){for(var Ue;it!==c||v!==0&&it.nodeType!==3||(K=N+v),it!==M||p!==0&&it.nodeType!==3||(fe=N+p),it.nodeType===3&&(N+=it.nodeValue.length),(Ue=it.firstChild)!==null;)je=it,it=Ue;for(;;){if(it===i)break t;if(je===c&&++Be===v&&(K=N),je===M&&++Ke===p&&(fe=N),(Ue=it.nextSibling)!==null)break;it=je,je=it.parentNode}it=Ue}c=K===-1||fe===-1?null:{start:K,end:fe}}else c=null}c=c||{start:0,end:0}}else c=null;for(Od={focusedElem:i,selectionRange:c},dt=!1,cn=s;cn!==null;)if(s=cn,i=s.child,(s.subtreeFlags&1024)!==0&&i!==null)i.return=s,cn=i;else for(;cn!==null;){switch(s=cn,M=s.alternate,i=s.flags,s.tag){case 0:break;case 11:case 15:break;case 1:if((i&1024)!==0&&M!==null){i=void 0,c=s,v=M.memoizedProps,M=M.memoizedState,p=c.stateNode;try{var Qt=zc(c.type,v,c.elementType===c.type);i=p.getSnapshotBeforeUpdate(Qt,M),p.__reactInternalSnapshotBeforeUpdate=i}catch(Xt){Ki(c,c.return,Xt)}}break;case 3:if((i&1024)!==0){if(i=s.stateNode.containerInfo,c=i.nodeType,c===9)Nd(i);else if(c===1)switch(i.nodeName){case"HEAD":case"HTML":case"BODY":Nd(i);break;default:i.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((i&1024)!==0)throw Error(I(163))}if(i=s.sibling,i!==null){i.return=s.return,cn=i;break}cn=s.return}}function wu(i,s,c){var p=c.flags;switch(c.tag){case 0:case 11:case 15:el(i,c),p&4&&wh(5,c);break;case 1:if(el(i,c),p&4)if(i=c.stateNode,s===null)try{i.componentDidMount()}catch(N){Ki(c,c.return,N)}else{var v=zc(c.type,s.memoizedProps);s=s.memoizedState;try{i.componentDidUpdate(v,s,i.__reactInternalSnapshotBeforeUpdate)}catch(N){Ki(c,c.return,N)}}p&64&&lp(c),p&512&&Sh(c,c.return);break;case 3:if(el(i,c),p&64&&(i=c.updateQueue,i!==null)){if(s=null,c.child!==null)switch(c.child.tag){case 27:case 5:s=c.child.stateNode;break;case 1:s=c.child.stateNode}try{ph(i,s)}catch(N){Ki(c,c.return,N)}}break;case 27:s===null&&p&4&&Bc(c);case 26:case 5:el(i,c),s===null&&p&4&&vd(c),p&512&&Sh(c,c.return);break;case 12:el(i,c);break;case 13:el(i,c),p&4&&hp(i,c),p&64&&(i=c.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&(c=nm.bind(null,c),um(i,c))));break;case 22:if(p=c.memoizedState!==null||fo,!p){s=s!==null&&s.memoizedState!==null||Cr,v=fo;var M=Cr;fo=p,(Cr=s)&&!M?Nl(i,c,(c.subtreeFlags&8772)!==0):el(i,c),fo=v,Cr=M}break;case 30:break;default:el(i,c)}}function bd(i){var s=i.alternate;s!==null&&(i.alternate=null,bd(s)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(s=i.stateNode,s!==null&&gt(s)),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}var Zi=null,Un=!1;function Ma(i,s,c){for(c=c.child;c!==null;)Su(i,s,c),c=c.sibling}function Su(i,s,c){if(sr&&typeof sr.onCommitFiberUnmount=="function")try{sr.onCommitFiberUnmount(Ti,c)}catch{}switch(c.tag){case 26:Cr||ho(c,s),Ma(i,s,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:Cr||ho(c,s);var p=Zi,v=Un;nl(c.type)&&(Zi=c.stateNode,Un=!1),Ma(i,s,c),Hc(c.stateNode),Zi=p,Un=v;break;case 5:Cr||ho(c,s);case 6:if(p=Zi,v=Un,Zi=null,Ma(i,s,c),Zi=p,Un=v,Zi!==null)if(Un)try{(Zi.nodeType===9?Zi.body:Zi.nodeName==="HTML"?Zi.ownerDocument.body:Zi).removeChild(c.stateNode)}catch(M){Ki(c,s,M)}else try{Zi.removeChild(c.stateNode)}catch(M){Ki(c,s,M)}break;case 18:Zi!==null&&(Un?(i=Zi,Nh(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,c.stateNode),Pr(i)):Nh(Zi,c.stateNode));break;case 4:p=Zi,v=Un,Zi=c.stateNode.containerInfo,Un=!0,Ma(i,s,c),Zi=p,Un=v;break;case 0:case 11:case 14:case 15:Cr||jl(2,c,s),Cr||jl(4,c,s),Ma(i,s,c);break;case 1:Cr||(ho(c,s),p=c.stateNode,typeof p.componentWillUnmount=="function"&&cp(c,s,p)),Ma(i,s,c);break;case 21:Ma(i,s,c);break;case 22:Cr=(p=Cr)||c.memoizedState!==null,Ma(i,s,c),Cr=p;break;default:Ma(i,s,c)}}function hp(i,s){if(s.memoizedState===null&&(i=s.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null))))try{Pr(i)}catch(c){Ki(s,s.return,c)}}function dp(i){switch(i.tag){case 13:case 19:var s=i.stateNode;return s===null&&(s=i.stateNode=new bu),s;case 22:return i=i.stateNode,s=i._retryCache,s===null&&(s=i._retryCache=new bu),s;default:throw Error(I(435,i.tag))}}function Jo(i,s){var c=dp(i);s.forEach(function(p){var v=am.bind(null,i,p);c.has(p)||(c.add(p),p.then(v,v))})}function qa(i,s){var c=s.deletions;if(c!==null)for(var p=0;p<c.length;p++){var v=c[p],M=i,N=s,K=N;e:for(;K!==null;){switch(K.tag){case 27:if(nl(K.type)){Zi=K.stateNode,Un=!1;break e}break;case 5:Zi=K.stateNode,Un=!1;break e;case 3:case 4:Zi=K.stateNode.containerInfo,Un=!0;break e}K=K.return}if(Zi===null)throw Error(I(160));Su(M,N,v),Zi=null,Un=!1,M=v.alternate,M!==null&&(M.return=null),v.return=null}if(s.subtreeFlags&13878)for(s=s.child;s!==null;)Tu(s,i),s=s.sibling}var fs=null;function Tu(i,s){var c=i.alternate,p=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:qa(s,i),ca(i),p&4&&(jl(3,i,i.return),wh(3,i),jl(5,i,i.return));break;case 1:qa(s,i),ca(i),p&512&&(Cr||c===null||ho(c,c.return)),p&64&&fo&&(i=i.updateQueue,i!==null&&(p=i.callbacks,p!==null&&(c=i.shared.hiddenCallbacks,i.shared.hiddenCallbacks=c===null?p:c.concat(p))));break;case 26:var v=fs;if(qa(s,i),ca(i),p&512&&(Cr||c===null||ho(c,c.return)),p&4){var M=c!==null?c.memoizedState:null;if(p=i.memoizedState,c===null)if(p===null)if(i.stateNode===null){e:{p=i.type,c=i.memoizedProps,v=v.ownerDocument||v;t:switch(p){case"title":M=v.getElementsByTagName("title")[0],(!M||M[Ja]||M[Nt]||M.namespaceURI==="http://www.w3.org/2000/svg"||M.hasAttribute("itemprop"))&&(M=v.createElement(p),v.head.insertBefore(M,v.querySelector("head > title"))),Or(M,p,c),M[Nt]=i,tr(M),p=M;break e;case"link":var N=_("link","href",v).get(p+(c.href||""));if(N){for(var K=0;K<N.length;K++)if(M=N[K],M.getAttribute("href")===(c.href==null||c.href===""?null:c.href)&&M.getAttribute("rel")===(c.rel==null?null:c.rel)&&M.getAttribute("title")===(c.title==null?null:c.title)&&M.getAttribute("crossorigin")===(c.crossOrigin==null?null:c.crossOrigin)){N.splice(K,1);break t}}M=v.createElement(p),Or(M,p,c),v.head.appendChild(M);break;case"meta":if(N=_("meta","content",v).get(p+(c.content||""))){for(K=0;K<N.length;K++)if(M=N[K],M.getAttribute("content")===(c.content==null?null:""+c.
vendor: 4,403 bytes, line 48
48content)&&M.getAttribute("name")===(c.name==null?null:c.name)&&M.getAttribute("property")===(c.property==null?null:c.property)&&M.getAttribute("http-equiv")===(c.httpEquiv==null?null:c.httpEquiv)&&M.getAttribute("charset")===(c.charSet==null?null:c.charSet)){N.splice(K,1);break t}}M=v.createElement(p),Or(M,p,c),v.head.appendChild(M);break;default:throw Error(I(468,p))}M[Nt]=i,tr(M),p=M}i.stateNode=p}else x(v,i.type,i.stateNode);else i.stateNode=t(v,p,i.memoizedProps);else M!==p?(M===null?c.stateNode!==null&&(c=c.stateNode,c.parentNode.removeChild(c)):M.count--,p===null?x(v,i.type,i.stateNode):t(v,p,i.memoizedProps)):p===null&&i.stateNode!==null&&hf(i,i.memoizedProps,c.memoizedProps)}break;case 27:qa(s,i),ca(i),p&512&&(Cr||c===null||ho(c,c.return)),c!==null&&p&4&&hf(i,i.memoizedProps,c.memoizedProps);break;case 5:if(qa(s,i),ca(i),p&512&&(Cr||c===null||ho(c,c.return)),i.flags&32){v=i.stateNode;try{rs(v,"")}catch(Ue){Ki(i,i.return,Ue)}}p&4&&i.stateNode!=null&&(v=i.memoizedProps,hf(i,v,c!==null?c.memoizedProps:v)),p&1024&&(vu=!0);break;case 6:if(qa(s,i),ca(i),p&4){if(i.stateNode===null)throw Error(I(162));p=i.memoizedProps,c=i.stateNode;try{c.nodeValue=p}catch(Ue){Ki(i,i.return,Ue)}}break;case 3:if(g=null,v=fs,fs=Bu(s.containerInfo),qa(s,i),fs=v,ca(i),p&4&&c!==null&&c.memoizedState.isDehydrated)try{Pr(s.containerInfo)}catch(Ue){Ki(i,i.return,Ue)}vu&&(vu=!1,pf(i));break;case 4:p=fs,fs=Bu(i.stateNode.containerInfo),qa(s,i),ca(i),fs=p;break;case 12:qa(s,i),ca(i);break;case 13:qa(s,i),ca(i),i.child.flags&8192&&i.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(xf=Kr()),p&4&&(p=i.updateQueue,p!==null&&(i.updateQueue=null,Jo(i,p)));break;case 22:v=i.memoizedState!==null;var fe=c!==null&&c.memoizedState!==null,Be=fo,Ke=Cr;if(fo=Be||v,Cr=Ke||fe,qa(s,i),Cr=Ke,fo=Be,ca(i),p&8192)e:for(s=i.stateNode,s._visibility=v?s._visibility&-2:s._visibility|1,v&&(c===null||fe||fo||Cr||Oc(i)),c=null,s=i;;){if(s.tag===5||s.tag===26){if(c===null){fe=c=s;try{if(M=fe.stateNode,v)N=M.style,typeof N.setProperty=="function"?N.setProperty("display","none","important"):N.display="none";else{K=fe.stateNode;var it=fe.memoizedProps.style,je=it!=null&&it.hasOwnProperty("display")?it.display:null;K.style.display=je==null||typeof je=="boolean"?"":(""+je).trim()}}catch(Ue){Ki(fe,fe.return,Ue)}}}else if(s.tag===6){if(c===null){fe=s;try{fe.stateNode.nodeValue=v?"":fe.memoizedProps}catch(Ue){Ki(fe,fe.return,Ue)}}}else if((s.tag!==22&&s.tag!==23||s.memoizedState===null||s===i)&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===i)break e;for(;s.sibling===null;){if(s.return===null||s.return===i)break e;c===s&&(c=null),s=s.return}c===s&&(c=null),s.sibling.return=s.return,s=s.sibling}p&4&&(p=i.updateQueue,p!==null&&(c=p.retryQueue,c!==null&&(p.retryQueue=null,Jo(i,c))));break;case 19:qa(s,i),ca(i),p&4&&(p=i.updateQueue,p!==null&&(i.updateQueue=null,Jo(i,p)));break;case 30:break;case 21:break;default:qa(s,i),ca(i)}}function ca(i){var s=i.flags;if(s&2){try{for(var c,p=i.return;p!==null;){if(df(p)){c=p;break}p=p.return}if(c==null)throw Error(I(160));switch(c.tag){case 27:var v=c.stateNode,M=Lc(i);hr(i,M,v);break;case 5:var N=c.stateNode;c.flags&32&&(rs(N,""),c.flags&=-33);var K=Lc(i);hr(i,K,N);break;case 3:case 4:var fe=c.stateNode.containerInfo,Be=Lc(i);ff(i,Be,fe);break;default:throw Error(I(161))}}catch(Ke){Ki(i,i.return,Ke)}i.flags&=-3}s&4096&&(i.flags&=-4097)}function pf(i){if(i.subtreeFlags&1024)for(i=i.child;i!==null;){var s=i;pf(s),s.tag===5&&s.flags&1024&&s.stateNode.reset(),i=i.sibling}}function el(i,s){if(s.subtreeFlags&8772)for(s=s.child;s!==null;)wu(i,s.alternate,s),s=s.sibling}function Oc(i){for(i=i.child;i!==null;){var s=i;switch(s.tag){case 0:case 11:case 14:case 15:jl(4,s,s.return),Oc(s);break;case 1:ho(s,s.return);var c=s.stateNode;typeof c.componentWillUnmount=="function"&&cp(s,s.return,c),Oc(s);break;case 27:Hc(s.stateNode);case 26:case 5:ho(s,s.return),Oc(s);break;case 22:s.memoizedState===null&&Oc(s);break;case 30:Oc(s);break;default:Oc(s)}i=i.sibling}}function Nl(i,s,c){for(c=c&&(s.subtreeFlags&8772)!==0,s=s.child;s!==null;){var p=s.alternate,v=i,M=s,N=M.flags;switch(M.tag){case 0:case 11:case 15:Nl(v,M,c),wh(4,M);break;case 1:if(Nl(v,M,c),p=M,v=p.stateNode,typeof v.componentDidMount=="function")try{v.componentDidMount()}catch(Be){Ki(p,p.return,Be)}if(p=M,v=p.updateQueue,v!==null){var K=p.stateNode;try{var fe=v.shared.hiddenCallbacks;
vendor: 10,011 bytes, line 48
48if(fe!==null)for(v.shared.hiddenCallbacks=null,v=0;v<fe.length;v++)fh(fe[v],K)}catch(Be){Ki(p,p.return,Be)}}c&&N&64&&lp(M),Sh(M,M.return);break;case 27:Bc(M);case 26:case 5:Nl(v,M,c),c&&p===null&&N&4&&vd(M),Sh(M,M.return);break;case 12:Nl(v,M,c);break;case 13:Nl(v,M,c),c&&N&4&&hp(v,M);break;case 22:M.memoizedState===null&&Nl(v,M,c),Sh(M,M.return);break;case 30:break;default:Nl(v,M,c)}s=s.sibling}}function mf(i,s){var c=null;i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(c=i.memoizedState.cachePool.pool),i=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(i=s.memoizedState.cachePool.pool),i!==c&&(i!=null&&i.refCount++,c!=null&&Go(c))}function gf(i,s){i=null,s.alternate!==null&&(i=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==i&&(s.refCount++,i!=null&&Go(i))}function po(i,s,c,p){if(s.subtreeFlags&10256)for(s=s.child;s!==null;)jc(i,s,c,p),s=s.sibling}function jc(i,s,c,p){var v=s.flags;switch(s.tag){case 0:case 11:case 15:po(i,s,c,p),v&2048&&wh(9,s);break;case 1:po(i,s,c,p);break;case 3:po(i,s,c,p),v&2048&&(i=null,s.alternate!==null&&(i=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==i&&(s.refCount++,i!=null&&Go(i)));break;case 12:if(v&2048){po(i,s,c,p),i=s.stateNode;try{var M=s.memoizedProps,N=M.id,K=M.onPostCommit;typeof K=="function"&&K(N,s.alternate===null?"mount":"update",i.passiveEffectDuration,-0)}catch(fe){Ki(s,s.return,fe)}}else po(i,s,c,p);break;case 13:po(i,s,c,p);break;case 23:break;case 22:M=s.stateNode,N=s.alternate,s.memoizedState!==null?M._visibility&2?po(i,s,c,p):Th(i,s):M._visibility&2?po(i,s,c,p):(M._visibility|=2,Mu(i,s,c,p,(s.subtreeFlags&10256)!==0)),v&2048&&mf(N,s);break;case 24:po(i,s,c,p),v&2048&&gf(s.alternate,s);break;default:po(i,s,c,p)}}function Mu(i,s,c,p,v){for(v=v&&(s.subtreeFlags&10256)!==0,s=s.child;s!==null;){var M=i,N=s,K=c,fe=p,Be=N.flags;switch(N.tag){case 0:case 11:case 15:Mu(M,N,K,fe,v),wh(8,N);break;case 23:break;case 22:var Ke=N.stateNode;N.memoizedState!==null?Ke._visibility&2?Mu(M,N,K,fe,v):Th(M,N):(Ke._visibility|=2,Mu(M,N,K,fe,v)),v&&Be&2048&&mf(N.alternate,N);break;case 24:Mu(M,N,K,fe,v),v&&Be&2048&&gf(N.alternate,N);break;default:Mu(M,N,K,fe,v)}s=s.sibling}}function Th(i,s){if(s.subtreeFlags&10256)for(s=s.child;s!==null;){var c=i,p=s,v=p.flags;switch(p.tag){case 22:Th(c,p),v&2048&&mf(p.alternate,p);break;case 24:Th(c,p),v&2048&&gf(p.alternate,p);break;default:Th(c,p)}s=s.sibling}}var Cu=8192;function Eu(i){if(i.subtreeFlags&Cu)for(i=i.child;i!==null;)_f(i),i=i.sibling}function _f(i){switch(i.tag){case 26:Eu(i),i.flags&Cu&&i.memoizedState!==null&&O(fs,i.memoizedState,i.memoizedProps);break;case 5:Eu(i);break;case 3:case 4:var s=fs;fs=Bu(i.stateNode.containerInfo),Eu(i),fs=s;break;case 22:i.memoizedState===null&&(s=i.alternate,s!==null&&s.memoizedState!==null?(s=Cu,Cu=16777216,Eu(i),Cu=s):Eu(i));break;default:Eu(i)}}function fp(i){var s=i.alternate;if(s!==null&&(i=s.child,i!==null)){s.child=null;do s=i.sibling,i.sibling=null,i=s;while(i!==null)}}function Nc(i){var s=i.deletions;if((i.flags&16)!==0){if(s!==null)for(var c=0;c<s.length;c++){var p=s[c];cn=p,pp(p,i)}fp(i)}if(i.subtreeFlags&10256)for(i=i.child;i!==null;)Au(i),i=i.sibling}function Au(i){switch(i.tag){case 0:case 11:case 15:Nc(i),i.flags&2048&&jl(9,i,i.return);break;case 3:Nc(i);break;case 12:Nc(i);break;case 22:var s=i.stateNode;i.memoizedState!==null&&s._visibility&2&&(i.return===null||i.return.tag!==13)?(s._visibility&=-3,Pu(i)):Nc(i);break;default:Nc(i)}}function Pu(i){var s=i.deletions;if((i.flags&16)!==0){if(s!==null)for(var c=0;c<s.length;c++){var p=s[c];cn=p,pp(p,i)}fp(i)}for(i=i.child;i!==null;){switch(s=i,s.tag){case 0:case 11:case 15:jl(8,s,s.return),Pu(s);break;case 22:c=s.stateNode,c._visibility&2&&(c._visibility&=-3,Pu(s));break;default:Pu(s)}i=i.sibling}}function pp(i,s){for(;cn!==null;){var c=cn;switch(c.tag){case 0:case 11:case 15:jl(8,c,s);break;case 23:case 22:if(c.memoizedState!==null&&c.memoizedState.cachePool!==null){var p=c.memoizedState.cachePool.pool;p!=null&&p.refCount++}break;case 24:Go(c.memoizedState.cache)}if(p=c.child,p!==null)p.return=c,cn=p;else e:for(c=i;cn!==null;){p=cn;var v=p.sibling,M=p.return;if(bd(p),p===c){cn=null;break e}if(v!==null){v.return=M,cn=v;break e}cn=M}}}var tm={getCacheForType:function(i){var s=Xi(Fr),c=s.data.get(i);return c===void 0&&(c=i(),s.data.set(i,c)),c}},mp=typeof WeakMap=="function"?WeakMap:Map,Vi=0,dr=null,bi=null,gi=0,Gi=0,$a=null,Fl=!1,zu=!1,yf=!1,tl=0,Br=0,mo=0,Ul=0,wd=0,Ha=0,ku=0,Vl=null,Ca=null,Sd=!1,xf=0,Td=1/0,Md=null,il=null,Vn=0,Gl=null,go=null,yr=0,Mh=0,Cd=null,vf=null,Fc=0,Zl=null;function Ea(){if((Vi&2)!==0&&gi!==0)return gi&-gi;if(Ve.T!==null){var i=$r;return i!==0?i:Ih()}return jr()}function gp(){Ha===0&&(Ha=(gi&536870912)===0||Ci?rt():536870912);var i=la.current;return i!==null&&(i.flags|=32),Ha}function Xa(i,s,c){(i===dr&&(Gi===2||Gi===9)||i.cancelPendingCommit!==null)&&(Iu(i,0),ql(i,gi,Ha,!1)),Me(i,c),((Vi&2)===0||i!==dr)&&(i===dr&&((Vi&2)===0&&(Ul|=c),Br===4&&ql(i,gi,Ha,!1)),Ya(i))}function _p(i,s,c){if((Vi&6)!==0)throw Error(I(327));var p=!c&&(s&124)===0&&(s&i.expiredLanes)===0||Te(i,s),v=p?$l(i,s):Ch(i,s,!0),M=p;do{if(v===0){zu&&!p&&ql(i,s,0,!1);break}else{if(c=i.current.alternate,M&&!im(c)){v=Ch(i,s,!1),M=!1;continue}if(v===2){if(M=s,i.errorRecoveryDisabledLanes&M)var N=0;else N=i.pendingLanes&-536870913,N=N!==0?N:N&536870912?536870912:0;if(N!==0){s=N;e:{var K=i;v=Vl;var fe=K.current.memoizedState.isDehydrated;if(fe&&(Iu(K,N).flags|=256),N=Ch(K,N,!1),N!==2){if(yf&&!fe){K.errorRecoveryDisabledLanes|=M,Ul|=M,v=4;break e}M=Ca,Ca=v,M!==null&&(Ca===null?Ca=M:Ca.push.apply(Ca,M))}v=N}if(M=!1,v!==2)continue}}if(v===1){Iu(i,0),ql(i,s,0,!0);break}e:{switch(p=i,M=v,M){case 0:case 1:throw Error(I(345));case 4:if((s&4194048)!==s)break;case 6:ql(p,s,Ha,!Fl);break e;case 2:Ca=null;break;case 3:case 5:break;default:throw Error(I(329))}if((s&62914560)===s&&(v=xf+300-Kr(),10<v)){if(ql(p,s,Ha,!Fl),Re(p,0,!0)!==0)break e;p.timeoutHandle=Lf(yp.bind(null,p,c,Ca,Md,Sd,s,Ha,Ul,ku,Fl,M,2,-0,0),v);break e}yp(p,c,Ca,Md,Sd,s,Ha,Ul,ku,Fl,M,0,-0,0)}}break}while(!0);Ya(i)}function yp(i,s,c,p,v,M,N,K,fe,Be,Ke,it,je,Ue){if(i.timeoutHandle=-1,it=s.subtreeFlags,(it&8192||(it&16785408)===16785408)&&(C={stylesheets:null,count:0,unsuspend:D},_f(s),it=F(),it!==null)){i.cancelPendingCommit=it(wf.bind(null,i,s,M,c,p,v,N,K,fe,Ke,1,je,Ue)),ql(i,M,N,!Be);return}wf(i,s,M,c,p,v,N,K,fe)}function im(i){for(var s=i;;){var c=s.tag;if((c===0||c===11||c===15)&&s.flags&16384&&(c=s.updateQueue,c!==null&&(c=c.stores,c!==null)))for(var p=0;p<c.length;p++){var v=c[p],M=v.getSnapshot;v=v.value;try{if(!Dn(M(),v))return!1}catch{return!1}}if(c=s.child,s.subtreeFlags&16384&&c!==null)c.return=s,s=c;else{if(s===i)break;for(;s.sibling===null;){if(s.return===null||s.return===i)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function ql(i,s,c,p){s&=~wd,s&=~Ul,i.suspendedLanes|=s,i.pingedLanes&=~s,p&&(i.warmLanes|=s),p=i.expirationTimes;for(var v=s;0<v;){var M=31-ye(v),N=1<<M;p[M]=-1,v&=~N}c!==0&&oi(i,c,s)}function Ed(){return(Vi&6)===0?(Gc(0),!1):!0}function bf(){if(bi!==null){if(Gi===0)var i=bi.return;else i=bi,_a=oa=null,ao(i),nr=null,_r=0,i=bi;for(;i!==null;)op(i.alternate,i),i=i.return;bi=null}}function Iu(i,s){var c=i.timeoutHandle;c!==-1&&(i.timeoutHandle=-1,Bp(c)),c=i.cancelPendingCommit,c!==null&&(i.cancelPendingCommit=null,c()),bf(),dr=i,bi=c=yn(i.current,null),gi=s,Gi=0,$a=null,Fl=!1,zu=Te(i,s),yf=!1,ku=Ha=wd=Ul=mo=Br=0,Ca=Vl=null,Sd=!1,(s&8)!==0&&(s|=s&32);var p=i.entangledLanes;if(p!==0)for(i=i.entanglements,p&=s;0<p;){var v=31-ye(p),M=1<<v;s|=i[v],p&=~M}return tl=s,Uo(),c}function xp(i,s){ci=null,Ve.H=ln,s===As||s===yt?(s=Cc(),Gi=3):s===xa?(s=Cc(),Gi=4):Gi=s===yh?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,$a=s,bi===null&&(Br=1,yu(i,Qr(s,i.current)))}function vp(){var i=Ve.H;return Ve.H=ln,i===null?ln:i}function bp(){var i=Ve.A;return Ve.A=tm,i}function Ad(){Br=4,Fl||(gi&4194048)!==gi&&la.current!==null||(zu=!0),(mo&134217727)===0&&(Ul&134217727)===0||dr===null||ql(dr,gi,Ha,!1)}function Ch(i,s,c){var p=Vi;Vi|=2;var v=vp(),M=bp();(dr!==i||gi!==s)&&(Md=null,Iu(i,s)),s=!1;var N=Br;e:do try{if(Gi!==0&&bi!==null){var K=bi,fe=$a;switch(Gi){case 8:bf(),N=6;break e;case 3:case 2:case 9:case 6:la.current===null&&(s=!0);var Be=Gi;if(Gi=0,$a=null,rl(i,K,fe,Be),c&&zu){N=0;break e}break;default:Be=Gi,Gi=0,$a=null,rl(i,K,fe,Be)}}wp(),N=Br;break}catch(Ke){xp(i,Ke)}while(!0);return s&&i.shellSuspendCounter++,_a=oa=null,Vi=p,Ve.H=v,Ve.A=M,bi===null&&(dr=null,gi=0,Uo()),N}function wp(){for(;bi!==null;)Uc(bi)}function $l(i,s){var c=Vi;Vi|=2;var p=vp(),v=bp();dr!==i||gi!==s?(Md=null,Td=Kr()+500,Iu(i,s)):zu=Te(i,s);e:do try{if(Gi!==0&&bi!==null){s=bi;var M=$a;t:switch(Gi){case 1:Gi=0,$a=null,rl(i,s,M,1);break;case 2:case 9:if(Mc(M)){Gi=0,$a=null,Ah(s);break}s=function(){Gi!==2&&Gi!==9||dr!==i||(Gi=7),Ya(i)},M.then(s,s);break e;case 3:Gi=7;break e;case 4:Gi=5;break e;case 7:Mc(M)?(Gi=0,$a=null,Ah(s)):(Gi=0,$a=null,rl(i,s,M,7));break;case 5:var N=null;switch(bi.tag){case 26:N=bi.memoizedState;case 5:case 27:var K=bi;if(!N||T(N)){Gi=0,$a=null;var fe=K.sibling;if(fe!==null)bi=fe;else{var Be=K.return;Be!==null?(bi=Be,Pd(Be)):bi=null}break t}}Gi=0,$a=null,rl(i,s,M,5);break;case 6:Gi=0,$a=null,rl(i,s,M,6);break;case 8:bf(),Br=6;break e;default:throw Error(I(462))}}Eh();break}catch(Ke){xp(i,Ke)}while(!0);return _a=oa=null,Ve.H=p,Ve.A=v,Vi=c,bi!==null?0:(dr=null,gi=0,Uo(),Br)}function Eh(){for(;bi!==null&&!Kn();)Uc(bi)}function Uc(i){var s=ap(i.alternate,i,tl);i.memoizedProps=i.pendingProps,s===null?Pd(i):bi=s}function Ah(i){var s=i,c=s.alternate;switch(s.tag){case 15:case 0:s=pd(c,s,s.pendingProps,s.type,void 0,gi);break;case 11:s=pd(c,s,s.pendingProps,s.type.render,s.ref,gi);break;case 5:ao(s);default:op(c,s),s=bi=lh(s,tl),s=ap(c,s,tl)}i.memoizedProps=i.pendingProps,s===null?Pd(i):bi=s}function rl(i,s,c,p){_a=oa=null,ao(s),nr=null,_r=0;var v=s.return;try{if(_h(i,v,s,c,gi)){Br=1,yu(i,Qr(c,i.current)),bi=null;return}}
vendor: 2,742 bytes, line 48
48catch(M){if(v!==null)throw bi=v,M;Br=1,yu(i,Qr(c,i.current)),bi=null;return}s.flags&32768?(Ci||p===1?i=!0:zu||(gi&536870912)!==0?i=!1:(Fl=i=!0,(p===2||p===9||p===3||p===6)&&(p=la.current,p!==null&&p.tag===13&&(p.flags|=16384))),Sp(s,i)):Pd(s)}function Pd(i){var s=i;do{if((s.flags&32768)!==0){Sp(s,Fl);return}i=s.return;var c=Dc(s.alternate,s,tl);if(c!==null){bi=c;return}if(s=s.sibling,s!==null){bi=s;return}bi=s=i}while(s!==null);Br===0&&(Br=5)}function Sp(i,s){do{var c=bh(i.alternate,i);if(c!==null){c.flags&=32767,bi=c;return}if(c=i.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!s&&(i=i.sibling,i!==null)){bi=i;return}bi=i=c}while(i!==null);Br=6,bi=null}function wf(i,s,c,p,v,M,N,K,fe){i.cancelPendingCommit=null;do Ru();while(Vn!==0);if((Vi&6)!==0)throw Error(I(327));if(s!==null){if(s===i.current)throw Error(I(177));if(M=s.lanes|s.childLanes,M|=Fo,Zt(i,c,M,N,K,fe),i===dr&&(bi=dr=null,gi=0),go=s,Gl=i,yr=c,Mh=M,Cd=v,vf=p,(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?(i.callbackNode=null,i.callbackPriority=0,Ep(Qn,function(){return zd(),null})):(i.callbackNode=null,i.callbackPriority=0),p=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||p){p=Ve.T,Ve.T=null,v=ht.p,ht.p=2,N=Vi,Vi|=4;try{up(i,s,c)}finally{Vi=N,ht.p=v,Ve.T=p}}Vn=1,Sf(),Tp(),Tf()}}function Sf(){if(Vn===1){Vn=0;var i=Gl,s=go,c=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||c){c=Ve.T,Ve.T=null;var p=ht.p;ht.p=2;var v=Vi;Vi|=4;try{Tu(s,i);var M=Od,N=ru(i.containerInfo),K=M.focusedElem,fe=M.selectionRange;if(N!==K&&K&&K.ownerDocument&&xi(K.ownerDocument.documentElement,K)){if(fe!==null&&dc(K)){var Be=fe.start,Ke=fe.end;if(Ke===void 0&&(Ke=Be),"selectionStart"in K)K.selectionStart=Be,K.selectionEnd=Math.min(Ke,K.value.length);else{var it=K.ownerDocument||document,je=it&&it.defaultView||window;if(je.getSelection){var Ue=je.getSelection(),Qt=K.textContent.length,Xt=Math.min(fe.start,Qt),Qi=fe.end===void 0?Xt:Math.min(fe.end,Qt);!Ue.extend&&Xt>Qi&&(N=Qi,Qi=Xt,Xt=N);var Pe=ls(K,Xt),Ee=ls(K,Qi);if(Pe&&Ee&&(Ue.rangeCount!==1||Ue.anchorNode!==Pe.node||Ue.anchorOffset!==Pe.offset||Ue.focusNode!==Ee.node||Ue.focusOffset!==Ee.offset)){var De=it.createRange();De.setStart(Pe.node,Pe.offset),Ue.removeAllRanges(),Xt>Qi?(Ue.addRange(De),Ue.extend(Ee.node,Ee.offset)):(De.setEnd(Ee.node,Ee.offset),Ue.addRange(De))}}}}for(it=[],Ue=K;Ue=Ue.parentNode;)Ue.nodeType===1&&it.push({element:Ue,left:Ue.scrollLeft,top:Ue.scrollTop});for(typeof K.focus=="function"&&K.focus(),K=0;K<it.length;K++){var Je=it[K];Je.element.scrollLeft=Je.left,Je.element.scrollTop=Je.top}}dt=!!Bd,Od=Bd=null}finally{Vi=v,ht.p=p,Ve.T=c}}i.current=s,Vn=2}}function Tp(){if(Vn===2){Vn=0;var i=Gl,s=go,c=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||c){c=Ve.T,Ve.T=null;
vendor: 16,419 bytes, lines 48-49
48var p=ht.p;ht.p=2;var v=Vi;Vi|=4;try{wu(i,s.alternate,s)}finally{Vi=v,ht.p=p,Ve.T=c}}Vn=3}}function Tf(){if(Vn===4||Vn===3){Vn=0,ha();var i=Gl,s=go,c=yr,p=vf;(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?Vn=5:(Vn=0,go=Gl=null,Mf(i,i.pendingLanes));var v=i.pendingLanes;if(v===0&&(il=null),Bi(c),s=s.stateNode,sr&&typeof sr.onCommitFiberRoot=="function")try{sr.onCommitFiberRoot(Ti,s,void 0,(s.current.flags&128)===128)}catch{}if(p!==null){s=Ve.T,v=ht.p,ht.p=2,Ve.T=null;try{for(var M=i.onRecoverableError,N=0;N<p.length;N++){var K=p[N];M(K.value,{componentStack:K.stack})}}finally{Ve.T=s,ht.p=v}}(yr&3)!==0&&Ru(),Ya(i),v=i.pendingLanes,(c&4194090)!==0&&(v&42)!==0?i===Zl?Fc++:(Fc=0,Zl=i):Fc=0,Gc(0)}}function Mf(i,s){(i.pooledCacheLanes&=s)===0&&(s=i.pooledCache,s!=null&&(i.pooledCache=null,Go(s)))}function Ru(i){return Sf(),Tp(),Tf(),zd()}function zd(){if(Vn!==5)return!1;var i=Gl,s=Mh;Mh=0;var c=Bi(yr),p=Ve.T,v=ht.p;try{ht.p=32>c?32:c,Ve.T=null,c=Cd,Cd=null;var M=Gl,N=yr;if(Vn=0,go=Gl=null,yr=0,(Vi&6)!==0)throw Error(I(331));var K=Vi;if(Vi|=4,Au(M.current),jc(M,M.current,N,c),Vi=K,Gc(0,!1),sr&&typeof sr.onPostCommitFiberRoot=="function")try{sr.onPostCommitFiberRoot(Ti,M)}catch{}return!0}finally{ht.p=v,Ve.T=p,Mf(i,s)}}function Mp(i,s,c){s=Qr(c,s),s=fd(i.stateNode,s,2),i=Ps(i,s,2),i!==null&&(Me(i,2),Ya(i))}function Ki(i,s,c){if(i.tag===3)Mp(i,i,c);else for(;s!==null;){if(s.tag===3){Mp(s,i,c);break}else if(s.tag===1){var p=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof p.componentDidCatch=="function"&&(il===null||!il.has(p))){i=Qr(c,i),c=kc(2),p=Ps(s,c,2),p!==null&&(Jf(c,p,s,i),Me(p,2),Ya(p));break}}s=s.return}}function Cf(i,s,c){var p=i.pingCache;if(p===null){p=i.pingCache=new mp;var v=new Set;p.set(s,v)}else v=p.get(s),v===void 0&&(v=new Set,p.set(s,v));v.has(c)||(yf=!0,v.add(c),i=rm.bind(null,i,s,c),s.then(i,i))}function rm(i,s,c){var p=i.pingCache;p!==null&&p.delete(s),i.pingedLanes|=i.suspendedLanes&c,i.warmLanes&=~c,dr===i&&(gi&c)===c&&(Br===4||Br===3&&(gi&62914560)===gi&&300>Kr()-xf?(Vi&2)===0&&Iu(i,0):wd|=c,ku===gi&&(ku=0)),Ya(i)}function Cp(i,s){s===0&&(s=Ye()),i=ia(i,s),i!==null&&(Me(i,s),Ya(i))}function nm(i){var s=i.memoizedState,c=0;s!==null&&(c=s.retryLane),Cp(i,c)}function am(i,s){var c=0;switch(i.tag){case 13:var p=i.stateNode,v=i.memoizedState;v!==null&&(c=v.retryLane);break;case 19:p=i.stateNode;break;case 22:p=i.stateNode._retryCache;break;default:throw Error(I(314))}p!==null&&p.delete(s),Cp(i,c)}function Ep(i,s){return qi(i,s)}var Ph=null,Aa=null,_o=!1,zh=!1,kh=!1,Vc=0;function Ya(i){i!==Aa&&i.next===null&&(Aa===null?Ph=Aa=i:Aa=Aa.next=i),zh=!0,_o||(_o=!0,Ap())}function Gc(i,s){if(!kh&&zh){kh=!0;do for(var c=!1,p=Ph;p!==null;){if(i!==0){var v=p.pendingLanes;if(v===0)var M=0;else{var N=p.suspendedLanes,K=p.pingedLanes;M=(1<<31-ye(42|i)+1)-1,M&=v&~(N&~K),M=M&201326741?M&201326741|1:M?M|2:0}M!==0&&(c=!0,Ef(p,M))}else M=gi,M=Re(p,p===dr?M:0,p.cancelPendingCommit!==null||p.timeoutHandle!==-1),(M&3)===0||Te(p,M)||(c=!0,Ef(p,M));p=p.next}while(c);kh=!1}}function sm(){kd()}function kd(){zh=_o=!1;var i=0;Vc!==0&&(Lp()&&(i=Vc),Vc=0);for(var s=Kr(),c=null,p=Ph;p!==null;){var v=p.next,M=Id(p,s);M===0?(p.next=null,c===null?Ph=v:c.next=v,v===null&&(Aa=c)):(c=p,(i!==0||(M&3)!==0)&&(zh=!0)),p=v}Gc(i)}function Id(i,s){for(var c=i.suspendedLanes,p=i.pingedLanes,v=i.expirationTimes,M=i.pendingLanes&-62914561;0<M;){var N=31-ye(M),K=1<<N,fe=v[N];fe===-1?((K&c)===0||(K&p)!==0)&&(v[N]=Ge(K,s)):fe<=s&&(i.expiredLanes|=K),M&=~K}if(s=dr,c=gi,c=Re(i,i===s?c:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),p=i.callbackNode,c===0||i===s&&(Gi===2||Gi===9)||i.cancelPendingCommit!==null)return p!==null&&p!==null&&$i(p),i.callbackNode=null,i.callbackPriority=0;if((c&3)===0||Te(i,c)){if(s=c&-c,s===i.callbackPriority)return s;switch(p!==null&&$i(p),Bi(c)){case 2:case 8:c=ms;break;case 32:c=Qn;break;case 268435456:c=Da;break;default:c=Qn}return p=Zc.bind(null,i),c=qi(c,p),i.callbackPriority=s,i.callbackNode=c,s}return p!==null&&p!==null&&$i(p),i.callbackPriority=2,i.callbackNode=null,2}function Zc(i,s){if(Vn!==0&&Vn!==5)return i.callbackNode=null,i.callbackPriority=0,null;var c=i.callbackNode;if(Ru()&&i.callbackNode!==c)return null;var p=gi;return p=Re(i,i===dr?p:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),p===0?null:(_p(i,p,s),Id(i,Kr()),i.callbackNode!=null&&i.callbackNode===c?Zc.bind(null,i):null)}function Ef(i,s){if(Ru())return null;_p(i,s,!0)}function Ap(){cm(function(){(Vi&6)!==0?qi(Wn,sm):kd()})}function Ih(){return Vc===0&&(Vc=rt()),Vc}function Af(i){return i==null||typeof i=="symbol"||typeof i=="boolean"?null:typeof i=="function"?i:ai(""+i)}function Rh(i,s){var c=s.ownerDocument.createElement("input");return c.name=s.name,c.value=s.value,i.id&&c.setAttribute("form",i.id),s.parentNode.insertBefore(c,s),i=new FormData(i),c.parentNode.removeChild(c),i}function Pp(i,s,c,p,v){if(s==="submit"&&c&&c.stateNode===v){var M=Af((v[qt]||null).action),N=p.submitter;N&&(s=(s=N[qt]||null)?Af(s.formAction):N.getAttribute("formAction"),s!==null&&(M=s,N=null));var K=new ea("action","action",null,p,v);i.push({event:K,listeners:[{instance:null,listener:function(){if(p.defaultPrevented){if(Vc!==0){var fe=N?Rh(v,N):new FormData(v);rr(c,{pending:!0,data:fe,method:v.method,action:M},null,fe)}}else typeof M=="function"&&(K.preventDefault(),fe=N?Rh(v,N):new FormData(v),rr(c,{pending:!0,data:fe,method:v.method,action:M},M,fe))},currentTarget:v}]})}}for(var Pf=0;Pf<au.length;Pf++){var zf=au[Pf],zp=zf.toLowerCase(),om=zf[0].toUpperCase()+zf.slice(1);ma(zp,"on"+om)}ma(fc,"onAnimationEnd"),ma(pc,"onAnimationIteration"),ma(mc,"onAnimationStart"),ma("dblclick","onDoubleClick"),ma("focusin","onFocus"),ma("focusout","onBlur"),ma(sh,"onTransitionRun"),ma(jo,"onTransitionStart"),ma(gc,"onTransitionCancel"),ma(No,"onTransitionEnd"),ys("onMouseEnter",["mouseout","mouseover"]),ys("onMouseLeave",["mouseout","mouseover"]),ys("onPointerEnter",["pointerout","pointerover"]),ys("onPointerLeave",["pointerout","pointerover"]),qn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),qn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),qn("onBeforeInput",["compositionend","keypress","textInput","paste"]),qn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),qn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),qn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Dh="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(" "),lm=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Dh));function kp(i,s){s=(s&4)!==0;for(var c=0;c<i.length;c++){var p=i[c],v=p.event;p=p.listeners;e:{var M=void 0;if(s)for(var N=p.length-1;0<=N;N--){var K=p[N],fe=K.instance,Be=K.currentTarget;if(K=K.listener,fe!==M&&v.isPropagationStopped())break e;M=K,v.currentTarget=Be;try{M(v)}catch(Ke){gh(Ke)}v.currentTarget=null,M=fe}else for(N=0;N<p.length;N++){if(K=p[N],fe=K.instance,Be=K.currentTarget,K=K.listener,fe!==M&&v.isPropagationStopped())break e;M=K,v.currentTarget=Be;try{M(v)}catch(Ke){gh(Ke)}v.currentTarget=null,M=fe}}}}function wi(i,s){var c=s[st];c===void 0&&(c=s[st]=new Set);var p=i+"__bubble";c.has(p)||(kf(s,i,2,!1),c.add(p))}function Lh(i,s,c){var p=0;s&&(p|=4),kf(c,i,p,s)}var Ns="_reactListening"+Math.random().toString(36).slice(2);function Rd(i){if(!i[Ns]){i[Ns]=!0,ti.forEach(function(c){c!=="selectionchange"&&(lm.has(c)||Lh(c,!1,i),Lh(c,!0,i))});var s=i.nodeType===9?i:i.ownerDocument;s===null||s[Ns]||(s[Ns]=!0,Lh("selectionchange",!1,s))}}function kf(i,s,c,p){switch(Rt(s)){case 2:var v=At;break;case 8:v=mt;break;default:v=ft}c=v.bind(null,s,c,i),v=void 0,!an||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(v=!0),p?v!==void 0?i.addEventListener(s,c,{capture:!0,passive:v}):i.addEventListener(s,c,!0):v!==void 0?i.addEventListener(s,c,{passive:v}):i.addEventListener(s,c,!1)}function Dd(i,s,c,p,v){var M=p;if((s&1)===0&&(s&2)===0&&p!==null)e:for(;;){if(p===null)return;var N=p.tag;if(N===3||N===4){var K=p.stateNode.containerInfo;if(K===v)break;if(N===4)for(N=p.return;N!==null;){var fe=N.tag;if((fe===3||fe===4)&&N.stateNode.containerInfo===v)return;N=N.return}for(;K!==null;){if(N=ei(K),N===null)return;if(fe=N.tag,fe===5||fe===6||fe===26||fe===27){p=M=N;continue e}K=K.parentNode}}p=p.return}Dr(function(){var Be=M,Ke=hl(c),it=[];e:{var je=ta.get(i);if(je!==void 0){var Ue=ea,Qt=i;switch(i){case"keypress":if($t(c)===0)break e;case"keydown":case"keyup":Ue=ac;break;case"focusin":Qt="focus",Ue=zo;break;case"focusout":Qt="blur",Ue=zo;break;case"beforeblur":case"afterblur":Ue=zo;break;case"click":if(c.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Ue=tc;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Ue=Wr;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Ue=Yd;break;case fc:case pc:case mc:Ue=vr;break;case No:Ue=Kd;break;case"scroll":case"scrollend":Ue=Yu;break;case"wheel":Ue=tu;break;case"copy":case"cut":case"paste":Ue=ic;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Ue=Wu;break;case"toggle":case"beforetoggle":Ue=Ro}var Xt=(s&4)!==0,Qi=!Xt&&(i==="scroll"||i==="scrollend"),Pe=Xt?je!==null?je+"Capture":null:je;Xt=[];for(var Ee=Be,De;Ee!==null;){var Je=Ee;if(De=Je.stateNode,Je=Je.tag,Je!==5&&Je!==26&&Je!==27||De===null||Pe===null||(Je=Mi(Ee,Pe),Je!=null&&Xt.push(Du(Ee,Je,De))),Qi)break;Ee=Ee.return}0<Xt.length&&(je=new Ue(je,Qt,null,c,Ke),it.push({event:je,listeners:Xt}))}}if((s&7)===0){e:{if(je=i==="mouseover"||i==="pointerover",Ue=i==="mouseout"||i==="pointerout",je&&c!==vs&&(Qt=c.relatedTarget||c.fromElement)&&(ei(Qt)||Qt[er]))break e;if((Ue||je)&&(je=Ke.window===Ke?Ke:(je=Ke.ownerDocument)?je.defaultView||je.parentWindow:window,Ue?(Qt=c.relatedTarget||c.toElement,Ue=Be,Qt=Qt?ei(Qt):null,Qt!==null&&(Qi=X(Qt),Xt=Qt.tag,Qt!==Qi||Xt!==5&&Xt!==27&&Xt!==6)&&(Qt=null)):(Ue=null,Qt=Be),Ue!==Qt)){if(Xt=tc,Je="onMouseLeave",Pe="onMouseEnter",Ee="mouse",(i==="pointerout"||i==="pointerover")&&(Xt=Wu,Je="onPointerLeave",Pe="onPointerEnter",Ee="pointer"),Qi=Ue==null?je:Rr(Ue),De=Qt==null?je:Rr(Qt),je=new Xt(Je,Ee+"leave",Ue,c,Ke),je.target=Qi,je.relatedTarget=De,Je=null,ei(Ke)===Be&&(Xt=new Xt(Pe,Ee+"enter",Qt,c,Ke),Xt.target=De,Xt.relatedTarget=Qi,Je=Xt),Qi=Je,Ue&&Qt)t:{for(Xt=Ue,Pe=Qt,Ee=0,De=Xt;De;De=Hl(De))Ee++;for(De=0,Je=Pe;Je;Je=Hl(Je))De++;for(;0<Ee-De;)Xt=Hl(Xt),Ee--;for(;0<De-Ee;)Pe=Hl(Pe),De--;for(;Ee--;){if(Xt===Pe||Pe!==null&&Xt===Pe.alternate)break t;Xt=Hl(Xt),Pe=Hl(Pe)}Xt=null}else Xt=null;Ue!==null&&If(it,je,Ue,Xt,!1),Qt!==null&&Qi!==null&&If(it,Qi,Qt,Xt,!0)}}e:{if(je=Be?Rr(Be):window,Ue=je.nodeName&&je.nodeName.toLowerCase(),Ue==="select"||Ue==="input"&&je.type==="file")var Dt=rh;else if(ed(je))if(Hs)Dt=nd;else{Dt=Jd;var _i=id}else Ue=je.nodeName,!Ue||Ue.toLowerCase()!=="input"||je.type!=="checkbox"&&je.type!=="radio"?Be&&ns(Be.elementType)&&(Dt=rh):Dt=rd;if(Dt&&(Dt=Dt(i,Be))){ih(it,Dt,c,Ke);break e}_i&&_i(i,je,Be),i==="focusout"&&Be&&je.type==="number"&&Be.memoizedProps.value!=null&&ec(je,"number",je.value)}switch(_i=Be?Rr(Be):window,i){case"focusin":(ed(_i)||_i.contentEditable==="true")&&(Xs=_i,ws=Be,Bo=null);break;case"focusout":Bo=ws=Xs=null;break;case"mousedown":ah=!0;break;case"contextmenu":case"mouseup":case"dragend":ah=!1,sd(it,c,Ke);break;case"selectionchange":if(ad)break;case"keydown":case"keyup":sd(it,c,Ke)}var Pt;if(pl)e:{switch(i){case"compositionstart":var Vt="onCompositionStart";break e;case"compositionend":Vt="onCompositionEnd";break e;case"compositionupdate":Vt="onCompositionUpdate";break e}Vt=void 0}else _l?Qh(i,c)&&(Vt="onCompositionEnd"):i==="keydown"&&c.keyCode===229&&(Vt="onCompositionStart");Vt&&(sc&&c.locale!=="ko"&&(_l||Vt!=="onCompositionStart"?Vt==="onCompositionEnd"&&_l&&(Pt=jt()):(gr=Ke,Ui="value"in gr?gr.value:gr.textContent,_l=!0)),_i=Bh(Be,Vt),0<_i.length&&(Vt=new Wh(Vt,i,null,c,Ke),it.push({event:Vt,listeners:_i}),Pt?Vt.data=Pt:(Pt=oc(c),Pt!==null&&(Vt.data=Pt)))),(Pt=Qd?Do(i,c):Jh(i,c))&&(Vt=Bh(Be,"onBeforeInput"),0<Vt.length&&(_i=new Wh("onBeforeInput","beforeinput",null,c,Ke),it.push({event:_i,listeners:Vt}),_i.data=Pt)),Pp(it,i,Be,c,Ke)}kp(it,s)})}function Du(i,s,c){return{instance:i,listener:s,currentTarget:c}}function Bh(i,s){for(var c=s+"Capture",p=[];i!==null;){var v=i,M=v.stateNode;if(v=v.tag,v!==5&&v!==26&&v!==27||M===null||(v=Mi(i,c),v!=null&&p.unshift(Du(i,v,M)),v=Mi(i,s),v!=null&&p.push(Du(i,v,M))),i.tag===3)return p;i=i.return}return[]}function Hl(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5&&i.tag!==27);return i||null}function If(i,s,c,p,v){for(var M=s._reactName,N=[];c!==null&&c!==p;){var K=c,fe=K.alternate,Be=K.stateNode;if(K=K.tag,fe!==null&&fe===p)break;K!==5&&K!==26&&K!==27||Be===null||(fe=Be,v?(Be=Mi(c,M),Be!=null&&N.unshift(Du(c,Be,fe))):v||(Be=Mi(c,M),Be!=null&&N.push(Du(c,Be,fe)))),c=c.return}N.length!==0&&i.push({event:s,listeners:N})}var Oh=/\r\n?/g,Ip=/\u0000|\uFFFD/g;function Ld(i){return(typeof i=="string"?i:""+i).replace(Oh,`
49`).replace(Ip,"")}function Rf(i,s){return s=Ld(s),Ld(i)===s}function Yn(){}function zi(i,s,c,p,v,M){switch(c){case"children":typeof p=="string"?s==="body"||s==="textarea"&&p===""||rs(i,p):(typeof p=="number"||typeof p=="bigint")&&s!=="body"&&rs(i,""+p);break;case"className":Ei(i,"class",p);break;case"tabIndex":Ei(i,"tabindex",p);break;case"dir":case"role":case"viewBox":case"width":case"height":Ei(i,c,p);break;case"style":Gs(i,p,M);break;case"data":if(s!=="object"){Ei(i,"data",p);break}case"src":case"href":if(p===""&&(s!=="a"||c!=="href")){i.removeAttribute(c);break}if(p==null||typeof p=="function"||typeof p=="symbol"||typeof p=="boolean"){i.removeAttribute(c);break}p=ai(""+p),i.setAttribute(c,p);break;case"action":case"formAction":if(typeof p=="function"){i.setAttribute(c,"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}else typeof M=="function"&&(c==="formAction"?(s!=="input"&&zi(i,s,"name",v.name,v,null),zi(i,s,"formEncType",v.formEncType,v,null),zi(i,s,"formMethod",v.formMethod,v,null),zi(i,s,"formTarget",v.formTarget,v,null)):(zi(i,s,"encType",v.encType,v,null),zi(i,s,"method",v.method,v,null),zi(i,s,"target",v.target,v,null)));if(p==null||typeof p=="symbol"||typeof p=="boolean"){i.removeAttribute(c);break}p=ai(""+p),i.setAttribute(c,p);break;case"onClick":p!=null&&(i.onclick=Yn);break;case"onScroll":p!=null&&wi("scroll",i);break;case"onScrollEnd":p!=null&&wi("scrollend",i);break;case"dangerouslySetInnerHTML":if(p!=null){if(typeof p!="object"||!("__html"in p))throw Error(I(61));if(c=p.__html,c!=null){if(v.children!=null)throw Error(I(60));i.innerHTML=c}}break;case"multiple":i.multiple=p&&typeof p!="function"&&typeof p!="symbol";break;case"muted":i.muted=p&&typeof p!="function"&&typeof p!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(p==null||typeof p=="function"||typeof p=="boolean"||typeof p=="symbol"){i.removeAttribute("xlink:href");break}c=ai(""+p),i.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",c);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":p!=null&&typeof p!="function"&&typeof p!="symbol"?i.setAttribute(c,""+p):i.removeAttribute(c);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"playsInl
49ine":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":p&&typeof p!="function"&&typeof p!="symbol"?i.setAttribute(c,""):i.removeAttribute(c);break;case"capture":case"download":p===!0?i.setAttribute(c,""):p!==!1&&p!=null&&typeof p!="function"&&typeof p!="symbol"?i.setAttribute(c,p):i.removeAttribute(c);break;case"cols":case"rows":case"size":case"span":p!=null&&typeof p!="function"&&typeof p!="symbol"&&!isNaN(p)&&1<=p?i.setAttribute(c,p):i.removeAttribute(c);break;case"rowSpan":case"start":p==null||typeof p=="function"||typeof p=="symbol"||isNaN(p)?i.removeAttribute(c):i.setAttribute(c,p);break;case"popover":wi("beforetoggle",i),wi("toggle",i),tn(i,"popover",p);break;case"xlinkActuate":ts(i,"http://www.w3.org/1999/xlink","xlink:actuate",p);break;case"xlinkArcrole":ts(i,"http://www.w3.org/1999/xlink","xlink:arcrole",p);break;case"xlinkRole":ts(i,"http://www.w3.org/1999/xlink","xlink:role",p);break;case"xlinkShow":ts(i,"http://www.w3.org/1999/xlink","xlink:show",p);break;case"xlinkTitle":ts(i,"http://www.w3.org/1999/xlink","xlink:title",p);break;case"xlinkType":ts(i,"http://www.w3.org/1999/xlink","xlink:type",p);break;case"xmlBase":ts(i,"http://www.w3.org/XML/1998/namespace","xml:base",p);break;case"xmlLang":ts(i,"http://www.w3.org/XML/1998/namespace","xml:lang",p);break;case"xmlSpace":ts(i,"http://www.w3.org/XML/1998/namespace","xml:space",p);break;case"is":tn(i,"is",p);break;case"innerText":case"textContent":break;default:(!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(c=xs.get(c)||c,tn(i,c,p))}}function qc(i,s,c,p,v,M){switch(c){case"style":Gs(i,p,M);break;case"dangerouslySetInnerHTML":if(p!=null){if(typeof p!="object"||!("__html"in p))throw Error(I(61));if(c=p.__html,c!=null){if(v.children!=null)throw Error(I(60));i.innerHTML=c}}break;case"children":typeof p=="string"?rs(i,p):(typeof p=="number"||typeof p=="bigint")&&rs(i,""+p);break;case"onScroll":p!=null&&wi("scroll",i);break;case"onScrollEnd":p!=null&&wi("scrollend",i);break;case"onClick":p!=null&&(i.onclick=Yn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Wl.hasOwnProperty(c))e:{if(c[0]==="o"&&c[1]==="n"&&(v=c.endsWith("Capture"),s=c.slice(2,v?c.length-7:void 0),M=i[qt]||null,M=M!=null?M[c]:null,typeof M=="function"&&i.removeEventListener(s,M,v),typeof p=="function")){typeof M!="function"&&M!==null&&(c in i?i[c]=null:i.hasAttribute(c)&&i.removeAttribute(c)),i.addEventListener(s,p,v);break e}c in i?i[c]=p:p===!0?i.setAttribute(c,""):tn(i,c,p)}}}function Or(i,s,c){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":wi("error",i),wi("load",i);var p=!1,v=!1,M;for(M in c)if(c.hasOwnProperty(M)){var N=c[M];if(N!=null)switch(M){case"src":p=!0;break;case"srcSet":v=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(I(137,s));default:zi(i,s,M,N,c,null)}}v&&zi(i,s,"srcSet",c.srcSet,c,null),p&&zi(i,s,"src",c.src,c,null);return;case"input":wi("invalid",i);var K=M=N=v=null,fe=null,Be=null;for(p in c)if(c.hasOwnProperty(p)){var Ke=c[p];if(Ke!=null)switch(p){case"name":v=Ke;break;case"type":N=Ke;break;case"checked":fe=Ke;break;case"defaultChecked":Be=Ke;break;case"value":M=Ke;break;case"defaultValue":K=Ke;break;case"children":case"dangerouslySetInnerHTML":if(Ke!=null)throw Error(I(137,s));break;default:zi(i,s,p,Ke,c,null)}}Mo(i,M,K,fe,Be,N,v,!1),Jc(i);return;case"select":wi("invalid",i),p=N=M=null;for(v in c)if(c.hasOwnProperty(v)&&(K=c[v],K!=null))switch(v){case"value":M=K;break;case"defaultValue":N=K;break;case"multiple":p=K;default:zi(i,s,v,K,c,null)}s=M,c=N,i.multiple=!!p,s!=null?Vs(i,!!p,s,!1):c!=null&&Vs(i,!!p,c,!0);return;case"textarea":wi("invalid",i),M=v=p=null;for(N in c)if(c.hasOwnProperty(N)&&(K=c[N],K!=null))switch(N){case"value":p=K;break;case"defaultValue":v=K;break;case"children":M=K;break;case"dangerouslySetInnerHTML":if(K!=null)throw Error(I(91));break;default:zi(i,s,N,K,c,null)}Co(i,p,v,M),Jc(i);return;case"option":for(fe in c)if(c.hasOwnProperty(fe)&&(p=c[fe],p!=null))switch(fe){case"selected":i.selected=p&&typeof p!="function"&&typeof p!="symbol";break;default:zi(i,s,fe,p,c,null)}return;case"dialog":wi("beforetoggle",i),wi("toggle",i),wi("cancel",i),wi("close",i);break;case"iframe":case"object":wi("load",i);break;case"video":case"audio":for(p=0;p<Dh.length;p++)wi(Dh[p],i);break;case"image":wi("error",i),wi("load",i);break;case"details":wi("toggle",i);break;case"embed":case"source":case"link":wi("error",i),wi("load",i);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(Be in c)if(c.hasOwnProperty(Be)&&(p=c[Be],p!=null))switch(Be){case"children":case"dangerouslySetInnerHTML":throw Error(I(137,s));default:zi(i,s,Be,p,c,null)}return;default:if(ns(s)){for(Ke in c)c.hasOwnProperty(Ke)&&(p=c[Ke],p!==void 0&&qc(i,s,Ke,p,c,void 0));return}}for(K in c)c.hasOwnProperty(K)&&(p=c[K],p!=null&&zi(i,s,K,p,c,null))}function Rp(i,s,c,p){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var v=null,M=null,N=null,K=null,fe=null,Be=null,Ke=null;for(Ue in c){var it=c[Ue];if(c.hasOwnProperty(Ue)&&it!=null)switch(Ue){case"checked":break;case"value":break;case"defaultValue":fe=it;default:p.hasOwnProperty(Ue)||zi(i,s,Ue,null,p,it)}}for(var je in p){var Ue=p[je];if(it=c[je],p.hasOwnProperty(je)&&(Ue!=null||it!=null))switch(je){case"type":M=Ue;break;case"name":v=Ue;break;case"checked":Be=Ue;break;case"defaultChecked":Ke=Ue;break;case"value":N=Ue;break;case"defaultValue":K=Ue;break;case"children":case"dangerouslySetInnerHTML":if(Ue!=null)throw Error(I(137,s));break;default:Ue!==it&&zi(i,s,je,Ue,p,it)}}Jl(i,N,K,fe,Be,Ke,M,v);return;case"select":Ue=N=K=je=null;for(M in c)if(fe=c[M],c.hasOwnProperty(M)&&fe!=null)switch(M){case"value":break;case"multiple":Ue=fe;default:p.hasOwnProperty(M)||zi(i,s,M,null,p,fe)}for(v in p)if(M=p[v],fe=c[v],p.hasOwnProperty(v)&&(M!=null||fe!=null))switch(v){case"value":je=M;break;case"defaultValue":K=M;break;case"multiple":N=M;default:M!==fe&&zi(i,s,v,M,p,fe)}s=K,c=N,p=Ue,je!=null?Vs(i,!!c,je,!1):!!p!=!!c&&(s!=null?Vs(i,!!c,s,!0):Vs(i,!!c,c?[]:"",!1));return;case"textarea":Ue=je=null;for(K in c)if(v=c[K],c.hasOwnProperty(K)&&v!=null&&!p.hasOwnProperty(K))switch(K){case"value":break;case"children":break;default:zi(i,s,K,null,p,v)}for(N in p)if(v=p[N],M=c[N],p.hasOwnProperty(N)&&(v!=null||M!=null))switch(N){case"value":je=v;break;case"defaultValue":Ue=v;break;case"children":break;case"dangerouslySetInnerHTML":if(v!=null)throw Error(I(91));break;default:v!==M&&zi(i,s,N,v,p,M)}Yh(i,je,Ue);return;case"option":for(var Qt in c)if(je=c[Qt],c.hasOwnProperty(Qt)&&je!=null&&!p.hasOwnProperty(Qt))switch(Qt){case"selected":i.selected=!1;break;
vendor: 18,241 bytes, line 49
49default:zi(i,s,Qt,null,p,je)}for(fe in p)if(je=p[fe],Ue=c[fe],p.hasOwnProperty(fe)&&je!==Ue&&(je!=null||Ue!=null))switch(fe){case"selected":i.selected=je&&typeof je!="function"&&typeof je!="symbol";break;default:zi(i,s,fe,je,p,Ue)}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 Xt in c)je=c[Xt],c.hasOwnProperty(Xt)&&je!=null&&!p.hasOwnProperty(Xt)&&zi(i,s,Xt,null,p,je);for(Be in p)if(je=p[Be],Ue=c[Be],p.hasOwnProperty(Be)&&je!==Ue&&(je!=null||Ue!=null))switch(Be){case"children":case"dangerouslySetInnerHTML":if(je!=null)throw Error(I(137,s));break;default:zi(i,s,Be,je,p,Ue)}return;default:if(ns(s)){for(var Qi in c)je=c[Qi],c.hasOwnProperty(Qi)&&je!==void 0&&!p.hasOwnProperty(Qi)&&qc(i,s,Qi,void 0,p,je);for(Ke in p)je=p[Ke],Ue=c[Ke],!p.hasOwnProperty(Ke)||je===Ue||je===void 0&&Ue===void 0||qc(i,s,Ke,je,p,Ue);return}}for(var Pe in c)je=c[Pe],c.hasOwnProperty(Pe)&&je!=null&&!p.hasOwnProperty(Pe)&&zi(i,s,Pe,null,p,je);for(it in p)je=p[it],Ue=c[it],!p.hasOwnProperty(it)||je===Ue||je==null&&Ue==null||zi(i,s,it,je,p,Ue)}var Bd=null,Od=null;function jh(i){return i.nodeType===9?i:i.ownerDocument}function Dp(i){switch(i){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Df(i,s){if(i===0)switch(s){case"svg":return 1;case"math":return 2;default:return 0}return i===1&&s==="foreignObject"?0:i}function yo(i,s){return i==="textarea"||i==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.children=="bigint"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var jd=null;function Lp(){var i=window.event;return i&&i.type==="popstate"?i===jd?!1:(jd=i,!0):(jd=null,!1)}var Lf=typeof setTimeout=="function"?setTimeout:void 0,Bp=typeof clearTimeout=="function"?clearTimeout:void 0,Op=typeof Promise=="function"?Promise:void 0,cm=typeof queueMicrotask=="function"?queueMicrotask:typeof Op<"u"?function(i){return Op.resolve(null).then(i).catch(jp)}:Lf;function jp(i){setTimeout(function(){throw i})}function nl(i){return i==="head"}function Nh(i,s){var c=s,p=0,v=0;do{var M=c.nextSibling;if(i.removeChild(c),M&&M.nodeType===8)if(c=M.data,c==="/$"){if(0<p&&8>p){c=p;var N=i.ownerDocument;if(c&1&&Hc(N.documentElement),c&2&&Hc(N.body),c&4)for(c=N.head,Hc(c),N=c.firstChild;N;){var K=N.nextSibling,fe=N.nodeName;N[Ja]||fe==="SCRIPT"||fe==="STYLE"||fe==="LINK"&&N.rel.toLowerCase()==="stylesheet"||c.removeChild(N),N=K}}if(v===0){i.removeChild(M),Pr(s);return}v--}else c==="$"||c==="$?"||c==="$!"?v++:p=c.charCodeAt(0)-48;else p=0;c=M}while(c);Pr(s)}function Nd(i){var s=i.firstChild;for(s&&s.nodeType===10&&(s=s.nextSibling);s;){var c=s;switch(s=s.nextSibling,c.nodeName){case"HTML":case"HEAD":case"BODY":Nd(c),gt(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}i.removeChild(c)}}function Fd(i,s,c,p){for(;i.nodeType===1;){var v=c;if(i.nodeName.toLowerCase()!==s.toLowerCase()){if(!p&&(i.nodeName!=="INPUT"||i.type!=="hidden"))break}else if(p){if(!i[Ja])switch(s){case"meta":if(!i.hasAttribute("itemprop"))break;return i;case"link":if(M=i.getAttribute("rel"),M==="stylesheet"&&i.hasAttribute("data-precedence"))break;if(M!==v.rel||i.getAttribute("href")!==(v.href==null||v.href===""?null:v.href)||i.getAttribute("crossorigin")!==(v.crossOrigin==null?null:v.crossOrigin)||i.getAttribute("title")!==(v.title==null?null:v.title))break;return i;case"style":if(i.hasAttribute("data-precedence"))break;return i;case"script":if(M=i.getAttribute("src"),(M!==(v.src==null?null:v.src)||i.getAttribute("type")!==(v.type==null?null:v.type)||i.getAttribute("crossorigin")!==(v.crossOrigin==null?null:v.crossOrigin))&&M&&i.hasAttribute("async")&&!i.hasAttribute("itemprop"))break;return i;default:return i}}else if(s==="input"&&i.type==="hidden"){var M=v.name==null?null:""+v.name;if(v.type==="hidden"&&i.getAttribute("name")===M)return i}else return i;if(i=Fs(i.nextSibling),i===null)break}return null}function Ud(i,s,c){if(s==="")return null;for(;i.nodeType!==3;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!c||(i=Fs(i.nextSibling),i===null))return null;return i}function Lu(i){return i.data==="$!"||i.data==="$?"&&i.ownerDocument.readyState==="complete"}function um(i,s){var c=i.ownerDocument;if(i.data!=="$?"||c.readyState==="complete")s();else{var p=function(){s(),c.removeEventListener("DOMContentLoaded",p)};c.addEventListener("DOMContentLoaded",p),i._reactRetry=p}}function Fs(i){for(;i!=null;i=i.nextSibling){var s=i.nodeType;if(s===1||s===3)break;if(s===8){if(s=i.data,s==="$"||s==="$!"||s==="$?"||s==="F!"||s==="F")break;if(s==="/$")return null}}return i}var Bf=null;function $c(i){i=i.previousSibling;for(var s=0;i;){if(i.nodeType===8){var c=i.data;if(c==="$"||c==="$!"||c==="$?"){if(s===0)return i;s--}else c==="/$"&&s++}i=i.previousSibling}return null}function un(i,s,c){switch(s=jh(c),i){case"html":if(i=s.documentElement,!i)throw Error(I(452));return i;case"head":if(i=s.head,!i)throw Error(I(453));return i;case"body":if(i=s.body,!i)throw Error(I(454));return i;default:throw Error(I(451))}}function Hc(i){for(var s=i.attributes;s.length;)i.removeAttributeNode(s[0]);gt(i)}var Ka=new Map,Of=new Set;function Bu(i){return typeof i.getRootNode=="function"?i.getRootNode():i.nodeType===9?i:i.ownerDocument}var al=ht.d;ht.d={f:Np,r:Fp,D:Nf,C:Ff,L:Up,m:Fh,X:Vp,S:Uf,M:Vf};function Np(){var i=al.f(),s=Ed();return i||s}function Fp(i){var s=Ht(i);s!==null&&s.tag===5&&s.type==="form"?Ri(s):al.r(i)}var Ou=typeof document>"u"?null:document;function jf(i,s,c){var p=Ou;if(p&&typeof s=="string"&&s){var v=$n(s);v='link[rel="'+i+'"][href="'+v+'"]',typeof c=="string"&&(v+='[crossorigin="'+c+'"]'),Of.has(v)||(Of.add(v),i={rel:i,crossOrigin:c,href:s},p.querySelector(v)===null&&(s=p.createElement("link"),Or(s,"link",i),tr(s),p.head.appendChild(s)))}}function Nf(i){al.D(i),jf("dns-prefetch",i,null)}function Ff(i,s){al.C(i,s),jf("preconnect",i,s)}function Up(i,s,c){al.L(i,s,c);var p=Ou;if(p&&i&&s){var v='link[rel="preload"][as="'+$n(s)+'"]';s==="image"&&c&&c.imageSrcSet?(v+='[imagesrcset="'+$n(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(v+='[imagesizes="'+$n(c.imageSizes)+'"]')):v+='[href="'+$n(i)+'"]';var M=v;switch(s){case"style":M=xo(i);break;case"script":M=ju(i)}Ka.has(M)||(i=se({rel:"preload",href:s==="image"&&c&&c.imageSrcSet?void 0:i,as:s},c),Ka.set(M,i),p.querySelector(v)!==null||s==="style"&&p.querySelector(Xc(M))||s==="script"&&p.querySelector(n(M))||(s=p.createElement("link"),Or(s,"link",i),tr(s),p.head.appendChild(s)))}}function Fh(i,s){al.m(i,s);var c=Ou;if(c&&i){var p=s&&typeof s.as=="string"?s.as:"script",v='link[rel="modulepreload"][as="'+$n(p)+'"][href="'+$n(i)+'"]',M=v;switch(p){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":M=ju(i)}if(!Ka.has(M)&&(i=se({rel:"modulepreload",href:i},s),Ka.set(M,i),c.querySelector(v)===null)){switch(p){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(n(M)))return}p=c.createElement("link"),Or(p,"link",i),tr(p),c.head.appendChild(p)}}}function Uf(i,s,c){al.S(i,s,c);var p=Ou;if(p&&i){var v=fa(p).hoistableStyles,M=xo(i);s=s||"default";var N=v.get(M);if(!N){var K={loading:0,preload:null};if(N=p.querySelector(Xc(M)))K.loading=5;else{i=se({rel:"stylesheet",href:i,"data-precedence":s},c),(c=Ka.get(M))&&o(i,c);var fe=N=p.createElement("link");tr(fe),Or(fe,"link",i),fe._p=new Promise(function(Be,Ke){fe.onload=Be,fe.onerror=Ke}),fe.addEventListener("load",function(){K.loading|=1}),fe.addEventListener("error",function(){K.loading|=2}),K.loading|=4,r(N,s,p)}N={type:"stylesheet",instance:N,count:1,state:K},v.set(M,N)}}}function Vp(i,s){al.X(i,s);var c=Ou;if(c&&i){var p=fa(c).hoistableScripts,v=ju(i),M=p.get(v);M||(M=c.querySelector(n(v)),M||(i=se({src:i,async:!0},s),(s=Ka.get(v))&&h(i,s),M=c.createElement("script"),tr(M),Or(M,"link",i),c.head.appendChild(M)),M={type:"script",instance:M,count:1,state:null},p.set(v,M))}}function Vf(i,s){al.M(i,s);var c=Ou;if(c&&i){var p=fa(c).hoistableScripts,v=ju(i),M=p.get(v);M||(M=c.querySelector(n(v)),M||(i=se({src:i,async:!0,type:"module"},s),(s=Ka.get(v))&&h(i,s),M=c.createElement("script"),tr(M),Or(M,"link",i),c.head.appendChild(M)),M={type:"script",instance:M,count:1,state:null},p.set(v,M))}}function Uh(i,s,c,p){var v=(v=zt.current)?Bu(v):null;if(!v)throw Error(I(446));switch(i){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(s=xo(c.href),c=fa(v).hoistableStyles,p=c.get(s),p||(p={type:"style",instance:null,count:0,state:null},c.set(s,p)),p):{type:"void",instance:null,count:0,state:null};case"link":if(c.rel==="stylesheet"&&typeof c.href=="string"&&typeof c.precedence=="string"){i=xo(c.href);var M=fa(v).hoistableStyles,N=M.get(i);if(N||(v=v.ownerDocument||v,N={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},M.set(i,N),(M=v.querySelector(Xc(i)))&&!M._p&&(N.instance=M,N.state.loading=5),Ka.has(i)||(c={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},Ka.set(i,c),M||Gf(v,i,c,N.state))),s&&p===null)throw Error(I(528,""));return N}if(s&&p!==null)throw Error(I(529,""));return null;case"script":return s=c.async,c=c.src,typeof c=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(s=ju(c),c=fa(v).hoistableScripts,p=c.get(s),p||(p={type:"script",instance:null,count:0,state:null},c.set(s,p)),p):{type:"void",instance:null,count:0,state:null};default:throw Error(I(444,i))}}function xo(i){return'href="'+$n(i)+'"'}function Xc(i){return'link[rel="stylesheet"]['+i+"]"}function Vd(i){return se({},i,{"data-precedence":i.precedence,precedence:null})}function Gf(i,s,c,p){i.querySelector('link[rel="preload"][as="style"]['+s+"]")?p.loading=1:(s=i.createElement("link"),p.preload=s,s.addEventListener("load",function(){return p.loading|=1}),s.addEventListener("error",function(){return p.loading|=2}),Or(s,"link",c),tr(s),i.head.appendChild(s))}function ju(i){return'[src="'+$n(i)+'"]'}function n(i){return"script[async]"+i}function t(i,s,c){if(s.count++,s.instance===null)switch(s.type){case"style":var p=i.querySelector('style[data-href~="'+$n(c.href)+'"]');if(p)return s.instance=p,tr(p),p;var v=se({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return p=(i.ownerDocument||i).createElement("style"),tr(p),Or(p,"style",v),r(p,c.precedence,i),s.instance=p;case"stylesheet":v=xo(c.href);var M=i.querySelector(Xc(v));if(M)return s.state.loading|=4,s.instance=M,tr(M),M;p=Vd(c),(v=Ka.get(v))&&o(p,v),M=(i.ownerDocument||i).createElement("link"),tr(M);var N=M;return N._p=new Promise(function(K,fe){N.onload=K,N.onerror=fe}),Or(M,"link",p),s.state.loading|=4,r(M,c.precedence,i),s.instance=M;case"script":return M=ju(c.src),(v=i.querySelector(n(M)))?(s.instance=v,tr(v),v):(p=c,(v=Ka.get(M))&&(p=se({},c),h(p,v)),i=i.ownerDocument||i,v=i.createElement("script"),tr(v),Or(v,"link",p),i.head.appendChild(v),s.instance=v);case"void":return null;default:throw Error(I(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(p=s.instance,s.state.loading|=4,r(p,c.precedence,i));return s.instance}function r(i,s,c){for(var p=c.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),v=p.length?p[p.length-1]:null,M=v,N=0;N<p.length;N++){var K=p[N];if(K.dataset.precedence===s)M=K;else if(M!==v)break}M?M.parentNode.insertBefore(i,M.nextSibling):(s=c.nodeType===9?c.head:c,s.insertBefore(i,s.firstChild))}function o(i,s){i.crossOrigin==null&&(i.crossOrigin=s.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=s.referrerPolicy),i.title==null&&(i.title=s.title)}function h(i,s){i.crossOrigin==null&&(i.crossOrigin=s.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=s.referrerPolicy),i.integrity==null&&(i.integrity=s.integrity)}var g=null;function _(i,s,c){if(g===null){var p=new Map,v=g=new Map;v.set(c,p)}else v=g,p=v.get(c),p||(p=new Map,v.set(c,p));if(p.has(i))return p;for(p.set(i,null),c=c.getElementsByTagName(i),v=0;v<c.length;v++){var M=c[v];if(!(M[Ja]||M[Nt]||i==="link"&&M.getAttribute("rel")==="stylesheet")&&M.namespaceURI!=="http://www.w3.org/2000/svg"){var N=M.getAttribute(s)||"";N=i+N;var K=p.get(N);K?K.push(M):p.set(N,[M])}}return p}function x(i,s,c){i=i.ownerDocument||i,i.head.insertBefore(c,s==="title"?i.querySelector("head > title"):null)}function b(i,s,c){if(c===1||s.itemProp!=null)return!1;switch(i){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;switch(s.rel){case"stylesheet":return i=s.disabled,typeof s.precedence=="string"&&i==null;default:return!0}case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function T(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}var C=null;function D(){}function O(i,s,c){if(C===null)throw Error(I(475));var p=C;if(s.type==="stylesheet"&&(typeof c.media!="string"||matchMedia(c.media).matches!==!1)&&(s.state.loading&4)===0){if(s.instance===null){var v=xo(c.href),M=i.querySelector(Xc(v));if(M){i=M._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(p.count++,p=U.bind(p),i.then(p,p)),s.state.loading|=4,s.instance=M,tr(M);return}M=i.ownerDocument||i,c=Vd(c),(v=Ka.get(v))&&o(c,v),M=M.createElement("link"),tr(M);var N=M;N._p=new Promise(function(K,fe){N.onload=K,N.onerror=fe}),Or(M,"link",c),s.instance=M}p.stylesheets===null&&(p.stylesheets=new Map),p.stylesheets.set(s,i),(i=s.state.preload)&&(s.state.loading&3)===0&&(p.count++,s=U.bind(p),i.addEventListener("load",s),i.addEventListener("error",s))}}function F(){if(C===null)throw Error(I(475));var i=C;return i.stylesheets&&i.count===0&&Q(i,i.stylesheets),0<i.count?function(s){var c=setTimeout(function(){if(i.stylesheets&&Q(i,i.stylesheets),i.unsuspend){var p=i.unsuspend;i.unsuspend=null,p()}},6e4);return i.unsuspend=s,function(){i.unsuspend=null,clearTimeout(c)}}:null}function U(){if(this.count--,this.count===0){if(this.stylesheets)Q(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var $=null;function Q(i,s){i.stylesheets=null,i.unsuspend!==null&&(i.count++,$=new Map,s.forEach(re,i),$=null,U.call(i))}function re(i,s){if(!(s.state.loading&4)){var c=$.get(i);if(c)var p=c.get(null);else{c=new Map,$.set(i,c);for(var v=i.querySelectorAll("link[data-precedence],style[data-precedence]"),M=0;M<v.length;M++){var N=v[M];(N.nodeName==="LINK"||N.getAttribute("media")!=="not all")&&(c.set(N.dataset.precedence,N),p=N)}p&&c.set(null,p)}v=s.instance,N=v.getAttribute("data-precedence"),M=c.get(N)||p,M===p&&c.set(null,v),c.set(N,v),this.count++,p=U.bind(this),v.addEventListener("load",p),v.addEventListener("error",p),M?M.parentNode.insertBefore(v,M.nextSibling):(i=i.nodeType===9?i.head:i,i.insertBefore(v,i.firstChild)),s.state.loading|=4}}var be={$$typeof:tt,Provider:null,Consumer:null,_currentValue:nt,_currentValue2:nt,_threadCount:0};function he(i,s,c,p,v,M,N,K){this.tag=1,this.containerInfo=i,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=Ct(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ct(0),this.hiddenUpdates=Ct(null),this.identifierPrefix=p,this.onUncaughtError=v,this.onCaughtError=M,this.onRecoverableError=N,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=K,this.incompleteTransitions=new Map}function pe(i,s,c,p,v,M,N,K,fe,Be,Ke,it){return i=new he(i,s,c,N,K,fe,Be,it),s=1,M===!0&&(s|=24),M=ra(3,null,null,s),i.current=M,M.stateNode=i,s=io(),s.refCount++,i.pooledCache=s,s.refCount++,M.memoizedState={element:p,isDehydrated:c,cache:s},dh(M),i}function Ie(i){return i?(i=ni,i):ni}function Ne(i,s,c,p,v,M){v=Ie(v),p.context===null?p.context=v:p.pendingContext=v,p=ro(s),p.payload={element:c},M=M===void 0?null:M,M!==null&&(p.callback=M),c=Ps(i,p,s),c!==null&&(Xa(c,i,s),qo(c,i,s))}function Qe(i,s){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var c=i.retryLane;i.retryLane=c!==0&&c<s?c:s}}function pt(i,s){Qe(i,s),(i=i.alternate)&&Qe(i,s)}function lt(i){if(i.tag===13){var s=ia(i,67108864);s!==null&&Xa(s,i,67108864),pt(i,67108864)}}var dt=!0;function At(i,s,c,p){var v=Ve.T;Ve.T=null;var M=ht.p;try{ht.p=2,ft(i,s,c,p)}finally{ht.p=M,Ve.T=v}}function mt(i,s,c,p){var v=Ve.T;Ve.T=null;var M=ht.p;try{ht.p=8,ft(i,s,c,p)}finally{ht.p=M,Ve.T=v}}function ft(i,s,c,p){if(dt){var v=$e(p);if(v===null)Dd(i,s,p,Ot,c),ar(i,p);else if(dn(v,i,s,c,p))p.stopPropagation();else if(ar(i,p),s&4&&-1<hn.indexOf(i)){for(;v!==null;){var M=Ht(v);if(M!==null)switch(M.tag){case 3:if(M=M.stateNode,M.current.memoizedState.isDehydrated){var N=ve(M.pendingLanes);if(N!==0){var K=M;for(K.pendingLanes|=2,K.entangledLanes|=2;N;){var fe=1<<31-ye(N);K.entanglements[1]|=fe,N&=~fe}Ya(M),(Vi&6)===0&&(Td=Kr()+500,Gc(0))}}break;case 13:K=ia(M,2),K!==null&&Xa(K,M,2),Ed(),pt(M,2)}if(M=$e(p),M===null&&Dd(i,s,p,Ot,c),M===v)break;v=M}v!==null&&p.stopPropagation()}else Dd(i,s,p,null,c)}}function $e(i){return i=hl(i),Ut(i)}var Ot=null;function Ut(i){if(Ot=null,i=ei(i),i!==null){var s=X(i);if(s===null)i=null;else{var c=s.tag;if(c===13){if(i=A(s),i!==null)return i;i=null}else if(c===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;i=null}else s!==i&&(i=null)}}return Ot=i,null}function Rt(i){switch(i){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"invali
49d":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(da()){case Wn:return 2;case ms:return 8;case Qn:case Qa:return 32;case Da:return 268435456;default:return 32}default:return 32}}var Mt=!1,ri=null,Di=null,Wi=null,Vr=new Map,Gn=new Map,Gr=[],hn="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 ar(i,s){switch(i){case"focusin":case"focusout":ri=null;break;case"dragenter":case"dragleave":Di=null;break;case"mouseover":case"mouseout":Wi=null;break;case"pointerover":case"pointerout":Vr.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Gn.delete(s.pointerId)}}function Er(i,s,c,p,v,M){return i===null||i.nativeEvent!==M?(i={blockedOn:s,domEventName:c,eventSystemFlags:p,nativeEvent:M,targetContainers:[v]},s!==null&&(s=Ht(s),s!==null&&lt(s)),i):(i.eventSystemFlags|=p,s=i.targetContainers,v!==null&&s.indexOf(v)===-1&&s.push(v),i)}function dn(i,s,c,p,v){switch(s){case"focusin":return ri=Er(ri,i,s,c,p,v),!0;case"dragenter":return Di=Er(Di,i,s,c,p,v),!0;case"mouseover":return Wi=Er(Wi,i,s,c,p,v),!0;case"pointerover":var M=v.pointerId;return Vr.set(M,Er(Vr.get(M)||null,i,s,c,p,v)),!0;case"gotpointercapture":return M=v.pointerId,Gn.set(M,Er(Gn.get(M)||null,i,s,c,p,v)),!0}return!1}function Jr(i){var s=ei(i.target);if(s!==null){var c=X(s);if(c!==null){if(s=c.tag,s===13){if(s=A(c),s!==null){i.blockedOn=s,Zr(i.priority,function(){if(c.tag===13){var p=Ea();p=Kt(p);var v=ia(c,p);v!==null&&Xa(v,c,p),pt(c,p)}});return}}else if(s===3&&c.stateNode.current.memoizedState.isDehydrated){i.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}i.blockedOn=null}function fn(i){if(i.blockedOn!==null)return!1;for(var s=i.targetContainers;0<s.length;){var c=$e(i.nativeEvent);if(c===null){c=i.nativeEvent;var p=new c.constructor(c.type,c);vs=p,c.target.dispatchEvent(p),vs=null}else return s=Ht(c),s!==null&&lt(s),i.blockedOn=c,!1;s.shift()}return!0}function Pa(i,s,c){fn(i)&&c.delete(s)}function en(){Mt=!1,ri!==null&&fn(ri)&&(ri=null),Di!==null&&fn(Di)&&(Di=null),Wi!==null&&fn(Wi)&&(Wi=null),Vr.forEach(Pa),Gn.forEach(Pa)}function An(i,s){i.blockedOn===s&&(i.blockedOn=null,Mt||(Mt=!0,R.unstable_scheduleCallback(R.unstable_NormalPriority,en)))}var Ar=null;function Yr(i){Ar!==i&&(Ar=i,R.unstable_scheduleCallback(R.unstable_NormalPriority,function(){Ar===i&&(Ar=null);for(var s=0;s<i.length;s+=3){var c=i[s],p=i[s+1],v=i[s+2];if(typeof p!="function"){if(Ut(p||c)===null)continue;break}var M=Ht(c);M!==null&&(i.splice(s,3),s-=3,rr(M,{pending:!0,data:v,method:c.method,action:p},p,v))}}))}function Pr(i){function s(fe){return An(fe,i)}ri!==null&&An(ri,i),Di!==null&&An(Di,i),Wi!==null&&An(Wi,i),Vr.forEach(s),Gn.forEach(s);for(var c=0;c<Gr.length;c++){var p=Gr[c];p.blockedOn===i&&(p.blockedOn=null)}for(;0<Gr.length&&(c=Gr[0],c.blockedOn===null);)Jr(c),c.blockedOn===null&&Gr.shift();if(c=(i.ownerDocument||i).$$reactFormReplay,c!=null)for(p=0;p<c.length;p+=3){var v=c[p],M=c[p+1],N=v[qt]||null;if(typeof M=="function")N||Yr(c);else if(N){var K=null;if(M&&M.hasAttribute("formAction")){if(v=M,N=M[qt]||null)K=N.formAction;else if(Ut(v)!==null)continue}else K=N.action;typeof K=="function"?c[p+1]=K:(c.splice(p,3),p-=3),Yr(c)}}}function zr(i){this._internalRoot=i}Ni.prototype.render=zr.prototype.render=function(i){var s=this._internalRoot;if(s===null)throw Error(I(409));var c=s.current,p=Ea();Ne(c,p,i,s,null,null)},Ni.prototype.unmount=zr.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var s=i.containerInfo;Ne(i.current,2,null,i,null,null),Ed(),s[er]=null}};function Ni(i){this._internalRoot=i}Ni.prototype.unstable_scheduleHydration=function(i){if(i){var s=jr();i={blockedOn:null,target:i,priority:s};for(var c=0;c<Gr.length&&s!==0&&s<Gr[c].priority;c++);Gr.splice(c,0,i),c===0&&Jr(i)}};var ps=E.version;if(ps!=="19.1.1")throw Error(I(527,ps,"19.1.1"));ht.findDOMNode=function(i){var s=i._reactInternals;if(s===void 0)throw typeof i.render=="function"?Error(I(188)):(i=Object.keys(i).join(","),Error(I(268,i)));return i=H(s),i=i!==null?ne(i):null,i=i===null?null:i.stateNode,i};var Nu={bundleType:0,version:"19.1.1",rendererPackageName:"react-dom",currentDispatcherRef:Ve,reconcilerVersion:"19.1.1"};
49if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var za=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!za.isDisabled&&za.supportsFiber)try{Ti=za.inject(Nu),sr=za}catch{}}return qf.createRoot=function(i,s){if(!V(i))throw Error(I(299));var c=!1,p="",v=Wf,M=dd,N=Qf,K=null;return s!=null&&(s.unstable_strictMode===!0&&(c=!0),s.identifierPrefix!==void 0&&(p=s.identifierPrefix),s.onUncaughtError!==void 0&&(v=s.onUncaughtError),s.onCaughtError!==void 0&&(M=s.onCaughtError),s.onRecoverableError!==void 0&&(N=s.onRecoverableError),s.unstable_transitionCallbacks!==void 0&&(K=s.unstable_transitionCallbacks)),s=pe(i,1,!1,null,null,c,p,v,M,N,K,null),i[er]=s.current,Rd(i),new zr(s)},qf.hydrateRoot=function(i,s,c){if(!V(i))throw Error(I(299));var p=!1,v="",M=Wf,N=dd,K=Qf,fe=null,Be=null;return c!=null&&(c.unstable_strictMode===!0&&(p=!0),c.identifierPrefix!==void 0&&(v=c.identifierPrefix),c.onUncaughtError!==void 0&&(M=c.onUncaughtError),c.onCaughtError!==void 0&&(N=c.onCaughtError),c.onRecoverableError!==void 0&&(K=c.onRecoverableError),c.unstable_transitionCallbacks!==void 0&&(fe=c.unstable_transitionCallbacks),c.formState!==void 0&&(Be=c.formState)),s=pe(i,1,!0,s,c??null,p,v,M,N,K,fe,Be),s.context=Ie(null),c=s.current,p=Ea(),p=Kt(p),v=ro(p),v.callback=null,Ps(c,v,p),c=p,s.current.lanes=c,Me(s,c),Ya(s),i[er]=s.current,Rd(i),new Ni(s)},qf.version="19.1.1",qf}var Jm;function N_(){if(Jm)return pm.exports;Jm=1;function R(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(R)}catch(E){console.error(E)}}return R(),pm.exports=j_(),pm.exports}var F_=N_();function U_(R,E,z,I){const X=(z-R)*(Math.PI/180),A=(I-E)*(Math.PI/180),u=Math.sin(X/2)*Math.sin(X/2)+Math.cos(R*(Math.PI/180))*Math.cos(z*(Math.PI/180))*Math.sin(A/2)*Math.sin(A/2);return 6371*(2*Math.atan2(Math.sqrt(u),Math.sqrt(1-u)))}function V_(R){const I=1e3-R*20;return Math.max(0,Math.round(I))}function ym(R){return R<=1?{tier:"Perfect!",color:"text-green-600",description:"Incredible accuracy!"}:R<=5?{tier:"Excellent",color:"text-green-500",description:"Outstanding guess!"}:R<=10?{tier:"Great",color:"text-blue-500",description:"Very close!"}:R<=25?{tier:"Good",color:"text-yellow-500",description:"Nice try!"}:R<=40?{tier:"Fair",color:"text-orange-500",description:"Getting warmer..."}:{tier:"Miss",color:"text-red-500",description:"Better luck next time!"}}function G_(){const[R,E]=Ae.useState({phase:"menu",currentLocation:null,userGuess:null,score:0,round:0,distance:null,points:null,roundScore:null,isLoading:!1,isSubmitting:!1}),z=()=>{E(se=>({...se,phase:"preparing",score:0,currentLocation:null,userGuess:null,distance:null,points:null,roundScore:null,isLoading:!1,isSubmitting:!1}))},I=Ae.useCallback(()=>{E(se=>({...se,phase:"tile-view"}))},[]);return{state:R,startGame:z,startTileView:I,startCountdown:()=>{E(se=>({...se,phase:"countdown"}))},showMap:()=>{E(se=>({...se,phase:"map-view"}))},setGuess:se=>{E(we=>({...we,userGuess:se}))},setLocation:se=>{E(we=>({...we,currentLocation:se}))},showResults:se=>{const we=se||R.userGuess;if(R.currentLocation&&we){const[Ce,ie]=R.currentLocation,[Fe,He]=we,xe=U_(ie,Ce,He,Fe),et=V_(xe);E(qe=>({...qe,phase:"results",userGuess:we,distance:xe,roundScore:et,score:qe.score+et}))}},resetGame:()=>{E({phase:"menu",currentLocation:null,userGuess:null,score:0,round:0,distance:null,points:null,roundScore:null,isLoading:!1,isSubmitting:!1})}}}const Gp=[{name:"Addis Ababa",coordinates:[38.7685,9.0161],population:3352e3},{name:"Dire Dawa",coordinates:[41.8667,9.6],population:493e3},{name:"Mekelle",coordinates:[39.4667,13.5],population:323700},{name:"Gondar",coordinates:[37.4667,12.6],population:324e3},{name:"Adama",coordinates:[39.2667,8.55],population:324e3},{name:"Jimma",coordinates:[36.8167,7.6667],population:207573},{name:"Dessie",coordinates:[39.6333,11.1333],population:151094},{name:"Bahir Dar",coordinates:[37.3833,11.6],population:168899},{name:"Hawassa",coordinates:[38.4667,7.05],population:258808},{name:"Harar",coordinates:[42.1167,9.3167],population:151977},{name:"Shashamane",coordinates:[38.6,7.2],population:100454},{name:"Bishoftu",coordinates:[39.1167,8.75],population:104215},{name:"Arba Minch",coordinates:[37.55,6.0333],population:69522},{name:"Hosaena",coordinates:[37.85,7.55],population:69069},{name:"Dilla",coordinates:[38.3167,6.4167],population:47021},{name:"Nekemte",coordinates:[36.55,9.0833],population:115741},{name:"Debre Birhan",coordinates:[39.5333,9.6833],population:65731},{name:"Asella",coordinates:[39.1333,7.95],population:67626},{name:"Debre Markos",coordinates:[37.7333,10.3333],population:62050},{name:"Kombolcha",coordinates:[39.7333,11.0833],population:65e3}];function Z_(R){const E=R?Gp.filter(I=>R.includes(I.name)):Gp;if(E.length===0){const I=Math.floor(Math.random()*Gp.length);return Gp[I]}const z=Math.floor(Math.random()*E.length);return E[z]}function q_(R){const E=Z_(R);return $_(E.coordinates)}function $_(R){const[E,z]=R,I=.1,V=.02,X=V+Math.random()*(I-V),A=Math.random()*2*Math.PI,u=X*Math.cos(A)/Math.cos(z*Math.PI/180),H=X*Math.sin(A),ne=E+u,se=z+H;return[ne,se]}const Yf=[{name:"Addis Ababa",coordinates:[38.7685,9.0161],region:"Central"},{name:"Dire Dawa",coordinates:[41.8702,9.6889],region:"Eastern"},{name:"Gondar",coordinates:[37.4572,12.6081],region:"Northern"},{name:"Bahir Dar",coordinates:[37.3905,11.6004],region:"Northern"},{name:"Mekelle",coordinates:[39.4692,13.4966],region:"Northern"},{name:"Hawassa",coordinates:[38.5018,7.0621],region:"Southern"},{name:"Jimma",coordinates:[36.82,7.6667],region:"Southwestern"},{name:"Harar",coordinates:[42.1186,9.3144],region:"Eastern"},{name:"Jijiga",coordinates:[42.8,9.35],region:"Eastern"},{name:"Arba Minch",coordinates:[37.55,6.0333],region:"Southern"},{name:"Shashamane",coordinates:[38.6,7.2],region:"Southern"},{name:"Dessie",coordinates:[39.6833,11.1333],region:"Northern"}
vendor: 10,622 bytes, line 49
49,{name:"Sodo",coordinates:[37.7667,6.85],region:"Southern"},{name:"Debre Markos",coordinates:[37.7167,10.3333],region:"Central"},{name:"Adama",coordinates:[39.2667,8.55],region:"Central"}],eg={selectedCities:Yf.map(R=>R.name),tileViewDuration:10};function tg(R,E){if(typeof R=="function")return R(E);R!=null&&(R.current=E)}function wg(...R){return E=>{let z=!1;const I=R.map(V=>{const X=tg(V,E);return!z&&typeof X=="function"&&(z=!0),X});if(z)return()=>{for(let V=0;V<I.length;V++){const X=I[V];typeof X=="function"?X():tg(R[V],null)}}}}function ll(...R){return Ae.useCallback(wg(...R),R)}function Kp(R){const E=X_(R),z=Ae.forwardRef((I,V)=>{const{children:X,...A}=I,u=Ae.Children.toArray(X),H=u.find(K_);if(H){const ne=H.props.children,se=u.map(we=>we===H?Ae.Children.count(ne)>1?Ae.Children.only(null):Ae.isValidElement(ne)?ne.props.children:null:we);return q.jsx(E,{...A,ref:V,children:Ae.isValidElement(ne)?Ae.cloneElement(ne,void 0,se):null})}return q.jsx(E,{...A,ref:V,children:X})});return z.displayName=`${R}.Slot`,z}var H_=Kp("Slot");function X_(R){const E=Ae.forwardRef((z,I)=>{const{children:V,...X}=z;if(Ae.isValidElement(V)){const A=Q_(V),u=W_(X,V.props);return V.type!==Ae.Fragment&&(u.ref=I?wg(I,A):A),Ae.cloneElement(V,u)}return Ae.Children.count(V)>1?Ae.Children.only(null):null});return E.displayName=`${R}.SlotClone`,E}var Y_=Symbol("radix.slottable");function K_(R){return Ae.isValidElement(R)&&typeof R.type=="function"&&"__radixId"in R.type&&R.type.__radixId===Y_}function W_(R,E){const z={...E};for(const I in E){const V=R[I],X=E[I];/^on[A-Z]/.test(I)?V&&X?z[I]=(...u)=>{const H=X(...u);return V(...u),H}:V&&(z[I]=V):I==="style"?z[I]={...V,...X}:I==="className"&&(z[I]=[V,X].filter(Boolean).join(" "))}return{...R,...z}}function Q_(R){let E=Object.getOwnPropertyDescriptor(R.props,"ref")?.get,z=E&&"isReactWarning"in E&&E.isReactWarning;return z?R.ref:(E=Object.getOwnPropertyDescriptor(R,"ref")?.get,z=E&&"isReactWarning"in E&&E.isReactWarning,z?R.props.ref:R.props.ref||R.ref)}function Sg(R){var E,z,I="";if(typeof R=="string"||typeof R=="number")I+=R;else if(typeof R=="object")if(Array.isArray(R)){var V=R.length;for(E=0;E<V;E++)R[E]&&(z=Sg(R[E]))&&(I&&(I+=" "),I+=z)}else for(z in R)R[z]&&(I&&(I+=" "),I+=z);return I}function Tg(){for(var R,E,z=0,I="",V=arguments.length;z<V;z++)(R=arguments[z])&&(E=Sg(R))&&(I&&(I+=" "),I+=E);return I}const ig=R=>typeof R=="boolean"?`${R}`:R===0?"0":R,rg=Tg,Mg=(R,E)=>z=>{var I;if(E?.variants==null)return rg(R,z?.class,z?.className);const{variants:V,defaultVariants:X}=E,A=Object.keys(V).map(ne=>{const se=z?.[ne],we=X?.[ne];if(se===null)return null;const Ce=ig(se)||ig(we);return V[ne][Ce]}),u=z&&Object.entries(z).reduce((ne,se)=>{let[we,Ce]=se;return Ce===void 0||(ne[we]=Ce),ne},{}),H=E==null||(I=E.compoundVariants)===null||I===void 0?void 0:I.reduce((ne,se)=>{let{class:we,className:Ce,...ie}=se;return Object.entries(ie).every(Fe=>{let[He,xe]=Fe;return Array.isArray(xe)?xe.includes({...X,...u}[He]):{...X,...u}[He]===xe})?[...ne,we,Ce]:ne},[]);return rg(R,A,H,z?.class,z?.className)},Rm="-",J_=R=>{const E=ty(R),{conflictingClassGroups:z,conflictingClassGroupModifiers:I}=R;return{getClassGroupId:A=>{const u=A.split(Rm);return u[0]===""&&u.length!==1&&u.shift(),Cg(u,E)||ey(A)},getConflictingClassGroupIds:(A,u)=>{const H=z[A]||[];return u&&I[A]?[...H,...I[A]]:H}}},Cg=(R,E)=>{if(R.length===0)return E.classGroupId;const z=R[0],I=E.nextPart.get(z),V=I?Cg(R.slice(1),I):void 0;if(V)return V;if(E.validators.length===0)return;const X=R.join(Rm);return E.validators.find(({validator:A})=>A(X))?.classGroupId},ng=/^\[(.+)\]$/,ey=R=>{if(ng.test(R)){const E=ng.exec(R)[1],z=E?.substring(0,E.indexOf(":"));if(z)return"arbitrary.."+z}},ty=R=>{const{theme:E,classGroups:z}=R,I={nextPart:new Map,validators:[]};for(const V in z)Tm(z[V],I,V,E);return I},Tm=(R,E,z,I)=>{R.forEach(V=>{if(typeof V=="string"){const X=V===""?E:ag(E,V);X.classGroupId=z;return}if(typeof V=="function"){if(iy(V)){Tm(V(I),E,z,I);return}E.validators.push({validator:V,classGroupId:z});return}Object.entries(V).forEach(([X,A])=>{Tm(A,ag(E,X),z,I)})})},ag=(R,E)=>{let z=R;return E.split(Rm).forEach(I=>{z.nextPart.has(I)||z.nextPart.set(I,{nextPart:new Map,validators:[]}),z=z.nextPart.get(I)}),z},iy=R=>R.isThemeGetter,ry=R=>{if(R<1)return{get:()=>{},set:()=>{}};let E=0,z=new Map,I=new Map;const V=(X,A)=>{z.set(X,A),E++,E>R&&(E=0,I=z,z=new Map)};return{get(X){let A=z.get(X);if(A!==void 0)return A;if((A=I.get(X))!==void 0)return V(X,A),A},set(X,A){z.has(X)?z.set(X,A):V(X,A)}}},Mm="!",Cm=":",ny=Cm.length,ay=R=>{const{prefix:E,experimentalParseClassName:z}=R;let I=V=>{const X=[];let A=0,u=0,H=0,ne;for(let Fe=0;Fe<V.length;Fe++){let He=V[Fe];if(A===0&&u===0){if(He===Cm){X.push(V.slice(H,Fe)),H=Fe+ny;continue}if(He==="/"){ne=Fe;continue}}He==="["?A++:He==="]"?A--:He==="("?u++:He===")"&&u--}const se=X.length===0?V:V.substring(H),we=sy(se),Ce=we!==se,ie=ne&&ne>H?ne-H:void 0;return{modifiers:X,hasImportantModifier:Ce,baseClassName:we,maybePostfixModifierPosition:ie}};if(E){const V=E+Cm,X=I;I=A=>A.startsWith(V)?X(A.substring(V.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:A,maybePostfixModifierPosition:void 0}}if(z){const V=I;I=X=>z({className:X,parseClassName:V})}return I},sy=R=>R.endsWith(Mm)?R.substring(0,R.length-1):R.startsWith(Mm)?R.substring(1):R,oy=R=>{const E=Object.fromEntries(R.orderSensitiveModifiers.map(I=>[I,!0]));return I=>{if(I.length<=1)return I;const V=[];let X=[];return I.forEach(A=>{A[0]==="["||E[A]?(V.push(...X.sort(),A),X=[]):X.push(A)}),V.push(...X.sort()),V}},ly=R=>({cache:ry(R.cacheSize),parseClassName:ay(R),sortModifiers:oy(R),...J_(R)}),cy=/\s+/,uy=(R,E)=>{const{parseClassName:z,getClassGroupId:I,getConflictingClassGroupIds:V,sortModifiers:X}=E,A=[],u=R.trim().split(cy);let H="";for(let ne=u.length-1;ne>=0;ne-=1){const se=u[ne],{isExternal:we,modifiers:Ce,hasImportantModifier:ie,baseClassName:Fe,maybePostfixModifierPosition:He}=z(se);if(we){H=se+(H.length>0?" "+H:H);continue}let xe=!!He,et=I(xe?Fe.substring(0,He):Fe);if(!et){if(!xe){H=se+(H.length>0?" "+H:H);continue}if(et=I(Fe),!et){H=se+(H.length>0?" "+H:H);continue}xe=!1}const qe=X(Ce).join(":"),tt=ie?qe+Mm:qe,ut=tt+et;if(A.includes(ut))continue;A.push(ut);const Ze=V(et,xe);for(let _t=0;_t<Ze.length;++_t){const Tt=Ze[_t];A.push(tt+Tt)}H=se+(H.length>0?" "+H:H)}return H};function hy(){let R=0,E,z,I="";for(;R<arguments.length;)(E=arguments[R++])&&(z=Eg(E))&&(I&&(I+=" "),I+=z);return I}const Eg=R=>{if(typeof R=="string")return R;let E,z="";for(let I=0;I<R.length;I++)R[I]&&(E=Eg(R[I]))&&(z&&(z+=" "),z+=E);return z};function dy(R,...E){let z,I,V,X=A;function A(H){const ne=E.reduce((se,we)=>we(se),R());return z=ly(ne),I=z.cache.get,V=z.cache.set,X=u,u(H)}function u(H){const ne=I(H);if(ne)return ne;const se=uy(H,z);return V(H,se),se}return function(){return X(hy.apply(null,arguments))}}const Zn=R=>{const E=z=>z[R]||[];return E.isThemeGetter=!0,E},Ag=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Pg=/^\((?:(\w[\w-]*):)?(.+)\)$/i,fy=/^\d+\/\d+$/,py=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,my=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,gy=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,_y=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,yy=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Gd=R=>fy.test(R),Si=R=>!!R&&!Number.isNaN(Number(R)),Fu=R=>!!R&&Number.isInteger(Number(R)),xm=R=>R.endsWith("%")&&Si(R.slice(0,-1)),Yc=R=>py.test(R),xy=()=>!0,vy=R=>my.test(R)&&!gy.test(R),zg=()=>!1,by=R=>_y.test(R),wy=R=>yy.test(R),Sy=R=>!Lt(R)&&!Bt(R),Ty=R=>Zd(R,Rg,zg),Lt=R=>Ag.test(R),Zh=R=>Zd(R,Dg,vy),vm=R=>Zd(R,Py,Si),sg=R=>Zd(R,kg,zg),My=R=>Zd(R,Ig,wy),Zp=R=>Zd(R,Lg,by),Bt=R=>Pg.test(R),$f=R=>qd(R,Dg),Cy=R=>qd(R,zy),og=R=>qd(R,kg),Ey=R=>qd(R,Rg),Ay=R=>qd(R,Ig),qp=R=>qd(R,Lg,!0),Zd=(R,E,z)=>{const I=Ag.exec(R);return I?I[1]?E(I[1]):z(I[2]):!1},qd=(R,E,z=!1)=>{const I=Pg.exec(R);return I?I[1]?E(I[1]):z:!1},kg=R=>R==="position"||R==="percentage",Ig=R=>R==="image"||R==="url",Rg=R=>R==="length"||R==="size"||R==="bg-size",Dg=R=>R==="length",Py=R=>R==="number",zy=R=>R==="family-name",Lg=R=>R==="shadow",ky=()=>{const R=Zn("color"),E=Zn("font"),z=Zn("text"),I=Zn("font-weight"),V=Zn("tracking"),X=Zn("leading"),A=Zn("breakpoint"),u=Zn("container"),H=Zn("spacing"),ne=Zn("radius"),se=Zn("shadow"),we=Zn("inset-shadow"),Ce=Zn("text-shadow"),ie=Zn("drop-shadow"),Fe=Zn("blur"),He=Zn("perspective"),xe=Zn("aspect"),et=Zn("ease"),qe=Zn("animate"),tt=()=>["auto","avoid","all","avoid-page","page","left","right","column"],ut=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],Ze=()=>[...ut(),Bt,Lt],_t=()=>["auto","hidden","clip","visible","scroll"],Tt=()=>["auto","contain","none"],xt=()=>[Bt,Lt,H],Gt=()=>[Gd,"full","auto",...xt()],hi=()=>[Fu,"none","subgrid",Bt,Lt],mi=()=>["auto",{span:["full",Fu,Bt,Lt]},Fu,Bt,Lt],Jt=()=>[Fu,"auto",Bt,Lt],fr=()=>["auto","min","max","fr",Bt,Lt],Ir=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],yi=()=>["start","end","center","stretch","center-safe","end-safe"],Ve=()=>["auto",...xt()],ht=()=>[Gd,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...xt()],nt=()=>[R,Bt,Lt],bt=()=>[...ut(),og,sg,{position:[Bt,Lt]}],_e=()=>["no-repeat",{repeat:["","x","y","space","round"]}],Xe=()=>["auto","cover","contain",Ey,Ty,{size:[Bt,Lt]}],vt=()=>[xm,$f,Zh],at=()=>["","none","full",ne,Bt,Lt],wt=()=>["",Si,$f,Zh],Ft=()=>["solid","dashed","dotted","double"],zt=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],di=()=>[Si,xm,og,sg],si=()=>["","none",Fe,Bt,Lt],Ji=()=>["none",Si,Bt,Lt],zn=()=>["none",Si,Bt,Lt],kn=()=>[Si,Bt,Lt],xr=()=>[Gd,"full",...xt()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Yc],breakpoint:[Yc],color:[xy],container:[Yc],"drop-shadow":[Yc],ease:["in","out","in-out"],font:[Sy],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Yc],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Yc],shadow:[Yc],spacing:["px",Si],text:[Yc],"text-shadow":[Yc],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Gd,Lt,Bt,xe]}
vendor: 12,739 bytes, line 49
49],container:["container"],columns:[{columns:[Si,Lt,Bt,u]}],"break-after":[{"break-after":tt()}],"break-before":[{"break-before":tt()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:Ze()}],overflow:[{overflow:_t()}],"overflow-x":[{"overflow-x":_t()}],"overflow-y":[{"overflow-y":_t()}],overscroll:[{overscroll:Tt()}],"overscroll-x":[{"overscroll-x":Tt()}],"overscroll-y":[{"overscroll-y":Tt()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:Gt()}],"inset-x":[{"inset-x":Gt()}],"inset-y":[{"inset-y":Gt()}],start:[{start:Gt()}],end:[{end:Gt()}],top:[{top:Gt()}],right:[{right:Gt()}],bottom:[{bottom:Gt()}],left:[{left:Gt()}],visibility:["visible","invisible","collapse"],z:[{z:[Fu,"auto",Bt,Lt]}],basis:[{basis:[Gd,"full","auto",u,...xt()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Si,Gd,"auto","initial","none",Lt]}],grow:[{grow:["",Si,Bt,Lt]}],shrink:[{shrink:["",Si,Bt,Lt]}],order:[{order:[Fu,"first","last","none",Bt,Lt]}],"grid-cols":[{"grid-cols":hi()}],"col-start-end":[{col:mi()}],"col-start":[{"col-start":Jt()}],"col-end":[{"col-end":Jt()}],"grid-rows":[{"grid-rows":hi()}],"row-start-end":[{row:mi()}],"row-start":[{"row-start":Jt()}],"row-end":[{"row-end":Jt()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":fr()}],"auto-rows":[{"auto-rows":fr()}],gap:[{gap:xt()}],"gap-x":[{"gap-x":xt()}],"gap-y":[{"gap-y":xt()}],"justify-content":[{justify:[...Ir(),"normal"]}],"justify-items":[{"justify-items":[...yi(),"normal"]}],"justify-self":[{"justify-self":["auto",...yi()]}],"align-content":[{content:["normal",...Ir()]}],"align-items":[{items:[...yi(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...yi(),{baseline:["","last"]}]}],"place-content":[{"place-content":Ir()}],"place-items":[{"place-items":[...yi(),"baseline"]}],"place-self":[{"place-self":["auto",...yi()]}],p:[{p:xt()}],px:[{px:xt()}],py:[{py:xt()}],ps:[{ps:xt()}],pe:[{pe:xt()}],pt:[{pt:xt()}],pr:[{pr:xt()}],pb:[{pb:xt()}],pl:[{pl:xt()}],m:[{m:Ve()}],mx:[{mx:Ve()}],my:[{my:Ve()}],ms:[{ms:Ve()}],me:[{me:Ve()}],mt:[{mt:Ve()}],mr:[{mr:Ve()}],mb:[{mb:Ve()}],ml:[{ml:Ve()}],"space-x":[{"space-x":xt()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":xt()}],"space-y-reverse":["space-y-reverse"],size:[{size:ht()}],w:[{w:[u,"screen",...ht()]}],"min-w":[{"min-w":[u,"screen","none",...ht()]}],"max-w":[{"max-w":[u,"screen","none","prose",{screen:[A]},...ht()]}],h:[{h:["screen","lh",...ht()]}],"min-h":[{"min-h":["screen","lh","none",...ht()]}],"max-h":[{"max-h":["screen","lh",...ht()]}],"font-size":[{text:["base",z,$f,Zh]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[I,Bt,vm]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",xm,Lt]}],"font-family":[{font:[Cy,Lt,E]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[V,Bt,Lt]}],"line-clamp":[{"line-clamp":[Si,"none",Bt,vm]}],leading:[{leading:[X,...xt()]}],"list-image":[{"list-image":["none",Bt,Lt]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Bt,Lt]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:nt()}],"text-color":[{text:nt()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Ft(),"wavy"]}],"text-decoration-thickness":[{decoration:[Si,"from-font","auto",Bt,Zh]}],"text-decoration-color":[{decoration:nt()}],"underline-offset":[{"underline-offset":[Si,"auto",Bt,Lt]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:xt()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Bt,Lt]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Bt,Lt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:bt()}],"bg-repeat":[{bg:_e()}],"bg-size":[{bg:Xe()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Fu,Bt,Lt],radial:["",Bt,Lt],conic:[Fu,Bt,Lt]},Ay,My]}],"bg-color":[{bg:nt()}],"gradient-from-pos":[{from:vt()}],"gradient-via-pos":[{via:vt()}],"gradient-to-pos":[{to:vt()}],"gradient-from":[{from:nt()}],"gradient-via":[{via:nt()}],"gradient-to":[{to:nt()}],rounded:[{rounded:at()}],"rounded-s":[{"rounded-s":at()}],"rounded-e":[{"rounded-e":at()}],"rounded-t":[{"rounded-t":at()}],"rounded-r":[{"rounded-r":at()}],"rounded-b":[{"rounded-b":at()}],"rounded-l":[{"rounded-l":at()}],"rounded-ss":[{"rounded-ss":at()}],"rounded-se":[{"rounded-se":at()}],"rounded-ee":[{"rounded-ee":at()}],"rounded-es":[{"rounded-es":at()}],"rounded-tl":[{"rounded-tl":at()}],"rounded-tr":[{"rounded-tr":at()}],"rounded-br":[{"rounded-br":at()}],"rounded-bl":[{"rounded-bl":at()}],"border-w":[{border:wt()}],"border-w-x":[{"border-x":wt()}],"border-w-y":[{"border-y":wt()}],"border-w-s":[{"border-s":wt()}],"border-w-e":[{"border-e":wt()}],"border-w-t":[{"border-t":wt()}],"border-w-r":[{"border-r":wt()}],"border-w-b":[{"border-b":wt()}],"border-w-l":[{"border-l":wt()}],"divide-x":[{"divide-x":wt()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":wt()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Ft(),"hidden","none"]}],"divide-style":[{divide:[...Ft(),"hidden","none"]}],"border-color":[{border:nt()}],"border-color-x":[{"border-x":nt()}],"border-color-y":[{"border-y":nt()}],"border-color-s":[{"border-s":nt()}],"border-color-e":[{"border-e":nt()}],"border-color-t":[{"border-t":nt()}],"border-color-r":[{"border-r":nt()}],"border-color-b":[{"border-b":nt()}],"border-color-l":[{"border-l":nt()}],"divide-color":[{divide:nt()}],"outline-style":[{outline:[...Ft(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Si,Bt,Lt]}],"outline-w":[{outline:["",Si,$f,Zh]}],"outline-color":[{outline:nt()}],shadow:[{shadow:["","none",se,qp,Zp]}],"shadow-color":[{shadow:nt()}],"inset-shadow":[{"inset-shadow":["none",we,qp,Zp]}],"inset-shadow-color":[{"inset-shadow":nt()}],"ring-w":[{ring:wt()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:nt()}],"ring-offset-w":[{"ring-offset":[Si,Zh]}],"ring-offset-color":[{"ring-offset":nt()}],"inset-ring-w":[{"inset-ring":wt()}],"inset-ring-color":[{"inset-ring":nt()}],"text-shadow":[{"text-shadow":["none",Ce,qp,Zp]}],"text-shadow-color":[{"text-shadow":nt()}],opacity:[{opacity:[Si,Bt,Lt]}],"mix-blend":[{"mix-blend":[...zt(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":zt()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Si]}],"mask-image-linear-from-pos":[{"mask-linear-from":di()}],"mask-image-linear-to-pos":[{"mask-linear-to":di()}],"mask-image-linear-from-color":[{"mask-linear-from":nt()}],"mask-image-linear-to-color":[{"mask-linear-to":nt()}],"mask-image-t-from-pos":[{"mask-t-from":di()}],"mask-image-t-to-pos":[{"mask-t-to":di()}],"mask-image-t-from-color":[{"mask-t-from":nt()}],"mask-image-t-to-color":[{"mask-t-to":nt()}],"mask-image-r-from-pos":[{"mask-r-from":di()}],"mask-image-r-to-pos":[{"mask-r-to":di()}],"mask-image-r-from-color":[{"mask-r-from":nt()}],"mask-image-r-to-color":[{"mask-r-to":nt()}],"mask-image-b-from-pos":[{"mask-b-from":di()}],"mask-image-b-to-pos":[{"mask-b-to":di()}],"mask-image-b-from-color":[{"mask-b-from":nt()}],"mask-image-b-to-color":[{"mask-b-to":nt()}],"mask-image-l-from-pos":[{"mask-l-from":di()}],"mask-image-l-to-pos":[{"mask-l-to":di()}],"mask-image-l-from-color":[{"mask-l-from":nt()}],"mask-image-l-to-color":[{"mask-l-to":nt()}],"mask-image-x-from-pos":[{"mask-x-from":di()}],"mask-image-x-to-pos":[{"mask-x-to":di()}],"mask-image-x-from-color":[{"mask-x-from":nt()}],"mask-image-x-to-color":[{"mask-x-to":nt()}],"mask-image-y-from-pos":[{"mask-y-from":di()}],"mask-image-y-to-pos":[{"mask-y-to":di()}],"mask-image-y-from-color":[{"mask-y-from":nt()}],"mask-image-y-to-color":[{"mask-y-to":nt()}],"mask-image-radial":[{"mask-radial":[Bt,Lt]}],"mask-image-radial-from-pos":[{"mask-radial-from":di()}],"mask-image-radial-to-pos":[{"mask-radial-to":di()}],"mask-image-radial-from-color":[{"mask-radial-from":nt()}],"mask-image-radial-to-color":[{"mask-radial-to":nt()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":ut()}],"mask-image-conic-pos":[{"mask-conic":[Si]}],"mask-image-conic-from-pos":[{"mask-conic-from":di()}],"mask-image-conic-to-pos":[{"mask-conic-to":di()}],"mask-image-conic-from-color":[{"mask-conic-from":nt()}],"mask-image-conic-to-color":[{"mask-conic-to":nt()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:bt()}],"mask-repeat":[{mask:_e()}],"mask-size":[{mask:Xe()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Bt,Lt]}],filter:[{filter:["","none",Bt,Lt]}],blur:[{blur:si()}],brightness:[{brightness:[Si,Bt,Lt]}],contrast:[{contrast:[Si,Bt,Lt]}],"drop-shadow":[{"drop-shadow":["","none",ie,qp,Zp]}],"drop-shadow-color":[{"drop-shadow":nt()}],grayscale:[{grayscale:["",Si,Bt,Lt]}],"hue-rotate":[{"hue-rotate":[Si,Bt,Lt]}],invert:[{invert:["",Si,Bt,Lt]}],saturate:[{saturate:[Si,Bt,Lt]}],sepia:[{sepia:["",Si,Bt,Lt]}],"backdrop-filter":[{"backdrop-filter":["","none",Bt,Lt]}],"backdrop-blur":[{"backdrop-blur":si()}],"backdrop-brightness":[{"backdrop-brightness":[Si,Bt,Lt]}],"backdrop-contrast":[{"backdrop-contrast":[Si,Bt,Lt]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Si,Bt,Lt]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Si,Bt,Lt]}],"backdrop-invert":[{"backdrop-invert":["",Si,Bt,Lt]}],"backdrop-opacity":[{"backdrop-opacity":[Si,Bt,Lt]}],"backdrop-saturate":[{"backdrop-saturate":[Si,Bt,Lt]}],"backdrop-sepia":[{"backdrop-sepia":["",Si,Bt,Lt]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":xt()}],"border-spacing-x":[{"border-spacing-x":xt()}],"border-spacing-y":[{"border-spacing-y":xt()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Bt,Lt]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Si,"initial",Bt,Lt]}],ease:[{ease:["linear","initial",et,Bt,Lt]}],delay:[{delay:[Si,Bt,Lt]}],animate:[{animate:["none",qe,Bt,Lt]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[He,Bt,Lt]}],"perspective-origin":[{"perspective-origin":Ze()}],rotate:[{rotate:Ji()}],"rotate-x":[{"rotate-x":Ji()}],"rotate-y":[{"rotate-y":Ji()}],"rotate-z":[{"rotate-z":Ji()}],scale:[{scale:zn()}],"scale-x":[{"scale-x":zn()}],"scale-y":[{"scale-y":zn()}],"scale-z":[{"scale-z":zn()}],"scale-3d":["scale-3d"],skew:[{skew:kn()}],"skew-x":[{"skew-x":kn()}],"skew-y":[{"skew-y":kn()}],transform:[{transform:[Bt,Lt,"","none","gpu","cpu"]}],"transform-origin":[{origin:Ze()}],"transform-style":[{transform:["3d","flat"]}
vendor: 5,991 bytes, line 49
49],translate:[{translate:xr()}],"translate-x":[{"translate-x":xr()}],"translate-y":[{"translate-y":xr()}],"translate-z":[{"translate-z":xr()}],"translate-none":["translate-none"],accent:[{accent:nt()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:nt()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Bt,Lt]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":xt()}],"scroll-mx":[{"scroll-mx":xt()}],"scroll-my":[{"scroll-my":xt()}],"scroll-ms":[{"scroll-ms":xt()}],"scroll-me":[{"scroll-me":xt()}],"scroll-mt":[{"scroll-mt":xt()}],"scroll-mr":[{"scroll-mr":xt()}],"scroll-mb":[{"scroll-mb":xt()}],"scroll-ml":[{"scroll-ml":xt()}],"scroll-p":[{"scroll-p":xt()}],"scroll-px":[{"scroll-px":xt()}],"scroll-py":[{"scroll-py":xt()}],"scroll-ps":[{"scroll-ps":xt()}],"scroll-pe":[{"scroll-pe":xt()}],"scroll-pt":[{"scroll-pt":xt()}],"scroll-pr":[{"scroll-pr":xt()}],"scroll-pb":[{"scroll-pb":xt()}],"scroll-pl":[{"scroll-pl":xt()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Bt,Lt]}],fill:[{fill:["none",...nt()]}],"stroke-w":[{stroke:[Si,$f,Zh,vm]}],stroke:[{stroke:["none",...nt()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},Iy=dy(ky);function wo(...R){return Iy(Tg(R))}const Ry=Mg("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),kr=Ae.forwardRef(({className:R,variant:E,size:z,asChild:I=!1,...V},X)=>{const A=I?H_:"button";return q.jsx(A,{className:wo(Ry({variant:E,size:z,className:R})),ref:X,...V})});kr.displayName="Button";const Ia=Ae.forwardRef(({className:R,...E},z)=>q.jsx("div",{ref:z,className:wo("rounded-lg border bg-card text-card-foreground shadow-sm",R),...E}));
vendor: 10,706 bytes, lines 49-169
49Ia.displayName="Card";const vo=Ae.forwardRef(({className:R,...E},z)=>q.jsx("div",{ref:z,className:wo("flex flex-col space-y-1.5 p-6",R),...E}));vo.displayName="CardHeader";const bo=Ae.forwardRef(({className:R,...E},z)=>q.jsx("h3",{ref:z,className:wo("text-2xl font-semibold leading-none tracking-tight",R),...E}));bo.displayName="CardTitle";const $h=Ae.forwardRef(({className:R,...E},z)=>q.jsx("p",{ref:z,className:wo("text-sm text-muted-foreground",R),...E}));$h.displayName="CardDescription";const Ra=Ae.forwardRef(({className:R,...E},z)=>q.jsx("div",{ref:z,className:wo("p-6 pt-0",R),...E}));Ra.displayName="CardContent";const Dy=Ae.forwardRef(({className:R,...E},z)=>q.jsx("div",{ref:z,className:wo("flex items-center p-6 pt-0",R),...E}));Dy.displayName="CardFooter";const Ly=Mg("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Kl({className:R,variant:E,...z}){return q.jsx("div",{className:wo(Ly({variant:E}),R),...z})}/**
50 * @license lucide-react v0.544.0 - ISC
51 *
52 * This source code is licensed under the ISC license.
53 * See the LICENSE file in the root directory of this source tree.
54 */const By=R=>R.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Oy=R=>R.replace(/^([A-Z])|[\s-_]+(\w)/g,(E,z,I)=>I?I.toUpperCase():z.toLowerCase()),lg=R=>{const E=Oy(R);return E.charAt(0).toUpperCase()+E.slice(1)},Bg=(...R)=>R.filter((E,z,I)=>!!E&&E.trim()!==""&&I.indexOf(E)===z).join(" ").trim(),jy=R=>{for(const E in R)if(E.startsWith("aria-")||E==="role"||E==="title")return!0};/**
55 * @license lucide-react v0.544.0 - ISC
56 *
57 * This source code is licensed under the ISC license.
58 * See the LICENSE file in the root directory of this source tree.
59 */var Ny={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
60 * @license lucide-react v0.544.0 - ISC
61 *
62 * This source code is licensed under the ISC license.
63 * See the LICENSE file in the root directory of this source tree.
64 */const Fy=Ae.forwardRef(({color:R="currentColor",size:E=24,strokeWidth:z=2,absoluteStrokeWidth:I,className:V="",children:X,iconNode:A,...u},H)=>Ae.createElement("svg",{ref:H,...Ny,width:E,height:E,stroke:R,strokeWidth:I?Number(z)*24/Number(E):z,className:Bg("lucide",V),...!X&&!jy(u)&&{"aria-hidden":"true"},...u},[...A.map(([ne,se])=>Ae.createElement(ne,se)),...Array.isArray(X)?X:[X]]));/**
65 * @license lucide-react v0.544.0 - ISC
66 *
67 * This source code is licensed under the ISC license.
68 * See the LICENSE file in the root directory of this source tree.
69 */const Pn=(R,E)=>{const z=Ae.forwardRef(({className:I,...V},X)=>Ae.createElement(Fy,{ref:X,iconNode:E,className:Bg(`lucide-${By(lg(R))}`,`lucide-${R}`,I),...V}));return z.displayName=lg(R),z};/**
70 * @license lucide-react v0.544.0 - ISC
71 *
72 * This source code is licensed under the ISC license.
73 * See the LICENSE file in the root directory of this source tree.
74 */const Uy=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Em=Pn("arrow-left",Uy);/**
75 * @license lucide-react v0.544.0 - ISC
76 *
77 * This source code is licensed under the ISC license.
78 * See the LICENSE file in the root directory of this source tree.
79 */const Vy=[["path",{d:"m15.477 12.89 1.515 8.526a.5.5 0 0 1-.81.47l-3.58-2.687a1 1 0 0 0-1.197 0l-3.586 2.686a.5.5 0 0 1-.81-.469l1.514-8.526",key:"1yiouv"}],["circle",{cx:"12",cy:"8",r:"6",key:"1vp47v"}]],Dm=Pn("award",Vy);/**
80 * @license lucide-react v0.544.0 - ISC
81 *
82 * This source code is licensed under the ISC license.
83 * See the LICENSE file in the root directory of this source tree.
84 */const Gy=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],Zy=Pn("chart-column",Gy);/**
85 * @license lucide-react v0.544.0 - ISC
86 *
87 * This source code is licensed under the ISC license.
88 * See the LICENSE file in the root directory of this source tree.
89 */const qy=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],$y=Pn("check",qy);/**
90 * @license lucide-react v0.544.0 - ISC
91 *
92 * This source code is licensed under the ISC license.
93 * See the LICENSE file in the root directory of this source tree.
94 */const Hy=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Xy=Pn("chevron-right",Hy);/**
95 * @license lucide-react v0.544.0 - ISC
96 *
97 * This source code is licensed under the ISC license.
98 * See the LICENSE file in the root directory of this source tree.
99 */const Yy=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Og=Pn("clock",Yy);/**
100 * @license lucide-react v0.544.0 - ISC
101 *
102 * This source code is licensed under the ISC license.
103 * See the LICENSE file in the root directory of this source tree.
104 */const Ky=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],Wy=Pn("download",Ky);/**
105 * @license lucide-react v0.544.0 - ISC
106 *
107 * This source code is licensed under the ISC license.
108 * See the LICENSE file in the root directory of this source tree.
109 */const Qy=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]],qu=Pn("map-pin",Qy);/**
110 * @license lucide-react v0.544.0 - ISC
111 *
112 * This source code is licensed under the ISC license.
113 * See the LICENSE file in the root directory of this source tree.
114 */const Jy=[["path",{d:"M7.21 15 2.66 7.14a2 2 0 0 1 .13-2.2L4.4 2.8A2 2 0 0 1 6 2h12a2 2 0 0 1 1.6.8l1.6 2.14a2 2 0 0 1 .14 2.2L16.79 15",key:"143lza"}],["path",{d:"M11 12 5.12 2.2",key:"qhuxz6"}],["path",{d:"m13 12 5.88-9.8",key:"hbye0f"}],["path",{d:"M8 7h8",key:"i86dvs"}],["circle",{cx:"12",cy:"17",r:"5",key:"qbz8iq"}],["path",{d:"M12 18v-2h-.5",key:"fawc4q"}]],Lm=Pn("medal",Jy);/**
115 * @license lucide-react v0.544.0 - ISC
116 *
117 * This source code is licensed under the ISC license.
118 * See the LICENSE file in the root directory of this source tree.
119 */const ex=[["polygon",{points:"3 11 22 2 13 21 11 13 3 11",key:"1ltx0t"}]],tx=Pn("navigation",ex);/**
120 * @license lucide-react v0.544.0 - ISC
121 *
122 * This source code is licensed under the ISC license.
123 * See the LICENSE file in the root directory of this source tree.
124 */const ix=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],rx=Pn("play",ix);/**
125 * @license lucide-react v0.544.0 - ISC
126 *
127 * This source code is licensed under the ISC license.
128 * See the LICENSE file in the root directory of this source tree.
129 */const nx=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],ax=Pn("refresh-cw",nx);/**
130 * @license lucide-react v0.544.0 - ISC
131 *
132 * This source code is licensed under the ISC license.
133 * See the LICENSE file in the root directory of this source tree.
134 */const sx=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],ox=Pn("rotate-ccw",sx);/**
135 * @license lucide-react v0.544.0 - ISC
136 *
137 * This source code is licensed under the ISC license.
138 * See the LICENSE file in the root directory of this source tree.
139 */const lx=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],cx=Pn("settings",lx);/**
140 * @license lucide-react v0.544.0 - ISC
141 *
142 * This source code is licensed under the ISC license.
143 * See the LICENSE file in the root directory of this source tree.
144 */const ux=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],hx=Pn("share-2",ux);/**
145 * @license lucide-react v0.544.0 - ISC
146 *
147 * This source code is licensed under the ISC license.
148 * See the LICENSE file in the root directory of this source tree.
149 */const dx=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],fx=Pn("target",dx);/**
150 * @license lucide-react v0.544.0 - ISC
151 *
152 * This source code is licensed under the ISC license.
153 * See the LICENSE file in the root directory of this source tree.
154 */const px=[["path",{d:"M10 14.66v1.626a2 2 0 0 1-.976 1.696A5 5 0 0 0 7 21.978",key:"1n3hpd"}],["path",{d:"M14 14.66v1.626a2 2 0 0 0 .976 1.696A5 5 0 0 1 17 21.978",key:"rfe1zi"}],["path",{d:"M18 9h1.5a1 1 0 0 0 0-5H18",key:"7xy6bh"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M6 9a6 6 0 0 0 12 0V3a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1z",key:"1mhfuq"}],["path",{d:"M6 9H4.5a1 1 0 0 1 0-5H6",key:"tex48p"}]],ol=Pn("trophy",px);/**
155 * @license lucide-react v0.544.0 - ISC
156 *
157 * This source code is licensed under the ISC license.
158 * See the LICENSE file in the root directory of this source tree.
159 */const mx=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],gx=Pn("user",mx);/**
160 * @license lucide-react v0.544.0 - ISC
161 *
162 * This source code is licensed under the ISC license.
163 * See the LICENSE file in the root directory of this source tree.
164 */const _x=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],yx=Pn("users",_x);/**
165 * @license lucide-react v0.544.0 - ISC
166 *
167 * This source code is licensed under the ISC license.
168 * See the LICENSE file in the root directory of this source tree.
169 */const xx=[["path",{d:"M18 6 6 18",key:"1bl5f8"}
169],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],vx=Pn("x",xx),jg=Ae.memo(({onPlayCity:R,onViewLeaderboard:E,cityScores:z})=>q.jsx("div",{className:"w-full",children:q.jsx("div",{className:"relative",children:q.jsxs("div",{className:"flex gap-4 overflow-x-auto pb-4 scrollbar-hide snap-x snap-mandatory",style:{scrollSnapType:"x mandatory"},children:[Yf.map(I=>{const V=z?.[I.name]||0;return q.jsxs(Ia,{className:"flex-shrink-0 w-64 h-42 bg-gradient-to-br from-gray-50 to-gray-100 hover:from-gray-100 hover:to-gray-200 transition-all duration-200 cursor-pointer group flex flex-col snap-start",onClick:()=>R(I.name),children:[q.jsx(vo,{className:"pb-2",children:q.jsx(bo,{className:"text-lg font-semibold text-gray-800 text-center",children:I.name})}),q.jsxs(Ra,{className:"flex-1 flex flex-col justify-between",children:[q.jsx("div",{className:"text-center",children:q.jsxs("div",{className:"flex items-center justify-center gap-2",children:[q.jsx(ol,{className:"w-4 h-4 text-yellow-600"}),q.jsx("span",{className:"text-sm font-semibold text-gray-800",children:V.toLocaleString()})]})}),q.jsxs("div",{className:"flex gap-2",children:[q.jsxs(kr,{size:"sm",className:"flex-1 bg-black text-white hover:bg-gray-800 group-hover:bg-gray-700 transition-colors",onClick:X=>{X.stopPropagation(),R(I.name)},children:[q.jsx(rx,{className:"w-4 h-4 mr-2"}),"Play"]}),q.jsx(kr,{size:"sm",variant:"outline",className:"px-3",onClick:X=>{X.stopPropagation(),E(I.name)},children:q.jsx(Zy,{className:"w-4 h-4"})})]})]})]},I.name)}),q.jsx("div",{className:"flex-shrink-0 w-64 h-42 flex flex-col items-center justify-center bg-gradient-to-br from-gray-50 to-gray-100 border-2 border-dashed border-gray-300 rounded-lg snap-start",children:q.jsxs("div",{className:"text-center space-y-3",children:[q.jsx("div",{className:"w-12 h-12 mx-auto bg-gray-200 rounded-full flex items-center justify-center",children:q.jsx("span",{className:"text-2xl",children:"⋯"})}),q.jsxs("div",{children:[q.jsx("h3",{className:"text-lg font-semibold text-gray-700 mb-1",children:"More Cities"}),q.jsx("p",{className:"text-sm text-gray-500",children:"Coming Soon"})]})]})})]})})}));jg.displayName="CityCarousel";function $d({className:R,size:E="md"}){const z={sm:"h-4 w-4",md:"h-6 w-6",lg:"h-8 w-8"};return q.jsx("div",{className:wo("animate-spin rounded-full border-2 border-gray-300 border-t-blue-600",z[E],R)})}const bx={apiUrl:"https://gebeta-geogussr-backend.onrender.com/api",gebetaMapsApiKey:"Anonymous"},{apiUrl:wx,gebetaMapsApiKey:Bm}=bx;class Sx{baseUrl;constructor(){this.baseUrl=wx}async submitScore(E,z){const I=await fetch(`${this.baseUrl}/scores`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...E,initData:z})});if(!I.ok){const V=await I.json();throw new Error(V.error||"Failed to submit score")}return I.json()}async getGlobalLeaderboard(E=100,z){const I=new URLSearchParams({limit:E.toString()});z&&I.append("gameMode",z);const V=await fetch(`${this.baseUrl}/leaderboard?${I}`);if(!V.ok){const X=await V.json();throw new Error(X.error||"Failed to fetch leaderboard")}return V.json()}async getCityLeaderboard(E,z=50){const I=new URLSearchParams({city:E,limit:z.toString()}),V=await fetch(`${this.baseUrl}/leaderboard/city?${I}`);if(!V.ok){const X=await V.json();throw new Error(X.error||"Failed to fetch city leaderboard")}return V.json()}async getUserLeaderboard(E,z=100){const I=new URLSearchParams({userId:E.toString(),limit:z.toString()}),V=await fetch(`${this.baseUrl}/leaderboard?${I}`);if(!V.ok){const X=await V.json();throw new Error(X.error||"Failed to fetch user leaderboard")}return V.json()}}const Kf=new Sx,Ng=(R,E=40)=>{const z=R.toLowerCase().replace(/[^a-z0-9]/g,""),I="https://api.dicebear.com/7.x/notionists-neutral/svg",V=new URLSearchParams({seed:z||"default",size:E.toString(),backgroundColor:"transparent",format:"svg"});return`${I}?${V.toString()}`},Fg=(R,E)=>{const z=`${R}${E?` ${E}`:""}`;return Ng(z)};function Tx({onViewFull:R}){const[E,z]=Ae.useState([]),[I,V]=Ae.useState(!0),[X,A]=Ae.useState(!1),[u,H]=Ae.useState(null);Ae.useEffect(()=>{ne()},[]);const ne=async(Fe=!1)=>{try{Fe?A(!0):V(!0),H(null);const He=await Kf.getGlobalLeaderboard(5,"all");z(He.leaderboard)}catch(He){console.error("Failed to load leaderboard:",He),H("Failed to load leaderboard")}finally{V(!1),A(!1)}},se=()=>{ne(!0)},we=Fe=>Fe===1?q.jsx(ol,{className:"w-3 h-3 text-black"}):Fe===2?q.jsx(Lm,{className:"w-3 h-3 text-gray-600"}):Fe===3?q.jsx(Dm,{className:"w-3 h-3 text-gray-600"}):q.jsxs("span",{className:"w-3 h-3 flex items-center justify-center text-xs font-bold text-gray-500",children:["#",Fe]}
169),Ce=Fe=>Fe.toLocaleString(),ie=Fe=>Fe>=950?{tier:"Perfect!",color:"bg-black text-white"}:Fe>=800?{tier:"Excellent",color:"bg-gray-800 text-white"}:Fe>=600?{tier:"Great",color:"bg-gray-600 text-white"}:Fe>=400?{tier:"Good",color:"bg-gray-400 text-black"}:Fe>=200?{tier:"Fair",color:"bg-gray-300 text-black"}:{tier:"Miss",color:"bg-gray-200 text-black"};return q.jsxs(Ia,{className:"w-full",children:[q.jsx(vo,{className:"pb-2",children:q.jsxs("div",{className:"flex items-center justify-between",children:[q.jsxs(bo,{className:"text-sm flex items-center gap-1 font-medium",children:[q.jsx(ol,{className:"w-4 h-4 text-black"}),"Top Scores"]}),q.jsxs("div",{className:"flex items-center gap-1",children:[q.jsx(kr,{variant:"ghost",size:"sm",onClick:se,disabled:X,className:"flex items-center gap-1 text-xs text-gray-600 hover:text-black",children:q.jsx(ax,{className:`w-3 h-3 ${X?"animate-spin":""}`})}),q.jsxs(kr,{variant:"ghost",size:"sm",onClick:R,className:"flex items-center gap-1 text-xs text-gray-600 hover:text-black",children:["View All",q.jsx(Xy,{className:"w-3 h-3"})]})]})]})}),q.jsx(Ra,{className:"space-y-1",children:I?q.jsxs("div",{className:"flex items-center justify-center py-3",children:[q.jsx($d,{size:"sm"}),q.jsx("span",{className:"ml-2 text-xs text-gray-500",children:"Loading..."})]}):u?q.jsxs("div",{className:"text-center py-3 text-gray-500 text-xs",children:[q.jsx("p",{children:u}),q.jsx(kr,{variant:"outline",size:"sm",onClick:()=>ne(!0),className:"mt-2 text-xs",children:"Retry"})]}):E.length===0?q.jsxs("div",{className:"text-center py-3 text-gray-500",children:[q.jsx(ol,{className:"w-6 h-6 mx-auto mb-1 text-gray-300"}),q.jsx("p",{className:"text-xs",children:"No scores yet. Be the first!"})]}):q.jsx("div",{className:"space-y-1",children:E.map((Fe,He)=>q.jsxs("div",{className:"flex items-center justify-between p-2 rounded bg-gray-50",children:[q.jsxs("div",{className:"flex items-center gap-2",children:[q.jsx("div",{className:"flex items-center justify-center w-4",children:we(Fe.rank||He+1)}),q.jsx("div",{className:"w-5 h-5 rounded-full overflow-hidden flex-shrink-0",children:q.jsx("img",{src:Fe.photo_url||Fg(Fe.firstName,Fe.lastName),alt:`${Fe.firstName} avatar`,className:"w-full h-full object-cover"})}),q.jsxs("div",{className:"min-w-0 flex-1",children:[q.jsxs("div",{className:"text-xs font-medium truncate",children:[Fe.firstName," ",Fe.lastName||""]}),q.jsxs("div",{className:"text-xs text-gray-500 flex items-center gap-1",children:[q.jsx(qu,{className:"w-2 h-2"}),Fe.city]})]})]}),q.jsxs("div",{className:"text-right",children:[q.jsx("div",{className:"text-xs font-bold",children:Ce(Fe.score)}),q.jsx(Kl,{className:`text-xs ${ie(Fe.score).color}`,children:ie(Fe.score).tier})]})]},Fe._id))})})]})}function Mx({}){const[R,E]=Ae.useState("global"),[z,I]=Ae.useState("all"),[V,X]=Ae.useState("Addis Ababa"),[A,u]=Ae.useState([]),[H,ne]=Ae.useState(null),[se,we]=Ae.useState(!1),[Ce,ie]=Ae.useState(null),Fe=["Addis Ababa","Dire Dawa","Bahir Dar","Gondar","Mekelle","Hawassa","Jimma","Harar","Jijiga","Arba Minch"];Ae.useEffect(()=>{He()},[R,z,V]);const He=async()=>{we(!0),ie(null);try{let Ze;switch(R){case"global":Ze=await Kf.getGlobalLeaderboard(100,z==="all"?void 0:z);break;case"city":Ze=await Kf.getCityLeaderboard(V,50);break;default:return}u(Ze.leaderboard||[]),ne(Ze.userBestScore||null)}catch(Ze){console.error("Error loading leaderboard:",Ze),u([]),ne(null),ie(null)}finally{we(!1)}},xe=Ze=>Ze===1?q.jsx(ol,{className:"w-4 h-4 text-black"}):Ze===2?q.jsx(Lm,{className:"w-4 h-4 text-gray-600"}):Ze===3?q.jsx(Dm,{className:"w-4 h-4 text-gray-600"}):q.jsxs("span",{className:"w-4 h-4 flex items-center justify-center text-xs font-bold text-gray-500",children:["#",Ze]}),et=Ze=>Ze.toLocaleString(),qe=Ze=>Ze?Ze<1?`${Math.round(Ze*1e3)}m`:`${Ze.toFixed(1)}km`:"N/A",tt=Ze=>{const _t=new Date(Ze),xt=new Date().getTime()-_t.getTime(),Gt=Math.floor(xt/(1e3*60*60*24));return Gt===0?"Today":Gt===1?"Yesterday":Gt<7?`${Gt} days ago`:_t.toLocaleDateString()},ut=Ze=>Ze>=950?{tier:"Perfect!",color:"bg-black text-white"}:Ze>=800?{tier:"Excellent",color:"bg-gray-800 text-white"}:Ze>=600?{tier:"Great",color:"bg-gray-600 text-white"}:Ze>
169=400?{tier:"Good",color:"bg-gray-400 text-black"}:Ze>=200?{tier:"Fair",color:"bg-gray-300 text-black"}:{tier:"Miss",color:"bg-gray-200 text-black"};return q.jsxs("div",{className:"space-y-4",children:[q.jsx("div",{className:"flex space-x-1 border-b border-gray-200",children:[{key:"global",label:"Global",icon:yx},{key:"city",label:"City",icon:qu}].map(({key:Ze,label:_t,icon:Tt})=>q.jsxs(kr,{variant:"ghost",size:"sm",onClick:()=>E(Ze),className:`flex items-center gap-1 text-xs px-3 py-2 ${R===Ze?"bg-black text-white":"text-gray-600"}`,children:[q.jsx(Tt,{className:"w-3 h-3"}),_t]},Ze))}),q.jsxs("div",{className:"flex flex-wrap gap-1",children:[R==="global"&&q.jsx("div",{className:"flex gap-1",children:["all","random","city"].map(Ze=>q.jsx(kr,{variant:"outline",size:"sm",onClick:()=>I(Ze),className:`text-xs px-2 py-1 ${z===Ze?"bg-black text-white border-black":"border-gray-300 text-gray-600"}`,children:Ze==="all"?"All":Ze==="random"?"Random":"City"},Ze))}),R==="city"&&q.jsx("div",{className:"flex gap-1",children:q.jsx("select",{value:V,onChange:Ze=>X(Ze.target.value),className:"px-2 py-1 border border-gray-300 rounded text-xs bg-white",children:Fe.map(Ze=>q.jsx("option",{value:Ze,children:Ze},Ze))})})]}),H&&q.jsx(Ia,{className:"bg-gray-50 border border-gray-200",children:q.jsx(Ra,{className:"p-3",children:q.jsxs("div",{className:"flex items-center justify-between",children:[q.jsxs("div",{className:"flex items-center gap-2",children:[q.jsx("div",{className:"w-6 h-6 rounded-full bg-black flex items-center justify-center text-white font-bold text-xs",children:"YOU"}),q.jsxs("div",{children:[q.jsx("div",{className:"text-sm font-medium",children:"Your Best Score"}),q.jsxs("div",{className:"text-xs text-gray-600",children:[H.city," • ",qe(H.distance)]})]})]}),q.jsxs("div",{className:"text-right",children:[q.jsx("div",{className:"text-lg font-bold text-black",children:et(H.score)}),q.jsx(Kl,{className:`text-xs ${ut(H.score).color}`,children:ut(H.score).tier})]})]})})}),se&&q.jsxs("div",{className:"flex items-center justify-center py-6",children:[q.jsx($d,{size:"md"}),q.jsx("span",{className:"ml-2 text-sm text-gray-600",children:"Loading..."})]}),Ce&&q.jsxs("div",{className:"text-center py-6 text-gray-600",children:[q.jsx("p",{className:"text-sm",children:Ce}),q.jsx(kr,{variant:"outline",size:"sm",onClick:He,className:"mt-2 text-xs",children:"Try Again"})]}),!se&&!Ce&&q.jsx("div",{className:"space-y-1 max-h-96 overflow-y-auto",children:A.length===0?q.jsxs("div",{className:"text-center py-6 text-gray-500",children:[q.jsx(ol,{className:"w-8 h-8 mx-auto mb-2 text-gray-300"}),q.jsx("p",{className:"text-sm",children:"No scores yet. Be the first to play!"})]}):A.map((Ze,_t)=>q.jsx(Ia,{className:`${_t<3?"border-black bg-gray-50":"border-gray-200"}`,children:q.jsx(Ra,{className:"p-3",children:q.jsxs("div",{className:"flex items-center justify-between",children:[q.jsxs("div",{className:"flex items-center gap-2",children:[q.jsx("div",{className:"flex items-center justify-center w-6",children:xe(Ze.rank||_t+1)}),q.jsx("div",{className:"w-6 h-6 rounded-full overflow-hidden flex-shrink-0",children:q.jsx("img",{src:Ze.photo_url||Fg(Ze.firstName,Ze.lastName),alt:`${Ze.firstName} avatar`,className:"w-full h-full object-cover"})}),q.jsxs("div",{className:"min-w-0 flex-1",children:[q.jsxs("div",{className:"text-sm font-medium truncate",children:[Ze.firstName," ",Ze.lastName||""]}),q.jsxs("div",{className:"text-xs text-gray-600 flex items-center gap-1",children:[q.jsx(qu,{className:"w-3 h-3"}),Ze.city,q.jsx(Og,{className:"w-3 h-3 ml-1"}),tt(Ze.timestamp)]})]})]}),q.jsxs("div",{className:"text-right",children:[q.jsx("div",{className:"text-sm font-bold text-black",children:et(Ze.score)}),q.jsx("div",{className:"text-xs text-gray-600",children:qe(Ze.distance)}),q.jsx(Kl,{className:`text-xs ${ut(Ze.score).color}`,children:ut(Ze.score).tier})]})]})})},Ze._id))})]})}const cg=["Happy","Clever","Swift","Bright","Bold","Wise","Kind","Brave","Calm","Wild"],ug=["Explorer","Navigator","Traveler","Wanderer","Seeker","Adventurer","Pioneer","Discoverer","Scout","Ranger"];function hg(){const R=cg[Math.floor(Math.random()*cg.length)],E=ug[Math.floor(Math.random()*ug.length)],z=Math.floor(Math.random()*999)+1;return`${R}${E}${z}`}function dg(R){return Ng(R,40)}function fg(){return localStorage.getItem("gebeta_user_name")}function pg(R){localStorage.setItem("gebeta_user_name",R)}const Ug=Ae.createContext(null),Qp=()=>{const R=Ae.useContext(Ug);if(!R)throw new Error("useTelegram must be used within a TelegramProvider");return R},Cx=({children:R})=>{const[E,z]=Ae.useState(null),[I,V]=Ae.useState(null),[X,A]=Ae.useState(!1);Ae.useEffect(()=>{const xe=()=>{console.log("Checking for Telegram WebApp..."),console.log("window.Telegram:",window.Telegram),console.log("window.Telegram?.WebApp:",window.Telegram?.WebApp),console.log("Document ready state:",document.readyState);let _t=null;if(typeof window<"u"&&window.Telegram?.WebApp){const Tt=window.Telegram.WebApp;Tt.initData&&Tt.initDataUnsafe&&Tt.platform?(_t=Tt,console.log("Telegram WebApp detected via direct check!")):console.log("Telegram WebApp script loaded but not in Telegram environment")}if(!_t&&typeof window<"u"&&window.Telegram?.WebApp)try{const Tt=window.Telegram.WebApp;Tt.expand(),Tt.initData&&Tt.initDataUnsafe&&Tt.platform&&(_t=Tt,console.log("Telegram WebApp detected via expand() method!"))}catch(Tt){console.log("expand() method failed:",Tt)}if(!_t&&typeof window<"u"&&window.Telegram){const Tt=window.Telegram,xt=Tt.WebApp||Tt.webApp;xt&&xt.initData&&xt.initDataUnsafe&&xt.platform&&(_t=xt,console.log("Telegram WebApp detected via property check!"))}if(_t){console.log("Telegram WebApp detected:",_t),console.log("Init data unsafe:",_t.initDataUnsafe),console.log("User data:",_t.initDataUnsafe?.user),console.log("Init data:",_t.initData),console.log("Platform:",_t.platform),console.log("Version:",_t.version),_t.ready(),_t.expand(),z(_t);let Tt=_t.initDataUnsafe?.user;if(!Tt&&_t.initData)try{const hi=new URLSearchParams(_t.initData).get("user");hi&&(Tt=JSON.parse(decodeURIComponent(hi)),console.log("Parsed user data from initData:",Tt))}catch(Gt){console.error("Error parsing user data from initData:",Gt)}if(Tt)console.log("Setting real user data:",Tt),V(Tt);else{console.log("No user data found in Telegram WebApp - using random name");let Gt=fg();Gt||(Gt=hg(),pg(Gt));const hi={id:999999999,first_name:Gt,last_name:"",language_code:"en",is_premium:!1,photo_url:dg(Gt)};V(hi)}A(!0),document.body.style.backgroundColor=_t.themeParams.bg_color||"#ffffff";const xt=()=>{document.body.style.backgroundColor=_t.themeParams.bg_color||"#ffffff"};return _t.onEvent("themeChanged",xt),()=>{_t.offEvent("themeChanged",xt)}}else{console.log("Not in Telegram WebApp"),console.log("Production mode:",!0),console.log("Simulate production:",!1);{console.log("Using development mode with random name");let Gt=fg();Gt||(Gt=hg(),pg(Gt));const hi={id:Math.floor(Math.random()*1e6)+1e5,first_name:Gt,last_name:"",language_code:"en",is_premium:!1,photo_url:dg(Gt)};V(hi)}A(!0)}};xe();const et=[setTimeout(()=>{E||(console.log("Retrying Telegram WebApp detection after 500ms"),xe())},500),setTimeout(()=>{E||(console.log("Retrying Telegram WebApp detection after 1000ms"),xe())},1e3),setTimeout(()=>{E||(console.log("Retrying Telegram WebApp detection after 2000ms"),xe())},2e3),setTimeout(()=>{E||(console.log("Retrying Telegram WebApp detection after 5000ms"),xe())},5e3)],qe=()=>{E||(console.log("Retrying Telegram WebApp detection on window load"),xe())},tt=()=>{E||(console.log("Retrying Telegram WebApp detection on DOMContentLoaded"),xe())};window.addEventListener("load",qe),document.addEventListener("DOMContentLoaded",tt);const ut=()=>{!E&&window.Telegram?.WebApp&&(console.log("Telegram script loaded, retrying detection"),xe())},Ze=setInterval(()=>{window.Telegram?.WebApp&&(clearInterval(Ze),ut())},100);return setTimeout(()=>clearInterval(Ze),1e4),()=>{et.forEach(_t=>clearTimeout(_t)),window.removeEventListener("load",qe),document.removeEventListener("DOMContentLoaded",tt),clearInterval(Ze)}},[]);const He={webApp:E,user:I,isReady:X,expand:()=>{E&&E.expand()},close:()=>{E&&E.close()},showAlert:xe=>{E?E.showAlert(xe):alert(xe)},showConfirm:(xe,et)=>{if(E)E.showConfirm(xe,et);else{const qe=confirm(xe);et&&et(qe)}},showPopup:(xe,et)=>{E?E.showPopup(xe,et):(alert(xe.message),et&&et("ok"))},hapticFeedback:{impactOccurred:xe=>{E&&E.HapticFeedback.impactOccurred(xe)},notificationOccurred:xe=>{E&&E.HapticFeedback.notificationOccurred(xe)},selectionChanged:()=>{E&&E.HapticFeedback.selectionChanged()}},sendData:xe=>{E&&E.sendData(xe)},ready:()=>{E&&E.ready()}};return q.jsx(Ug.Provider,{value:He,children:R})},Vg=Ae.memo(({onStartGame:R,onStartSpecificCity:E,onOpenSettings:z,onOpenCityLeaderboard:I,bestScore:V,cityScores:X})=>{const[A,u]=Ae.useState(!1),[H,ne]=Ae.useState(!1),[se,we]=Ae.useState(0),{user:Ce,hapticFeedback:ie}=Qp();Ae.useEffect(()=>{!A&&!H&&we(ut=>ut+1)},[A,H]);const Fe=ut=>{ie.selectionChanged(),E(ut),u(!1)},He=()=>{ie.impactOccurred("medium"),R()},xe=()=>{ie.selectionChanged(),z()},et=()=>{ie.selectionChanged(),u(!0)},qe=()=>{ie.selectionChanged(),ne(!0)},tt=()=>{ie.selectionChanged(),ne(!1)};return A?q.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center p-4",children:q.jsxs(Ia,{className:"w-full max-w-md mx-auto 
169shadow-lg",children:[q.jsxs(vo,{className:"pb-4",children:[q.jsxs("div",{className:"flex items-center gap-3",children:[q.jsx(kr,{variant:"ghost",size:"sm",onClick:()=>u(!1),className:"text-gray-600 hover:text-black",children:q.jsx(Em,{className:"w-4 h-4"})}),q.jsxs(bo,{className:"text-2xl font-bold text-black flex items-center gap-2",children:[q.jsx(qu,{className:"w-6 h-6"}),"Choose a City"]})]}),q.jsx($h,{className:"text-gray-600 mt-3",children:"Select a city to play a specific location"})]}),q.jsx(Ra,{className:"px-6 pb-6",children:q.jsx(jg,{onPlayCity:Fe,onViewLeaderboard:I,cityScores:X})})]})}):H?q.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center p-4",children:q.jsxs(Ia,{className:"w-full max-w-4xl mx-auto shadow-lg",children:[q.jsxs(vo,{className:"pb-4",children:[q.jsxs("div",{className:"flex items-center gap-3",children:[q.jsx(kr,{variant:"ghost",size:"sm",onClick:tt,className:"text-gray-600 hover:text-black",children:q.jsx(Em,{className:"w-4 h-4"})}),q.jsxs(bo,{className:"text-2xl font-bold text-black flex items-center gap-2",children:[q.jsx(ol,{className:"w-6 h-6"}),"Leaderboard"]})]}),q.jsx($h,{className:"text-gray-600 mt-3",children:"View global and city-specific rankings"})]}),q.jsx(Ra,{className:"px-6 pb-6",children:q.jsx(Mx,{onClose:tt})})]})}):q.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center p-4",children:q.jsxs(Ia,{className:"w-full max-w-md mx-auto shadow-lg",children:[q.jsxs(vo,{className:"text-center space-y-4",children:[q.jsxs("div",{className:"flex justify-between items-start",children:[q.jsx(kr,{variant:"ghost",size:"sm",onClick:xe,className:"text-gray-600 hover:text-black",children:q.jsx(cx,{className:"w-4 h-4"})}),q.jsx("div",{className:"mx-auto w-16 h-16 bg-black rounded-full flex items-center justify-center",children:q.jsx("img",{src:"/logo.svg",alt:"Gebeta",className:"w-8 h-8"})}),q.jsx("div",{className:"w-8"})," "]}),q.jsx(bo,{className:"text-3xl font-bold text-black",children:"Guess the Place"}),q.jsx($h,{className:"text-lg text-gray-600",children:"Can you recognize a corner of Ethiopia just from its roads?"}),Ce&&q.jsxs("div",{className:"flex items-center justify-center gap-2 p-3 bg-gray-100 rounded-lg",children:[q.jsx(gx,{className:"w-4 h-4 text-gray-600"}),q.jsxs("span",{className:"text-sm font-medium text-gray-700",children:["Welcome, ",Ce.first_name,Ce.username&&Ce.id!==999999999&&` (@${Ce.username})`]})]})]}),q.jsxs(Ra,{className:"space-y-4",children:[q.jsxs(kr,{onClick:He,size:"lg",className:"w-full h-12 text-lg font-semibold bg-black text-white hover:bg-gray-800",children:[q.jsx(tx,{className:"w-5 h-5 mr-2"}),"Random Place"]}),q.jsxs(kr,{onClick:et,variant:"outline",size:"lg",className:"w-full h-12 text-lg font-semibold",children:[q.jsx(qu,{className:"w-5 h-5 mr-2"}),"Choose City"]}),q.jsx("div",{className:"flex justify-center space-x-2 text-sm text-gray-600",children:q.jsxs(Kl,{variant:"secondary",className:"flex items-center gap-1",children:[q.jsx(ol,{className:"w-3 h-3"}),"Best Score: ",V]})}),q.jsx(Tx,{onViewFull:qe},se),q.jsx("div",{className:"flex justify-center mt-4",children:q.jsx("span",{className:"text-xs text-gray-400",children:"Powered by Gebeta"})})]})]})})});Vg.displayName="MainMenu";const Gg=Ae.memo(()=>q.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center p-4",children:q.jsxs(Ia,{className:"w-full max-w-md mx-auto shadow-lg",children:[q.jsxs(vo,{className:"text-center space-y-4",children:[q.jsx("div",{className:"flex justify-center",children:q.jsx("div",{className:"w-16 h-16 bg-black rounded-full flex items-center justify-center",children:q.jsx("img",{src:"/logo.svg",alt:"Gebeta",className:"w-8 h-8"})})}),q.jsxs(bo,{className:"text-2xl font-bold text-black flex items-center justify-center gap-2",children:[q.jsx(qu,{className:"w-6 h-6"}),"Preparing Game"]}),q.jsx($h,{className:"text-lg text-gray-600",children:"Loading the map and setting up your challenge..."})]}),q.jsxs(Ra,{className:"space-y-6",children:[q.jsxs("div",{className:"flex items-center justify-center space-x-3",children:[q.jsx($d,{size:"md"}),q.jsx("p",{className:"text-sm text-gray-600",children:"Loading map..."})]}),q.jsxs("div",{className:"space-y-2",children:[q.jsxs("div",{className:"flex items-center space-x-2 text-sm text-gray-600",children:[q.jsx("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),q.jsx("span",{children:"Generating random location"})]}),q.jsxs("div",{className:"flex items-center space-x-2 text-sm text-gray-600",children:[q.jsx("div",{className:"w-2 h-2 bg-yellow-500 rounded-full"}),q.jsx("span",{children:"Loading map"})]}),q.jsxs("div",{className:"flex items-center space-x-2 text-sm text-gray-600",children:[q.jsx("div",{className:"w-2 h-2 bg-gray-300 rounded-full"}),q.jsx("span",{children:"Preparing challenge"})]})]})]})]})}));Gg.displayName="PreparingGame";var Yp={exports:{}};/**
170 * MapLibre GL JS
171 * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v5.7.1
171/LICENSE.txt
172 */var Ex=Yp.exports,mg;function Ax(){return mg||(mg=1,(function(R,E){(function(z,I){R.exports=I()})(Ex,(function(){var z={},I={};function V(A,u,H){if(I[A]=H,A==="index"){var ne="var sharedModule = {}; ("+I.shared+")(sharedModule); ("+I.worker+")(sharedModule);",se={};return I.shared(se),I.index(z,se),typeof window<"u"&&z.setWorkerUrl(window.URL.createObjectURL(new Blob([ne],{type:"text/javascript"}))),z}}V("shared",["exports"],(function(A){function u(n,t,r,o){return new(r||(r=Promise))((function(h,g){function _(T){try{b(o.next(T))}catch(C){g(C)}}function x(T){try{b(o.throw(T))}catch(C){g(C)}}function b(T){var C;T.done?h(T.value):(C=T.value,C instanceof r?C:new r((function(D){D(C)}))).then(_,x)}b((o=o.apply(n,t||[])).next())}))}function H(n,t){this.x=n,this.y=t}function ne(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var se,we;typeof SuppressedError=="function"&&SuppressedError,H.prototype={clone(){return new H(this.x,this.y)},add(n){return this.clone()._add(n)},sub(n){return this.clone()._sub(n)},multByPoint(n){return this.clone()._multByPoint(n)},divByPoint(n){return this.clone()._divByPoint(n)},mult(n){return this.clone()._mult(n)},div(n){return this.clone()._div(n)},rotate(n){return this.clone()._rotate(n)},rotateAround(n,t){return this.clone()._rotateAround(n,t)},matMult(n){return this.clone()._matMult(n)},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(n){return this.x===n.x&&this.y===n.y},dist(n){return Math.sqrt(this.distSqr(n))},distSqr(n){const t=n.x-this.x,r=n.y-this.y;return t*t+r*r},angle(){return Math.atan2(this.y,this.x)},angleTo(n){return Math.atan2(this.y-n.y,this.x-n.x)},angleWith(n){return this.angleWithSep(n.x,n.y)},angleWithSep(n,t){return Math.atan2(this.x*t-this.y*n,this.x*n+this.y*t)},_matMult(n){const t=n[2]*this.x+n[3]*this.y;return this.x=n[0]*this.x+n[1]*this.y,this.y=t,this},_add(n){return this.x+=n.x,this.y+=n.y,this},_sub(n){return this.x-=n.x,this.y-=n.y,this},_mult(n){return this.x*=n,this.y*=n,this},_div(n){return this.x/=n,this.y/=n,this},_multByPoint(n){return this.x*=n.x,this.y*=n.y,this},_divByPoint(n){return this.x/=n.x,this.y/=n.y,this},_unit(){return this._div(this.mag()),this},_perp(){const n=this.y;return this.y=this.x,this.x=-n,this},_rotate(n){const t=Math.cos(n),r=Math.sin(n),o=r*this.x+t*this.y;return this.x=t*this.x-r*this.y,this.y=o,this},_rotateAround(n,t){const r=Math.cos(n),o=Math.sin(n),h=t.y+o*(this.x-t.x)+r*(this.y-t.y);return this.x=t.x+r*(this.x-t.x)-o*(this.y-t.y),this.y=h,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:H},H.convert=function(n){if(n instanceof H)return n;if(Array.isArray(n))return new H(+n[0],+n[1]);if(n.x!==void 0&&n.y!==void 0)return new H(+n.x,+n.y);throw new Error("Expected [x, y] or {x, y} point format")};var Ce=(function(){if(we)return se;function n(t,r,o,h){this.cx=3*t,this.bx=3*(o-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*r,this.by=3*(h-r)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=r,this.p2x=o,this.p2y=h}return we=1,se=n,n.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,r){if(r===void 0&&(r=1e-6),t<0)return 0;if(t>1)return 1;for(var o=t,h=0;h<8;h++){var g=this.sampleCurveX(o)-t;if(Math.abs(g)<r)return o;var _=this.sampleCurveDerivativeX(o);if(Math.abs(_)<1e-6)break;o-=g/_}var x=0,b=1;for(o=t,h=0;h<20&&(g=this.sampleCurveX(o),!(Math.abs(g-t)<r));h++)t>g?x=o:b=o,o=.5*(b-x)+x;return o},solve:function(t,r){return this.sampleCurveY(this.solveCurveX(t,r))}},se})(),ie=ne(Ce);let Fe,He;function xe(){return Fe==null&&(Fe=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Fe}function et(){if(He==null&&(He=!1,xe())){const t=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(t){for(let o=0;o<25;o++){const h=4*o;t.fillStyle=`rgb(${h},${h+1},${h+2})`,t.fillRect(o%5,Math.floor(o/5),1,1)}const r=t.getImageData(0,0,5,5).data;for(let o=0;o<100;o++)if(o%4!=3&&r[o]!==o){He=!0;break}}}return He||!1}var qe=1e-6,tt=typeof Float32Array<"u"?Float32Array:Array;function ut(){var n=new tt(9);return tt!=Float32Array&&(n[1]=0,n[2]=0,n[3]=0,n[5]=0,n[6]=0,n[7]=0),n[0]=1,n[4]=1,n[8]=1,n}function Ze(n){return n[0]=1,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=1,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=1,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,n}function _t(){var n=new tt(3);return tt!=Float32Array&&(n[0]=0,n[1]=0,n[2]=0),n}function Tt(n){var t=n[0],r=n[1],o=n[2];return Math.sqrt(t*t+r*r+o*o)}function xt(n,t,r){var o=new tt(3);return o[0]=n,o[1]=t,o[2]=r,o}function Gt(n,t,r){return n[0]=t[0]+r[0],n[1]=t[1]+r[1],n[2]=t[2]+r[2],n}function hi(n,t,r){return n[0]=t[0]*r,n[1]=t[1]*r,n[2]=t[2]*r,n}function mi(n,t,r){var o=t[0],h=t[1],g=t[2],_=r[0],x=r[1],b=r[2];return n[0]=h*b-g*x,n[1]=g*_-o*b,n[2]=o*x-h*_,n}var Jt,fr=Tt;function Ir(n,t,r){var o=t[0],h=t[1],g=t[2],_=t[3];return n[0]=r[0]*o+r[4]*h+r[8]*g+r[12]*_,n[1]=r[1]*o+r[5]*h+r[9]*g+r[13]*_,n[2]=r[2]*o+r[6]*h+r[10]*g+r[14]*_,n[3]=r[3]*o+r[7]*h+r[11]*g+r[15]*_,n}function yi(){var n=new tt(4);return tt!=Float32Array&&(n[0]=0,n[1]=0,n[2]=0),n[3]=1,n}function Ve(n,t,r,o){var h=arguments.length>4&&arguments[4]!==void 0?arguments[4]:"zyx",g=Math.PI/360;t*=g,o*=g,r*=g;var _=Math.sin(t),x=Math.cos(t),b=Math.sin(r),T=Math.cos(r),C=Math.sin(o),D=Math.cos(o);switch(h){case"xyz":n[0]=_*T*D+x*b*C,n[1]=x*b*D-_*T*C,n[2]=x*T*C+_*b*D,n[3]=x*T*D-_*b*C;break;case"xzy":n[0]=_*T*D-x*b*C,n[1]=x*b*D-_*T*C,n[2]=x*T*C+_*b*D,n[3]=x*T*D+_*b*C;break;case"yxz":n[0]=_*T*D+x*b*C,n[1]=x*b*D-_*T*C,n[2]=x*T*C-_*b*D,n[3]=x*T*D+_*b*C;break;case"yzx":n[0]=_*T*D+x*b*C,n[1]=x*b*D+_*T*C,n[2]=x*T*C-_*b*D,n[3]=x*T*D-_*b*C;break;case"zxy":n[0]=_*T*D-x*b*C,n[1]=x*b*D+_*T*C,n[2]=x*T*C+_*b*D,n[3]=x*T*D-_*b*C;break;case"zyx":n[0]=_*T*D-x*b*C,n[1]=x*b*D+_*T*C,n[2]=x*T*C-_*b*D,n[3]=x*T*D+_*b*C;break;default:throw new Error("Unknown angle order "+h)}return n}function ht(){var n=new tt(2);return tt!=Float32Array&&(n[0]=0,n[1]=0),n}function nt(n,t){var r=new tt(2);return r[0]=n,r[1]=t,r}_t(),Jt=new tt(4),tt!=Float32Array&&(Jt[0]=0,Jt[1]=0,Jt[2]=0,Jt[3]=0),_t(),xt(1,0,0),xt(0,1,0),yi(),yi(),ut(),ht();const bt=8192;function _e(n,t,r){return t*(bt/(n.tileSize*Math.pow(2,r-n.tileID.overscaledZ
vendor: 9,441 bytes, line 172
172)))}function Xe(n,t){return(n%t+t)%t}function vt(n,t,r){return n*(1-r)+t*r}function at(n){if(n<=0)return 0;if(n>=1)return 1;const t=n*n,r=t*n;return 4*(n<.5?r:3*(n-t)+r-.75)}function wt(n,t,r,o){const h=new ie(n,t,r,o);return g=>h.solve(g)}const Ft=wt(.25,.1,.25,1);function zt(n,t,r){return Math.min(r,Math.max(t,n))}function di(n,t,r){const o=r-t,h=((n-t)%o+o)%o+t;return h===t?r:h}function si(n,...t){for(const r of t)for(const o in r)n[o]=r[o];return n}let Ji=1;function zn(n,t,r){const o={};for(const h in n)o[h]=t.call(this,n[h],h,n);return o}function kn(n,t,r){const o={};for(const h in n)t.call(this,n[h],h,n)&&(o[h]=n[h]);return o}function xr(n){return Array.isArray(n)?n.map(xr):typeof n=="object"&&n?zn(n,xr):n}const qi={};function $i(n){qi[n]||(typeof console<"u"&&console.warn(n),qi[n]=!0)}function Kn(n,t,r){return(r.y-n.y)*(t.x-n.x)>(t.y-n.y)*(r.x-n.x)}function ha(n){return typeof WorkerGlobalScope<"u"&&n!==void 0&&n instanceof WorkerGlobalScope}let Kr=null;function da(n){return typeof ImageBitmap<"u"&&n instanceof ImageBitmap}const Wn="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function ms(n,t,r,o,h){return u(this,void 0,void 0,(function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");const g=new VideoFrame(n,{timestamp:0});try{const _=g?.format;if(!_||!_.startsWith("BGR")&&!_.startsWith("RGB"))throw new Error(`Unrecognized format ${_}`);const x=_.startsWith("BGR"),b=new Uint8ClampedArray(o*h*4);if(yield g.copyTo(b,(function(T,C,D,O,F){const U=4*Math.max(-C,0),$=(Math.max(0,D)-D)*O*4+U,Q=4*O,re=Math.max(0,C),be=Math.max(0,D);return{rect:{x:re,y:be,width:Math.min(T.width,C+O)-re,height:Math.min(T.height,D+F)-be},layout:[{offset:$,stride:Q}]}})(n,t,r,o,h)),x)for(let T=0;T<b.length;T+=4){const C=b[T];b[T]=b[T+2],b[T+2]=C}return b}finally{g.close()}}))}let Qn,Qa;function Da(n,t,r,o){return n.addEventListener(t,r,o),{unsubscribe:()=>{n.removeEventListener(t,r,o)}}}function gs(n){return n*Math.PI/180}function Yt(n){return n/Math.PI*180}const Ti={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},sr={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0},In="AbortError";function ye(){return new Error(In)}const Z={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function Y(n){return Z.REGISTERED_PROTOCOLS[n.substring(0,n.indexOf("://"))]}const W="global-dispatcher";class ce extends Error{constructor(t,r,o,h){super(`AJAXError: ${r} (${t}): ${o}`),this.status=t,this.statusText=r,this.url=o,this.body=h}}const me=()=>ha(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,ve=function(n,t){if(/:\/\//.test(n.url)&&!/^https?:|^file:/.test(n.url)){const o=Y(n.url);if(o)return o(n,t);if(ha(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:n,targetMapId:W},t)}if(!(/^file:/.test(r=n.url)||/^file:/.test(me())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return(function(o,h){return u(this,void 0,void 0,(function*(){const g=new Request(o.url,{method:o.method||"GET",body:o.body,credentials:o.credentials,headers:o.headers,cache:o.cache,referrer:me(),signal:h.signal});let _,x;o.type!=="json"||g.headers.has("Accept")||g.headers.set("Accept","application/json");try{_=yield fetch(g)}catch(T){throw new ce(0,T.message,o.url,new Blob)}if(!_.ok){const T=yield _.blob();throw new ce(_.status,_.statusText,o.url,T)}x=o.type==="arrayBuffer"||o.type==="image"?_.arrayBuffer():o.type==="json"?_.json():_.text();const b=yield x;if(h.signal.aborted)throw ye();return{data:b,cacheControl:_.headers.get("Cache-Control"),expires:_.headers.get("Expires")}}))})(n,t);if(ha(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:n,mustQueue:!0,targetMapId:W},t)}var r;return(function(o,h){return new Promise(((g,_)=>{var x;const b=new XMLHttpRequest;b.open(o.method||"GET",o.url,!0),o.type!=="arrayBuffer"&&o.type!=="image"||(b.responseType="arraybuffer");for(const T in o.headers)b.setRequestHeader(T,o.headers[T]);o.type==="json"&&(b.responseType="text",!((x=o.headers)===null||x===void 0)&&x.Accept||b.setRequestHeader("Accept","application/json")),b.withCredentials=o.credentials==="include",b.onerror=()=>{_(new Error(b.statusText))},b.onload=()=>{if(!h.signal.aborted)if((b.status>=200&&b.status<300||b.status===0)&&b.response!==null){let T=b.response;if(o.type==="json")try{T=JSON.parse(b.response)}catch(C){return void _(C)}g({data:T,cacheControl:b.getResponseHeader("Cache-Control"),expires:b.getResponseHeader("Expires")})}else{const T=new Blob([b.response],{type:b.getResponseHeader("Content-Type")});_(new ce(b.status,b.statusText,o.url,T))}},h.signal.addEventListener("abort",(()=>{b.abort(),_(ye())})),b.send(o.body)}))})(n,t)};function Re(n){if(!n||n.indexOf("://")<=0||n.indexOf("data:image/")===0||n.indexOf("blob:")===0)return!0;const t=new URL(n),r=window.location;return t.protocol===r.protocol&&t.host===r.host}function Te(n,t,r){r[n]&&r[n].indexOf(t)!==-1||(r[n]=r[n]||[],r[n].push(t))}function Ge(n,t,r){if(r&&r[n]){const o=r[n].indexOf(t);o!==-1&&r[n].splice(o,1)}}class rt{constructor(t,r={}){si(this,r),this.type=t}}class Ye extends rt{constructor(t,r={}){super("error",si({error:t},r))}}class Ct{on(t,r){return this._listeners=this._listeners||{},Te(t,r,this._listeners),{unsubscribe:()=>{this.off(t,r)}}}off(t,r){return Ge(t,r,this._listeners),Ge(t,r,this._oneTimeListeners),this}once(t,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},Te(t,r,this._oneTimeListeners),this):new Promise((o=>this.once(t,o)))}fire(t,r){typeof t=="string"&&(t=new rt(t,r||{}));const o=t.type;if(this.listens(o)){t.target=this;const h=this._listeners&&this._listeners[o]?this._listeners[o].slice():[];for(const x of h)x.call(this,t);const g=this._oneTimeListeners&&this._oneTimeListeners[o]?this._oneTimeListeners[o].slice():[];for(const x of g)Ge(o,x,this._oneTimeListeners),x.call(this,t);const _=this._eventedParent;_&&(si(t,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),_.fire(t))}else t instanceof Ye&&console.error(t.error);return this}listens(t){return this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)}setEventedParent(t,r){return this._eventedParent=t,this._eventedParentData=r,this}}var Me={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},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"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0}
vendor: 1,192 bytes, line 172
172,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
vendor: 8,509 bytes, line 172
172","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}
vendor: 9,097 bytes, line 172
172,"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"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"}
vendor: 7,960 bytes, line 172
172,"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number
172Array",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"}}};const Zt=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function oi(n,t){const r={};for(const o in n)o!=="ref"&&(r[o]=n[o]);return Zt.forEach((o=>{o in t&&(r[o]=t[o])})),r}function kt(n,t){if(Array.isArray(n)){if(!Array.isArray(t)||n.length!==t.length)return!1;for(let r=0;r<n.length;r++)if(!kt(n[r],t[r]))return!1;return!0}if(typeof n=="object"&&n!==null&&t!==null){if(typeof t!="object"||Object.keys(n).length!==Object.keys(t).length)return!1;for(const r in n)if(!kt(n[r],t[r]))return!1;return!0}return n===t}function Kt(n,t){n.push(t)}function Bi(n,t,r){Kt(r,{command:"addSource",args:[n,t[n]]})}function jr(n,t,r){Kt(t,{command:"removeSource",args:[n]}),r[n]=!0}function Zr(n,t,r,o){jr(n,r,o),Bi(n,t,r)}function Fi(n,t,r){let o;for(o in n[r])if(Object.prototype.hasOwnProperty.call(n[r],o)&&o!=="data"&&!kt(n[r][o],t[r][o]))return!1;for(o in t[r])if(Object.prototype.hasOwnProperty.call(t[r],o)&&o!=="data"&&!kt(n[r][o],t[r][o]))return!1;return!0}function Nt(n,t,r,o,h,g){n=n||{},t=t||{};for(const _ in n)Object.prototype.hasOwnProperty.call(n,_)&&(kt(n[_],t[_])||r.push({command:g,args:[o,_,t[_],h]}));for(const _ in t)Object.prototype.hasOwnProperty.call(t,_)&&!Object.prototype.hasOwnProperty.call(n,_)&&(kt(n[_],t[_])||r.push({command:g,args:[o,_,t[_],h]}))}function qt(n){return n.id}function er(n,t){return n[t.id]=t,n}class st{constructor(t,r,o,h){this.message=(t?`${t}: `:"")+o,h&&(this.identifier=h),r!=null&&r.__line__&&(this.line=r.__line__)}}function mn(n,...t){for(const r of t)for(const o in r)n[o]=r[o];return n}
vendor: 91,480 bytes, lines 172-173
172class pr extends Error{constructor(t,r){super(r),this.message=r,this.key=t}}class _s{constructor(t,r=[]){this.parent=t,this.bindings={};for(const[o,h]of r)this.bindings[o]=h}concat(t){return new _s(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error(`${t} not found in scope.`)}has(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)}}const Ja={kind:"null"},gt={kind:"number"},ei={kind:"string"},Ht={kind:"boolean"},Rr={kind:"color"},fa={kind:"projectionDefinition"},tr={kind:"object"},ti={kind:"value"},Wl={kind:"collator"},qn={kind:"formatted"},ys={kind:"padding"},es={kind:"colorArray"},So={kind:"numberArray"},mr={kind:"resolvedImage"},Wc={kind:"variableAnchorOffsetCollection"};function tn(n,t){return{kind:"array",itemType:n,N:t}}function Ei(n){if(n.kind==="array"){const t=Ei(n.itemType);return typeof n.N=="number"?`array<${t}, ${n.N}>`:n.itemType.kind==="value"?"array":`array<${t}>`}return n.kind}const ts=[Ja,gt,ei,Ht,Rr,fa,qn,tr,tn(ti),ys,So,es,mr,Wc];function To(n,t){if(t.kind==="error")return null;if(n.kind==="array"){if(t.kind==="array"&&(t.N===0&&t.itemType.kind==="value"||!To(n.itemType,t.itemType))&&(typeof n.N!="number"||n.N===t.N))return null}else{if(n.kind===t.kind)return null;if(n.kind==="value"){for(const r of ts)if(!To(r,t))return null}}return`Expected ${Ei(n)} but found ${Ei(t)} instead.`}function Qc(n,t){return t.some((r=>r.kind===n.kind))}function Jn(n,t){return t.some((r=>r==="null"?n===null:r==="array"?Array.isArray(n):r==="object"?n&&!Array.isArray(n)&&typeof n=="object":r===typeof n))}function is(n,t){return n.kind==="array"&&t.kind==="array"?n.itemType.kind===t.itemType.kind&&typeof n.N=="number":n.kind===t.kind}const Ql=.96422,Hh=.82521,Hu=4/29,rn=6/29,Xu=3*rn*rn,Xd=rn*rn*rn,Jc=Math.PI/180,Xh=180/Math.PI;function cl(n){return(n%=360)<0&&(n+=360),n}function ul([n,t,r,o]){let h,g;const _=Jl((.2225045*(n=$n(n))+.7168786*(t=$n(t))+.0606169*(r=$n(r)))/1);n===t&&t===r?h=g=_:(h=Jl((.4360747*n+.3850649*t+.1430804*r)/Ql),g=Jl((.0139322*n+.0971045*t+.7141733*r)/Hh));const x=116*_-16;return[x<0?0:x,500*(h-_),200*(_-g),o]}function $n(n){return n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)}function Jl(n){return n>Xd?Math.pow(n,1/3):n/Xu+Hu}function Mo([n,t,r,o]){let h=(n+16)/116,g=isNaN(t)?h:h+t/500,_=isNaN(r)?h:h-r/200;return h=1*Vs(h),g=Ql*Vs(g),_=Hh*Vs(_),[ec(3.1338561*g-1.6168667*h-.4906146*_),ec(-.9787684*g+1.9161415*h+.033454*_),ec(.0719453*g-.2289914*h+1.4052427*_),o]}function ec(n){return(n=n<=.00304?12.92*n:1.055*Math.pow(n,1/2.4)-.055)<0?0:n>1?1:n}function Vs(n){return n>rn?n*n*n:Xu*(n-Hu)}const Yh=Object.hasOwn||function(n,t){return Object.prototype.hasOwnProperty.call(n,t)};function Co(n,t){return Yh(n,t)?n[t]:void 0}function rs(n){return parseInt(n.padEnd(2,n),16)/255}function La(n,t){return li(t?n/100:n,0,1)}function li(n,t,r){return Math.min(Math.max(t,n),r)}function Gs(n){return!n.some(Number.isNaN)}const ns={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 xs(n,t,r){return n+r*(t-n)}function Eo(n,t,r){return n.map(((o,h)=>xs(o,t[h],r)))}class ai{constructor(t,r,o,h=1,g=!0){this.r=t,this.g=r,this.b=o,this.a=h,g||(this.r*=h,this.g*=h,this.b*=h,h||this.overwriteGetter("rgb",[t,r,o,h]))}static parse(t){if(t instanceof ai)return t;if(typeof t!="string")return;const r=(function(o){if((o=o.toLowerCase().trim())==="transparent")return[0,0,0,0];const h=Co(ns,o);if(h){const[_,x,b]=h;return[_/255,x/255,b/255,1]}if(o.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(o)){const _=o.length<6?1:2;let x=1;return[rs(o.slice(x,x+=_)),rs(o.slice(x,x+=_)),rs(o.slice(x,x+=_)),rs(o.slice(x,x+_)||"ff")]}if(o.startsWith("rgb")){const _=o.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(_){const[x,b,T,C,D,O,F,U,$,Q,re,be]=_,he=[C||" ",F||" ",Q].join("");if(he==="  "||he==="  /"||he===",,"||he===",,,"){const pe=[T,O,$].join(""),Ie=pe==="%%%"?100:pe===""?255:0;if(Ie){const Ne=[li(+b/Ie,0,1),li(+D/Ie,0,1),li(+U/Ie,0,1),re?La(+re,be):1];if(Gs(Ne))return Ne}}return}}const g=o.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(g){const[_,x,b,T,C,D,O,F,U]=g,$=[b||" ",C||" ",O].join("");if($==="  "||$==="  /"||$===",,"||$===",,,"){const Q=[+x,li(+T,0,100),li(+D,0,100),F?La(+F,U):1];if(Gs(Q))return(function([re,be,he,pe]){function Ie(Ne){const Qe=(Ne+re/30)%12,pt=be*Math.min(he,1-he);return he-pt*Math.max(-1,Math.min(Qe-3,9-Qe,1))}return re=cl(re),be/=100,he/=100,[Ie(0),Ie(8),Ie(4),pe]})(Q)}}})(t);return r?new ai(...r,!1):void 0}get rgb(){const{r:t,g:r,b:o,a:h}=this,g=h||1/0;return this.overwriteGetter("rgb",[t/g,r/g,o/g,h])}get hcl(){return this.overwriteGetter("hcl",(function(t){const[r,o,h,g]=ul(t),_=Math.sqrt(o*o+h*h);return[Math.round(1e4*_)?cl(Math.atan2(h,o)*Xh):NaN,_,r,g]})(this.rgb))}get lab(){return this.overwriteGetter("lab",ul(this.rgb))}overwriteGetter(t,r){return Object.defineProperty(this,t,{value:r}),r}toString(){const[t,r,o,h]=this.rgb;return`rgba(${[t,r,o].map((g=>Math.round(255*g))).join(",")},${h})`}static interpolate(t,r,o,h="rgb"){switch(h){case"rgb":{const[g,_,x,b]=Eo(t.rgb,r.rgb,o);return new ai(g,_,x,b,!1)}case"hcl":{const[g,_,x,b]=t.hcl,[T,C,D,O]=r.hcl;let F,U;if(isNaN(g)||isNaN(T))isNaN(g)?isNaN(T)?F=NaN:(F=T,x!==1&&x!==0||(U=C)):(F=g,D!==1&&D!==0||(U=_));else{let he=T-g;T>g&&he>180?he-=360:T<g&&g-T>180&&(he+=360),F=g+o*he}const[$,Q,re,be]=(function([he,pe,Ie,Ne]){return he=isNaN(he)?0:he*Jc,Mo([Ie,Math.cos(he)*pe,Math.sin(he)*pe,Ne])})([F,U??xs(_,C,o),xs(x,D,o),xs(b,O,o)]);return new ai($,Q,re,be,!1)}case"lab":{const[g,_,x,b]=Mo(Eo(t.lab,r.lab,o));return new ai(g,_,x,b,!1)}}}}ai.black=new ai(0,0,0,1),ai.white=new ai(1,1,1,1),ai.transparent=new ai(0,0,0,0),ai.red=new ai(1,0,0,1);class vs{constructor(t,r,o){this.sensitivity=t?r?"variant":"case":r?"accent":"base",this.locale=o,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,r){return this.collator.compare(t,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}const hl=["bottom","center","top"];class bs{constructor(t,r,o,h,g,_){this.text=t,this.image=r,this.scale=o,this.fontStack=h,this.textColor=g,this.verticalAlign=_}}class Nr{constructor(t){this.sections=t}static fromString(t){return new Nr([new bs(t,null,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some((t=>t.text.length!==0||t.image&&t.image.name.length!==0))}static factory(t){return t instanceof Nr?t:Nr.fromString(t)}toString(){return this.sections.length===0?"":this.sections.map((t=>t.text)).join("")}}class qr{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof qr)return t;if(typeof t=="number")return new qr([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(const r of t)if(typeof r!="number")return;switch(t.length){case 1:t=[t[0],t[0],t[0],t[0]];break;case 2:t=[t[0],t[1],t[0],t[1]];break;case 3:t=[t[0],t[1],t[2],t[1]]}return new qr(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,r,o){return new qr(Eo(t.values,r.values,o))}}class nn{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof nn)return t;if(typeof t=="number")return new nn([t]);if(Array.isArray(t)){for(const r of t)if(typeof r!="number")return;return new nn(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,r,o){return new nn(Eo(t.values,r.values,o))}}class Dr{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Dr)return t;if(typeof t=="string"){const o=ai.parse(t);return o?new Dr([o]):void 0}if(!Array.isArray(t))return;const r=[];for(const o of t){if(typeof o!="string")return;const h=ai.parse(o);if(!h)return;r.push(h)}return new Dr(r)}toString(){return JSON.stringify(this.values)}static interpolate(t,r,o,h="rgb"){const g=[];if(t.values.length!=r.values.length)throw new Error(`colorArray: Arrays have mismatched length (${t.values.length} vs. ${r.values.length}), cannot interpolate.`);for(let _=0;_<t.values.length;_++)g.push(ai.interpolate(t.values[_],r.values[_],o,h));return new Dr(g)}}class Mi extends Error{constructor(t){super(t),this.name="RuntimeError"}toJSON(){return this.message}}const as=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class an{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof an)return t;if(Array.isArray(t)&&!(t.length<1)&&t.length%2==0){for(let r=0;r<t.length;r+=2){const o=t[r],h=t[r+1];if(typeof o!="string"||!as.has(o)||!Array.isArray(h)||h.length!==2||typeof h[0]!="number"||typeof h[1]!="number")return}return new an(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,r,o){const h=t.values,g=r.values;if(h.length!==g.length)throw new Mi(`Cannot interpolate values of different length. from: ${t.toString()}, to: ${r.toString()}`);const _=[];for(let x=0;x<h.length;x+=2){if(h[x]!==g[x])throw new Mi(`Cannot interpolate values containing mismatched anchors. from[${x}]: ${h[x]}, to[${x}]: ${g[x]}`);_.push(h[x]);const[b,T]=h[x+1],[C,D]=g[x+1];_.push([xs(b,C,o),xs(T,D,o)])}return new an(_)}}class sn{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new sn({name:t,available:!1}):null}}class gr{constructor(t,r,o){this.from=t,this.to=r,this.transition=o}static interpolate(t,r,o){return new gr(t,r,o)}static parse(t){return t instanceof gr?t:Array.isArray(t)&&t.length===3&&typeof t[0]=="string"&&typeof t[1]=="string"&&typeof t[2]=="number"?new gr(t[0],t[1],t[2]):typeof t=="object"&&typeof t.from=="string"&&typeof t.to=="string"&&typeof t.transition=="number"?new gr(t.from,t.to,t.transition):typeof t=="string"?new gr(t,t,1):void 0}}function Ui(n,t,r,o){return typeof n=="number"&&n>=0&&n<=255&&typeof t=="number"&&t>=0&&t<=255&&typeof r=="number"&&r>=0&&r<=255?o===void 0||typeof o=="number"&&o>=0&&o<=1?null:`Invalid rgba value [${[n,t,r,o].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof o=="number"?[n,t,r,o]:[n,t,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function ss(n){if(n===null||typeof n=="string"||typeof n=="boolean"||typeof n=="number"||n instanceof gr||n instanceof ai||n instanceof vs||n instanceof Nr||n instanceof qr||n instanceof nn||n instanceof Dr||n instanceof an||n instanceof sn)return!0;if(Array.isArray(n)){for(const t of n)if(!ss(t))return!1;return!0}if(typeof n=="object"){for(const t in n)if(!ss(n[t]))return!1;return!0}return!1}function jt(n){if(n===null)return Ja;if(typeof n=="string")return ei;if(typeof n=="boolean")return Ht;if(typeof n=="number")return gt;if(n instanceof ai)return Rr;if(n instanceof gr)return fa;if(n instanceof vs)return Wl;if(n instanceof Nr)return qn;if(n instanceof qr)return ys;if(n instanceof nn)return So;if(n instanceof Dr)return es;if(n instanceof an)return Wc;if(n instanceof sn)return mr;if(Array.isArray(n)){const t=n.length;let r;for(const o of n){const h=jt(o);if(r){if(r===h)continue;r=ti;break}r=h}return tn(r||ti,t)}return tr}function $t(n){const t=typeof n;return n===null?"":t==="string"||t==="number"||t==="boolean"?String(n):n instanceof ai||n instanceof gr||n instanceof Nr||n instanceof qr||n instanceof nn||n instanceof Dr||n instanceof an||n instanceof sn?n.toString():JSON.stringify(n)}class pa{constructor(t,r){this.type=t,this.value=r}static parse(t,r){if(t.length!==2)return r.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!ss(t[1]))return r.error("invalid value");const o=t[1];let h=jt(o);const g=r.expectedType;return h.kind!=="array"||h.N!==0||!g||g.kind!=="array"||typeof g.N=="number"&&g.N!==0||(h=g),new pa(h,o)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const fi={string:ei,number:gt,boolean:Ht,object:tr};class Hi{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let o,h=1;const g=t[0];if(g==="array"){let x,b;if(t.length>2){const T=t[1];if(typeof T!="string"||!(T in fi)||T==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);x=fi[T],h++}else x=ti;if(t.length>3){if(t[2]!==null&&(typeof t[2]!="number"||t[2]<0||t[2]!==Math.floor(t[2])))return r.error('The length argument to "array" must be a positive integer literal',2);b=t[2],h++}o=tn(x,b)}else{if(!fi[g])throw new Error(`Types doesn't contain name = ${g}`);o=fi[g]}const _=[];for(;h<t.length;h++){const x=r.parse(t[h],h,ti);if(!x)return null;_.push(x)}return new Hi(o,_)}evaluate(t){for(let r=0;r<this.args.length;r++){const o=this.args[r].evaluate(t);if(!To(this.type,jt(o)))return o;if(r===this.args.length-1)throw new Mi(`Expected value to be of type ${Ei(this.type)}, but found ${Ei(jt(o))} instead.`)}throw new Error}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}}const gn={"to-boolean":Ht,"to-color":Rr,"to-number":gt,"to-string":ei};class ea{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");const o=t[0];if(!gn[o])throw new Error(`Can't parse ${o} as it is not part of the known types`);if((o==="to-boolean"||o==="to-string")&&t.length!==2)return r.error("Expected one argument.");const h=gn[o],g=[];for(let _=1;_<t.length;_++){const x=r.parse(t[_],_,ti);if(!x)return null;g.push(x)}return new ea(h,g)}evaluate(t){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(t);case"color":{let r,o;for(const h of this.args){if(r=h.evaluate(t),o=null,r instanceof ai)return r;if(typeof r=="string"){const g=t.parseColor(r);if(g)return g}else if(Array.isArray(r)&&(o=r.length<3||r.length>4?`Invalid rgba value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:Ui(r[0],r[1],r[2],r[3]),!o))return new ai(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new Mi(o||`Could not parse color from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"padding":{let r;for(const o of this.args){r=o.evaluate(t);const h=qr.parse(r);if(h)return h}throw new Mi(`Could not parse padding from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"numberArray":{let r;for(const o of this.args){r=o.evaluate(t);const h=nn.parse(r);if(h)return h}throw new Mi(`Could not parse numberArray from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"colorArray":{let r;for(const o of this.args){r=o.evaluate(t);const h=Dr.parse(r);if(h)return h}throw new Mi(`Could not parse colorArray from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"variableAnchorOffsetCollection":{let r;for(const o of this.args){r=o.evaluate(t);const h=an.parse(r);if(h)return h}throw new Mi(`Could not parse variableAnchorOffsetCollection from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"number":{let r=null;for(const o of this.args){if(r=o.evaluate(t),r===null)return 0;const h=Number(r);if(!isNaN(h))return h}throw new Mi(`Could not convert ${JSON.stringify(r)} to number.`)}case"formatted":return Nr.fromString($t(this.args[0].evaluate(t)));case"resolvedImage":return sn.fromString($t(this.args[0].evaluate(t)));case"projectionDefinition":return this.args[0].evaluate(t);default:return $t(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}}const Zs=["Unknown","Point","LineString","Polygon"];class Yu{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?typeof this.feature.type=="number"?Zs[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(t){let r=this._parseColorCache.get(t);return r||(r=ai.parse(t),this._parseColorCache.set(t,r)),r}}class qs{constructor(t,r,o=[],h,g=new _s,_=[]){this.registry=t,this.path=o,this.key=o.map((x=>`[${x}]`)).join(""),this.scope=g,this.errors=_,this.expectedType=h,this._isConstant=r}parse(t,r,o,h,g={}){return r?this.concat(r,o,h)._parse(t,g):this._parse(t,g)}_parse(t,r){function o(h,g,_){return _==="assert"?new Hi(g,[h]):_==="coerce"?new ea(g,[h]):h}if(t!==null&&typeof t!="string"&&typeof t!="boolean"&&typeof t!="number"||(t=["literal",t]),Array.isArray(t)){if(t.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const h=t[0];if(typeof h!="string")return this.error(`Expression name must be a string, but found ${typeof h} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const g=this.registry[h];if(g){let _=g.parse(t,this);if(!_)return null;if(this.expectedType){const x=this.expectedType,b=_.type;if(x.kind!=="string"&&x.kind!=="number"&&x.kind!=="boolean"&&x.kind!=="object"&&x.kind!=="array"||b.kind!=="value"){if(x.kind==="projectionDefinition"&&["string","array"].includes(b.kind)||["color","formatted","resolvedImage"].includes(x.kind)&&["value","string"].includes(b.kind)||["padding","numberArray"].includes(x.kind)&&["value","number","array"].includes(b.kind)||x.kind==="colorArray"&&["value","string","array"].includes(b.kind)||x.kind==="variableAnchorOffsetCollection"&&["value","array"].includes(b.kind))_=o(_,x,r.typeAnnotation||"coerce");else if(this.checkSubtype(x,b))return null}else _=o(_,x,r.typeAnnotation||"assert")}if(!(_ instanceof pa)&&_.type.kind!=="resolvedImage"&&this._isConstant(_)){const x=new Yu;try{_=new pa(_.type,_.evaluate(x))}catch(b){return this.error(b.message),null}}return _}return this.error(`Unknown expression "${h}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(t===void 0?"'undefined' value invalid. Use null instead.":typeof t=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof t} instead.`)}concat(t,r,o){const h=typeof t=="number"?this.path.concat(t):this.path,g=o?this.scope.concat(o):this.scope;return new qs(this.registry,this._isConstant,h,r||null,g,this.errors)}error(t,...r){const o=`${this.key}${r.map((h=>`[${h}]`)).join("")}`;this.errors.push(new pr(o,t))}checkSubtype(t,r){const o=To(t,r);return o&&this.error(o),o}}class Ao{constructor(t,r){this.type=r.type,this.bindings=[].concat(t),this.result=r}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const r of this.bindings)t(r[1]);t(this.result)}static parse(t,r){if(t.length<4)return r.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const o=[];for(let g=1;g<t.length-1;g+=2){const _=t[g];if(typeof _!="string")return r.error(`Expected string, but found ${typeof _} instead.`,g);if(/[^a-zA-Z0-9_]/.test(_))return r.error("Variable names must contain only alphanumeric characters or '_'.",g);const x=r.parse(t[g+1],g+1);if(!x)return null;o.push([_,x])}const h=r.parse(t[t.length-1],t.length-1,r.expectedType,o);return h?new Ao(o,h):null}outputDefined(){return this.result.outputDefined()}}class $s{constructor(t,r){this.type=r.type,this.name=t,this.boundExpression=r}static parse(t,r){if(t.length!==2||typeof t[1]!="string")return r.error("'var' expression requires exactly one string literal argument.");const o=t[1];return r.scope.has(o)?new $s(o,r.scope.get(o)):r.error(`Unknown variable "${o}". Make sure "${o}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}}class Po{constructor(t,r,o){this.type=t,this.index=r,this.input=o}static parse(t,r){if(t.length!==3)return r.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const o=r.parse(t[1],1,gt),h=r.parse(t[2],2,tn(r.expectedType||ti));return o&&h?new Po(h.type.itemType,o,h):null}evaluate(t){const r=this.index.evaluate(t),o=this.input.evaluate(t);if(r<0)throw new Mi(`Array index out of bounds: ${r} < 0.`);if(r>=o.length)throw new Mi(`Array index out of bounds: ${r} > ${o.length-1}.`);if(r!==Math.floor(r))throw new Mi(`Array index must be an integer, but found ${r} instead.`);return o[r]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}}class tc{constructor(t,r){this.type=Ht,this.needle=t,this.haystack=r}static parse(t,r){if(t.length!==3)return r.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const o=r.parse(t[1],1,ti),h=r.parse(t[2],2,ti);return o&&h?Qc(o.type,[Ht,ei,gt,Ja,ti])?new tc(o,h):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${Ei(o.type)} instead`):null}evaluate(t){const r=this.needle.evaluate(t),o=this.haystack.evaluate(t);if(!o)return!1;if(!Jn(r,["boolean","string","number","null"]))throw new Mi(`Expected first argument to be of type boolean, string, number or null, but found ${Ei(jt(r))} instead.`);if(!Jn(o,["string","array"]))throw new Mi(`Expected second argument to be of type array or string, but found ${Ei(jt(o))} instead.`);return o.indexOf(r)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}}class Ba{constructor(t,r,o){this.type=gt,this.needle=t,this.haystack=r,this.fromIndex=o}static parse(t,r){if(t.length<=2||t.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const o=r.parse(t[1],1,ti),h=r.parse(t[2],2,ti);if(!o||!h)return null;if(!Qc(o.type,[Ht,ei,gt,Ja,ti]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${Ei(o.type)} instead`);if(t.length===4){const g=r.parse(t[3],3,gt);return g?new Ba(o,h,g):null}return new Ba(o,h)}evaluate(t){const r=this.needle.evaluate(t),o=this.haystack.evaluate(t);if(!Jn(r,["boolean","string","number","null"]))throw new Mi(`Expected first argument to be of type boolean, string, number or null, but found ${Ei(jt(r))} instead.`);let h;if(this.fromIndex&&(h=this.fromIndex.evaluate(t)),Jn(o,["string"])){const g=o.indexOf(r,h);return g===-1?-1:[...o.slice(0,g)].length}if(Jn(o,["array"]))return o.indexOf(r,h);throw new Mi(`Expected second argument to be of type array or string, but found ${Ei(jt(o))} instead.`)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}}class Wr{constructor(t,r,o,h,g,_){this.inputType=t,this.type=r,this.input=o,this.cases=h,this.outputs=g,this.otherwise=_}static parse(t,r){if(t.length<5)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return r.error("Expected an even number of arguments.");let o,h;r.expectedType&&r.expectedType.kind!=="value"&&(h=r.expectedType);const g={},_=[];for(let T=2;T<t.length-1;T+=2){let C=t[T];const D=t[T+1];Array.isArray(C)||(C=[C]);const O=r.concat(T);if(C.length===0)return O.error("Expected at least one branch label.");for(const U of C){if(typeof U!="number"&&typeof U!="string")return O.error("Branch labels must be numbers or strings.");if(typeof U=="number"&&Math.abs(U)>Number.MAX_SAFE_INTEGER)return O.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof U=="number"&&Math.floor(U)!==U)return O.error("Numeric branch labels must be integer values.");if(o){if(O.checkSubtype(o,jt(U)))return null}else o=jt(U);if(g[String(U)]!==void 0)return O.error("Branch labels must be unique.");g[String(U)]=_.length}const F=r.parse(D,T,h);if(!F)return null;h=h||F.type,_.push(F)}const x=r.parse(t[1],1,ti);if(!x)return null;const b=r.parse(t[t.length-1],t.length-1,h);return b?x.type.kind!=="value"&&r.concat(1).checkSubtype(o,x.type)?null:new Wr(o,h,x,g,_,b):null}evaluate(t){const r=this.input.evaluate(t);return(jt(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))&&this.otherwise.outputDefined()}}class dl{constructor(t,r,o){this.type=t,this.branches=r,this.otherwise=o}static parse(t,r){if(t.length<4)return r.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return r.error("Expected an odd number of arguments.");let o;r.expectedType&&r.expectedType.kind!=="value"&&(o=r.expectedType);const h=[];for(let _=1;_<t.length-1;_+=2){const x=r.parse(t[_],_,Ht);if(!x)return null;const b=r.parse(t[_+1],_+1,o);if(!b)return null;h.push([x,b]),o=o||b.type}const g=r.parse(t[t.length-1],t.length-1,o);if(!g)return null;if(!o)throw new Error("Can't infer output type");return new dl(o,h,g)}evaluate(t){for(const[r,o]of this.branches)if(r.evaluate(t))return o.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(const[r,o]of this.branches)t(r),t(o);t(this.otherwise)}outputDefined(){return this.branches.every((([t,r])=>r.outputDefined()))&&this.otherwise.outputDefined()}}class zo{constructor(t,r,o,h){this.type=t,this.input=r,this.beginIndex=o,this.endIndex=h}static parse(t,r){if(t.length<=2||t.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const o=r.parse(t[1],1,ti),h=r.parse(t[2],2,gt);if(!o||!h)return null;if(!Qc(o.type,[tn(ti),ei,ti]))return r.error(`Expected first argument to be of type array or string, but found ${Ei(o.type)} instead`);if(t.length===4){const g=r.parse(t[3],3,gt);return g?new zo(o.type,o,h,g):null}return new zo(o.type,o,h)}evaluate(t){const r=this.input.evaluate(t),o=this.beginIndex.evaluate(t);let h;if(this.endIndex&&(h=this.endIndex.evaluate(t)),Jn(r,["string"]))return[...r].slice(o,h).join("");if(Jn(r,["array"]))return r.slice(o,h);throw new Mi(`Expected first argument to be of type array or string, but found ${Ei(jt(r))} instead.`)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}}function ko(n,t){const r=n.length-1;let o,h,g=0,_=r,x=0;for(;g<=_;)if(x=Math.floor((g+_)/2),o=n[x],h=n[x+1],o<=t){if(x===r||t<h)return x;g=x+1}else{if(!(o>t))throw new Mi("Input is not a number.");_=x-1}return 0}class vr{constructor(t,r,o){this.type=t,this.input=r,this.labels=[],this.outputs=[];for(const[h,g]of o)this.labels.push(h),this.outputs.push(g)}static parse(t,r){if(t.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return r.error("Expected an even number of arguments.");const o=r.parse(t[1],1,gt);if(!o)return null;const h=[];let g=null;r.expectedType&&r.expectedType.kind!=="value"&&(g=r.expectedType);for(let _=1;_<t.length;_+=2){const x=_===1?-1/0:t[_],b=t[_+1],T=_,C=_+1;if(typeof x!="number")return r.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',T);if(h.length&&h[h.length-1][0]>=x)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',T);const D=r.parse(b,C,g);if(!D)return null;g=g||D.type,h.push([x,D])}return new vr(g,o,h)}evaluate(t){const r=this.labels,o=this.outputs;if(r.length===1)return o[0].evaluate(t);const h=this.input.evaluate(t);if(h<=r[0])return o[0].evaluate(t);const g=r.length;return h>=r[g-1]?o[g-1].evaluate(t):o[ko(r,h)].evaluate(t)}eachChild(t){t(this.input);for(const r of this.outputs)t(r)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}}function Kh(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var ic,Ku,Wh=(function(){if(Ku)return ic;function n(t,r,o,h){this.cx=3*t,this.bx=3*(o-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*r,this.by=3*(h-r)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=r,this.p2x=o,this.p2y=h}return Ku=1,ic=n,n.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,r){if(r===void 0&&(r=1e-6),t<0)return 0;if(t>1)return 1;for(var o=t,h=0;h<8;h++){var g=this.sampleCurveX(o)-t;if(Math.abs(g)<r)return o;var _=this.sampleCurveDerivativeX(o);if(Math.abs(_)<1e-6)break;o-=g/_}var x=0,b=1;for(o=t,h=0;h<20&&(g=this.sampleCurveX(o),!(Math.abs(g-t)<r));h++)t>g?x=o:b=o,o=.5*(b-x)+x;return o},solve:function(t,r){return this.sampleCurveY(this.solveCurveX(t,r))}},ic})(),fl=Kh(Wh);class on{constructor(t,r,o,h,g){this.type=t,this.operator=r,this.interpolation=o,this.input=h,this.labels=[],this.outputs=[];for(const[_,x]of g)this.labels.push(_),this.outputs.push(x)}static interpolationFactor(t,r,o,h){let g=0;if(t.name==="exponential")g=rc(r,t.base,o,h);else if(t.name==="linear")g=rc(r,1,o,h);else if(t.name==="cubic-bezier"){const _=t.controlPoints;g=new fl(_[0],_[1],_[2],_[3]).solve(rc(r,1,o,h))}return g}static parse(t,r){let[o,h,g,..._]=t;if(!Array.isArray(h)||h.length===0)return r.error("Expected an interpolation type expression.",1);if(h[0]==="linear")h={name:"linear"};else if(h[0]==="exponential"){const T=h[1];if(typeof T!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);h={name:"exponential",base:T}}else{if(h[0]!=="cubic-bezier")return r.error(`Unknown interpolation type ${String(h[0])}`,1,0);{const T=h.slice(1);if(T.length!==4||T.some((C=>typeof C!="number"||C<0||C>1)))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);h={name:"cubic-bezier",controlPoints:T}}}if(t.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(g=r.parse(g,2,gt),!g)return null;const x=[];let b=null;o!=="interpolate-hcl"&&o!=="interpolate-lab"||r.expectedType==es?r.expectedType&&r.expectedType.kind!=="value"&&(b=r.expectedType):b=Rr;for(let T=0;T<_.length;T+=2){const C=_[T],D=_[T+1],O=T+3,F=T+4;if(typeof C!="number")return r.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',O);if(x.length&&x[x.length-1][0]>=C)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',O);const U=r.parse(D,F,b);if(!U)return null;b=b||U.type,x.push([C,U])}return is(b,gt)||is(b,fa)||is(b,Rr)||is(b,ys)||is(b,So)||is(b,es)||is(b,Wc)||is(b,tn(gt))?new on(b,o,h,g,x):r.error(`Type ${Ei(b)} is not interpolatable.`)}evaluate(t){const r=this.labels,o=this.outputs;if(r.length===1)return o[0].evaluate(t);const h=this.input.evaluate(t);if(h<=r[0])return o[0].evaluate(t);const g=r.length;if(h>=r[g-1])return o[g-1].evaluate(t);const _=ko(r,h),x=on.interpolationFactor(this.interpolation,h,r[_],r[_+1]),b=o[_].evaluate(t),T=o[_+1].evaluate(t);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return xs(b,T,x);case"color":return ai.interpolate(b,T,x);case"padding":return qr.interpolate(b,T,x);case"colorArray":return Dr.interpolate(b,T,x);case"numberArray":return nn.interpolate(b,T,x);case"variableAnchorOffsetCollection":return an.interpolate(b,T,x);case"array":return Eo(b,T,x);case"projectionDefinition":return gr.interpolate(b,T,x)}case"interpolate-hcl":switch(this.type.kind){case"color":return ai.interpolate(b,T,x,"hcl");case"colorArray":return Dr.interpolate(b,T,x,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return ai.interpolate(b,T,x,"lab");case"colorArray":return Dr.interpolate(b,T,x,"lab")}}}eachChild(t){t(this.input);for(const r of this.outputs)t(r)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}}function rc(n,t,r,o){const h=o-r,g=n-r;return h===0?0:t===1?g/h:(Math.pow(t,g)-1)/(Math.pow(t,h)-1)}const os={color:ai.interpolate,number:xs,padding:qr.interpolate,numberArray:nn.interpolate,colorArray:Dr.interpolate,variableAnchorOffsetCollection:an.interpolate,array:Eo};class Io{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let o=null;const h=r.expectedType;h&&h.kind!=="value"&&(o=h);const g=[];for(const x of t.slice(1)){const b=r.parse(x,1+g.length,o,void 0,{typeAnnotation:"omit"});if(!b)return null;o=o||b.type,g.push(b)}if(!o)throw new Error("No output type");const _=h&&g.some((x=>To(h,x.type)));return new Io(_?ti:o,g)}evaluate(t){let r,o=null,h=0;for(const g of this.args)if(h++,o=g.evaluate(t),o&&o instanceof sn&&!o.available&&(r||(r=o.name),o=null,h===this.args.length&&(o=r)),o!==null)break;return o}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}}function nc(n,t){return n==="=="||n==="!="?t.kind==="boolean"||t.kind==="string"||t.kind==="number"||t.kind==="null"||t.kind==="value":t.kind==="string"||t.kind==="number"||t.kind==="value"}function ac(n,t,r,o){return o.compare(t,r)===0}function _n(n,t,r){const o=n!=="=="&&n!=="!=";return class Zg{constructor(g,_,x){this.type=Ht,this.lhs=g,this.rhs=_,this.collator=x,this.hasUntypedArgument=g.type.kind==="value"||_.type.kind==="value"}static parse(g,_){if(g.length!==3&&g.length!==4)return _.error("Expected two or three arguments.");const x=g[0];let b=_.parse(g[1],1,ti);if(!b)return null;if(!nc(x,b.type))return _.concat(1).error(`"${x}" comparisons are not supported for type '${Ei(b.type)}'.`);let T=_.parse(g[2],2,ti);if(!T)return null;if(!nc(x,T.type))return _.concat(2).error(`"${x}" comparisons are not supported for type '${Ei(T.type)}'.`);if(b.type.kind!==T.type.kind&&b.type.kind!=="value"&&T.type.kind!=="value")return _.error(`Cannot compare types '${Ei(b.type)}' and '${Ei(T.type)}'.`);o&&(b.type.kind==="value"&&T.type.kind!=="value"?b=new Hi(T.type,[b]):b.type.kind!=="value"&&T.type.kind==="value"&&(T=new Hi(b.type,[T])));let C=null;if(g.length===4){if(b.type.kind!=="string"&&T.type.kind!=="string"&&b.type.kind!=="value"&&T.type.kind!=="value")return _.error("Cannot use collator to compare non-string types.");if(C=_.parse(g[3],3,Wl),!C)return null}return new Zg(b,T,C)}evaluate(g){const _=this.lhs.evaluate(g),x=this.rhs.evaluate(g);if(o&&this.hasUntypedArgument){const b=jt(_),T=jt(x);if(b.kind!==T.kind||b.kind!=="string"&&b.kind!=="number")throw new Mi(`Expected arguments for "${n}" to be (string, string) or (number, number), but found (${b.kind}, ${T.kind}) instead.`)}if(this.collator&&!o&&this.hasUntypedArgument){const b=jt(_),T=jt(x);if(b.kind!=="string"||T.kind!=="string")return t(g,_,x)}return this.collator?r(g,_,x,this.collator.evaluate(g)):t(g,_,x)}eachChild(g){g(this.lhs),g(this.rhs),this.collator&&g(this.collator)}outputDefined(){return!0}}}const Wu=_n("==",(function(n,t,r){return t===r}),ac),eu=_n("!=",(function(n,t,r){return t!==r}),(function(n,t,r,o){return!ac(0,t,r,o)})),Yd=_n("<",(function(n,t,r){return t<r}),(function(n,t,r,o){return o.compare(t,r)<0})),Qu=_n(">",(function(n,t,r){return t>r}),(function(n,t,r,o){return o.compare(t,r)>0})),Kd=_n("<=",(function(n,t,r){return t<=r}),(function(n,t,r,o){return o.compare(t,r)<=0})),Wd=_n(">=",(function(n,t,r){return t>=r}),(function(n,t,r,o){return o.compare(t,r)>=0}));class tu{constructor(t,r,o){this.type=Wl,this.locale=o,this.caseSensitive=t,this.diacriticSensitive=r}static parse(t,r){if(t.length!==2)return r.error("Expected one argument.");const o=t[1];if(typeof o!="object"||Array.isArray(o))return r.error("Collator options argument must be an object.");const h=r.parse(o["case-sensitive"]!==void 0&&o["case-sensitive"],1,Ht);if(!h)return null;const g=r.parse(o["diacritic-sensitive"]!==void 0&&o["diacritic-sensitive"],1,Ht);if(!g)return null;let _=null;return o.locale&&(_=r.parse(o.locale,1,ei),!_)?null:new tu(h,g,_)}evaluate(t){return new vs(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}}class Ju{constructor(t,r,o,h,g){this.type=ei,this.number=t,this.locale=r,this.currency=o,this.minFractionDigits=h,this.maxFractionDigits=g}static parse(t,r){if(t.length!==3)return r.error("Expected two arguments.");const o=r.parse(t[1],1,gt);if(!o)return null;const h=t[2];if(typeof h!="object"||Array.isArray(h))return r.error("NumberFormat options argument must be an object.");let g=null;if(h.locale&&(g=r.parse(h.locale,1,ei),!g))return null;let _=null;if(h.currency&&(_=r.parse(h.currency,1,ei),!_))return null;let x=null;if(h["min-fraction-digits"]&&(x=r.parse(h["min-fraction-digits"],1,gt),!x))return null;let b=null;return h["max-fraction-digits"]&&(b=r.parse(h["max-fraction-digits"],1,gt),!b)?null:new Ju(o,g,_,x,b)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}}class Ro{constructor(t){this.type=qn,this.sections=t}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");const o=t[1];if(!Array.isArray(o)&&typeof o=="object")return r.error("First argument must be an image or text section.");const h=[];let g=!1;for(let _=1;_<=t.length-1;++_){const x=t[_];if(g&&typeof x=="object"&&!Array.isArray(x)){g=!1;let b=null;if(x["font-scale"]&&(b=r.parse(x["font-scale"],1,gt),!b))return null;let T=null;if(x["text-font"]&&(T=r.parse(x["text-font"],1,tn(ei)),!T))return null;let C=null;if(x["text-color"]&&(C=r.parse(x["text-color"],1,Rr),!C))return null;let D=null;if(x["vertical-align"]){if(typeof x["vertical-align"]=="string"&&!hl.includes(x["vertical-align"]))return r.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${x["vertical-align"]}' instead.`);if(D=r.parse(x["vertical-align"],1,ei),!D)return null}const O=h[h.length-1];O.scale=b,O.font=T,O.textColor=C,O.verticalAlign=D}else{const b=r.parse(t[_],1,ti);if(!b)return null;const T=b.type.kind;if(T!=="string"&&T!=="value"&&T!=="null"&&T!=="resolvedImage")return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");g=!0,h.push({content:b,scale:null,font:null,textColor:null,verticalAlign:null})}}return new Ro(h)}evaluate(t){return new Nr(this.sections.map((r=>{const o=r.content.evaluate(t);return jt(o)===mr?new bs("",o,null,null,null,r.verticalAlign?r.verticalAlign.evaluate(t):null):new bs($t(o),null,r.scale?r.scale.evaluate(t):null,r.font?r.font.evaluate(t).join(","):null,r.textColor?r.textColor.evaluate(t):null,r.verticalAlign?r.verticalAlign.evaluate(t):null)})))}eachChild(t){for(const r of this.sections)t(r.content),r.scale&&t(r.scale),r.font&&t(r.font),r.textColor&&t(r.textColor),r.verticalAlign&&t(r.verticalAlign)}outputDefined(){return!1}}class eh{constructor(t){this.type=mr,this.input=t}static parse(t,r){if(t.length!==2)return r.error("Expected two arguments.");const o=r.parse(t[1],1,ei);return o?new eh(o):r.error("No image name provided.")}evaluate(t){const r=this.input.evaluate(t),o=sn.fromString(r);return o&&t.availableImages&&(o.available=t.availableImages.indexOf(r)>-1),o}eachChild(t){t(this.input)}outputDefined(){return!1}}class pl{constructor(t){this.type=gt,this.input=t}static parse(t,r){if(t.length!==2)return r.error(`Expected 1 argument, but found ${t.length-1} instead.`);const o=r.parse(t[1],1);return o?o.type.kind!=="array"&&o.type.kind!=="string"&&o.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${Ei(o.type)} instead.`):new pl(o):null}evaluate(t){const r=this.input.evaluate(t);if(typeof r=="string")return[...r].length;if(Array.isArray(r))return r.length;throw new Mi(`Expected value to be of type string or array, but found ${Ei(jt(r))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}const Rn=8192;function Qd(n,t){const r=(180+n[0])/360,o=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+n[1]*Math.PI/360)))/360,h=Math.pow(2,t.z);return[Math.round(r*h*Rn),Math.round(o*h*Rn)]}function sc(n,t){const r=Math.pow(2,t.z);return[(h=(n[0]/Rn+t.x)/r,360*h-180),(o=(n[1]/Rn+t.y)/r,360/Math.PI*Math.atan(Math.exp((180-360*o)*Math.PI/180))-90)];var o,h}function ml(n,t){n[0]=Math.min(n[0],t[0]),n[1]=Math.min(n[1],t[1]),n[2]=Math.max(n[2],t[0]),n[3]=Math.max(n[3],t[1])}function gl(n,t){return!(n[0]<=t[0]||n[2]>=t[2]||n[1]<=t[1]||n[3]>=t[3])}function Qh(n,t,r){const o=n[0]-t[0],h=n[1]-t[1],g=n[0]-r[0],_=n[1]-r[1];return o*_-g*h==0&&o*g<=0&&h*_<=0}function oc(n,t,r,o){return(h=[o[0]-r[0],o[1]-r[1]])[0]*(g=[t[0]-n[0],t[1]-n[1]])[1]-h[1]*g[0]!=0&&!(!ih(n,t,r,o)||!ih(r,o,n,t));var h,g}function _l(n,t,r){for(const o of r)for(let h=0;h<o.length-1;++h)if(oc(n,t,o[h],o[h+1]))return!0;return!1}function Do(n,t,r=!1){let o=!1;for(const x of t)for(let b=0;b<x.length-1;b++){if(Qh(n,x[b],x[b+1]))return r;(g=x[b])[1]>(h=n)[1]!=(_=x[b+1])[1]>h[1]&&h[0]<(_[0]-g[0])*(h[1]-g[1])/(_[1]-g[1])+g[0]&&(o=!o)}var h,g,_;return o}function Jh(n,t){for(const r of t)if(Do(n,r))return!0;return!1}function th(n,t){for(const r of n)if(!Do(r,t))return!1;for(let r=0;r<n.length-1;++r)if(_l(n[r],n[r+1],t))return!1;return!0}function ed(n,t){for(const r of t)if(th(n,r))return!0;return!1}function ih(n,t,r,o){const h=o[0]-r[0],g=o[1]-r[1],_=(n[0]-r[0])*g-h*(n[1]-r[1]),x=(t[0]-r[0])*g-h*(t[1]-r[1]);return _>0&&x<0||_<0&&x>0}function Lo(n,t,r){const o=[];for(let h=0;h<n.length;h++){const g=[];for(let _=0;_<n[h].length;_++){const x=Qd(n[h][_],r);ml(t,x),g.push(x)}o.push(g)}return o}function yl(n,t,r){const o=[];for(let h=0;h<n.length;h++){const g=Lo(n[h],t,r);o.push(g)}return o}function iu(n,t,r,o){if(n[0]<r[0]||n[0]>r[2]){const h=.5*o;let g=n[0]-r[0]>h?-o:r[0]-n[0]>h?o:0;g===0&&(g=n[0]-r[2]>h?-o:r[2]-n[0]>h?o:0),n[0]+=g}ml(t,n)}function lc(n,t,r,o){const h=Math.pow(2,o.z)*Rn,g=[o.x*Rn,o.y*Rn],_=[];for(const x of n)for(const b of x){const T=[b.x+g[0],b.y+g[1]];iu(T,t,r,h),_.push(T)}return _}function rh(n,t,r,o){const h=Math.pow(2,o.z)*Rn,g=[o.x*Rn,o.y*Rn],_=[];for(const b of n){const T=[];for(const C of b){const D=[C.x+g[0],C.y+g[1]];ml(t,D),T.push(D)}_.push(T)}if(t[2]-t[0]<=h/2){(x=t)[0]=x[1]=1/0,x[2]=x[3]=-1/0;for(const b of _)for(const T of b)iu(T,t,r,h)}var x;return _}class Hs{constructor(t,r){this.type=Ht,this.geojson=t,this.geometries=r}static parse(t,r){if(t.length!==2)return r.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(ss(t[1])){const o=t[1];if(o.type==="FeatureCollection"){const h=[];for(const g of o.features){const{type:_,coordinates:x}=g.geometry;_==="Polygon"&&h.push(x),_==="MultiPolygon"&&h.push(...x)}if(h.length)return new Hs(o,{type:"MultiPolygon",coordinates:h})}else if(o.type==="Feature"){const h=o.geometry.type;if(h==="Polygon"||h==="MultiPolygon")return new Hs(o,o.geometry)}else if(o.type==="Polygon"||o.type==="MultiPolygon")return new Hs(o,o)}return r.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return(function(r,o){const h=[1/0,1/0,-1/0,-1/0],g=[1/0,1/0,-1/0,-1/0],_=r.canonicalID();if(o.type==="Polygon"){const x=Lo(o.coordinates,g,_),b=lc(r.geometry(),h,g,_);if(!gl(h,g))return!1;for(const T of b)if(!Do(T,x))return!1}if(o.type==="MultiPolygon"){const x=yl(o.coordinates,g,_),b=lc(r.geometry(),h,g,_);if(!gl(h,g))return!1;for(const T of b)if(!Jh(T,x))return!1}return!0})(t,this.geometries);if(t.geometryType()==="LineString")return(function(r,o){const h=[1/0,1/0,-1/0,-1/0],g=[1/0,1/0,-1/0,-1/0],_=r.canonicalID();if(o.type==="Polygon"){const x=Lo(o.coordinates,g,_),b=rh(r.geometry(),h,g,_);if(!gl(h,g))return!1;for(const T of b)if(!th(T,x))return!1}if(o.type==="MultiPolygon"){const x=yl(o.coordinates,g,_),b=rh(r.geometry(),h,g,_);if(!gl(h,g))return!1;for(const T of b)if(!ed(T,x))return!1}return!0})(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let cc=class{constructor(n=[],t=(r,o)=>r<o?-1:r>o?1:0){if(this.data=n,this.length=this.data.length,this.compare=t,this.length>0)for(let r=(this.length>>1)-1;r>=0;r--)this._down(r)}push(n){this.data.push(n),this._up(this.length++)}pop(){if(this.length===0)return;const n=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),n}peek(){return this.data[0]}_up(n){const{data:t,compare:r}=this,o=t[n];for(;n>0;){const h=n-1>>1,g=t[h];if(r(o,g)>=0)break;t[n]=g,n=h}t[n]=o}_down(n){const{data:t,compare:r}=this,o=this.length>>1,h=t[n];for(;n<o;){let g=1+(n<<1);const _=g+1;if(_<this.length&&r(t[_],t[g])<0&&(g=_),r(t[g],h)>=0)break;t[n]=t[g],n=g}t[n]=h}};function uc(n,t,r=0,o=n.length-1,h=td){for(;o>r;){if(o-r>600){const b=o-r+1,T=t-r+1,C=Math.log(b),D=.5*Math.exp(2*C/3),O=.5*Math.sqrt(C*D*(b-D)/b)*(T-b/2<0?-1:1);uc(n,t,Math.max(r,Math.floor(t-T*D/b+O)),Math.min(o,Math.floor(t+(b-T)*D/b+O)),h)}const g=n[t];let _=r,x=o;for(xl(n,r,t),h(n[o],g)>0&&xl(n,r,o);_<x;){for(xl(n,_,x),_++,x--;h(n[_],g)<0;)_++;for(;h(n[x],g)>0;)x--}h(n[r],g)===0?xl(n,r,x):(x++,xl(n,x,o)),x<=t&&(r=x+1),t<=x&&(o=x-1)}}function xl(n,t,r){const o=n[t];n[t]=n[r],n[r]=o}function td(n,t){return n<t?-1:n>t?1:0}function vl(n,t){if(n.length<=1)return[n];const r=[];let o,h;for(const g of n){const _=Jd(g);_!==0&&(g.area=Math.abs(_),h===void 0&&(h=_<0),h===_<0?(o&&r.push(o),o=[g]):o.push(g))}if(o&&r.push(o),t>1)for(let g=0;g<r.length;g++)r[g].length<=t||(uc(r[g],t,1,r[g].length-1,id),r[g]=r[g].slice(0,t));return r}function id(n,t){return t.area-n.area}function Jd(n){let t=0;for(let r,o,h=0,g=n.length,_=g-1;h<g;_=h++)r=n[h],o=n[_],t+=(o.x-r.x)*(r.y+o.y);return t}const rd=1/298.257223563,nd=rd*(2-rd),nh=Math.PI/180;class Dn{constructor(t){const r=6378.137*nh*1e3,o=Math.cos(t*nh),h=1/(1-nd*(1-o*o)),g=Math.sqrt(h);this.kx=r*g*o,this.ky=r*g*h*(1-nd)}distance(t,r){const o=this.wrap(t[0]-r[0])*this.kx,h=(t[1]-r[1])*this.ky;return Math.sqrt(o*o+h*h)}pointOnLine(t,r){let o,h,g,_,x=1/0;for(let b=0;b<t.length-1;b++){let T=t[b][0],C=t[b][1],D=this.wrap(t[b+1][0]-T)*this.kx,O=(t[b+1][1]-C)*this.ky,F=0;D===0&&O===0||(F=(this.wrap(r[0]-T)*this.kx*D+(r[1]-C)*this.ky*O)/(D*D+O*O),F>1?(T=t[b+1][0],C=t[b+1][1]):F>0&&(T+=D/this.kx*F,C+=O/this.ky*F)),D=this.wrap(r[0]-T)*this.kx,O=(r[1]-C)*this.ky;const U=D*D+O*O;U<x&&(x=U,o=T,h=C,g=b,_=F)}return{point:[o,h],index:g,t:Math.max(0,Math.min(1,_))}}wrap(t){for(;t<-180;)t+=360;for(;t>180;)t-=360;return t}}function bl(n,t){return t[0]-n[0]}function hc(n){return n[1]-n[0]+1}function ls(n,t){return n[1]>=n[0]&&n[1]<t}function xi(n,t){if(n[0]>n[1])return[null,null];const r=hc(n);if(t){if(r===2)return[n,null];const h=Math.floor(r/2);return[[n[0],n[0]+h],[n[0]+h,n[1]]]}if(r===1)return[n,null];const o=Math.floor(r/2)-1;return[[n[0],n[0]+o],[n[0]+o+1,n[1]]]}function ru(n,t){if(!ls(t,n.length))return[1/0,1/0,-1/0,-1/0];const r=[1/0,1/0,-1/0,-1/0];for(let o=t[0];o<=t[1];++o)ml(r,n[o]);return r}function dc(n){const t=[1/0,1/0,-1/0,-1/0];for(const r of n)for(const o of r)ml(t,o);return t}function ad(n){return n[0]!==-1/0&&n[1]!==-1/0&&n[2]!==1/0&&n[3]!==1/0}function Xs(n,t,r){if(!ad(n)||!ad(t))return NaN;let o=0,h=0;return n[2]<t[0]&&(o=t[0]-n[2]),n[0]>t[2]&&(o=n[0]-t[2]),n[1]>t[3]&&(h=n[1]-t[3]),n[3]<t[1]&&(h=t[1]-n[3]),r.distance([0,0],[o,h])}function ws(n,t,r){const o=r.pointOnLine(t,n);return r.distance(n,o.point)}function Bo(n,t,r,o,h){const g=Math.min(ws(n,[r,o],h),ws(t,[r,o],h)),_=Math.min(ws(r,[n,t],h),ws(o,[n,t],h));return Math.min(g,_)}function ah(n,t,r,o,h){if(!ls(t,n.length)||!ls(o,r.length))return 1/0;let g=1/0;for(let _=t[0];_<t[1];++_){const x=n[_],b=n[_+1];for(let T=o[0];T<o[1];++T){const C=r[T],D=r[T+1];if(oc(x,b,C,D))return 0;g=Math.min(g,Bo(x,b,C,D,h))}}return g}function sd(n,t,r,o,h){if(!ls(t,n.length)||!ls(o,r.length))return NaN;let g=1/0;for(let _=t[0];_<=t[1];++_)for(let x=o[0];x<=o[1];++x)if(g=Math.min(g,h.distance(n[_],r[x])),g===0)return g;return g}function Oo(n,t,r){if(Do(n,t,!0))return 0;let o=1/0;for(const h of t){const g=h[0],_=h[h.length-1];if(g!==_&&(o=Math.min(o,ws(n,[_,g],r)),o===0))return o;const x=r.pointOnLine(h,n);if(o=Math.min(o,r.distance(n,x.point)),o===0)return o}return o}function wl(n,t,r,o){if(!ls(t,n.length))return NaN;for(let g=t[0];g<=t[1];++g)if(Do(n[g],r,!0))return 0;let h=1/0;for(let g=t[0];g<t[1];++g){const _=n[g],x=n[g+1];for(const b of r)for(let T=0,C=b.length,D=C-1;T<C;D=T++){const O=b[D],F=b[T];if(oc(_,x,O,F))return 0;h=Math.min(h,Bo(_,x,O,F,o))}}return h}function nu(n,t){for(const r of n)for(const o of r)if(Do(o,t,!0))return!0;return!1}function od(n,t,r,o=1/0){const h=dc(n),g=dc(t);if(o!==1/0&&Xs(h,g,r)>=o)return o;if(gl(h,g)){if(nu(n,t))return 0}else if(nu(t,n))return 0;let _=1/0;for(const x of n)for(let b=0,T=x.length,C=T-1;b<T;C=b++){const D=x[C],O=x[b];for(const F of t)for(let U=0,$=F.length,Q=$-1;U<$;Q=U++){const re=F[Q],be=F[U];if(oc(D,O,re,be))return 0;_=Math.min(_,Bo(D,O,re,be,r))}}return _}function Ys(n,t,r,o,h,g){if(!g)return;const _=Xs(ru(o,g),h,r);_<t&&n.push([_,g,[0,0]])}function fc(n,t,r,o,h,g,_){if(!g||!_)return;const x=Xs(ru(o,g),ru(h,_),r);x<t&&n.push([x,g,_])}function pc(n,t,r,o,h=1/0){let g=Math.min(o.distance(n[0],r[0][0]),h);if(g===0)return g;const _=new cc([[0,[0,n.length-1],[0,0]]],bl),x=dc(r);for(;_.length>0;){const b=_.pop();if(b[0]>=g)continue;const T=b[1],C=t?50:100;if(hc(T)<=C){if(!ls(T,n.length))return NaN;if(t){const D=wl(n,T,r,o);if(isNaN(D)||D===0)return D;g=Math.min(g,D)}else for(let D=T[0];D<=T[1];++D){const O=Oo(n[D],r,o);if(g=Math.min(g,O),g===0)return 0}}else{const D=xi(T,t);Ys(_,g,o,n,x,D[0]),Ys(_,g,o,n,x,D[1])}}return g}function mc(n,t,r,o,h,g=1/0){let _=Math.min(g,h.distance(n[0],r[0]));if(_===0)return _;const x=new cc([[0,[0,n.length-1],[0,r.length-1]]],bl);for(;x.length>0;){const b=x.pop();if(b[0]>=_)continue;const T=b[1],C=b[2],D=t?50:100,O=o?50:100;if(hc(T)<=D&&hc(C)<=O){if(!ls(T,n.length)&&ls(C,r.length))return NaN;let F;if(t&&o)F=ah(n,T,r,C,h),_=Math.min(_,F);else if(t&&!o){const U=n.slice(T[0],T[1]+1);for(let $=C[0];$<=C[1];++$)if(F=ws(r[$],U,h),_=Math.min(_,F),_===0)return _}else if(!t&&o){const U=r.slice(C[0],C[1]+1);for(let $=T[0];$<=T[1];++$)if(F=ws(n[$],U,h),_=Math.min(_,F),_===0)return _}else F=sd(n,T,r,C,h),_=Math.min(_,F)}else{const F=xi(T,t),U=xi(C,o);fc(x,_,h,n,r,F[0],U[0]),fc(x,_,h,n,r,F[0],U[1]),fc(x,_,h,n,r,F[1],U[0]),fc(x,_,h,n,r,F[1],U[1])}}return _}function sh(n){return n.type==="MultiPolygon"?n.coordinates.map((t=>({type:"Polygon",coordinates:t}))):n.type==="MultiLineString"?n.coordinates.map((t=>({type:"LineString",coordinates:t}))):n.type==="MultiPoint"?n.coordinates.map((t=>({type:"Point",coordinates:t}))):[n]}class jo{constructor(t,r){this.type=gt,this.geojson=t,this.geometries=r}static parse(t,r){if(t.length!==2)return r.error(`'distance' expression requires exactly one argument, but found ${t.length-1} instead.`);if(ss(t[1])){const o=t[1];if(o.type==="FeatureCollection")return new jo(o,o.features.map((h=>sh(h.geometry))).flat());if(o.type==="Feature")return new jo(o,sh(o.geometry));if("type"in o&&"coordinates"in o)return new jo(o,sh(o))}return r.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return(function(r,o){const h=r.geometry(),g=h.flat().map((b=>sc([b.x,b.y],r.canonical)));if(h.length===0)return NaN;const _=new Dn(g[0][1]);let x=1/0;for(const b of o){switch(b.type){case"Point":x=Math.min(x,mc(g,!1,[b.coordinates],!1,_,x));break;case"LineString":x=Math.min(x,mc(g,!1,b.coordinates,!0,_,x));break;case"Polygon":x=Math.min(x,pc(g,!1,b.coordinates,_,x))}if(x===0)return x}return x})(t,this.geometries);if(t.geometryType()==="LineString")return(function(r,o){const h=r.geometry(),g=h.flat().map((b=>sc([b.x,b.y],r.canonical)));if(h.length===0)return NaN;const _=new Dn(g[0][1]);let x=1/0;for(const b of o){switch(b.type){case"Point":x=Math.min(x,mc(g,!0,[b.coordinates],!1,_,x));break;case"LineString":x=Math.min(x,mc(g,!0,b.coordinates,!0,_,x));break;case"Polygon":x=Math.min(x,pc(g,!0,b.coordinates,_,x))}if(x===0)return x}return x})(t,this.geometries);if(t.geometryType()==="Polygon")return(function(r,o){const h=r.geometry();if(h.length===0||h[0].length===0)return NaN;const g=vl(h,0).map((b=>b.map((T=>T.map((C=>sc([C.x,C.y],r.canonical))))))),_=new Dn(g[0][0][0][1]);let x=1/0;for(const b of o)for(const T of g){switch(b.type){case"Point":x=Math.min(x,pc([b.coordinates],!1,T,_,x));break;case"LineString":x=Math.min(x,pc(b.coordinates,!0,T,_,x));break;case"Polygon":x=Math.min(x,od(T,b.coordinates,_,x))}if(x===0)return x}return x})(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class gc{constructor(t){this.type=ti,this.key=t}static parse(t,r){if(t.length!==2)return r.error(`Expected 1 argument, but found ${t.length-1} instead.`);const o=t[1];return o==null?r.error("Global state property must be defined."):typeof o!="string"?r.error(`Global state property must be string, but found ${typeof t[1]} instead.`):new gc(o)}evaluate(t){var r;const o=(r=t.globals)===null||r===void 0?void 0:r.globalState;return o&&Object.keys(o).length!==0?Co(o,this.key):null}eachChild(){}outputDefined(){return!1}}const No={"==":Wu,"!=":eu,">":Qu,"<":Yd,">=":Wd,"<=":Kd,array:Hi,at:Po,boolean:Hi,case:dl,coalesce:Io,collator:tu,format:Ro,image:eh,in:tc,"index-of":Ba,interpolate:on,"interpolate-hcl":on,"interpolate-lab":on,length:pl,let:Ao,literal:pa,match:Wr,number:Hi,"number-format":Ju,object:Hi,slice:zo,step:vr,string:Hi,"to-boolean":ea,"to-color":ea,"to-number":ea,"to-string":ea,var:$s,within:Hs,distance:jo,"global-state":gc};class ta{constructor(t,r,o,h){this.name=t,this.type=r,this._evaluate=o,this.args=h}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(t,r){const o=t[0],h=ta.definitions[o];if(!h)return r.error(`Unknown expression "${o}". If you wanted a literal array, use ["literal", [...]].`,0);const g=Array.isArray(h)?h[0]:h.type,_=Array.isArray(h)?[[h[1],h[2]]]:h.overloads,x=_.filter((([T])=>!Array.isArray(T)||T.length===t.length-1));let b=null;for(const[T,C]of x){b=new qs(r.registry,Ln,r.path,null,r.scope);const D=[];let O=!1;for(let F=1;F<t.length;F++){const U=t[F],$=Array.isArray(T)?T[F-1]:T.type,Q=b.parse(U,1+D.length,$);if(!Q){O=!0;break}D.push(Q)}if(!O)if(Array.isArray(T)&&T.length!==D.length)b.error(`Expected ${T.length} arguments, but found ${D.length} instead.`);else{for(let F=0;F<D.length;F++){const U=Array.isArray(T)?T[F]:T.type,$=D[F];b.concat(F+1).checkSubtype(U,$.type)}if(b.errors.length===0)return new ta(o,g,C,D)}}if(x.length===1)r.errors.push(...b.errors);else{const T=(x.length?x:_).map((([D])=>{return O=D,Array.isArray(O)?`(${O.map(Ei).join(", ")})`:`(${Ei(O.type)}...)`;var O})).join(" | "),C=[];for(let D=1;D<t.length;D++){const O=r.parse(t[D],1+C.length);if(!O)return null;C.push(Ei(O.type))}r.error(`Expected arguments of type ${T}, but found (${C.join(", ")}) instead.`)}return null}static register(t,r){ta.definitions=r;for(const o in r)t[o]=ta}}function au(n,[t,r,o,h]){t=t.evaluate(n),r=r.evaluate(n),o=o.evaluate(n);const g=h?h.evaluate(n):1,_=Ui(t,r,o,g);if(_)throw new Mi(_);return new ai(t/255,r/255,o/255,g,!1)}function ma(n,t){return n in t}function su(n,t){const r=t[n];return r===void 0?null:r}function Qr(n){return{type:n}}function Ln(n){if(n instanceof $s)return Ln(n.boundExpression);if(n instanceof ta&&n.name==="error"||n instanceof tu||n instanceof Hs||n instanceof jo||n instanceof gc)return!1;const t=n instanceof ea||n instanceof Hi;let r=!0;return n.eachChild((o=>{r=t?r&&Ln(o):r&&o instanceof pa})),!!r&&Ss(n)&&Uo(n,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"])}function Ss(n){if(n instanceof ta&&(n.name==="get"&&n.args.length===1||n.name==="feature-state"||n.name==="has"&&n.args.length===1||n.name==="properties"||n.name==="geometry-type"||n.name==="id"||/^filter-/.test(n.name))||n instanceof Hs||n instanceof jo)return!1;let t=!0;return n.eachChild((r=>{t&&!Ss(r)&&(t=!1)})),t}function Fo(n){if(n instanceof ta&&n.name==="feature-state")return!1;let t=!0;return n.eachChild((r=>{t&&!Fo(r)&&(t=!1)})),t}function Uo(n,t){if(n instanceof ta&&t.indexOf(n.name)>=0)return!1;let r=!0;return n.eachChild((o=>{r&&!Uo(o,t)&&(r=!1)})),r}function _c(n){return{result:"success",value:n}}function Ks(n){return{result:"error",value:n}}function ia(n){return n["property-type"]==="data-driven"||n["property-type"]==="cross-faded-data-driven"}function oh(n){return!!n.expression&&n.expression.parameters.indexOf("zoom")>-1}function Sl(n){return!!n.expression&&n.expression.interpolated}function ni(n){return n instanceof Number?"number":n instanceof String?"string":n instanceof Boolean?"boolean":Array.isArray(n)?"array":n===null?"null":typeof n}function yc(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)&&jt(n)===tr}function ra(n){return n}function ou(n,t){const r=n.stops&&typeof n.stops[0][0]=="object",o=r||!(r||n.property!==void 0),h=n.type||(Sl(t)?"exponential":"interval"),g=(function(C){switch(C.type){case"color":return ai.parse;case"padding":return qr.parse;case"numberArray":return nn.parse;case"colorArray":return Dr.parse;default:return null}})(t);if(g&&((n=mn({},n)).stops&&(n.stops=n.stops.map((C=>[C[0],g(C[1])]))),n.default=g(n.default?n.default:t.default)),n.colorSpace&&(_=n.colorSpace)!=="rgb"&&_!=="hcl"&&_!=="lab")throw new Error(`Unknown color space: "${n.colorSpace}"`);var _;const x=(function(C){switch(C){case"exponential":return Ws;case"interval":return lu;case"categorical":return lh;case"identity":return ch;default:throw new Error(`Unknown function type "${C}"`)}})(h);let b,T;if(h==="categorical"){b=Object.create(null);for(const C of n.stops)b[C[0]]=C[1];T=typeof n.stops[0][0]}if(r){const C={},D=[];for(let U=0;U<n.stops.length;U++){const $=n.stops[U],Q=$[0].zoom;C[Q]===void 0&&(C[Q]={zoom:Q,type:n.type,property:n.property,default:n.default,stops:[]},D.push(Q)),C[Q].stops.push([$[0].value,$[1]])}const O=[];for(const U of D)O.push([C[U].zoom,ou(C[U],t)]);const F={name:"linear"};return{kind:"composite",interpolationType:F,interpolationFactor:on.interpolationFactor.bind(void 0,F),zoomStops:O.map((U=>U[0])),evaluate:({zoom:U},$)=>Ws({stops:O,base:n.base},t,U).evaluate(U,$)}}if(o){const C=h==="exponential"?{name:"exponential",base:n.base!==void 0?n.base:1}:null;return{kind:"camera",interpolationType:C,interpolationFactor:on.interpolationFactor.bind(void 0,C),zoomStops:n.stops.map((D=>D[0])),evaluate:({zoom:D})=>x(n,t,D,b,T)}}return{kind:"source",evaluate(C,D){const O=D&&D.properties?D.properties[n.property]:void 0;return O===void 0?yn(n.default,t.default):x(n,t,O,b,T)}}}function yn(n,t,r){return n!==void 0?n:t!==void 0?t:r!==void 0?r:void 0}function lh(n,t,r,o,h){return yn(typeof r===h?o[r]:void 0,n.default,t.default)}function lu(n,t,r){if(ni(r)!=="number")return yn(n.default,t.default);const o=n.stops.length;if(o===1||r<=n.stops[0][0])return n.stops[0][1];if(r>=n.stops[o-1][0])return n.stops[o-1][1];const h=ko(n.stops.map((g=>g[0])),r);return n.stops[h][1]}function Ws(n,t,r){const o=n.base!==void 0?n.base:1;if(ni(r)!=="number")return yn(n.default,t.default);const h=n.stops.length;if(h===1||r<=n.stops[0][0])return n.stops[0][1];if(r>=n.stops[h-1][0])return n.stops[h-1][1];const g=ko(n.stops.map((C=>C[0])),r),_=(function(C,D,O,F){const U=F-O,$=C-O;return U===0?0:D===1?$/U:(Math.pow(D,$)-1)/(Math.pow(D,U)-1)})(r,o,n.stops[g][0],n.stops[g+1][0]),x=n.stops[g][1],b=n.stops[g+1][1],T=os[t.type]||ra;return typeof x.evaluate=="function"?{evaluate(...C){const D=x.evaluate.apply(void 0,C),O=b.evaluate.apply(void 0,C);if(D!==void 0&&O!==void 0)return T(D,O,_,n.colorSpace)}}:T(x,b,_,n.colorSpace)}function ch(n,t,r){switch(t.type){case"color":r=ai.parse(r);break;case"formatted":r=Nr.fromString(r.toString());break;case"resolvedImage":r=sn.fromString(r.toString());break;case"padding":r=qr.parse(r);break;case"colorArray":r=Dr.parse(r);break;case"numberArray":r=nn.parse(r);break;default:ni(r)===t.type||t.type==="enum"&&t.values[r]||(r=void 0)}return yn(r,n.default,t.default)}ta.register(No,{error:[{kind:"error"},[ei],(n,[t])=>{throw new Mi(t.evaluate(n))}],typeof:[ei,[ti],(n,[t])=>Ei(jt(t.evaluate(n)))],"to-rgba":[tn(gt,4),[Rr],(n,[t])=>{const[r,o,h,g]=t.evaluate(n).rgb;return[255*r,255*o,255*h,g]}],rgb:[Rr,[gt,gt,gt],au],rgba:[Rr,[gt,gt,gt,gt],au],has:{type:Ht,overloads:[[[ei],(n,[t])=>ma(t.evaluate(n),n.properties())],[[ei,tr],(n,[t,r])=>ma(t.evaluate(n),r.evaluate(n))]]},get:{type:ti,overloads:[[[ei],(n,[t])=>su(t.evaluate(n),n.properties())],[[ei,tr],(n,[t,r])=>su(t.evaluate(n),r.evaluate(n))]]},"feature-state":[ti,[ei],(n,[t])=>su(t.evaluate(n),n.featureState||{})],properties:[tr,[],n=>n.properties()],"geometry-type":[ei,[],n=>n.geometryType()],id:[ti,[],n=>n.id()],zoom:[gt,[],n=>n.globals.zoom],"heatmap-density":[gt,[],n=>n.globals.heatmapDensity||0],elevation:[gt,[],n=>n.globals.elevation||0],"line-progress":[gt,[],n=>n.globals.lineProgress||0],accumulated:[ti,[],n=>n.globals.accumulated===void 0?null:n.globals.accumulated],"+":[gt,Qr(gt),(n,t)=>{let r=0;for(const o of t)r+=o.evaluate(n);return r}],"*":[gt,Qr(gt),(n,t)=>{let r=1;for(const o of t)r*=o.evaluate(n);return r}],"-":{type:gt,overloads:[[[gt,gt],(n,[t,r])=>t.evaluate(n)-r.evaluate(n)],[[gt],(n,[t])=>-t.evaluate(n)]]},"/":[gt,[gt,gt],(n,[t,r])=>t.evaluate(n)/r.evaluate(n)],"%":[gt,[gt,gt],(n,[t,r])=>t.evaluate(n)%r.evaluate(n)],ln2:[gt,[],()=>Math.LN2],pi:[gt,[],()=>Math.PI],e:[gt,[],()=>Math.E],"^":[gt,[gt,gt],(n,[t,r])=>Math.pow(t.evaluate(n),r.evaluate(n))],sqrt:[gt,[gt],(n,[t])=>Math.sqrt(t.evaluate(n))],log10:[gt,[gt],(n,[t])=>Math.log(t.evaluate(n))/Math.LN10],ln:[gt,[gt],(n,[t])=>Math.log(t.evaluate(n))],log2:[gt,[gt],(n,[t])=>Math.log(t.evaluate(n))/Math.LN2],sin:[gt,[gt],(n,[t])=>Math.sin(t.evaluate(n))],cos:[gt,[gt],(n,[t])=>Math.cos(t.evaluate(n))],tan:[gt,[gt],(n,[t])=>Math.tan(t.evaluate(n))],asin:[gt,[gt],(n,[t])=>Math.asin(t.evaluate(n))],acos:[gt,[gt],(n,[t])=>Math.acos(t.evaluate(n))],atan:[gt,[gt],(n,[t])=>Math.atan(t.evaluate(n))],min:[gt,Qr(gt),(n,t)=>Math.min(...t.map((r=>r.evaluate(n))))],max:[gt,Qr(gt),(n,t)=>Math.max(...t.map((r=>r.evaluate(n))))],abs:[gt,[gt],(n,[t])=>Math.abs(t.evaluate(n))],round:[gt,[gt],(n,[t])=>{const r=t.evaluate(n);return r<0?-Math.round(-r):Math.round(r)}],floor:[gt,[gt],(n,[t])=>Math.floor(t.evaluate(n))],ceil:[gt,[gt],(n,[t])=>Math.ceil(t.evaluate(n))],"filter-==":[Ht,[ei,ti],(n,[t,r])=>n.properties()[t.value]===r.value],"filter-id-==":[Ht,[ti],(n,[t])=>n.id()===t.value],"filter-type-==":[Ht,[ei],(n,[t])=>n.geometryType()===t.value],"filter-<":[Ht,[ei,ti],(n,[t,r])=>{const o=n.properties()[t.value],h=r.value;return typeof o==typeof h&&o<h}],"filter-id-<":[Ht,[ti],(n,[t])=>{const r=n.id(),o=t.value;return typeof r==typeof o&&r<o}],"filter->":[Ht,[ei,ti],(n,[t,r])=>{const o=n.properties()[t.value],h=r.value;return typeof o==typeof h&&o>h}],"filter-id->":[Ht,[ti],(n,[t])=>{const r=n.id(),o=t.value;return typeof r==typeof o&&r>o}],"filter-<=":[Ht,[ei,ti],(n,[t,r])=>{const o=n.properties()[t.value],h=r.value;return typeof o==typeof h&&o<=h}],"filter-id-<=":[Ht,[ti],(n,[t])=>{const r=n.id(),o=t.value;return typeof r==typeof o&&r<=o}],"filter->=":[Ht,[ei,ti],(n,[t,r])=>{const o=n.properties()[t.value],h=r.value;return typeof o==typeof h&&o>=h}],"filter-id->=":[Ht,[ti],(n,[t])=>{const r=n.id(),o=t.value;return typeof r==typeof o&&r>=o}],"filter-has":[Ht,[ti],(n,[t])=>t.value in n.properties()],"filter-has-id":[Ht,[],n=>n.id()!==null&&n.id()!==void 0],"filter-type-in":[Ht,[tn(ei)],(n,[t])=>t.value.indexOf(n.geometryType())>=0],"filter-id-in":[Ht,[tn(ti)],(n,[t])=>t.value.indexOf(n.id())>=0],"filter-in-small":[Ht,[ei,tn(ti)],(n,[t,r])=>r.value.indexOf(n.properties()[t.value])>=0],"filter-in-large":[Ht,[ei,tn(ti)],(n,[t,r])=>(function(o,h,g,_){for(;g<=_;){const x=g+_>>1;if(h[x]===o)return!0;h[x]>o?_=x-1:g=x+1}return!1})(n.properties()[t.value],r.value,0,r.value.length-1)],all:{type:Ht,overloads:[[[Ht,Ht],(n,[t,r])=>t.evaluate(n)&&r.evaluate(n)],[Qr(Ht),(n,t)=>{for(const r of t)if(!r.evaluate(n))return!1;return!0}]]},any:{type:Ht,overloads:[[[Ht,Ht],(n,[t,r])=>t.evaluate(n)||r.evaluate(n)],[Qr(Ht),(n,t)=>{for(const r of t)if(r.evaluate(n))return!0;return!1}]]},"!":[Ht,[Ht],(n,[t])=>!t.evaluate(n)],"is-supported-script":[Ht,[ei],(n,[t])=>{const r=n.globals&&n.globals.isSupportedScript;return!r||r(t.evaluate(n))}],upcase:[ei,[ei],(n,[t])=>t.evaluate(n).toUpperCase()],downcase:[ei,[ei],(n,[t])=>t.evaluate(n).toLowerCase()],concat:[ei,Qr(ti),(n,t)=>t.map((r=>$t(r.evaluate(n)))).join("")],"resolved-locale":[ei,[Wl],(n,[t])=>t.evaluate(n).resolvedLocale()]});class xc{constructor(t,r){this.expression=t,this._warningHistory={},this._evaluator=new Yu,this._defaultValue=r?(function(o){if(o.type==="color"&&yc(o.default))return new ai(0,0,0,0);switch(o.type){case"color":return ai.parse(o.default)||null;case"padding":return qr.parse(o.default)||null;case"numberArray":return nn.parse(o.default)||null;case"colorArray":return Dr.parse(o.default)||null;case"variableAnchorOffsetCollection":return an.parse(o.default)||null;case"projectionDefinition":return gr.parse(o.default)||null;default:return o.default===void 0?null:o.default}})(r):null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(t,r,o,h,g,_){return this._evaluator.globals=t,this._evaluator.feature=r,this._evaluator.featureState=o,this._evaluator.canonical=h,this._evaluator.availableImages=g||null,this._evaluator.formattedSection=_,this.expression.evaluate(this._evaluator)}evaluate(t,r,o,h,g,_){this._evaluator.globals=t,this._evaluator.feature=r||null,this._evaluator.featureState=o||null,this._evaluator.canonical=h,this._evaluator.availableImages=g||null,this._evaluator.formattedSection=_||null;try{const x=this.expression.evaluate(this._evaluator);if(x==null||typeof x=="number"&&x!=x)return this._defaultValue;if(this._enumValues&&!(x in this._enumValues))throw new Mi(`Expected value to be one of ${Object.keys(this._enumValues).map((b=>JSON.stringify(b))).join(", ")}, but found ${JSON.stringify(x)} instead.`);return x}catch(x){return this._warningHistory[x.message]||(this._warningHistory[x.message]=!0,typeof console<"u"&&console.warn(x.message)),this._defaultValue}}}function Ts(n){return Array.isArray(n)&&n.length>0&&typeof n[0]=="string"&&n[0]in No}function cs(n,t){const r=new qs(No,Ln,[],t?(function(h){const g={color:Rr,string:ei,number:gt,enum:ei,boolean:Ht,formatted:qn,padding:ys,numberArray:So,colorArray:es,projectionDefinition:fa,resolvedImage:mr,variableAnchorOffsetCollection:Wc};return h.type==="array"?tn(g[h.value]||ti,h.length):g[h.type]})(t):void 0),o=r.parse(n,void 0,void 0,void 0,t&&t.type==="string"?{typeAnnotation:"coerce"}:void 0);return o?_c(new xc(o,t)):Ks(r.errors)}class Qs{constructor(t,r){this.kind=t,this._styleExpression=r,this.isStateDependent=t!=="constant"&&!Fo(r.expression),this.globalStateRefs=aa(r.expression)}evaluateWithoutErrorHandling(t,r,o,h,g,_){return this._styleExpression.evaluateWithoutErrorHandling(t,r,o,h,g,_)}evaluate(t,r,o,h,g,_){return this._styleExpression.evaluate(t,r,o,h,g,_)}}class Tl{constructor(t,r,o,h){this.kind=t,this.zoomStops=o,this._styleExpression=r,this.isStateDependent=t!=="camera"&&!Fo(r.expression),this.globalStateRefs=aa(r.expression),this.interpolationType=h}evaluateWithoutErrorHandling(t,r,o,h,g,_){return this._styleExpression.evaluateWithoutErrorHandling(t,r,o,h,g,_)}evaluate(t,r,o,h,g,_){return this._styleExpression.evaluate(t,r,o,h,g,_)}interpolationFactor(t,r,o){return this.interpolationType?on.interpolationFactor(this.interpolationType,t,r,o):0}}function na(n,t){const r=cs(n,t);if(r.result==="error")return r;const o=r.value.expression,h=Ss(o);if(!h&&!ia(t))return Ks([new pr("","data expressions not supported")]);const g=Uo(o,["zoom"]);if(!g&&!oh(t))return Ks([new pr("","zoom expressions not supported")]);const _=Oa(o);return _||g?_ instanceof pr?Ks([_]):_ instanceof on&&!Sl(t)?Ks([new pr("",'"interpolate" expressions cannot be used with this property')]):_c(_?new Tl(h?"camera":"composite",r.value,_.labels,_ instanceof on?_.interpolation:void 0):new Qs(h?"constant":"source",r.value)):Ks([new pr("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class xn{constructor(t,r){this._parameters=t,this._specification=r,mn(this,ou(this._parameters,this._specification))}static deserialize(t){return new xn(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function Oa(n){let t=null;if(n instanceof Ao)t=Oa(n.result);else if(n instanceof Io){for(const r of n.args)if(t=Oa(r),t)break}else(n instanceof vr||n instanceof on)&&n.input instanceof ta&&n.input.name==="zoom"&&(t=n);return t instanceof pr||n.eachChild((r=>{const o=Oa(r);o instanceof pr?t=o:!t&&o?t=new pr("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&o&&t!==o&&(t=new pr("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),t}function aa(n,t=new Set){return n instanceof gc&&t.add(n.key),n.eachChild((r=>{aa(r,t)})),t}function ga(n){if(n===!0||n===!1)return!0;if(!Array.isArray(n)||n.length===0)return!1;switch(n[0]){case"has":return n.length>=2&&n[1]!=="$id"&&n[1]!=="$type";case"in":return n.length>=3&&(typeof n[1]!="string"||Array.isArray(n[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return n.length!==3||Array.isArray(n[1])||Array.isArray(n[2]);case"any":case"all":for(const t of n.slice(1))if(!ga(t)&&typeof t!="boolean")return!1;return!0;default:return!0}}const Ms={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Js(n){if(n==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};ga(n)||(n=Lr(n));const t=cs(n,Ms);if(t.result==="error")throw new Error(t.value.map((r=>`${r.key}: ${r.message}`)).join(", "));return{filter:(r,o,h)=>t.value.evaluate(r,o,{},h),needGeometry:Ml(n),getGlobalStateRefs:()=>aa(t.value.expression)}}function vc(n,t){return n<t?-1:n>t?1:0}function Ml(n){if(!Array.isArray(n))return!1;if(n[0]==="within"||n[0]==="distance")return!0;for(let t=1;t<n.length;t++)if(Ml(n[t]))return!0;return!1}function Lr(n){if(!n)return!0;const t=n[0];return n.length<=1?t!=="any":t==="=="?or(n[1],n[2],"=="):t==="!="?sa(or(n[1],n[2],"==")):t==="<"||t===">"||t==="<="||t===">="?or(n[1],n[2],t):t==="any"?(r=n.slice(1),["any"].concat(r.map(Lr))):t==="all"?["all"].concat(n.slice(1).map(Lr)):t==="none"?["all"].concat(n.slice(1).map(Lr).map(sa)):t==="in"?Ci(n[1],n.slice(2)):t==="!in"?sa(Ci(n[1],n.slice(2))):t==="has"?eo(n[1]):t!=="!has"||sa(eo(n[1]));var r}function or(n,t,r){switch(n){case"$type":return[`filter-type-${r}`,t];case"$id":return[`filter-id-${r}`,t];default:return[`filter-${r}`,n,t]}}function Ci(n,t){if(t.length===0)return!1;switch(n){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some((r=>typeof r!=typeof t[0]))?["filter-in-large",n,["literal",t.sort(vc)]]:["filter-in-small",n,["literal",t]]}}function eo(n){switch(n){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",n]}}function sa(n){return["!",n]}function bc(n){const t=typeof n;if(t==="number"||t==="boolean"||t==="string"||n==null)return JSON.stringify(n);if(Array.isArray(n)){let h="[";for(const g of n)h+=`${bc(g)},`;return`${h}]`}const r=Object.keys(n).sort();let o="{";for(let h=0;h<r.length;h++)o+=`${JSON.stringify(r[h])}:${bc(n[r[h]])},`;return`${o}}`}function Vo(n){let t="";for(const r of Zt)t+=`/${bc(n[r])}`;return t}function cu(n){const t=n.value;return t?[new st(n.key,t,"constants have been deprecated as of v8")]:[]}function lr(n){return n instanceof Number||n instanceof String||n instanceof Boolean?n.valueOf():n}function Hn(n){if(Array.isArray(n))return n.map(Hn);if(n instanceof Object&&!(n instanceof Number||n instanceof String||n instanceof Boolean)){const t={};for(const r in n)t[r]=Hn(n[r]);return t}return lr(n)}function vn(n){const t=n.key,r=n.value,o=n.valueSpec||{},h=n.objectElementValidators||{},g=n.style,_=n.styleSpec,x=n.validateSpec;let b=[];const T=ni(r);if(T!=="object")return[new st(t,r,`object expected, ${T} found`)];for(const C in r){const D=C.split(".")[0],O=Co(o,D)||o["*"];let F;if(Co(h,D))F=h[D];else if(Co(o,D))F=x;else if(h["*"])F=h["*"];else{if(!o["*"]){b.push(new st(t,r[C],`unknown property "${C}"`));continue}F=x}b=b.concat(F({key:(t&&`${t}.`)+C,value:r[C],valueSpec:O,style:g,styleSpec:_,object:r,objectKey:C,validateSpec:x},r))}for(const C in o)h[C]||o[C].required&&o[C].default===void 0&&r[C]===void 0&&b.push(new st(t,r,`missing required property "${C}"`));return b}function wc(n){const t=n.value,r=n.valueSpec,o=n.style,h=n.styleSpec,g=n.key,_=n.arrayElementValidator||n.validateSpec;if(ni(t)!=="array")return[new st(g,t,`array expected, ${ni(t)} found`)];if(r.length&&t.length!==r.length)return[new st(g,t,`array length ${r.length} expected, length ${t.length} found`)];if(r["min-length"]&&t.length<r["min-length"])return[new st(g,t,`array length at least ${r["min-length"]} expected, length ${t.length} found`)];let x={type:r.value,values:r.values};h.$version<7&&(x.function=r.function),ni(r.value)==="object"&&(x=r.value);let b=[];for(let T=0;T<t.length;T++)b=b.concat(_({array:t,arrayIndex:T,value:t[T],valueSpec:x,validateSpec:n.validateSpec,style:o,styleSpec:h,key:`${g}[${T}]`}));return b}function Cs(n){const t=n.key,r=n.value,o=n.valueSpec;let h=ni(r);return h==="number"&&r!=r&&(h="NaN"),h!=="number"?[new st(t,r,`number expected, ${h} found`)]:"minimum"in o&&r<o.minimum?[new st(t,r,`${r} is less than the minimum value ${o.minimum}`)]:"maximum"in o&&r>o.maximum?[new st(t,r,`${r} is greater than the maximum value ${o.maximum}`)]:[]}function uu(n){const t=n.valueSpec,r=lr(n.value.type);let o,h,g,_={};const x=r!=="categorical"&&n.value.property===void 0,b=!x,T=ni(n.value.stops)==="array"&&ni(n.value.stops[0])==="array"&&ni(n.value.stops[0][0])==="object",C=vn({key:n.key,value:n.value,valueSpec:n.styleSpec.function,validateSpec:n.validateSpec,style:n.style,styleSpec:n.styleSpec,objectElementValidators:{stops:function(F){if(r==="identity")return[new st(F.key,F.value,'identity function may not have a "stops" property')];let U=[];const $=F.value;return U=U.concat(wc({key:F.key,value:$,valueSpec:F.valueSpec,validateSpec:F.validateSpec,style:F.style,styleSpec:F.styleSpec,arrayElementValidator:D})),ni($)==="array"&&$.length===0&&U.push(new st(F.key,$,"array must have at least one stop")),U},default:function(F){return F.validateSpec({key:F.key,value:F.value,valueSpec:t,validateSpec:F.validateSpec,style:F.style,styleSpec:F.styleSpec})}}});return r==="identity"&&x&&C.push(new st(n.key,n.value,'missing required property "property"')),r==="identity"||n.value.stops||C.push(new st(n.key,n.value,'missing required property "stops"')),r==="exponential"&&n.valueSpec.expression&&!Sl(n.valueSpec)&&C.push(new st(n.key,n.value,"exponential functions not supported")),n.styleSpec.$version>=8&&(b&&!ia(n.valueSpec)?C.push(new st(n.key,n.value,"property functions not supported")):x&&!oh(n.valueSpec)&&C.push(new st(n.key,n.value,"zoom functions not supported"))),r!=="categorical"&&!T||n.value.property!==void 0||C.push(new st(n.key,n.value,'"property" property is required')),C;function D(F){let U=[];const $=F.value,Q=F.key;if(ni($)!=="array")return[new st(Q,$,`array expected, ${ni($)} found`)];if($.length!==2)return[new st(Q,$,`array length 2 expected, length ${$.length} found`)];if(T){if(ni($[0])!=="object")return[new st(Q,$,`object expected, ${ni($[0])} found`)];if($[0].zoom===void 0)return[new st(Q,$,"object stop key must have zoom")];if($[0].value===void 0)return[new st(Q,$,"object stop key must have value")];if(g&&g>lr($[0].zoom))return[new st(Q,$[0].zoom,"stop zoom values must appear in ascending order")];lr($[0].zoom)!==g&&(g=lr($[0].zoom),h=void 0,_={}),U=U.concat(vn({key:`${Q}[0]`,value:$[0],valueSpec:{zoom:{}},validateSpec:F.validateSpec,style:F.style,styleSpec:F.styleSpec,objectElementValidators:{zoom:Cs,value:O}}))}else U=U.concat(O({key:`${Q}[0]`,value:$[0],validateSpec:F.validateSpec,style:F.style,styleSpec:F.styleSpec},$));return Ts(Hn($[1]))?U.concat([new st(`${Q}[1]`,$[1],"expressions are not allowed in function stops.")]):U.concat(F.validateSpec({key:`${Q}[1]`,value:$[1],valueSpec:t,validateSpec:F.validateSpec,style:F.style,styleSpec:F.styleSpec}))}function O(F,U){const $=ni(F.value),Q=lr(F.value),re=F.value!==null?F.value:U;if(o){if($!==o)return[new st(F.key,re,`${$} stop domain type must match previous stop domain type ${o}`)]}else o=$;if($!=="number"&&$!=="string"&&$!=="boolean")return[new st(F.key,re,"stop domain value must be a number, string, or boolean")];if($!=="number"&&r!=="categorical"){let be=`number expected, ${$} found`;return ia(t)&&r===void 0&&(be+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new st(F.key,re,be)]}return r!=="categorical"||$!=="number"||isFinite(Q)&&Math.floor(Q)===Q?r!=="categorical"&&$==="number"&&h!==void 0&&Q<h?[new st(F.key,re,"stop domain values must appear in ascending order")]:(h=Q,r==="categorical"&&Q in _?[new st(F.key,re,"stop domain values must be unique")]:(_[Q]=!0,[])):[new st(F.key,re,`integer expected, found ${Q}`)]}}function oa(n){const t=(n.expressionContext==="property"?na:cs)(Hn(n.value),n.valueSpec);if(t.result==="error")return t.value.map((o=>new st(`${n.key}${o.key}`,n.value,o.message)));const r=t.value.expression||t.value._styleExpression.expression;if(n.expressionContext==="property"&&n.propertyKey==="text-font"&&!r.outputDefined())return[new st(n.key,n.value,`Invalid data expression for "${n.propertyKey}". Output values must be contained as literals within the expression.`)];if(n.expressionContext==="property"&&n.propertyType==="layout"&&!Fo(r))return[new st(n.key,n.value,'"feature-state" data expressions are not supported with layout properties.')];if(n.expressionContext==="filter"&&!Fo(r))return[new st(n.key,n.value,'"feature-state" data expressions are not supported with filters.')];if(n.expressionContext&&n.expressionContext.indexOf("cluster")===0){if(!Uo(r,["zoom","feature-state"]))return[new st(n.key,n.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(n.expressionContext==="cluster-initial"&&!Ss(r))return[new st(n.key,n.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function _a(n){const t=n.key,r=n.value,o=ni(r);return o!=="string"?[new st(t,r,`color expected, ${o} found`)]:ai.parse(String(r))?[]:[new st(t,r,`color expected, "${r}" found`)]}function bn(n){const t=n.key,r=n.value,o=n.valueSpec,h=[];return Array.isArray(o.values)?o.values.indexOf(lr(r))===-1&&h.push(new st(t,r,`expected one of [${o.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(o.values).indexOf(lr(r))===-1&&h.push(new st(t,r,`expected one of [${Object.keys(o.values).join(", ")}], ${JSON.stringify(r)} found`)),h}function ja(n){return ga(Hn(n.value))?oa(mn({},n,{expressionContext:"filter",valueSpec:{value:"boolean"}})):hu(n)}function hu(n){const t=n.value,r=n.key;if(ni(t)!=="array")return[new st(r,t,`array expected, ${ni(t)} found`)];const o=n.styleSpec;let h,g=[];if(t.length<1)return[new st(r,t,"filter array must have at least 1 element")];switch(g=g.concat(bn({key:`${r}[0]`,value:t[0],valueSpec:o.filter_operator,style:n.style,styleSpec:n.styleSpec})),lr(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&lr(t[1])==="$type"&&g.push(new st(r,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":t.length!==3&&g.push(new st(r,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(h=ni(t[1]),h!=="string"&&g.push(new st(`${r}[1]`,t[1],`string expected, ${h} found`)));for(let _=2;_<t.length;_++)h=ni(t[_]),lr(t[1])==="$type"?g=g.concat(bn({key:`${r}[${_}]`,value:t[_],valueSpec:o.geometry_type,style:n.style,styleSpec:n.styleSpec})):h!=="string"&&h!=="number"&&h!=="boolean"&&g.push(new st(`${r}[${_}]`,t[_],`string, number, or boolean expected, ${h} found`));break;case"any":case"all":case"none":for(let _=1;_<t.length;_++)g=g.concat(hu({key:`${r}[${_}]`,value:t[_],style:n.style,styleSpec:n.styleSpec}));break;case"has":case"!has":h=ni(t[1]),t.length!==2?g.push(new st(r,t,`filter array for "${t[0]}" operator must have 2 elements`)):h!=="string"&&g.push(new st(`${r}[1]`,t[1],`string expected, ${h} found`))}return g}function du(n,t){const r=n.key,o=n.validateSpec,h=n.style,g=n.styleSpec,_=n.value,x=n.objectKey,b=g[`${t}_${n.layerType}`];if(!b)return[];const T=x.match(/^(.*)-transition$/);if(t==="paint"&&T&&b[T[1]]&&b[T[1]].transition)return o({key:r,value:_,valueSpec:g.transition,style:h,styleSpec:g});const C=n.valueSpec||b[x];if(!C)return[new st(r,_,`unknown property "${x}"`)];let D;if(ni(_)==="string"&&ia(C)&&!C.tokens&&(D=/^{([^}]+)}$/.exec(_)))return[new st(r,_,`"${x}" does not support interpolation syntax
173Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(D[1])} }\`.`)];const O=[];return n.layerType==="symbol"&&(x==="text-field"&&h&&!h.glyphs&&O.push(new st(r,_,'use of "text-field" requires a style "glyphs" property')),x==="text-font"&&yc(Hn(_))&&lr(_.type)==="identity"&&O.push(new st(r,_,'"text-font" does not support identity functions'))),O.concat(o({key:n.key,value:_,valueSpec:C,style:h,styleSpec:g,expressionContext:"property",propertyType:t,propertyKey:x}))}function Cl(n){return du(n,"paint")}function Sc(n){return du(n,"layout")}function to(n){let t=[];const r=n.value,o=n.key,h=n.style,g=n.styleSpec;if(ni(r)!=="object")return[new st(o,r,`object expected, ${ni(r)} found`)];r.type||r.ref||t.push(new st(o,r,'either "type" or "ref" is required'));let _=lr(r.type);const x=lr(r.ref);if(r.id){const b=lr(r.id);for(let T=0;T<n.arrayIndex;T++){const C=h.layers[T];lr(C.id)===b&&t.push(new st(o,r.id,`duplicate layer id "${r.id}", previously used at line ${C.id.__line__}`))}}if("ref"in r){let b;["type","source","source-layer","filter","layout"].forEach((T=>{T in r&&t.push(new st(o,r[T],`"${T}" is prohibited for ref layers`))})),h.layers.forEach((T=>{lr(T.id)===x&&(b=T)})),b?b.ref?t.push(new st(o,r.ref,"ref cannot reference another ref layer")):_=lr(b.type):t.push(new st(o,r.ref,`ref layer "${x}" not found`))}else if(_!=="background")if(r.source){const b=h.sources&&h.sources[r.source],T=b&&lr(b.type);b?T==="vector"&&_==="raster"?t.push(new st(o,r.source,`layer "${r.id}" requires a raster source`)):T!=="raster-dem"&&_==="hillshade"||T!=="raster-dem"&&_==="color-relief"?t.push(new st(o,r.source,`layer "${r.id}" requires a raster-dem source`)):T==="raster"&&_!=="raster"?t.push(new st(o,r.source,`layer "${r.id}" requires a vector source`)):T!=="vector"||r["source-layer"]?T==="raster-dem"&&_!=="hillshade"&&_!=="color-relief"?t.push(new st(o,r.source,"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")):_!=="line"||!r.paint||!r.paint["line-gradient"]||T==="geojson"&&b.lineMetrics||t.push(new st(o,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new st(o,r,`layer "${r.id}" must specify a "source-layer"`)):t.push(new st(o,r.source,`source "${r.source}" not found`))}else t.push(new st(o,r,'missing required property "source"'));return t=t.concat(vn({key:o,value:r,valueSpec:g.layer,style:n.style,styleSpec:n.styleSpec,validateSpec:n.validateSpec,objectElementValidators:{"*":()=>[],type:()=>n.validateSpec({key:`${o}.type`,value:r.type,valueSpec:g.layer.type,style:n.style,styleSpec:n.styleSpec,validateSpec:n.validateSpec,object:r,objectKey:"type"}),filter:ja,layout:b=>vn({layer:r,key:b.key,value:b.value,style:b.style,styleSpec:b.styleSpec,validateSpec:b.validateSpec,objectElementValidators:{"*":T=>Sc(mn({layerType:_},T))}}),paint:b=>vn({layer:r,key:b.key,value:b.value,style:b.style,styleSpec:b.styleSpec,validateSpec:b.validateSpec,objectElementValidators:{"*":T=>Cl(mn({layerType:_},T))}})}})),t}function Xi(n){const t=n.value,r=n.key,o=ni(t);return o!=="string"?[new st(r,t,`string expected, ${o} found`)]:[]}const Es={promoteId:function({key:n,value:t}){if(ni(t)==="string")return Xi({key:n,value:t});{const r=[];for(const o in t)r.push(...Xi({key:`${n}.${o}`,value:t[o]}));return r}}};function Bn(n){const t=n.value,r=n.key,o=n.styleSpec,h=n.style,g=n.validateSpec;if(!t.type)return[new st(r,t,'"type" is required')];const _=lr(t.type);let x;switch(_){case"vector":case"raster":return x=vn({key:r,value:t,valueSpec:o[`source_${_.replace("-","_")}`],style:n.style,styleSpec:o,objectElementValidators:Es,validateSpec:g}),x;case"raster-dem":return x=(function(b){var T;const C=(T=b.sourceName)!==null&&T!==void 0?T:"",D=b.value,O=b.styleSpec,F=O.source_raster_dem,U=b.style;let $=[];const Q=ni(D);if(D===void 0)return $;if(Q!=="object")return $.push(new st("source_raster_dem",D,`object expected, ${Q} found`)),$;const re=lr(D.encoding)==="custom",be=["redFactor","greenFactor","blueFactor","baseShift"],he=b.value.encoding?`"${b.value.encoding}"`:"Default";for(const pe in D)!re&&be.includes(pe)?$.push(new st(pe,D[pe],`In "${C}": "${pe}" is only valid when "encoding" is set to "custom". ${he} encoding found`)):F[pe]?$=$.concat(b.validateSpec({key:pe,value:D[pe],valueSpec:F[pe],validateSpec:b.validateSpec,style:U,styleSpec:O})):$.push(new st(pe,D[pe],`unknown property "${pe}"`));return $})({sourceName:r,value:t,style:n.style,styleSpec:o,validateSpec:g}),x;case"geojson":if(x=vn({key:r,value:t,valueSpec:o.source_geojson,style:h,styleSpec:o,validateSpec:g,objectElementValidators:Es}),t.cluster)for(const b in t.clusterProperties){const[T,C]=t.clusterProperties[b],D=typeof T=="string"?[T,["accumulated"],["get",b]]:T;x.push(...oa({key:`${r}.${b}.map`,value:C,expressionContext:"cluster-map"})),x.push(...oa({key:`${r}.${b}.reduce`,value:D,expressionContext:"cluster-reduce"}))}return x;case"video":return vn({key:r,value:t,valueSpec:o.source_video,style:h,validateSpec:g,styleSpec:o});case"image":return vn({key:r,value:t,valueSpec:o.source_image,style:h,validateSpec:g,styleSpec:o});case"canvas":return[new st(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return bn({key:`${r}.type`,value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function El(n){const t=n.value,r=n.styleSpec,o=r.light,h=n.style;let g=[];const _=ni(t);if(t===void 0)return g;if(_!=="object")return g=g.concat([new st("light",t,`object expected, ${_} found`)]),g;for(const x in t){const b=x.match(/^(.*)-transition$/);g=g.concat(b&&o[b[1]]&&o[b[1]].transition?n.validateSpec({key:x,value:t[x],valueSpec:r.transition,validateSpec:n.validateSpec,style:h,styleSpec:r}):o[x]?n.validateSpec({key:x,value:t[x],valueSpec:o[x],validateSpec:n.validateSpec,style:h,styleSpec:r}):[new st(x,t[x],`unknown property "${x}"`)])}return g}function uh(n){const t=n.value,r=n.styleSpec,o=r.sky,h=n.style,g=ni(t);if(t===void 0)return[];if(g!=="object")return[new st("sky",t,`object expected, ${g} found`)];let _=[];for(const x in t)_=_.concat(o[x]?n.validateSpec({key:x,value:t[x],valueSpec:o[x],style:h,styleSpec:r}):[new st(x,t[x],`unknown property "${x}"`)]);return _}function ld(n){const t=n.value,r=n.styleSpec,o=r.terrain,h=n.style;let g=[];const _=ni(t);if(t===void 0)return g;if(_!=="object")return g=g.concat([new st("terrain",t,`object expected, ${_}
173 found`)]),g;for(const x in t)g=g.concat(o[x]?n.validateSpec({key:x,value:t[x],valueSpec:o[x],validateSpec:n.validateSpec,style:h,styleSpec:r}):[new st(x,t[x],`unknown property "${x}"`)]);return g}function Fr(n){let t=[];const r=n.value,o=n.key;if(Array.isArray(r)){const h=[],g=[];for(const _ in r)r[_].id&&h.includes(r[_].id)&&t.push(new st(o,r,`all the sprites' ids must be unique, but ${r[_].id} is duplicated`)),h.push(r[_].id),r[_].url&&g.includes(r[_].url)&&t.push(new st(o,r,`all the sprites' URLs must be unique, but ${r[_].url} is duplicated`)),g.push(r[_].url),t=t.concat(vn({key:`${o}[${_}]`,value:r[_],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:n.validateSpec}));return t}return Xi({key:o,value:r})}function io(n){return t=n.value,t&&t.constructor===Object?[]:[new st(n.key,n.value,`object expected, ${ni(n.value)} found`)];var t}const Go={"*":()=>[],array:wc,boolean:function(n){const t=n.value,r=n.key,o=ni(t);return o!=="boolean"?[new st(r,t,`boolean expected, ${o} found`)]:[]},number:Cs,color:_a,constants:cu,enum:bn,filter:ja,function:uu,layer:to,object:vn,source:Bn,light:El,sky:uh,terrain:ld,projection:function(n){const t=n.value,r=n.styleSpec,o=r.projection,h=n.style,g=ni(t);if(t===void 0)return[];if(g!=="object")return[new st("projection",t,`object expected, ${g} found`)];let _=[];for(const x in t)_=_.concat(o[x]?n.validateSpec({key:x,value:t[x],valueSpec:o[x],style:h,styleSpec:r}):[new st(x,t[x],`unknown property "${x}"`)]);return _},projectionDefinition:function(n){const t=n.key;let r=n.value;r=r instanceof String?r.valueOf():r;const o=ni(r);return o!=="array"||(function(h){return Array.isArray(h)&&h.length===3&&typeof h[0]=="string"&&typeof h[1]=="string"&&typeof h[2]=="number"})(r)||(function(h){return!!["interpolate","step","literal"].includes(h[0])})(r)?["array","string"].includes(o)?[]:[new st(t,r,`projection expected, invalid type "${o}" found`)]:[new st(t,r,`projection expected, invalid array ${JSON.stringify(r)} found`)]},string:Xi,formatted:function(n){return Xi(n).length===0?[]:oa(n)},resolvedImage:function(n){return Xi(n).length===0?[]:oa(n)},padding:function(n){const t=n.key,r=n.value;if(ni(r)==="array"){if(r.length<1||r.length>4)return[new st(t,r,`padding requires 1 to 4 values; ${r.length} values found`)];const o={type:"number"};let h=[];for(let g=0;g<r.length;g++)h=h.concat(n.validateSpec({key:`${t}[${g}]`,value:r[g],validateSpec:n.validateSpec,valueSpec:o}));return h}return Cs({key:t,value:r,valueSpec:{}})},numberArray:function(n){const t=n.key,r=n.value;if(ni(r)==="array"){const o={type:"number"};if(r.length<1)return[new st(t,r,"array length at least 1 expected, length 0 found")];let h=[];for(let g=0;g<r.length;g++)h=h.concat(n.validateSpec({key:`${t}[${g}]`,value:r[g],validateSpec:n.validateSpec,valueSpec:o}));return h}return Cs({key:t,value:r,valueSpec:{}})},colorArray:function(n){const t=n.key,r=n.value;if(ni(r)==="array"){if(r.length<1)return[new st(t,r,"array length at least 1 expected, length 0 found")];let o=[];for(let h=0;h<r.length;h++)o=o.concat(_a({key:`${t}[${h}]`,value:r[h]}));return o}return _a({key:t,value:r})},variableAnchorOffsetCollection:function(n){const t=n.key,r=n.value,o=ni(r),h=n.styleSpec;if(o!=="array"||r.length<1||r.length%2!=0)return[new st(t,r,"variableAnchorOffsetCollection requires a non-empty array of even length")];let g=[];for(let _=0;_<r.length;_+=2)g=g.concat(bn({key:`${t}[${_}]`,value:r[_],valueSpec:h.layout_symbol["text-anchor"]})),g=g.concat(wc({key:`${t}[${_+1}]`,value:r[_+1],valueSpec:{length:2,value:"number"},validateSpec:n.validateSpec,style:n.style,styleSpec:h}));return g},sprite:Fr,state:io};function us(n){const t=n.value,r=n.valueSpec,o=n.styleSpec;return n.validateSpec=us,r.expression&&yc(lr(t))?uu(n):r.expression&&Ts(Hn(t))?oa(n):r.type&&Go[r.type]?Go[r.type](n):vn(mn({},n,{valueSpec:r.type?o[r.type]:r}))}function fu(n){const t=n.value,r=n.key,o=Xi(n);return o.length||(t.indexOf("{fontstack}")===-1&&o.push(new st(r,t,'"glyphs" url must include a "{fontstack}" token')),t.indexOf("{range}")===-1&&o.push(new st(r,t,'"glyphs" url must include a "{range}" token'))),o}function $r(n,t=Me){let r=[];return r=r.concat(us({key:"",value:n,valueSpec:t.$root,styleSpec:t,style:n,validateSpec:us,objectElementValidators:{glyphs:fu,"*":()=>[]}})),n.constants&&(r=r.concat(cu({key:"constants",value:n.constants}))),Al(r)}function wn(n){return function(t){return n({...t,validateSpec:us})}}function Al(n){return[].concat(n).sort(((t,r)=>t.line-r.line))}function ya(n){return function(...t){return Al(n.apply(this,t))}}$r.source=ya(wn(Bn)),$r.sprite=ya(wn(Fr)),$r.glyphs=ya(wn(fu)),$r.light=ya(wn(El)),$r.sky=ya(wn(uh)),$r.terrain=ya(wn(ld)),$r.state=ya(wn(io)),$r.layer=ya(wn(to)),$r.filter=ya(wn(ja)),$r.paintProperty=ya(wn(Cl)),$r.layoutProperty=ya(wn(Sc));const Pl=$r,cd=Pl.light,Na=Pl.sky,hh=Pl.paintProperty,pu=Pl.layoutProperty;function zl(n,t){let r=!1;if(t&&t.length)for(const o of t)n.fire(new Ye(new Error(o.message))),r=!0;return r}class As{constructor(t,r,o){const h=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;const _=new Int32Array(this.arrayBuffer);t=_[0],this.d=(r=_[1])+2*(o=_[2]);for(let b=0;b<this.d*this.d;b++){const T=_[3+b],C=_[3+b+1];h.push(T===C?null:_.subarray(T,C))}const x=_[3+h.length+1];this.keys=_.subarray(_[3+h.length],x),this.bboxes=_.subarray(x),this.insert=this._insertReadonly}else{this.d=r+2*o;for(let _=0;_<this.d*this.d;_++)h.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=t,this.padding=o,this.scale=r/t,this.uid=0;const g=o/r*t;this.min=-g,this.max=t+g}
vendor: 6,956 bytes, line 173
173insert(t,r,o,h,g){this._forEachCell(r,o,h,g,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(r),this.bboxes.push(o),this.bboxes.push(h),this.bboxes.push(g)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t,r,o,h,g,_){this.cells[g].push(_)}query(t,r,o,h,g){const _=this.min,x=this.max;if(t<=_&&r<=_&&x<=o&&x<=h&&!g)return Array.prototype.slice.call(this.keys);{const b=[];return this._forEachCell(t,r,o,h,this._queryCell,b,{},g),b}}_queryCell(t,r,o,h,g,_,x,b){const T=this.cells[g];if(T!==null){const C=this.keys,D=this.bboxes;for(let O=0;O<T.length;O++){const F=T[O];if(x[F]===void 0){const U=4*F;(b?b(D[U+0],D[U+1],D[U+2],D[U+3]):t<=D[U+2]&&r<=D[U+3]&&o>=D[U+0]&&h>=D[U+1])?(x[F]=!0,_.push(C[F])):x[F]=!1}}}}_forEachCell(t,r,o,h,g,_,x,b){const T=this._convertToCellCoord(t),C=this._convertToCellCoord(r),D=this._convertToCellCoord(o),O=this._convertToCellCoord(h);for(let F=T;F<=D;F++)for(let U=C;U<=O;U++){const $=this.d*U+F;if((!b||b(this._convertFromCellCoord(F),this._convertFromCellCoord(U),this._convertFromCellCoord(F+1),this._convertFromCellCoord(U+1)))&&g.call(this,t,r,o,h,$,_,x,b))return}}_convertFromCellCoord(t){return(t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const t=this.cells,r=3+this.cells.length+1+1;let o=0;for(let _=0;_<this.cells.length;_++)o+=this.cells[_].length;const h=new Int32Array(r+o+this.keys.length+this.bboxes.length);h[0]=this.extent,h[1]=this.n,h[2]=this.padding;let g=r;for(let _=0;_<t.length;_++){const x=t[_];h[3+_]=g,h.set(x,g),g+=x.length}return h[3+t.length]=g,h.set(this.keys,g),g+=this.keys.length,h[3+t.length+1]=g,h.set(this.bboxes,g),g+=this.bboxes.length,h.buffer}static serialize(t,r){const o=t.toArrayBuffer();return r&&r.push(o),{buffer:o}}static deserialize(t){return new As(t.buffer)}}const xa={};function yt(n,t,r={}){if(xa[n])throw new Error(`${n} is already registered.`);Object.defineProperty(t,"_classRegistryKey",{value:n,writeable:!1}),xa[n]={klass:t,omit:r.omit||[],shallow:r.shallow||[]}}yt("Object",Object),yt("Set",Set),yt("TransferableGridIndex",As),yt("Color",ai),yt("Error",Error),yt("AJAXError",ce),yt("ResolvedImage",sn),yt("StylePropertyFunction",xn),yt("StyleExpression",xc,{omit:["_evaluator"]}),yt("ZoomDependentExpression",Tl),yt("ZoomConstantExpression",Qs),yt("CompoundExpression",ta,{omit:["_evaluate"]});for(const n in No)No[n]._classRegistryKey||yt(`Expression_${n}`,No[n]);function Tc(n){return n&&typeof ArrayBuffer<"u"&&(n instanceof ArrayBuffer||n.constructor&&n.constructor.name==="ArrayBuffer")}function Mc(n){return n.$name||n.constructor._classRegistryKey}function kl(n){return!(function(t){if(t===null||typeof t!="object")return!1;const r=Mc(t);return!(!r||r==="Object")})(n)&&(n==null||typeof n=="boolean"||typeof n=="number"||typeof n=="string"||n instanceof Boolean||n instanceof Number||n instanceof String||n instanceof Date||n instanceof RegExp||n instanceof Blob||n instanceof Error||Tc(n)||da(n)||ArrayBuffer.isView(n)||n instanceof ImageData)}function Zo(n,t){if(kl(n))return(Tc(n)||da(n))&&t&&t.push(n),ArrayBuffer.isView(n)&&t&&t.push(n.buffer),n instanceof ImageData&&t&&t.push(n.data.buffer),n;if(Array.isArray(n)){const g=[];for(const _ of n)g.push(Zo(_,t));return g}if(typeof n!="object")throw new Error("can't serialize object of type "+typeof n);const r=Mc(n);if(!r)throw new Error(`can't serialize object of unregistered class ${n.constructor.name}`);if(!xa[r])throw new Error(`${r} is not registered.`);const{klass:o}=xa[r],h=o.serialize?o.serialize(n,t):{};if(o.serialize){if(t&&h===t[t.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const g in n){if(!n.hasOwnProperty(g)||xa[r].omit.indexOf(g)>=0)continue;const _=n[g];h[g]=xa[r].shallow.indexOf(g)>=0?_:Zo(_,t)}n instanceof Error&&(h.message=n.message)}if(h.$name)throw new Error("$name property is reserved for worker serialization logic.");return r!=="Object"&&(h.$name=r),h}function Fa(n){if(kl(n))return n;if(Array.isArray(n))return n.map(Fa);if(typeof n!="object")throw new Error("can't deserialize object of type "+typeof n);const t=Mc(n)||"Object";if(!xa[t])throw new Error(`can't deserialize unregistered class ${t}`);const{klass:r}=xa[t];if(!r)throw new Error(`can't deserialize unregistered class ${t}`);if(r.deserialize)return r.deserialize(n);const o=Object.create(r.prototype);for(const h of Object.keys(n)){if(h==="$name")continue;const g=n[h];o[h]=xa[t].shallow.indexOf(h)>=0?g:Fa(g)}return o}class Cc{constructor(){this.first=!0}update(t,r){const o=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=o,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=o,!0):(this.lastFloorZoom>o?(this.lastIntegerZoom=o+1,this.lastIntegerZoomTime=r):this.lastFloorZoom<o&&(this.lastIntegerZoom=o,this.lastIntegerZoomTime=r),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=o,!0))}}const ui={"Latin-1 Supplement":n=>n>=128&&n<=255,"Hangul Jamo":n=>n>=4352&&n<=4607,Khmer:n=>n>=6016&&n<=6143,"General Punctuation":n=>n>=8192&&n<=8303,"Letterlike Symbols":n=>n>=8448&&n<=8527,"Number Forms":n=>n>=8528&&n<=8591,"Miscellaneous Technical":n=>n>=8960&&n<=9215,"Control Pictures":n=>n>=9216&&n<=9279,"Optical Character Recognition":n=>n>=9280&&n<=9311,"Enclosed Alphanumerics":n=>n>=9312&&n<=9471,"Geometric Shapes":n=>n>=9632&&n<=9727,"Miscellaneous Symbols":n=>n>=9728&&n<=9983,"Miscellaneous Symbols and Arrows":n=>n>=11008&&n<=11263,"Ideographic Description Characters":n=>n>=12272&&n<=12287,"CJK Symbols and Punctuation":n=>n>=12288&&n<=12351,Hiragana:n=>n>=12352&&n<=12447,Katakana:n=>n>=12448&&n<=12543,Kanbun:n=>n>=12688&&n<=12703,"CJK Strokes":n=>n>=12736&&n<=12783,"Enclosed CJK Letters and Months":n=>n>=12800&&n<=13055,"CJK Compatibility":n=>n>=13056&&n<=13311,"Yijing Hexagram Symbols":n=>n>=19904&&n<=19967,"CJK Unified Ideographs":n=>n>=19968&&n<=40959,"Hangul Syllables":n=>n>=44032&&n<=55215,"Private Use Area":n=>n>=57344&&n<=63743,"Vertical Forms":n=>n>=65040&&n<=65055,"CJK Compatibility Forms":n=>n>=65072&&n<=65103,"Small Form Variants":n=>n>=65104&&n<=65135,"Halfwidth and Fullwidth Forms":n=>n>=65280&&n<=65519};function Ua(n){for(const t of n)if(Ec(t.charCodeAt(0)))return!0;return!1}function dh(n){for(const t of n)if(!Ps(t.charCodeAt(0)))return!1;return!0}function Il(n){const t=n.map((r=>{try{return new RegExp(`\\p{sc=${r}}`,"u").source}catch{return null}})).filter((r=>r));return new RegExp(t.join("|"),"u")}const ro=Il(["Arab","Dupl","Mong","Ougr","Syrc"]);function Ps(n){return!ro.test(String.fromCodePoint(n))}const qo=Il(["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"]);function Ec(n){return!(n!==746&&n!==747&&(n<4352||!(ui["CJK Compatibility Forms"](n)&&!(n>=65097&&n<=65103)||ui["CJK Compatibility"](n)||ui["CJK Strokes"](n)||
173!(!ui["CJK Symbols and Punctuation"](n)||n>=12296&&n<=12305||n>=12308&&n<=12319||n===12336)||ui["Enclosed CJK Letters and Months"](n)||ui["Ideographic Description Characters"](n)||ui.Kanbun(n)||ui.Katakana(n)&&n!==12540||!(!ui["Halfwidth and Fullwidth Forms"](n)||n===65288||n===65289||n===65293||n>=65306&&n<=65310||n===65339||n===65341||n===65343||n>=65371&&n<=65503||n===65507||n>=65512&&n<=65519)||!(!ui["Small Form Variants"](n)||n>=65112&&n<=65118||n>=65123&&n<=65126)||ui["Vertical Forms"](n)||ui["Yijing Hexagram Symbols"](n)||new RegExp("\\p{sc=Cans}","u").test(String.fromCodePoint(n))||new RegExp("\\p{sc=Hang}","u").test(String.fromCodePoint(n))||qo.test(String.fromCodePoint(n)))))}function mu(n){return!(Ec(n)||(function(t){return!!(ui["Latin-1 Supplement"](t)&&(t===167||t===169||t===174||t===177||t===188||t===189||t===190||t===215||t===247)||ui["General Punctuation"](t)&&(t===8214||t===8224||t===8225||t===8240||t===8241||t===8251||t===8252||t===8258||t===8263||t===8264||t===8265||t===8273)||ui["Letterlike Symbols"](t)||ui["Number Forms"](t)||ui["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||t===9003||t>=9085&&t<=9114||t>=9150&&t<=9165||t===9167||t>=9169&&t<=9179||t>=9186&&t<=9215)||ui["Control Pictures"](t)&&t!==9251||ui["Optical Character Recognition"](t)||ui["Enclosed Alphanumerics"](t)||ui["Geometric Shapes"](t)||ui["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||ui["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||ui["CJK Symbols and Punctuation"](t)||ui.Katakana(t)||ui["Private Use Area"](t)||ui["CJK Compatibility Forms"](t)||ui["Small Form Variants"](t)||ui["Halfwidth and Fullwidth Forms"](t)||t===8734||t===8756||t===8757||t>=9984&&t<=10087||t>=10102&&t<=10131||t===65532||t===65533)})(n))}const Rl=Il(["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 $o(n){return Rl.test(String.fromCodePoint(n))}function fh(n,t){return!(!t&&$o(n)||n>=2304&&n<=3583||n>=3840&&n<=4255||ui.Khmer(n))}function ph(n){for(const t of n)if($o(t.charCodeAt(0)))return!0;return!1}const Sn=new class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(n){this.pluginStatus=n.pluginStatus,this.pluginURL=n.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(n){if(Sn.isParsed())throw new Error("RTL text plugin already registered.");this.applyArabicShaping=n.applyArabicShaping,this.processBidirectionalText=n.processBidirectionalText,this.processStyledBidirectionalText=n.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getRTLTextPluginStatus(){return this.pluginStatus}syncState(n,t){return u(this,void 0,void 0,(function*(){if(this.isParsed())return this.getState();if(n.pluginStatus!=="loading")return this.setState(n),n;const r=n.pluginURL,o=new Promise((g=>{this.loadScriptResolve=g}));t(r);const h=new Promise((g=>setTimeout((()=>g()),this.TIMEOUT)));if(yield Promise.race([o,h]),this.isParsed()){const g={pluginStatus:"loaded",pluginURL:r};return this.setState(g),g}throw this.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${r}`)}))}};class Ai{constructor(t,r){this.zoom=t,r?(this.now=r.now||0,this.fadeDuration=r.fadeDuration||0,this.zoomHistory=r.zoomHistory||new Cc,this.transition=r.transition||{},this.globalState=r.globalState||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Cc,this.transition={},this.globalState={})}isSupportedScript(t){return(function(r,o){for(const h of r)if(!fh(h.charCodeAt(0),o))return!1;return!0})(t,Sn.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}
vendor: 19,479 bytes, line 173
173getCrossfadeParameters(){const t=this.zoom,r=t-Math.floor(t),o=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*o}:{fromScale:.5,toScale:1,t:1-(1-o)*r}}}class Ho{constructor(t,r){this.property=t,this.value=r,this.expression=(function(o,h){if(yc(o))return new xn(o,h);if(Ts(o)){const g=na(o,h);if(g.result==="error")throw new Error(g.value.map((_=>`${_.key}: ${_.message}`)).join(", "));return g.value}{let g=o;return h.type==="color"&&typeof o=="string"?g=ai.parse(o):h.type!=="padding"||typeof o!="number"&&!Array.isArray(o)?h.type!=="numberArray"||typeof o!="number"&&!Array.isArray(o)?h.type!=="colorArray"||typeof o!="string"&&!Array.isArray(o)?h.type==="variableAnchorOffsetCollection"&&Array.isArray(o)?g=an.parse(o):h.type==="projectionDefinition"&&typeof o=="string"&&(g=gr.parse(o)):g=Dr.parse(o):g=nn.parse(o):g=qr.parse(o),{globalStateRefs:new Set,kind:"constant",evaluate:()=>g}}})(r===void 0?t.specification.default:r,t.specification),this._evaluate=this.expression.evaluate}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(t,r,o){return this.property.possiblyEvaluate(this,t,r,o)}setGlobalState(t){this.expression.evaluate=(r,o,h,g,_,x)=>(r.globalState=t,this._evaluate.call(this.expression,r,o,h,g,_,x))}}class Ac{constructor(t){this.property=t,this.value=new Ho(t,void 0)}transitioned(t,r){return new hs(this.property,this.value,r,si({},t.transition,this.transition),t.now)}untransitioned(){return new hs(this.property,this.value,null,{},0)}}class gu{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return xr(this._values[t].value.value)}setValue(t,r){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new Ac(this._values[t].property)),this._values[t].value=new Ho(this._values[t].property,r===null?void 0:xr(r))}getTransition(t){return xr(this._values[t].transition)}setTransition(t,r){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new Ac(this._values[t].property)),this._values[t].transition=xr(r)||void 0}serialize(){const t={};for(const r of Object.keys(this._values)){const o=this.getValue(r);o!==void 0&&(t[r]=o);const h=this.getTransition(r);h!==void 0&&(t[`${r}-transition`]=h)}return t}transitioned(t,r){const o=new ci(this._properties);for(const h of Object.keys(this._values))o._values[h]=this._values[h].transitioned(t,r._values[h]);return o}untransitioned(){const t=new ci(this._properties);for(const r of Object.keys(this._values))t._values[r]=this._values[r].untransitioned();return t}}class hs{constructor(t,r,o,h,g){this.property=t,this.value=r,this.begin=g+h.delay||0,this.end=this.begin+h.duration||0,t.specification.transition&&(h.delay||h.duration)&&(this.prior=o)}possiblyEvaluate(t,r,o){const h=t.now||0,g=this.value.possiblyEvaluate(t,r,o),_=this.prior;if(_){if(h>this.end)return this.prior=null,g;if(this.value.isDataDriven())return this.prior=null,g;if(h<this.begin)return _.possiblyEvaluate(t,r,o);{const x=(h-this.begin)/(this.end-this.begin);return this.property.interpolate(_.possiblyEvaluate(t,r,o),g,at(x))}}return g}}class ci{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,r,o){const h=new Xo(this._properties);for(const g of Object.keys(this._values))h._values[g]=this._values[g].possiblyEvaluate(t,r,o);return h}hasTransition(){for(const t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}}class Oi{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues),this._globalState={}}hasValue(t){return this._values[t].value!==void 0}getValue(t){return xr(this._values[t].value)}setValue(t,r){this._values[t]=new Ho(this._values[t].property,r===null?void 0:xr(r)),this._values[t].setGlobalState(this._globalState)}serialize(){const t={};for(const r of Object.keys(this._values)){const o=this.getValue(r);o!==void 0&&(t[r]=o)}return t}possiblyEvaluate(t,r,o){const h=new Xo(this._properties);for(const g of Object.keys(this._values))h._values[g]=this._values[g].possiblyEvaluate(t,r,o);return h}setGlobalState(t){this._globalState=t;for(const r of Object.values(this._values))r.setGlobalState(t)}}class ji{constructor(t,r,o){this.property=t,this.value=r,this.parameters=o}isConstant(){return this.value.kind==="constant"}constantOr(t){return this.value.kind==="constant"?this.value.value:t}evaluate(t,r,o,h){return this.property.evaluate(this.value,this.parameters,t,r,o,h)}}class Xo{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class St{constructor(t){this.specification=t}possiblyEvaluate(t,r){if(t.isDataDriven())throw new Error("Value should not be data driven");return t.expression.evaluate(r)}interpolate(t,r,o){const h=os[this.specification.type];return h?h(t,r,o):t}}class It{constructor(t,r){this.specification=t,this.overrides=r}possiblyEvaluate(t,r,o,h){return new ji(this,t.expression.kind==="constant"||t.expression.kind==="camera"?{kind:"constant",value:t.expression.evaluate(r,null,{},o,h)}:t.expression,r)}interpolate(t,r,o){if(t.value.kind!=="constant"||r.value.kind!=="constant")return t;if(t.value.value===void 0||r.value.value===void 0)return new ji(this,{kind:"constant",value:void 0},t.parameters);const h=os[this.specification.type];if(h){const g=h(t.value.value,r.value.value,o);return new ji(this,{kind:"constant",value:g},t.parameters)}return t}evaluate(t,r,o,h,g,_){return t.kind==="constant"?t.value:t.evaluate(r,o,h,g,_)}}class Yo extends It{possiblyEvaluate(t,r,o,h){if(t.value===void 0)return new ji(this,{kind:"constant",value:void 0},r);if(t.expression.kind==="constant"){const g=t.expression.evaluate(r,null,{},o,h),_=t.property.specification.type==="resolvedImage"&&typeof g!="string"?g.name:g,x=this._calculate(_,_,_,r);return new ji(this,{kind:"constant",value:x},r)}if(t.expression.kind==="camera"){const g=this._calculate(t.expression.evaluate({zoom:r.zoom-1}),t.expression.evaluate({zoom:r.zoom}),t.expression.evaluate({zoom:r.zoom+1}),r);return new ji(this,{kind:"constant",value:g},r)}return new ji(this,t.expression,r)}evaluate(t,r,o,h,g,_){if(t.kind==="source"){const x=t.evaluate(r,o,h,g,_);return this._calculate(x,x,x,r)}return t.kind==="composite"?this._calculate(t.evaluate({zoom:Math.floor(r.zoom)-1},o,h),t.evaluate({zoom:Math.floor(r.zoom)},o,h),t.evaluate({zoom:Math.floor(r.zoom)+1},o,h),r):t.value}_calculate(t,r,o,h){return h.zoom>h.zoomHistory.lastIntegerZoom?{from:t,to:r}:{from:o,to:r}}interpolate(t){return t}}class va{constructor(t){this.specification=t}possiblyEvaluate(t,r,o,h){if(t.value!==void 0){if(t.expression.kind==="constant"){const g=t.expression.evaluate(r,null,{},o,h);return this._calculate(g,g,g,r)}return this._calculate(t.expression.evaluate(new Ai(Math.floor(r.zoom-1),r)),t.expression.evaluate(new Ai(Math.floor(r.zoom),r)),t.expression.evaluate(new Ai(Math.floor(r.zoom+1),r)),r)}}_calculate(t,r,o,h){return h.zoom>h.zoomHistory.lastIntegerZoom?{from:t,to:r}:{from:o,to:r}}interpolate(t){return t}}class zs{constructor(t){this.specification=t}possiblyEvaluate(t,r,o,h){return!!t.expression.evaluate(r,null,{},o,h)}interpolate(){return!1}}class On{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const r in t){const o=t[r];o.specification.overridable&&this.overridableProperties.push(r);const h=this.defaultPropertyValues[r]=new Ho(o,void 0),g=this.defaultTransitionablePropertyValues[r]=new Ac(o);this.defaultTransitioningPropertyValues[r]=g.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=h.possiblyEvaluate({})}}}yt("DataDrivenProperty",It),yt("DataConstantProperty",St),yt("CrossFadedDataDrivenProperty",Yo),yt("CrossFadedProperty",va),yt("ColorRampProperty",zs);const br="-transition";class Xn extends Ct{constructor(t,r){if(super(),this.id=t.id,this.type=t.type,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},t.type!=="custom"&&(this.metadata=t.metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,this._globalState={},t.type!=="background"&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter,this._featureFilter=Js(t.filter)),r.layout&&(this._unevaluatedLayout=new Oi(r.layout)),r.paint)){this._transitionablePaint=new gu(r.paint);for(const o in t.paint)this.setPaintProperty(o,t.paint[o],{validate:!1});for(const o in t.layout)this.setLayoutProperty(o,t.layout[o],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Xo(r.paint)}}setFilter(t){this.filter=t,this._featureFilter=Js(t)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return t==="visibility"?this.visibility:this._unevaluatedLayout.getValue(t)}getLayoutAffectingGlobalStateRefs(){const t=new Set;if(this._unevaluatedLayout)for(const r in this._unevaluatedLayout._values){const o=this._unevaluatedLayout._values[r];for(const h of o.getGlobalStateRefs())t.add(h)}for(const r of this._featureFilter.getGlobalStateRefs())t.add(r);return t}getPaintAffectingGlobalStateRefs(){var t;const r=new globalThis.Map;if(this._transitionablePaint)for(const o in this._transitionablePaint._values){const h=this._transitionablePaint._values[o].value;for(const g of h.getGlobalStateRefs()){const _=(t=r.get(g))!==null&&t!==void 0?t:[];_.push({name:o,value:h.value}),r.set(g,_)}}return r}setLayoutProperty(t,r,o={}){r!=null&&this._validate(pu,`layers.${this.id}.layout.${t}`,t,r,o)||(t!=="visibility"?this._unevaluatedLayout.setValue(t,r):this.visibility=r)}getPaintProperty(t){return t.endsWith(br)?this._transitionablePaint.getTransition(t.slice(0,-11)):this._transitionablePaint.getValue(t)}setPaintProperty(t,r,o={}){if(r!=null&&this._validate(hh,`layers.${this.id}.paint.${t}`,t,r,o))return!1;if(t.endsWith(br))return this._transitionablePaint.setTransition(t.slice(0,-11),r||void 0),!1;{const h=this._transitionablePaint._values[t],g=h.property.specification["property-type"]==="cross-faded-data-driven",_=h.value.isDataDriven(),x=h.value;this._transitionablePaint.setValue(t,r),this._handleSpecialPaintPropertyUpdate(t);const b=this._transitionablePaint._values[t].value;return b.isDataDriven()||_||g||this._handleOverridablePaintPropertyUpdate(t,x,b)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,r,o){return!1}isHidden(t){return!!(this.minzoom&&t<this.minzoom)||!!(this.maxzoom&&t>=this.maxzoom)||this.visibility==="none"}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(t,r){t.globalState=this._globalState,t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,r)}setGlobalState(t){this._globalState=t,this._unevaluatedLayout&&this._unevaluatedLayout.setGlobalState(t)}serialize(){const t={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&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),kn(t,((r,o)=>!(r===void 0||o==="layout"&&!Object.keys(r).length||o==="paint"&&!Object.keys(r).length)))}_validate(t,r,o,h,g={}){return(!g||g.validate!==!1)&&zl(this,t.call(Pl,{key:r,layerType:this.type,objectKey:o,value:h,styleSpec:Me,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const t in this.paint._values){const r=this.paint.get(t);if(r instanceof ji&&ia(r.property.specification)&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}}const mh={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Dl{constructor(t,r){this._structArray=t,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class ki{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,r){return t._trim(),r&&(t.isTransferred=!0,r.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){const r=Object.create(this.prototype);return r.arrayBuffer=t.arrayBuffer,r.length=t.length,r.capacity=t.arrayBuffer.byteLength/r.bytesPerElement,r._refreshViews(),r}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function wr(n,t=1){let r=0,o=0;return{members:n.map((h=>{const g=mh[h.type].BYTES_PER_ELEMENT,_=r=Ll(r,Math.max(t,g)),x=h.components||1;return o=Math.max(o,g),r+=g*x,{name:h.name,type:h.type,components:x,offset:_}})),size:Ll(r,Math.max(o,t)),alignment:t}}function Ll(n,t){return Math.ceil(n/t)*t}class no extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r){const o=this.length;return this.resize(o+1),this.emplace(o,t,r)}emplace(t,r,o){const h=2*t;return this.int16[h+0]=r,this.int16[h+1]=o,t}}no.prototype.bytesPerElement=4,yt("StructArrayLayout2i4",no);class ao extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,o){const h=this.length;return this.resize(h+1),this.emplace(h,t,r,o)}emplace(t,r,o,h){const g=3*t;return this.int16[g+0]=r,this.int16[g+1]=o,this.int16[g+2]=h,t}}ao.prototype.bytesPerElement=6,yt("StructArrayLayout3i6",ao);class Tn extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,o,h){const g=this.length;return this.resize(g+1),this.emplace(g,t,r,o,h)}emplace(t,r,o,h,g){const _=4*t;return this.int16[_+0]=r,this.int16[_+1]=o,this.int16[_+2]=h,this.int16[_+3]=g,t}}Tn.prototype.bytesPerElement=8,yt("StructArrayLayout4i8",Tn);class ir extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,o,h,g,_){const x=this.length;return this.resize(x+1),this.emplace(x,t,r,o,h,g,_)}emplace(t,r,o,h,g,_,x){const b=6*t;return this.int16[b+0]=r,this.int16[b+1]=o,this.int16[b+2]=h,this.int16[b+3]=g,this.int16[b+4]=_,this.int16[b+5]=x,t}}ir.prototype.bytesPerElement=12,yt("StructArrayLayout2i4i12",ir);class ks extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,o,h,g,_){const x=this.length;return this.resize(x+1),this.emplace(x,t,r,o,h,g,_)}emplace(t,r,o,h,g,_,x){const b=4*t,T=8*t;return this.int16[b+0]=r,this.int16[b+1]=o,this.uint8[T+4]=h,this.uint8[T+5]=g,this.uint8[T+6]=_,this.uint8[T+7]=x,t}}ks.prototype.bytesPerElement=8,yt("StructArrayLayout2i4ub8",ks);class Is extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r){const o=this.length;return this.resize(o+1),this.emplace(o,t,r)}emplace(t,r,o){const h=2*t;return this.float32[h+0]=r,this.float32[h+1]=o,t}}Is.prototype.bytesPerElement=8,yt("StructArrayLayout2f8",Is);class Ko extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,o,h,g,_,x,b,T,C){const D=this.length;return this.resize(D+1),this.emplace(D,t,r,o,h,g,_,x,b,T,C)}emplace(t,r,o,h,g,_,x,b,T,C,D){const O=10*t;return this.uint16[O+0]=r,this.uint16[O+1]=o,this.uint16[O+2]=h,this.uint16[O+3]=g,this.uint16[O+4]=_,this.uint16[O+5]=x,this.uint16[O+6]=b,this.uint16[O+7]=T,this.uint16[O+8]=C,this.uint16[O+9]=D,t}}Ko.prototype.bytesPerElement=20,yt("StructArrayLayout10ui20",Ko);class Rs extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,o,h,g,_,x,b,T,C,D,O){const F=this.length;return this.resize(F+1),this.emplace(F,t,r,o,h,g,_,x,b,T,C,D,O)}emplace(t,r,o,h,g,_,x,b,T,C,D,O,F){const U=12*t;return this.int16[U+0]=r,this.int16[U+1]=o,this.int16[U+2]=h,this.int16[U+3]=g,this.uint16[U+4]=_,this.uint16[U+5]=x,this.uint16[U+6]=b,this.uint16[U+7]=T,this.int16[U+8]=C,this.int16[U+9]=D,this.int16[U+10]=O,this.int16[U+11]=F,t}}Rs.prototype.bytesPerElement=24,yt("StructArrayLayout4i4ui4i24",Rs);class Va extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,o){const h=this.length;return this.resize(h+1),this.emplace(h,t,r,o)}emplace(t,r,o,h){const g=3*t;return this.float32[g+0]=r,this.float32[g+1]=o,this.float32[g+2]=h,t}}Va.prototype.bytesPerElement=12,yt("StructArrayLayout3f12",Va);class Bl extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){const r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){return this.uint32[1*t+0]=r,t}}Bl.prototype.bytesPerElement=4,yt("StructArrayLayout1ul4",Bl);class Ol extends ki{_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(t,r,o,h,g,_,x,b,T){const C=this.length;return this.resize(C+1),this.emplace(C,t,r,o,h,g,_,x,b,T)}emplace(t,r,o,h,g,_,x,b,T,C){const D=10*t,O=5*t;return this.int16[D+0]=r,this.int16[D+1]=o,this.int16[D+2]=h,this.int16[D+3]=g,this.int16[D+4]=_,this.int16[D+5]=x,this.uint32[O+3]=b,this.uint16[D+8]=T,this.uint16[D+9]=C,t}}Ol.prototype.bytesPerElement=20,yt("StructArrayLayout6i1ul2ui20",Ol);class Pc extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,o,h,g,_){const x=this.length;return this.resize(x+1),this.emplace(x,t,r,o,h,g,_)}emplace(t,r,o,h,g,_,x){const b=6*t;return this.int16[b+0]=r,this.int16[b+1]=o,this.int16[b+2]=h,this.int16[b+3]=g,this.int16[b+4]=_,this.int16[b+5]=x,t}}Pc.prototype.bytesPerElement=12,yt("StructArrayLayout2i2i2i12",Pc);class f extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,o,h,g){const _=this.length;return this.resize(_+1),this.emplace(_,t,r,o,h,g)}emplace(t,r,o,h,g,_){const x=4*t,b=8*t;return this.float32[x+0]=r,this.float32[x+1]=o,this.float32[x+2]=h,this.int16[b+6]=g,this.int16[b+7]=_,t}}
vendor: 5,233 bytes, line 173
173f.prototype.bytesPerElement=16,yt("StructArrayLayout2f1f2i16",f);class e extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,o,h,g,_){const x=this.length;return this.resize(x+1),this.emplace(x,t,r,o,h,g,_)}emplace(t,r,o,h,g,_,x){const b=16*t,T=4*t,C=8*t;return this.uint8[b+0]=r,this.uint8[b+1]=o,this.float32[T+1]=h,this.float32[T+2]=g,this.int16[C+6]=_,this.int16[C+7]=x,t}}e.prototype.bytesPerElement=16,yt("StructArrayLayout2ub2f2i16",e);class a extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,o){const h=this.length;return this.resize(h+1),this.emplace(h,t,r,o)}emplace(t,r,o,h){const g=3*t;return this.uint16[g+0]=r,this.uint16[g+1]=o,this.uint16[g+2]=h,t}}a.prototype.bytesPerElement=6,yt("StructArrayLayout3ui6",a);class l extends ki{_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(t,r,o,h,g,_,x,b,T,C,D,O,F,U,$,Q,re){const be=this.length;return this.resize(be+1),this.emplace(be,t,r,o,h,g,_,x,b,T,C,D,O,F,U,$,Q,re)}emplace(t,r,o,h,g,_,x,b,T,C,D,O,F,U,$,Q,re,be){const he=24*t,pe=12*t,Ie=48*t;return this.int16[he+0]=r,this.int16[he+1]=o,this.uint16[he+2]=h,this.uint16[he+3]=g,this.uint32[pe+2]=_,this.uint32[pe+3]=x,this.uint32[pe+4]=b,this.uint16[he+10]=T,this.uint16[he+11]=C,this.uint16[he+12]=D,this.float32[pe+7]=O,this.float32[pe+8]=F,this.uint8[Ie+36]=U,this.uint8[Ie+37]=$,this.uint8[Ie+38]=Q,this.uint32[pe+10]=re,this.int16[he+22]=be,t}}l.prototype.bytesPerElement=48,yt("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",l);class d extends ki{_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(t,r,o,h,g,_,x,b,T,C,D,O,F,U,$,Q,re,be,he,pe,Ie,Ne,Qe,pt,lt,dt,At,mt){const ft=this.length;return this.resize(ft+1),this.emplace(ft,t,r,o,h,g,_,x,b,T,C,D,O,F,U,$,Q,re,be,he,pe,Ie,Ne,Qe,pt,lt,dt,At,mt)}emplace(t,r,o,h,g,_,x,b,T,C,D,O,F,U,$,Q,re,be,he,pe,Ie,Ne,Qe,pt,lt,dt,At,mt,ft){const $e=32*t,Ot=16*t;return this.int16[$e+0]=r,this.int16[$e+1]=o,this.int16[$e+2]=h,this.int16[$e+3]=g,this.int16[$e+4]=_,this.int16[$e+5]=x,this.int16[$e+6]=b,this.int16[$e+7]=T,this.uint16[$e+8]=C,this.uint16[$e+9]=D,this.uint16[$e+10]=O,this.uint16[$e+11]=F,this.uint16[$e+12]=U,this.uint16[$e+13]=$,this.uint16[$e+14]=Q,this.uint16[$e+15]=re,this.uint16[$e+16]=be,this.uint16[$e+17]=he,this.uint16[$e+18]=pe,this.uint16[$e+19]=Ie,this.uint16[$e+20]=Ne,this.uint16[$e+21]=Qe,this.uint16[$e+22]=pt,this.uint32[Ot+12]=lt,this.float32[Ot+13]=dt,this.float32[Ot+14]=At,this.uint16[$e+30]=mt,this.uint16[$e+31]=ft,t}}d.prototype.bytesPerElement=64,yt("StructArrayLayout8i15ui1ul2f2ui64",d);class m extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){const r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){return this.float32[1*t+0]=r,t}}m.prototype.bytesPerElement=4,yt("StructArrayLayout1f4",m);class y extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,o){const h=this.length;return this.resize(h+1),this.emplace(h,t,r,o)}emplace(t,r,o,h){const g=3*t;return this.uint16[6*t+0]=r,this.float32[g+1]=o,this.float32[g+2]=h,t}}y.prototype.bytesPerElement=12,yt("StructArrayLayout1ui2f12",y);class w extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,o){const h=this.length;return this.resize(h+1),this.emplace(h,t,r,o)}emplace(t,r,o,h){const g=4*t;return this.uint32[2*t+0]=r,this.uint16[g+2]=o,this.uint16[g+3]=h,t}}w.prototype.bytesPerElement=8,yt("StructArrayLayout1ul2ui8",w);class S extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r){const o=this.length;return this.resize(o+1),this.emplace(o,t,r)}emplace(t,r,o){const h=2*t;return this.uint16[h+0]=r,this.uint16[h+1]=o,t}}S.prototype.bytesPerElement=4,yt("StructArrayLayout2ui4",S);class P extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){const r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){return this.uint16[1*t+0]=r,t}}P.prototype.bytesPerElement=2,yt("StructArrayLayout1ui2",P);class k extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,o,h){const g=this.length;return this.resize(g+1),this.emplace(g,t,r,o,h)}emplace(t,r,o,h,g){const _=4*t;return this.float32[_+0]=r,this.float32[_+1]=o,this.float32[_+2]=h,this.float32[_+3]=g,t}}
vendor: 6,134 bytes, line 173
173k.prototype.bytesPerElement=16,yt("StructArrayLayout4f16",k);class B extends Dl{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 H(this.anchorPointX,this.anchorPointY)}}B.prototype.size=20;class L extends Ol{get(t){return new B(this,t)}}yt("CollisionBoxArray",L);class j extends Dl{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(t){this._structArray.uint8[this._pos1+37]=t}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(t){this._structArray.uint8[this._pos1+38]=t}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(t){this._structArray.uint32[this._pos4+10]=t}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}j.prototype.size=48;class G extends l{get(t){return new j(this,t)}}yt("PlacedSymbolArray",G);class ee extends Dl{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(t){this._structArray.uint32[this._pos4+12]=t}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]}}ee.prototype.size=64;class J extends d{get(t){return new ee(this,t)}}yt("SymbolInstanceArray",J);class te extends m{getoffsetX(t){return this.float32[1*t+0]}}yt("GlyphOffsetArray",te);class ae extends ao{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}yt("SymbolLineVertexArray",ae);class ue extends Dl{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]}}ue.prototype.size=12;class oe extends y{get(t){return new ue(this,t)}}yt("TextAnchorOffsetArray",oe);class de extends Dl{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]}}de.prototype.size=8;class ge extends w{get(t){return new de(this,t)}}yt("FeatureIndexArray",ge);class le extends no{}class Se extends no{}class Oe extends no{}class ze extends ir{}class ke extends ks{}class Le extends Is{}class ot extends Ko{}class ct extends Rs{}class We extends Va{}class Et extends Bl{}class ii extends Pc{}class vi extends e{}class Ii extends a{}class Pi extends S{}const cr=wr([{name:"a_pos",components:2,type:"Int16"}],4),{members:rr}=cr;class Wt{constructor(t=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=t}prepareSegment(t,r,o,h){const g=this.segments[this.segments.length-1];return t>Wt.MAX_VERTEX_ARRAY_LENGTH&&$i(`Max vertices per segment is ${Wt.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${Wt.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!g||g.vertexLength+t>
vendor: 14,042 bytes, line 173
173Wt.MAX_VERTEX_ARRAY_LENGTH||g.sortKey!==h?this.createNewSegment(r,o,h):g}createNewSegment(t,r,o){const h={vertexOffset:t.length,primitiveOffset:r.length,vertexLength:0,primitiveLength:0,vaos:{}};return o!==void 0&&(h.sortKey=o),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(h),h}getOrCreateLatestSegment(t,r,o){return this.prepareSegment(0,t,r,o)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(const t of this.segments)for(const r in t.vaos)t.vaos[r].destroy()}static simpleSegment(t,r,o,h){return new Wt([{vertexOffset:t,primitiveOffset:r,vertexLength:o,primitiveLength:h,vaos:{},sortKey:0}])}}function Ri(n,t){return 256*(n=zt(Math.floor(n),0,255))+zt(Math.floor(t),0,255)}Wt.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,yt("SegmentVector",Wt);const Sr=wr([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var Ur,Hr,jn,Ga={exports:{}},Ds={exports:{}},ba={exports:{}},so=(function(){if(jn)return Ga.exports;jn=1;var n=(Ur||(Ur=1,Ds.exports=function(r,o){var h,g,_,x,b,T,C,D;for(g=r.length-(h=3&r.length),_=o,b=3432918353,T=461845907,D=0;D<g;)C=255&r.charCodeAt(D)|(255&r.charCodeAt(++D))<<8|(255&r.charCodeAt(++D))<<16|(255&r.charCodeAt(++D))<<24,++D,_=27492+(65535&(x=5*(65535&(_=(_^=C=(65535&(C=(C=(65535&C)*b+(((C>>>16)*b&65535)<<16)&4294967295)<<15|C>>>17))*T+(((C>>>16)*T&65535)<<16)&4294967295)<<13|_>>>19))+((5*(_>>>16)&65535)<<16)&4294967295))+((58964+(x>>>16)&65535)<<16);switch(C=0,h){case 3:C^=(255&r.charCodeAt(D+2))<<16;case 2:C^=(255&r.charCodeAt(D+1))<<8;case 1:_^=C=(65535&(C=(C=(65535&(C^=255&r.charCodeAt(D)))*b+(((C>>>16)*b&65535)<<16)&4294967295)<<15|C>>>17))*T+(((C>>>16)*T&65535)<<16)&4294967295}return _^=r.length,_=2246822507*(65535&(_^=_>>>16))+((2246822507*(_>>>16)&65535)<<16)&4294967295,_=3266489909*(65535&(_^=_>>>13))+((3266489909*(_>>>16)&65535)<<16)&4294967295,(_^=_>>>16)>>>0}),Ds.exports),t=(Hr||(Hr=1,ba.exports=function(r,o){for(var h,g=r.length,_=o^g,x=0;g>=4;)h=1540483477*(65535&(h=255&r.charCodeAt(x)|(255&r.charCodeAt(++x))<<8|(255&r.charCodeAt(++x))<<16|(255&r.charCodeAt(++x))<<24))+((1540483477*(h>>>16)&65535)<<16),_=1540483477*(65535&_)+((1540483477*(_>>>16)&65535)<<16)^(h=1540483477*(65535&(h^=h>>>24))+((1540483477*(h>>>16)&65535)<<16)),g-=4,++x;switch(g){case 3:_^=(255&r.charCodeAt(x+2))<<16;case 2:_^=(255&r.charCodeAt(x+1))<<8;case 1:_=1540483477*(65535&(_^=255&r.charCodeAt(x)))+((1540483477*(_>>>16)&65535)<<16)}return _=1540483477*(65535&(_^=_>>>13))+((1540483477*(_>>>16)&65535)<<16),(_^=_>>>15)>>>0}),ba.exports);return Ga.exports=n,Ga.exports.murmur3=n,Ga.exports.murmur2=t,Ga.exports})(),Ls=ne(so);class oo{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,r,o,h){this.ids.push(lo(t)),this.positions.push(r,o,h)}getPositions(t){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const r=lo(t);let o=0,h=this.ids.length-1;for(;o<h;){const _=o+h>>1;this.ids[_]>=r?h=_:o=_+1}const g=[];for(;this.ids[o]===r;)g.push({index:this.positions[3*o],start:this.positions[3*o+1],end:this.positions[3*o+2]}),o++;return g}static serialize(t,r){const o=new Float64Array(t.ids),h=new Uint32Array(t.positions);return ln(o,h,0,o.length-1),r&&r.push(o.buffer,h.buffer),{ids:o,positions:h}}static deserialize(t){const r=new oo;return r.ids=t.ids,r.positions=t.positions,r.indexed=!0,r}}function lo(n){const t=+n;return!isNaN(t)&&t<=Number.MAX_SAFE_INTEGER?t:Ls(String(n))}function ln(n,t,r,o){for(;r<o;){const h=n[r+o>>1];let g=r-1,_=o+1;for(;;){do g++;while(n[g]<h);do _--;while(n[_]>h);if(g>=_)break;wa(n,g,_),wa(t,3*g,3*_),wa(t,3*g+1,3*_+1),wa(t,3*g+2,3*_+2)}_-r<o-_?(ln(n,t,r,_),r=_+1):(ln(n,t,_+1,o),o=_)}}function wa(n,t,r){const o=n[t];n[t]=n[r],n[r]=o}yt("FeaturePositionMap",oo);class Mn{constructor(t,r){this.gl=t.gl,this.location=r}}class co extends Mn{constructor(t,r){super(t,r),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}}class nr extends Mn{constructor(t,r){super(t,r),this.current=[0,0,0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]&&t[3]===this.current[3]||(this.current=t,this.gl.uniform4f(this.location,t[0],t[1],t[2],t[3]))}}class _r extends Mn{constructor(t,r){super(t,r),this.current=ai.transparent}set(t){t.r===this.current.r&&t.g===this.current.g&&t.b===this.current.b&&t.a===this.current.a||(this.current=t,this.gl.uniform4f(this.location,t.r,t.g,t.b,t.a))}}const Nn=new Float32Array(16);function ur(n){return[Ri(255*n.r,255*n.g),Ri(255*n.b,255*n.a)]}class uo{constructor(t,r,o){this.value=t,this.uniformNames=r.map((h=>`u_${h}`)),this.type=o}setUniform(t,r,o){t.set(o.constantOr(this.value))}getBinding(t,r,o){return this.type==="color"?new _r(t,r):new co(t,r)}}class Wo{constructor(t,r){this.uniformNames=r.map((o=>`u_${o}`)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,r){this.pixelRatioFrom=r.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=r.tlbr,this.patternTo=t.tlbr}setUniform(t,r,o,h){const g=h==="u_pattern_to"?this.patternTo:h==="u_pattern_from"?this.patternFrom:h==="u_pixel_ratio_to"?this.pixelRatioTo:h==="u_pixel_ratio_from"?this.pixelRatioFrom:null;g&&t.set(g)}getBinding(t,r,o){return o.substr(0,9)==="u_pattern"?new nr(t,r):new co(t,r)}}class ds{constructor(t,r,o,h){this.expression=t,this.type=o,this.maxValue=0,this.paintVertexAttributes=r.map((g=>({name:`a_${g}`,type:"Float32",components:o==="color"?2:1,offset:0}))),this.paintVertexArray=new h}populatePaintArray(t,r,o){const h=this.paintVertexArray.length,g=this.expression.evaluate(new Ai(0,o),r,{},o.canonical,[],o.formattedSection);this.paintVertexArray.resize(t),this._setPaintValue(h,t,g)}updatePaintArray(t,r,o,h,g){const _=this.expression.evaluate(new Ai(0,g),o,h);this._setPaintValue(t,r,_)}_setPaintValue(t,r,o){if(this.type==="color"){const h=ur(o);for(let g=t;g<r;g++)this.paintVertexArray.emplace(g,h[0],h[1])}else{for(let h=t;h<r;h++)this.paintVertexArray.emplace(h,o);this.maxValue=Math.max(this.maxValue,Math.abs(o))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Cn{constructor(t,r,o,h,g,_){this.expression=t,this.uniformNames=r.map((x=>`u_${x}_t`)),this.type=o,this.useIntegerZoom=h,this.zoom=g,this.maxValue=0,this.paintVertexAttributes=r.map((x=>({name:`a_${x}`,type:"Float32",components:o==="color"?4:2,offset:0}))),this.paintVertexArray=new _}populatePaintArray(t,r,o){const h=this.expression.evaluate(new Ai(this.zoom,o),r,{},o.canonical,[],o.formattedSection),g=this.expression.evaluate(new Ai(this.zoom+1,o),r,{},o.canonical,[],o.formattedSection),_=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(_,t,h,g)}updatePaintArray(t,r,o,h,g){const _=this.expression.evaluate(new Ai(this.zoom,g),o,h),x=this.expression.evaluate(new Ai(this.zoom+1,g),o,h);this._setPaintValue(t,r,_,x)}_setPaintValue(t,r,o,h){if(this.type==="color"){const g=ur(o),_=ur(h);for(let x=t;x<r;x++)this.paintVertexArray.emplace(x,g[0],g[1],_[0],_[1])}else{for(let g=t;g<r;g++)this.paintVertexArray.emplace(g,o,h);this.maxValue=Math.max(this.maxValue,Math.abs(o),Math.abs(h))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(t,r){const o=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,h=zt(this.expression.interpolationFactor(o,this.zoom,this.zoom+1),0,1);t.set(h)}getBinding(t,r,o){return new co(t,r)}}class Bs{constructor(t,r,o,h,g,_){this.expression=t,this.type=r,this.useIntegerZoom=o,this.zoom=h,this.layerId=_,this.zoomInPaintVertexArray=new g,this.zoomOutPaintVertexArray=new g}populatePaintArray(t,r,o){const h=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(h,t,r.patterns&&r.patterns[this.layerId],o.imagePositions)}updatePaintArray(t,r,o,h,g){this._setPaintValues(t,r,o.patterns&&o.patterns[this.layerId],g.imagePositions)}_setPaintValues(t,r,o,h){if(!h||!o)return;const{min:g,mid:_,max:x}=o,b=h[g],T=h[_],C=h[x];if(b&&T&&C)for(let D=t;D<r;D++)this.zoomInPaintVertexArray.emplace(D,T.tl[0],T.tl[1],T.br[0],T.br[1],b.tl[0],b.tl[1],b.br[0],b.br[1],T.pixelRatio,b.pixelRatio),this.zoomOutPaintVertexArray.emplace(D,T.tl[0],T.tl[1],T.br[0],T.br[1],C.tl[0],C.tl[1],C.br[0],C.br[1],T.pixelRatio,C.pixelRatio)}upload(t){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,Sr.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,Sr.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class la{constructor(t,r,o){this.binders={},this._buffers=[];const h=[];for(const g in t.paint._values){if(!o(g))continue;const _=t.paint.get(g);if(!(_ instanceof ji&&ia(_.property.specification)))continue;const x=Os(g,t.type),b=_.value,T=_.property.specification.type,C=_.property.useIntegerZoom,D=_.property.specification["property-type"],O=D==="cross-faded"||D==="cross-faded-data-driven";if(b.kind==="constant")this.binders[g]=O?new Wo(b.value,x):new uo(b.value,x,T),h.push(`/u_${g}`);else if(b.kind==="source"||O){const F=_u(g,T,"source");this.binders[g]=O?new Bs(b,T,C,r,F,t.id):new ds(b,x,T,F),h.push(`/a_${g}`)}else{const F=_u(g,T,"composite");this.binders[g]=new Cn(b,x,T,C,r,F),h.push(`/z_${g}`)}}this.cacheKey=h.sort().join("")}getMaxValue(t){const r=this.binders[t];return r instanceof ds||r instanceof Cn?r.maxValue:0}populatePaintArrays(t,r,o){for(const h in this.binders){const g=this.binders[h];(g instanceof ds||g instanceof Cn||g instanceof Bs)&&g.populatePaintArray(t,r,o)}}setConstantPatternPositions(t,r){for(const o in this.binders){const h=this.binders[o];h instanceof Wo&&h.setConstantPatternPositions(t,r)}}updatePaintArrays(t,r,o,h,g){let _=!1;for(const x in t){const b=r.getPositions(x);for(const T of b){const C=o.feature(T.index);for(const D in this.binders){const O=this.binders[D];if((O instanceof ds||O instanceof Cn||O instanceof Bs)&&O.expression.isStateDependent===!0){const F=h.paint.get(D);O.expression=F.value,O.updatePaintArray(T.start,T.end,C,t[x],g),_=!0}}}}return _}defines(){const t=[];for(const r in this.binders){const o=this.binders[r];(o instanceof uo||o instanceof Wo)&&t.push(...o.uniformNames.map((h=>`#define HAS_UNIFORM_${h}`)))}return t}getBinderAttributes(){const t=[];for(const r in this.binders){const o=this.binders[r];if(o instanceof ds||o instanceof Cn)for(let h=0;h<o.paintVertexAttributes.length;h++)t.push(o.paintVertexAttributes[h].name);else if(o instanceof Bs)for(let h=0;h<Sr.members.length;h++)t.push(Sr.members[h].name)}return t}getBinderUniforms(){const t=[];for(const r in this.binders){const o=this.binders[r];if(o instanceof uo||o instanceof Wo||o instanceof Cn)for(const h of o.uniformNames)t.push(h)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,r){const o=[];for(const h in this.binders){const g=this.binders[h];if(g instanceof uo||g instanceof Wo||g instanceof Cn){for(const _ of g.uniformNames)if(r[_]){const x=g.getBinding(t,r[_],_);o.push({name:_,property:h,binding:x})}}}return o}setUniforms(t,r,o,h){for(const{name:g,property:_,binding:x}of r)this.binders[_].setUniform(x,h,o.get(_),g)}updatePaintBuffers(t){this._buffers=[];for(const r in this.binders){const o=this.binders[r];if(t&&o instanceof Bs){const h=t.fromScale===2?o.zoomInPaintVertexBuffer:o.zoomOutPaintVertexBuffer;h&&this._buffers.push(h)}else(o instanceof ds||o instanceof Cn)&&o.paintVertexBuffer&&this._buffers.push(o.paintVertexBuffer)}}upload(t){for(const r in this.binders){const o=this.binders[r];(o instanceof ds||o instanceof Cn||o instanceof Bs)&&o.upload(t)}this.updatePaintBuffers()}destroy(){for(const t in this.binders){const r=this.binders[t];(r instanceof ds||r instanceof Cn||r instanceof Bs)&&r.destroy()}}}class Tr{constructor(t,r,o=()=>!0){this.programConfigurations={};for(const h of t)this.programConfigurations[h.id]=new la(h,r,o);this.needsUpload=!1,this._featureMap=new oo,this._bufferOffset=0}populatePaintArrays(t,r,o,h){for(const g in this.programConfigurations)this.programConfigurations[g].populatePaintArrays(t,r,h);r.id!==void 0&&this._featureMap.add(r.id,o,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,r,o,h){for(const g of o)this.needsUpload=this.programConfigurations[g.id].updatePaintArrays(t,this._featureMap,r,g,h)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(const r in this.programConfigurations)this.programConfigurations[r].upload(t);this.needsUpload=!1}}destroy(){for(const t in this.programConfigurations)this.programConfigurations[t].destroy()}}function Os(n,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":["ga
173pwidth"],"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"]}[n]||[n.replace(`${t}-`,"").replace(/-/g,"_")]}function _u(n,t,r){const o={color:{source:Is,composite:k},number:{source:m,composite:Is}},h=(function(g){return{"line-pattern":{source:ot,composite:ot},"fill-pattern":{source:ot,composite:ot},"fill-extrusion-pattern":{source:ot,composite:ot}}[g]})(n);return h&&h[r]||o[t][r]}yt("ConstantBinder",uo),yt("CrossFadedConstantBinder",Wo),yt("SourceExpressionBinder",ds),yt("CrossFadedCompositeBinder",Bs),yt("CompositeExpressionBinder",Cn),yt("ProgramConfiguration",la,{omit:["_buffers"]}),yt("ProgramConfigurationSet",Tr);const Za=Math.pow(2,14)-1,Sa=-Za-1;function Yi(n){const t=bt/n.extent,r=n.loadGeometry();for(let o=0;o<r.length;o++){const h=r[o];for(let g=0;g<h.length;g++){const _=h[g],x=Math.round(_.x*t),b=Math.round(_.y*t);_.x=zt(x,Sa,Za),_.y=zt(b,Sa,Za),(x<_.x||x>_.x+1||b<_.y||b>_.y+1)&&$i("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function Ta(n,t){return{type:n.type,id:n.id,properties:n.properties,geometry:t?Yi(n):[]}}const ud=-32768;function ef(n,t,r,o,h){n.emplaceBack(ud+8*t+o,ud+8*r+h)}class hd{constructor(t){this.zoom=t.zoom,this.globalState=t.globalState,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((r=>r.id)),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Se,this.indexArray=new Ii,this.segments=new Wt,this.programConfigurations=new Tr(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter((r=>r.isStateDependent())).map((r=>r.id))}populate(t,r,o){const h=this.layers[0],g=[];let _=null,x=!1,b=h.type==="heatmap";if(h.type==="circle"){const C=h;_=C.layout.get("circle-sort-key"),x=!_.isConstant(),b=b||C.paint.get("circle-pitch-alignment")==="map"}const T=b?r.subdivisionGranularity.circle:1;for(const{feature:C,id:D,index:O,sourceLayerIndex:F}of t){const U=this.layers[0]._featureFilter.needGeometry,$=Ta(C,U);if(!this.layers[0]._featureFilter.filter(new Ai(this.zoom,{globalState:this.globalState}),$,o))continue;const Q=x?_.evaluate($,{},o):void 0,re={id:D,properties:C.properties,type:C.type,sourceLayerIndex:F,index:O,geometry:U?$.geometry:Yi(C),patterns:{},sortKey:Q};g.push(re)}x&&g.sort(((C,D)=>C.sortKey-D.sortKey));for(const C of g){const{geometry:D,index:O,sourceLayerIndex:F}=C,U=t[O].feature;this.addFeature(C,D,O,o,T),r.featureIndex.insert(U,D,O,F,this.index)}}update(t,r,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,{imagePositions:o,globalState:this.globalState})}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,rr),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,r,o,h,g=1){let _;switch(g){case 1:_=[0,7];break;case 3:_=[0,2,5,7];break;case 5:_=[0,1,3,4,6,7];break;case 7:_=[0,1,2,3,4,5,6,7];break;default:throw new Error(`Invalid circle bucket granularity: ${g}; valid values are 1, 3, 5, 7.`)}const x=_.length;for(const b of r)for(const T of b){const C=T.x,D=T.y;if(C<0||C>=bt||D<0||D>=bt)continue;const O=this.segments.prepareSegment(x*x,this.layoutVertexArray,this.indexArray,t.sortKey),F=O.vertexLength;for(let U=0;U<x;U++)for(let $=0;$<x;$++)ef(this.layoutVertexArray,C,D,_[$],_[U]);for(let U=0;U<x-1;U++)for(let $=0;$<x-1;$++){const Q=F+U*x+$,re=F+(U+1)*x+$;this.indexArray.emplaceBack(Q,re+1,Q+1),this.indexArray.emplaceBack(Q,re,re+1)}O.vertexLength+=x*x,O.primitiveLength+=(x-1)*(x-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,o,{imagePositions:{},canonical:h,globalState:this.globalState})}}function tf(n,t){for(let r=0;r<n.length;r++)if(kc(t,n[r]))return!0;for(let r=0;r<t.length;r++)if(kc(n,t[r]))return!0;return!!dd(n,t)}function zc(n,t,r){return!!kc(n,t)||!!yu(t,n,r)}function gh(n,t){if(n.length===1)return fd(t,n[0]);for(let r=0;r<t.length;r++){const o=t[r];for(let h=0;h<o.length;h++)if(kc(n,o[h]))return!0}for(let r=0;r<n.length;r++)if(fd(t,n[r]))return!0;for(let r=0;r<t.length;r++)if(dd(n,t[r]))return!0;return!1}function Wf(n,t,r){if(n.length>1){if(dd(n,t))return!0;for(let o=0;o<t.length;o++)if(yu(t[o],n,r))return!0}for(let o=0;o<n.length;o++)if(yu(n[o],t,r))return!0;return!1}function dd(n,t){if(n.length===0||t.length===0)return!1;for(let r=0;r<n.length-1;r++){const o=n[r],h=n[r+1];for(let g=0;g<t.length-1;g++)if(Qf(o,h,t[g],t[g+1]))return!0}return!1}function Qf(n,t,r,o){return Kn(n,r,o)!==Kn(t,r,o)&&Kn(n,t,r)!==Kn(n,t,o)}function yu(n,t,r){const o=r*r;if(t.length===1)return n.distSqr(t[0])<o;for(let h=1;h<t.length;h++)if(rf(n,t[h-1],t[h])<o)return!0;return!1}function rf(n,t,r){const o=t.distSqr(r);if(o===0)return n.distSqr(t);const h=((n.x-t.x)*(r.x-t.x)+(n.y-t.y)*(r.y-t.y))/o;return n.distSqr(h<0?t:h>1?r:r.sub(t)._mult(h)._add(t))}function fd(n,t){let r,o,h,g=!1;for(let _=0;_<n.length;_++){r=n[_];for(let x=0,b=r.length-1;x<r.length;b=x++)o=r[x],h=r[b],o.y>
vendor: 13,296 bytes, line 173
173t.y!=h.y>t.y&&t.x<(h.x-o.x)*(t.y-o.y)/(h.y-o.y)+o.x&&(g=!g)}return g}function kc(n,t){let r=!1;for(let o=0,h=n.length-1;o<n.length;h=o++){const g=n[o],_=n[h];g.y>t.y!=_.y>t.y&&t.x<(_.x-g.x)*(t.y-g.y)/(_.y-g.y)+g.x&&(r=!r)}return r}function Jf(n,t,r){const o=r[0],h=r[2];if(n.x<o.x&&t.x<o.x||n.x>h.x&&t.x>h.x||n.y<o.y&&t.y<o.y||n.y>h.y&&t.y>h.y)return!1;const g=Kn(n,t,r[0]);return g!==Kn(n,t,r[1])||g!==Kn(n,t,r[2])||g!==Kn(n,t,r[3])}function _h(n,t,r){const o=t.paint.get(n).value;return o.kind==="constant"?o.value:r.programConfigurations.get(t.id).getMaxValue(n)}function yh(n){return Math.sqrt(n[0]*n[0]+n[1]*n[1])}function Xr(n,t,r,o,h){if(!t[0]&&!t[1])return n;const g=H.convert(t)._mult(h);r==="viewport"&&g._rotate(-o);const _=[];for(let x=0;x<n.length;x++)_.push(n[x].sub(g));return _}let En,nf;yt("CircleBucket",hd,{omit:["layers"]});var ep={get paint(){return nf=nf||new On({"circle-radius":new It(Me.paint_circle["circle-radius"]),"circle-color":new It(Me.paint_circle["circle-color"]),"circle-blur":new It(Me.paint_circle["circle-blur"]),"circle-opacity":new It(Me.paint_circle["circle-opacity"]),"circle-translate":new St(Me.paint_circle["circle-translate"]),"circle-translate-anchor":new St(Me.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new St(Me.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new St(Me.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new It(Me.paint_circle["circle-stroke-width"]),"circle-stroke-color":new It(Me.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new It(Me.paint_circle["circle-stroke-opacity"])})},get layout(){return En=En||new On({"circle-sort-key":new It(Me.layout_circle["circle-sort-key"])})}};class tp extends Xn{constructor(t){super(t,ep)}createBucket(t){return new hd(t)}queryRadius(t){const r=t;return _h("circle-radius",this,r)+_h("circle-stroke-width",this,r)+yh(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:t,feature:r,featureState:o,geometry:h,transform:g,pixelsToTileUnits:_,unwrappedTileID:x,getElevation:b}){const T=Xr(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-g.bearingInRadians,_),C=this.paint.get("circle-radius").evaluate(r,o)+this.paint.get("circle-stroke-width").evaluate(r,o),D=this.paint.get("circle-pitch-alignment")==="map",O=D?T:(function(U,$,Q,re){return U.map((be=>af(be,$,Q,re)))})(T,g,x,b),F=D?C*_:C;for(const U of h)for(const $ of U){const Q=D?$:af($,g,x,b);let re=F;const be=g.projectTileCoordinates($.x,$.y,x,b).signedDistanceFromCamera;if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?re*=be/g.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(re*=g.cameraToCenterDistance/be),zc(O,Q,re))return!0}return!1}}function af(n,t,r,o){const h=t.projectTileCoordinates(n.x,n.y,r,o).point;return new H((.5*h.x+.5)*t.width,(.5*-h.y+.5)*t.height)}class sf extends hd{}let xh;yt("HeatmapBucket",sf,{omit:["layers"]});var of={get paint(){return xh=xh||new On({"heatmap-radius":new It(Me.paint_heatmap["heatmap-radius"]),"heatmap-weight":new It(Me.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new St(Me.paint_heatmap["heatmap-intensity"]),"heatmap-color":new zs(Me.paint_heatmap["heatmap-color"]),"heatmap-opacity":new St(Me.paint_heatmap["heatmap-opacity"])})}};function pd(n,{width:t,height:r},o,h){if(h){if(h instanceof Uint8ClampedArray)h=new Uint8Array(h.buffer);else if(h.length!==t*r*o)throw new RangeError(`mismatched image size. expected: ${h.length} but got: ${t*r*o}`)}else h=new Uint8Array(t*r*o);return n.width=t,n.height=r,n.data=h,n}function lf(n,{width:t,height:r},o){if(t===n.width&&r===n.height)return;const h=pd({},{width:t,height:r},o);md(n,h,{x:0,y:0},{x:0,y:0},{width:Math.min(n.width,t),height:Math.min(n.height,r)},o),n.width=t,n.height=r,n.data=h.data}function md(n,t,r,o,h,g){if(h.width===0||h.height===0)return t;if(h.width>n.width||h.height>n.height||r.x>n.width-h.width||r.y>n.height-h.height)throw new RangeError("out of range source coordinates for image copy");if(h.width>t.width||h.height>t.height||o.x>t.width-h.width||o.y>t.height-h.height)throw new RangeError("out of range destination coordinates for image copy");const _=n.data,x=t.data;if(_===x)throw new Error("srcData equals dstData, so image is already copied");for(let b=0;b<h.height;b++){const T=((r.y+b)*n.width+r.x)*g,C=((o.y+b)*t.width+o.x)*g;for(let D=0;D<h.width*g;D++)x[C+D]=_[T+D]}return t}class Ic{constructor(t,r){pd(this,t,1,r)}resize(t){lf(this,t,1)}clone(){return new Ic({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,r,o,h,g){md(t,r,o,h,g,1)}}class Fn{constructor(t,r){pd(this,t,4,r)}resize(t){lf(this,t,4)}replace(t,r){r?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new Fn({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,r,o,h,g){md(t,r,o,h,g,4)}setPixel(t,r,o){const h=4*(t*this.width+r);this.data[h+0]=Math.round(255*o.r/o.a),this.data[h+1]=Math.round(255*o.g/o.a),this.data[h+2]=Math.round(255*o.b/o.a),this.data[h+3]=Math.round(255*o.a)}}function gd(n){const t={},r=n.resolution||256,o=n.clips?n.clips.length:1,h=n.image||new Fn({width:r,height:o});if(Math.log(r)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${r}`);const g=(_,x,b)=>{t[n.evaluationKey]=b;const T=n.expression.evaluate(t);h.setPixel(_/4/r,x/4,T)};if(n.clips)for(let _=0,x=0;_<o;++_,x+=4*r)for(let b=0,T=0;b<r;b++,T+=4){const C=b/(r-1),{start:D,end:O}=n.clips[_];g(x,T,D*(1-C)+O*C)}else for(let _=0,x=0;_<r;_++,x+=4)g(0,x,_/(r-1));return h}yt("AlphaImage",Ic),yt("RGBAImage",Fn);const _d="big-fb";class cf extends Xn{createBucket(t){return new sf(t)}constructor(t){super(t,of),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){t==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=gd({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(_d)&&this.heatmapFbos.delete(_d)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}}let vh;var uf={get paint(){return vh=vh||new On({"hillshade-illumination-direction":new St(Me.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-altitude":new St(Me.paint_hillshade["hillshade-illumination-altitude"]),"hillshade-illumination-anchor":new St(Me.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new St(Me.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new St(Me.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new St(Me.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new St(Me.paint_hillshade["hillshade-accent-color"]),"hillshade-method":new St(Me.paint_hillshade["hillshade-method"])})}};class ip extends Xn{constructor(t){super(t,uf),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let t=this.paint.get("hillshade-illumination-direction").values,r=this.paint.get("hillshade-illumination-altitude").values,o=this.paint.get("hillshade-highlight-color").values,h=this.paint.get("hillshade-shadow-color").values;const g=Math.max(t.length,r.length,o.length,h.length);t=t.concat(Array(g-t.length).fill(t.at(-1))),r=r.concat(Array(g-r.length).fill(r.at(-1))),o=o.concat(Array(g-o.length).fill(o.at(-1))),h=h.concat(Array(g-h.length).fill(h.at(-1)));const _=r.map(gs);return{directionRadians:t.map(gs),altitudeRadians:_,shadowColor:h,highlightColor:o}}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}}let yd;var rp={get paint(){return yd=yd||new On({"color-relief-opacity":new St(Me["paint_color-relief"]["color-relief-opacity"]),"color-relief-color":new zs(Me["paint_color-relief"]["color-relief-color"])})}};class js{constructor(t,r,o,h){this.context=t,this.format=o,this.texture=t.gl.createTexture(),this.update(r,h)}update(t,r,o){const{width:h,height:g}=t,_=!(this.size&&this.size[0]===h&&this.size[1]===g||o),{context:x}=this,{gl:b}=x;if(this.useMipmap=!!(r&&r.useMipmap),b.bindTexture(b.TEXTURE_2D,this.texture),x.pixelStoreUnpackFlipY.set(!1),x.pixelStoreUnpack.set(1),x.pixelStoreUnpackPremultiplyAlpha.set(this.format===b.RGBA&&(!r||r.premultiply!==!1)),_)this.size=[h,g],t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||da(t)?b.texImage2D(b.TEXTURE_2D,0,this.format,this.format,b.UNSIGNED_BYTE,t):b.texImage2D(b.TEXTURE_2D,0,this.format,h,g,0,this.format,b.UNSIGNED_BYTE,t.data);else{const{x:T,y:C}=o||{x:0,y:0};t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||da(t)?b.texSubImage2D(b.TEXTURE_2D,0,T,C,b.RGBA,b.UNSIGNED_BYTE,t):b.texSubImage2D(b.TEXTURE_2D,0,T,C,h,g,b.RGBA,b.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&b.generateMipmap(b.TEXTURE_2D),x.pixelStoreUnpackFlipY.setDefault(),x.pixelStoreUnpack.setDefault(),x.pixelStoreUnpackPremultiplyAlpha.setDefault()}bind(t,r,o){const{context:h}=this,{gl:g}=h;g.bindTexture(g.TEXTURE_2D,this.texture),o!==g.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(o=g.LINEAR),t!==this.filter&&(g.texParameteri(g.TEXTURE_2D,g.TEXTURE_MAG_FILTER,t),g.texParameteri(g.TEXTURE_2D,g.TEXTURE_MIN_FILTER,o||t),this.filter=t),r!==this.wrap&&(g.texParameteri(g.TEXTURE_2D,g.TEXTURE_WRAP_S,r),g.texParameteri(g.TEXTURE_2D,g.TEXTURE_WRAP_T,r),this.wrap=r)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null}}class xd{constructor(t,r,o,h=1,g=1,_=1,x=0){if(this.uid=t,r.height!==r.width)throw new RangeError("DEM tiles must be square");if(o&&!["mapbox","terrarium","custom"].includes(o))return void $i(`"${o}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=r.height;const b=this.dim=r.height-2;switch(this.data=new Uint32Array(r.data.buffer),o){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=h,this.greenFactor=g,this.blueFactor=_,this.baseShift=x;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let T=0;T<b;T++)this.data[this._idx(-1,T)]=this.data[this._idx(0,T)],this.data[this._idx(b,T)]=this.data[this._idx(b-1,T)],this.data[this._idx(T,-1)]=this.data[this._idx(T,0)],this.data[this._idx(T,b)]=this.data[this._idx(T,b-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(b,-1)]=this.data[this._idx(b-1,0)],this.data[this._idx(-1,b)]=this.data[this._idx(0,b-1)],this.data[this._idx(b,b)]=this.data[this._idx(b-1,b-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let T=0;T<b;T++)for(let C=0;C<b;C++){const D=this.get(T,C);D>this.max&&(this.max=D),D<this.min&&(this.min=D)}}get(t,r){const o=new Uint8Array(this.data.buffer),h=4*this._idx(t,r);return this.unpack(o[h],o[h+1],o[h+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(t,r){if(t<-1||t>=this.dim+1||r<-1||r>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(r+1)*this.stride+(t+1)}unpack(t,r,o){return t*this.redFactor+r*this.greenFactor+o*this.blueFactor-this.baseShift}pack(t){return np(t,this.getUnpackVector())}getPixels(){return new Fn({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,r,o){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let h=r*this.dim,g=r*this.dim+this.dim,_=o*this.dim,x=o*this.dim+this.dim;switch(r){case-1:h=g-1;break;case 1:g=h+1}switch(o){case-1:_=x-1;break;case 1:x=_+1}const b=-r*this.dim,T=-o*this.dim;for(let C=_;C<x;C++)for(let D=h;D<g;D++)this.data[this._idx(D,C)]=t.data[this._idx(D+b,C+T)]}}function np(n,t){const r=t[0],o=t[1],h=t[2],g=t[3],_=Math.min(r,o,h),x=Math.round((n+g)/_);return{r:Math.floor(x*_/r)%256,g:Math.floor(x*_/o)%256,b:Math.floor(x*_/h)%256}}yt("DEMData",xd);class ap extends Xn{constructor(t){super(t,rp)}_createColorRamp(t){const r={elevationStops:[],colorStops:[]},o=this._transitionablePaint._values["color-relief-color"].value.expression;if(o instanceof Qs&&o._styleExpression.expression instanceof on){this.colorRampExpression=o;const _=o._styleExpression.expression;r.elevationStops=_.labels,r.colorStops=[];for(const x of r.elevationStops)r.colorStops.push(_.evaluate({globals:{elevation:x}}))}if(r.elevationStops.length<1&&(r.elevationStops=[0],r.colorStops=[ai.transparent]),r.elevationStops.length<2&&(r.elevationStops.push(r.elevationStops[0]+1),r.colorStops.push(r.colorStops[0])),r.elevationStops.length<=t)return r;const h={elevationStops:[],colorStops:[]},g=(r.elevationStops.length-1)/(t-1);for(let _=0;_<r.elevationStops.length-.5;_+=g)h.elevationStops.push(r.elevationStops[Math.round(_)]),h.colorStops.push(r.colorStops[Math.round(_)]);return $i(`Too many colors in specification of ${this.id}
173 color-relief layer, may not render properly.`),h}_colorRampChanged(){return this.colorRampExpression!=this._transitionablePaint._values["color-relief-color"].value.expression}getColorRampTextures(t,r,o){if(this.colorRampTextures&&!this._colorRampChanged())return this.colorRampTextures;const h=this._createColorRamp(r),g=new Fn({width:h.colorStops.length,height:1}),_=new Fn({width:h.colorStops.length,height:1});for(let x=0;x<h.elevationStops.length;x++){const b=np(h.elevationStops[x],o);_.setPixel(0,x,new ai(b.r/255,b.g/255,b.b/255,1)),g.setPixel(0,x,h.colorStops[x])}return this.colorRampTextures={elevationTexture:new js(t,_,t.gl.RGBA),colorTexture:new js(t,g,t.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return this.visibility!=="none"&&!!this.colorRampTextures}}const Qo=wr([{name:"a_pos",components:2,type:"Int16"}],4),{members:sp}=Qo;function xu(n,t,r){const o=r.patternDependencies;let h=!1;for(const g of t){const _=g.paint.get(`${n}-pattern`);_.isConstant()||(h=!0);const x=_.constantOr(null);x&&(h=!0,o[x.to]=!0,o[x.from]=!0)}return h}function Rc(n,t,r,o,h){const{zoom:g,globalState:_}=o,x=h.patternDependencies;for(const b of t){const T=b.paint.get(`${n}-pattern`).value;if(T.kind!=="constant"){let C=T.evaluate({zoom:g-1,globalState:_},r,{},h.availableImages),D=T.evaluate({zoom:g,globalState:_},r,{},h.availableImages),O=T.evaluate({zoom:g+1,globalState:_},r,{},h.availableImages);C=C&&C.name?C.name:C,D=D&&D.name?D.name:D,O=O&&O.name?O.name:O,x[C]=!0,x[D]=!0,x[O]=!0,r.patterns[b.id]={min:C,mid:D,max:O}}}return r}function Mr(n,t,r,o,h){let g;if(h===(function(_,x,b,T){let C=0;for(let D=x,O=b-T;D<b;D+=T)C+=(_[O]-_[D])*(_[D+1]+_[O+1]),O=D;return C})(n,t,r,o)>0)for(let _=t;_<r;_+=o)g=up(_/o|0,n[_],n[_+1],g);else for(let _=r-o;_>=t;_-=o)g=up(_/o|0,n[_],n[_+1],g);return g&&Bc(g,g.next)&&(wu(g),g=g.next),g}function Dc(n,t){if(!n)return n;t||(t=n);let r,o=n;do if(r=!1,o.steiner||!Bc(o,o.next)&&hr(o.prev,o,o.next)!==0)o=o.next;else{if(wu(o),o=t=o.prev,o===o.next)break;r=!0}while(r||o!==t);return t}function bh(n,t,r,o,h,g,_){if(!n)return;!_&&g&&(function(b,T,C,D){let O=b;do O.z===0&&(O.z=vd(O.x,O.y,T,C,D)),O.prevZ=O.prev,O.nextZ=O.next,O=O.next;while(O!==b);O.prevZ.nextZ=null,O.prevZ=null,(function(F){let U,$=1;do{let Q,re=F;F=null;let be=null;for(U=0;re;){U++;let he=re,pe=0;for(let Ne=0;Ne<$&&(pe++,he=he.nextZ,he);Ne++);let Ie=$;for(;pe>0||Ie>0&&he;)pe!==0&&(Ie===0||!he||re.z<=he.z)?(Q=re,re=re.nextZ,pe--):(Q=he,he=he.nextZ,Ie--),be?be.nextZ=Q:F=Q,Q.prevZ=be,be=Q;re=he}be.nextZ=null,$*=2}while(U>1)})(O)})(n,o,h,g);let x=n;for(;n.prev!==n.next;){const b=n.prev,T=n.next;if(g?wh(n,o,h,g):op(n))t.push(b.i,n.i,T.i),wu(n),n=T.next,x=T.next;
vendor: 154,527 bytes, line 173
173else if((n=T)===x){_?_===1?bh(n=jl(Dc(n),t),t,r,o,h,g,2):_===2&&lp(n,t,r,o,h,g):bh(Dc(n),t,r,o,h,g,1);break}}}function op(n){const t=n.prev,r=n,o=n.next;if(hr(t,r,o)>=0)return!1;const h=t.x,g=r.x,_=o.x,x=t.y,b=r.y,T=o.y,C=Math.min(h,g,_),D=Math.min(x,b,T),O=Math.max(h,g,_),F=Math.max(x,b,T);let U=o.next;for(;U!==t;){if(U.x>=C&&U.x<=O&&U.y>=D&&U.y<=F&&Lc(h,x,g,b,_,T,U.x,U.y)&&hr(U.prev,U,U.next)>=0)return!1;U=U.next}return!0}function wh(n,t,r,o){const h=n.prev,g=n,_=n.next;if(hr(h,g,_)>=0)return!1;const x=h.x,b=g.x,T=_.x,C=h.y,D=g.y,O=_.y,F=Math.min(x,b,T),U=Math.min(C,D,O),$=Math.max(x,b,T),Q=Math.max(C,D,O),re=vd(F,U,t,r,o),be=vd($,Q,t,r,o);let he=n.prevZ,pe=n.nextZ;for(;he&&he.z>=re&&pe&&pe.z<=be;){if(he.x>=F&&he.x<=$&&he.y>=U&&he.y<=Q&&he!==h&&he!==_&&Lc(x,C,b,D,T,O,he.x,he.y)&&hr(he.prev,he,he.next)>=0||(he=he.prevZ,pe.x>=F&&pe.x<=$&&pe.y>=U&&pe.y<=Q&&pe!==h&&pe!==_&&Lc(x,C,b,D,T,O,pe.x,pe.y)&&hr(pe.prev,pe,pe.next)>=0))return!1;pe=pe.nextZ}for(;he&&he.z>=re;){if(he.x>=F&&he.x<=$&&he.y>=U&&he.y<=Q&&he!==h&&he!==_&&Lc(x,C,b,D,T,O,he.x,he.y)&&hr(he.prev,he,he.next)>=0)return!1;he=he.prevZ}for(;pe&&pe.z<=be;){if(pe.x>=F&&pe.x<=$&&pe.y>=U&&pe.y<=Q&&pe!==h&&pe!==_&&Lc(x,C,b,D,T,O,pe.x,pe.y)&&hr(pe.prev,pe,pe.next)>=0)return!1;pe=pe.nextZ}return!0}function jl(n,t){let r=n;do{const o=r.prev,h=r.next.next;!Bc(o,h)&&fo(o,r,r.next,h)&&bu(o,h)&&bu(h,o)&&(t.push(o.i,r.i,h.i),wu(r),wu(r.next),r=n=h),r=r.next}while(r!==n);return Dc(r)}function lp(n,t,r,o,h,g){let _=n;do{let x=_.next.next;for(;x!==_.prev;){if(_.i!==x.i&&ff(_,x)){let b=cn(_,x);return _=Dc(_,_.next),b=Dc(b,b.next),bh(_,t,r,o,h,g,0),void bh(b,t,r,o,h,g,0)}x=x.next}_=_.next}while(_!==n)}function cp(n,t){let r=n.x-t.x;return r===0&&(r=n.y-t.y,r===0)&&(r=(n.next.y-n.y)/(n.next.x-n.x)-(t.next.y-t.y)/(t.next.x-t.x)),r}function Sh(n,t){const r=(function(h,g){let _=g;const x=h.x,b=h.y;let T,C=-1/0;if(Bc(h,_))return _;do{if(Bc(h,_.next))return _.next;if(b<=_.y&&b>=_.next.y&&_.next.y!==_.y){const $=_.x+(b-_.y)*(_.next.x-_.x)/(_.next.y-_.y);if($<=x&&$>C&&(C=$,T=_.x<_.next.x?_:_.next,$===x))return T}_=_.next}while(_!==g);if(!T)return null;const D=T,O=T.x,F=T.y;let U=1/0;_=T;do{if(x>=_.x&&_.x>=O&&x!==_.x&&df(b<F?x:C,b,O,F,b<F?C:x,b,_.x,_.y)){const $=Math.abs(b-_.y)/(x-_.x);bu(_,h)&&($<U||$===U&&(_.x>T.x||_.x===T.x&&ho(T,_)))&&(T=_,U=$)}_=_.next}while(_!==D);return T})(n,t);if(!r)return t;const o=cn(r,n);return Dc(o,o.next),Dc(r,r.next)}function ho(n,t){return hr(n.prev,n,t.prev)<0&&hr(t.next,n,n.next)<0}function vd(n,t,r,o,h){return(n=1431655765&((n=858993459&((n=252645135&((n=16711935&((n=(n-r)*h|0)|n<<8))|n<<4))|n<<2))|n<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-o)*h|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function hf(n){let t=n,r=n;do(t.x<r.x||t.x===r.x&&t.y<r.y)&&(r=t),t=t.next;while(t!==n);return r}function df(n,t,r,o,h,g,_,x){return(h-_)*(t-x)>=(n-_)*(g-x)&&(n-_)*(o-x)>=(r-_)*(t-x)&&(r-_)*(g-x)>=(h-_)*(o-x)}function Lc(n,t,r,o,h,g,_,x){return!(n===_&&t===x)&&df(n,t,r,o,h,g,_,x)}function ff(n,t){return n.next.i!==t.i&&n.prev.i!==t.i&&!(function(r,o){let h=r;do{if(h.i!==r.i&&h.next.i!==r.i&&h.i!==o.i&&h.next.i!==o.i&&fo(h,h.next,r,o))return!0;h=h.next}while(h!==r);return!1})(n,t)&&(bu(n,t)&&bu(t,n)&&(function(r,o){let h=r,g=!1;const _=(r.x+o.x)/2,x=(r.y+o.y)/2;do h.y>x!=h.next.y>x&&h.next.y!==h.y&&_<(h.next.x-h.x)*(x-h.y)/(h.next.y-h.y)+h.x&&(g=!g),h=h.next;while(h!==r);return g})(n,t)&&(hr(n.prev,n,t.prev)||hr(n,t.prev,t))||Bc(n,t)&&hr(n.prev,n,n.next)>0&&hr(t.prev,t,t.next)>0)}function hr(n,t,r){return(t.y-n.y)*(r.x-t.x)-(t.x-n.x)*(r.y-t.y)}function Bc(n,t){return n.x===t.x&&n.y===t.y}function fo(n,t,r,o){const h=vu(hr(n,t,r)),g=vu(hr(n,t,o)),_=vu(hr(r,o,n)),x=vu(hr(r,o,t));return h!==g&&_!==x||!(h!==0||!Cr(n,r,t))||!(g!==0||!Cr(n,o,t))||!(_!==0||!Cr(r,n,o))||!(x!==0||!Cr(r,t,o))}function Cr(n,t,r){return t.x<=Math.max(n.x,r.x)&&t.x>=Math.min(n.x,r.x)&&t.y<=Math.max(n.y,r.y)&&t.y>=Math.min(n.y,r.y)}function vu(n){return n>0?1:n<0?-1:0}function bu(n,t){return hr(n.prev,n,n.next)<0?hr(n,t,n.next)>=0&&hr(n,n.prev,t)>=0:hr(n,t,n.prev)<0||hr(n,n.next,t)<0}function cn(n,t){const r=bd(n.i,n.x,n.y),o=bd(t.i,t.x,t.y),h=n.next,g=t.prev;return n.next=t,t.prev=n,r.next=h,h.prev=r,o.next=r,r.prev=o,g.next=o,o.prev=g,o}function up(n,t,r,o){const h=bd(n,t,r);return o?(h.next=o.next,h.prev=o,o.next.prev=h,o.next=h):(h.prev=h,h.next=h),h}function wu(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function bd(n,t,r){return{i:n,x:t,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class Zi{constructor(t,r){if(r>t)throw new Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=t,this._minGranularity=r}getGranularityForZoomLevel(t){return Math.max(Math.floor(this._baseZoomGranularity/(1<<t)),this._minGranularity,1)}}class Un{constructor(t){this.fill=t.fill,this.line=t.line,this.tile=t.tile,this.stencil=t.stencil,this.circle=t.circle}}Un.noSubdivision=new Un({fill:new Zi(0,0),line:new Zi(0,0),tile:new Zi(0,0),stencil:new Zi(0,0),circle:1}),yt("SubdivisionGranularityExpression",Zi),yt("SubdivisionGranularitySetting",Un);const Ma=-32768,Su=32767;class hp{constructor(t,r){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=t,this._granularityCellSize=bt/t,this._canonical=r}_getKey(t,r){return(t+=32768)<<16|r+32768}_vertexToIndex(t,r){if(t<-32768||r<-32768||t>32767||r>32767)throw new Error("Vertex coordinates are out of signed 16 bit integer range.");const o=0|Math.round(t),h=0|Math.round(r),g=this._getKey(o,h);if(this._vertexDictionary.has(g))return this._vertexDictionary.get(g);const _=this._vertexBuffer.length/2;return this._vertexDictionary.set(g,_),this._vertexBuffer.push(o,h),_}_subdivideTrianglesScanline(t){if(this._granularity<2)return(function(h,g){const _=[];for(let x=0;x<g.length;x+=3){const b=g[x],T=g[x+1],C=g[x+2],D=h[2*b],O=h[2*b+1];(h[2*T]-D)*(h[2*C+1]-O)-(h[2*T+1]-O)*(h[2*C]-D)>0?(_.push(b),_.push(C),_.push(T)):(_.push(b),_.push(T),_.push(C))}return _})(this._vertexBuffer,t);const r=[],o=t.length;for(let h=0;h<o;h+=3){const g=[t[h+0],t[h+1],t[h+2]],_=[this._vertexBuffer[2*t[h+0]+0],this._vertexBuffer[2*t[h+0]+1],this._vertexBuffer[2*t[h+1]+0],this._vertexBuffer[2*t[h+1]+1],this._vertexBuffer[2*t[h+2]+0],this._vertexBuffer[2*t[h+2]+1]];let x=1/0,b=1/0,T=-1/0,C=-1/0;for(let $=0;$<3;$++){const Q=_[2*$],re=_[2*$+1];x=Math.min(x,Q),T=Math.max(T,Q),b=Math.min(b,re),C=Math.max(C,re)}if(x===T||b===C)continue;const D=Math.floor(x/this._granularityCellSize),O=Math.ceil(T/this._granularityCellSize),F=Math.floor(b/this._granularityCellSize),U=Math.ceil(C/this._granularityCellSize);if(D!==O||F!==U)for(let $=F;$<U;$++){const Q=this._scanlineGenerateVertexRingForCellRow($,_,g);qa(this._vertexBuffer,Q,r)}else r.push(...g)}return r}_scanlineGenerateVertexRingForCellRow(t,r,o){const h=t*this._granularityCellSize,g=h+this._granularityCellSize,_=[];for(let x=0;x<3;x++){const b=r[2*x],T=r[2*x+1],C=r[2*(x+1)%6],D=r[(2*(x+1)+1)%6],O=r[2*(x+2)%6],F=r[(2*(x+2)+1)%6],U=C-b,$=D-T,Q=U===0,re=$===0,be=(h-T)/$,he=(g-T)/$,pe=Math.min(be,he),Ie=Math.max(be,he);if(!re&&(pe>=1||Ie<=0)||re&&(T<h||T>g)){D>=h&&D<=g&&_.push(o[(x+1)%3]);continue}!re&&pe>0&&_.push(this._vertexToIndex(b+U*pe,T+$*pe));const Ne=b+U*Math.max(pe,0),Qe=b+U*Math.min(Ie,1);Q||this._generateIntraEdgeVertices(_,b,T,C,D,Ne,Qe),!re&&Ie<1&&_.push(this._vertexToIndex(b+U*Ie,T+$*Ie)),(re||D>=h&&D<=g)&&_.push(o[(x+1)%3]),!re&&(D<=h||D>=g)&&this._generateInterEdgeVertices(_,b,T,C,D,O,F,Qe,h,g)}return _}_generateIntraEdgeVertices(t,r,o,h,g,_,x){const b=h-r,T=g-o,C=T===0,D=C?Math.min(r,h):Math.min(_,x),O=C?Math.max(r,h):Math.max(_,x),F=Math.floor(D/this._granularityCellSize)+1,U=Math.ceil(O/this._granularityCellSize)-1;if(C?r<h:_<x)for(let $=F;$<=U;$++){const Q=$*this._granularityCellSize;t.push(this._vertexToIndex(Q,o+T*(Q-r)/b))}else for(let $=U;$>=F;$--){const Q=$*this._granularityCellSize;t.push(this._vertexToIndex(Q,o+T*(Q-r)/b))}}_generateInterEdgeVertices(t,r,o,h,g,_,x,b,T,C){const D=g-o,O=_-h,F=x-g,U=(T-g)/F,$=(C-g)/F,Q=Math.min(U,$),re=Math.max(U,$),be=h+O*Q;let he=Math.floor(Math.min(be,b)/this._granularityCellSize)+1,pe=Math.ceil(Math.max(be,b)/this._granularityCellSize)-1,Ie=b<be;const Ne=F===0;if(Ne&&(x===T||x===C))return;if(Ne||Q>=1||re<=0){const pt=o-x,lt=_+(r-_)*Math.min((T-x)/pt,(C-x)/pt);he=Math.floor(Math.min(lt,b)/this._granularityCellSize)+1,pe=Math.ceil(Math.max(lt,b)/this._granularityCellSize)-1,Ie=b<lt}const Qe=D>0?C:T;if(Ie)for(let pt=he;pt<=pe;pt++)t.push(this._vertexToIndex(pt*this._granularityCellSize,Qe));else for(let pt=pe;pt>=he;pt--)t.push(this._vertexToIndex(pt*this._granularityCellSize,Qe))}_generateOutline(t){const r=[];for(const o of t){const h=Jo(o,this._granularity,!0),g=this._pointArrayToIndices(h),_=[];for(let x=1;x<g.length;x++)_.push(g[x-1]),_.push(g[x]);r.push(_)}return r}_handlePoles(t){let r=!1,o=!1;this._canonical&&(this._canonical.y===0&&(r=!0),this._canonical.y===(1<<this._canonical.z)-1&&(o=!0)),(r||o)&&this._fillPoles(t,r,o)}_ensureNoPoleVertices(){const t=this._vertexBuffer;for(let r=0;r<t.length;r+=2){const o=t[r+1];o===Ma&&(t[r+1]=-32767),o===Su&&(t[r+1]=32766)}}_generatePoleQuad(t,r,o,h,g,_){h>g!=(_===Ma)?(t.push(r),t.push(o),t.push(this._vertexToIndex(h,_)),t.push(o),t.push(this._vertexToIndex(g,_)),t.push(this._vertexToIndex(h,_))):(t.push(o),t.push(r),t.push(this._vertexToIndex(h,_)),t.push(this._vertexToIndex(g,_)),t.push(o),t.push(this._vertexToIndex(h,_)))}_fillPoles(t,r,o){const h=this._vertexBuffer,g=bt,_=t.length;for(let x=2;x<_;x+=3){const b=t[x-2],T=t[x-1],C=t[x],D=h[2*b],O=h[2*b+1],F=h[2*T],U=h[2*T+1],$=h[2*C],Q=h[2*C+1];r&&(O===0&&U===0&&this._generatePoleQuad(t,b,T,D,F,Ma),U===0&&Q===0&&this._generatePoleQuad(t,T,C,F,$,Ma),Q===0&&O===0&&this._generatePoleQuad(t,C,b,$,D,Ma)),o&&(O===g&&U===g&&this._generatePoleQuad(t,b,T,D,F,Su),U===g&&Q===g&&this._generatePoleQuad(t,T,C,F,$,Su),Q===g&&O===g&&this._generatePoleQuad(t,C,b,$,D,Su))}}_initializeVertices(t){for(let r=0;r<t.length;r+=2)this._vertexToIndex(t[r],t[r+1])}subdividePolygonInternal(t,r){if(this._used)throw new Error("Subdivision: multiple use not allowed.");this._used=!0;const{flattened:o,holeIndices:h}=(function(x){const b=[],T=[];for(const C of x)if(C.length!==0){C!==x[0]&&b.push(T.length/2);for(let D=0;D<C.length;D++)T.push(C[D].x),T.push(C[D].y)}return{flattened:T,holeIndices:b}})(t);let g;this._initializeVertices(o);try{const x=(function(T,C,D=2){const O=C&&C.length,F=O?C[0]*D:T.length;let U=Mr(T,0,F,D,!0);const $=[];if(!U||U.next===U.prev)return $;let Q,re,be;if(O&&(U=(function(he,pe,Ie,Ne){const Qe=[];for(let pt=0,lt=pe.length;pt<lt;pt++){const dt=Mr(he,pe[pt]*Ne,pt<lt-1?pe[pt+1]*Ne:he.length,Ne,!1);dt===dt.next&&(dt.steiner=!0),Qe.push(hf(dt))}Qe.sort(cp);for(let pt=0;pt<Qe.length;pt++)Ie=Sh(Qe[pt],Ie);return Ie})(T,C,U,D)),T.length>80*D){Q=T[0],re=T[1];let he=Q,pe=re;for(let Ie=D;Ie<F;Ie+=D){const Ne=T[Ie],Qe=T[Ie+1];Ne<Q&&(Q=Ne),Qe<re&&(re=Qe),Ne>he&&(he=Ne),Qe>pe&&(pe=Qe)}be=Math.max(he-Q,pe-re),be=be!==0?32767/be:0}return bh(U,$,D,Q,re,be,0),$})(o,h),b=this._convertIndices(o,x);g=this._subdivideTrianglesScanline(b)}catch(x){console.error(x)}let _=[];return r&&(_=this._generateOutline(t)),this._ensureNoPoleVertices(),this._handlePoles(g),{verticesFlattened:this._vertexBuffer,indicesTriangles:g,indicesLineList:_}}_convertIndices(t,r){const o=[];for(let h=0;h<r.length;h++)o.push(this._vertexToIndex(t[2*r[h]],t[2*r[h]+1]));return o}_pointArrayToIndices(t){const r=[];for(let o=0;o<t.length;o++){const h=t[o];r.push(this._vertexToIndex(h.x,h.y))}return r}}function dp(n,t,r,o=!0){return new hp(r,t).subdividePolygonInternal(n,o)}function Jo(n,t,r=!1){if(!n||n.length<1)return[];if(n.length<2)return[];const o=n[0],h=n[n.length-1],g=r&&(o.x!==h.x||o.y!==h.y);if(t<2)return g?[...n,n[0]]:[...n];const _=Math.floor(bt/t),x=[];x.push(new H(n[0].x,n[0].y));const b=n.length,T=g?b:b-1;for(let C=0;C<T;C++){const D=n[C],O=C<b-1?n[C+1]:n[0],F=D.x,U=D.y,$=O.x,Q=O.y,re=F!==$,be=U!==Q;if(!re&&!be)continue;const he=$-F,pe=Q-U,Ie=Math.abs(he),Ne=Math.abs(pe);let Qe=F,pt=U;for(;;){const dt=he>0?(Math.floor(Qe/_)+1)*_:(Math.ceil(Qe/_)-1)*_,At=pe>0?(Math.floor(pt/_)+1)*_:(Math.ceil(pt/_)-1)*_,mt=Math.abs(Qe-dt),ft=Math.abs(pt-At),$e=Math.abs(Qe-$),Ot=Math.abs(pt-Q),Ut=re?mt/Ie:Number.POSITIVE_INFINITY,Rt=be?ft/Ne:Number.POSITIVE_INFINITY;if(($e<=mt||!re)&&(Ot<=ft||!be))break;if(Ut<Rt&&re||!be){Qe=dt,pt+=pe*Ut;const Mt=new H(Qe,Math.round(pt));x[x.length-1].x===Mt.x&&x[x.length-1].y===Mt.y||x.push(Mt)}else{Qe+=he*Rt,pt=At;const Mt=new H(Math.round(Qe),pt);x[x.length-1].x===Mt.x&&x[x.length-1].y===Mt.y||x.push(Mt)}}const lt=new H($,Q);x[x.length-1].x===lt.x&&x[x.length-1].y===lt.y||x.push(lt)}return x}function qa(n,t,r){if(t.length===0)throw new Error("Subdivision vertex ring is empty.");let o=0,h=n[2*t[0]];for(let b=1;b<t.length;b++){const T=n[2*t[b]];T<h&&(h=T,o=b)}const g=t.length;let _=o,x=(_+1)%g;for(;;){const b=_-1>=0?_-1:g-1,T=(x+1)%g,C=n[2*t[b]],D=n[2*t[T]],O=n[2*t[_]],F=n[2*t[_]+1],U=n[2*t[x]+1];let $=!1;if(C<D)$=!0;else if(C>D)$=!1;else{const Q=U-F,re=-(n[2*t[x]]-O),be=F<U?1:-1;((C-O)*Q+(n[2*t[b]+1]-F)*re)*be>((D-O)*Q+(n[2*t[T]+1]-F)*re)*be&&($=!0)}if($){const Q=t[b],re=t[_],be=t[x];Q!==re&&Q!==be&&re!==be&&r.push(be,re,Q),_--,_<0&&(_=g-1)}else{const Q=t[T],re=t[_],be=t[x];Q!==re&&Q!==be&&re!==be&&r.push(be,re,Q),x++,x>=g&&(x=0)}if(b===T)break}}function fs(n,t,r,o,h,g,_,x,b){const T=h.length/2,C=_&&x&&b;if(T<Wt.MAX_VERTEX_ARRAY_LENGTH){const D=t.prepareSegment(T,r,o),O=D.vertexLength;for(let $=0;$<g.length;$+=3)o.emplaceBack(O+g[$],O+g[$+1],O+g[$+2]);let F,U;D.vertexLength+=T,D.primitiveLength+=g.length/3,C&&(U=_.prepareSegment(T,r,x),F=U.vertexLength,U.vertexLength+=T);for(let $=0;$<h.length;$+=2)n(h[$],h[$+1]);if(C)for(let $=0;$<b.length;$++){const Q=b[$];for(let re=1;re<Q.length;re+=2)x.emplaceBack(F+Q[re-1],F+Q[re]);U.primitiveLength+=Q.length/2}}else(function(D,O,F,U,$,Q){const re=[];for(let Ne=0;Ne<U.length/2;Ne++)re.push(-1);const be={count:0};let he=0,pe=D.getOrCreateLatestSegment(O,F),Ie=pe.vertexLength;for(let Ne=2;Ne<$.length;Ne+=3){const Qe=$[Ne-2],pt=$[Ne-1],lt=$[Ne];let dt=re[Qe]<he,At=re[pt]<he,mt=re[lt]<he;pe.vertexLength+((dt?1:0)+(At?1:0)+(mt?1:0))>Wt.MAX_VERTEX_ARRAY_LENGTH&&(pe=D.createNewSegment(O,F),he=be.count,dt=!0,At=!0,mt=!0,Ie=0);const ft=Tu(re,U,Q,be,Qe,dt,pe),$e=Tu(re,U,Q,be,pt,At,pe),Ot=Tu(re,U,Q,be,lt,mt,pe);F.emplaceBack(Ie+ft-he,Ie+$e-he,Ie+Ot-he),pe.primitiveLength++}})(t,r,o,h,g,n),C&&(function(D,O,F,U,$,Q){const re=[];for(let Ne=0;Ne<U.length/2;Ne++)re.push(-1);const be={count:0};let he=0,pe=D.getOrCreateLatestSegment(O,F),Ie=pe.vertexLength;for(let Ne=0;Ne<$.length;Ne++){const Qe=$[Ne];for(let pt=1;pt<$[Ne].length;pt+=2){const lt=Qe[pt-1],dt=Qe[pt];let At=re[lt]<he,mt=re[dt]<he;pe.vertexLength+((At?1:0)+(mt?1:0))>Wt.MAX_VERTEX_ARRAY_LENGTH&&(pe=D.createNewSegment(O,F),he=be.count,At=!0,mt=!0,Ie=0);const ft=Tu(re,U,Q,be,lt,At,pe),$e=Tu(re,U,Q,be,dt,mt,pe);F.emplaceBack(Ie+ft-he,Ie+$e-he),pe.primitiveLength++}}})(_,r,x,h,b,n),t.forceNewSegmentOnNextPrepare(),_?.forceNewSegmentOnNextPrepare()}function Tu(n,t,r,o,h,g,_){if(g){const x=o.count;return r(t[2*h],t[2*h+1]),n[h]=o.count,o.count++,_.vertexLength++,x}return n[h]}class ca{constructor(t){this.zoom=t.zoom,this.globalState=t.globalState,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((r=>r.id)),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Oe,this.indexArray=new Ii,this.indexArray2=new Pi,this.programConfigurations=new Tr(t.layers,t.zoom),this.segments=new Wt,this.segments2=new Wt,this.stateDependentLayerIds=this.layers.filter((r=>r.isStateDependent())).map((r=>r.id))}populate(t,r,o){this.hasPattern=xu("fill",this.layers,r);const h=this.layers[0].layout.get("fill-sort-key"),g=!h.isConstant(),_=[];for(const{feature:x,id:b,index:T,sourceLayerIndex:C}of t){const D=this.layers[0]._featureFilter.needGeometry,O=Ta(x,D);if(!this.layers[0]._featureFilter.filter(new Ai(this.zoom,{globalState:this.globalState}),O,o))continue;const F=g?h.evaluate(O,{},o,r.availableImages):void 0,U={id:b,properties:x.properties,type:x.type,sourceLayerIndex:C,index:T,geometry:D?O.geometry:Yi(x),patterns:{},sortKey:F};_.push(U)}g&&_.sort(((x,b)=>x.sortKey-b.sortKey));for(const x of _){const{geometry:b,index:T,sourceLayerIndex:C}=x;if(this.hasPattern){const D=Rc("fill",this.layers,x,{zoom:this.zoom,globalState:this.globalState},r);this.patternFeatures.push(D)}else this.addFeature(x,b,T,o,{},r.subdivisionGranularity);r.featureIndex.insert(t[T].feature,b,T,C,this.index)}}update(t,r,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,{imagePositions:o,globalState:this.globalState})}addFeatures(t,r,o){for(const h of this.patternFeatures)this.addFeature(h,h.geometry,h.index,r,o,t.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,sp),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),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(t,r,o,h,g,_){for(const x of vl(r,500)){const b=dp(x,h,_.fill.getGranularityForZoomLevel(h.z)),T=this.layoutVertexArray;fs(((C,D)=>{T.emplaceBack(C,D)}),this.segments,this.layoutVertexArray,this.indexArray,b.verticesFlattened,b.indicesTriangles,this.segments2,this.indexArray2,b.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,o,{imagePositions:g,canonical:h,globalState:this.globalState})}}let pf,el;yt("FillBucket",ca,{omit:["layers","patternFeatures"]});var Oc={get paint(){return el=el||new On({"fill-antialias":new St(Me.paint_fill["fill-antialias"]),"fill-opacity":new It(Me.paint_fill["fill-opacity"]),"fill-color":new It(Me.paint_fill["fill-color"]),"fill-outline-color":new It(Me.paint_fill["fill-outline-color"]),"fill-translate":new St(Me.paint_fill["fill-translate"]),"fill-translate-anchor":new St(Me.paint_fill["fill-translate-anchor"]),"fill-pattern":new Yo(Me.paint_fill["fill-pattern"])})},get layout(){return pf=pf||new On({"fill-sort-key":new It(Me.layout_fill["fill-sort-key"])})}};class Nl extends Xn{constructor(t){super(t,Oc)}recalculate(t,r){super.recalculate(t,r);const o=this.paint._values["fill-outline-color"];o.value.kind==="constant"&&o.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(t){return new ca(t)}queryRadius(){return yh(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:t,geometry:r,transform:o,pixelsToTileUnits:h}){return gh(Xr(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-o.bearingInRadians,h),r)}isTileClipped(){return!0}}const mf=wr([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),gf=wr([{name:"a_centroid",components:2,type:"Int16"}],4),{members:po}=mf;class jc{constructor(t,r,o,h,g){this.properties={},this.extent=o,this.type=0,this.id=void 0,this._pbf=t,this._geometry=-1,this._keys=h,this._values=g,t.readFields(Mu,this,r)}loadGeometry(){const t=this._pbf;t.pos=this._geometry;const r=t.readVarint()+t.pos,o=[];let h,g=1,_=0,x=0,b=0;for(;t.pos<r;){if(_<=0){const T=t.readVarint();g=7&T,_=T>>3}if(_--,g===1||g===2)x+=t.readSVarint(),b+=t.readSVarint(),g===1&&(h&&o.push(h),h=[]),h&&h.push(new H(x,b));else{if(g!==7)throw new Error(`unknown command ${g}`);h&&h.push(h[0].clone())}}return h&&o.push(h),o}bbox(){const t=this._pbf;t.pos=this._geometry;const r=t.readVarint()+t.pos;let o=1,h=0,g=0,_=0,x=1/0,b=-1/0,T=1/0,C=-1/0;for(;t.pos<r;){if(h<=0){const D=t.readVarint();o=7&D,h=D>>3}if(h--,o===1||o===2)g+=t.readSVarint(),_+=t.readSVarint(),g<x&&(x=g),g>b&&(b=g),_<T&&(T=_),_>C&&(C=_);else if(o!==7)throw new Error(`unknown command ${o}`)}return[x,T,b,C]}toGeoJSON(t,r,o){const h=this.extent*Math.pow(2,o),g=this.extent*t,_=this.extent*r,x=this.loadGeometry();function b(O){return[360*(O.x+g)/h-180,360/Math.PI*Math.atan(Math.exp((1-2*(O.y+_)/h)*Math.PI))-90]}function T(O){return O.map(b)}let C;if(this.type===1){const O=[];for(const U of x)O.push(U[0]);const F=T(O);C=O.length===1?{type:"Point",coordinates:F[0]}:{type:"MultiPoint",coordinates:F}}else if(this.type===2){const O=x.map(T);C=O.length===1?{type:"LineString",coordinates:O[0]}:{type:"MultiLineString",coordinates:O}}else{if(this.type!==3)throw new Error("unknown feature type");{const O=(function(U){const $=U.length;if($<=1)return[U];const Q=[];let re,be;for(let he=0;he<$;he++){const pe=Th(U[he]);pe!==0&&(be===void 0&&(be=pe<0),be===pe<0?(re&&Q.push(re),re=[U[he]]):re&&re.push(U[he]))}return re&&Q.push(re),Q})(x),F=[];for(const U of O)F.push(U.map(T));C=F.length===1?{type:"Polygon",coordinates:F[0]}:{type:"MultiPolygon",coordinates:F}}}const D={type:"Feature",geometry:C,properties:this.properties};return this.id!=null&&(D.id=this.id),D}}function Mu(n,t,r){n===1?t.id=r.readVarint():n===2?(function(o,h){const g=o.readVarint()+o.pos;for(;o.pos<g;){const _=h._keys[o.readVarint()],x=h._values[o.readVarint()];h.properties[_]=x}})(r,t):n===3?t.type=r.readVarint():n===4&&(t._geometry=r.pos)}function Th(n){let t=0;for(let r,o,h=0,g=n.length,_=g-1;h<g;_=h++)r=n[h],o=n[_],t+=(o.x-r.x)*(r.y+o.y);return t}jc.types=["Unknown","Point","LineString","Polygon"];class Cu{constructor(t,r){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(Eu,this,r),this.length=this._features.length}feature(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];const r=this._pbf.readVarint()+this._pbf.pos;return new jc(this._pbf,r,this.extent,this._keys,this._values)}}function Eu(n,t,r){n===15?t.version=r.readVarint():n===1?t.name=r.readString():n===5?t.extent=r.readVarint():n===2?t._features.push(r.pos):n===3?t._keys.push(r.readString()):n===4&&t._values.push((function(o){let h=null;const g=o.readVarint()+o.pos;for(;o.pos<g;){const _=o.readVarint()>>3;h=_===1?o.readString():_===2?o.readFloat():_===3?o.readDouble():_===4?o.readVarint64():_===5?o.readVarint():_===6?o.readSVarint():_===7?o.readBoolean():null}if(h==null)throw new Error("unknown feature value");return h})(r))}class _f{constructor(t,r){this.layers=t.readFields(fp,{},r)}}function fp(n,t,r){if(n===3){const o=new Cu(r,r.readVarint()+r.pos);o.length&&(t[o.name]=o)}}const Nc=Math.pow(2,13);function Au(n,t,r,o,h,g,_,x){n.emplaceBack(t,r,2*Math.floor(o*Nc)+_,h*Nc*2,g*Nc*2,Math.round(x))}class Pu{constructor(t){this.zoom=t.zoom,this.globalState=t.globalState,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((r=>r.id)),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new ze,this.centroidVertexArray=new le,this.indexArray=new Ii,this.programConfigurations=new Tr(t.layers,t.zoom),this.segments=new Wt,this.stateDependentLayerIds=this.layers.filter((r=>r.isStateDependent())).map((r=>r.id))}populate(t,r,o){this.features=[],this.hasPattern=xu("fill-extrusion",this.layers,r);for(const{feature:h,id:g,index:_,sourceLayerIndex:x}of t){const b=this.layers[0]._featureFilter.needGeometry,T=Ta(h,b);if(!this.layers[0]._featureFilter.filter(new Ai(this.zoom,{globalState:this.globalState}),T,o))continue;const C={id:g,sourceLayerIndex:x,index:_,geometry:b?T.geometry:Yi(h),properties:h.properties,type:h.type,patterns:{}};this.hasPattern?this.features.push(Rc("fill-extrusion",this.layers,C,{zoom:this.zoom,globalState:this.globalState},r)):this.addFeature(C,C.geometry,_,o,{},r.subdivisionGranularity),r.featureIndex.insert(h,C.geometry,_,x,this.index,!0)}}addFeatures(t,r,o){for(const h of this.features){const{geometry:g}=h;this.addFeature(h,g,h.index,r,o,t.subdivisionGranularity)}}update(t,r,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,{imagePositions:o,globalState:this.globalState})}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,po),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,gf.members,!0),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(t,r,o,h,g,_){for(const x of vl(r,500)){const b={x:0,y:0,sampleCount:0},T=this.layoutVertexArray.length;this.processPolygon(b,h,t,x,_);const C=this.layoutVertexArray.length-T,D=Math.floor(b.x/b.sampleCount),O=Math.floor(b.y/b.sampleCount);for(let F=0;F<C;F++)this.centroidVertexArray.emplaceBack(D,O)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,o,{imagePositions:g,canonical:h,globalState:this.globalState})}processPolygon(t,r,o,h,g){if(h.length<1||mp(h[0]))return;for(const D of h)D.length!==0&&pp(t,D);const _={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},x=g.fill.getGranularityForZoomLevel(r.z),b=jc.types[o.type]==="Polygon";for(const D of h){if(D.length===0||mp(D))continue;const O=Jo(D,x,b);this._generateSideFaces(O,_)}if(!b)return;const T=dp(h,r,x,!1),C=this.layoutVertexArray;fs(((D,O)=>{Au(C,D,O,0,0,1,1,0)}),this.segments,this.layoutVertexArray,this.indexArray,T.verticesFlattened,T.indicesTriangles)}_generateSideFaces(t,r){let o=0;for(let h=1;h<t.length;h++){const g=t[h],_=t[h-1];if(tm(g,_))continue;r.segment.vertexLength+4>Wt.MAX_VERTEX_ARRAY_LENGTH&&(r.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const x=g.sub(_)._perp()._unit(),b=_.dist(g);o+b>32768&&(o=0),Au(this.layoutVertexArray,g.x,g.y,x.x,x.y,0,0,o),Au(this.layoutVertexArray,g.x,g.y,x.x,x.y,0,1,o),o+=b,Au(this.layoutVertexArray,_.x,_.y,x.x,x.y,0,0,o),Au(this.layoutVertexArray,_.x,_.y,x.x,x.y,0,1,o);const T=r.segment.vertexLength;this.indexArray.emplaceBack(T,T+2,T+1),this.indexArray.emplaceBack(T+1,T+2,T+3),r.segment.vertexLength+=4,r.segment.primitiveLength+=2}}}function pp(n,t){for(let r=0;r<t.length;r++){const o=t[r];r===t.length-1&&t[0].x===o.x&&t[0].y===o.y||(n.x+=o.x,n.y+=o.y,n.sampleCount++)}}function tm(n,t){return n.x===t.x&&(n.x<0||n.x>bt)||n.y===t.y&&(n.y<0||n.y>bt)}function mp(n){return n.every((t=>t.x<0))||n.every((t=>t.x>bt))||n.every((t=>t.y<0))||n.every((t=>t.y>bt))}let Vi;yt("FillExtrusionBucket",Pu,{omit:["layers","features"]});var dr={get paint(){return Vi=Vi||new On({"fill-extrusion-opacity":new St(Me["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new It(Me["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new St(Me["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new St(Me["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Yo(Me["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new It(Me["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new It(Me["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new St(Me["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class bi extends Xn{constructor(t){super(t,dr)}createBucket(t){return new Pu(t)}queryRadius(){return yh(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:t,feature:r,featureState:o,geometry:h,transform:g,pixelsToTileUnits:_,pixelPosMatrix:x}){const b=Xr(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-g.bearingInRadians,_),T=this.paint.get("fill-extrusion-height").evaluate(r,o),C=this.paint.get("fill-extrusion-base").evaluate(r,o),D=(function(F,U){const $=[];for(const Q of F){const re=[Q.x,Q.y,0,1];Ir(re,re,U),$.push(new H(re[0]/re[3],re[1]/re[3]))}return $})(b,x),O=(function(F,U,$,Q){const re=[],be=[],he=Q[8]*U,pe=Q[9]*U,Ie=Q[10]*U,Ne=Q[11]*U,Qe=Q[8]*$,pt=Q[9]*$,lt=Q[10]*$,dt=Q[11]*$;for(const At of F){const mt=[],ft=[];for(const $e of At){const Ot=$e.x,Ut=$e.y,Rt=Q[0]*Ot+Q[4]*Ut+Q[12],Mt=Q[1]*Ot+Q[5]*Ut+Q[13],ri=Q[2]*Ot+Q[6]*Ut+Q[14],Di=Q[3]*Ot+Q[7]*Ut+Q[15],Wi=ri+Ie,Vr=Di+Ne,Gn=Rt+Qe,Gr=Mt+pt,hn=ri+lt,ar=Di+dt,Er=new H((Rt+he)/Vr,(Mt+pe)/Vr);Er.z=Wi/Vr,mt.push(Er);const dn=new H(Gn/ar,Gr/ar);dn.z=hn/ar,ft.push(dn)}re.push(mt),be.push(ft)}return[re,be]})(h,C,T,x);return(function(F,U,$){let Q=1/0;gh($,U)&&(Q=Gi($,U[0]));for(let re=0;re<U.length;re++){const be=U[re],he=F[re];for(let pe=0;pe<be.length-1;pe++){const Ie=be[pe],Ne=[Ie,be[pe+1],he[pe+1],he[pe],Ie];tf($,Ne)&&(Q=Math.min(Q,Gi($,Ne)))}}return Q!==1/0&&Q})(O[0],O[1],D)}}function gi(n,t){return n.x*t.x+n.y*t.y}function Gi(n,t){if(n.length===1){let r=0;const o=t[r++];let h;for(;!h||o.equals(h);)if(h=t[r++],!h)return 1/0;for(;r<t.length;r++){const g=t[r],_=n[0],x=h.sub(o),b=g.sub(o),T=_.sub(o),C=gi(x,x),D=gi(x,b),O=gi(b,b),F=gi(T,x),U=gi(T,b),$=C*O-D*D,Q=(O*F-D*U)/$,re=(C*U-D*F)/$,be=o.z*(1-Q-re)+h.z*Q+g.z*re;if(isFinite(be))return be}return 1/0}{let r=1/0;for(const o of t)r=Math.min(r,o.z);return r}}const $a=wr([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:Fl}=$a,zu=wr([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:yf}=zu,tl=Math.cos(Math.PI/180*37.5),Br=Math.pow(2,14)/.5;class mo{constructor(t){this.zoom=t.zoom,this.globalState=t.globalState,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((r=>r.id)),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((r=>{this.gradients[r.id]={}})),this.layoutVertexArray=new ke,this.layoutVertexArray2=new Le,this.indexArray=new Ii,this.programConfigurations=new Tr(t.layers,t.zoom),this.segments=new Wt,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((r=>r.isStateDependent())).map((r=>r.id))}populate(t,r,o){this.hasPattern=xu("line",this.layers,r);const h=this.layers[0].layout.get("line-sort-key"),g=!h.isConstant(),_=[];for(const{feature:x,id:b,index:T,sourceLayerIndex:C}of t){const D=this.layers[0]._featureFilter.needGeometry,O=Ta(x,D);if(!this.layers[0]._featureFilter.filter(new Ai(this.zoom,{globalState:this.globalState}),O,o))continue;const F=g?h.evaluate(O,{},o):void 0,U={id:b,properties:x.properties,type:x.type,sourceLayerIndex:C,index:T,geometry:D?O.geometry:Yi(x),patterns:{},sortKey:F};_.push(U)}g&&_.sort(((x,b)=>x.sortKey-b.sortKey));for(const x of _){const{geometry:b,index:T,sourceLayerIndex:C}=x;if(this.hasPattern){const D=Rc("line",this.layers,x,{zoom:this.zoom,globalState:this.globalState},r);this.patternFeatures.push(D)}else this.addFeature(x,b,T,o,{},r.subdivisionGranularity);r.featureIndex.insert(t[T].feature,b,T,C,this.index)}}update(t,r,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,{imagePositions:o,globalState:this.globalState})}addFeatures(t,r,o){for(const h of this.patternFeatures)this.addFeature(h,h.geometry,h.index,r,o,t.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,yf)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Fl),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_end"))return{start:+t.properties.mapbox_clip_start,end:+t.properties.mapbox_clip_end}}addFeature(t,r,o,h,g,_){const x=this.layers[0].layout,b=x.get("line-join").evaluate(t,{}),T=x.get("line-cap"),C=x.get("line-miter-limit"),D=x.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(const O of r)this.addLine(O,t,b,T,C,D,h,_);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,o,{imagePositions:g,canonical:h,globalState:this.globalState})}addLine(t,r,o,h,g,_,x,b){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,t=Jo(t,x?b.line.getGranularityForZoomLevel(x.z):1),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let he=0;he<t.length-1;he++)this.totalDistance+=t[he].dist(t[he+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const T=jc.types[r.type]==="Polygon";let C=t.length;for(;C>=2&&t[C-1].equals(t[C-2]);)C--;let D=0;for(;D<C-1&&t[D].equals(t[D+1]);)D++;if(C<(T?3:2))return;o==="bevel"&&(g=1.05);const O=this.overscaling<=16?122880/(512*this.overscaling):0,F=this.segments.prepareSegment(10*C,this.layoutVertexArray,this.indexArray);let U,$,Q,re,be;this.e1=this.e2=-1,T&&(U=t[C-2],be=t[D].sub(U)._unit()._perp());for(let he=D;he<C;he++){if(Q=he===C-1?T?t[D+1]:void 0:t[he+1],Q&&t[he].equals(Q))continue;be&&(re=be),U&&($=U),U=t[he],be=Q?Q.sub(U)._unit()._perp():re,re=re||be;let pe=re.add(be);pe.x===0&&pe.y===0||pe._unit();const Ie=re.x*be.x+re.y*be.y,Ne=pe.x*be.x+pe.y*be.y,Qe=Ne!==0?1/Ne:1/0,pt=2*Math.sqrt(2-2*Ne),lt=Ne<tl&&$&&Q,dt=re.x*be.y-re.y*be.x>0;if(lt&&he>D){const ft=U.dist($);if(ft>2*O){const $e=U.sub(U.sub($)._mult(O/ft)._round());this.updateDistance($,$e),this.addCurrentVertex($e,re,0,0,F),$=$e}}const At=$&&Q;let mt=At?o:T?"butt":h;if(At&&mt==="round"&&(Qe<_?mt="miter":Qe<=2&&(mt="fakeround")),mt==="miter"&&Qe>g&&(mt="bevel"),mt==="bevel"&&(Qe>2&&(mt="flipbevel"),Qe<g&&(mt="miter")),$&&this.updateDistance($,U),mt==="miter")pe._mult(Qe),this.addCurrentVertex(U,pe,0,0,F);else if(mt==="flipbevel"){if(Qe>100)pe=be.mult(-1);else{const ft=Qe*re.add(be).mag()/re.sub(be).mag();pe._perp()._mult(ft*(dt?-1:1))}this.addCurrentVertex(U,pe,0,0,F),this.addCurrentVertex(U,pe.mult(-1),0,0,F)}else if(mt==="bevel"||mt==="fakeround"){const ft=-Math.sqrt(Qe*Qe-1),$e=dt?ft:0,Ot=dt?0:ft;if($&&this.addCurrentVertex(U,re,$e,Ot,F),mt==="fakeround"){const Ut=Math.round(180*pt/Math.PI/20);for(let Rt=1;Rt<Ut;Rt++){let Mt=Rt/Ut;if(Mt!==.5){const Di=Mt-.5;Mt+=Mt*Di*(Mt-1)*((1.0904+Ie*(Ie*(3.55645-1.43519*Ie)-3.2452))*Di*Di+(.848013+Ie*(.215638*Ie-1.06021)))}const ri=be.sub(re)._mult(Mt)._add(re)._unit()._mult(dt?-1:1);this.addHalfVertex(U,ri.x,ri.y,!1,dt,0,F)}}Q&&this.addCurrentVertex(U,be,-$e,-Ot,F)}else if(mt==="butt")this.addCurrentVertex(U,pe,0,0,F);else if(mt==="square"){const ft=$?1:-1;this.addCurrentVertex(U,pe,ft,ft,F)}else mt==="round"&&($&&(this.addCurrentVertex(U,re,0,0,F),this.addCurrentVertex(U,re,1,1,F,!0)),Q&&(this.addCurrentVertex(U,be,-1,-1,F,!0),this.addCurrentVertex(U,be,0,0,F)));if(lt&&he<C-1){const ft=U.dist(Q);if(ft>2*O){const $e=U.add(Q.sub(U)._mult(O/ft)._round());this.updateDistance(U,$e),this.addCurrentVertex($e,be,0,0,F),U=$e}}}}addCurrentVertex(t,r,o,h,g,_=!1){const x=r.y*h-r.x,b=-r.y-r.x*h;this.addHalfVertex(t,r.x+r.y*o,r.y-r.x*o,_,!1,o,g),this.addHalfVertex(t,x,b,_,!0,-h,g),this.distance>Br/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,r,o,h,g,_))}addHalfVertex({x:t,y:r},o,h,g,_,x,b){const T=.5*(this.lineClips?this.scaledDistance*(Br-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+(g?1:0),(r<<1)+(_?1:0),Math.round(63*o)+128,Math.round(63*h)+128,1+(x===0?0:x<0?-1:1)|(63&T)<<2,T>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const C=b.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,C,this.e2),b.primitiveLength++),_?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(t,r){this.distance+=t.dist(r),this.updateScaledDistance()}}let Ul,wd;yt("LineBucket",mo,{omit:["layers","patternFeatures"]});var Ha={get paint(){return wd=wd||new On({"line-opacity":new It(Me.paint_line["line-opacity"]),"line-color":new It(Me.paint_line["line-color"]),"line-translate":new St(Me.paint_line["line-translate"]),"line-translate-anchor":new St(Me.paint_line["line-translate-anchor"]),"line-width":new It(Me.paint_line["line-width"]),"line-gap-width":new It(Me.paint_line["line-gap-width"]),"line-offset":new It(Me.paint_line["line-offset"]),"line-blur":new It(Me.paint_line["line-blur"]),"line-dasharray":new va(Me.paint_line["line-dasharray"]),"line-pattern":new Yo(Me.paint_line["line-pattern"]),"line-gradient":new zs(Me.paint_line["line-gradient"])})},get layout(){return Ul=Ul||new On({"line-cap":new St(Me.layout_line["line-cap"]),"line-join":new It(Me.layout_line["line-join"]),"line-miter-limit":new St(Me.layout_line["line-miter-limit"]),"line-round-limit":new St(Me.layout_line["line-round-limit"]),"line-sort-key":new It(Me.layout_line["line-sort-key"])})}};class ku extends It{possiblyEvaluate(t,r){return r=new Ai(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),super.possiblyEvaluate(t,r)}evaluate(t,r,o,h){return r=si({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(t,r,o,h)}}let Vl;class Ca extends Xn{constructor(t){super(t,Ha),this.gradientVersion=0,Vl||(Vl=new ku(Ha.paint.properties["line-width"].specification),Vl.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(t){if(t==="line-gradient"){const r=this.gradientExpression();this.stepInterpolant=!!(function(o){return o._styleExpression!==void 0})(r)&&r._styleExpression.expression instanceof vr,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(t,r){super.recalculate(t,r),this.paint._values["line-floorwidth"]=Vl.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new mo(t)}queryRadius(t){const r=t,o=Sd(_h("line-width",this,r),_h("line-gap-width",this,r)),h=_h("line-offset",this,r);return o/2+Math.abs(h)+yh(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:t,feature:r,featureState:o,geometry:h,transform:g,pixelsToTileUnits:_}){const x=Xr(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-g.bearingInRadians,_),b=_/2*Sd(this.paint.get("line-width").evaluate(r,o),this.paint.get("line-gap-width").evaluate(r,o)),T=this.paint.get("line-offset").evaluate(r,o);return T&&(h=(function(C,D){const O=[];for(let F=0;F<C.length;F++){const U=C[F],$=[];for(let Q=0;Q<U.length;Q++){const re=U[Q-1],be=U[Q],he=U[Q+1],pe=Q===0?new H(0,0):be.sub(re)._unit()._perp(),Ie=Q===U.length-1?new H(0,0):he.sub(be)._unit()._perp(),Ne=pe._add(Ie)._unit(),Qe=Ne.x*Ie.x+Ne.y*Ie.y;Qe!==0&&Ne._mult(1/Qe),$.push(Ne._mult(D)._add(be))}O.push($)}return O})(h,T*_)),(function(C,D,O){for(let F=0;F<D.length;F++){const U=D[F];if(C.length>=3){for(let $=0;$<U.length;$++)if(kc(C,U[$]))return!0}if(Wf(C,U,O))return!0}return!1})(x,h,b)}isTileClipped(){return!0}}function Sd(n,t){return t>0?t+2*n:n}const xf=wr([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Td=wr([{name:"a_projected_pos",components:3,type:"Float32"}],4);wr([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Md=wr([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);wr([{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 il=wr([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Vn=wr([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function Gl(n,t,r){return n.sections.forEach((o=>{o.text=(function(h,g,_){const x=g.layout.get("text-transform").evaluate(_,{});return x==="uppercase"?h=h.toLocaleUpperCase():x==="lowercase"&&(h=h.toLocaleLowerCase()),Sn.applyArabicShaping&&(h=Sn.applyArabicShaping(h)),h})(o.text,t,r)})),n}wr([{name:"triangle",components:3,type:"Uint16"}]),wr([{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"}]),wr([{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"}]),wr([{type:"Float32",name:"offsetX"}]),wr([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),wr([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const go={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var yr=24;const Mh=4294967296,Cd=1/Mh,vf=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");class Fc{constructor(t=new Uint8Array(16)){this.buf=ArrayBuffer.isView(t)?t:new Uint8Array(t),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(t,r,o=this.length){for(;this.pos<o;){const h=this.readVarint(),g=h>>3,_=this.pos;this.type=7&h,t(g,r,this),this.pos===_&&this.skip(h)}return r}readMessage(t,r){return this.readFields(t,r,this.readVarint()+this.pos)}readFixed32(){const t=this.dataView.getUint32(this.pos,!0);return this.pos+=4,t}readSFixed32(){const t=this.dataView.getInt32(this.pos,!0);return this.pos+=4,t}readFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*Mh;return this.pos+=8,t}readSFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*Mh;return this.pos+=8,t}readFloat(){const t=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,t}readDouble(){const t=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,t}readVarint(t){const r=this.buf;let o,h;return h=r[this.pos++],o=127&h,h<128?o:(h=r[this.pos++],o|=(127&h)<<7,h<128?o:(h=r[this.pos++],o|=(127&h)<<14,h<128?o:(h=r[this.pos++],o|=(127&h)<<21,h<128?o:(h=r[this.pos],o|=(15&h)<<28,(function(g,_,x){const b=x.buf;let T,C;if(C=b[x.pos++],T=(112&C)>>4,C<128||(C=b[x.pos++],T|=(127&C)<<3,C<128)||(C=b[x.pos++],T|=(127&C)<<10,C<128)||(C=b[x.pos++],T|=(127&C)<<17,C<128)||(C=b[x.pos++],T|=(127&C)<<24,C<128)||(C=b[x.pos++],T|=(1&C)<<31,C<128))return Zl(g,T,_);throw new Error("Expected varint not more than 10 bytes")})(o,t,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const t=this.readVarint();return t%2==1?(t+1)/-2:t/2}readBoolean(){return!!this.readVarint()}readString(){const t=this.readVarint()+this.pos,r=this.pos;return this.pos=t,t-r>=12&&vf?vf.decode(this.buf.subarray(r,t)):(function(o,h,g){let _="",x=h;for(;x<g;){const b=o[x];let T,C,D,O=null,F=b>239?4:b>223?3:b>191?2:1;if(x+F>g)break;F===1?b<128&&(O=b):F===2?(T=o[x+1],(192&T)==128&&(O=(31&b)<<6|63&T,O<=127&&(O=null))):F===3?(T=o[x+1],C=o[x+2],(192&T)==128&&(192&C)==128&&(O=(15&b)<<12|(63&T)<<6|63&C,(O<=2047||O>=55296&&O<=57343)&&(O=null))):F===4&&(T=o[x+1],C=o[x+2],D=o[x+3],(192&T)==128&&(192&C)==128&&(192&D)==128&&(O=(15&b)<<18|(63&T)<<12|(63&C)<<6|63&D,(O<=65535||O>=1114112)&&(O=null))),O===null?(O=65533,F=1):O>65535&&(O-=65536,_+=String.fromCharCode(O>>>10&1023|55296),O=56320|1023&O),_+=String.fromCharCode(O),x+=F}return _})(this.buf,r,t)}readBytes(){const t=this.readVarint()+this.pos,r=this.buf.subarray(this.pos,t);return this.pos=t,r}readPackedVarint(t=[],r){const o=this.readPackedEnd();for(;this.pos<o;)t.push(this.readVarint(r));return t}readPackedSVarint(t=[]){const r=this.readPackedEnd();for(;this.pos<r;)t.push(this.readSVarint());return t}readPackedBoolean(t=[]){const r=this.readPackedEnd();for(;this.pos<r;)t.push(this.readBoolean());return t}readPackedFloat(t=[]){const r=this.readPackedEnd();for(;this.pos<r;)t.push(this.readFloat());return t}readPackedDouble(t=[]){const r=this.readPackedEnd();for(;this.pos<r;)t.push(this.readDouble());return t}readPackedFixed32(t=[]){const r=this.readPackedEnd();for(;this.pos<r;)t.push(this.readFixed32());return t}readPackedSFixed32(t=[]){const r=this.readPackedEnd();for(;this.pos<r;)t.push(this.readSFixed32());return t}readPackedFixed64(t=[]){const r=this.readPackedEnd();for(;this.pos<r;)t.push(this.readFixed64());return t}readPackedSFixed64(t=[]){const r=this.readPackedEnd();for(;this.pos<r;)t.push(this.readSFixed64());return t}readPackedEnd(){return this.type===2?this.readVarint()+this.pos:this.pos+1}skip(t){const r=7&t;if(r===0)for(;this.buf[this.pos++]>127;);else if(r===2)this.pos=this.readVarint()+this.pos;else if(r===5)this.pos+=4;else{if(r!==1)throw new Error(`Unimplemented type: ${r}`);this.pos+=8}}writeTag(t,r){this.writeVarint(t<<3|r)}realloc(t){let r=this.length||16;for(;r<this.pos+t;)r*=2;if(r!==this.length){const o=new Uint8Array(r);o.set(this.buf),this.buf=o,this.dataView=new DataView(o.buffer),this.length=r}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(t){this.realloc(4),this.dataView.setInt32(this.pos,t,!0),this.pos+=4}writeSFixed32(t){this.realloc(4),this.dataView.setInt32(this.pos,t,!0),this.pos+=4}writeFixed64(t){this.realloc(8),this.dataView.setInt32(this.pos,-1&t,!0),this.dataView.setInt32(this.pos+4,Math.floor(t*Cd),!0),this.pos+=8}writeSFixed64(t){this.realloc(8),this.dataView.setInt32(this.pos,-1&t,!0),this.dataView.setInt32(this.pos+4,Math.floor(t*Cd),!0),this.pos+=8}writeVarint(t){(t=+t||0)>268435455||t<0?(function(r,o){let h,g;if(r>=0?(h=r%4294967296|0,g=r/4294967296|0):(h=~(-r%4294967296),g=~(-r/4294967296),4294967295^h?h=h+1|0:(h=0,g=g+1|0)),r>=18446744073709552e3||r<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");o.realloc(10),(function(_,x,b){b.buf[b.pos++]=127&_|128,_>>>=7,b.buf[b.pos++]=127&_|128,_>>>=7,b.buf[b.pos++]=127&_|128,_>>>=7,b.buf[b.pos++]=127&_|128,b.buf[b.pos]=127&(_>>>=7)})(h,0,o),(function(_,x){const b=(7&_)<<4;x.buf[x.pos++]|=b|((_>>>=3)?128:0),_&&(x.buf[x.pos++]=127&_|((_>>>=7)?128:0),_&&(x.buf[x.pos++]=127&_|((_>>>=7)?128:0),_&&(x.buf[x.pos++]=127&_|((_>>>=7)?128:0),_&&(x.buf[x.pos++]=127&_|((_>>>=7)?128:0),_&&(x.buf[x.pos++]=127&_)))))})(g,o)})(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))}writeSVarint(t){this.writeVarint(t<0?2*-t-1:2*t)}writeBoolean(t){this.writeVarint(+t)}writeString(t){t=String(t),this.realloc(4*t.length),this.pos++;const r=this.pos;this.pos=(function(h,g,_){for(let x,b,T=0;T<g.length;T++){if(x=g.charCodeAt(T),x>55295&&x<57344){if(!b){x>56319||T+1===g.length?(h[_++]=239,h[_++]=191,h[_++]=189):b=x;continue}if(x<56320){h[_++]=239,h[_++]=191,h[_++]=189,b=x;continue}x=b-55296<<10|x-56320|65536,b=null}else b&&(h[_++]=239,h[_++]=191,h[_++]=189,b=null);x<128?h[_++]=x:(x<2048?h[_++]=x>>6|192:(x<65536?h[_++]=x>>12|224:(h[_++]=x>>18|240,h[_++]=x>>12&63|128),h[_++]=x>>6&63|128),h[_++]=63&x|128)}return _})(this.buf,t,this.pos);const o=this.pos-r;o>=128&&Ea(r,o,this),this.pos=r-1,this.writeVarint(o),this.pos+=o}writeFloat(t){this.realloc(4),this.dataView.setFloat32(this.pos,t,!0),this.pos+=4}writeDouble(t){this.realloc(8),this.dataView.setFloat64(this.pos,t,!0),this.pos+=8}writeBytes(t){const r=t.length;this.writeVarint(r),this.realloc(r);for(let o=0;o<r;o++)this.buf[this.pos++]=t[o]}writeRawMessage(t,r){this.pos++;const o=this.pos;t(r,this);const h=this.pos-o;h>=128&&Ea(o,h,this),this.pos=o-1,this.writeVarint(h),this.pos+=h}writeMessage(t,r,o){this.writeTag(t,2),this.writeRawMessage(r,o)}writePackedVarint(t,r){r.length&&this.writeMessage(t,gp,r)}writePackedSVarint(t,r){r.length&&this.writeMessage(t,Xa,r)}writePackedBoolean(t,r){r.length&&this.writeMessage(t,im,r)}writePackedFloat(t,r){r.length&&this.writeMessage(t,_p,r)}writePackedDouble(t,r){r.length&&this.writeMessage(t,yp,r)}writePackedFixed32(t,r){r.length&&this.writeMessage(t,ql,r)}writePackedSFixed32(t,r){r.length&&this.writeMessage(t,Ed,r)}writePackedFixed64(t,r){r.length&&this.writeMessage(t,bf,r)}writePackedSFixed64(t,r){r.length&&this.writeMessage(t,Iu,r)}writeBytesField(t,r){this.writeTag(t,2),this.writeBytes(r)}writeFixed32Field(t,r){this.writeTag(t,5),this.writeFixed32(r)}writeSFixed32Field(t,r){this.writeTag(t,5),this.writeSFixed32(r)}writeFixed64Field(t,r){this.writeTag(t,1),this.writeFixed64(r)}writeSFixed64Field(t,r){this.writeTag(t,1),this.writeSFixed64(r)}writeVarintField(t,r){this.writeTag(t,0),this.writeVarint(r)}writeSVarintField(t,r){this.writeTag(t,0),this.writeSVarint(r)}writeStringField(t,r){this.writeTag(t,2),this.writeString(r)}writeFloatField(t,r){this.writeTag(t,5),this.writeFloat(r)}writeDoubleField(t,r){this.writeTag(t,1),this.writeDouble(r)}writeBooleanField(t,r){this.writeVarintField(t,+r)}}function Zl(n,t,r){return r?4294967296*t+(n>>>0):4294967296*(t>>>0)+(n>>>0)}function Ea(n,t,r){const o=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));r.realloc(o);for(let h=r.pos-1;h>=n;h--)r.buf[h+o]=r.buf[h]}function gp(n,t){for(let r=0;r<n.length;r++)t.writeVarint(n[r])}function Xa(n,t){for(let r=0;r<n.length;r++)t.writeSVarint(n[r])}function _p(n,t){for(let r=0;r<n.length;r++)t.writeFloat(n[r])}function yp(n,t){for(let r=0;r<n.length;r++)t.writeDouble(n[r])}function im(n,t){for(let r=0;r<n.length;r++)t.writeBoolean(n[r])}function ql(n,t){for(let r=0;r<n.length;r++)t.writeFixed32(n[r])}function Ed(n,t){for(let r=0;r<n.length;r++)t.writeSFixed32(n[r])}function bf(n,t){for(let r=0;r<n.length;r++)t.writeFixed64(n[r])}function Iu(n,t){for(let r=0;r<n.length;r++)t.writeSFixed64(n[r])}function xp(n,t,r){n===1&&r.readMessage(vp,t)}function vp(n,t,r){if(n===3){const{id:o,bitmap:h,width:g,height:_,left:x,top:b,advance:T}=r.readMessage(bp,{});t.push({id:o,bitmap:new Ic({width:g+6,height:_+6},h),metrics:{width:g,height:_,left:x,top:b,advance:T}})}}function bp(n,t,r){n===1?t.id=r.readVarint():n===2?t.bitmap=r.readBytes():n===3?t.width=r.readVarint():n===4?t.height=r.readVarint():n===5?t.left=r.readSVarint():n===6?t.top=r.readSVarint():n===7&&(t.advance=r.readVarint())}function Ad(n){let t=0,r=0;for(const _ of n)t+=_.w*_.h,r=Math.max(r,_.w);n.sort(((_,x)=>x.h-_.h));const o=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),r),h:1/0}];let h=0,g=0;for(const _ of n)for(let x=o.length-1;x>=0;x--){const b=o[x];if(!(_.w>b.w||_.h>b.h)){if(_.x=b.x,_.y=b.y,g=Math.max(g,_.y+_.h),h=Math.max(h,_.x+_.w),_.w===b.w&&_.h===b.h){const T=o.pop();T&&x<o.length&&(o[x]=T)}else _.h===b.h?(b.x+=_.w,b.w-=_.w):_.w===b.w?(b.y+=_.h,b.h-=_.h):(o.push({x:b.x+_.w,y:b.y,w:b.w-_.w,h:_.h}),b.y+=_.h,b.h-=_.h);break}}return{w:h,h:g,fill:t/(h*g)||0}}class Ch{constructor(t,{pixelRatio:r,version:o,stretchX:h,stretchY:g,content:_,textFitWidth:x,textFitHeight:b}){this.paddedRect=t,this.pixelRatio=r,this.stretchX=h,this.stretchY=g,this.content=_,this.version=o,this.textFitWidth=x,this.textFitHeight=b}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 wp{constructor(t,r){const o={},h={};this.haveRenderCallbacks=[];const g=[];this.addImages(t,o,g),this.addImages(r,h,g);const{w:_,h:x}=Ad(g),b=new Fn({width:_||1,height:x||1});for(const T in t){const C=t[T],D=o[T].paddedRect;Fn.copy(C.data,b,{x:0,y:0},{x:D.x+1,y:D.y+1},C.data)}for(const T in r){const C=r[T],D=h[T].paddedRect,O=D.x+1,F=D.y+1,U=C.data.width,$=C.data.height;Fn.copy(C.data,b,{x:0,y:0},{x:O,y:F},C.data),Fn.copy(C.data,b,{x:0,y:$-1},{x:O,y:F-1},{width:U,height:1}),Fn.copy(C.data,b,{x:0,y:0},{x:O,y:F+$},{width:U,height:1}),Fn.copy(C.data,b,{x:U-1,y:0},{x:O-1,y:F},{width:1,height:$}),Fn.copy(C.data,b,{x:0,y:0},{x:O+U,y:F},{width:1,height:$})}this.image=b,this.iconPositions=o,this.patternPositions=h}addImages(t,r,o){for(const h in t){const g=t[h],_={x:0,y:0,w:g.data.width+2,h:g.data.height+2};o.push(_),r[h]=new Ch(_,g),g.hasRenderCallback&&this.haveRenderCallbacks.push(h)}}patchUpdatedImages(t,r){t.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const o in t.updatedImages)this.patchUpdatedImage(this.iconPositions[o],t.getImage(o),r),this.patchUpdatedImage(this.patternPositions[o],t.getImage(o),r)}patchUpdatedImage(t,r,o){if(!t||!r||t.version===r.version)return;t.version=r.version;const[h,g]=t.tl;o.update(r.data,void 0,{x:h,y:g})}}var $l;yt("ImagePosition",Ch),yt("ImageAtlas",wp),A.ao=void 0,($l=A.ao||(A.ao={}))[$l.none=0]="none",$l[$l.horizontal=1]="horizontal",$l[$l.vertical=2]="vertical",$l[$l.horizontalOnly=3]="horizontalOnly";class Eh{constructor(){this.scale=1,this.fontStack="",this.imageName=null,this.verticalAlign="bottom"}static forText(t,r,o){const h=new Eh;return h.scale=t||1,h.fontStack=r,h.verticalAlign=o||"bottom",h}static forImage(t,r){const o=new Eh;return o.imageName=t,o.verticalAlign=r||"bottom",o}}class Uc{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(t,r){const o=new Uc;for(let h=0;h<t.sections.length;h++){const g=t.sections[h];g.image?o.addImageSection(g):o.addTextSection(g,r)}return o}length(){return this.text.length}getSection(t){return this.sections[this.sectionIndex[t]]}getSectionIndex(t){return this.sectionIndex[t]}getCharCode(t){return this.text.charCodeAt(t)}verticalizePunctuation(){this.text=(function(t){let r="";for(let o=0;o<t.length;o++){const h=t.charCodeAt(o+1)||null,g=t.charCodeAt(o-1)||null;r+=h&&mu(h)&&!go[t[o+1]]||g&&mu(g)&&!go[t[o-1]]||!go[t[o]]?t[o]:go[t[o]]}return r})(this.text)}trim(){let t=0;for(let o=0;o<this.text.length&&rl[this.text.charCodeAt(o)];o++)t++;let r=this.text.length;for(let o=this.text.length-1;o>=0&&o>=t&&rl[this.text.charCodeAt(o)];o--)r--;this.text=this.text.substring(t,r),this.sectionIndex=this.sectionIndex.slice(t,r)}substring(t,r){const o=new Uc;return o.text=this.text.substring(t,r),o.sectionIndex=this.sectionIndex.slice(t,r),o.sections=this.sections,o}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((t,r)=>Math.max(t,this.sections[r].scale)),0)}getMaxImageSize(t){let r=0,o=0;for(let h=0;h<this.length();h++){const g=this.getSection(h);if(g.imageName){const _=t[g.imageName];if(!_)continue;const x=_.displaySize;r=Math.max(r,x[0]),o=Math.max(o,x[1])}}return{maxImageWidth:r,maxImageHeight:o}}addTextSection(t,r){this.text+=t.text,this.sections.push(Eh.forText(t.scale,t.fontStack||r,t.verticalAlign));const o=this.sections.length-1;for(let h=0;h<t.text.length;++h)this.sectionIndex.push(o)}addImageSection(t){const r=t.image?t.image.name:"";if(r.length===0)return void $i("Can't add FormattedSection with an empty image.");const o=this.getNextImageSectionCharCode();o?(this.text+=String.fromCharCode(o),this.sections.push(Eh.forImage(r,t.verticalAlign)),this.sectionIndex.push(this.sections.length-1)):$i("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Ah(n,t,r,o,h,g,_,x,b,T,C,D,O,F,U){const $=Uc.fromFeature(n,h);let Q;D===A.ao.vertical&&$.verticalizePunctuation();const{processBidirectionalText:re,processStyledBidirectionalText:be}=Sn;if(re&&$.sections.length===1){Q=[];const Ie=re($.toString(),Ru($,T,g,t,o,F));for(const Ne of Ie){const Qe=new Uc;Qe.text=Ne,Qe.sections=$.sections;for(let pt=0;pt<Ne.length;pt++)Qe.sectionIndex.push(0);Q.push(Qe)}}else if(be){Q=[];const Ie=be($.text,$.sectionIndex,Ru($,T,g,t,o,F));for(const Ne of Ie){const Qe=new Uc;Qe.text=Ne[0],Qe.sectionIndex=Ne[1],Qe.sections=$.sections,Q.push(Qe)}}else Q=(function(Ie,Ne){const Qe=[],pt=Ie.text;let lt=0;for(const dt of Ne)Qe.push(Ie.substring(lt,dt)),lt=dt;return lt<pt.length&&Qe.push(Ie.substring(lt,pt.length)),Qe})($,Ru($,T,g,t,o,F));const he=[],pe={positionedLines:he,text:$.toString(),top:C[1],bottom:C[1],left:C[0],right:C[0],writingMode:D,iconsInText:!1,verticalizable:!1};return(function(Ie,Ne,Qe,pt,lt,dt,At,mt,ft,$e,Ot,Ut){let Rt=0,Mt=0,ri=0,Di=0;const Wi=mt==="right"?1:mt==="left"?0:.5,Vr=yr/Ut;let Gn=0;for(const ar of lt){ar.trim();const Er=ar.getMaxScale(),dn={positionedGlyphs:[],lineOffset:0};Ie.positionedLines[Gn]=dn;const Jr=dn.positionedGlyphs;let fn=0;if(!ar.length()){Mt+=dt,++Gn;continue}const Pa=Mp(pt,ar,Vr);for(let An=0;An<ar.length();An++){const Ar=ar.getSection(An),Yr=ar.getSectionIndex(An),Pr=ar.getCharCode(An),zr=Cf(ft,Ot,Pr);let Ni;if(Ar.imageName){if(Ie.iconsInText=!0,Ar.scale=Ar.scale*Vr,Ni=Cp(Ar,zr,Er,Pa,pt),!Ni)continue;fn=Math.max(fn,Ni.imageOffset)}else if(Ni=rm(Ar,Pr,zr,Pa,Ne,Qe),!Ni)continue;const{rect:ps,metrics:Nu,baselineOffset:za}=Ni;Jr.push({glyph:Pr,imageName:Ar.imageName,x:Rt,y:Mt+za+-17,vertical:zr,scale:Ar.scale,fontStack:Ar.fontStack,sectionIndex:Yr,metrics:Nu,rect:ps}),zr?(Ie.verticalizable=!0,Rt+=(Ar.imageName?Nu.advance:yr)*Ar.scale+$e):Rt+=Nu.advance*Ar.scale+$e}Jr.length!==0&&(ri=Math.max(Rt-$e,ri),nm(Jr,0,Jr.length-1,Wi)),Rt=0,dn.lineOffset=Math.max(fn,(Er-1)*yr);const en=dt*Er+fn;Mt+=en,Di=Math.max(en,Di),++Gn}const{horizontalAlign:Gr,verticalAlign:hn}=zd(At);(function(ar,Er,dn,Jr,fn,Pa,en,An,Ar){const Yr=(Er-dn)*fn;let Pr=0;Pr=Pa!==en?-An*Jr- -17:-Jr*Ar*en+.5*en;for(const zr of ar)for(const Ni of zr.positionedGlyphs)Ni.x+=Yr,Ni.y+=Pr})(Ie.positionedLines,Wi,Gr,hn,ri,Di,dt,Mt,lt.length),Ie.top+=-hn*Mt,Ie.bottom=Ie.top+Mt,Ie.left+=-Gr*ri,Ie.right=Ie.left+ri})(pe,t,r,o,Q,_,x,b,D,T,O,U),!(function(Ie){for(const Ne of Ie)if(Ne.positionedGlyphs.length!==0)return!1;return!0})(he)&&pe}const rl={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Pd={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},Sp={40:!0};function wf(n,t,r,o,h,g){if(t.imageName){const _=o[t.imageName];return _?_.displaySize[0]*t.scale*yr/g+h:0}{const _=r[t.fontStack],x=_&&_[n];return x?x.metrics.advance*t.scale+h:0}}function Sf(n,t,r,o){const h=Math.pow(n-t,2);return o?n<t?h/2:2*h:h+Math.abs(r)*r}function Tp(n,t,r){let o=0;return n===10&&(o-=1e4),r&&(o+=150),n!==40&&n!==65288||(o+=50),t!==41&&t!==65289||(o+=50),o}function Tf(n,t,r,o,h,g){let _=null,x=Sf(t,r,h,g);for(const b of o){const T=Sf(t-b.x,r,h,g)+b.badness;T<=x&&(_=b,x=T)}return{index:n,x:t,priorBreak:_,badness:x}}function Mf(n){return n?Mf(n.priorBreak).concat(n.index):[]}function Ru(n,t,r,o,h,g){if(!n)return[];const _=[],x=(function(D,O,F,U,$,Q){let re=0;for(let be=0;be<D.length();be++){const he=D.getSection(be);re+=wf(D.getCharCode(be),he,U,$,O,Q)}return re/Math.max(1,Math.ceil(re/F))})(n,t,r,o,h,g),b=n.text.indexOf("​")>=0;let T=0;for(let D=0;D<n.length();D++){const O=n.getSection(D),F=n.getCharCode(D);if(rl[F]||(T+=wf(F,O,o,h,t,g)),D<n.length()-1){const U=!((C=F)<11904)&&(!!ui["CJK Compatibility Forms"](C)||!!ui["CJK Compatibility"](C)||!!ui["CJK Strokes"](C)||!!ui["CJK Symbols and Punctuation"](C)||!!ui["Enclosed CJK Letters and Months"](C)||!!ui["Halfwidth and Fullwidth Forms"](C)||!!ui["Ideographic Description Characters"](C)||!!ui["Vertical Forms"](C)||qo.test(String.fromCodePoint(C)));(Pd[F]||U||O.imageName||D!==n.length()-2&&Sp[n.getCharCode(D+1)])&&_.push(Tf(D+1,T,x,_,Tp(F,n.getCharCode(D+1),U&&b),!1))}}var C;return Mf(Tf(n.length(),T,x,_,0,!0))}function zd(n){let t=.5,r=.5;switch(n){case"right":case"top-right":case"bottom-right":t=1;break;case"left":case"top-left":case"bottom-left":t=0}switch(n){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:t,verticalAlign:r}}function Mp(n,t,r){const o=t.getMaxScale()*yr,{maxImageWidth:h,maxImageHeight:g}=t.getMaxImageSize(n),_=Math.max(o,g*r);return{verticalLineContentWidth:Math.max(o,h*r),horizontalLineContentHeight:_}}function Ki(n){switch(n){case"top":return 0;case"center":return .5;default:return 1}}function Cf(n,t,r){return!(n===A.ao.horizontal||!t&&!Ec(r)||t&&(rl[r]||(o=r,new RegExp("\\p{sc=Arab}","u").test(String.fromCodePoint(o)))));var o}function rm(n,t,r,o,h,g){const _=g[n.fontStack],x=(function(T,C,D,O){if(T&&T.rect)return T;const F=C[D.fontStack],U=F&&F[O];return U?{rect:null,metrics:U.metrics}:null})(_&&_[t],h,n,t);if(x===null)return null;let b;if(r)b=o.verticalLineContentWidth-n.scale*yr;else{const T=Ki(n.verticalAlign);b=(o.horizontalLineContentHeight-n.scale*yr)*T}return{rect:x.rect,metrics:x.metrics,baselineOffset:b}}function Cp(n,t,r,o,h){const g=h[n.imageName];if(!g)return null;const _=g.paddedRect,x=g.displaySize,b={width:x[0],height:x[1],left:1,top:-3,advance:t?x[1]:x[0]};let T;if(t)T=o.verticalLineContentWidth-x[1]*n.scale;else{const C=Ki(n.verticalAlign);T=(o.horizontalLineContentHeight-x[1]*n.scale)*C}return{rect:_,metrics:b,baselineOffset:T,imageOffset:(t?x[0]:x[1])*n.scale-yr*r}}function nm(n,t,r,o){if(o===0)return;const h=n[r],g=(n[r].x+h.metrics.advance*h.scale)*o;for(let _=t;_<=r;_++)n[_].x-=g}function am(n,t,r){const{horizontalAlign:o,verticalAlign:h}=zd(r),g=t[0]-n.displaySize[0]*o,_=t[1]-n.displaySize[1]*h;return{image:n,top:_,bottom:_+n.displaySize[1],left:g,right:g+n.displaySize[0]}}function Ep(n){var t,r;let o=n.left,h=n.top,g=n.right-o,_=n.bottom-h;const x=(t=n.image.textFitWidth)!==null&&t!==void 0?t:"stretchOrShrink",b=(r=n.image.textFitHeight)!==null&&r!==void 0?r:"stretchOrShrink",T=(n.image.content[2]-n.image.content[0])/(n.image.content[3]-n.image.content[1]);if(b==="proportional"){if(x==="stretchOnly"&&g/_<T||x==="proportional"){const C=Math.ceil(_*T);o*=C/g,g=C}}else if(x==="proportional"&&b==="stretchOnly"&&T!==0&&g/_>T){const C=Math.ceil(g/T);h*=C/_,_=C}return{x1:o,y1:h,x2:o+g,y2:h+_}}function Ph(n,t,r,o,h,g){const _=n.image;let x;if(_.content){const Q=_.content,re=_.pixelRatio||1;x=[Q[0]/re,Q[1]/re,_.displaySize[0]-Q[2]/re,_.displaySize[1]-Q[3]/re]}const b=t.left*g,T=t.right*g;let C,D,O,F;r==="width"||r==="both"?(F=h[0]+b-o[3],D=h[0]+T+o[1]):(F=h[0]+(b+T-_.displaySize[0])/2,D=F+_.displaySize[0]);const U=t.top*g,$=t.bottom*g;return r==="height"||r==="both"?(C=h[1]+U-o[0],O=h[1]+$+o[2]):(C=h[1]+(U+$-_.displaySize[1])/2,O=C+_.displaySize[1]),{image:_,top:C,right:D,bottom:O,left:F,collisionPadding:x}}const Aa=128,_o=32640;function zh(n,t){const{expression:r}=t;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new Ai(n+1))};if(r.kind==="source")return{kind:"source"};{const{zoomStops:o,interpolationType:h}=r;let g=0;for(;g<o.length&&o[g]<=n;)g++;g=Math.max(0,g-1);let _=g;for(;_<o.length&&o[_]<n+1;)_++;_=Math.min(o.length-1,_);const x=o[g],b=o[_];return r.kind==="composite"?{kind:"composite",minZoom:x,maxZoom:b,interpolationType:h}:{kind:"camera",minZoom:x,maxZoom:b,minSize:r.evaluate(new Ai(x)),maxSize:r.evaluate(new Ai(b)),interpolationType:h}}}function kh(n,t,r){let o="never";const h=n.get(t);return h?o=h:n.get(r)&&(o="always"),o}const Vc=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Ya(n,t,r,o,h,g,_,x,b,T,C,D,O){const F=x?Math.min(_o,Math.round(x[0])):0,U=x?Math.min(_o,Math.round(x[1])):0;n.emplaceBack(t,r,Math.round(32*o),Math.round(32*h),g,_,(F<<1)+(b?1:0),U,16*T,16*C,256*D,256*O)}function Gc(n,t,r){n.emplaceBack(t.x,t.y,r),n.emplaceBack(t.x,t.y,r),n.emplaceBack(t.x,t.y,r),n.emplaceBack(t.x,t.y,r)}function sm(n){for(const t of n.sections)if(ph(t.text))return!0;return!1}class kd{constructor(t){this.layoutVertexArray=new ct,this.indexArray=new Ii,this.programConfigurations=t,this.segments=new Wt,this.dynamicLayoutVertexArray=new We,this.opacityVertexArray=new Et,this.hasVisibleVertices=!1,this.placedSymbolArray=new G}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(t,r,o,h){this.isEmpty()||(o&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,xf.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,Td.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,Vc,!0),this.opacityVertexBuffer.itemSize=1),(o||h)&&this.programConfigurations.upload(t))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}yt("SymbolBuffers",kd);class Id{constructor(t,r,o){this.layoutVertexArray=new t,this.layoutAttributes=r,this.indexArray=new o,this.segments=new Wt,this.collisionVertexArray=new vi}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,Md.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}yt("CollisionBuffers",Id);class Zc{constructor(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.globalState=t.globalState,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((_=>_.id)),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=zh(this.zoom,r["text-size"]),this.iconSizeData=zh(this.zoom,r["icon-size"]);const o=this.layers[0].layout,h=o.get("symbol-sort-key"),g=o.get("symbol-z-order");this.canOverlap=kh(o,"text-overlap","text-allow-overlap")!=="never"||kh(o,"icon-overlap","icon-allow-overlap")!=="never"||o.get("text-ignore-placement")||o.get("icon-ignore-placement"),this.sortFeaturesByKey=g!=="viewport-y"&&!h.isConstant(),this.sortFeaturesByY=(g==="viewport-y"||g==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,o.get("symbol-placement")==="point"&&(this.writingModes=o.get("text-writing-mode").map((_=>A.ao[_]))),this.stateDependentLayerIds=this.layers.filter((_=>_.isStateDependent())).map((_=>_.id)),this.sourceID=t.sourceID}createArrays(){this.text=new kd(new Tr(this.layers,this.zoom,(t=>/^text/.test(t)))),this.icon=new kd(new Tr(this.layers,this.zoom,(t=>/^icon/.test(t)))),this.glyphOffsetArray=new te,this.lineVertexArray=new ae,this.symbolInstances=new J,this.textAnchorOffsets=new oe}calculateGlyphDependencies(t,r,o,h,g){for(let _=0;_<t.length;_++)if(r[t.charCodeAt(_)]=!0,(o||h)&&g){const x=go[t.charAt(_)];x&&(r[x.charCodeAt(0)]=!0)}}populate(t,r,o){const h=this.layers[0],g=h.layout,_=g.get("text-font"),x=g.get("text-field"),b=g.get("icon-image"),T=(x.value.kind!=="constant"||x.value.value instanceof Nr&&!x.value.value.isEmpty()||x.value.value.toString().length>0)&&(_.value.kind!=="constant"||_.value.value.length>0),C=b.value.kind!=="constant"||!!b.value.value||Object.keys(b.parameters).length>0,D=g.get("symbol-sort-key");if(this.features=[],!T&&!C)return;const O=r.iconDependencies,F=r.glyphDependencies,U=r.availableImages,$=new Ai(this.zoom,{globalState:this.globalState});for(const{feature:Q,id:re,index:be,sourceLayerIndex:he}of t){const pe=h._featureFilter.needGeometry,Ie=Ta(Q,pe);if(!h._featureFilter.filter($,Ie,o))continue;let Ne,Qe;if(pe||(Ie.geometry=Yi(Q)),T){const lt=h.getValueAndResolveTokens("text-field",Ie,o,U),dt=Nr.factory(lt),At=this.hasRTLText=this.hasRTLText||sm(dt);(!At||Sn.getRTLTextPluginStatus()==="unavailable"||At&&Sn.isParsed())&&(Ne=Gl(dt,h,Ie))}if(C){const lt=h.getValueAndResolveTokens("icon-image",Ie,o,U);Qe=lt instanceof sn?lt:sn.fromString(lt)}if(!Ne&&!Qe)continue;const pt=this.sortFeaturesByKey?D.evaluate(Ie,{},o):void 0;if(this.features.push({id:re,text:Ne,icon:Qe,index:be,sourceLayerIndex:he,geometry:Ie.geometry,properties:Q.properties,type:jc.types[Q.type],sortKey:pt}),Qe&&(O[Qe.name]=!0),Ne){const lt=_.evaluate(Ie,{},o).join(","),dt=g.get("text-rotation-alignment")!=="viewport"&&g.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(A.ao.vertical)>=0;for(const At of Ne.sections)if(At.image)O[At.image.name]=!0;else{const mt=Ua(Ne.toString()),ft=At.fontStack||lt,$e=F[ft]=F[ft]||{};this.calculateGlyphDependencies(At.text,$e,dt,this.allowVerticalPlacement,mt)}}}g.get("symbol-placement")==="line"&&(this.features=(function(Q){const re={},be={},he=[];let pe=0;function Ie(lt){he.push(Q[lt]),pe++}function Ne(lt,dt,At){const mt=be[lt];return delete be[lt],be[dt]=mt,he[mt].geometry[0].pop(),he[mt].geometry[0]=he[mt].geometry[0].concat(At[0]),mt}function Qe(lt,dt,At){const mt=re[dt];return delete re[dt],re[lt]=mt,he[mt].geometry[0].shift(),he[mt].geometry[0]=At[0].concat(he[mt].geometry[0]),mt}function pt(lt,dt,At){const mt=At?dt[0][dt[0].length-1]:dt[0][0];return`${lt}:${mt.x}:${mt.y}`}for(let lt=0;lt<Q.length;lt++){const dt=Q[lt],At=dt.geometry,mt=dt.text?dt.text.toString():null;if(!mt){Ie(lt);continue}const ft=pt(mt,At),$e=pt(mt,At,!0);if(ft in be&&$e in re&&be[ft]!==re[$e]){const Ot=Qe(ft,$e,At),Ut=Ne(ft,$e,he[Ot].geometry);delete re[ft],delete be[$e],be[pt(mt,he[Ut].geometry,!0)]=Ut,he[Ot].geometry=null}else ft in be?Ne(ft,$e,At):$e in re?Qe(ft,$e,At):(Ie(lt),re[ft]=pe-1,be[$e]=pe-1)}return he.filter((lt=>lt.geometry))})(this.features)),this.sortFeaturesByKey&&this.features.sort(((Q,re)=>Q.sortKey-re.sortKey))}update(t,r,o){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,r,this.layers,{imagePositions:o,globalState:this.globalState}),this.icon.programConfigurations.updatePaintArrays(t,r,this.layers,{imagePositions:o,globalState:this.globalState}))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,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(t,r){const o=this.lineVertexArray.length;if(t.segment!==void 0){let h=t.dist(r[t.segment+1]),g=t.dist(r[t.segment]);const _={};for(let x=t.segment+1;x<r.length;x++)_[x]={x:r[x].x,y:r[x].y,tileUnitDistanceFromAnchor:h},x<r.length-1&&(h+=r[x+1].dist(r[x]));for(let x=t.segment||0;x>=0;x--)_[x]={x:r[x].x,y:r[x].y,tileUnitDistanceFromAnchor:g},x>0&&(g+=r[x-1].dist(r[x]));for(let x=0;x<r.length;x++){const b=_[x];this.lineVertexArray.emplaceBack(b.x,b.y,b.tileUnitDistanceFromAnchor)}}return{lineStartIndex:o,lineLength:this.lineVertexArray.length-o}}addSymbols(t,r,o,h,g,_,x,b,T,C,D,O){const F=t.indexArray,U=t.layoutVertexArray,$=t.segments.prepareSegment(4*r.length,U,F,this.canOverlap?_.sortKey:void 0),Q=this.glyphOffsetArray.length,re=$.vertexLength,be=this.allowVerticalPlacement&&x===A.ao.vertical?Math.PI/2:0,he=_.text&&_.text.sections;for(let pe=0;pe<r.length;pe++){const{tl:Ie,tr:Ne,bl:Qe,br:pt,tex:lt,pixelOffsetTL:dt,pixelOffsetBR:At,minFontScaleX:mt,minFontScaleY:ft,glyphOffset:$e,isSDF:Ot,sectionIndex:Ut}=r[pe],Rt=$.vertexLength,Mt=$e[1];Ya(U,b.x,b.y,Ie.x,Mt+Ie.y,lt.x,lt.y,o,Ot,dt.x,dt.y,mt,ft),Ya(U,b.x,b.y,Ne.x,Mt+Ne.y,lt.x+lt.w,lt.y,o,Ot,At.x,dt.y,mt,ft),Ya(U,b.x,b.y,Qe.x,Mt+Qe.y,lt.x,lt.y+lt.h,o,Ot,dt.x,At.y,mt,ft),Ya(U,b.x,b.y,pt.x,Mt+pt.y,lt.x+lt.w,lt.y+lt.h,o,Ot,At.x,At.y,mt,ft),Gc(t.dynamicLayoutVertexArray,b,be),F.emplaceBack(Rt,Rt+2,Rt+1),F.emplaceBack(Rt+1,Rt+2,Rt+3),$.vertexLength+=4,$.primitiveLength+=2,this.glyphOffsetArray.emplaceBack($e[0]),pe!==r.length-1&&Ut===r[pe+1].sectionIndex||t.programConfigurations.populatePaintArrays(U.length,_,_.index,{imagePositions:{},canonical:O,formattedSection:he&&he[Ut],globalState:this.globalState})}t.placedSymbolArray.emplaceBack(b.x,b.y,Q,this.glyphOffsetArray.length-Q,re,T,C,b.segment,o?o[0]:0,o?o[1]:0,h[0],h[1],x,0,!1,0,D)}_addCollisionDebugVertex(t,r,o,h,g,_){return r.emplaceBack(0,0),t.emplaceBack(o.x,o.y,h,g,Math.round(_.x),Math.round(_.y))}addCollisionDebugVertices(t,r,o,h,g,_,x){const b=g.segments.prepareSegment(4,g.layoutVertexArray,g.indexArray),T=b.vertexLength,C=g.layoutVertexArray,D=g.collisionVertexArray,O=x.anchorX,F=x.anchorY;this._addCollisionDebugVertex(C,D,_,O,F,new H(t,r)),this._addCollisionDebugVertex(C,D,_,O,F,new H(o,r)),this._addCollisionDebugVertex(C,D,_,O,F,new H(o,h)),this._addCollisionDebugVertex(C,D,_,O,F,new H(t,h)),b.vertexLength+=4;const U=g.indexArray;U.emplaceBack(T,T+1),U.emplaceBack(T+1,T+2),U.emplaceBack(T+2,T+3),U.emplaceBack(T+3,T),b.primitiveLength+=4}addDebugCollisionBoxes(t,r,o,h){for(let g=t;g<r;g++){const _=this.collisionBoxArray.get(g);this.addCollisionDebugVertices(_.x1,_.y1,_.x2,_.y2,h?this.textCollisionBox:this.iconCollisionBox,_.anchorPoint,o)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Id(ii,il.members,Pi),this.iconCollisionBox=new Id(ii,il.members,Pi);for(let t=0;t<this.symbolInstances.length;t++){const r=this.symbolInstances.get(t);this.addDebugCollisionBoxes(r.textBoxStartIndex,r.textBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.iconBoxStartIndex,r.iconBoxEndIndex,r,!1),this.addDebugCollisionBoxes(r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex,r,!1)}}_deserializeCollisionBoxesForSymbol(t,r,o,h,g,_,x,b,T){const C={};for(let D=r;D<o;D++){const O=t.get(D);C.textBox={x1:O.x1,y1:O.y1,x2:O.x2,y2:O.y2,anchorPointX:O.anchorPointX,anchorPointY:O.anchorPointY},C.textFeatureIndex=O.featureIndex;break}for(let D=h;D<g;D++){const O=t.get(D);C.verticalTextBox={x1:O.x1,y1:O.y1,x2:O.x2,y2:O.y2,anchorPointX:O.anchorPointX,anchorPointY:O.anchorPointY},C.verticalTextFeatureIndex=O.featureIndex;break}for(let D=_;D<x;D++){const O=t.get(D);C.iconBox={x1:O.x1,y1:O.y1,x2:O.x2,y2:O.y2,anchorPointX:O.anchorPointX,anchorPointY:O.anchorPointY},C.iconFeatureIndex=O.featureIndex;break}for(let D=b;D<T;D++){const O=t.get(D);C.verticalIconBox={x1:O.x1,y1:O.y1,x2:O.x2,y2:O.y2,anchorPointX:O.anchorPointX,anchorPointY:O.anchorPointY},C.verticalIconFeatureIndex=O.featureIndex;break}return C}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let r=0;r<this.symbolInstances.length;r++){const o=this.symbolInstances.get(r);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,o.textBoxStartIndex,o.textBoxEndIndex,o.verticalTextBoxStartIndex,o.verticalTextBoxEndIndex,o.iconBoxStartIndex,o.iconBoxEndIndex,o.verticalIconBoxStartIndex,o.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(t,r){const o=t.placedSymbolArray.get(r),h=o.vertexStartIndex+4*o.numGlyphs;for(let g=o.vertexStartIndex;g<h;g+=4)t.indexArray.emplaceBack(g,g+2,g+1),t.indexArray.emplaceBack(g+1,g+2,g+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const r=Math.sin(t),o=Math.cos(t),h=[],g=[],_=[];for(let x=0;x<this.symbolInstances.length;++x){_.push(x);const b=this.symbolInstances.get(x);h.push(0|Math.round(r*b.anchorX+o*b.anchorY)),g.push(b.featureIndex)}return _.sort(((x,b)=>h[x]-h[b]||g[b]-g[x])),_}addToSortKeyRanges(t,r){const o=this.sortKeyRanges[this.sortKeyRanges.length-1];o&&o.sortKey===r?o.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:r,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const r of this.symbolInstanceIndexes){const o=this.symbolInstances.get(r);this.featureSortOrder.push(o.featureIndex),[o.rightJustifiedTextSymbolIndex,o.centerJustifiedTextSymbolIndex,o.leftJustifiedTextSymbolIndex].forEach(((h,g,_)=>{h>=0&&_.indexOf(h)===g&&this.addIndicesForPlacedSymbol(this.text,h)})),o.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,o.verticalPlacedTextSymbolIndex),o.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,o.placedIconSymbolIndex),o.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,o.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let Ef,Ap;yt("SymbolBucket",Zc,{omit:["layers","collisionBoxArray","features","compareText"]}),Zc.MAX_GLYPHS=65535,Zc.addDynamicAttributes=Gc;var Ih={get paint(){return Ap=Ap||new On({"icon-opacity":new It(Me.paint_symbol["icon-opacity"]),"icon-color":new It(Me.paint_symbol["icon-color"]),"icon-halo-color":new It(Me.paint_symbol["icon-halo-color"]),"icon-halo-width":new It(Me.paint_symbol["icon-halo-width"]),"icon-halo-blur":new It(Me.paint_symbol["icon-halo-blur"]),"icon-translate":new St(Me.paint_symbol["icon-translate"]),"icon-translate-anchor":new St(Me.paint_symbol["icon-translate-anchor"]),"text-opacity":new It(Me.paint_symbol["text-opacity"]),"text-color":new It(Me.paint_symbol["text-color"],{runtimeType:Rr,getOverride:n=>n.textColor,hasOverride:n=>!!n.textColor}),"text-halo-color":new It(Me.paint_symbol["text-halo-color"]),"text-halo-width":new It(Me.paint_symbol["text-halo-width"]),"text-halo-blur":new It(Me.paint_symbol["text-halo-blur"]),"text-translate":new St(Me.paint_symbol["text-translate"]),"text-translate-anchor":new St(Me.paint_symbol["text-translate-anchor"])})},get layout(){return Ef=Ef||new On({"symbol-placement":new St(Me.layout_symbol["symbol-placement"]),"symbol-spacing":new St(Me.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new St(Me.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new It(Me.layout_symbol["symbol-sort-key"]),"symbol-z-order":new St(Me.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new St(Me.layout_symbol["icon-allow-overlap"]),"icon-overlap":new St(Me.layout_symbol["icon-overlap"]),"icon-ignore-placement":new St(Me.layout_symbol["icon-ignore-placement"]),"icon-optional":new St(Me.layout_symbol["icon-optional"]),"icon-rotation-alignment":new St(Me.layout_symbol["icon-rotation-alignment"]),"icon-size":new It(Me.layout_symbol["icon-size"]),"icon-text-fit":new St(Me.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new St(Me.layout_symbol["icon-text-fit-padding"]),"icon-image":new It(Me.layout_symbol["icon-image"]),"icon-rotate":new It(Me.layout_symbol["icon-rotate"]),"icon-padding":new It(Me.layout_symbol["icon-padding"]),"icon-keep-upright":new St(Me.layout_symbol["icon-keep-upright"]),"icon-offset":new It(Me.layout_symbol["icon-offset"]),"icon-anchor":new It(Me.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new St(Me.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new St(Me.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new St(Me.layout_symbol["text-rotation-alignment"]),"text-field":new It(Me.layout_symbol["text-field"]),"text-font":new It(Me.layout_symbol["text-font"]),"text-size":new It(Me.layout_symbol["text-size"]),"text-max-width":new It(Me.layout_symbol["text-max-width"]),"text-line-height":new St(Me.layout_symbol["text-line-height"]),"text-letter-spacing":new It(Me.layout_symbol["text-letter-spacing"]),"text-justify":new It(Me.layout_symbol["text-justify"]),"text-radial-offset":new It(Me.layout_symbol["text-radial-offset"]),"text-variable-anchor":new St(Me.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new It(Me.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new It(Me.layout_symbol["text-anchor"]),"text-max-angle":new St(Me.layout_symbol["text-max-angle"]),"text-writing-mode":new St(Me.layout_symbol["text-writing-mode"]),"text-rotate":new It(Me.layout_symbol["text-rotate"]),"text-padding":new St(Me.layout_symbol["text-padding"]),"text-keep-upright":new St(Me.layout_symbol["text-keep-upright"]),"text-transform":new It(Me.layout_symbol["text-transform"]),"text-offset":new It(Me.layout_symbol["text-offset"]),"text-allow-overlap":new St(Me.layout_symbol["text-allow-overlap"]),"text-overlap":new St(Me.layout_symbol["text-overlap"]),"text-ignore-placement":new St(Me.layout_symbol["text-ignore-placement"]),"text-optional":new St(Me.layout_symbol["text-optional"])})}};class Af{constructor(t){if(t.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=t.property.overrides?t.property.overrides.runtimeType:Ja,this.defaultValue=t}evaluate(t){if(t.formattedSection){const r=this.defaultValue.property.overrides;if(r&&r.hasOverride(t.formattedSection))return r.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}yt("FormatSectionOverride",Af,{omit:["defaultValue"]});class Rh extends Xn{constructor(t){super(t,Ih)}recalculate(t,r){if(super.recalculate(t,r),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){const o=this.layout.get("text-writing-mode");if(o){const h=[];for(const g of o)h.indexOf(g)<0&&h.push(g);this.layout._values["text-writing-mode"]=h}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t,r,o,h){const g=this.layout.get(t).evaluate(r,{},o,h),_=this._unevaluatedLayout._values[t];return _.isDataDriven()||Ts(_.value)||!g?g:(function(x,b){return b.replace(/{([^{}]+)}/g,((T,C)=>x&&C in x?String(x[C]):""))})(r.properties,g)}createBucket(t){return new Zc(t)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const t of Ih.paint.overridableProperties){if(!Rh.hasPaintOverride(this.layout,t))continue;const r=this.paint.get(t),o=new Af(r),h=new xc(o,r.property.specification);let g=null;g=r.value.kind==="constant"||r.value.kind==="source"?new Qs("source",h):new Tl("composite",h,r.value.zoomStops),this.paint._values[t]=new ji(r.property,g,r.parameters)}}_handleOverridablePaintPropertyUpdate(t,r,o){return!(!this.layout||r.isDataDriven()||o.isDataDriven())&&Rh.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,r){const o=t.get("text-field"),h=Ih.paint.properties[r];let g=!1;const _=x=>{for(const b of x)if(h.overrides&&h.overrides.hasOverride(b))return void(g=!0)};if(o.value.kind==="constant"&&o.value.value instanceof Nr)_(o.value.value.sections);else if(o.value.kind==="source"||o.value.kind==="composite"){const x=T=>{g||(T instanceof pa&&jt(T.value)===qn?_(T.value.sections):T instanceof Ro?_(T.sections):T.eachChild(x))},b=o.value;b._styleExpression&&x(b._styleExpression.expression)}return g}}let Pp;var Pf={get paint(){return Pp=Pp||new On({"background-color":new St(Me.paint_background["background-color"]),"background-pattern":new va(Me.paint_background["background-pattern"]),"background-opacity":new St(Me.paint_background["background-opacity"])})}};class zf extends Xn{constructor(t){super(t,Pf)}}let zp;var om={get paint(){return zp=zp||new On({"raster-opacity":new St(Me.paint_raster["raster-opacity"]),"raster-hue-rotate":new St(Me.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new St(Me.paint_raster["raster-brightness-min"]),"raster-brightness-max":new St(Me.paint_raster["raster-brightness-max"]),"raster-saturation":new St(Me.paint_raster["raster-saturation"]),"raster-contrast":new St(Me.paint_raster["raster-contrast"]),"raster-resampling":new St(Me.paint_raster["raster-resampling"]),"raster-fade-duration":new St(Me.paint_raster["raster-fade-duration"])})}};class Dh extends Xn{constructor(t){super(t,om)}}class lm extends Xn{constructor(t){super(t,{}),this.onAdd=r=>{this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)},this.onRemove=r=>{this.implementation.onRemove&&this.implementation.onRemove(r,r.painter.context.gl)},this.implementation=t}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class kp{constructor(t){this._methodToThrottle=t,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout((()=>{this._triggered=!1,this._methodToThrottle()}),0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}const wi={once:!0},Lh=63710088e-1;class Ns{constructor(t,r){if(isNaN(t)||isNaN(r))throw new Error(`Invalid LngLat object: (${t}, ${r})`);if(this.lng=+t,this.lat=+r,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Ns(di(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){const r=Math.PI/180,o=this.lat*r,h=t.lat*r,g=Math.sin(o)*Math.sin(h)+Math.cos(o)*Math.cos(h)*Math.cos((t.lng-this.lng)*r);return Lh*Math.acos(Math.min(g,1))}static convert(t){if(t instanceof Ns)return t;if(Array.isArray(t)&&(t.length===2||t.length===3))return new Ns(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&typeof t=="object"&&t!==null)return new Ns(Number("lng"in t?t.lng:t.lon),Number(t.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 Rd=2*Math.PI*Lh;function kf(n){return Rd*Math.cos(n*Math.PI/180)}function Dd(n){return(180+n)/360}function Du(n){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+n*Math.PI/360)))/360}function Bh(n,t){return n/kf(t)}function Hl(n){return 360/Math.PI*Math.atan(Math.exp((180-360*n)*Math.PI/180))-90}function If(n,t){return n*kf(Hl(t))}class Oh{constructor(t,r,o=0){this.x=+t,this.y=+r,this.z=+o}static fromLngLat(t,r=0){const o=Ns.convert(t);return new Oh(Dd(o.lng),Du(o.lat),Bh(r,o.lat))}toLngLat(){return new Ns(360*this.x-180,Hl(this.y))}toAltitude(){return If(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/Rd*(t=Hl(this.y),1/Math.cos(t*Math.PI/180));var t}}function Ip(n,t,r){var o=2*Math.PI*6378137/256/Math.pow(2,r);return[n*o-2*Math.PI*6378137/2,t*o-2*Math.PI*6378137/2]}class Ld{constructor(t,r,o){if(!(function(h,g,_){return!(h<0||h>25||_<0||_>=Math.pow(2,h)||g<0||g>=Math.pow(2,h))})(t,r,o))throw new Error(`x=${r}, y=${o}, z=${t} outside of bounds. 0<=x<${Math.pow(2,t)}, 0<=y<${Math.pow(2,t)} 0<=z<=25 `);this.z=t,this.x=r,this.y=o,this.key=zi(0,t,t,r,o)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,r,o){const h=(_=this.y,x=this.z,b=Ip(256*(g=this.x),256*(_=Math.pow(2,x)-_-1),x),T=Ip(256*(g+1),256*(_+1),x),b[0]+","+b[1]+","+T[0]+","+T[1]);var g,_,x,b,T;const C=(function(D,O,F){let U,$="";for(let Q=D;Q>0;Q--)U=1<<Q-1,$+=(O&U?1:0)+(F&U?2:0);return $})(this.z,this.x,this.y);return t[(this.x+this.y)%t.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(o==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,r>1?"@2x":"").replace(/{quadkey}/g,C).replace(/{bbox-epsg-3857}/g,h)}isChildOf(t){const r=this.z-t.z;return r>0&&t.x===this.x>>r&&t.y===this.y>>r}getTilePoint(t){const r=Math.pow(2,this.z);return new H((t.x*r-this.x)*bt,(t.y*r-this.y)*bt)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Rf{constructor(t,r){this.wrap=t,this.canonical=r,this.key=zi(t,r.z,r.z,r.x,r.y)}}class Yn{constructor(t,r,o,h,g){if(this.terrainRttPosMatrix32f=null,t<o)throw new Error(`overscaledZ should be >= z; overscaledZ = ${t}; z = ${o}`);this.overscaledZ=t,this.wrap=r,this.canonical=new Ld(o,+h,+g),this.key=zi(r,t,o,h,g)}clone(){return new Yn(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const r=this.canonical.z-t;return t>this.canonical.z?new Yn(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Yn(t,this.wrap,t,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(t,r){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const o=this.canonical.z-t;return t>this.canonical.z?zi(this.wrap*+r,t,this.canonical.z,this.canonical.x,this.canonical.y):zi(this.wrap*+r,t,t,this.canonical.x>>o,this.canonical.y>>o)}isChildOf(t){if(t.wrap!==this.wrap)return!1;const r=this.canonical.z-t.canonical.z;return t.overscaledZ===0||t.overscaledZ<this.overscaledZ&&t.canonical.x===this.canonical.x>>r&&t.canonical.y===this.canonical.y>>r}children(t){if(this.overscaledZ>=t)return[new Yn(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const r=this.canonical.z+1,o=2*this.canonical.x,h=2*this.canonical.y;return[new Yn(r,this.wrap,r,o,h),new Yn(r,this.wrap,r,o+1,h),new Yn(r,this.wrap,r,o,h+1),new Yn(r,this.wrap,r,o+1,h+1)]}isLessThan(t){return this.wrap<t.wrap||!(this.wrap>t.wrap)&&(this.overscaledZ<t.overscaledZ||!(this.overscaledZ>t.overscaledZ)&&(this.canonical.x<t.canonical.x||!(this.canonical.x>t.canonical.x)&&this.canonical.y<t.canonical.y))}wrapped(){return new Yn(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new Yn(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Rf(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(t){return this.canonical.getTilePoint(new Oh(t.x-this.wrap,t.y))}}function zi(n,t,r,o,h){(n*=2)<0&&(n=-1*n-1);const g=1<<r;return(g*g*n+g*h+o).toString(36)+r.toString(36)+t.toString(36)}function qc(n,t){return t?n.properties[t]:n.id}yt("CanonicalTileID",Ld),yt("OverscaledTileID",Yn,{omit:["terrainRttPosMatrix32f"]});class Or{constructor(){this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0}extend(t){return this.minX=Math.min(this.minX,t.x),this.minY=Math.min(this.minY,t.y),this.maxX=Math.max(this.maxX,t.x),this.maxY=Math.max(this.maxY,t.y),this}expandBy(t){return this.minX-=t,this.minY-=t,this.maxX+=t,this.maxY+=t,(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(t){return this.expandBy(-t)}map(t){const r=new Or;return r.extend(t(new H(this.minX,this.minY))),r.extend(t(new H(this.maxX,this.minY))),r.extend(t(new H(this.minX,this.maxY))),r.extend(t(new H(this.maxX,this.maxY))),r}static fromPoints(t){const r=new Or;for(const o of t)r.extend(o);return r}contains(t){return t.x>=this.minX&&t.x<=this.maxX&&t.y>=this.minY&&t.y<=this.maxY}empty(){return this.minX>this.maxX}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}covers(t){return!this.empty()&&!t.empty()&&t.minX>=this.minX&&t.maxX<=this.maxX&&t.minY>=this.minY&&t.maxY<=this.maxY}intersects(t){return!this.empty()&&!t.empty()&&t.minX<=this.maxX&&t.maxX>=this.minX&&t.minY<=this.maxY&&t.maxY>=this.minY}}class Rp{constructor(t){this._stringToNumber={},this._numberToString=[];for(let r=0;r<t.length;r++){const o=t[r];this._stringToNumber[o]=r,this._numberToString[r]=o}}encode(t){return this._stringToNumber[t]}decode(t){if(t>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${t} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[t]}}class Bd{constructor(t,r,o,h,g){this.type="Feature",this._vectorTileFeature=t,t._z=r,t._x=o,t._y=h,this.properties=t.properties,this.id=g}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(t){this._geometry=t}toJSON(){const t={geometry:this.geometry};for(const r in this)r!=="_geometry"&&r!=="_vectorTileFeature"&&(t[r]=this[r]);return t}}class Od{constructor(t,r){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new As(bt,16,0),this.grid3D=new As(bt,16,0),this.featureIndexArray=new ge,this.promoteId=r}insert(t,r,o,h,g,_){const x=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(o,h,g);const b=_?this.grid3D:this.grid;for(let T=0;T<r.length;T++){const C=r[T],D=[1/0,1/0,-1/0,-1/0];for(let O=0;O<C.length;O++){const F=C[O];D[0]=Math.min(D[0],F.x),D[1]=Math.min(D[1],F.y),D[2]=Math.max(D[2],F.x),D[3]=Math.max(D[3],F.y)}D[0]<bt&&D[1]<bt&&D[2]>=0&&D[3]>=0&&b.insert(x,D[0],D[1],D[2],D[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new _f(new Fc(this.rawTileData)).layers,this.sourceLayerCoder=new Rp(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,r,o,h){this.loadVTLayers();const g=t.params,_=bt/t.tileSize/t.scale,x=Js(g.filter),b=t.queryGeometry,T=t.queryPadding*_,C=Or.fromPoints(b),D=this.grid.query(C.minX-T,C.minY-T,C.maxX+T,C.maxY+T),O=Or.fromPoints(t.cameraQueryGeometry).expandBy(T),F=this.grid3D.query(O.minX,O.minY,O.maxX,O.maxY,((Q,re,be,he)=>(function(pe,Ie,Ne,Qe,pt){for(const dt of pe)if(Ie<=dt.x&&Ne<=dt.y&&Qe>=dt.x&&pt>=dt.y)return!0;const lt=[new H(Ie,Ne),new H(Ie,pt),new H(Qe,pt),new H(Qe,Ne)];if(pe.length>2){for(const dt of lt)if(kc(pe,dt))return!0}for(let dt=0;dt<pe.length-1;dt++)if(Jf(pe[dt],pe[dt+1],lt))return!0;return!1})(t.cameraQueryGeometry,Q-T,re-T,be+T,he+T)));for(const Q of F)D.push(Q);D.sort(Dp);const U={};let $;for(let Q=0;Q<D.length;Q++){const re=D[Q];if(re===$)continue;$=re;const be=this.featureIndexArray.get(re);let he=null;this.loadMatchingFeature(U,be.bucketIndex,be.sourceLayerIndex,be.featureIndex,x,g.layers,g.availableImages,r,o,h,((pe,Ie,Ne)=>(he||(he=Yi(pe)),Ie.queryIntersectsFeature({queryGeometry:b,feature:pe,featureState:Ne,geometry:he,zoom:this.z,transform:t.transform,pixelsToTileUnits:_,pixelPosMatrix:t.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:t.getElevation}))))}return U}loadMatchingFeature(t,r,o,h,g,_,x,b,T,C,D){const O=this.bucketLayerIDs[r];if(_&&!O.some((Q=>_.has(Q))))return;const F=this.sourceLayerCoder.decode(o),U=this.vtLayers[F].feature(h);if(g.needGeometry){const Q=Ta(U,!0);if(!g.filter(new Ai(this.tileID.overscaledZ),Q,this.tileID.canonical))return}else if(!g.filter(new Ai(this.tileID.overscaledZ),U))return;const $=this.getId(U,F);for(let Q=0;Q<O.length;Q++){const re=O[Q];if(_&&!_.has(re))continue;const be=b[re];if(!be)continue;let he={};$&&C&&(he=C.getState(be.sourceLayer||"_geojsonTileLayer",$));const pe=si({},T[re]);pe.paint=jh(pe.paint,be.paint,U,he,x),pe.layout=jh(pe.layout,be.layout,U,he,x);const Ie=!D||D(U,be,he);if(!Ie)continue;const Ne=new Bd(U,this.z,this.x,this.y,$);Ne.layer=pe;let Qe=t[re];Qe===void 0&&(Qe=t[re]=[]),Qe.push({featureIndex:h,feature:Ne,intersectionZ:Ie})}}lookupSymbolFeatures(t,r,o,h,g,_,x,b){const T={};this.loadVTLayers();const C=Js(g);for(const D of t)this.loadMatchingFeature(T,o,h,D,C,_,x,b,r);return T}hasLayer(t){for(const r of this.bucketLayerIDs)for(const o of r)if(t===o)return!0;return!1}getId(t,r){var o;let h=t.id;return this.promoteId&&(h=t.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[r]],typeof h=="boolean"&&(h=Number(h)),h===void 0&&(!((o=t.properties)===null||o===void 0)&&o.cluster)&&this.promoteId&&(h=Number(t.properties.cluster_id))),h}}function jh(n,t,r,o,h){return zn(n,((g,_)=>{const x=t instanceof Xo?t.get(_):null;return x&&x.evaluate?x.evaluate(r,o,h):x}))}function Dp(n,t){return t-n}function Df(n,t,r,o,h){const g=[];for(let _=0;_<n.length;_++){const x=n[_];let b;for(let T=0;T<x.length-1;T++){let C=x[T],D=x[T+1];C.x<t&&D.x<t||(C.x<t?C=new H(t,C.y+(t-C.x)/(D.x-C.x)*(D.y-C.y))._round():D.x<t&&(D=new H(t,C.y+(t-C.x)/(D.x-C.x)*(D.y-C.y))._round()),C.y<r&&D.y<r||(C.y<r?C=new H(C.x+(r-C.y)/(D.y-C.y)*(D.x-C.x),r)._round():D.y<r&&(D=new H(C.x+(r-C.y)/(D.y-C.y)*(D.x-C.x),r)._round()),C.x>=o&&D.x>=o||(C.x>=o?C=new H(o,C.y+(o-C.x)/(D.x-C.x)*(D.y-C.y))._round():D.x>=o&&(D=new H(o,C.y+(o-C.x)/(D.x-C.x)*(D.y-C.y))._round()),C.y>=h&&D.y>=h||(C.y>=h?C=new H(C.x+(h-C.y)/(D.y-C.y)*(D.x-C.x),h)._round():D.y>=h&&(D=new H(C.x+(h-C.y)/(D.y-C.y)*(D.x-C.x),h)._round()),b&&C.equals(b[b.length-1])||(b=[C],g.push(b)),b.push(D)))))}}return g}yt("FeatureIndex",Od,{omit:["rawTileData","sourceLayerCoder"]});class yo extends H{constructor(t,r,o,h){super(t,r),this.angle=o,h!==void 0&&(this.segment=h)}clone(){return new yo(this.x,this.y,this.angle,this.segment)}}function jd(n,t,r,o,h){if(t.segment===void 0||r===0)return!0;let g=t,_=t.segment+1,x=0;for(;x>-r/2;){if(_--,_<0)return!1;x-=n[_].dist(g),g=n[_]}x+=n[_].dist(n[_+1]),_++;const b=[];let T=0;for(;x<r/2;){const C=n[_],D=n[_+1];if(!D)return!1;let O=n[_-1].angleTo(C)-C.angleTo(D);for(O=Math.abs((O+3*Math.PI)%(2*Math.PI)-Math.PI),b.push({distance:x,angleDelta:O}),T+=O;x-b[0].distance>o;)T-=b.shift().angleDelta;if(T>h)return!1;_++,x+=C.dist(D)}return!0}function Lp(n){let t=0;for(let r=0;r<n.length-1;r++)t+=n[r].dist(n[r+1]);return t}function Lf(n,t,r){return n?.6*t*r:0}function Bp(n,t){return Math.max(n?n.right-n.left:0,t?t.right-t.left:0)}function Op(n,t,r,o,h,g){const _=Lf(r,h,g),x=Bp(r,o)*g;let b=0;const T=Lp(n)/2;for(let C=0;C<n.length-1;C++){const D=n[C],O=n[C+1],F=D.dist(O);if(b+F>T){const U=(T-b)/F,$=os.number(D.x,O.x,U),Q=os.number(D.y,O.y,U),re=new yo($,Q,O.angleTo(D),C);return re._round(),!_||jd(n,re,x,_,t)?re:void 0}b+=F}}function cm(n,t,r,o,h,g,_,x,b){const T=Lf(o,g,_),C=Bp(o,h),D=C*_,O=n[0].x===0||n[0].x===b||n[0].y===0||n[0].y===b;return t-D<t/4&&(t=D+t/4),jp(n,O?t/2*x%t:(C/2+2*g)*_*x%t,t,T,r,D,O,!1,b)}function jp(n,t,r,o,h,g,_,x,b){const T=g/2,C=Lp(n);let D=0,O=t-r,F=[];for(let U=0;U<n.length-1;U++){const $=n[U],Q=n[U+1],re=$.dist(Q),be=Q.angleTo($);for(;O+r<D+re;){O+=r;const he=(O-D)/re,pe=os.number($.x,Q.x,he),Ie=os.number($.y,Q.y,he);if(pe>=0&&pe<b&&Ie>=0&&Ie<b&&O-T>=0&&O+T<=C){const Ne=new yo(pe,Ie,be,U);Ne._round(),o&&!jd(n,Ne,g,o,h)||F.push(Ne)}}D+=re}return x||F.length||_||(F=jp(n,D/2,r,o,h,g,_,!0,b)),F}function nl(n,t,r,o){const h=[],g=n.image,_=g.pixelRatio,x=g.paddedRect.w-2,b=g.paddedRect.h-2;let T={x1:n.left,y1:n.top,x2:n.right,y2:n.bottom};const C=g.stretchX||[[0,x]],D=g.stretchY||[[0,b]],O=($e,Ot)=>$e+Ot[1]-Ot[0],F=C.reduce(O,0),U=D.reduce(O,0),$=x-F,Q=b-U;let re=0,be=F,he=0,pe=U,Ie=0,Ne=$,Qe=0,pt=Q;if(g.content&&o){const $e=g.content,Ot=$e[2]-$e[0],Ut=$e[3]-$e[1];(g.textFitWidth||g.textFitHeight)&&(T=Ep(n)),re=Nh(C,0,$e[0]),he=Nh(D,0,$e[1]),be=Nh(C,$e[0],$e[2]),pe=Nh(D,$e[1],$e[3]),Ie=$e[0]-re,Qe=$e[1]-he,Ne=Ot-be,pt=Ut-pe}const lt=T.x1,dt=T.y1,At=T.x2-lt,mt=T.y2-dt,ft=($e,Ot,Ut,Rt)=>{const Mt=Fd($e.stretch-re,be,At,lt),ri=Ud($e.fixed-Ie,Ne,$e.stretch,F),Di=Fd(Ot.stretch-he,pe,mt,dt),Wi=Ud(Ot.fixed-Qe,pt,Ot.stretch,U),Vr=Fd(Ut.stretch-re,be,At,lt),Gn=Ud(Ut.fixed-Ie,Ne,Ut.stretch,F),Gr=Fd(Rt.stretch-he,pe,mt,dt),hn=Ud(Rt.fixed-Qe,pt,Rt.stretch,U),ar=new H(Mt,Di),Er=new H(Vr,Di),dn=new H(Vr,Gr),Jr=new H(Mt,Gr),fn=new H(ri/_,Wi/_),Pa=new H(Gn/_,hn/_),en=t*Math.PI/180;if(en){const Yr=Math.sin(en),Pr=Math.cos(en),zr=[Pr,-Yr,Yr,Pr];ar._matMult(zr),Er._matMult(zr),Jr._matMult(zr),dn._matMult(zr)}const An=$e.stretch+$e.fixed,Ar=Ot.stretch+Ot.fixed;return{tl:ar,tr:Er,bl:Jr,br:dn,tex:{x:g.paddedRect.x+1+An,y:g.paddedRect.y+1+Ar,w:Ut.stretch+Ut.fixed-An,h:Rt.stretch+Rt.fixed-Ar},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:fn,pixelOffsetBR:Pa,minFontScaleX:Ne/_/At,minFontScaleY:pt/_/mt,isSDF:r}};if(o&&(g.stretchX||g.stretchY)){const $e=Nd(C,$,F),Ot=Nd(D,Q,U);for(let Ut=0;Ut<$e.length-1;Ut++){const Rt=$e[Ut],Mt=$e[Ut+1];for(let ri=0;ri<Ot.length-1;ri++)h.push(ft(Rt,Ot[ri],Mt,Ot[ri+1]))}}else h.push(ft({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:x+1},{fixed:0,stretch:b+1}));return h}function Nh(n,t,r){let o=0;for(const h of n)o+=Math.max(t,Math.min(r,h[1]))-Math.max(t,Math.min(r,h[0]));return o}function Nd(n,t,r){const o=[{fixed:-1,stretch:0}];for(const[h,g]of n){const _=o[o.length-1];o.push({fixed:h-_.stretch,stretch:_.stretch}),o.push({fixed:h-_.stretch,stretch:_.stretch+(g-h)})}return o.push({fixed:t+1,stretch:r}),o}function Fd(n,t,r,o){return n/t*r+o}function Ud(n,t,r,o){return n-t*r/o}yt("Anchor",yo);class Lu{constructor(t,r,o,h,g,_,x,b,T,C){var D;if(this.boxStartIndex=t.length,T){let O=_.top,F=_.bottom;const U=_.collisionPadding;U&&(O-=U[1],F+=U[3]);let $=F-O;$>0&&($=Math.max(10,$),this.circleDiameter=$)}else{const O=!((D=_.image)===null||D===void 0)&&D.content&&(_.image.textFitWidth||_.image.textFitHeight)?Ep(_):{x1:_.left,y1:_.top,x2:_.right,y2:_.bottom};O.y1=O.y1*x-b[0],O.y2=O.y2*x+b[2],O.x1=O.x1*x-b[3],O.x2=O.x2*x+b[1];const F=_.collisionPadding;if(F&&(O.x1-=F[0]*x,O.y1-=F[1]*x,O.x2+=F[2]*x,O.y2+=F[3]*x),C){const U=new H(O.x1,O.y1),$=new H(O.x2,O.y1),Q=new H(O.x1,O.y2),re=new H(O.x2,O.y2),be=C*Math.PI/180;U._rotate(be),$._rotate(be),Q._rotate(be),re._rotate(be),O.x1=Math.min(U.x,$.x,Q.x,re.x),O.x2=Math.max(U.x,$.x,Q.x,re.x),O.y1=Math.min(U.y,$.y,Q.y,re.y),O.y2=Math.max(U.y,$.y,Q.y,re.y)}t.emplaceBack(r.x,r.y,O.x1,O.y1,O.x2,O.y2,o,h,g)}this.boxEndIndex=t.length}}class um{constructor(t=[],r=(o,h)=>o<h?-1:o>h?1:0){if(this.data=t,this.length=this.data.length,this.compare=r,this.length>0)for(let o=(this.length>>1)-1;o>=0;o--)this._down(o)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(this.length===0)return;const t=this.data[0],r=this.data.pop();return--this.length>0&&(this.data[0]=r,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:r,compare:o}=this,h=r[t];for(;t>0;){const g=t-1>>1,_=r[g];if(o(h,_)>=0)break;r[t]=_,t=g}r[t]=h}_down(t){const{data:r,compare:o}=this,h=this.length>>1,g=r[t];for(;t<h;){let _=1+(t<<1);const x=_+1;if(x<this.length&&o(r[x],r[_])<0&&(_=x),o(r[_],g)>=0)break;r[t]=r[_],t=_}r[t]=g}}function Fs(n,t=1,r=!1){const o=Or.fromPoints(n[0]),h=Math.min(o.width(),o.height());let g=h/2;const _=new um([],Bf),{minX:x,minY:b,maxX:T,maxY:C}=o;if(h===0)return new H(x,b);for(let F=x;F<T;F+=h)for(let U=b;U<C;U+=h)_.push(new $c(F+g,U+g,g,n));let D=(function(F){let U=0,$=0,Q=0;const re=F[0];for(let be=0,he=re.length,pe=he-1;be<he;pe=be++){const Ie=re[be],Ne=re[pe],Qe=Ie.x*Ne.y-Ne.x*Ie.y;$+=(Ie.x+Ne.x)*Qe,Q+=(Ie.y+Ne.y)*Qe,U+=3*Qe}return new $c($/U,Q/U,0,F)})(n),O=_.length;for(;_.length;){const F=_.pop();(F.d>D.d||!D.d)&&(D=F,r&&console.log("found best %d after %d probes",Math.round(1e4*F.d)/1e4,O)),F.max-D.d<=t||(g=F.h/2,_.push(new $c(F.p.x-g,F.p.y-g,g,n)),_.push(new $c(F.p.x+g,F.p.y-g,g,n)),_.push(new $c(F.p.x-g,F.p.y+g,g,n)),_.push(new $c(F.p.x+g,F.p.y+g,g,n)),O+=4)}return r&&(console.log(`num probes: ${O}`),console.log(`best distance: ${D.d}`)),D.p}function Bf(n,t){return t.max-n.max}function $c(n,t,r,o){this.p=new H(n,t),this.h=r,this.d=(function(h,g){let _=!1,x=1/0;for(let b=0;b<g.length;b++){const T=g[b];for(let C=0,D=T.length,O=D-1;C<D;O=C++){const F=T[C],U=T[O];F.y>h.y!=U.y>h.y&&h.x<(U.x-F.x)*(h.y-F.y)/(U.y-F.y)+F.x&&(_=!_),x=Math.min(x,rf(h,F,U))}}return(_?1:-1)*Math.sqrt(x)})(this.p,o),this.max=this.d+this.h*Math.SQRT2}var un;A.aE=void 0,(un=A.aE||(A.aE={}))[un.center=1]="center",un[un.left=2]="left",un[un.right=3]="right",un[un.top=4]="top",un[un.bottom=5]="bottom",un[un["top-left"]=6]="top-left",un[un["top-right"]=7]="top-right",un[un["bottom-left"]=8]="bottom-left",un[un["bottom-right"]=9]="bottom-right";const Hc=Number.POSITIVE_INFINITY;function Ka(n,t){return t[1]!==Hc?(function(r,o,h){let g=0,_=0;switch(o=Math.abs(o),h=Math.abs(h),r){case"top-right":case"top-left":case"top":_=h-7;break;case"bottom-right":case"bottom-left":case"bottom":_=7-h}switch(r){case"top-right":case"bottom-right":case"right":g=-o;break;case"top-left":case"bottom-left":case"left":g=o}return[g,_]})(n,t[0],t[1]):(function(r,o){let h=0,g=0;o<0&&(o=0);const _=o/Math.SQRT2;switch(r){case"top-right":case"top-left":g=_-7;break;case"bottom-right":case"bottom-left":g=7-_;break;case"bottom":g=7-o;break;case"top":g=o-7}switch(r){case"top-right":case"bottom-right":h=-_;break;case"top-left":case"bottom-left":h=_;break;case"left":h=o;break;case"right":h=-o}return[h,g]})(n,t[0])}function Of(n,t,r){var o;const h=n.layout,g=(o=h.get("text-variable-anchor-offset"))===null||o===void 0?void 0:o.evaluate(t,{},r);if(g){const x=g.values,b=[];for(let T=0;T<x.length;T+=2){const C=b[T]=x[T],D=x[T+1].map((O=>O*yr));C.startsWith("top")?D[1]-=7:C.startsWith("bottom")&&(D[1]+=7),b[T+1]=D}return new an(b)}const _=h.get("text-variable-anchor");if(_){let x;x=n._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[h.get("text-radial-offset").evaluate(t,{},r)*yr,Hc]:h.get("text-offset").evaluate(t,{},r).map((T=>T*yr));const b=[];for(const T of _)b.push(T,Ka(T,x));return new an(b)}return null}function Bu(n){switch(n){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function al(n,t,r,o,h,g,_,x,b,T,C,D){let O=g.textMaxSize.evaluate(t,{});O===void 0&&(O=_);const F=n.layers[0].layout,U=F.get("icon-offset").evaluate(t,{},C),$=Fp(r.horizontal),Q=_/24,re=n.tilePixelRatio*Q,be=n.tilePixelRatio*O/24,he=n.tilePixelRatio*x,pe=n.tilePixelRatio*F.get("symbol-spacing"),Ie=F.get("text-padding")*n.tilePixelRatio,Ne=(function(Ut,Rt,Mt,ri=1){const Di=Ut.get("icon-padding").evaluate(Rt,{},Mt),Wi=Di&&Di.values;return[Wi[0]*ri,Wi[1]*ri,Wi[2]*ri,Wi[3]*ri]})(F,t,C,n.tilePixelRatio),Qe=F.get("text-max-angle")/180*Math.PI,pt=F.get("text-rotation-alignment")!=="viewport"&&F.get("symbol-placement")!=="point",lt=F.get("icon-rotation-alignment")==="map"&&F.get("symbol-placement")!=="point",dt=F.get("symbol-placement"),At=pe/2,mt=F.get("icon-text-fit");let ft;o&&mt!=="none"&&(n.allowVerticalPlacement&&r.vertical&&(ft=Ph(o,r.vertical,mt,F.get("icon-text-fit-padding"),U,Q)),$&&(o=Ph(o,$,mt,F.get("icon-text-fit-padding"),U,Q)));const $e=C?D.line.getGranularityForZoomLevel(C.z):1,Ot=(Ut,Rt)=>{Rt.x<0||Rt.x>=bt||Rt.y<0||Rt.y>=bt||(function(Mt,ri,Di,Wi,Vr,Gn,Gr,hn,ar,Er,dn,Jr,fn,Pa,en,An,Ar,Yr,Pr,zr,Ni,ps,Nu,za,i){const s=Mt.addToLineVertexArray(ri,Di);let c,p,v,M,N=0,K=0,fe=0,Be=0,Ke=-1,it=-1;const je={};let Ue=Ls("");if(Mt.allowVerticalPlacement&&Wi.vertical){const ua=hn.layout.get("text-rotate").evaluate(Ni,{},za)+90;v=new Lu(ar,ri,Er,dn,Jr,Wi.vertical,fn,Pa,en,ua),Gr&&(M=new Lu(ar,ri,Er,dn,Jr,Gr,Ar,Yr,en,ua))}if(Vr){const ua=hn.layout.get("icon-rotate").evaluate(Ni,{}),Us=hn.layout.get("icon-text-fit")!=="none",Vh=nl(Vr,ua,Nu,Us),sl=Gr?nl(Gr,ua,Nu,Us):void 0;p=new Lu(ar,ri,Er,dn,Jr,Vr,Ar,Yr,!1,ua),N=4*Vh.length;const Gh=Mt.iconSizeData;let Yl=null;Gh.kind==="source"?(Yl=[Aa*hn.layout.get("icon-size").evaluate(Ni,{})],Yl[0]>_o&&$i(`${Mt.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):Gh.kind==="composite"&&(Yl=[Aa*ps.compositeIconSizes[0].evaluate(Ni,{},za),Aa*ps.compositeIconSizes[1].evaluate(Ni,{},za)],(Yl[0]>_o||Yl[1]>_o)&&$i(`${Mt.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),Mt.addSymbols(Mt.icon,Vh,Yl,zr,Pr,Ni,A.ao.none,ri,s.lineStartIndex,s.lineLength,-1,za),Ke=Mt.icon.placedSymbolArray.length-1,sl&&(K=4*sl.length,Mt.addSymbols(Mt.icon,sl,Yl,zr,Pr,Ni,A.ao.vertical,ri,s.lineStartIndex,s.lineLength,-1,za),it=Mt.icon.placedSymbolArray.length-1)}const Qt=Object.keys(Wi.horizontal);for(const ua of Qt){const Us=Wi.horizontal[ua];if(!c){Ue=Ls(Us.text);const sl=hn.layout.get("text-rotate").evaluate(Ni,{},za);c=new Lu(ar,ri,Er,dn,Jr,Us,fn,Pa,en,sl)}const Vh=Us.positionedLines.length===1;if(fe+=Np(Mt,ri,Us,Gn,hn,en,Ni,An,s,Wi.vertical?A.ao.horizontal:A.ao.horizontalOnly,Vh?Qt:[ua],je,Ke,ps,za),Vh)break}Wi.vertical&&(Be+=Np(Mt,ri,Wi.vertical,Gn,hn,en,Ni,An,s,A.ao.vertical,["vertical"],je,it,ps,za));const Xt=c?c.boxStartIndex:Mt.collisionBoxArray.length,Qi=c?c.boxEndIndex:Mt.collisionBoxArray.length,Pe=v?v.boxStartIndex:Mt.collisionBoxArray.length,Ee=v?v.boxEndIndex:Mt.collisionBoxArray.length,De=p?p.boxStartIndex:Mt.collisionBoxArray.length,Je=p?p.boxEndIndex:Mt.collisionBoxArray.length,Dt=M?M.boxStartIndex:Mt.collisionBoxArray.length,_i=M?M.boxEndIndex:Mt.collisionBoxArray.length;let Pt=-1;const Vt=(ua,Us)=>ua&&ua.circleDiameter?Math.max(ua.circleDiameter,Us):Us;Pt=Vt(c,Pt),Pt=Vt(v,Pt),Pt=Vt(p,Pt),Pt=Vt(M,Pt);const pn=Pt>-1?1:0;pn&&(Pt*=i/yr),Mt.glyphOffsetArray.length>=Zc.MAX_GLYPHS&&$i("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Ni.sortKey!==void 0&&Mt.addToSortKeyRanges(Mt.symbolInstances.length,Ni.sortKey);const Li=Of(hn,Ni,za),[Xl,hm]=(function(ua,Us){const Vh=ua.length,sl=Us?.values;if(sl?.length>0)for(let Gh=0;Gh<sl.length;Gh+=2){const Yl=sl[Gh+1];ua.emplaceBack(A.aE[sl[Gh]],Yl[0],Yl[1])}return[Vh,ua.length]})(Mt.textAnchorOffsets,Li);Mt.symbolInstances.emplaceBack(ri.x,ri.y,je.right>=0?je.right:-1,je.center>=0?je.center:-1,je.left>=0?je.left:-1,je.vertical||-1,Ke,it,Ue,Xt,Qi,Pe,Ee,De,Je,Dt,_i,Er,fe,Be,N,K,pn,0,fn,Pt,Xl,hm)})(n,Rt,Ut,r,o,h,ft,n.layers[0],n.collisionBoxArray,t.index,t.sourceLayerIndex,n.index,re,[Ie,Ie,Ie,Ie],pt,b,he,Ne,lt,U,t,g,T,C,_)};if(dt==="line")for(const Ut of Df(t.geometry,0,0,bt,bt)){const Rt=Jo(Ut,$e),Mt=cm(Rt,pe,Qe,r.vertical||$,o,24,be,n.overscaling,bt);for(const ri of Mt)$&&Ou(n,$.text,At,ri)||Ot(Rt,ri)}else if(dt==="line-center"){for(const Ut of t.geometry)if(Ut.length>1){const Rt=Jo(Ut,$e),Mt=Op(Rt,Qe,r.vertical||$,o,24,be);Mt&&Ot(Rt,Mt)}}else if(t.type==="Polygon")for(const Ut of vl(t.geometry,0)){const Rt=Fs(Ut,16);Ot(Jo(Ut[0],$e,!0),new yo(Rt.x,Rt.y,0))}else if(t.type==="LineString")for(const Ut of t.geometry){const Rt=Jo(Ut,$e);Ot(Rt,new yo(Rt[0].x,Rt[0].y,0))}else if(t.type==="Point")for(const Ut of t.geometry)for(const Rt of Ut)Ot([Rt],new yo(Rt.x,Rt.y,0))}function Np(n,t,r,o,h,g,_,x,b,T,C,D,O,F,U){const $=(function(be,he,pe,Ie,Ne,Qe,pt,lt){const dt=Ie.layout.get("text-rotate").evaluate(Qe,{})*Math.PI/180,At=[];for(const mt of he.positionedLines)for(const ft of mt.positionedGlyphs){if(!ft.rect)continue;const $e=ft.rect||{};let Ot=4,Ut=!0,Rt=1,Mt=0;const ri=(Ne||lt)&&ft.vertical,Di=ft.metrics.advance*ft.scale/2;if(lt&&he.verticalizable&&(Mt=mt.lineOffset/2-(ft.imageName?-(yr-ft.metrics.width*ft.scale)/2:(ft.scale-1)*yr)),ft.imageName){const Yr=pt[ft.imageName];Ut=Yr.sdf,Rt=Yr.pixelRatio,Ot=1/Rt}const Wi=Ne?[ft.x+Di,ft.y]:[0,0];let Vr=Ne?[0,0]:[ft.x+Di+pe[0],ft.y+pe[1]-Mt],Gn=[0,0];ri&&(Gn=Vr,Vr=[0,0]);const Gr=ft.metrics.isDoubleResolution?2:1,hn=(ft.metrics.left-Ot)*ft.scale-Di+Vr[0],ar=(-ft.metrics.top-Ot)*ft.scale+Vr[1],Er=hn+$e.w/Gr*ft.scale/Rt,dn=ar+$e.h/Gr*ft.scale/Rt,Jr=new H(hn,ar),fn=new H(Er,ar),Pa=new H(hn,dn),en=new H(Er,dn);if(ri){const Yr=new H(-Di,Di- -17),Pr=-Math.PI/2,zr=12-Di,Ni=new H(22-zr,-(ft.imageName?zr:0)),ps=new H(...Gn);Jr._rotateAround(Pr,Yr)._add(Ni)._add(ps),fn._rotateAround(Pr,Yr)._add(Ni)._add(ps),Pa._rotateAround(Pr,Yr)._add(Ni)._add(ps),en._rotateAround(Pr,Yr)._add(Ni)._add(ps)}if(dt){const Yr=Math.sin(dt),Pr=Math.cos(dt),zr=[Pr,-Yr,Yr,Pr];Jr._matMult(zr),fn._matMult(zr),Pa._matMult(zr),en._matMult(zr)}const An=new H(0,0),Ar=new H(0,0);At.push({tl:Jr,tr:fn,bl:Pa,br:en,tex:$e,writingMode:he.writingMode,glyphOffset:Wi,sectionIndex:ft.sectionIndex,isSDF:Ut,pixelOffsetTL:An,pixelOffsetBR:Ar,minFontScaleX:0,minFontScaleY:0})}return At})(0,r,x,h,g,_,o,n.allowVerticalPlacement),Q=n.textSizeData;let re=null;Q.kind==="source"?(re=[Aa*h.layout.get("text-size").evaluate(_,{})],re[0]>_o&&$i(`${n.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):Q.kind==="composite"&&(re=[Aa*F.compositeTextSizes[0].evaluate(_,{},U),Aa*F.compositeTextSizes[1].evaluate(_,{},U)],(re[0]>_o||re[1]>_o)&&$i(`${n.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),n.addSymbols(n.text,$,re,x,g,_,T,t,b.lineStartIndex,b.lineLength,O,U);for(const be of C)D[be]=n.text.placedSymbolArray.length-1;return 4*$.length}function Fp(n){for(const t in n)return n[t];return null}function Ou(n,t,r,o){const h=n.compareText;if(t in h){const g=h[t];for(let _=g.length-1;_>=0;_--)if(o.dist(g[_])<r)return!0}else h[t]=[];return h[t].push(o),!1}const jf=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Nf{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[r,o]=new Uint8Array(t,0,2);if(r!==219)throw new Error("Data does not appear to be in a KDBush format.");const h=o>>4;if(h!==1)throw new Error(`Got v${h} data when expected v1.`);const g=jf[15&o];if(!g)throw new Error("Unrecognized array type.");const[_]=new Uint16Array(t,2,1),[x]=new Uint32Array(t,4,1);return new Nf(x,_,g,t)}constructor(t,r=64,o=Float64Array,h){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=o,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const g=jf.indexOf(this.ArrayType),_=2*t*this.ArrayType.BYTES_PER_ELEMENT,x=t*this.IndexArrayType.BYTES_PER_ELEMENT,b=(8-x%8)%8;if(g<0)throw new Error(`Unexpected typed array class: ${o}.`);h&&h instanceof ArrayBuffer?(this.data=h,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+x+b,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+_+x+b),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+x+b,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+g]),new Uint16Array(this.data,2,1)[0]=r,new Uint32Array(this.data,4,1)[0]=t)}add(t,r){const o=this._pos>>1;return this.ids[o]=o,this.coords[this._pos++]=t,this.coords[this._pos++]=r,o}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return Ff(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,r,o,h){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:g,coords:_,nodeSize:x}=this,b=[0,g.length-1,0],T=[];for(;b.length;){const C=b.pop()||0,D=b.pop()||0,O=b.pop()||0;if(D-O<=x){for(let Q=O;Q<=D;Q++){const re=_[2*Q],be=_[2*Q+1];re>=t&&re<=o&&be>=r&&be<=h&&T.push(g[Q])}continue}const F=O+D>>1,U=_[2*F],$=_[2*F+1];U>=t&&U<=o&&$>=r&&$<=h&&T.push(g[F]),(C===0?t<=U:r<=$)&&(b.push(O),b.push(F-1),b.push(1-C)),(C===0?o>=U:h>=$)&&(b.push(F+1),b.push(D),b.push(1-C))}return T}within(t,r,o){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:h,coords:g,nodeSize:_}=this,x=[0,h.length-1,0],b=[],T=o*o;for(;x.length;){const C=x.pop()||0,D=x.pop()||0,O=x.pop()||0;if(D-O<=_){for(let Q=O;Q<=D;Q++)Vp(g[2*Q],g[2*Q+1],t,r)<=T&&b.push(h[Q]);continue}const F=O+D>>1,U=g[2*F],$=g[2*F+1];Vp(U,$,t,r)<=T&&b.push(h[F]),(C===0?t-o<=U:r-o<=$)&&(x.push(O),x.push(F-1),x.push(1-C)),(C===0?t+o>=U:r+o>=$)&&(x.push(F+1),x.push(D),x.push(1-C))}return b}}function Ff(n,t,r,o,h,g){if(h-o<=r)return;const _=o+h>>1;Up(n,t,_,o,h,g),Ff(n,t,r,o,_-1,1-g),Ff(n,t,r,_+1,h,1-g)}function Up(n,t,r,o,h,g){for(;h>o;){if(h-o>600){const T=h-o+1,C=r-o+1,D=Math.log(T),O=.5*Math.exp(2*D/3),F=.5*Math.sqrt(D*O*(T-O)/T)*(C-T/2<0?-1:1);Up(n,t,r,Math.max(o,Math.floor(r-C*O/T+F)),Math.min(h,Math.floor(r+(T-C)*O/T+F)),g)}const _=t[2*r+g];let x=o,b=h;for(Fh(n,t,o,r),t[2*h+g]>_&&Fh(n,t,o,h);x<b;){for(Fh(n,t,x,b),x++,b--;t[2*x+g]<_;)x++;for(;t[2*b+g]>_;)b--}t[2*o+g]===_?Fh(n,t,o,b):(b++,Fh(n,t,b,h)),b<=r&&(o=b+1),r<=b&&(h=b-1)}}function Fh(n,t,r,o){Uf(n,r,o),Uf(t,2*r,2*o),Uf(t,2*r+1,2*o+1)}function Uf(n,t,r){const o=n[t];n[t]=n[r],n[r]=o}function Vp(n,t,r,o){const h=n-r,g=t-o;return h*h+g*g}var Vf;A.cx=void 0,(Vf=A.cx||(A.cx={})).create="create",Vf.load="load",Vf.fullLoad="fullLoad";let Uh=null,xo=[];const Xc=1e3/60,Vd="loadTime",Gf="fullLoadTime",ju={mark(n){performance.mark(n)},frame(n){const t=n;Uh!=null&&xo.push(t-Uh),Uh=t},clearMetrics(){Uh=null,xo=[],performance.clearMeasures(Vd),performance.clearMeasures(Gf);for(const n in A.cx)performance.clearMarks(A.cx[n])},getPerformanceMetrics(){performance.measure(Vd,A.cx.create,A.cx.load),performance.measure(Gf,A.cx.create,A.cx.fullLoad);const n=performance.getEntriesByName(Vd)[0].duration,t=performance.getEntriesByName(Gf)[0].duration,r=xo.length,o=1/(xo.reduce(((g,_)=>g+_),0)/r/1e3),h=xo.filter((g=>g>Xc)).reduce(((g,_)=>g+(_-Xc)/Xc),0);return{loadTime:n,fullLoadTime:t,fps:o,percentDroppedFrames:h/(r+h)*100,totalFrames:r}}};A.$=bt,A.A=tt,A.B=function([n,t,r]){return t+=90,t*=Math.PI/180,r*=Math.PI/180,{x:n*Math.cos(t)*Math.sin(r),y:n*Math.sin(t)*Math.sin(r),z:n*Math.cos(r)}},A.C=os,A.D=St,A.E=Ct,A.F=Ai,A.G=Na,A.H=function(n){if(Kr==null){const t=n.navigator?n.navigator.userAgent:null;Kr=!!n.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return Kr},A.I=Ch,A.J=class{constructor(n,t){this.target=n,this.mapId=t,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new kp((()=>this.process())),this.subscription=Da(this.target,"message",(r=>this.receive(r)),!1),this.globalScope=ha(self)?n:window}registerMessageHandler(n,t){this.messageHandlers[n]=t}sendAsync(n,t){return new Promise(((r,o)=>{const h=Math.round(1e18*Math.random()).toString(36).substring(0,10),g=t?Da(t.signal,"abort",(()=>{g?.unsubscribe(),delete this.resolveRejects[h];const b={id:h,type:"<cancel>",origin:location.origin,targetMapId:n.targetMapId,sourceMapId:this.mapId};this.target.postMessage(b)}),wi):null;this.resolveRejects[h]={resolve:b=>{g?.unsubscribe(),r(b)},reject:b=>{g?.unsubscribe(),o(b)}};const _=[],x=Object.assign(Object.assign({},n),{id:h,sourceMapId:this.mapId,origin:location.origin,data:Zo(n.data,_)});this.target.postMessage(x,{transfer:_})}))}receive(n){const t=n.data,r=t.id;if(!(t.origin!=="file://"&&location.origin!=="file://"&&t.origin!=="resource://android"&&location.origin!=="resource://android"&&t.origin!==location.origin||t.targetMapId&&this.mapId!==t.targetMapId)){if(t.type==="<cancel>"){delete this.tasks[r];const o=this.abortControllers[r];return delete this.abortControllers[r],void(o&&o.abort())}if(ha(self)||t.mustQueue)return this.tasks[r]=t,this.taskQueue.push(r),void this.invoker.trigger();this.processTask(r,t)}}process(){if(this.taskQueue.length===0)return;const n=this.taskQueue.shift(),t=this.tasks[n];delete this.tasks[n],this.taskQueue.length>0&&this.invoker.trigger(),t&&this.processTask(n,t)}processTask(n,t){return u(this,void 0,void 0,(function*(){if(t.type==="<response>"){const h=this.resolveRejects[n];return delete this.resolveRejects[n],h?void(t.error?h.reject(Fa(t.error)):h.resolve(Fa(t.data))):void 0}if(!this.messageHandlers[t.type])return void this.completeTask(n,new Error(`Could not find a registered handler for ${t.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const r=Fa(t.data),o=new AbortController;this.abortControllers[n]=o;try{const h=yield this.messageHandlers[t.type](t.sourceMapId,r,o);this.completeTask(n,null,h)}catch(h){this.completeTask(n,h)}}))}completeTask(n,t,r){const o=[];delete this.abortControllers[n];const h={id:n,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:t?Zo(t):null,data:Zo(r,o)};this.target.postMessage(h,{transfer:o})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},A.K=W,A.L=function(){var n=new tt(16);return tt!=Float32Array&&(n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[11]=0,n[12]=0,n[13]=0,n[14]=0),n[0]=1,n[5]=1,n[10]=1,n[15]=1,n},A.M=function(n,t,r){var o,h,g,_,x,b,T,C,D,O,F,U,$=r[0],Q=r[1],re=r[2];return t===n?(n[12]=t[0]*$+t[4]*Q+t[8]*re+t[12],n[13]=t[1]*$+t[5]*Q+t[9]*re+t[13],n[14]=t[2]*$+t[6]*Q+t[10]*re+t[14],n[15]=t[3]*$+t[7]*Q+t[11]*re+t[15]):(h=t[1],g=t[2],_=t[3],x=t[4],b=t[5],T=t[6],C=t[7],D=t[8],O=t[9],F=t[10],U=t[11],n[0]=o=t[0],n[1]=h,n[2]=g,n[3]=_,n[4]=x,n[5]=b,n[6]=T,n[7]=C,n[8]=D,n[9]=O,n[10]=F,n[11]=U,n[12]=o*$+x*Q+D*re+t[12],n[13]=h*$+b*Q+O*re+t[13],n[14]=g*$+T*Q+F*re+t[14],n[15]=_*$+C*Q+U*re+t[15]),n},A.N=function(n,t,r){var o=r[0],h=r[1],g=r[2];return n[0]=t[0]*o,n[1]=t[1]*o,n[2]=t[2]*o,n[3]=t[3]*o,n[4]=t[4]*h,n[5]=t[5]*h,n[6]=t[6]*h,n[7]=t[7]*h,n[8]=t[8]*g,n[9]=t[9]*g,n[10]=t[10]*g,n[11]=t[11]*g,n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15],n},A.O=function(n,t,r){var o=t[0],h=t[1],g=t[2],_=t[3],x=t[4],b=t[5],T=t[6],C=t[7],D=t[8],O=t[9],F=t[10],U=t[11],$=t[12],Q=t[13],re=t[14],be=t[15],he=r[0],pe=r[1],Ie=r[2],Ne=r[3];return n[0]=he*o+pe*x+Ie*D+Ne*$,n[1]=he*h+pe*b+Ie*O+Ne*Q,n[2]=he*g+pe*T+Ie*F+Ne*re,n[3]=he*_+pe*C+Ie*U+Ne*be,n[4]=(he=r[4])*o+(pe=r[5])*x+(Ie=r[6])*D+(Ne=r[7])*$,n[5]=he*h+pe*b+Ie*O+Ne*Q,n[6]=he*g+pe*T+Ie*F+Ne*re,n[7]=he*_+pe*C+Ie*U+Ne*be,n[8]=(he=r[8])*o+(pe=r[9])*x+(Ie=r[10])*D+(Ne=r[11])*$,n[9]=he*h+pe*b+Ie*O+Ne*Q,n[10]=he*g+pe*T+Ie*F+Ne*re,n[11]=he*_+pe*C+Ie*U+Ne*be,n[12]=(he=r[12])*o+(pe=r[13])*x+(Ie=r[14])*D+(Ne=r[15])*$,n[13]=he*h+pe*b+Ie*O+Ne*Q,n[14]=he*g+pe*T+Ie*F+Ne*re,n[15]=he*_+pe*C+Ie*U+Ne*be,n},A.P=H,A.Q=function(n,t){const r={};for(let o=0;o<t.length;o++){const h=t[o];h in n&&(r[h]=n[h])}return r},A.R=Fn,A.S=Ns,A.T=js,A.U=Du,A.V=Dd,A.W=xe,A.X=et,A.Y=ms,A.Z=Yn,A._=u,A.a=Z,A.a$=fr,A.a0=function(n,t){var r,o,h,g,_;if(!n)return t??{};if(!t)return n;let x=Object.assign({},n);if(t.removeAll&&(x={removeAll:!0}),t.remove){const b=new Set(t.remove);x.add&&(x.add=x.add.filter((C=>!b.has(C.id)))),x.update&&(x.update=x.update.filter((C=>!b.has(C.id))));const T=new Set(((r=n.add)!==null&&r!==void 0?r:[]).map((C=>C.id)));t.remove=t.remove.filter((C=>!T.has(C)))}if(t.remove){const b=new Set(x.remove?x.remove.concat(t.remove):t.remove);x.remove=Array.from(b.values())}if(t.add){const b=x.add?x.add.concat(t.add):t.add,T=new Map(b.map((C=>[C.id,C])));x.add=Array.from(T.values())}if(t.update){const b=new Map((o=x.update)===null||o===void 0?void 0:o.map((T=>[T.id,T])));for(const T of t.update){const C=(h=b.get(T.id))!==null&&h!==void 0?h:{id:T.id};T.newGeometry&&(C.newGeometry=T.newGeometry),T.addOrUpdateProperties&&(C.addOrUpdateProperties=((g=C.addOrUpdateProperties)!==null&&g!==void 0?g:[]).concat(T.addOrUpdateProperties)),T.removeProperties&&(C.removeProperties=((_=C.removeProperties)!==null&&_!==void 0?_:[]).concat(T.removeProperties)),T.removeAllProperties&&(C.removeAllProperties=!0),b.set(T.id,C)}x.update=Array.from(b.values())}return x.remove&&x.add&&(x.remove=x.remove.filter((b=>x.add.findIndex((T=>T.id===b))===-1))),x},A.a1=Oh,A.a2=Or,A.a3=25,A.a4=Ld,A.a5=n=>{const t=window.document.createElement("video");return t.muted=!0,new Promise((r=>{t.onloadstart=()=>{r(t)};for(const o of n){const h=window.document.createElement("source");Re(o)||(t.crossOrigin="Anonymous"),h.src=o,t.appendChild(h)}}))},A.a6=st,A.a7=function(){return Ji++},A.a8=L,A.a9=Zc,A.aA=function(n){let t=1/0,r=1/0,o=-1/0,h=-1/0;for(const g of n)t=Math.min(t,g.x),r=Math.min(r,g.y),o=Math.max(o,g.x),h=Math.max(h,g.y);return[t,r,o,h]},A.aB=yr,A.aC=_e,A.aD=function(n,t,r,o,h=!1){if(!r[0]&&!r[1])return[0,0];const g=h?o==="map"?-n.bearingInRadians:0:o==="viewport"?n.bearingInRadians:0;if(g){const _=Math.sin(g),x=Math.cos(g);r=[r[0]*x-r[1]*_,r[0]*_+r[1]*x]}return[h?r[0]:_e(t,r[0],n.zoom),h?r[1]:_e(t,r[1],n.zoom)]},A.aF=kh,A.aG=Bu,A.aH=zd,A.aI=Nf,A.aJ=wr,A.aK=Un,A.aL=le,A.aM=Wt,A.aN=Ii,A.aO=di,A.aP=Yt,A.aQ=If,A.aR=hi,A.aS=Gt,A.aT=function(n){var t=new tt(3);return t[0]=n[0],t[1]=n[1],t[2]=n[2],t},A.aU=function(n,t,r){return n[0]=t[0]-r[0],n[1]=t[1]-r[1],n[2]=t[2]-r[2],n},A.aV=function(n,t){var r=t[0],o=t[1],h=t[2],g=r*r+o*o+h*h;return g>0&&(g=1/Math.sqrt(g)),n[0]=t[0]*g,n[1]=t[1]*g,n[2]=t[2]*g,n},A.aW=mi,A.aX=function(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]},A.aY=function(n,t,r){return n[0]=t[0]*r[0],n[1]=t[1]*r[1],n[2]=t[2]*r[2],n[3]=t[3]*r[3],n},A.aZ=Tt,A.a_=function(n,t,r){const o=t[0]*r[0]+t[1]*r[1]+t[2]*r[2];return o===0?null:(-(n[0]*r[0]+n[1]*r[1]+n[2]*r[2])-r[3])/o},A.aa=Js,A.ab=Ta,A.ac=Bd,A.ad=function(n){const t={};if(n.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((r,o,h,g)=>{const _=h||g;return t[o]=!_||_.toLowerCase(),""})),t["max-age"]){const r=parseInt(t["max-age"],10);isNaN(r)?delete t["max-age"]:t["max-age"]=r}return t},A.ae=gs,A.af=function(n){return Math.pow(2,n)},A.ag=Ze,A.ah=zt,A.ai=85.051129,A.aj=Bh,A.ak=function(n){return Math.log(n)/Math.LN2},A.al=function(n){var t=n[0],r=n[1];return t*t+r*r},A.am=function(n,t){const r=[];for(const o in n)o in t||r.push(o);return r},A.an=function(n,t){let r=0,o=0;if(n.kind==="constant")o=n.layoutSize;else if(n.kind!=="source"){const{interpolationType:h,minZoom:g,maxZoom:_}=n,x=h?zt(on.interpolationFactor(h,t,g,_),0,1):0;n.kind==="camera"?o=os.number(n.minSize,n.maxSize,x):r=x}return{uSizeT:r,uSize:o}},A.ap=function(n,{uSize:t,uSizeT:r},{lowerSize:o,upperSize:h}){return n.kind==="source"?o/Aa:n.kind==="composite"?os.number(o/Aa,h/Aa,r):t},A.aq=function(n,t){var r=t[0],o=t[1],h=t[2],g=t[3],_=t[4],x=t[5],b=t[6],T=t[7],C=t[8],D=t[9],O=t[10],F=t[11],U=t[12],$=t[13],Q=t[14],re=t[15],be=r*x-o*_,he=r*b-h*_,pe=r*T-g*_,Ie=o*b-h*x,Ne=o*T-g*x,Qe=h*T-g*b,pt=C*$-D*U,lt=C*Q-O*U,dt=C*re-F*U,At=D*Q-O*$,mt=D*re-F*$,ft=O*re-F*Q,$e=be*ft-he*mt+pe*At+Ie*dt-Ne*lt+Qe*pt;return $e?(n[0]=(x*ft-b*mt+T*At)*($e=1/$e),n[1]=(h*mt-o*ft-g*At)*$e,n[2]=($*Qe-Q*Ne+re*Ie)*$e,n[3]=(O*Ne-D*Qe-F*Ie)*$e,n[4]=(b*dt-_*ft-T*lt)*$e,n[5]=(r*ft-h*dt+g*lt)*$e,n[6]=(Q*pe-U*Qe-re*he)*$e,n[7]=(C*Qe-O*pe+F*he)*$e,n[8]=(_*mt-x*dt+T*pt)*$e,n[9]=(o*dt-r*mt-g*pt)*$e,n[10]=(U*Ne-$*pe+re*be)*$e,n[11]=(D*pe-C*Ne-F*be)*$e,n[12]=(x*lt-_*At-b*pt)*$e,n[13]=(r*At-o*lt+h*pt)*$e,n[14]=($*he-U*Ie-Q*be)*$e,n[15]=(C*Ie-D*he+O*be)*$e,n):null},A.ar=ht,A.as=function(n){var t=n[0],r=n[1];return Math.sqrt(t*t+r*r)},A.at=function(n){return n[0]=0,n[1]=0,n},A.au=function(n,t,r){return n[0]=t[0]*r,n[1]=t[1]*r,n},A.av=Gc,A.aw=Ir,A.ax=function(n,t,r,o){const h=t.y-n.y,g=t.x-n.x,_=o.y-r.y,x=o.x-r.x,b=_*g-x*h;if(b===0)return null;const T=(x*(n.y-r.y)-_*(n.x-r.x))/b;return new H(n.x+T*g,n.y+T*h)},A.ay=Df,A.az=tf,A.b=da,A.b$=class extends f{},A.b0=function(n,t,r){return n[0]=t[0]*r,n[1]=t[1]*r,n[2]=t[2]*r,n[3]=t[3]*r,n},A.b1=function(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]+n[3]},A.b2=Rf,A.b3=zi,A.b4=function(n,t,r,o,h){var g=1/Math.tan(t/2);if(n[0]=g/r,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=g,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[11]=-1,n[12]=0,n[13]=0,n[15]=0,h!=null&&h!==1/0){var _=1/(o-h);n[10]=(h+o)*_,n[14]=2*h*o*_}else n[10]=-1,n[14]=-2*o;return n},A.b5=function(n){var t=new tt(16);return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],t},A.b6=function(n,t,r){var o=Math.sin(r),h=Math.cos(r),g=t[0],_=t[1],x=t[2],b=t[3],T=t[4],C=t[5],D=t[6],O=t[7];return t!==n&&(n[8]=t[8],n[9]=t[9],n[10]=t[10],n[11]=t[11],n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15]),n[0]=g*h+T*o,n[1]=_*h+C*o,n[2]=x*h+D*o,n[3]=b*h+O*o,n[4]=T*h-g*o,n[5]=C*h-_*o,n[6]=D*h-x*o,n[7]=O*h-b*o,n},A.b7=function(n,t,r){var o=Math.sin(r),h=Math.cos(r),g=t[4],_=t[5],x=t[6],b=t[7],T=t[8],C=t[9],D=t[10],O=t[11];return t!==n&&(n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15]),n[4]=g*h+T*o,n[5]=_*h+C*o,n[6]=x*h+D*o,n[7]=b*h+O*o,n[8]=T*h-g*o,n[9]=C*h-_*o,n[10]=D*h-x*o,n[11]=O*h-b*o,n},A.b8=function(){const n=new Float32Array(16);return Ze(n),n},A.b9=function(){const n=new Float64Array(16);return Ze(n),n},A.bA=function(n,t){const r=Xe(n,360),o=Xe(t,360),h=o-r,g=o>r?h-360:h+360;return Math.abs(h)<Math.abs(g)?h:g},A.bB=function(n){return n[0]=0,n[1]=0,n[2]=0,n},A.bC=function(n,t,r,o){const h=Math.sqrt(n*n+t*t),g=Math.sqrt(r*r+o*o);n/=h,t/=h,r/=g,o/=g;const _=Math.acos(n*r+t*o);return-t*r+n*o>0?_:-_},A.bD=function(n,t){const r=Xe(n,2*Math.PI),o=Xe(t,2*Math.PI);return Math.min(Math.abs(r-o),Math.abs(r-o+2*Math.PI),Math.abs(r-o-2*Math.PI))},A.bE=function(){const n={},t=Me.$version;for(const r in Me.$root){const o=Me.$root[r];if(o.required){let h=null;h=r==="version"?t:o.type==="array"?[]:{},h!=null&&(n[r]=h)}}return n},A.bF=Cc,A.bG=me,A.bH=function n(t,r){if(Array.isArray(t)){if(!Array.isArray(r)||t.length!==r.length)return!1;for(let o=0;o<t.length;o++)if(!n(t[o],r[o]))return!1;return!0}if(typeof t=="object"&&t!==null&&r!==null){if(typeof r!="object"||Object.keys(t).length!==Object.keys(r).length)return!1;for(const o in t)if(!n(t[o],r[o]))return!1;return!0}return t===r},A.bI=function(n){n=n.slice();const t=Object.create(null);for(let r=0;r<n.length;r++)t[n[r].id]=n[r];for(let r=0;r<n.length;r++)"ref"in n[r]&&(n[r]=oi(n[r],t[n[r].ref]));return n},A.bJ=function(n){if(n.type==="custom")return new lm(n);switch(n.type){case"background":return new zf(n);case"circle":return new tp(n);case"color-relief":return new ap(n);case"fill":return new Nl(n);case"fill-extrusion":return new bi(n);case"heatmap":return new cf(n);case"hillshade":return new ip(n);case"line":return new Ca(n);case"raster":return new Dh(n);case"symbol":return new Rh(n)}},A.bK=xr,A.bL=function(n,t){if(!n)return[{command:"setStyle",args:[t]}];let r=[];try{if(!kt(n.version,t.version))return[{command:"setStyle",args:[t]}];kt(n.center,t.center)||r.push({command:"setCenter",args:[t.center]}),kt(n.state,t.state)||r.push({command:"setGlobalState",args:[t.state]}),kt(n.centerAltitude,t.centerAltitude)||r.push({command:"setCenterAltitude",args:[t.centerAltitude]}),kt(n.zoom,t.zoom)||r.push({command:"setZoom",args:[t.zoom]}),kt(n.bearing,t.bearing)||r.push({command:"setBearing",args:[t.bearing]}),kt(n.pitch,t.pitch)||r.push({command:"setPitch",args:[t.pitch]}),kt(n.roll,t.roll)||r.push({command:"setRoll",args:[t.roll]}),kt(n.sprite,t.sprite)||r.push({command:"setSprite",args:[t.sprite]}),kt(n.glyphs,t.glyphs)||r.push({command:"setGlyphs",args:[t.glyphs]}),kt(n.transition,t.transition)||r.push({command:"setTransition",args:[t.transition]}),kt(n.light,t.light)||r.push({command:"setLight",args:[t.light]}),kt(n.terrain,t.terrain)||r.push({command:"setTerrain",args:[t.terrain]}),kt(n.sky,t.sky)||r.push({command:"setSky",args:[t.sky]}),kt(n.projection,t.projection)||r.push({command:"setProjection",args:[t.projection]});const o={},h=[];(function(_,x,b,T){let C;for(C in x=x||{},_=_||{})Object.prototype.hasOwnProperty.call(_,C)&&(Object.prototype.hasOwnProperty.call(x,C)||jr(C,b,T));for(C in x)Object.prototype.hasOwnProperty.call(x,C)&&(Object.prototype.hasOwnProperty.call(_,C)?kt(_[C],x[C])||(_[C].type==="geojson"&&x[C].type==="geojson"&&Fi(_,x,C)?Kt(b,{command:"setGeoJSONSourceData",args:[C,x[C].data]}):Zr(C,x,b,T)):Bi(C,x,b))})(n.sources,t.sources,h,o);const g=[];n.layers&&n.layers.forEach((_=>{"source"in _&&o[_.source]?r.push({command:"removeLayer",args:[_.id]}):g.push(_)})),r=r.concat(h),(function(_,x,b){x=x||[];const T=(_=_||[]).map(qt),C=x.map(qt),D=_.reduce(er,{}),O=x.reduce(er,{}),F=T.slice(),U=Object.create(null);let $,Q,re,be,he;for(let pe=0,Ie=0;pe<T.length;pe++)$=T[pe],Object.prototype.hasOwnProperty.call(O,$)?Ie++:(Kt(b,{command:"removeLayer",args:[$]}),F.splice(F.indexOf($,Ie),1));for(let pe=0,Ie=0;pe<C.length;pe++)$=C[C.length-1-pe],F[F.length-1-pe]!==$&&(Object.prototype.hasOwnProperty.call(D,$)?(Kt(b,{command:"removeLayer",args:[$]}),F.splice(F.lastIndexOf($,F.length-Ie),1)):Ie++,be=F[F.length-pe],Kt(b,{command:"addLayer",args:[O[$],be]}),F.splice(F.length-pe,0,$),U[$]=!0);for(let pe=0;pe<C.length;pe++)if($=C[pe],Q=D[$],re=O[$],!U[$]&&!kt(Q,re))if(kt(Q.source,re.source)&&kt(Q["source-layer"],re["source-layer"])&&kt(Q.type,re.type)){for(he in Nt(Q.layout,re.layout,b,$,null,"setLayoutProperty"),Nt(Q.paint,re.paint,b,$,null,"setPaintProperty"),kt(Q.filter,re.filter)||Kt(b,{command:"setFilter",args:[$,re.filter]}),kt(Q.minzoom,re.minzoom)&&kt(Q.maxzoom,re.maxzoom)||Kt(b,{command:"setLayerZoomRange",args:[$,re.minzoom,re.maxzoom]}),Q)Object.prototype.hasOwnProperty.call(Q,he)&&he!=="layout"&&he!=="paint"&&he!=="filter"&&he!=="metadata"&&he!=="minzoom"&&he!=="maxzoom"&&(he.indexOf("paint.")===0?Nt(Q[he],re[he],b,$,he.slice(6),"setPaintProperty"):kt(Q[he],re[he])||Kt(b,{command:"setLayerProperty",args:[$,he,re[he]]}));for(he in re)Object.prototype.hasOwnProperty.call(re,he)&&!Object.prototype.hasOwnProperty.call(Q,he)&&he!=="layout"&&he!=="paint"&&he!=="filter"&&he!=="metadata"&&he!=="minzoom"&&he!=="maxzoom"&&(he.indexOf("paint.")===0?Nt(Q[he],re[he],b,$,he.slice(6),"setPaintProperty"):kt(Q[he],re[he])||Kt(b,{command:"setLayerProperty",args:[$,he,re[he]]}))}else Kt(b,{command:"removeLayer",args:[$]}),be=F[F.lastIndexOf($)+1],Kt(b,{command:"addLayer",args:[re,be]})})(g,t.layers,r)}catch(o){console.warn("Unable to compute style diff:",o),r=[{command:"setStyle",args:[t]}]}return r},A.bM=function(n){const t=[],r=n.id;return r===void 0&&t.push({message:`layers.${r}: missing required property "id"`}),n.render===void 0&&t.push({message:`layers.${r}: missing required method "render"`}),n.renderingMode&&n.renderingMode!=="2d"&&n.renderingMode!=="3d"&&t.push({message:`layers.${r}: property "renderingMode" must be either "2d" or "3d"`}),t},A.bN=zn,A.bO=kn,A.bP=class extends Mn{constructor(n,t){super(n,t),this.current=0}set(n){this.current!==n&&(this.current=n,this.gl.uniform1i(this.location,n))}},A.bQ=_r,A.bR=class extends Mn{constructor(n,t){super(n,t),this.current=Nn}set(n){if(n[12]!==this.current[12]||n[0]!==this.current[0])return this.current=n,void this.gl.uniformMatrix4fv(this.location,!1,n);for(let t=1;t<16;t++)if(n[t]!==this.current[t]){this.current=n,this.gl.uniformMatrix4fv(this.location,!1,n);break}}},A.bS=nr,A.bT=class extends Mn{constructor(n,t){super(n,t),this.current=[0,0,0]}set(n){n[0]===this.current[0]&&n[1]===this.current[1]&&n[2]===this.current[2]||(this.current=n,this.gl.uniform3f(this.location,n[0],n[1],n[2]))}},A.bU=class extends Mn{constructor(n,t){super(n,t),this.current=[0,0]}set(n){n[0]===this.current[0]&&n[1]===this.current[1]||(this.current=n,this.gl.uniform2f(this.location,n[0],n[1]))}},A.bV=ut,A.bW=function(n,t){var r=Math.sin(t),o=Math.cos(t);return n[0]=o,n[1]=r,n[2]=0,n[3]=-r,n[4]=o,n[5]=0,n[6]=0,n[7]=0,n[8]=1,n},A.bX=function(n,t,r){var o=t[0],h=t[1],g=t[2];return n[0]=o*r[0]+h*r[3]+g*r[6],n[1]=o*r[1]+h*r[4]+g*r[7],n[2]=o*r[2]+h*r[5]+g*r[8],n},A.bY=function(n,t,r,o,h,g,_){var x=1/(t-r),b=1/(o-h),T=1/(g-_);return n[0]=-2*x,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=-2*b,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=2*T,n[11]=0,n[12]=(t+r)*x,n[13]=(h+o)*b,n[14]=(_+g)*T,n[15]=1,n},A.bZ=class extends Mn{constructor(n,t){super(n,t),this.current=new Array}set(n){if(n!=this.current){this.current=n;const t=new Float32Array(4*n.length);for(let r=0;r<n.length;r++)t[4*r]=n[r].r,t[4*r+1]=n[r].g,t[4*r+2]=n[r].b,t[4*r+3]=n[r].a;this.gl.uniform4fv(this.location,t)}}},A.b_=class extends Mn{constructor(n,t){super(n,t),this.current=new Array}set(n){if(n!=this.current){this.current=n;const t=new Float32Array(n);this.gl.uniform1fv(this.location,t)}}},A.ba=function(){return new Float64Array(16)},A.bb=function(n,t,r){const o=new Float64Array(4);return Ve(o,n,t-90,r),o},A.bc=function(n,t,r,o){var h,g,_,x,b,T=t[0],C=t[1],D=t[2],O=t[3],F=r[0],U=r[1],$=r[2],Q=r[3];return(g=T*F+C*U+D*$+O*Q)<0&&(g=-g,F=-F,U=-U,$=-$,Q=-Q),1-g>qe?(h=Math.acos(g),_=Math.sin(h),x=Math.sin((1-o)*h)/_,b=Math.sin(o*h)/_):(x=1-o,b=o),n[0]=x*T+b*F,n[1]=x*C+b*U,n[2]=x*D+b*$,n[3]=x*O+b*Q,n},A.bd=function(n){const t=new Float64Array(9);var r,o,h,g,_,x,b,T,C,D,O,F,U,$,Q,re,be,he;D=(h=(o=n)[0])*(b=h+h),O=(g=o[1])*b,U=(_=o[2])*b,$=_*(T=g+g),re=(x=o[3])*b,be=x*T,he=x*(C=_+_),(r=t)[0]=1-(F=g*T)-(Q=_*C),r[3]=O-he,r[6]=U+be,r[1]=O+he,r[4]=1-D-Q,r[7]=$-re,r[2]=U-be,r[5]=$+re,r[8]=1-D-F;const pe=Yt(-Math.asin(zt(t[2],-1,1)));let Ie,Ne;return Math.hypot(t[5],t[8])<.001?(Ie=0,Ne=-Yt(Math.atan2(t[3],t[4]))):(Ie=Yt(t[5]===0&&t[8]===0?0:Math.atan2(t[5],t[8])),Ne=Yt(t[1]===0&&t[0]===0?0:Math.atan2(t[1],t[0]))),{roll:Ie,pitch:pe+90,bearing:Ne}},A.be=function(n,t){return n.roll==t.roll&&n.pitch==t.pitch&&n.bearing==t.bearing},A.bf=ai,A.bg=co,A.bh=Ma,A.bi=Su,A.bj=Zi,A.bk=vt,A.bl=at,A.bm=gr,A.bn=function(n,t,r,o,h){return vt(o,h,zt((n-t)/(r-t),0,1))},A.bo=Xe,A.bp=function(){return new Float64Array(3)},A.bq=function(n,t,r,o){return n[0]=t[0]+r[0]*o,n[1]=t[1]+r[1]*o,n[2]=t[2]+r[2]*o,n},A.br=Ve,A.bs=function(n,t,r){var o=r[0],h=r[1],g=r[2],_=r[3],x=t[0],b=t[1],T=t[2],C=h*T-g*b,D=g*x-o*T,O=o*b-h*x;return n[0]=x+_*(C+=C)+h*(O+=O)-g*(D+=D),n[1]=b+_*D+g*C-o*O,n[2]=T+_*O+o*D-h*C,n},A.bt=function(n,t,r){const o=(h=[n[0],n[1],n[2],t[0],t[1],t[2],r[0],r[1],r[2]])[0]*((C=h[8])*(_=h[4])-(x=h[5])*(T=h[7]))+h[1]*(-C*(g=h[3])+x*(b=h[6]))+h[2]*(T*g-_*b);var h,g,_,x,b,T,C;if(o===0)return null;const D=mi([],[t[0],t[1],t[2]],[r[0],r[1],r[2]]),O=mi([],[r[0],r[1],r[2]],[n[0],n[1],n[2]]),F=mi([],[n[0],n[1],n[2]],[t[0],t[1],t[2]]),U=hi([],D,-n[3]);return Gt(U,U,hi([],O,-t[3])),Gt(U,U,hi([],F,-r[3])),hi(U,U,1/o),U},A.bu=Lh,A.bv=function(){return new Float64Array(4)},A.bw=function(n,t,r,o){var h=[],g=[];return h[0]=t[0]-r[0],h[1]=t[1]-r[1],h[2]=t[2]-r[2],g[0]=h[0]*Math.cos(o)-h[1]*Math.sin(o),g[1]=h[0]*Math.sin(o)+h[1]*Math.cos(o),g[2]=h[2],n[0]=g[0]+r[0],n[1]=g[1]+r[1],n[2]=g[2]+r[2],n},A.bx=function(n,t,r,o){var h=[],g=[];return h[0]=t[0]-r[0],h[1]=t[1]-r[1],h[2]=t[2]-r[2],g[0]=h[0],g[1]=h[1]*Math.cos(o)-h[2]*Math.sin(o),g[2]=h[1]*Math.sin(o)+h[2]*Math.cos(o),n[0]=g[0]+r[0],n[1]=g[1]+r[1],n[2]=g[2]+r[2],n},A.by=function(n,t,r,o){var h=[],g=[];return h[0]=t[0]-r[0],h[1]=t[1]-r[1],h[2]=t[2]-r[2],g[0]=h[2]*Math.sin(o)+h[0]*Math.cos(o),g[1]=h[1],g[2]=h[2]*Math.cos(o)-h[0]*Math.sin(o),n[0]=g[0]+r[0],n[1]=g[1]+r[1],n[2]=g[2]+r[2],n},A.bz=function(n,t,r){var o=Math.sin(r),h=Math.cos(r),g=t[0],_=t[1],x=t[2],b=t[3],T=t[8],C=t[9],D=t[10],O=t[11];return t!==n&&(n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15]),n[0]=g*h-T*o,n[1]=_*h-C*o,n[2]=x*h-D*o,n[3]=b*h-O*o,n[8]=g*o+T*h,n[9]=_*o+C*h,n[10]=x*o+D*h,n[11]=b*o+O*h,n},A.c=ye,A.c0=Vn,A.c1=class extends a{},A.c2=_d,A.c3=function(n){return n<=1?1:Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))},A.c4=gd,A.c5=function(n,t,r){var o=t[0],h=t[1],g=t[2],_=r[3]*o+r[7]*h+r[11]*g+r[15];return n[0]=(r[0]*o+r[4]*h+r[8]*g+r[12])/(_=_||1),n[1]=(r[1]*o+r[5]*h+r[9]*g+r[13])/_,n[2]=(r[2]*o+r[6]*h+r[10]*g+r[14])/_,n},A.c6=class extends Tn{},A.c7=class extends P{},A.c8=function(n,t){return n[0]===t[0]&&n[1]===t[1]&&n[2]===t[2]&&n[3]===t[3]&&n[4]===t[4]&&n[5]===t[5]&&n[6]===t[6]&&n[7]===t[7]&&n[8]===t[8]&&n[9]===t[9]&&n[10]===t[10]&&n[11]===t[11]&&n[12]===t[12]&&n[13]===t[13]&&n[14]===t[14]&&n[15]===t[15]},A.c9=function(n,t){var r=n[0],o=n[1],h=n[2],g=n[3],_=n[4],x=n[5],b=n[6],T=n[7],C=n[8],D=n[9],O=n[10],F=n[11],U=n[12],$=n[13],Q=n[14],re=n[15],be=t[0],he=t[1],pe=t[2],Ie=t[3],Ne=t[4],Qe=t[5],pt=t[6],lt=t[7],dt=t[8],At=t[9],mt=t[10],ft=t[11],$e=t[12],Ot=t[13],Ut=t[14],Rt=t[15];return Math.abs(r-be)<=qe*Math.max(1,Math.abs(r),Math.abs(be))&&Math.abs(o-he)<=qe*Math.max(1,Math.abs(o),Math.abs(he))&&Math.abs(h-pe)<=qe*Math.max(1,Math.abs(h),Math.abs(pe))&&Math.abs(g-Ie)<=qe*Math.max(1,Math.abs(g),Math.abs(Ie))&&Math.abs(_-Ne)<=qe*Math.max(1,Math.abs(_),Math.abs(Ne))&&Math.abs(x-Qe)<=qe*Math.max(1,Math.abs(x),Math.abs(Qe))&&Math.abs(b-pt)<=qe*Math.max(1,Math.abs(b),Math.abs(pt))&&Math.abs(T-lt)<=qe*Math.max(1,Math.abs(T),Math.abs(lt))&&Math.abs(C-dt)<=qe*Math.max(1,Math.abs(C),Math.abs(dt))&&Math.abs(D-At)<=qe*Math.max(1,Math.abs(D),Math.abs(At))&&Math.abs(O-mt)<=qe*Math.max(1,Math.abs(O),Math.abs(mt))&&Math.abs(F-ft)<=qe*Math.max(1,Math.abs(F),Math.abs(ft))&&Math.abs(U-$e)<=qe*Math.max(1,Math.abs(U),Math.abs($e))&&Math.abs($-Ot)<=qe*Math.max(1,Math.abs($),Math.abs(Ot))&&Math.abs(Q-Ut)<=qe*Math.max(1,Math.abs(Q),Math.abs(Ut))&&Math.abs(re-Rt)<=qe*Math.max(1,Math.abs(re),Math.abs(Rt))},A.cA=function(n,t){Z.REGISTERED_PROTOCOLS[n]=t},A.cB=function(n){delete Z.REGISTERED_PROTOCOLS[n]},A.cC=function(n,t){const r={};for(let h=0;h<n.length;h++){const g=t&&t[n[h].id]||Vo(n[h]);t&&(t[n[h].id]=g);let _=r[g];_||(_=r[g]=[]),_.push(n[h])}const o=[];for(const h in r)o.push(r[h]);return o},A.cD=yt,A.cE=Rp,A.cF=Od,A.cG=wp,A.cH=function(n){n.bucket.createArrays(),n.bucket.tilePixelRatio=bt/(512*n.bucket.overscaling),n.bucket.compareText={},n.bucket.iconsNeedLinear=!1;const t=n.bucket.layers[0],r=t.layout,o=t._unevaluatedLayout._values,h={layoutIconSize:o["icon-size"].possiblyEvaluate(new Ai(n.bucket.zoom+1),n.canonical),layoutTextSize:o["text-size"].possiblyEvaluate(new Ai(n.bucket.zoom+1),n.canonical),textMaxSize:o["text-size"].possiblyEvaluate(new Ai(18))};if(n.bucket.textSizeData.kind==="composite"){const{minZoom:T,maxZoom:C}=n.bucket.textSizeData;h.compositeTextSizes=[o["text-size"].possiblyEvaluate(new Ai(T),n.canonical),o["text-size"].possiblyEvaluate(new Ai(C),n.canonical)]}if(n.bucket.iconSizeData.kind==="composite"){const{minZoom:T,maxZoom:C}=n.bucket.iconSizeData;h.compositeIconSizes=[o["icon-size"].possiblyEvaluate(new Ai(T),n.canonical),o["icon-size"].possiblyEvaluate(new Ai(C),n.canonical)]}const g=r.get("text-line-height")*yr,_=r.get("text-rotation-alignment")!=="viewport"&&r.get("symbol-placement")!=="point",x=r.get("text-keep-upright"),b=r.get("text-size");for(const T of n.bucket.features){const C=r.get("text-font").evaluate(T,{},n.canonical).join(","),D=b.evaluate(T,{},n.canonical),O=h.layoutTextSize.evaluate(T,{},n.canonical),F=h.layoutIconSize.evaluate(T,{},n.canonical),U={horizontal:{},vertical:void 0},$=T.text;let Q,re=[0,0];if($){const pe=$.toString(),Ie=r.get("text-letter-spacing").evaluate(T,{},n.canonical)*yr,Ne=dh(pe)?Ie:0,Qe=r.get("text-anchor").evaluate(T,{},n.canonical),pt=Of(t,T,n.canonical);if(!pt){const mt=r.get("text-radial-offset").evaluate(T,{},n.canonical);re=mt?Ka(Qe,[mt*yr,Hc]):r.get("text-offset").evaluate(T,{},n.canonical).map((ft=>ft*yr))}let lt=_?"center":r.get("text-justify").evaluate(T,{},n.canonical);const dt=r.get("symbol-placement")==="point"?r.get("text-max-width").evaluate(T,{},n.canonical)*yr:1/0,At=()=>{n.bucket.allowVerticalPlacement&&Ua(pe)&&(U.vertical=Ah($,n.glyphMap,n.glyphPositions,n.imagePositions,C,dt,g,Qe,"left",Ne,re,A.ao.vertical,!0,O,D))};if(!_&&pt){const mt=new Set;if(lt==="auto")for(let $e=0;$e<pt.values.length;$e+=2)mt.add(Bu(pt.values[$e]));else mt.add(lt);let ft=!1;for(const $e of mt)if(!U.horizontal[$e])if(ft)U.horizontal[$e]=U.horizontal[0];else{const Ot=Ah($,n.glyphMap,n.glyphPositions,n.imagePositions,C,dt,g,"center",$e,Ne,re,A.ao.horizontal,!1,O,D);Ot&&(U.horizontal[$e]=Ot,ft=Ot.positionedLines.length===1)}At()}else{lt==="auto"&&(lt=Bu(Qe));const mt=Ah($,n.glyphMap,n.glyphPositions,n.imagePositions,C,dt,g,Qe,lt,Ne,re,A.ao.horizontal,!1,O,D);mt&&(U.horizontal[lt]=mt),At(),Ua(pe)&&_&&x&&(U.vertical=Ah($,n.glyphMap,n.glyphPositions,n.imagePositions,C,dt,g,Qe,lt,Ne,re,A.ao.vertical,!1,O,D))}}let be=!1;if(T.icon&&T.icon.name){const pe=n.imageMap[T.icon.name];pe&&(Q=am(n.imagePositions[T.icon.name],r.get("icon-offset").evaluate(T,{},n.canonical),r.get("icon-anchor").evaluate(T,{},n.canonical)),be=!!pe.sdf,n.bucket.sdfIcons===void 0?n.bucket.sdfIcons=be:n.bucket.sdfIcons!==be&&$i("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(pe.pixelRatio!==n.bucket.pixelRatio||r.get("icon-rotate").constantOr(1)!==0)&&(n.bucket.iconsNeedLinear=!0))}const he=Fp(U.horizontal)||U.vertical;n.bucket.iconsInText=!!he&&he.iconsInText,(he||Q)&&al(n.bucket,T,U,Q,n.imageMap,h,O,F,re,be,n.canonical,n.subdivisionGranularity)}n.showCollisionBoxes&&n.bucket.generateCollisionDebugBuffers()},A.cI=mo,A.cJ=ca,A.cK=Pu,A.cL=_f,A.cM=Fc,A.cN=class{constructor(n){this._marks={start:[n.url,"start"].join("#"),end:[n.url,"end"].join("#"),measure:n.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let n=performance.getEntriesByName(this._marks.measure);return n.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),n=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),n}},A.cO=function(n,t,r,o,h){return u(this,void 0,void 0,(function*(){if(et())try{return yield ms(n,t,r,o,h)}catch{}return(function(g,_,x,b,T){const C=g.width,D=g.height;Qn&&Qa||(Qn=new OffscreenCanvas(C,D),Qa=Qn.getContext("2d",{willReadFrequently:!0})),Qn.width=C,Qn.height=D,Qa.drawImage(g,0,0,C,D);const O=Qa.getImageData(_,x,b,T);return Qa.clearRect(0,0,C,D),O.data})(n,t,r,o,h)}))},A.cP=xd,A.cQ=ne,A.cR=Cu,A.cS=jc,A.cT=cs,A.cU=function(n,t){const r=new Map;if(n!=null)if(n.type==="Feature")r.set(qc(n,t),n);else for(const o of n.features)r.set(qc(o,t),o);return r},A.cV=function(n,t){if(n==null)return!0;if(n.type==="Feature")return qc(n,t)!=null;if(n.type==="FeatureCollection"){const r=new Set;for(const o of n.features){const h=qc(o,t);if(h==null||r.has(h))return!1;r.add(h)}return!0}return!1},A.cW=function(n,t,r){var o,h,g,_;if(t.removeAll&&n.clear(),t.remove)for(const x of t.remove)n.delete(x);if(t.add)for(const x of t.add){const b=qc(x,r);b!=null&&n.set(b,x)}if(t.update)for(const x of t.update){let b=n.get(x.id);if(b==null)continue;const T=!x.removeAllProperties&&(((o=x.removeProperties)===null||o===void 0?void 0:o.length)>0||((h=x.addOrUpdateProperties)===null||h===void 0?void 0:h.length)>0);if((x.newGeometry||x.removeAllProperties||T)&&(b=Object.assign({},b),n.set(x.id,b),T&&(b.properties=Object.assign({},b.properties))),x.newGeometry&&(b.geometry=x.newGeometry),x.removeAllProperties)b.properties={};else if(((g=x.removeProperties)===null||g===void 0?void 0:g.length)>0)for(const C of x.removeProperties)Object.prototype.hasOwnProperty.call(b.properties,C)&&delete b.properties[C];if(((_=x.addOrUpdateProperties)===null||_===void 0?void 0:_.length)>0)for(const{key:C,value:D}of x.addOrUpdateProperties)b.properties[C]=D}},A.cX=Sn,A.ca=function(n,t){return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[8]=t[8],n[9]=t[9],n[10]=t[10],n[11]=t[11],n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15],n},A.cb=n=>n.type==="symbol",A.cc=n=>n.type==="circle",A.cd=n=>n.type==="heatmap",A.ce=n=>n.type==="line",A.cf=n=>n.type==="fill",A.cg=n=>n.type==="fill-extrusion",A.ch=n=>n.type==="hillshade",A.ci=n=>n.type==="color-relief",A.cj=n=>n.type==="raster",A.ck=n=>n.type==="background",A.cl=n=>n.type==="custom",A.cm=wt,A.cn=function(n,t,r){const o=nt(t.x-r.x,t.y-r.y),h=nt(n.x-r.x,n.y-r.y);var g,_;return Yt(Math.atan2(o[0]*h[1]-o[1]*h[0],(g=o)[0]*(_=h)[0]+g[1]*_[1]))},A.co=Ft,A.cp=function(n,t){return sr[t]&&(n instanceof MouseEvent||n instanceof WheelEvent)},A.cq=function(n,t){return Ti[t]&&"touches"in n},A.cr=function(n){return Ti[n]||sr[n]},A.cs=function(n,t,r){var o=t[0],h=t[1];return n[0]=r[0]*o+r[4]*h+r[12],n[1]=r[1]*o+r[5]*h+r[13],n},A.ct=function(n,t){const{x:r,y:o}=Oh.fromLngLat(t);return!(n<0||n>25||o<0||o>=1||r<0||r>=1)},A.cu=function(n,t){return n[0]=t[0],n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=t[1],n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=t[2],n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,n},A.cv=class extends ao{},A.cw=ju,A.cy=function(n){return n.message===In},A.cz=ce,A.d=Re,A.e=si,A.f=n=>u(void 0,void 0,void 0,(function*(){if(n.byteLength===0)return createImageBitmap(new ImageData(1,1));const t=new Blob([new Uint8Array(n)],{type:"image/png"});try{return createImageBitmap(t)}catch(r){throw new Error(`Could not load image because of ${r.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}})),A.g=Y,A.h=n=>new Promise(((t,r)=>{const o=new Image;o.onload=()=>{t(o),URL.revokeObjectURL(o.src),o.onload=null,window.requestAnimationFrame((()=>{o.src=Wn}))},o.onerror=()=>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."));const h=new Blob([new Uint8Array(n)],{type:"image/png"});o.src=n.byteLength?URL.createObjectURL(h):Wn})),A.i=ha,A.j=(n,t)=>ve(si(n,{type:"json"}),t),A.k=Ye,A.l=rt,A.m=ve,A.n=(n,t)=>ve(si(n,{type:"arrayBuffer"}),t),A.o=function(n){return new Fc(n).readFields(xp,[])},A.p=Ad,A.q=Ic,A.r=On,A.s=Da,A.t=gu,A.u=ui,A.v=Me,A.w=$i,A.x=cd,A.y=zl,A.z=Pl})),V("worker",["./shared"],(function(A){class u{constructor(Z){this.keyCache={},Z&&this.replace(Z)}replace(Z){this._layerConfigs={},this._layers={},this.update(Z,[])}update(Z,Y){for(const ce of Z){this._layerConfigs[ce.id]=ce;const me=this._layers[ce.id]=A.bJ(ce);me._featureFilter=A.aa(me.filter),this.keyCache[ce.id]&&delete this.keyCache[ce.id]}for(const ce of Y)delete this.keyCache[ce],delete this._layerConfigs[ce],delete this._layers[ce];this.familiesBySource={};const W=A.cC(Object.values(this._layerConfigs),this.keyCache);for(const ce of W){const me=ce.map((Ye=>this._layers[Ye.id])),ve=me[0];if(ve.visibility==="none")continue;const Re=ve.source||"";let Te=this.familiesBySource[Re];Te||(Te=this.familiesBySource[Re]={});const Ge=ve.sourceLayer||"_geojsonTileLayer";let rt=Te[Ge];rt||(rt=Te[Ge]=[]),rt.push(me)}}}class H{constructor(Z){const Y={},W=[];for(const Re in Z){const Te=Z[Re],Ge=Y[Re]={};for(const rt in Te){const Ye=Te[+rt];if(!Ye||Ye.bitmap.width===0||Ye.bitmap.height===0)continue;const Ct={x:0,y:0,w:Ye.bitmap.width+2,h:Ye.bitmap.height+2};W.push(Ct),Ge[rt]={rect:Ct,metrics:Ye.metrics}}}const{w:ce,h:me}=A.p(W),ve=new A.q({width:ce||1,height:me||1});for(const Re in Z){const Te=Z[Re];for(const Ge in Te){const rt=Te[+Ge];
vendor: 5,060 bytes, line 173
173if(!rt||rt.bitmap.width===0||rt.bitmap.height===0)continue;const Ye=Y[Re][Ge].rect;A.q.copy(rt.bitmap,ve,{x:0,y:0},{x:Ye.x+1,y:Ye.y+1},rt.bitmap)}}this.image=ve,this.positions=Y}}A.cD("GlyphAtlas",H);class ne{constructor(Z){this.tileID=new A.Z(Z.tileID.overscaledZ,Z.tileID.wrap,Z.tileID.canonical.z,Z.tileID.canonical.x,Z.tileID.canonical.y),this.uid=Z.uid,this.zoom=Z.zoom,this.pixelRatio=Z.pixelRatio,this.tileSize=Z.tileSize,this.source=Z.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=Z.showCollisionBoxes,this.collectResourceTiming=!!Z.collectResourceTiming,this.returnDependencies=!!Z.returnDependencies,this.promoteId=Z.promoteId,this.inFlightDependencies=[],this.globalState=Z.globalState}parse(Z,Y,W,ce,me){return A._(this,void 0,void 0,(function*(){this.status="parsing",this.data=Z,this.collisionBoxArray=new A.a8;const ve=new A.cE(Object.keys(Z.layers).sort()),Re=new A.cF(this.tileID,this.promoteId);Re.bucketLayerIDs=[];const Te={},Ge={featureIndex:Re,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:W,subdivisionGranularity:me},rt=Y.familiesBySource[this.source];for(const Nt in rt){const qt=Z.layers[Nt];if(!qt)continue;qt.version===1&&A.w(`Vector tile source "${this.source}" layer "${Nt}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const er=ve.encode(Nt),st=[];for(let mn=0;mn<qt.length;mn++){const pr=qt.feature(mn),_s=Re.getId(pr,Nt);st.push({feature:pr,id:_s,index:mn,sourceLayerIndex:er})}for(const mn of rt[Nt]){const pr=mn[0];pr.source!==this.source&&A.w(`layer.source = ${pr.source} does not equal this.source = ${this.source}`),pr.minzoom&&this.zoom<Math.floor(pr.minzoom)||pr.maxzoom&&this.zoom>=pr.maxzoom||pr.visibility!=="none"&&(se(mn,this.zoom,W,this.globalState),(Te[pr.id]=pr.createBucket({index:Re.bucketLayerIDs.length,layers:mn,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:er,sourceID:this.source,globalState:this.globalState})).populate(st,Ge,this.tileID.canonical),Re.bucketLayerIDs.push(mn.map((_s=>_s.id))))}}const Ye=A.bN(Ge.glyphDependencies,(Nt=>Object.keys(Nt).map(Number)));this.inFlightDependencies.forEach((Nt=>Nt?.abort())),this.inFlightDependencies=[];let Ct=Promise.resolve({});if(Object.keys(Ye).length){const Nt=new AbortController;this.inFlightDependencies.push(Nt),Ct=ce.sendAsync({type:"GG",data:{stacks:Ye,source:this.source,tileID:this.tileID,type:"glyphs"}},Nt)}const Me=Object.keys(Ge.iconDependencies);let Zt=Promise.resolve({});if(Me.length){const Nt=new AbortController;this.inFlightDependencies.push(Nt),Zt=ce.sendAsync({type:"GI",data:{icons:Me,source:this.source,tileID:this.tileID,type:"icons"}},Nt)}const oi=Object.keys(Ge.patternDependencies);let kt=Promise.resolve({});if(oi.length){const Nt=new AbortController;this.inFlightDependencies.push(Nt),kt=ce.sendAsync({type:"GI",data:{icons:oi,source:this.source,tileID:this.tileID,type:"patterns"}},Nt)}const[Kt,Bi,jr]=yield Promise.all([Ct,Zt,kt]),Zr=new H(Kt),Fi=new A.cG(Bi,jr);for(const Nt in Te){const qt=Te[Nt];qt instanceof A.a9?(se(qt.layers,this.zoom,W,this.globalState),A.cH({bucket:qt,glyphMap:Kt,glyphPositions:Zr.positions,imageMap:Bi,imagePositions:Fi.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:Ge.subdivisionGranularity})):qt.hasPattern&&(qt instanceof A.cI||qt instanceof A.cJ||qt instanceof A.cK)&&(se(qt.layers,this.zoom,W,this.globalState),qt.addFeatures(Ge,this.tileID.canonical,Fi.patternPositions))}return this.status="done",{buckets:Object.values(Te).filter((Nt=>!Nt.isEmpty())),featureIndex:Re,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Zr.image,imageAtlas:Fi,glyphMap:this.returnDependencies?Kt:null,iconMap:this.returnDependencies?Bi:null,glyphPositions:this.returnDependencies?Zr.positions:null}}))}}function se(ye,Z,Y,W){const ce=new A.F(Z);for(const me of ye)me.setGlobalState(W),me.recalculate(ce,Y)}class we{constructor(Z,Y,W){this.actor=Z,this.layerIndex=Y,this.availableImages=W,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(Z,Y){return A._(this,void 0,void 0,(function*(){const W=yield A.n(Z.request,Y);try{return{vectorTile:new A.cL(new A.cM(W.data)),rawData:W.data,cacheControl:W.cacheControl,expires:W.expires}}catch(ce){const me=new Uint8Array(W.data);let ve=`Unable to parse the tile at ${Z.request.url}, `;throw ve+=me[0]===31&&me[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${ce.message}`,new Error(ve)}}))}loadTile(Z){return A._(this,void 0,void 0,(function*(){const Y=Z.uid,W=!!(Z&&Z.request&&Z.request.collectResourceTiming)&&new A.cN(Z.request),ce=new ne(Z);this.loading[Y]=ce;const me=new AbortController;ce.abort=me;try{const ve=yield this.loadVectorTile(Z,me);if(delete this.loading[Y],!ve)return null;const Re=ve.rawData,Te={};ve.expires&&(Te.expires=ve.expires),ve.cacheControl&&(Te.cacheControl=ve.cacheControl);const Ge={};
vendor: 25,669 bytes, line 173
173if(W){const Ye=W.finish();Ye&&(Ge.resourceTiming=JSON.parse(JSON.stringify(Ye)))}ce.vectorTile=ve.vectorTile;const rt=ce.parse(ve.vectorTile,this.layerIndex,this.availableImages,this.actor,Z.subdivisionGranularity);this.loaded[Y]=ce,this.fetching[Y]={rawTileData:Re,cacheControl:Te,resourceTiming:Ge};try{const Ye=yield rt;return A.e({rawTileData:Re.slice(0)},Ye,Te,Ge)}finally{delete this.fetching[Y]}}catch(ve){throw delete this.loading[Y],ce.status="done",this.loaded[Y]=ce,ve}}))}reloadTile(Z){return A._(this,void 0,void 0,(function*(){const Y=Z.uid;if(!this.loaded||!this.loaded[Y])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const W=this.loaded[Y];if(W.showCollisionBoxes=Z.showCollisionBoxes,W.globalState=Z.globalState,W.status==="parsing"){const ce=yield W.parse(W.vectorTile,this.layerIndex,this.availableImages,this.actor,Z.subdivisionGranularity);let me;if(this.fetching[Y]){const{rawTileData:ve,cacheControl:Re,resourceTiming:Te}=this.fetching[Y];delete this.fetching[Y],me=A.e({rawTileData:ve.slice(0)},ce,Re,Te)}else me=ce;return me}if(W.status==="done"&&W.vectorTile)return W.parse(W.vectorTile,this.layerIndex,this.availableImages,this.actor,Z.subdivisionGranularity)}))}abortTile(Z){return A._(this,void 0,void 0,(function*(){const Y=this.loading,W=Z.uid;Y&&Y[W]&&Y[W].abort&&(Y[W].abort.abort(),delete Y[W])}))}removeTile(Z){return A._(this,void 0,void 0,(function*(){this.loaded&&this.loaded[Z.uid]&&delete this.loaded[Z.uid]}))}}class Ce{constructor(){this.loaded={}}loadTile(Z){return A._(this,void 0,void 0,(function*(){const{uid:Y,encoding:W,rawImageData:ce,redFactor:me,greenFactor:ve,blueFactor:Re,baseShift:Te}=Z,Ge=ce.width+2,rt=ce.height+2,Ye=A.b(ce)?new A.R({width:Ge,height:rt},yield A.cO(ce,-1,-1,Ge,rt)):ce,Ct=new A.cP(Y,Ye,W,me,ve,Re,Te);return this.loaded=this.loaded||{},this.loaded[Y]=Ct,Ct}))}removeTile(Z){const Y=this.loaded,W=Z.uid;Y&&Y[W]&&delete Y[W]}}var ie,Fe,He=(function(){if(Fe)return ie;function ye(Y,W){if(Y.length!==0){Z(Y[0],W);for(var ce=1;ce<Y.length;ce++)Z(Y[ce],!W)}}function Z(Y,W){for(var ce=0,me=0,ve=0,Re=Y.length,Te=Re-1;ve<Re;Te=ve++){var Ge=(Y[ve][0]-Y[Te][0])*(Y[Te][1]+Y[ve][1]),rt=ce+Ge;me+=Math.abs(ce)>=Math.abs(Ge)?ce-rt+Ge:Ge-rt+ce,ce=rt}ce+me>=0!=!!W&&Y.reverse()}return Fe=1,ie=function Y(W,ce){var me,ve=W&&W.type;if(ve==="FeatureCollection")for(me=0;me<W.features.length;me++)Y(W.features[me],ce);else if(ve==="GeometryCollection")for(me=0;me<W.geometries.length;me++)Y(W.geometries[me],ce);else if(ve==="Feature")Y(W.geometry,ce);else if(ve==="Polygon")ye(W.coordinates,ce);else if(ve==="MultiPolygon")for(me=0;me<W.coordinates.length;me++)ye(W.coordinates[me],ce);return W}})(),xe=A.cQ(He);class et extends A.cS{constructor(Z,Y){super(new A.cM,0,Y,[],[]),this.feature=Z,this.type=Z.type,this.properties=Z.tags?Z.tags:{},"id"in Z&&(typeof Z.id=="string"?this.id=parseInt(Z.id,10):typeof Z.id!="number"||isNaN(Z.id)||(this.id=Z.id))}loadGeometry(){const Z=[],Y=this.feature.type===1?[this.feature.geometry]:this.feature.geometry;for(const W of Y){const ce=[];for(const me of W)ce.push(new A.P(me[0],me[1]));Z.push(ce)}return Z}}class qe extends A.cR{constructor(Z,Y){super(new A.cM),this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.version=Y?Y.version:1,this.extent=Y?Y.extent:4096,this.length=Z.length,this.features=Z}feature(Z){return new et(this.features[Z],this.extent)}}function tt(ye,Z){Z.writeVarintField(15,ye.version||1),Z.writeStringField(1,ye.name||""),Z.writeVarintField(5,ye.extent||4096);const Y={keys:[],values:[],keycache:{},valuecache:{}};for(let me=0;me<ye.length;me++)Y.feature=ye.feature(me),Z.writeMessage(2,ut,Y);const W=Y.keys;for(const me of W)Z.writeStringField(3,me);const ce=Y.values;for(const me of ce)Z.writeMessage(4,Gt,me)}function ut(ye,Z){if(!ye.feature)return;const Y=ye.feature;Y.id!==void 0&&Z.writeVarintField(1,Y.id),Z.writeMessage(2,Ze,ye),Z.writeVarintField(3,Y.type),Z.writeMessage(4,xt,Y)}function Ze(ye,Z){for(const Y in ye.feature?.properties){let W=ye.feature.properties[Y],ce=ye.keycache[Y];if(W===null)continue;ce===void 0&&(ye.keys.push(Y),ce=ye.keys.length-1,ye.keycache[Y]=ce),Z.writeVarint(ce),typeof W!="string"&&typeof W!="boolean"&&typeof W!="number"&&(W=JSON.stringify(W));const me=typeof W+":"+W;let ve=ye.valuecache[me];ve===void 0&&(ye.values.push(W),ve=ye.values.length-1,ye.valuecache[me]=ve),Z.writeVarint(ve)}}function _t(ye,Z){return(Z<<3)+(7&ye)}function Tt(ye){return ye<<1^ye>>31}function xt(ye,Z){const Y=ye.loadGeometry(),W=ye.type;let ce=0,me=0;for(const ve of Y){let Re=1;W===1&&(Re=ve.length),Z.writeVarint(_t(1,Re));const Te=W===3?ve.length-1:ve.length;for(let Ge=0;Ge<Te;Ge++){Ge===1&&W!==1&&Z.writeVarint(_t(2,Te-1));const rt=ve[Ge].x-ce,Ye=ve[Ge].y-me;Z.writeVarint(Tt(rt)),Z.writeVarint(Tt(Ye)),ce+=rt,me+=Ye}ye.type===3&&Z.writeVarint(_t(7,1))}}function Gt(ye,Z){const Y=typeof ye;Y==="string"?Z.writeStringField(1,ye):Y==="boolean"?Z.writeBooleanField(7,ye):Y==="number"&&(ye%1!=0?Z.writeDoubleField(3,ye):ye<0?Z.writeSVarintField(6,ye):Z.writeVarintField(5,ye))}const hi={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:ye=>ye},mi=Math.fround||(Jt=new Float32Array(1),ye=>(Jt[0]=+ye,Jt[0]));var Jt;class fr{constructor(Z){this.options=Object.assign(Object.create(hi),Z),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(Z){const{log:Y,minZoom:W,maxZoom:ce}=this.options;Y&&console.time("total time");const me=`prepare ${Z.length} points`;Y&&console.time(me),this.points=Z;const ve=[];for(let Te=0;Te<Z.length;Te++){const Ge=Z[Te];if(!Ge.geometry)continue;const[rt,Ye]=Ge.geometry.coordinates,Ct=mi(Ve(rt)),Me=mi(ht(Ye));ve.push(Ct,Me,1/0,Te,-1,1),this.options.reduce&&ve.push(0)}let Re=this.trees[ce+1]=this._createTree(ve);Y&&console.timeEnd(me);for(let Te=ce;Te>=W;Te--){const Ge=+Date.now();Re=this.trees[Te]=this._createTree(this._cluster(Re,Te)),Y&&console.log("z%d: %d clusters in %dms",Te,Re.numItems,+Date.now()-Ge)}return Y&&console.timeEnd("total time"),this}getClusters(Z,Y){let W=((Z[0]+180)%360+360)%360-180;const ce=Math.max(-90,Math.min(90,Z[1]));let me=Z[2]===180?180:((Z[2]+180)%360+360)%360-180;const ve=Math.max(-90,Math.min(90,Z[3]));if(Z[2]-Z[0]>=360)W=-180,me=180;else if(W>me){const Ye=this.getClusters([W,ce,180,ve],Y),Ct=this.getClusters([-180,ce,me,ve],Y);return Ye.concat(Ct)}const Re=this.trees[this._limitZoom(Y)],Te=Re.range(Ve(W),ht(ve),Ve(me),ht(ce)),Ge=Re.data,rt=[];for(const Ye of Te){const Ct=this.stride*Ye;rt.push(Ge[Ct+5]>1?Ir(Ge,Ct,this.clusterProps):this.points[Ge[Ct+3]])}return rt}getChildren(Z){const Y=this._getOriginId(Z),W=this._getOriginZoom(Z),ce="No cluster with the specified id.",me=this.trees[W];if(!me)throw new Error(ce);const ve=me.data;if(Y*this.stride>=ve.length)throw new Error(ce);const Re=this.options.radius/(this.options.extent*Math.pow(2,W-1)),Te=me.within(ve[Y*this.stride],ve[Y*this.stride+1],Re),Ge=[];for(const rt of Te){const Ye=rt*this.stride;ve[Ye+4]===Z&&Ge.push(ve[Ye+5]>1?Ir(ve,Ye,this.clusterProps):this.points[ve[Ye+3]])}if(Ge.length===0)throw new Error(ce);return Ge}getLeaves(Z,Y,W){const ce=[];return this._appendLeaves(ce,Z,Y=Y||10,W=W||0,0),ce}getTile(Z,Y,W){const ce=this.trees[this._limitZoom(Z)],me=Math.pow(2,Z),{extent:ve,radius:Re}=this.options,Te=Re/ve,Ge=(W-Te)/me,rt=(W+1+Te)/me,Ye={features:[]};return this._addTileFeatures(ce.range((Y-Te)/me,Ge,(Y+1+Te)/me,rt),ce.data,Y,W,me,Ye),Y===0&&this._addTileFeatures(ce.range(1-Te/me,Ge,1,rt),ce.data,me,W,me,Ye),Y===me-1&&this._addTileFeatures(ce.range(0,Ge,Te/me,rt),ce.data,-1,W,me,Ye),Ye.features.length?Ye:null}getClusterExpansionZoom(Z){let Y=this._getOriginZoom(Z)-1;for(;Y<=this.options.maxZoom;){const W=this.getChildren(Z);if(Y++,W.length!==1)break;Z=W[0].properties.cluster_id}return Y}_appendLeaves(Z,Y,W,ce,me){const ve=this.getChildren(Y);for(const Re of ve){const Te=Re.properties;if(Te&&Te.cluster?me+Te.point_count<=ce?me+=Te.point_count:me=this._appendLeaves(Z,Te.cluster_id,W,ce,me):me<ce?me++:Z.push(Re),Z.length===W)break}return me}_createTree(Z){const Y=new A.aI(Z.length/this.stride|0,this.options.nodeSize,Float32Array);for(let W=0;W<Z.length;W+=this.stride)Y.add(Z[W],Z[W+1]);return Y.finish(),Y.data=Z,Y}_addTileFeatures(Z,Y,W,ce,me,ve){for(const Re of Z){const Te=Re*this.stride,Ge=Y[Te+5]>1;let rt,Ye,Ct;if(Ge)rt=yi(Y,Te,this.clusterProps),Ye=Y[Te],Ct=Y[Te+1];else{const oi=this.points[Y[Te+3]];rt=oi.properties;const[kt,Kt]=oi.geometry.coordinates;Ye=Ve(kt),Ct=ht(Kt)}const Me={type:1,geometry:[[Math.round(this.options.extent*(Ye*me-W)),Math.round(this.options.extent*(Ct*me-ce))]],tags:rt};let Zt;Zt=Ge||this.options.generateId?Y[Te+3]:this.points[Y[Te+3]].id,Zt!==void 0&&(Me.id=Zt),ve.features.push(Me)}}_limitZoom(Z){return Math.max(this.options.minZoom,Math.min(Math.floor(+Z),this.options.maxZoom+1))}_cluster(Z,Y){const{radius:W,extent:ce,reduce:me,minPoints:ve}=this.options,Re=W/(ce*Math.pow(2,Y)),Te=Z.data,Ge=[],rt=this.stride;for(let Ye=0;Ye<Te.length;Ye+=rt){if(Te[Ye+2]<=Y)continue;Te[Ye+2]=Y;const Ct=Te[Ye],Me=Te[Ye+1],Zt=Z.within(Te[Ye],Te[Ye+1],Re),oi=Te[Ye+5];let kt=oi;for(const Kt of Zt){const Bi=Kt*rt;Te[Bi+2]>Y&&(kt+=Te[Bi+5])}if(kt>oi&&kt>=ve){let Kt,Bi=Ct*oi,jr=Me*oi,Zr=-1;const Fi=(Ye/rt<<5)+(Y+1)+this.points.length;for(const Nt of Zt){const qt=Nt*rt;if(Te[qt+2]<=Y)continue;Te[qt+2]=Y;const er=Te[qt+5];Bi+=Te[qt]*er,jr+=Te[qt+1]*er,Te[qt+4]=Fi,me&&(Kt||(Kt=this._map(Te,Ye,!0),Zr=this.clusterProps.length,this.clusterProps.push(Kt)),me(Kt,this._map(Te,qt)))}Te[Ye+4]=Fi,Ge.push(Bi/kt,jr/kt,1/0,Fi,-1,kt),me&&Ge.push(Zr)}else{for(let Kt=0;Kt<rt;Kt++)Ge.push(Te[Ye+Kt]);if(kt>1)for(const Kt of Zt){const Bi=Kt*rt;if(!(Te[Bi+2]<=Y)){Te[Bi+2]=Y;for(let jr=0;jr<rt;jr++)Ge.push(Te[Bi+jr])}}}}return Ge}_getOriginId(Z){return Z-this.points.length>>5}_getOriginZoom(Z){return(Z-this.points.length)%32}_map(Z,Y,W){if(Z[Y+5]>1){const ve=this.clusterProps[Z[Y+6]];return W?Object.assign({},ve):ve}const ce=this.points[Z[Y+3]].properties,me=this.options.map(ce);return W&&me===ce?Object.assign({},me):me}}function Ir(ye,Z,Y){return{type:"Feature",id:ye[Z+3],properties:yi(ye,Z,Y),geometry:{type:"Point",coordinates:[(W=ye[Z],360*(W-.5)),nt(ye[Z+1])]}};var W}function yi(ye,Z,Y){const W=ye[Z+5],ce=W>=1e4?`${Math.round(W/1e3)}k`:W>=1e3?Math.round(W/100)/10+"k":W,me=ye[Z+6],ve=me===-1?{}:Object.assign({},Y[me]);return Object.assign(ve,{cluster:!0,cluster_id:ye[Z+3],point_count:W,point_count_abbreviated:ce})}function Ve(ye){return ye/360+.5}function ht(ye){const Z=Math.sin(ye*Math.PI/180),Y=.5-.25*Math.log((1+Z)/(1-Z))/Math.PI;return Y<0?0:Y>1?1:Y}function nt(ye){const Z=(180-360*ye)*Math.PI/180;return 360*Math.atan(Math.exp(Z))/Math.PI-90}function bt(ye,Z,Y,W){let ce=W;const me=Z+(Y-Z>>1);let ve,Re=Y-Z;const Te=ye[Z],Ge=ye[Z+1],rt=ye[Y],Ye=ye[Y+1];for(let Ct=Z+3;Ct<Y;Ct+=3){const Me=_e(ye[Ct],ye[Ct+1],Te,Ge,rt,Ye);if(Me>ce)ve=Ct,ce=Me;else if(Me===ce){const Zt=Math.abs(Ct-me);Zt<Re&&(ve=Ct,Re=Zt)}}ce>W&&(ve-Z>3&&bt(ye,Z,ve,W),ye[ve+2]=ce,Y-ve>3&&bt(ye,ve,Y,W))}function _e(ye,Z,Y,W,ce,me){let ve=ce-Y,Re=me-W;if(ve!==0||Re!==0){const Te=((ye-Y)*ve+(Z-W)*Re)/(ve*ve+Re*Re);Te>1?(Y=ce,W=me):Te>0&&(Y+=ve*Te,W+=Re*Te)}return ve=ye-Y,Re=Z-W,ve*ve+Re*Re}function Xe(ye,Z,Y,W){const ce={id:ye??null,type:Z,geometry:Y,tags:W,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(Z==="Point"||Z==="MultiPoint"||Z==="LineString")vt(ce,Y);else if(Z==="Polygon")vt(ce,Y[0]);else if(Z==="MultiLineString")for(const me of Y)vt(ce,me);else if(Z==="MultiPolygon")for(const me of Y)vt(ce,me[0]);return ce}function vt(ye,Z){for(let Y=0;Y<Z.length;Y+=3)ye.minX=Math.min(ye.minX,Z[Y]),ye.minY=Math.min(ye.minY,Z[Y+1]),ye.maxX=Math.max(ye.maxX,Z[Y]),ye.maxY=Math.max(ye.maxY,Z[Y+1])}function at(ye,Z,Y,W){if(!Z.geometry)return;const ce=Z.geometry.coordinates;if(ce&&ce.length===0)return;const me=Z.geometry.type,ve=Math.pow(Y.tolerance/((1<<Y.maxZoom)*Y.extent),2);let Re=[],Te=Z.id;if(Y.promoteId?Te=Z.properties[Y.promoteId]:Y.generateId&&(Te=W||0),me==="Point")wt(ce,Re);else if(me==="MultiPoint")for(const Ge of ce)wt(Ge,Re);else if(me==="LineString")Ft(ce,Re,ve,!1);else if(me==="MultiLineString"){if(Y.lineMetrics){for(const Ge of ce)Re=[],Ft(Ge,Re,ve,!1),ye.push(Xe(Te,"LineString",Re,Z.properties));return}zt(ce,Re,ve,!1)}else if(me==="Polygon")zt(ce,Re,ve,!0);else{if(me!=="MultiPolygon"){if(me==="GeometryCollection"){for(const Ge of Z.geometry.geometries)at(ye,{id:Te,geometry:Ge,properties:Z.properties},Y,W);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const Ge of ce){const rt=[];zt(Ge,rt,ve,!0),Re.push(rt)}}ye.push(Xe(Te,me,Re,Z.properties))}function wt(ye,Z){Z.push(di(ye[0]),si(ye[1]),0)}function Ft(ye,Z,Y,W){let ce,me,ve=0;for(let Te=0;Te<ye.length;Te++){const Ge=di(ye[Te][0]),rt=si(ye[Te][1]);Z.push(Ge,rt,0),Te>0&&(ve+=W?(ce*rt-Ge*me)/2:Math.sqrt(Math.pow(Ge-ce,2)+Math.pow(rt-me,2))),ce=Ge,me=rt}const Re=Z.length-3;Z[2]=1,bt(Z,0,Re,Y),Z[Re+2]=1,Z.size=Math.abs(ve),Z.start=0,Z.end=Z.size}function zt(ye,Z,Y,W){for(let ce=0;ce<ye.length;ce++){const me=[];Ft(ye[ce],me,Y,W),Z.push(me)}}function di(ye){return ye/360+.5}function si(ye){const Z=Math.sin(ye*Math.PI/180),Y=.5-.25*Math.log((1+Z)/(1-Z))/Math.PI;return Y<0?0:Y>1?1:Y}function Ji(ye,Z,Y,W,ce,me,ve,Re){if(W/=Z,me>=(Y/=Z)&&ve<W)return ye;if(ve<Y||me>=W)return null;const Te=[];for(const Ge of ye){const rt=Ge.geometry;let Ye=Ge.type;const Ct=ce===0?Ge.minX:Ge.minY,Me=ce===0?Ge.maxX:Ge.maxY;if(Ct>=Y&&Me<W){Te.push(Ge);continue}if(Me<Y||Ct>=W)continue;let Zt=[];if(Ye==="Point"||Ye==="MultiPoint")zn(rt,Zt,Y,W,ce);else if(Ye==="LineString")kn(rt,Zt,Y,W,ce,!1,Re.lineMetrics);else if(Ye==="MultiLineString")qi(rt,Zt,Y,W,ce,!1);else if(Ye==="Polygon")qi(rt,Zt,Y,W,ce,!0);else if(Ye==="MultiPolygon")for(const oi of rt){const kt=[];qi(oi,kt,Y,W,ce,!0),kt.length&&Zt.push(kt)}if(Zt.length){if(Re.lineMetrics&&Ye==="LineString"){for(const oi of Zt)Te.push(Xe(Ge.id,Ye,oi,Ge.tags));continue}Ye!=="LineString"&&Ye!=="MultiLineString"||(Zt.length===1?(Ye="LineString",Zt=Zt[0]):Ye="MultiLineString"),Ye!=="Point"&&Ye!=="MultiPoint"||(Ye=Zt.length===3?"Point":"MultiPoint"),Te.push(Xe(Ge.id,Ye,Zt,Ge.tags))}}return Te.length?Te:null}function zn(ye,Z,Y,W,ce){for(let me=0;me<ye.length;me+=3){const ve=ye[me+ce];ve>=Y&&ve<=W&&$i(Z,ye[me],ye[me+1],ye[me+2])}}function kn(ye,Z,Y,W,ce,me,ve){let Re=xr(ye);const Te=ce===0?Kn:ha;let Ge,rt,Ye=ye.start;for(let kt=0;kt<ye.length-3;kt+=3){const Kt=ye[kt],Bi=ye[kt+1],jr=ye[kt+2],Zr=ye[kt+3],Fi=ye[kt+4],Nt=ce===0?Kt:Bi,qt=ce===0?Zr:Fi;let er=!1;ve&&(Ge=Math.sqrt(Math.pow(Kt-Zr,2)+Math.pow(Bi-Fi,2))),Nt<Y?qt>Y&&(rt=Te(Re,Kt,Bi,Zr,Fi,Y),ve&&(Re.start=Ye+Ge*rt)):Nt>W?qt<W&&(rt=Te(Re,Kt,Bi,Zr,Fi,W),ve&&(Re.start=Ye+Ge*rt)):$i(Re,Kt,Bi,jr),qt<Y&&Nt>=Y&&(rt=Te(Re,Kt,Bi,Zr,Fi,Y),er=!0),qt>W&&Nt<=W&&(rt=Te(Re,Kt,Bi,Zr,Fi,W),er=!0),!me&&er&&(ve&&(Re.end=Ye+Ge*rt),Z.push(Re),Re=xr(ye)),ve&&(Ye+=Ge)}let Ct=ye.length-3;const Me=ye[Ct],Zt=ye[Ct+1],oi=ce===0?Me:Zt;oi>=Y&&oi<=W&&$i(Re,Me,Zt,ye[Ct+2]),Ct=Re.length-3,me&&Ct>=3&&(Re[Ct]!==Re[0]||Re[Ct+1]!==Re[1])&&$i(Re,Re[0],Re[1],Re[2]),Re.length&&Z.push(Re)}function xr(ye){const Z=[];return Z.size=ye.size,Z.start=ye.start,Z.end=ye.end,Z}function qi(ye,Z,Y,W,ce,me){for(const ve of ye)kn(ve,Z,Y,W,ce,me,!1)}function $i(ye,Z,Y,W){ye.push(Z,Y,W)}function Kn(ye,Z,Y,W,ce,me){const ve=(me-Z)/(W-Z);return $i(ye,me,Y+(ce-Y)*ve,1),ve}function ha(ye,Z,Y,W,ce,me){const ve=(me-Y)/(ce-Y);return $i(ye,Z+(W-Z)*ve,me,1),ve}function Kr(ye,Z){const Y=[];for(let W=0;W<ye.length;W++){const ce=ye[W],me=ce.type;let ve;if(me==="Point"||me==="MultiPoint"||me==="LineString")ve=da(ce.geometry,Z);else if(me==="MultiLineString"||me==="Polygon"){ve=[];for(const Re of ce.geometry)ve.push(da(Re,Z))}else if(me==="MultiPolygon"){ve=[];for(const Re of ce.geometry){const Te=[];for(const Ge of Re)Te.push(da(Ge,Z));ve.push(Te)}}Y.push(Xe(ce.id,me,ve,ce.tags))}return Y}function da(ye,Z){const Y=[];Y.size=ye.size,ye.start!==void 0&&(Y.start=ye.start,Y.end=ye.end);for(let W=0;W<ye.length;W+=3)Y.push(ye[W]+Z,ye[W+1],ye[W+2]);return Y}function Wn(ye,Z){if(ye.transformed)return ye;const Y=1<<ye.z,W=ye.x,ce=ye.y;for(const me of ye.features){const ve=me.geometry,Re=me.type;if(me.geometry=[],Re===1)for(let Te=0;Te<ve.length;Te+=2)me.geometry.push(ms(ve[Te],ve[Te+1],Z,Y,W,ce));else for(let Te=0;Te<ve.length;Te++){const Ge=[];for(let rt=0;rt<ve[Te].length;rt+=2)Ge.push(ms(ve[Te][rt],ve[Te][rt+1],Z,Y,W,ce));me.geometry.push(Ge)}}return ye.transformed=!0,ye}function ms(ye,Z,Y,W,ce,me){return[Math.round(Y*(ye*W-ce)),Math.round(Y*(Z*W-me))]}function Qn(ye,Z,Y,W,ce){const me=Z===ce.maxZoom?0:ce.tolerance/((1<<Z)*ce.extent),ve={features:[],numPoints:0,numSimplified:0,numFeatures:ye.length,source:null,x:Y,y:W,z:Z,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const Re of ye)Qa(ve,Re,me,ce);return ve}function Qa(ye,Z,Y,W){const ce=Z.geometry,me=Z.type,ve=[];if(ye.minX=Math.min(ye.minX,Z.minX),ye.minY=Math.min(ye.minY,Z.minY),ye.maxX=Math.max(ye.maxX,Z.maxX),ye.maxY=Math.max(ye.maxY,Z.maxY),me==="Point"||me==="MultiPoint")for(let Re=0;Re<ce.length;Re+=3)ve.push(ce[Re],ce[Re+1]),ye.numPoints++,ye.numSimplified++;else if(me==="LineString")Da(ve,ce,ye,Y,!1,!1);else if(me==="MultiLineString"||me==="Polygon")for(let Re=0;Re<ce.length;Re++)Da(ve,ce[Re],ye,Y,me==="Polygon",Re===0);else if(me==="MultiPolygon")for(let Re=0;Re<ce.length;Re++){const Te=ce[Re];for(let Ge=0;Ge<Te.length;Ge++)Da(ve,Te[Ge],ye,Y,!0,Ge===0)}if(ve.length){let Re=Z.tags||null;if(me==="LineString"&&W.lineMetrics){Re={};for(const Ge in Z.tags)Re[Ge]=Z.tags[Ge];Re.mapbox_clip_start=ce.start/ce.size,Re.mapbox_clip_end=ce.end/ce.size}const Te={geometry:ve,type:me==="Polygon"||me==="MultiPolygon"?3:me==="LineString"||me==="MultiLineString"?2:1,tags:Re};Z.id!==null&&(Te.id=Z.id),ye.features.push(Te)}}function Da(ye,Z,Y,W,ce,me){const ve=W*W;if(W>0&&Z.size<(ce?ve:W))return void(Y.numPoints+=Z.length/3);const Re=[];for(let Te=0;Te<Z.length;Te+=3)(W===0||Z[Te+2]>ve)&&(Y.numSimplified++,Re.push(Z[Te],Z[Te+1])),Y.numPoints++;ce&&(function(Te,Ge){let rt=0;for(let Ye=0,Ct=Te.length,Me=Ct-2;Ye<Ct;Me=Ye,Ye+=2)rt+=(Te[Ye]-Te[Me])*(Te[Ye+1]+Te[Me+1]);if(rt>0===Ge)for(let Ye=0,Ct=Te.length;Ye<Ct/2;Ye+=2){const Me=Te[Ye],Zt=Te[Ye+1];Te[Ye]=Te[Ct-2-Ye],Te[Ye+1]=Te[Ct-1-Ye],Te[Ct-2-Ye]=Me,Te[Ct-1-Ye]=Zt}})(Re,me),ye.push(Re)}const gs={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class Yt{constructor(Z,Y){const W=(Y=this.options=(function(me,ve){for(const Re in ve)me[Re]=ve[Re];return me})(Object.create(gs),Y)).debug;if(W&&console.time("preprocess data"),Y.maxZoom<0||Y.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(Y.promoteId&&Y.generateId)throw new Error("promoteId and generateId cannot be used together.");let ce=(function(me,ve){const Re=[];if(me.type==="FeatureCollection")for(let Te=0;Te<me.features.length;Te++)at(Re,me.features[Te],ve,Te);else at(Re,me.type==="Feature"?me:{geometry:me},ve);return Re})(Z,Y);this.tiles={},this.tileCoords=[],W&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",Y.indexMaxZoom,Y.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),ce=(function(me,ve){const Re=ve.buffer/ve.extent;let Te=me;const Ge=Ji(me,1,-1-Re,Re,0,-1,2,ve),rt=Ji(me,1,1-Re,2+Re,0,-1,2,ve);return(Ge||rt)&&(Te=Ji(me,1,-Re,1+Re,0,-1,2,ve)||[],Ge&&(Te=Kr(Ge,1).concat(Te)),rt&&(Te=Te.concat(Kr(rt,-1)))),Te})(ce,Y),ce.length&&this.splitTile(ce,0,0,0),W&&(ce.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}splitTile(Z,Y,W,ce,me,ve,Re){const Te=[Z,Y,W,ce],Ge=this.options,rt=Ge.debug;for(;Te.length;){ce=Te.pop(),W=Te.pop(),Y=Te.pop(),Z=Te.pop();const Ye=1<<Y,Ct=Ti(Y,W,ce);let Me=this.tiles[Ct];if(!Me&&(rt>1&&console.time("creation"),Me=this.tiles[Ct]=Qn(Z,Y,W,ce,Ge),this.tileCoords.push({z:Y,x:W,y:ce}),rt)){rt>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",Y,W,ce,Me.numFeatures,Me.numPoints,Me.numSimplified),console.timeEnd("creation"));const er=`z${Y}`;this.stats[er]=(this.stats[er]||0)+1,this.total++}if(Me.source=Z,me==null){if(Y===Ge.indexMaxZoom||Me.numPoints<=Ge.indexMaxPoints)continue}else{if(Y===Ge.maxZoom||Y===me)continue;if(me!=null){const er=me-Y;if(W!==ve>>er||ce!==Re>>er)continue}}if(Me.source=null,Z.length===0)continue;rt>1&&console.time("clipping");const Zt=.5*Ge.buffer/Ge.extent,oi=.5-Zt,kt=.5+Zt,Kt=1+Zt;let Bi=null,jr=null,Zr=null,Fi=null,Nt=Ji(Z,Ye,W-Zt,W+kt,0,Me.minX,Me.maxX,Ge),qt=Ji(Z,Ye,W+oi,W+Kt,0,Me.minX,Me.maxX,Ge);Z=null,Nt&&(Bi=Ji(Nt,Ye,ce-Zt,ce+kt,1,Me.minY,Me.maxY,Ge),jr=Ji(Nt,Ye,ce+oi,ce+Kt,1,Me.minY,Me.maxY,Ge),Nt=null),qt&&(Zr=Ji(qt,Ye,ce-Zt,ce+kt,1,Me.minY,Me.maxY,Ge),Fi=Ji(qt,Ye,ce+oi,ce+Kt,1,Me.minY,Me.maxY,Ge),qt=null),rt>1&&console.timeEnd("clipping"),Te.push(Bi||[],Y+1,2*W,2*ce),Te.push(jr||[],Y+1,2*W,2*ce+1),Te.push(Zr||[],Y+1,2*W+1,2*ce),Te.push(Fi||[],Y+1,2*W+1,2*ce+1)}}getTile(Z,Y,W){Z=+Z,Y=+Y,W=+W;const ce=this.options,{extent:me,debug:ve}=ce;if(Z<0||Z>24)return null;const Re=1<<Z,Te=Ti(Z,Y=Y+Re&Re-1,W);if(this.tiles[Te])return Wn(this.tiles[Te],me);ve>1&&console.log("drilling down to z%d-%d-%d",Z,Y,W);let Ge,rt=Z,Ye=Y,Ct=W;for(;!Ge&&rt>0;)rt--,Ye>>=1,Ct>>=1,Ge=this.tiles[Ti(rt,Ye,Ct)];return Ge&&Ge.source?(ve>1&&(console.log("found parent tile z%d-%d-%d",rt,Ye,Ct),console.time("drilling down")),this.splitTile(Ge.source,rt,Ye,Ct,Z,Y,W),ve>1&&console.timeEnd("drilling down"),this.tiles[Te]?Wn(this.tiles[Te],me):null):null}}function Ti(ye,Z,Y){return 32*((1<<ye)*Y+Z)+ye}class sr extends we{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(Z,Y){return A._(this,void 0,void 0,(function*(){const W=Z.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const ce=this._geoJSONIndex.getTile(W.z,W.x,W.y);if(!ce)return null;const me=new qe(ce.features,{version:2,extent:A.$});let ve=(function(Re){const Te=new A.cM;return(function(Ge,rt){for(const Ye in Ge.layers)rt.writeMessage(3,tt,Ge.layers[Ye])})(Re,Te),Te.finish()})(me);return ve.byteOffset===0&&ve.byteLength===ve.buffer.byteLength||(ve=new Uint8Array(ve)),{vectorTile:me,rawData:ve.buffer}}))}loadData(Z){return A._(this,void 0,void 0,(function*(){var Y;(Y=this._pendingRequest)===null||Y===void 0||Y.abort();const W=!!(Z&&Z.request&&Z.request.collectResourceTiming)&&new A.cN(Z.request);this._pendingRequest=new AbortController;try{this._pendingData=this.loadAndProcessGeoJSON(Z,this._pendingRequest);const ce=yield this._pendingData;this._geoJSONIndex=Z.cluster?new fr((function({superclusterOptions:ve,clusterProperties:Re}){if(!Re||!ve)return ve;const Te={},Ge={},rt={accumulated:null,zoom:0},Ye={properties:null},Ct=Object.keys(Re);for(const Me of Ct){const[Zt,oi]=Re[Me],kt=A.cT(oi),Kt=A.cT(typeof Zt=="string"?[Zt,["accumulated"],["get",Me]]:Zt);Te[Me]=kt.value,Ge[Me]=Kt.value}return ve.map=Me=>{Ye.properties=Me;const Zt={};for(const oi of Ct)Zt[oi]=Te[oi].evaluate(rt,Ye);return Zt},ve.reduce=(Me,Zt)=>{Ye.properties=Zt;for(const oi of Ct)rt.accumulated=Me[oi],Me[oi]=Ge[oi].evaluate(rt,Ye)},ve})(Z)).load(ce.features):(function(ve,Re){return new Yt(ve,Re)})(ce,Z.geojsonVtOptions),this.loaded={};const me={data:ce};if(W){const ve=W.finish();ve&&(me.resourceTiming={},me.resourceTiming[Z.source]=JSON.parse(JSON.stringify(ve)))}return me}catch(ce){if(delete this._pendingRequest,A.cy(ce))return{abandoned:!0};throw ce}}))}getData(){return A._(this,void 0,void 0,(function*(){return this._pendingData}))}reloadTile(Z){const Y=this.loaded;return Y&&Y[Z.uid]?super.reloadTile(Z):this.loadTile(Z)}loadAndProcessGeoJSON(Z,Y){return A._(this,void 0,void 0,(function*(){let W=yield this.loadGeoJSON(Z,Y);if(delete this._pendingRequest,typeof W!="object")throw new Error(`Input data given to '${Z.source}' is not a valid GeoJSON object.`);if(xe(W,!0),Z.filter){const ce=A.cT(Z.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(ce.result==="error")throw new Error(ce.value.map((ve=>`${ve.key}: ${ve.message}`)).join(", "));W={type:"FeatureCollection",features:W.features.filter((ve=>ce.value.evaluate({zoom:0},ve)))}}return W}))}loadGeoJSON(Z,Y){return A._(this,void 0,void 0,(function*(){const{promoteId:W}=Z;if(Z.request){const ce=yield A.j(Z.request,Y);return this._dataUpdateable=A.cV(ce.data,W)?A.cU(ce.data,W):void 0,ce.data}if(typeof Z.data=="string")try{const ce=JSON.parse(Z.data);return this._dataUpdateable=A.cV(ce,W)?A.cU(ce,W):void 0,ce}catch{throw new Error(`Input data given to '${Z.source}' is not a valid GeoJSON object.`)}if(!Z.dataDiff)throw new Error(`Input data given to '${Z.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${Z.source}`);return A.cW(this._dataUpdateable,Z.dataDiff,W),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}}))}removeSource(Z){return A._(this,void 0,void 0,(function*(){this._pendingRequest&&this._pendingRequest.abort()}))}getClusterExpansionZoom(Z){return this._geoJSONIndex.getClusterExpansionZoom(Z.clusterId)}getClusterChildren(Z){return this._geoJSONIndex.getChildren(Z.clusterId)}getClusterLeaves(Z){return this._geoJSONIndex.getLeaves(Z.clusterId,Z.limit,Z.offset)}}class In{constructor(Z){this.self=Z,this.actor=new A.J(Z),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={}
vendor: 4,549 bytes, line 173
173,this.self.registerWorkerSource=(Y,W)=>{if(this.externalWorkerSourceTypes[Y])throw new Error(`Worker source with name "${Y}" already registered.`);this.externalWorkerSourceTypes[Y]=W},this.self.addProtocol=A.cA,this.self.removeProtocol=A.cB,this.self.registerRTLTextPlugin=Y=>{A.cX.setMethods(Y)},this.actor.registerMessageHandler("LDT",((Y,W)=>this._getDEMWorkerSource(Y,W.source).loadTile(W))),this.actor.registerMessageHandler("RDT",((Y,W)=>A._(this,void 0,void 0,(function*(){this._getDEMWorkerSource(Y,W.source).removeTile(W)})))),this.actor.registerMessageHandler("GCEZ",((Y,W)=>A._(this,void 0,void 0,(function*(){return this._getWorkerSource(Y,W.type,W.source).getClusterExpansionZoom(W)})))),this.actor.registerMessageHandler("GCC",((Y,W)=>A._(this,void 0,void 0,(function*(){return this._getWorkerSource(Y,W.type,W.source).getClusterChildren(W)})))),this.actor.registerMessageHandler("GCL",((Y,W)=>A._(this,void 0,void 0,(function*(){return this._getWorkerSource(Y,W.type,W.source).getClusterLeaves(W)})))),this.actor.registerMessageHandler("LD",((Y,W)=>this._getWorkerSource(Y,W.type,W.source).loadData(W))),this.actor.registerMessageHandler("GD",((Y,W)=>this._getWorkerSource(Y,W.type,W.source).getData())),this.actor.registerMessageHandler("LT",((Y,W)=>this._getWorkerSource(Y,W.type,W.source).loadTile(W))),this.actor.registerMessageHandler("RT",((Y,W)=>this._getWorkerSource(Y,W.type,W.source).reloadTile(W))),this.actor.registerMessageHandler("AT",((Y,W)=>this._getWorkerSource(Y,W.type,W.source).abortTile(W))),this.actor.registerMessageHandler("RMT",((Y,W)=>this._getWorkerSource(Y,W.type,W.source).removeTile(W))),this.actor.registerMessageHandler("RS",((Y,W)=>A._(this,void 0,void 0,(function*(){if(!this.workerSources[Y]||!this.workerSources[Y][W.type]||!this.workerSources[Y][W.type][W.source])return;const ce=this.workerSources[Y][W.type][W.source];delete this.workerSources[Y][W.type][W.source],ce.removeSource!==void 0&&ce.removeSource(W)})))),this.actor.registerMessageHandler("RM",(Y=>A._(this,void 0,void 0,(function*(){delete this.layerIndexes[Y],delete this.availableImages[Y],delete this.workerSources[Y],delete this.demWorkerSources[Y]})))),this.actor.registerMessageHandler("SR",((Y,W)=>A._(this,void 0,void 0,(function*(){this.referrer=W})))),this.actor.registerMessageHandler("SRPS",((Y,W)=>this._syncRTLPluginState(Y,W))),this.actor.registerMessageHandler("IS",((Y,W)=>A._(this,void 0,void 0,(function*(){this.self.importScripts(W)})))),this.actor.registerMessageHandler("SI",((Y,W)=>this._setImages(Y,W))),this.actor.registerMessageHandler("UL",((Y,W)=>A._(this,void 0,void 0,(function*(){this._getLayerIndex(Y).update(W.layers,W.removedIds)})))),this.actor.registerMessageHandler("SL",((Y,W)=>A._(this,void 0,void 0,(function*(){this._getLayerIndex(Y).replace(W)}))))}_setImages(Z,Y){return A._(this,void 0,void 0,(function*(){this.availableImages[Z]=Y;for(const W in this.workerSources[Z]){const ce=this.workerSources[Z][W];for(const me in ce)ce[me].availableImages=Y}}))}_syncRTLPluginState(Z,Y){return A._(this,void 0,void 0,(function*(){return yield A.cX.syncState(Y,this.self.importScripts)}))}_getAvailableImages(Z){let Y=this.availableImages[Z];return Y||(Y=[]),Y}_getLayerIndex(Z){let Y=this.layerIndexes[Z];return Y||(Y=this.layerIndexes[Z]=new u),Y}_getWorkerSource(Z,Y,W){if(this.workerSources[Z]||(this.workerSources[Z]={}),this.workerSources[Z][Y]||(this.workerSources[Z][Y]={}),!this.workerSources[Z][Y][W]){const ce={sendAsync:(me,ve)=>(me.targetMapId=Z,this.actor.sendAsync(me,ve))};switch(Y){case"vector":this.workerSources[Z][Y][W]=new we(ce,this._getLayerIndex(Z),this._getAvailableImages(Z));break;case"geojson":this.workerSources[Z][Y][W]=new sr(ce,this._getLayerIndex(Z),this._getAvailableImages(Z));break;default:this.workerSources[Z][Y][W]=new this.externalWorkerSourceTypes[Y](ce,this._getLayerIndex(Z),this._getAvailableImages(Z))}}return this.workerSources[Z][Y][W]}_getDEMWorkerSource(Z,Y){return this.demWorkerSources[Z]||(this.demWorkerSources[Z]={}),this.demWorkerSources[Z][Y]||(this.demWorkerSources[Z][Y]=new Ce),this.demWorkerSources[Z][Y]}}return A.i(self)&&(self.worker=new In(self)),In})),V("index",["exports","./shared"],(function(A,u){var H="5.7.1";function ne(){var f=new u.A(4);return u.A!=Float32Array&&(f[1]=0,f[2]=0),f[0]=1,f[3]=1,f}let se,we;const Ce={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frame(f,e,a){const l=requestAnimationFrame((m=>{d(),e(m)})),{unsubscribe:d}=u.s(f.signal,"abort",(()=>
vendor: 7,588 bytes, line 173
173{d(),cancelAnimationFrame(l),a(u.c())}),!1)},frameAsync(f){return new Promise(((e,a)=>{this.frame(f,e,a)}))},getImageData(f,e=0){return this.getImageCanvasContext(f).getImageData(-e,-e,f.width+2*e,f.height+2*e)},getImageCanvasContext(f){const e=window.document.createElement("canvas"),a=e.getContext("2d",{willReadFrequently:!0});if(!a)throw new Error("failed to create canvas 2d context");return e.width=f.width,e.height=f.height,a.drawImage(f,0,0,f.width,f.height),a},resolveURL:f=>(se||(se=document.createElement("a")),se.href=f,se.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(we==null&&(we=matchMedia("(prefers-reduced-motion: reduce)")),we.matches)}};class ie{static testProp(e){if(!ie.docStyle)return e[0];for(let a=0;a<e.length;a++)if(e[a]in ie.docStyle)return e[a];return e[0]}static create(e,a,l){const d=window.document.createElement(e);return a!==void 0&&(d.className=a),l&&l.appendChild(d),d}static createNS(e,a){return window.document.createElementNS(e,a)}static disableDrag(){ie.docStyle&&ie.selectProp&&(ie.userSelect=ie.docStyle[ie.selectProp],ie.docStyle[ie.selectProp]="none")}static enableDrag(){ie.docStyle&&ie.selectProp&&(ie.docStyle[ie.selectProp]=ie.userSelect)}static setTransform(e,a){e.style[ie.transformProp]=a}static addEventListener(e,a,l,d={}){e.addEventListener(a,l,"passive"in d?d:d.capture)}static removeEventListener(e,a,l,d={}){e.removeEventListener(a,l,"passive"in d?d:d.capture)}static suppressClickInternal(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener("click",ie.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",ie.suppressClickInternal,!0),window.setTimeout((()=>{window.removeEventListener("click",ie.suppressClickInternal,!0)}),0)}static getScale(e){const a=e.getBoundingClientRect();return{x:a.width/e.offsetWidth||1,y:a.height/e.offsetHeight||1,boundingClientRect:a}}static getPoint(e,a,l){const d=a.boundingClientRect;return new u.P((l.clientX-d.left)/a.x-e.clientLeft,(l.clientY-d.top)/a.y-e.clientTop)}static mousePos(e,a){const l=ie.getScale(e);return ie.getPoint(e,l,a)}static touchPos(e,a){const l=[],d=ie.getScale(e);for(let m=0;m<a.length;m++)l.push(ie.getPoint(e,d,a[m]));return l}static mouseButton(e){return e.button}static remove(e){e.parentNode&&e.parentNode.removeChild(e)}static sanitize(e){const a=new DOMParser().parseFromString(e,"text/html").body||document.createElement("body"),l=a.querySelectorAll("script");for(const d of l)d.remove();return ie.clean(a),a.innerHTML}static isPossiblyDangerous(e,a){const l=a.replace(/\s+/g,"").toLowerCase();return!(!["src","href","xlink:href"].includes(e)||!l.includes("javascript:")&&!l.includes("data:"))||!!e.startsWith("on")||void 0}static clean(e){const a=e.children;for(const l of a)ie.removeAttributes(l),ie.clean(l)}static removeAttributes(e){for(const{name:a,value:l}of e.attributes)ie.isPossiblyDangerous(a,l)&&e.removeAttribute(a)}}ie.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,ie.selectProp=ie.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),ie.transformProp=ie.testProp(["transform","WebkitTransform"]);const Fe={supported:!1,testSupport:function(f){!et&&xe&&(qe?tt(f):He=f)}};let He,xe,et=!1,qe=!1;function tt(f){const e=f.createTexture();f.bindTexture(f.TEXTURE_2D,e);try{if(f.texImage2D(f.TEXTURE_2D,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,xe),f.isContextLost())return;Fe.supported=!0}catch{}f.deleteTexture(e),et=!0}var ut;typeof document<"u"&&(xe=document.createElement("img"),xe.onload=()=>{He&&tt(He),He=null,qe=!0},xe.onerror=()=>{et=!0,He=null},xe.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),(function(f){let e,a,l,d;f.resetRequestQueue=()=>{e=[],a=0,l=0,d={}},f.addThrottleControl=S=>{const P=l++;return d[P]=S,P},f.removeThrottleControl=S=>{delete d[S],y()},f.getImage=(S,P,k=!0)=>new Promise(((B,L)=>{Fe.supported&&(S.headers||(S.headers={}),S.headers.accept="image/webp,*/*"),u.e(S,{type:"image"}),e.push({abortController:P,requestParameters:S,supportImageRefresh:k,state:"queued",onError:j=>{L(j)},onSuccess:j=>{B(j)}}),y()}));const m=S=>u._(this,void 0,void 0,(function*(){S.state="running";const{requestParameters:P,supportImageRefresh:k,onError:B,onSuccess:L,abortController:j}=S,G=k===!1&&!u.i(self)&&!u.g(P.url)&&(!P.headers||Object.keys(P.headers).reduce(((te,ae)=>te&&ae==="accept"),!0));a++;const ee=G?w(P,j):u.m(P,j);try{const te=yield ee;delete S.abortController,S.state="completed",te.data instanceof HTMLImageElement||u.b(te.data)?L(te):te.data&&L({data:yield(J=te.data,typeof createImageBitmap=="function"?u.f(J):u.h(J)),cacheControl:te.cacheControl,expires:te.expires})}catch(te){delete S.abortController,B(te)}finally{a--,y()}var J})),y=()=>{const S=(()=>{for(const P of Object.keys(d))if(d[P]())return!0;return!1})()?u.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:u.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let P=a;P<S&&e.length>0;P++){const k=e.shift();k.abortController.signal.aborted?P--:m(k)}},w=(S,P)=>new Promise(((k,B)=>{const L=new Image,j=S.url,G=S.credentials;G&&G==="include"?L.crossOrigin="use-credentials":(G&&G==="same-origin"||!u.d(j))&&(L.crossOrigin="anonymous"),P.signal.addEventListener("abort",(()=>{L.src="",B(u.c())})),L.fetchPriority="high",L.onload=()=>{L.onerror=L.onload=null,k({data:L})},L.onerror=()=>{L.onerror=L.onload=null,P.signal.aborted||B(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))},L.src=j}))})(ut||(ut={})),ut.resetRequestQueue();class Ze{constructor(e){this._transformRequestFn=e??null}transformRequest(e,a){return this._transformRequestFn&&this._transformRequestFn(e,a)||{url:e}}setTransformRequest(e){this._transformRequestFn=e}}function _t(f){const e=[];if(typeof f=="string")e.push({id:"default",url:f});else if(f&&f.length>0){const a=[];for(const{id:l,url:d}of f){const m=`${l}${d}`;a.indexOf(m)===-1&&(a.push(m),e.push({id:l,url:d}))}}return e}function Tt(f,e,a){try{const l=new URL(f);return l.pathname+=`${e}${a}`,l.toString()}catch{throw new Error(`Invalid sprite URL "${f}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}function xt(f){const{userImage:e}=f;return!!(e&&e.render&&e.render())&&(f.data.replace(new Uint8Array(e.data.buffer)),!0)}class Gt extends u.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new u.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:a,promiseResolve:l}of this.requestors)l(this._getImagesForIds(a));this.requestors=[]}}getImage(e){const a=this.images[e];if(a&&!a.data&&a.spriteData){const l=a.spriteData;a.data=new u.R({width:l.width,height:l.height},l.context.getImageData(l.x,l.y,l.width,l.height).data),a.spriteData=null}return a}addImage(e,a){if(this.images[e])throw new Error(`Image id ${e} already exist, use updateImage instead`);this._validate(e,a)&&(this.images[e]=a)}_validate(e,a){let l=!0;const d=a.data||a.spriteData;return this._validateStretch(a.stretchX,d&&d.width)||(this.fire(new u.k(new Error(`Image "${e}" has invalid "stretchX" value`))),l=!1),this._validateStretch(a.stretchY,d&&d.height)||(this.fire(new u.k(new Error(`Image "${e}" has invalid "stretchY" value`))),l=!1),this._validateContent(a.content,a)||(this.fire(new u.k(new Error(`Image "${e}
173" has invalid "content" value`))),l=!1),l}_validateStretch(e,a){if(!e)return!0;let l=0;for(const d of e){if(d[0]<l||d[1]<d[0]||a<d[1])return!1;l=d[1]}return!0}_validateContent(e,a){if(!e)return!0;if(e.length!==4)return!1;const l=a.spriteData,d=l&&l.width||a.data.width,m=l&&l.height||a.data.height;return!(e[0]<0||d<e[0]||e[1]<0||m<e[1]||e[2]<0||d<e[2]||e[3]<0||m<e[3]||e[2]<e[0]||e[3]<e[1])}updateImage(e,a,l=!0){const d=this.getImage(e);if(l&&(d.data.width!==a.data.width||d.data.height!==a.data.height))throw new Error(`size mismatch between old image (${d.data.width}x${d.data.height}) and new image (${a.data.width}x${a.data.height}).`);a.version=d.version+1,this.images[e]=a,this.updatedImages[e]=!0}removeImage(e){const a=this.images[e];delete this.images[e],delete this.patterns[e],a.userImage&&a.userImage.onRemove&&a.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(e){return new Promise(((a,l)=>{let d=!0;if(!this.isLoaded())for(const m of e)this.images[m]||(d=!1);this.isLoaded()||d?a(this._getImagesForIds(e)):this.requestors.push({ids:e,promiseResolve:a})}))}_getImagesForIds(e){const a={};for(const l of e){let d=this.getImage(l);d||(this.fire(new u.l("styleimagemissing",{id:l})),d=this.getImage(l)),d?a[l]={data:d.data.clone(),pixelRatio:d.pixelRatio,sdf:d.sdf,ver
vendor: 5,041 bytes, line 173
173sion:d.version,stretchX:d.stretchX,stretchY:d.stretchY,content:d.content,textFitWidth:d.textFitWidth,textFitHeight:d.textFitHeight,hasRenderCallback:!!(d.userImage&&d.userImage.render)}:u.w(`Image "${l}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}return a}getPixelSize(){const{width:e,height:a}=this.atlasImage;return{width:e,height:a}}getPattern(e){const a=this.patterns[e],l=this.getImage(e);if(!l)return null;if(a&&a.position.version===l.version)return a.position;if(a)a.position.version=l.version;else{const d={w:l.data.width+2,h:l.data.height+2,x:0,y:0},m=new u.I(d,l);this.patterns[e]={bin:d,position:m}}return this._updatePatternAtlas(),this.patterns[e].position}bind(e){const a=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new u.T(e,this.atlasImage,a.RGBA),this.atlasTexture.bind(a.LINEAR,a.CLAMP_TO_EDGE)}_updatePatternAtlas(){const e=[];for(const m in this.patterns)e.push(this.patterns[m].bin);const{w:a,h:l}=u.p(e),d=this.atlasImage;d.resize({width:a||1,height:l||1});for(const m in this.patterns){const{bin:y}=this.patterns[m],w=y.x+1,S=y.y+1,P=this.getImage(m).data,k=P.width,B=P.height;u.R.copy(P,d,{x:0,y:0},{x:w,y:S},{width:k,height:B}),u.R.copy(P,d,{x:0,y:B-1},{x:w,y:S-1},{width:k,height:1}),u.R.copy(P,d,{x:0,y:0},{x:w,y:S+B},{width:k,height:1}),u.R.copy(P,d,{x:k-1,y:0},{x:w-1,y:S},{width:1,height:B}),u.R.copy(P,d,{x:0,y:0},{x:w+k,y:S},{width:1,height:B})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(const a of e){if(this.callbackDispatchedThisFrame[a])continue;this.callbackDispatchedThisFrame[a]=!0;const l=this.getImage(a);l||u.w(`Image with ID: "${a}" was not found`),xt(l)&&this.updateImage(a,l)}}}const hi=1e20;function mi(f,e,a,l,d,m,y,w,S){for(let P=e;P<e+l;P++)Jt(f,a*m+P,m,d,y,w,S);for(let P=a;P<a+d;P++)Jt(f,P*m+e,1,l,y,w,S)}function Jt(f,e,a,l,d,m,y){m[0]=0,y[0]=-hi,y[1]=hi,d[0]=f[e];for(let w=1,S=0,P=0;w<l;w++){d[w]=f[e+w*a];const k=w*w;do{const B=m[S];P=(d[w]-d[B]+k-B*B)/(w-B)/2}while(P<=y[S]&&--S>-1);S++,m[S]=w,y[S]=P,y[S+1]=hi}for(let w=0,S=0;w<l;w++){for(;y[S+1]<w;)S++;const P=m[S],k=w-P;f[e+w*a]=d[P]+k*k}}class fr{constructor(e,a,l){this.requestManager=e,this.localIdeographFontFamily=a,this.entries={},this.lang=l}setURL(e){this.url=e}getGlyphs(e){return u._(this,void 0,void 0,(function*(){const a=[];for(const m in e)for(const y of e[m])a.push(this._getAndCacheGlyphsPromise(m,y));const l=yield Promise.all(a),d={};for(const{stack:m,id:y,glyph:w}of l)d[m]||(d[m]={}),d[m][y]=w&&{id:w.id,bitmap:w.bitmap.clone(),metrics:w.metrics};return d}))}_getAndCacheGlyphsPromise(e,a){return u._(this,void 0,void 0,(function*(){let l=this.entries[e];l||(l=this.entries[e]={glyphs:{},requests:{},ranges:{}});let d=l.glyphs[a];if(d!==void 0)return{stack:e,id:a,glyph:d};if(d=this._tinySDF(l,e,a),d)return l.glyphs[a]=d,{stack:e,id:a,glyph:d};const m=Math.floor(a/256);if(256*m>65535)throw new Error("glyphs > 65535 not supported");if(l.ranges[m])return{stack:e,id:a,glyph:d};if(!this.url)throw new Error("glyphsUrl is not set");if(!l.requests[m]){const w=fr.loadGlyphRange(e,m,this.url,this.requestManager);l.requests[m]=w}const y=yield l.requests[m];for(const w in y)this._doesCharSupportLocalGlyph(+w)||(l.glyphs[+w]=y[+w]);return l.ranges[m]=!0,{stack:e,id:a,glyph:y[a]||null}}))}_doesCharSupportLocalGlyph(e){return!!this.localIdeographFontFamily&&(new RegExp("\\p{Ideo}|\\p{sc=Hang}|\\p{sc=Hira}|\\p{sc=Kana}","u").test(String.fromCodePoint(e))||u.u["CJK Unified Ideographs"](e)||u.u["Hangul Syllables"](e)||u.u.Hiragana(e)||u.u.Katakana(e)||u.u["CJK Symbols and Punctuation"](e)||u.u["Halfwidth and Fullwidth Forms"](e))}_tinySDF(e,a,l){const d=this.localIdeographFontFamily;if(!d||!this._doesCharSupportLocalGlyph(l))return;let m=e.tinySDF;if(!m){let w="400";/bold/i.test(a)?w="900":/medium/i.test(a)?w="500":/light/i.test(a)&&(w="200"),m=e.tinySDF=new fr.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,lang:this.lang,fontFamily:d,fontWeight:w})}const y=m.draw(String.fromCharCode(l));return{id:l,bitmap:new u.q({width:y.width||60,height:y.height||60},y.data),metrics:{width:y.glyphWidth/2||24,height:y.glyphHeight/2||24,left:y.glyphLeft/2+.5||0,top:y.glyphTop/2-27.5||-8,advance:y.glyphAdvance/2||24,isDoubleResolution:!0}}}}fr.loadGlyphRange=function(f,e,a,l){return u._(this,void 0,void 0,(function*(){const d=256*e,m=d+255,y=l.transformRequest(a.replace("{fontstack}",f).replace("{range}",`${d}-${m}`),"Glyphs"),w=yield u.n(y,new AbortController);if(!w||!w.data)throw new Error(`Could not load glyph range. range: ${e}, ${d}-${m}`);const S={};for(const P of u.o(w.data))S[P.id]=P;return S}))},fr.TinySDF=class{constructor({fontSize:f=24,buffer:e=3,radius:a=8,cutoff:l=.25,fontFamily:d="sans-serif",fontWeight:m="normal",fontStyle:y="normal",lang:w=null}={}){this.buffer=e,this.cutoff=l,this.radius=a,this.lang=w;
vendor: 20,851 bytes, line 173
173const S=this.size=f+4*e,P=this._createCanvas(S),k=this.ctx=P.getContext("2d",{willReadFrequently:!0});k.font=`${y} ${m} ${f}px ${d}`,k.textBaseline="alphabetic",k.textAlign="left",k.fillStyle="black",this.gridOuter=new Float64Array(S*S),this.gridInner=new Float64Array(S*S),this.f=new Float64Array(S),this.z=new Float64Array(S+1),this.v=new Uint16Array(S)}_createCanvas(f){const e=document.createElement("canvas");return e.width=e.height=f,e}draw(f){const{width:e,actualBoundingBoxAscent:a,actualBoundingBoxDescent:l,actualBoundingBoxLeft:d,actualBoundingBoxRight:m}=this.ctx.measureText(f),y=Math.ceil(a),w=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(m-d))),S=Math.min(this.size-this.buffer,y+Math.ceil(l)),P=w+2*this.buffer,k=S+2*this.buffer,B=Math.max(P*k,0),L=new Uint8ClampedArray(B),j={data:L,width:P,height:k,glyphWidth:w,glyphHeight:S,glyphTop:y,glyphLeft:0,glyphAdvance:e};if(w===0||S===0)return j;const{ctx:G,buffer:ee,gridInner:J,gridOuter:te}=this;this.lang&&(G.lang=this.lang),G.clearRect(ee,ee,w,S),G.fillText(f,ee,ee+y);const ae=G.getImageData(ee,ee,w,S);te.fill(hi,0,B),J.fill(0,0,B);for(let ue=0;ue<S;ue++)for(let oe=0;oe<w;oe++){const de=ae.data[4*(ue*w+oe)+3]/255;if(de===0)continue;const ge=(ue+ee)*P+oe+ee;if(de===1)te[ge]=0,J[ge]=hi;else{const le=.5-de;te[ge]=le>0?le*le:0,J[ge]=le<0?le*le:0}}mi(te,0,0,P,k,P,this.f,this.v,this.z),mi(J,ee,ee,w,S,P,this.f,this.v,this.z);for(let ue=0;ue<B;ue++){const oe=Math.sqrt(te[ue])-Math.sqrt(J[ue]);L[ue]=Math.round(255-255*(oe/this.radius+this.cutoff))}return j}};class Ir{constructor(){this.specification=u.v.light.position}possiblyEvaluate(e,a){return u.B(e.expression.evaluate(a))}interpolate(e,a,l){return{x:u.C.number(e.x,a.x,l),y:u.C.number(e.y,a.y,l),z:u.C.number(e.z,a.z,l)}}}let yi;class Ve extends u.E{constructor(e){super(),yi=yi||new u.r({anchor:new u.D(u.v.light.anchor),position:new Ir,color:new u.D(u.v.light.color),intensity:new u.D(u.v.light.intensity)}),this._transitionable=new u.t(yi),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,a={}){if(!this._validate(u.x,e,a))for(const l in e){const d=e[l];l.endsWith("-transition")?this._transitionable.setTransition(l.slice(0,-11),d):this._transitionable.setValue(l,d)}}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,a,l){return(!l||l.validate!==!1)&&u.y(this,e.call(u.z,{value:a,style:{glyphs:!0,sprite:!0},styleSpec:u.v}))}}const ht=new u.r({"sky-color":new u.D(u.v.sky["sky-color"]),"horizon-color":new u.D(u.v.sky["horizon-color"]),"fog-color":new u.D(u.v.sky["fog-color"]),"fog-ground-blend":new u.D(u.v.sky["fog-ground-blend"]),"horizon-fog-blend":new u.D(u.v.sky["horizon-fog-blend"]),"sky-horizon-blend":new u.D(u.v.sky["sky-horizon-blend"]),"atmosphere-blend":new u.D(u.v.sky["atmosphere-blend"])});class nt extends u.E{constructor(e){super(),this._transitionable=new u.t(ht),this.setSky(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new u.F(0))}setSky(e,a={}){if(!this._validate(u.G,e,a)){e||(e={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(const l in e){const d=e[l];l.endsWith("-transition")?this._transitionable.setTransition(l.slice(0,-11),d):this._transitionable.setValue(l,d)}}}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,a,l={}){return l?.validate!==!1&&u.y(this,e.call(u.z,u.e({value:a,style:{glyphs:!0,sprite:!0},styleSpec:u.v})))}calculateFogBlendOpacity(e){return e<60?0:e<70?(e-60)/10:1}}class bt{constructor(e,a){this.width=e,this.height=a,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(e,a){const l=e.join(",")+String(a);return this.dashEntry[l]||(this.dashEntry[l]=this.addDash(e,a)),this.dashEntry[l]}getDashRanges(e,a,l){const d=[];let m=e.length%2==1?-e[e.length-1]*l:0,y=e[0]*l,w=!0;d.push({left:m,right:y,isDash:w,zeroLength:e[0]===0});let S=e[0];for(let P=1;P<e.length;P++){w=!w;const k=e[P];m=S*l,S+=k,y=S*l,d.push({left:m,right:y,isDash:w,zeroLength:k===0})}return d}addRoundDash(e,a,l){const d=a/2;for(let m=-l;m<=l;m++){const y=this.width*(this.nextRow+l+m);let w=0,S=e[w];for(let P=0;P<this.width;P++){P/S.right>1&&(S=e[++w]);const k=Math.abs(P-S.left),B=Math.abs(P-S.right),L=Math.min(k,B);let j;const G=m/l*(d+1);if(S.isDash){const ee=d-Math.abs(G);j=Math.sqrt(L*L+ee*ee)}else j=d-Math.sqrt(L*L+G*G);this.data[y+P]=Math.max(0,Math.min(255,j+128))}}}addRegularDash(e){for(let w=e.length-1;w>=0;--w){const S=e[w],P=e[w+1];S.zeroLength?e.splice(w,1):P&&P.isDash===S.isDash&&(P.left=S.left,e.splice(w,1))}const a=e[0],l=e[e.length-1];a.isDash===l.isDash&&(a.left=l.left-this.width,l.right=a.right+this.width);const d=this.width*this.nextRow;let m=0,y=e[m];for(let w=0;w<this.width;w++){w/y.right>1&&(y=e[++m]);const S=Math.abs(w-y.left),P=Math.abs(w-y.right),k=Math.min(S,P);this.data[d+w]=Math.max(0,Math.min(255,(y.isDash?k:-k)+128))}}addDash(e,a){const l=a?7:0,d=2*l+1;if(this.nextRow+d>this.height)return u.w("LineAtlas out of space"),null;let m=0;for(let w=0;w<e.length;w++)m+=e[w];if(m!==0){const w=this.width/m,S=this.getDashRanges(e,this.width,w);a?this.addRoundDash(S,w,l):this.addRegularDash(S)}const y={y:(this.nextRow+l+.5)/this.height,height:2*l/this.height,width:m};return this.nextRow+=d,this.dirty=!0,y}bind(e){const a=e.gl;this.texture?(a.bindTexture(a.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,a.texSubImage2D(a.TEXTURE_2D,0,0,0,this.width,this.height,a.ALPHA,a.UNSIGNED_BYTE,this.data))):(this.texture=a.createTexture(),a.bindTexture(a.TEXTURE_2D,this.texture),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.REPEAT),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.REPEAT),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.LINEAR),a.texImage2D(a.TEXTURE_2D,0,a.ALPHA,this.width,this.height,0,a.ALPHA,a.UNSIGNED_BYTE,this.data))}}const _e="maplibre_preloaded_worker_pool";class Xe{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<Xe.workerCount;)this.workers.push(new Worker(u.a.WORKER_URL));return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],this.numActive()===0&&(this.workers.forEach((a=>{a.terminate()})),this.workers=null)}isPreloaded(){return!!this.active[_e]}numActive(){return Object.keys(this.active).length}}const vt=Math.floor(Ce.hardwareConcurrency/2);let at,wt;function Ft(){return at||(at=new Xe),at}Xe.workerCount=u.H(globalThis)?Math.max(Math.min(vt,3),1):1;class zt{constructor(e,a){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=a;const l=this.workerPool.acquire(a);for(let d=0;d<l.length;d++){const m=new u.J(l[d],a);m.name=`Worker ${d}`,this.actors.push(m)}if(!this.actors.length)throw new Error("No actors found")}broadcast(e,a){const l=[];for(const d of this.actors)l.push(d.sendAsync({type:e,data:a}));return Promise.all(l)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(e=!0){this.actors.forEach((a=>{a.remove()})),this.actors=[],e&&this.workerPool.release(this.id)}registerMessageHandler(e,a){for(const l of this.actors)l.registerMessageHandler(e,a)}}function di(){return wt||(wt=new zt(Ft(),u.K),wt.registerMessageHandler("GR",((f,e,a)=>u.m(e,a)))),wt}function si(f,e){const a=u.L();return u.M(a,a,[1,1,0]),u.N(a,a,[.5*f.width,.5*f.height,1]),f.calculatePosMatrix?u.O(a,a,f.calculatePosMatrix(e.toUnwrapped())):a}function Ji(f,e,a,l,d,m,y){var w;const S=(function(L,j,G){if(L)for(const ee of L){const J=j[ee];if(J&&J.source===G&&J.type==="fill-extrusion")return!0}else for(const ee in j){const J=j[ee];if(J.source===G&&J.type==="fill-extrusion")return!0}return!1})((w=d?.layers)!==null&&w!==void 0?w:null,e,f.id),P=m.maxPitchScaleFactor(),k=f.tilesIn(l,P,S);k.sort(zn);const B=[];for(const L of k)B.push({wrappedTileID:L.tileID.wrapped().key,queryResults:L.tile.queryRenderedFeatures(e,a,f._state,L.queryGeometry,L.cameraQueryGeometry,L.scale,d,m,P,si(f.transform,L.tileID),y?(j,G)=>y(L.tileID,j,G):void 0)});return(function(L,j){for(const G in L)for(const ee of L[G])kn(ee,j);return L})((function(L){const j={},G={};for(const ee of L){const J=ee.queryResults,te=ee.wrappedTileID,ae=G[te]=G[te]||{};for(const ue in J){const oe=J[ue],de=ae[ue]=ae[ue]||{},ge=j[ue]=j[ue]||[];for(const le of oe)de[le.featureIndex]||(de[le.featureIndex]=!0,ge.push(le))}}return j})(B),f)}function zn(f,e){const a=f.tileID,l=e.tileID;return a.overscaledZ-l.overscaledZ||a.canonical.y-l.canonical.y||a.wrap-l.wrap||a.canonical.x-l.canonical.x}function kn(f,e){const a=f.feature,l=e.getFeatureState(a.layer["source-layer"],a.id);a.source=a.layer.source,a.layer["source-layer"]&&(a.sourceLayer=a.layer["source-layer"]),a.state=l}function xr(f,e,a){return u._(this,void 0,void 0,(function*(){let l=f;if(f.url?l=(yield u.j(e.transformRequest(f.url,"Source"),a)).data:yield Ce.frameAsync(a),!l)return null;const d=u.Q(u.e(l,f),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in l&&l.vector_layers&&(d.vectorLayerIds=l.vector_layers.map((m=>m.id))),d}))}class qi{constructor(e,a){e&&(a?this.setSouthWest(e).setNorthEast(a):Array.isArray(e)&&(e.length===4?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1])))}setNorthEast(e){return this._ne=e instanceof u.S?new u.S(e.lng,e.lat):u.S.convert(e),this}setSouthWest(e){return this._sw=e instanceof u.S?new u.S(e.lng,e.lat):u.S.convert(e),this}extend(e){const a=this._sw,l=this._ne;let d,m;if(e instanceof u.S)d=e,m=e;else{if(!(e instanceof qi))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(qi.convert(e)):this.extend(u.S.convert(e)):e&&("lng"in e||"lon"in e)&&"lat"in e?this.extend(u.S.convert(e)):this;if(d=e._sw,m=e._ne,!d||!m)return this}return a||l?(a.lng=Math.min(d.lng,a.lng),a.lat=Math.min(d.lat,a.lat),l.lng=Math.max(m.lng,l.lng),l.lat=Math.max(m.lat,l.lat)):(this._sw=new u.S(d.lng,d.lat),this._ne=new u.S(m.lng,m.lat)),this}getCenter(){return new u.S((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 u.S(this.getWest(),this.getNorth())}getSouthEast(){return new u.S(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:a,lat:l}=u.S.convert(e);let d=this._sw.lng<=a&&a<=this._ne.lng;return this._sw.lng>this._ne.lng&&(d=this._sw.lng>=a&&a>=this._ne.lng),this._sw.lat<=l&&l<=this._ne.lat&&d}static convert(e){return e instanceof qi?e:e&&new qi(e)}static fromLngLat(e,a=0){const l=360*a/40075017,d=l/Math.cos(Math.PI/180*e.lat);return new qi(new u.S(e.lng-d,e.lat-l),new u.S(e.lng+d,e.lat+l))}adjustAntiMeridian(){const e=new u.S(this._sw.lng,this._sw.lat),a=new u.S(this._ne.lng,this._ne.lat);return new qi(e,e.lng>a.lng?new u.S(a.lng+360,a.lat):a)}}class $i{constructor(e,a,l){this.bounds=qi.convert(this.validateBounds(e)),this.minzoom=a||0,this.maxzoom=l||24}validateBounds(e){return Array.isArray(e)&&e.length===4?[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 a=Math.pow(2,e.z),l=Math.floor(u.V(this.bounds.getWest())*a),d=Math.floor(u.U(this.bounds.getNorth())*a),m=Math.ceil(u.V(this.bounds.getEast())*a),y=Math.ceil(u.U(this.bounds.getSouth())*a);return e.x>=l&&e.x<m&&e.y>=d&&e.y<y}}class Kn extends u.E{constructor(e,a,l,d){if(super(),this.id=e,this.dispatcher=l,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,u.e(this,u.Q(a,["url","scheme","tileSize","promoteId"])),this._options=u.e({type:"vector"},a),this._collectResourceTiming=a.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(d)}load(){return u._(this,void 0,void 0,(function*(){this._loaded=!1,this.fire(new u.l("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const e=yield xr(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),e&&(u.e(this,e),e.bounds&&(this.tileBounds=new $i(e.bounds,this.minzoom,this.maxzoom)),this.fire(new u.l("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new u.l("data",{dataType:"source",sourceDataType:"content"})))}catch(e){this._tileJSONRequest=null,this.fire(new u.k(e))}}))}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 u.e({},this._options)}loadTile(e){return u._(this,void 0,void 0,(function*(){const a=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),l={request:this.map._requestManager.transformRequest(a,"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,globalState:this.map.getGlobalState()};l.request.collectResourceTiming=this._collectResourceTiming;let d="RT";if(e.actor&&e.state!=="expired"){if(e.state==="loading")return new Promise(((m,y)=>{e.reloadPromise={resolve:m,reject:y}}))}else e.actor=this.dispatcher.getActor(),d="LT";e.abortController=new AbortController;try{const m=yield e.actor.sendAsync({type:d,data:l},e.abortController);if(delete e.abortController,e.aborted)return;this._afterTileLoadWorkerResponse(e,m)}catch(m){if(delete e.abortController,e.aborted)return;if(m&&m.status!==404)throw m;this._afterTileLoadWorkerResponse(e,null)}}))}_afterTileLoadWorkerResponse(e,a){if(a&&a.resourceTiming&&(e.resourceTiming=a.resourceTiming),a&&this.map._refreshExpiredTiles&&e.setExpiryData(a),e.loadVectorData(a,this.map.painter),e.reloadPromise){const l=e.reloadPromise;e.reloadPromise=null,this.loadTile(e).then(l.resolve).catch(l.reject)}}abortTile(e){return u._(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 u._(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 ha extends u.E{constructor(e,a,l,d){super(),this.id=e,this.dispatcher=l,this.setEventedParent(d),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=u.e({type:"raster"},a),u.e(this,u.Q(a,["url","scheme","tileSize"]))}load(){return u._(this,arguments,void 0,(function*(e=!1){this._loaded=!1,this.fire(new u.l("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const a=yield xr(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,a&&(u.e(this,a),a.bounds&&(this.tileBounds=new $i(a.bounds,this.minzoom,this.maxzoom)),this.fire(new u.l("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new u.l("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:e})))}catch(a){this._tileJSONRequest=null,this.fire(new u.k(a))}}))}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 u.e({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(e){return u._(this,void 0,void 0,(function*(){const a=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.abortController=new AbortController;try{const l=yield ut.getImage(this.map._requestManager.transformRequest(a,"Tile"),e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(l&&l.data){this.map._refreshExpiredTiles&&(l.cacheControl||l.expires)&&e.setExpiryData({cacheControl:l.cacheControl,expires:l.expires});const d=this.map.painter.context,m=d.gl,y=l.data;e.texture=this.map.painter.getTileTexture(y.width),e.texture?e.texture.update(y,{useMipmap:!0}):(e.texture=new u.T(d,y,m.RGBA,{useMipmap:!0}),e.texture.bind(m.LINEAR,m.CLAMP_TO_EDGE,m.LINEAR_MIPMAP_NEAREST)),e.state="loaded"}}catch(l){if(delete e.abortController,e.aborted)e.state="unloaded";else if(l)throw e.state="errored",l}}))}abortTile(e){return u._(this,void 0,void 0,(function*(){e.abortController&&(e.abortController.abort(),delete e.abortController)}))}unloadTile(e){return u._(this,void 0,void 0,(function*(){e.texture&&this.map.painter.saveTileTexture(e.texture)}))}hasTransition(){return!1}}class Kr extends ha{constructor(e,a,l,d){super(e,a,l,d),this.type="raster-dem",this.maxzoom=22,this._options=u.e({type:"raster-dem"},a),this.encoding=a.encoding||"mapbox",this.redFactor=a.redFactor,this.greenFactor=a.greenFactor,this.blueFactor=a.blueFactor,this.baseShift=a.baseShift}loadTile(e){return u._(this,void 0,void 0,(function*(){const a=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),l=this.map._requestManager.transformRequest(a,"Tile");e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.abortController=new AbortController;try{const d=yield ut.getImage(l,e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(d&&d.data){const m=d.data;this.map._refreshExpiredTiles&&(d.cacheControl||d.expires)&&e.setExpiryData({cacheControl:d.cacheControl,expires:d.expires});const y=u.b(m)&&u.W()?m:yield this.readImageNow(m),w={type:this.type,uid:e.uid,source:this.id,rawImageData:y,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!e.actor||e.state==="expired"){e.actor=this.dispatcher.getActor();const S=yield e.actor.sendAsync({type:"LDT",data:w});e.dem=S,e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state="loaded"}}}catch(d){if(delete e.abortController,e.aborted)e.state="unloaded";else if(d)throw e.state="errored",d}}))}readImageNow(e){return u._(this,void 0,void 0,(function*(){if(typeof VideoFrame<"u"&&u.X()){const a=e.width+2,l=e.height+2;try{return new u.R({width:a,height:l},yield u.Y(e,-1,-1,a,l))}catch{}}return Ce.getImageData(e,1)}))}_getNeighboringTiles(e){const a=e.canonical,l=Math.pow(2,a.z),d=(a.x-1+l)%l,m=a.x===0?e.wrap-1:e.wrap,y=(a.x+1+l)%l,w=a.x+1===l?e.wrap+1:e.wrap,S={};return S[new u.Z(e.overscaledZ,m,a.z,d,a.y).key]={backfilled:!1},S[new u.Z(e.overscaledZ,w,a.z,y,a.y).key]={backfilled:!1},a.y>0&&(S[new u.Z(e.overscaledZ,m,a.z,d,a.y-1).key]={backfilled:!1},S[new u.Z(e.overscaledZ,e.wrap,a.z,a.x,a.y-1).key]={backfilled:!1},S[new u.Z(e.overscaledZ,w,a.z,y,a.y-1).key]={backfilled:!1}),a.y+1<l&&(S[new u.Z(e.overscaledZ,m,a.z,d,a.y+1).key]={backfilled:!1},S[new u.Z(e.overscaledZ,e.wrap,a.z,a.x,a.y+1).key]={backfilled:!1},S[new u.Z(e.overscaledZ,w,a.z,y,a.y+1).key]={backfilled:!1}),S}unloadTile(e){return u._(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.t
173ype,uid:e.uid,source:this.id}}))}))}}class da extends u.E{constructor(e,a,l,d){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:a.data},this.actor=l.getActor(),this.setEventedParent(d),this._data=a.data,this._options=u.e({},a),this._collectResourceTiming=a.collectResourceTiming,a.maxzoom!==void 0&&(this.maxzoom=a.maxzoom),a.type&&(this.type=a.type),a.attribution&&(this.attribution=a.attribution),this.promoteId=a.promoteId,a.clusterMaxZoom!==void 0&&this.maxzoom<=a.clusterMaxZoom&&u.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${a.clusterMaxZoom}".`),this.workerOptions=u.e({source:this.id,cluster:a.cluster||!1,geojsonVtOptions:{buffer:this._pixelsToTileUnits(a.buffer!==void 0?a.buffer:128),tolerance:this._pixelsToTileUnits(a.tolerance!==void 0?a.tolerance:.375),extent:u.$,maxZoom:this.maxzoom,lineMetrics:a.lineMetrics||!1,generateId:a.generateId||!1},superclusterOptions:{maxZoom:this._getClusterMaxZoom(a.clusterMaxZoom),minPoints:Math.max(2,a.clusterMinPoints||2),extent:u.$,radius:this._pixelsToTileUnits(a.clusterRadius||50),log:!1,generateId:a.generateId||!1},clusterProperties:a.clusterProperties,filter:a.filter},a.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}_pixelsToTileUnits(e){return e*(u.$/this.tileSize)}_getClusterMaxZoom(e){const a=e?Math.round(e):this.maxzoom-1;return Number.isInteger(e)||e===void 0||u.w(`Integer expected for option 'clusterMaxZoom': provided value "${e}" rounded to "${a}"`),a}load(){return u._(this,void 0,void 0,(function*(){yield this._updateWorkerData()}))}onAdd(e){this.map=e,this.load()}setData(e){return this._data=e,this._pendingWorkerUpdate={data:e},this._updateWorkerData(),this}updateData(e){return this._pendingWorkerUpdate.diff=u.a0(this._pendingWorkerUpdate.diff,e),this._updateWorkerData(),this}getData(){return u._(this,void 0,void 0,(function*(){const e=u.e({type:this.type},this.workerOptions);return this.actor.sendAsync({type:"GD",data:e})}))}getCoordinatesFromGeometry(e){return e.type==="GeometryCollection"?e.geometries.map((a=>a.coordinates)).flat(1/0):e.coordinates.flat(1/0)}getBounds(){return u._(this,void 0,void 0,(function*(){const e=new qi,a=yield this.getData();let l;switch(a.type){case"FeatureCollection":l=a.features.map((d=>this.getCoordinatesFromGeometry(d.geometry))).flat(1/0);break;case"Feature":l=this.getCoordinatesFromGeometry(a.geometry);break;default:l=this.getCoordinatesFromGeometry(a)}if(l.length==0)return e;for(let d=0;d<l.length-1;d+=2)e.extend([l[d],l[d+1]]);return e}))}setClusterOptions(e){return this.workerOptions.cluster=e.cluster,e&&(e.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=this._pixelsToTileUnits(e.clusterRadius)),e.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=this._getClusterMaxZoom(e.clusterMa
173xZoom))),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,a,l){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:e,limit:a,offset:l}})}_updateWorkerData(){return u._(this,void 0,void 0,(function*(){if(this._isUpdatingWorker)return;const{data:e,diff:a}=this._pendingWorkerUpdate;if(!e&&!a)return void u.w(`No data or diff provided to GeoJSONSource ${this.id}.`);const l=u.e({type:this.type},this.workerOptions);e?(typeof e=="string"?(l.request=this.map._requestManager.transformRequest(Ce.resolveURL(e),"Source"),l.request.collectResourceTiming=this._collectResourceTiming):l.data=JSON.stringify(e),this._pendingWorkerUpdate.data=void 0):a&&(l.dataDiff=a,this._pendingWorkerUpdate.diff=void 0),this._isUpdatingWorker=!0,this.fire(new u.l("dataloading",{dataType:"source"}));try{const d=yield this.actor.sendAsync({type:"LD",data:l});if(this._isUpdatingWorker=!1,this._removed||d.abandoned)return void this.fire(new u.l("dataabort",{dataType:"source"}));this._data=d.data;let m=null;d.resourceTiming&&d.resourceTiming[this.id]&&(m=d.resourceTiming[this.id].slice(0));const y={dataType:"source"};this._collectResourceTiming&&m&&m.length>0&&u.e(y,{resourceTiming:m}),this.fire(new u.l("data",Object.assign(Object.assign({},y),{sourceDataType:"metadata"}))),this.fire(new u.l("data",Object.assign(Object.assign({},y),{sourceDataType:"content"})))}catch(d){if(this._isUpdatingWorker=!1,this._removed)return void this.fire(new u.l("dataabort",{dataType:"source"}));this.fire(new u.k(d))}finally{(this._pendingWorkerUpdate.data||this._pendingWorkerUpdate.diff)&&this._updateWorkerData()}}))}loaded(){return!this._isUpdatingWorker&&this._pendingWorkerUpdate.data===void 0&&this._pendingWorkerUpdate.diff===void 0}loadTile(e){return u._(this,void 0,void 0,(function*(){const a=e.actor?"RT":"LT";e.actor=this.actor;const l={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,globalState:this.map.getGlobalState()};e.abortController=new AbortController;const d=yield this.actor.sendAsync({type:a,data:l},e.abortController);delete e.abortController,e.unloadVectorData(),e.aborted||e.loadVectorData(d,this.map.painter,a==="RT")}))}abortTile(e){return u._(this,void 0,void 0,(function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.aborted=!0}))}unloadTile(e){return u._(this,void 0,void 0,(function*(){e.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.t
vendor: 5,320 bytes, line 173
173ype,source:this.id}})}))}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return u.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}class Wn extends u.E{constructor(e,a,l,d){super(),this.flippedWindingOrder=!1,this.id=e,this.dispatcher=l,this.coordinates=a.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(d),this.options=a}load(e){return u._(this,void 0,void 0,(function*(){this._loaded=!1,this.fire(new u.l("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const a=yield ut.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,a&&a.data&&(this.image=a.data,e&&(this.coordinates=e),this._finishLoading())}catch(a){this._request=null,this._loaded=!0,this.fire(new u.k(a))}}))}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 u.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 a=e.map(u.a1.fromLngLat);var l;return this.tileID=(function(d){const m=u.a2.fromPoints(d),y=m.width(),w=m.height(),S=Math.max(y,w),P=Math.max(0,Math.floor(-Math.log(S)/Math.LN2)),k=Math.pow(2,P);return new u.a4(P,Math.floor((m.minX+m.maxX)/2*k),Math.floor((m.minY+m.maxY)/2*k))})(a),this.terrainTileRanges=this._getOverlappingTileRanges(a),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=a.map((d=>this.tileID.getTilePoint(d)._round())),this.flippedWindingOrder=((l=this.tileCoords)[1].x-l[0].x)*(l[2].y-l[0].y)-(l[1].y-l[0].y)*(l[2].x-l[0].x)<0,this.fire(new u.l("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const e=this.map.painter.context,a=e.gl;this.texture||(this.texture=new u.T(e,this.image,a.RGBA),this.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE));let l=!1;for(const d in this.tiles){const m=this.tiles[d];m.state!=="loaded"&&(m.state="loaded",m.texture=this.texture,l=!0)}l&&this.fire(new u.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(e){return u._(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:a,minY:l,maxX:d,maxY:m}=u.a2.fromPoints(e),y={};for(let w=0;w<=u.a3;w++){const S=Math.pow(2,w),P=Math.floor(a*S),k=Math.floor(l*S),B=Math.floor(d*S),L=Math.floor(m*S);y[w]={minTileX:P,minTileY:k,maxTileX:B,maxTileY:L}}return y}}class ms extends Wn{constructor(e,a,l,d){super(e,a,l,d),this.roundZoom=!0,this.type="video",this.options=a}load(){return u._(this,void 0,void 0,(function*(){this._loaded=!1;const e=this.options;this.urls=[];for(const a of e.urls)this.urls.push(this.map._requestManager.transformRequest(a,"Source").url);try{const a=yield u.a5(this.urls);if(this._loaded=!0,!a)return;this.video=a,this.video.loop=!0,this.video.addEventListener("playing",(()=>{this.map.triggerRepaint()})),this.map&&this.video.play(),this._finishLoading()}catch(a){this.fire(new u.k(a))}}))}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){const a=this.video.seekable;e<a.start(0)||e>a.end(0)?this.fire(new u.k(new u.a6(`sources.${this.id}`,null,`Playback for this video can be set only between the ${a.start(0)} and ${a.end(0)}-second mark.`))):this.video.currentTime=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(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const e=this.map.painter.context,a=e.gl;this.texture?this.video.paused||(this.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE),a.texSubImage2D(a.TEXTURE_2D,0,0,0,a.RGBA,a.UNSIGNED_BYTE,this.video)):(this.texture=new u.T(e,this.video,a.RGBA),this.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE));let l=!1;for(const d in this.tiles){const m=this.tiles[d];m.state!=="loaded"&&(m.state="loaded",m.texture=this.texture,l=!0)}l&&this.fire(new u.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 Qn extends Wn{constructor(e,a,l,d){super(e,a,l,d),a.coordinates?Array.isArray(a.coordinates)&&a.coordinates.length===4&&!a.coordinates.some((m=>!Array.isArray(m)||m.length!==2||m.some((y=>typeof y!="number"))))||this.fire(new u.k(new u.a6(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new u.k(new u.a6(`sources.${e}`,null,'missing required property "coordinates"'))),a.animate&&typeof a.animate!="boolean"&&this.fire(new u.k(new u.a6(`sources.${e}
173`,null,'optional "animate" property must be a boolean value'))),a.canvas?typeof a.canvas=="string"||a.canvas instanceof HTMLCanvasElement||this.fire(new u.k(new u.a6(`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 u.k(new u.a6(`sources.${e}`,null,'missing required property "canvas"'))),this.options=a,this.animate=a.animate===void 0||a.animate}load(){return u._(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 u.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()||Object.keys(this.tiles).length===0)return;const a=this.map.painter.context,l=a.gl;this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new u.T(a,this.canvas,l.RGBA,{premultiply:!0});let d=!1;for(const m in this.tiles){const y=this.tiles[m];y.state!=="loaded"&&(y.state="loaded",y.texture=this.texture,d=!0)}d&&this.fire(new u.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"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 Qa={},Da=f=>{switch(f){case"geojson":return da;case"image":return Wn;case"raster":return ha;case"raster-dem":return Kr;case"vector":return Kn;case"video":return ms;case"canvas":return Qn}return Qa[f]},gs="RTLPluginLoaded";class Yt extends u.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=di()}_syncState(e){return this.status=e,this.dispatcher.broadcast("SRPS",{pluginStatus:e,pluginURL:this.url}).catch((a=>{throw this.status="error",a}))}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(e){return u._(this,arguments,void 0,(function*(a,l=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=Ce.resolveURL(a),!this.url)throw new Error(`requested url ${a} is invalid`);if(this.status==="unavailable"){if(!l)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()}))}_requestImport(){return u._(this,void 0,void 0,(function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new u.l(gs))}))}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let Ti=null;function sr(){return Ti||(Ti=new Yt),Ti}class In{constructor(e,a){this.timeAdded=0,this.fadeEndTime=0,this.tileID=e,this.uid=u.a7(),this.uses=0,this.tileSize=a,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(e){const a=e+this.timeAdded;a<this.fadeEndTime||(this.fadeEndTime=a)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(e){this.demTexture&&e.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(e,a,l){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.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=(function(d,m){const y={};if(!m)return y;for(const w of d){const S=w.layerIds.map((P=>
vendor: 14,851 bytes, line 173
173m.getLayer(P))).filter(Boolean);if(S.length!==0){w.layers=S,w.stateDependentLayerIds&&(w.stateDependentLayers=w.stateDependentLayerIds.map((P=>S.filter((k=>k.id===P))[0])));for(const P of S)y[P.id]=w}}return y})(e.buckets,a?.style),this.hasSymbolBuckets=!1;for(const d in this.buckets){const m=this.buckets[d];if(m instanceof u.a9){if(this.hasSymbolBuckets=!0,!l)break;m.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const d in this.buckets){const m=this.buckets[d];if(m instanceof u.a9&&m.hasRTLText){this.hasRTLText=!0,sr().lazyLoad();break}}this.queryPadding=0;for(const d in this.buckets){const m=this.buckets[d];this.queryPadding=Math.max(this.queryPadding,a.style.getLayer(d).queryRadius(m))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage)}else this.collisionBoxArray=new u.a8}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.latestFeatureIndex=null,this.state="unloaded"}getBucket(e){return this.buckets[e.id]}upload(e){for(const l in this.buckets){const d=this.buckets[l];d.uploadPending()&&d.upload(e)}const a=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new u.T(e,this.imageAtlas.image,a.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new u.T(e,this.glyphAtlasImage,a.ALPHA),this.glyphAtlasImage=null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,a,l,d,m,y,w,S,P,k,B){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:d,cameraQueryGeometry:m,scale:y,tileSize:this.tileSize,pixelPosMatrix:k,transform:S,params:w,queryPadding:this.queryPadding*P,getElevation:B},e,a,l):{}}querySourceFeatures(e,a){const l=this.latestFeatureIndex;if(!l||!l.rawTileData)return;const d=l.loadVTLayers(),m=a&&a.sourceLayer?a.sourceLayer:"",y=d._geojsonTileLayer||d[m];if(!y)return;const w=u.aa(a&&a.filter),{z:S,x:P,y:k}=this.tileID.canonical,B={z:S,x:P,y:k};for(let L=0;L<y.length;L++){const j=y.feature(L);if(w.needGeometry){const J=u.ab(j,!0);if(!w.filter(new u.F(this.tileID.overscaledZ),J,this.tileID.canonical))continue}else if(!w.filter(new u.F(this.tileID.overscaledZ),j))continue;const G=l.getId(j,m),ee=new u.ac(j,S,P,k,G);ee.tile=B,e.push(ee)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){const a=this.expirationTime;if(e.cacheControl){const l=u.ad(e.cacheControl);l["max-age"]&&(this.expirationTime=Date.now()+1e3*l["max-age"])}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){const l=Date.now();let d=!1;if(this.expirationTime>l)d=!1;else if(a)if(this.expirationTime<a)d=!0;else{const m=this.expirationTime-a;m?this.expirationTime=l+Math.max(m,3e4):d=!0}else d=!0;d?(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,a){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(e).length===0)return;const l=this.latestFeatureIndex.loadVTLayers();for(const d in this.buckets){if(!a.style.hasLayer(d))continue;const m=this.buckets[d],y=m.layers[0].sourceLayer||"_geojsonTileLayer",w=l[y],S=e[y];if(!w||!S||Object.keys(S).length===0)continue;m.update(S,w,this.imageAtlas&&this.imageAtlas.patternPositions||{});const P=a&&a.style&&a.style.getLayer(d);P&&(this.queryPadding=Math.max(this.queryPadding,P.queryRadius(m)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<Ce.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(e){this.symbolFadeHoldUntil=Ce.now()+e}setDependencies(e,a){const l={};for(const d of a)l[d]=!0;this.dependencies[e]=l}hasDependency(e,a){for(const l of e){const d=this.dependencies[l];if(d){for(const m of a)if(d[m])return!0}}return!1}}class ye{constructor(e,a){this.max=e,this.onRemove=a,this.reset()}reset(){for(const e in this.data)for(const a of this.data[e])a.timeout&&clearTimeout(a.timeout),this.onRemove(a.value);return this.data={},this.order=[],this}add(e,a,l){const d=e.wrapped().key;this.data[d]===void 0&&(this.data[d]=[]);const m={value:a,timeout:void 0};if(l!==void 0&&(m.timeout=setTimeout((()=>{this.remove(e,m)}),l)),this.data[d].push(m),this.order.push(d),this.order.length>this.max){const y=this._getAndRemoveByKey(this.order[0]);y&&this.onRemove(y)}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 a=this.data[e].shift();return a.timeout&&clearTimeout(a.timeout),this.data[e].length===0&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),a.value}getByKey(e){const a=this.data[e];return a?a[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,a){if(!this.has(e))return this;const l=e.wrapped().key,d=a===void 0?0:this.data[l].indexOf(a),m=this.data[l][d];return this.data[l].splice(d,1),m.timeout&&clearTimeout(m.timeout),this.data[l].length===0&&delete this.data[l],this.onRemove(m.value),this.order.splice(this.order.indexOf(l),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){const a=this._getAndRemoveByKey(this.order[0]);a&&this.onRemove(a)}return this}filter(e){const a=[];for(const l in this.data)for(const d of this.data[l])e(d.value)||a.push(d);for(const l of a)this.remove(l.value.tileID,l)}}class Z{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,a,l){const d=String(a);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][d]=this.stateChanges[e][d]||{},u.e(this.stateChanges[e][d],l),this.deletedStates[e]===null){this.deletedStates[e]={};for(const m in this.state[e])m!==d&&(this.deletedStates[e][m]=null)}else if(this.deletedStates[e]&&this.deletedStates[e][d]===null){this.deletedStates[e][d]={};for(const m in this.state[e][d])l[m]||(this.deletedStates[e][d][m]=null)}else for(const m in l)this.deletedStates[e]&&this.deletedStates[e][d]&&this.deletedStates[e][d][m]===null&&delete this.deletedStates[e][d][m]}removeFeatureState(e,a,l){if(this.deletedStates[e]===null)return;const d=String(a);if(this.deletedStates[e]=this.deletedStates[e]||{},l&&a!==void 0)this.deletedStates[e][d]!==null&&(this.deletedStates[e][d]=this.deletedStates[e][d]||{},this.deletedStates[e][d][l]=null);else if(a!==void 0)if(this.stateChanges[e]&&this.stateChanges[e][d])for(l in this.deletedStates[e][d]={},this.stateChanges[e][d])this.deletedStates[e][d][l]=null;else this.deletedStates[e][d]=null;else this.deletedStates[e]=null}getState(e,a){const l=String(a),d=u.e({},(this.state[e]||{})[l],(this.stateChanges[e]||{})[l]);if(this.deletedStates[e]===null)return{};if(this.deletedStates[e]){const m=this.deletedStates[e][a];if(m===null)return{};for(const y in m)delete d[y]}return d}initializeTileState(e,a){e.setFeatureState(this.state,a)}coalesceChanges(e,a){const l={};for(const d in this.stateChanges){this.state[d]=this.state[d]||{};const m={};for(const y in this.stateChanges[d])this.state[d][y]||(this.state[d][y]={}),u.e(this.state[d][y],this.stateChanges[d][y]),m[y]=this.state[d][y];l[d]=m}for(const d in this.deletedStates){this.state[d]=this.state[d]||{};const m={};if(this.deletedStates[d]===null)for(const y in this.state[d])m[y]={},this.state[d][y]={};else for(const y in this.deletedStates[d]){if(this.deletedStates[d][y]===null)this.state[d][y]={};else for(const w of Object.keys(this.deletedStates[d][y]))delete this.state[d][y][w];m[y]=this.state[d][y]}l[d]=l[d]||{},u.e(l[d],m)}if(this.stateChanges={},this.deletedStates={},Object.keys(l).length!==0)for(const d in e)e[d].setFeatureState(l,a)}}const Y=89.25;function W(f,e){const a=u.ah(e.lat,-u.ai,u.ai);return new u.P(u.V(e.lng)*f,u.U(a)*f)}function ce(f,e){return new u.a1(e.x/f,e.y/f).toLngLat()}function me(f){return f.cameraToCenterDistance*Math.min(.85*Math.tan(u.ae(90-f.pitch)),Math.tan(u.ae(Y-f.pitch)))}function ve(f,e){const a=f.canonical,l=e/u.af(a.z),d=a.x+Math.pow(2,a.z)*f.wrap,m=u.ag(new Float64Array(16));return u.M(m,m,[d*l,a.y*l,0]),u.N(m,m,[l/u.$,l/u.$,1]),m}function Re(f,e,a,l,d){const m=u.a1.fromLngLat(f,e),y=d*u.aj(1,f.lat),w=y*Math.cos(u.ae(a)),S=Math.sqrt(y*y-w*w),P=S*Math.sin(u.ae(-l)),k=S*Math.cos(u.ae(-l));return new u.a1(m.x+P,m.y+k,m.z+w)}function Te(f,e,a){const l=e.intersectsFrustum(f);if(!a||l===0)return l;const d=e.intersectsPlane(a);return d===0?0:l===2&&d===2?2:1}function Ge(f,e,a){let l=0;const d=(a-e)/10;for(let m=0;m<10;m++)l+=d*Math.pow(Math.cos(e+(m+.5)/10*(a-e)),f);return l}function rt(f,e){return function(a,l,d,m,y){const w=2*((f-1)/u.ak(Math.cos(u.ae(Y-y))/Math.cos(u.ae(Y)))-1),S=Math.acos(d/m),P=2*Ge(w-1,0,u.ae(y/2)),k=Math.min(u.ae(Y),S+u.ae(y/2)),B=Ge(w-1,Math.min(k,S-u.ae(y/2)),k),L=Math.atan(l/d),j=Math.hypot(l,d);let G=a;return G+=u.ak(m/j/Math.max(.5,Math.cos(u.ae(y/2)))),G+=w*u.ak(Math.cos(L))/2,G-=u.ak(Math.max(1,B/P/e))/2,G}}const Ye=rt(9.314,3);function Ct(f,e){const a=(e.roundZoom?Math.round:Math.floor)(f.zoom+u.ak(f.tileSize/e.tileSize));return Math.max(0,a)}function Me(f,e){const a=f.getCameraFrustum(),l=f.getClippingPlane(),d=f.screenPointToMercatorCoordinate(f.getCameraPoint()),m=u.a1.fromLngLat(f.center,f.elevation);d.z=m.z+Math.cos(f.pitchInRadians)*f.cameraToCenterDistance/f.worldSize;const y=f.getCoveringTilesDetailsProvider(),w=y.allowVariableZoom(f,e),S=Ct(f,e),P=e.minzoom||0,k=e.maxzoom!==void 0?e.maxzoom:f.maxZoom,B=Math.min(Math.max(0,S),k),L=Math.pow(2,B),j=[L*d.x,L*d.y,0],G=[L*m.x,L*m.y,0],ee=Math.hypot(m.x-d.x,m.y-d.y),J=Math.abs(m.z-d.z),te=Math.hypot(ee,J),ae=de=>({zoom:0,x:0,y:0,wrap:de,fullyVisible:!1}),ue=[],oe=[];if(f.renderWorldCopies&&y.allowWorldCopies())for(let de=1;de<=3;de++)ue.push(ae(-de)),ue.push(ae(de));for(ue.push(ae(0));ue.length>0;){const de=ue.pop(),ge=de.x,le=de.y;let Se=de.fullyVisible;const Oe={x:ge,y:le,z:de.zoom},ze=y.getTileBoundingVolume(Oe,de.wrap,f.elevation,e);if(!Se){const ct=Te(a,ze,l);if(ct===0)continue;Se=ct===2}const ke=y.distanceToTile2d(d.x,d.y,Oe,ze);let Le=S;w&&(Le=(e.calculateTileZoom||Ye)(f.zoom+u.ak(f.tileSize/e.tileSize),ke,J,te,f.fov)),Le=(e.roundZoom?Math.round:Math.floor)(Le),Le=Math.max(0,Le);const ot=Math.min(Le,k);if(de.wrap=y.getWrap(m,Oe,de.wrap),de.zoom>=ot){if(de.zoom<P)continue;const ct=B-de.zoom,We=j[0]-.5-(ge<<ct),Et=j[1]-.5-(le<<ct),ii=e.reparseOverscaled?Math.max(de.zoom,Le):de.zoom;oe.push({tileID:new u.Z(de.zoom===k?ii:de.zoom,de.wrap,de.zoom,ge,le),distanceSq:u.al([G[0]-.5-ge,G[1]-.5-le]),tileDistanceToCamera:Math.sqrt(We*We+Et*Et)})}else for(let ct=0;ct<4;ct++)ue.push({zoom:de.zoom+1,x:(ge<<1)+ct%2,y:(le<<1)+(ct>>1),wrap:de.wrap,fullyVisible:Se})}return oe.sort(((de,ge)=>de.distanceSq-ge.distanceSq)).map((de=>de.tileID))}const Zt=u.a2.fromPoints([new u.P(0,0),new u.P(u.$,u.$)]);class oi extends u.E{constructor(e,a,l){super(),this.id=e,this.dispatcher=l,this.on("data",(d=>this._dataHandler(d))),this.on("dataloading",(()=>{this._sourceErrored=!1})),this.on("error",(()=>{this._sourceErrored=this._source.loaded()})),this._source=((d,m,y,w)=>{const S=new(Da(m.type))(d,m,y,w);if(S.id!==d)throw new Error(`Expected Source id to be ${d} instead of ${S.id}`);return S})(e,a,l,this),this._tiles={},this._cache=new ye(0,(d=>this._unloadTile(d))),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Z,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){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(e)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(this.used===void 0&&this.usedForTerrain===void 0||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(const e in this._tiles){const a=this._tiles[e];if(a.state!=="loaded"&&a.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(e,a,l){return u._(this,void 0,void 0,(function*(){try{yield this._source.loadTile(e),this._tileLoaded(e,a,l)}catch(d){e.state="errored",d.status!==404?this._source.fire(new u.k(d,{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 u.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._tiles,this.map?this.map.painter:null);for(const a in this._tiles){const l=this._tiles[a];l.upload(e),l.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map((e=>e.tileID)).sort(kt).map((e=>e.key))}getRenderableIds(e){const a=[];for(const l in this._tiles)this._isIdRenderable(l,e)&&a.push(this._tiles[l]);return e?a.sort(((l,d)=>{const m=l.tileID,y=d.tileID,w=new u.P(m.canonical.x,m.canonical.y)._rotate(-this.transform.bearingInRadians),S=new u.P(y.canonical.x,y.canonical.y)._rotate(-this.transform.bearingInRadians);return m.overscaledZ-y.overscaledZ||S.y-w.y||S.x-w.x})).map((l=>l.tileID.key)):a.map((l=>l.tileID)).sort(kt).map((l=>l.key))}hasRenderableParent(e){const a=this.findLoadedParent(e,0);return!!a&&this._isIdRenderable(a.tileID.key)}_isIdRenderable(e,a){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(a||!this._tiles[e].holdingForFade())}reload(e){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const a in this._tiles)e?this._reloadTile(a,"expired"):this._tiles[a].state!=="errored"&&this._reloadTile(a,"reloading")}}_reloadTile(e,a){return u._(this,void 0,void 0,(function*(){const l=this._tiles[e];l&&(l.state!=="loading"&&(l.state=a),yield this._loadTile(l,e,a))}))}_tileLoaded(e,a,l){e.timeAdded=Ce.now(),l==="expired"&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(a,e),this.get
vendor: 9,056 bytes, line 173
173Source().type==="raster-dem"&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new u.l("data",{dataType:"source",tile:e,coord:e.tileID}))}_backfillDEM(e){const a=this.getRenderableIds();for(let d=0;d<a.length;d++){const m=a[d];if(e.neighboringTiles&&e.neighboringTiles[m]){const y=this.getTileByID(m);l(e,y),l(y,e)}}function l(d,m){d.needsHillshadePrepare=!0,d.needsTerrainPrepare=!0;let y=m.tileID.canonical.x-d.tileID.canonical.x;const w=m.tileID.canonical.y-d.tileID.canonical.y,S=Math.pow(2,d.tileID.canonical.z),P=m.tileID.key;y===0&&w===0||Math.abs(w)>1||(Math.abs(y)>1&&(Math.abs(y+S)===1?y+=S:Math.abs(y-S)===1&&(y-=S)),m.dem&&d.dem&&(d.dem.backfillBorder(m.dem,y,w),d.neighboringTiles&&d.neighboringTiles[P]&&(d.neighboringTiles[P].backfilled=!0)))}}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,a,l,d){for(const m in this._tiles){let y=this._tiles[m];if(d[m]||!y.hasData()||y.tileID.overscaledZ<=a||y.tileID.overscaledZ>l)continue;let w=y.tileID;for(;y&&y.tileID.overscaledZ>a+1;){const P=y.tileID.scaledTo(y.tileID.overscaledZ-1);y=this._tiles[P.key],y&&y.hasData()&&(w=P)}let S=w;for(;S.overscaledZ>a;)if(S=S.scaledTo(S.overscaledZ-1),e[S.key]||e[S.canonical.key]){d[w.key]=w;break}}}findLoadedParent(e,a){if(e.key in this._loadedParentTiles){const l=this._loadedParentTiles[e.key];return l&&l.tileID.overscaledZ>=a?l:null}for(let l=e.overscaledZ-1;l>=a;l--){const d=e.scaledTo(l),m=this._getLoadedTile(d);if(m)return m}}findLoadedSibling(e){return this._getLoadedTile(e)}_getLoadedTile(e){const a=this._tiles[e.key];return a&&a.hasData()?a:this._cache.getByKey(e.wrapped().key)}updateCacheSize(e){const a=Math.ceil(e.width/this._source.tileSize)+1,l=Math.ceil(e.height/this._source.tileSize)+1,d=Math.floor(a*l*(this._maxTileCacheZoomLevels===null?u.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),m=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,d):d;this._cache.setMaxSize(m)}handleWrapJump(e){const a=Math.round((e-(this._prevLng===void 0?e:this._prevLng))/360);if(this._prevLng=e,a){const l={};for(const d in this._tiles){const m=this._tiles[d];m.tileID=m.tileID.unwrapTo(m.tileID.wrap+a),l[m.tileID.key]=m}this._tiles=l;for(const d in this._timers)clearTimeout(this._timers[d]),delete this._timers[d];for(const d in this._tiles)this._setTileReloadTimer(d,this._tiles[d])}}_updateCoveredAndRetainedTiles(e,a,l,d,m,y){const w={},S={},P=Object.keys(e),k=Ce.now();for(const B of P){const L=e[B],j=this._tiles[B];if(!j||j.fadeEndTime!==0&&j.fadeEndTime<=k)continue;const G=this.findLoadedParent(L,a),ee=this.findLoadedSibling(L),J=G||ee||null;J&&(this._addTile(J.tileID),w[J.tileID.key]=J.tileID),S[B]=L}this._retainLoadedChildren(S,d,l,e);for(const B in w)e[B]||(this._coveredTiles[B]=!0,e[B]=w[B]);if(y){const B={},L={};for(const j of m)this._tiles[j.key].hasData()?B[j.key]=j:L[j.key]=j;for(const j in L){const G=L[j].children(this._source.maxzoom);this._tiles[G[0].key]&&this._tiles[G[1].key]&&this._tiles[G[2].key]&&this._tiles[G[3].key]&&(B[G[0].key]=e[G[0].key]=G[0],B[G[1].key]=e[G[1].key]=G[1],B[G[2].key]=e[G[2].key]=G[2],B[G[3].key]=e[G[3].key]=G[3],delete L[j])}for(const j in L){const G=L[j],ee=this.findLoadedParent(G,this._source.minzoom),J=this.findLoadedSibling(G),te=ee||J||null;if(te){B[te.tileID.key]=e[te.tileID.key]=te.tileID;for(const ae in B)B[ae].isChildOf(te.tileID)&&delete B[ae]}}for(const j in this._tiles)B[j]||(this._coveredTiles[j]=!0)}}update(e,a){if(!this._sourceLoaded||this._paused)return;let l;this.transform=e,this.terrain=a,this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?l=e.getVisibleUnwrappedCoordinates(this._source.tileID).map((k=>new u.Z(k.canonical.z,k.wrap,k.canonical.z,k.canonical.x,k.canonical.y))):(l=Me(e,{tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:a,calculateTileZoom:this._source.calculateTileZoom}),this._source.hasTile&&(l=l.filter((k=>this._source.hasTile(k))))):l=[];const d=Ct(e,this._source),m=Math.max(d-oi.maxOverzooming,this._source.minzoom),y=Math.max(d+oi.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const k={};for(const B of l)if(B.canonical.z>this._source.minzoom){const L=B.scaledTo(B.canonical.z-1);k[L.key]=L;const j=B.scaledTo(Math.max(this._source.minzoom,Math.min(B.canonical.z,5)));k[j.key]=j}l=l.concat(Object.values(k))}const w=l.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,w&&this.fire(new u.l("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const S=this._updateRetainedTiles(l,d);Kt(this._source.type)&&this._updateCoveredAndRetainedTiles(S,m,y,d,l,a);for(const k in S)this._tiles[k].clearFadeHold();const P=u.am(this._tiles,S);for(const k of P){const B=this._tiles[k];B.hasSymbolBuckets&&!B.holdingForFade()?B.setHoldDuration(this.map._fadeDuration):B.hasSymbolBuckets&&!B.symbolFadeFinished()||this._removeTile(k)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(const e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(e)}_updateRetainedTiles(e,a){var l;const d={},m={},y=Math.max(a-oi.maxOverzooming,this._source.minzoom),w=Math.max(a+oi.maxUnderzooming,this._source.minzoom),S={};for(const P of e){const k=this._addTile(P);d[P.key]=P,k.hasData()||a<this._source.maxzoom&&(S[P.key]=P)}this._retainLoadedChildren(S,a,w,d);for(const P of e){let k=this._tiles[P.key];if(k.hasData())continue;if(a+1>this._source.maxzoom){const L=P.children(this._source.maxzoom)[0],j=this.getTile(L);if(j&&j.hasData()){d[L.key]=L;continue}}else{const L=P.children(this._source.maxzoom);if(d[L[0].key]&&d[L[1].key]&&d[L[2].key]&&d[L[3].key])continue}let B=k.wasRequested();for(let L=P.overscaledZ-1;L>=y;--L){const j=P.scaledTo(L);if(m[j.key])break;if(m[j.key]=!0,k=this.getTile(j),!k&&B&&(k=this._addTile(j)),k){const G=k.hasData();if((G||!(!((l=this.map)===null||l===void 0)&&l.cancelPendingTileRequestsWhileZooming)||B)&&(d[j.key]=j),B=k.wasRequested(),G)break}}}return d}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const e in this._tiles){const a=[];let l,d=this._tiles[e].tileID;for(;d.overscaledZ>0;){if(d.key in this._loadedParentTiles){l=this._loadedParentTiles[d.key];break}a.push(d.key);const m=d.scaledTo(d.overscaledZ-1);if(l=this._getLoadedTile(m),l)break;d=m}for(const m of a)this._loadedParentTiles[m]=l}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(const e in this._tiles){const a=this._tiles[e].tileID,l=this._getLoadedTile(a);this._loadedSiblingTiles[a.key]=l}}_addTile(e){let a=this._tiles[e.key];if(a)return a;a=this._cache.getAndRemove(e),a&&(this._setTileReloadTimer(e.key,a),a.tileID=e,this._state.initializeTileState(a,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,a)));const l=a;return a||(a=new In(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(a,e.key,a.state)),a.uses++,this._tiles[e.key]=a,l||this._source.fire(new u.l("dataloading",{tile:a,coord:a.tileID,dataType:"source"})),a}_setTileReloadTimer(e,a){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);const l=a.getExpiryTimeout();l&&(this._timers[e]=setTimeout((()=>{this._reloadTile(e,"expired"),delete this._timers[e]}),l))}refreshTiles(e){for(const a in this._tiles)(this._isIdRenderable(a)||this._tiles[a].state=="errored")&&e.some((l=>l.equals(this._tiles[a].tileID.canonical)))&&this._reloadTile(a,"expired")}_removeTile(e){const a=this._tiles[e];a&&(a.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),a.uses>0||(a.hasData()&&a.state!=="reloading"?this._cache.add(a.tileID,a,a.getExpiryTimeout()):(a.aborted=!0,this._abortTile(a),this._unloadTile(a))))}_dataHandler(e){const a=e.sourceDataType;e.dataType==="source"&&a==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&e.dataType==="source"&&a==="content"&&(this.reload(e.sourceDataChanged),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const e in this._tiles)this._removeTile(e);this._cache.reset()}tilesIn(e,a,l){const d=[],m=this.transform;if(!m)return d;const y=m.getCoveringTilesDetailsProvider().allowWorldCopies(),w=l?m.getCameraQueryGeometry(e):e,S=j=>m.screenPointToMercatorCoordinate(j,this.terrain),P=this.transformBbox(e,S,!y),k=this.transformBbox(w,S,!y),B=this.getIds(),L=u.a2.fromPoints(k);for(let j=0;j<B.length;j++){const G=this._tiles[B[j]];if(G.holdingForFade())continue;const ee=y?[G.tileID]:[G.tileID.unwrapTo(-1),G.tileID.unwrapTo(0)],J=Math.pow(2,m.zoom-G.tileID.overscaledZ
vendor: 45,472 bytes, lines 173-200
173),te=a*G.queryPadding*u.$/G.tileSize/J;for(const ae of ee){const ue=L.map((oe=>ae.getTilePoint(new u.a1(oe.x,oe.y))));if(ue.expandBy(te),ue.intersects(Zt)){const oe=P.map((ge=>ae.getTilePoint(ge))),de=k.map((ge=>ae.getTilePoint(ge)));d.push({tile:G,tileID:y?ae:ae.unwrapTo(0),queryGeometry:oe,cameraQueryGeometry:de,scale:J})}}}return d}transformBbox(e,a,l){let d=e.map(a);if(l){const m=u.a2.fromPoints(e);m.shrinkBy(.001*Math.min(m.width(),m.height()));const y=m.map(a);u.a2.fromPoints(d).covers(y)||(d=d.map((w=>w.x>.5?new u.a1(w.x-1,w.y,w.z):w)))}return d}getVisibleCoordinates(e){const a=this.getRenderableIds(e).map((l=>this._tiles[l].tileID));return this.transform&&this.transform.populateCache(a),a}hasTransition(){if(this._source.hasTransition())return!0;if(Kt(this._source.type)){const e=Ce.now();for(const a in this._tiles)if(this._tiles[a].fadeEndTime>=e)return!0}return!1}setFeatureState(e,a,l){this._state.updateState(e=e||"_geojsonTileLayer",a,l)}removeFeatureState(e,a,l){this._state.removeFeatureState(e=e||"_geojsonTileLayer",a,l)}getFeatureState(e,a){return this._state.getState(e=e||"_geojsonTileLayer",a)}setDependencies(e,a,l){const d=this._tiles[e];d&&d.setDependencies(a,l)}reloadTilesForDependencies(e,a){for(const l in this._tiles)this._tiles[l].hasDependency(e,a)&&this._reloadTile(l,"reloading");this._cache.filter((l=>!l.hasDependency(e,a)))}}function kt(f,e){const a=Math.abs(2*f.wrap)-+(f.wrap<0),l=Math.abs(2*e.wrap)-+(e.wrap<0);return f.overscaledZ-e.overscaledZ||l-a||e.canonical.y-f.canonical.y||e.canonical.x-f.canonical.x}function Kt(f){return f==="raster"||f==="image"||f==="video"}oi.maxOverzooming=10,oi.maxUnderzooming=3;class Bi{constructor(e,a){this.reset(e,a)}reset(e,a){this.points=e||[],this._distances=[0];for(let l=1;l<this.points.length;l++)this._distances[l]=this._distances[l-1]+this.points[l].dist(this.points[l-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(a||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(e){if(this.points.length===1)return this.points[0];e=u.ah(e,0,1);let a=1,l=this._distances[a];const d=e*this.paddedLength+this.padding;for(;l<d&&a<this._distances.length;)l=this._distances[++a];const m=a-1,y=this._distances[m],w=l-y,S=w>0?(d-y)/w:0;return this.points[m].mult(1-S).add(this.points[a].mult(S))}}function jr(f,e){let a=!0;return f==="always"||f!=="never"&&e!=="never"||(a=!1),a}class Zr{constructor(e,a,l){const d=this.boxCells=[],m=this.circleCells=[];this.xCellCount=Math.ceil(e/l),this.yCellCount=Math.ceil(a/l);for(let y=0;y<this.xCellCount*this.yCellCount;y++)d.push([]),m.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=a,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/a,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,a,l,d,m){this._forEachCell(a,l,d,m,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(a),this.bboxes.push(l),this.bboxes.push(d),this.bboxes.push(m)}insertCircle(e,a,l,d){this._forEachCell(a-d,l-d,a+d,l+d,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(a),this.circles.push(l),this.circles.push(d)}_insertBoxCell(e,a,l,d,m,y){this.boxCells[m].push(y)}_insertCircleCell(e,a,l,d,m,y){this.circleCells[m].push(y)}_query(e,a,l,d,m,y,w){if(l<0||e>this.width||d<0||a>this.height)return[];const S=[];if(e<=0&&a<=0&&this.width<=l&&this.height<=d){if(m)return[{key:null,x1:e,y1:a,x2:l,y2:d}];for(let P=0;P<this.boxKeys.length;P++)S.push({key:this.boxKeys[P],x1:this.bboxes[4*P],y1:this.bboxes[4*P+1],x2:this.bboxes[4*P+2],y2:this.bboxes[4*P+3]});for(let P=0;P<this.circleKeys.length;P++){const k=this.circles[3*P],B=this.circles[3*P+1],L=this.circles[3*P+2];S.push({key:this.circleKeys[P],x1:k-L,y1:B-L,x2:k+L,y2:B+L})}}else this._forEachCell(e,a,l,d,this._queryCell,S,{hitTest:m,overlapMode:y,seenUids:{box:{},circle:{}}},w);return S}query(e,a,l,d){return this._query(e,a,l,d,!1,null)}hitTest(e,a,l,d,m,y){return this._query(e,a,l,d,!0,m,y).length>0}hitTestCircle(e,a,l,d,m){const y=e-l,w=e+l,S=a-l,P=a+l;if(w<0||y>this.width||P<0||S>this.height)return!1;const k=[];return this._forEachCell(y,S,w,P,this._queryCellCircle,k,{hitTest:!0,overlapMode:d,circle:{x:e,y:a,radius:l},seenUids:{box:{},circle:{}}},m),k.length>0}_queryCell(e,a,l,d,m,y,w,S){const{seenUids:P,hitTest:k,overlapMode:B}=w,L=this.boxCells[m];if(L!==null){const G=this.bboxes;for(const ee of L)if(!P.box[ee]){P.box[ee]=!0;const J=4*ee,te=this.boxKeys[ee];if(e<=G[J+2]&&a<=G[J+3]&&l>=G[J+0]&&d>=G[J+1]&&(!S||S(te))&&(!k||!jr(B,te.overlapMode))&&(y.push({key:te,x1:G[J],y1:G[J+1],x2:G[J+2],y2:G[J+3]}),k))return!0}}const j=this.circleCells[m];if(j!==null){const G=this.circles;for(const ee of j)if(!P.circle[ee]){P.circle[ee]=!0;const J=3*ee,te=this.circleKeys[ee];if(this._circleAndRectCollide(G[J],G[J+1],G[J+2],e,a,l,d)&&(!S||S(te))&&(!k||!jr(B,te.overlapMode))){const ae=G[J],ue=G[J+1],oe=G[J+2];if(y.push({key:te,x1:ae-oe,y1:ue-oe,x2:ae+oe,y2:ue+oe}),k)return!0}}}return!1}_queryCellCircle(e,a,l,d,m,y,w,S){const{circle:P,seenUids:k,overlapMode:B}=w,L=this.boxCells[m];if(L!==null){const G=this.bboxes;for(const ee of L)if(!k.box[ee]){k.box[ee]=!0;const J=4*ee,te=this.boxKeys[ee];if(this._circleAndRectCollide(P.x,P.y,P.radius,G[J+0],G[J+1],G[J+2],G[J+3])&&(!S||S(te))&&!jr(B,te.overlapMode))return y.push(!0),!0}}const j=this.circleCells[m];if(j!==null){const G=this.circles;for(const ee of j)if(!k.circle[ee]){k.circle[ee]=!0;const J=3*ee,te=this.circleKeys[ee];if(this._circlesCollide(G[J],G[J+1],G[J+2],P.x,P.y,P.radius)&&(!S||S(te))&&!jr(B,te.overlapMode))return y.push(!0),!0}}}_forEachCell(e,a,l,d,m,y,w,S){const P=this._convertToXCellCoord(e),k=this._convertToYCellCoord(a),B=this._convertToXCellCoord(l),L=this._convertToYCellCoord(d);for(let j=P;j<=B;j++)for(let G=k;G<=L;G++)if(m.call(this,e,a,l,d,this.xCellCount*G+j,y,w,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,a,l,d,m,y){const w=d-e,S=m-a,P=l+y;return P*P>w*w+S*S}_circleAndRectCollide(e,a,l,d,m,y,w){const S=(y-d)/2,P=Math.abs(e-(d+S));if(P>S+l)return!1;const k=(w-m)/2,B=Math.abs(a-(m+k));if(B>k+l)return!1;if(P<=S||B<=k)return!0;const L=P-S,j=B-k;return L*L+j*j<=l*l}}function Fi(f,e,a){const l=u.L();if(!f){const{vecSouth:B,vecEast:L}=qt(e),j=ne();j[0]=L[0],j[1]=L[1],j[2]=B[0],j[3]=B[1],d=j,(k=(y=(m=j)[0])*(P=m[3])-(S=m[2])*(w=m[1]))&&(d[0]=P*(k=1/k),d[1]=-w*k,d[2]=-S*k,d[3]=y*k),l[0]=j[0],l[1]=j[1],l[4]=j[2],l[5]=j[3]}var d,m,y,w,S,P,k;return u.N(l,l,[1/a,1/a,1]),l}function Nt(f,e,a,l){if(f){const d=u.L();if(!e){const{vecSouth:m,vecEast:y}=qt(a);d[0]=y[0],d[1]=y[1],d[4]=m[0],d[5]=m[1]}return u.N(d,d,[l,l,1]),d}return a.pixelsToClipSpaceMatrix}function qt(f){const e=Math.cos(f.rollInRadians),a=Math.sin(f.rollInRadians),l=Math.cos(f.pitchInRadians),d=Math.cos(f.bearingInRadians),m=Math.sin(f.bearingInRadians),y=u.ar();y[0]=-d*l*a-m*e,y[1]=-m*l*a+d*e;const w=u.as(y);w<1e-9?u.at(y):u.au(y,y,1/w);const S=u.ar();S[0]=d*l*e-m*a,S[1]=m*l*e+d*a;const P=u.as(S);return P<1e-9?u.at(S):u.au(S,S,1/P),{vecEast:S,vecSouth:y}}function er(f,e,a,l){let d;l?(d=[f,e,l(f,e),1],u.aw(d,d,a)):(d=[f,e,0,1],So(d,d,a));const m=d[3];return{point:new u.P(d[0]/m,d[1]/m),signedDistanceFromCamera:m,isOccluded:!1}}function st(f,e){return .5+f/e*.5}function mn(f,e){return f.x>=-e[0]&&f.x<=e[0]&&f.y>=-e[1]&&f.y<=e[1]}function pr(f,e,a,l,d,m,y,w,S,P,k,B,L){const j=a?f.textSizeData:f.iconSizeData,G=u.an(j,e.transform.zoom),ee=[256/e.width*2+1,256/e.height*2+1],J=a?f.text.dynamicLayoutVertexArray:f.icon.dynamicLayoutVertexArray;J.clear();const te=f.lineVertexArray,ae=a?f.text.placedSymbolArray:f.icon.placedSymbolArray,ue=e.transform.width/e.transform.height;let oe=!1;for(let de=0;de<ae.length;de++){const ge=ae.get(de);if(ge.hidden||ge.writingMode===u.ao.vertical&&!oe){es(ge.numGlyphs,J);continue}oe=!1;const le=new u.P(ge.anchorX,ge.anchorY),Se={getElevation:L,pitchedLabelPlaneMatrix:l,lineVertexArray:te,pitchWithMap:m,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:e.transform,tileAnchorPoint:le,unwrappedTileID:S,width:P,height:k,translation:B},Oe=tr(ge.anchorX,ge.anchorY,Se);if(!mn(Oe.point,ee)){es(ge.numGlyphs,J);continue}const ze=st(e.transform.cameraToCenterDistance,Oe.signedDistanceFromCamera),ke=u.ap(j,G,ge),Le=m?ke*e.transform.getPitchedTextCorrection(ge.anchorX,ge.anchorY,S)/ze:ke*ze,ot=gt({projectionContext:Se,pitchedLabelPlaneMatrixInverse:d,symbol:ge,fontSize:Le,flip:!1,keepUpright:y,glyphOffsetArray:f.glyphOffsetArray,dynamicLayoutVertexArray:J,aspectRatio:ue,rotateToLine:w});oe=ot.useVertical,(ot.notEnoughRoom||oe||ot.needsFlipping&&gt({projectionContext:Se,pitchedLabelPlaneMatrixInverse:d,symbol:ge,fontSize:Le,flip:!0,keepUpright:y,glyphOffsetArray:f.glyphOffsetArray,dynamicLayoutVertexArray:J,aspectRatio:ue,rotateToLine:w}).notEnoughRoom)&&es(ge.numGlyphs,J)}a?f.text.dynamicLayoutVertexBuffer.updateData(J):f.icon.dynamicLayoutVertexBuffer.updateData(J)}function _s(f,e,a,l,d,m,y,w){const S=m.glyphStartIndex+m.numGlyphs,P=m.lineStartIndex,k=m.lineStartIndex+m.lineLength,B=e.getoffsetX(m.glyphStartIndex),L=e.getoffsetX(S-1),j=qn(f*B,a,l,d,m.segment,P,k,w,y);if(!j)return null;const G=qn(f*L,a,l,d,m.segment,P,k,w,y);return G?w.projectionCache.anyProjectionOccluded?null:{first:j,last:G}:null}function Ja(f,e,a,l){return f===u.ao.horizontal&&Math.abs(a.y-e.y)>Math.abs(a.x-e.x)*l?{useVertical:!0}:(f===u.ao.vertical?e.y<a.y:e.x>a.x)?{needsFlipping:!0}:null}function gt(f){const{projectionContext:e,pitchedLabelPlaneMatrixInverse:a,symbol:l,fontSize:d,flip:m,keepUpright:y,glyphOffsetArray:w,dynamicLayoutVertexArray:S,aspectRatio:P,rotateToLine:k}=f,B=d/24,L=l.lineOffsetX*B,j=l.lineOffsetY*B;let G;if(l.numGlyphs>1){const ee=l.glyphStartIndex+l.numGlyphs,J=l.lineStartIndex,te=l.lineStartIndex+l.lineLength,ae=_s(B,w,L,j,m,l,k,e);if(!ae)return{notEnoughRoom:!0};const ue=fa(ae.first.point.x,ae.first.point.y,e,a),oe=fa(ae.last.point.x,ae.last.point.y,e,a);if(y&&!m){const de=Ja(l.writingMode,ue,oe,P);if(de)return de}G=[ae.first];for(let de=l.glyphStartIndex+1;de<ee-1;de++){const ge=qn(B*w.getoffsetX(de),L,j,m,l.segment,J,te,e,k);if(!ge)return{notEnoughRoom:!0};G.push(ge)}G.push(ae.last)}else{if(y&&!m){const J=Rr(e.tileAnchorPoint.x,e.tileAnchorPoint.y,e).point,te=l.lineStartIndex+l.segment+1,ae=new u.P(e.lineVertexArray.getx(te),e.lineVertexArray.gety(te)),ue=Rr(ae.x,ae.y,e),oe=ue.signedDistanceFromCamera>0?ue.point:ei(e.tileAnchorPoint,ae,J,1,e),de=fa(J.x,J.y,e,a),ge=fa(oe.x,oe.y,e,a),le=Ja(l.writingMode,de,ge,P);if(le)return le}const ee=qn(B*w.getoffsetX(l.glyphStartIndex),L,j,m,l.segment,l.lineStartIndex,l.lineStartIndex+l.lineLength,e,k);if(!ee||e.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};G=[ee]}for(const ee of G)u.av(S,ee.point,ee.angle);return{}}function ei(f,e,a,l,d){const m=f.add(f.sub(e)._unit()),y=Rr(m.x,m.y,d).point,w=a.sub(y);return a.add(w._mult(l/w.mag()))}function Ht(f,e,a){const l=e.projectionCache;if(l.projections[f])return l.projections[f];const d=new u.P(e.lineVertexArray.getx(f),e.lineVertexArray.gety(f)),m=Rr(d.x,d.y,e);if(m.signedDistanceFromCamera>0)return l.projections[f]=m.point,l.anyProjectionOccluded=l.anyProjectionOccluded||m.isOccluded,m.point;const y=f-a.direction;return ei(a.distanceFromAnchor===0?e.tileAnchorPoint:new u.P(e.lineVertexArray.getx(y),e.lineVertexArray.gety(y)),d,a.previousVertex,a.absOffsetX-a.distanceFromAnchor+1,e)}function Rr(f,e,a){const l=f+a.translation[0],d=e+a.translation[1];let m;return a.pitchWithMap?(m=er(l,d,a.pitchedLabelPlaneMatrix,a.getElevation),m.isOccluded=!1):(m=a.transform.projectTileCoordinates(l,d,a.unwrappedTileID,a.getElevation),m.point.x=(.5*m.point.x+.5)*a.width,m.point.y=(.5*-m.point.y+.5)*a.height),m}function fa(f,e,a,l){if(a.pitchWithMap){const d=[f,e,0,1];return u.aw(d,d,l),a.transform.projectTileCoordinates(d[0]/d[3],d[1]/d[3],a.unwrappedTileID,a.getElevation).point}return{x:f/a.width*2-1,y:1-e/a.height*2}}function tr(f,e,a){return a.transform.projectTileCoordinates(f,e,a.unwrappedTileID,a.getElevation)}function ti(f,e,a){return f._unit()._perp()._mult(e*a)}function Wl(f,e,a,l,d,m,y,w,S){if(w.projectionCache.offsets[f])return w.projectionCache.offsets[f];const P=a.add(e);if(f+S.direction<l||f+S.direction>=d)return w.projectionCache.offsets[f]=P,P;const k=Ht(f+S.direction,w,S),B=ti(k.sub(a),y,S.direction),L=a.add(B),j=k.add(B);return w.projectionCache.offsets[f]=u.ax(m,P,L,j)||P,w.projectionCache.offsets[f]}function qn(f,e,a,l,d,m,y,w,S){const P=l?f-e:f+e;let k=P>0?1:-1,B=0;l&&(k*=-1,B=Math.PI),k<0&&(B+=Math.PI);let L,j=k>0?m+d:m+d+1;w.projectionCache.cachedAnchorPoint?L=w.projectionCache.cachedAnchorPoint:(L=Rr(w.tileAnchorPoint.x,w.tileAnchorPoint.y,w).point,w.projectionCache.cachedAnchorPoint=L);let G,ee,J=L,te=L,ae=0,ue=0;const oe=Math.abs(P),de=[];let ge;for(;ae+ue<=oe;){if(j+=k,j<m||j>=y)return null;ae+=ue,te=J,ee=G;const Oe={absOffsetX:oe,direction:k,distanceFromAnchor:ae,previousVertex:te};if(J=Ht(j,w,Oe),a===0)de.push(te),ge=J.sub(te);else{let ze;const ke=J.sub(te);ze=ke.mag()===0?ti(Ht(j+k,w,Oe).sub(J),a,k):ti(ke,a,k),ee||(ee=te.add(ze)),G=Wl(j,ze,J,m,y,ee,a,w,Oe),de.push(ee),ge=G.sub(ee)}ue=ge.mag()}const le=ge._mult((oe-ae)/ue)._add(ee||te),Se=B+Math.atan2(J.y-te.y,J.x-te.x);return de.push(le),{point:le,angle:S?Se:0,path:de}}const ys=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function es(f,e){for(let a=0;a<f;a++){const l=e.length;e.resize(l+4),e.float32.set(ys,3*l)}}function So(f,e,a){const l=e[0],d=e[1];return f[0]=a[0]*l+a[4]*d+a[12],f[1]=a[1]*l+a[5]*d+a[13],f[3]=a[3]*l+a[7]*d+a[15],f}const mr=100;class Wc{constructor(e,a=new Zr(e.width+200,e.height+200,25),l=new Zr(e.width+200,e.height+200,25)){this.transform=e,this.grid=a,this.ignoredGrid=l,this.pitchFactor=Math.cos(e.pitch*Math.PI/180)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+mr,this.screenBottomBoundary=e.height+mr,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(e,a,l,d,m,y,w,S,P,k,B,L){const j=this.projectAndGetPerspectiveRatio(e.anchorPointX+S[0],e.anchorPointY+S[1],m,k,L),G=l*j.perspectiveRatio;let ee;if(y||w)ee=this._projectCollisionBox(e,G,d,m,y,w,S,j,k,B,L);else{const ge=j.x+(B?B.x*G:0),le=j.y+(B?B.y*G:0);ee={allPointsOccluded:!1,box:[ge+e.x1*G,le+e.y1*G,ge+e.x2*G,le+e.y2*G]}}const[J,te,ae,ue]=ee.box,oe=y?ee.allPointsOccluded:j.isOccluded;let de=oe;return de||(de=j.perspectiveRatio<this.perspectiveRatioCutoff),de||(de=!this.isInsideGrid(J,te,ae,ue)),de||a!=="always"&&this.grid.hitTest(J,te,ae,ue,a,P)?{box:[J,te,ae,ue],placeable:!1,offscreen:!1,occluded:oe}:{box:[J,te,ae,ue],placeable:!0,offscreen:this.isOffscreen(J,te,ae,ue),occluded:oe}}placeCollisionCircles(e,a,l,d,m,y,w,S,P,k,B,L,j,G){const ee=[],J=new u.P(a.anchorX,a.anchorY),te=this.getPerspectiveRatio(J.x,J.y,y,G),ae=(P?m*this.transform.getPitchedTextCorrection(a.anchorX,a.anchorY,y)/te:m*te)/u.aB,ue={getElevation:G,pitchedLabelPlaneMatrix:w,lineVertexArray:l,pitchWithMap:P,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:this.transform,tileAnchorPoint:J,unwrappedTileID:y,width:this.transform.width,height:this.transform.height,translation:j},oe=_s(ae,d,a.lineOffsetX*ae,a.lineOffsetY*ae,!1,a,!1,ue);let de=!1,ge=!1,le=!0;if(oe){const Se=.5*B*te+L,Oe=new u.P(-100,-100),ze=new u.P(this.screenRightBoundary,this.screenBottomBoundary),ke=new Bi,Le=oe.first,ot=oe.last;let ct=[];for(let ii=Le.path.length-1;ii>=1;ii--)ct.push(Le.path[ii]);for(let ii=1;ii<ot.path.length;ii++)ct.push(ot.path[ii]);const We=2.5*Se;if(P){const ii=this.projectPathToScreenSpace(ct,ue);ct=ii.some((vi=>vi.signedDistanceFromCamera<=0))?[]:ii.map((vi=>vi.point))}let Et=[];if(ct.length>0){const ii=ct[0].clone(),vi=ct[0].clone();for(let Ii=1;Ii<ct.length;Ii++)ii.x=Math.min(ii.x,ct[Ii].x),ii.y=Math.min(ii.y,ct[Ii].y),vi.x=Math.max(vi.x,ct[Ii].x),vi.y=Math.max(vi.y,ct[Ii].y);Et=ii.x>=Oe.x&&vi.x<=ze.x&&ii.y>=Oe.y&&vi.y<=ze.y?[ct]:vi.x<Oe.x||ii.x>ze.x||vi.y<Oe.y||ii.y>ze.y?[]:u.ay([ct],Oe.x,Oe.y,ze.x,ze.y)}for(const ii of Et){ke.reset(ii,.25*Se);let vi=0;vi=ke.length<=.5*Se?1:Math.ceil(ke.paddedLength/We)+1;for(let Ii=0;Ii<vi;Ii++){const Pi=Ii/Math.max(vi-1,1),cr=ke.lerp(Pi),rr=cr.x+mr,Wt=cr.y+mr;ee.push(rr,Wt,Se,0);const Ri=rr-Se,Sr=Wt-Se,Ur=rr+Se,Hr=Wt+Se;if(le=le&&this.isOffscreen(Ri,Sr,Ur,Hr),ge=ge||this.isInsideGrid(Ri,Sr,Ur,Hr),e!=="always"&&this.grid.hitTestCircle(rr,Wt,Se,e,k)&&(de=!0,!S))return{circles:[],offscreen:!1,collisionDetected:de}}}}return{circles:!S&&de||!ge||te<this.perspectiveRatioCutoff?[]:ee,offscreen:le,collisionDetected:de}}projectPathToScreenSpace(e,a){const l=(function(d,m){const y=u.L();return u.aq(y,m.pitchedLabelPlaneMatrix),d.map((w=>{const S=er(w.x,w.y,y,m.getElevation),P=m.transform.projectTileCoordinates(S.point.x,S.point.y,m.unwrappedTileID,m.getElevation);return P.point.x=(.5*P.point.x+.5)*m.width,P.point.y=(.5*-P.point.y+.5)*m.height,P}))})(e,a);return(function(d){let m=0,y=0,w=0,S=0;for(let P=0;P<d.length;P++)d[P].isOccluded?(w=P+1,S=0):(S++,S>y&&(y=S,m=w));return d.slice(m,m+y)})(l)}queryRenderedSymbols(e){if(e.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const a=[],l=new u.a2;for(const B of e){const L=new u.P(B.x+mr,B.y+mr);l.extend(L),a.push(L)}const{minX:d,minY:m,maxX:y,maxY:w}=l,S=this.grid.query(d,m,y,w).concat(this.ignoredGrid.query(d,m,y,w)),P={},k={};for(const B of S){const L=B.key;if(P[L.bucketInstanceId]===void 0&&(P[L.bucketInstanceId]={}),P[L.bucketInstanceId][L.featureIndex])continue;const j=[new u.P(B.x1,B.y1),new u.P(B.x2,B.y1),new u.P(B.x2,B.y2),new u.P(B.x1,B.y2)];u.az(a,j)&&(P[L.bucketInstanceId][L.featureIndex]=!0,k[L.bucketInstanceId]===void 0&&(k[L.bucketInstanceId]=[]),k[L.bucketInstanceId].push(L.featureIndex))}return k}insertCollisionBox(e,a,l,d,m,y){(l?this.ignoredGrid:this.grid).insert({bucketInstanceId:d,featureIndex:m,collisionGroupID:y,overlapMode:a},e[0],e[1],e[2],e[3])}insertCollisionCircles(e,a,l,d,m,y){const w=l?this.ignoredGrid:this.grid,S={bucketInstanceId:d,featureIndex:m,collisionGroupID:y,overlapMode:a};for(let P=0;P<e.length;P+=4)w.insertCircle(S,e[P],e[P+1],e[P+2])}projectAndGetPerspectiveRatio(e,a,l,d,m){if(m){let y;d?(y=[e,a,d(e,a),1],u.aw(y,y,m)):(y=[e,a,0,1],So(y,y,m));const w=y[3];return{x:(y[0]/w+1)/2*this.transform.width+mr,y:(-y[1]/w+1)/2*this.transform.height+mr,perspectiveRatio:.5+this.transform.cameraToCenterDistance/w*.5,isOccluded:!1,signedDistanceFromCamera:w}}{const y=this.transform.projectTileCoordinates(e,a,l,d);return{x:(y.point.x+1)/2*this.transform.width+mr,y:(1-y.point.y)/2*this.transform.height+mr,perspectiveRatio:.5+this.transform.cameraToCenterDistance/y.signedDistanceFromCamera*.5,isOccluded:y.isOccluded,signedDistanceFromCamera:y.signedDistanceFromCamera}}}getPerspectiveRatio(e,a,l,d){const m=this.transform.projectTileCoordinates(e,a,l,d);return .5+this.transform.cameraToCenterDistance/m.signedDistanceFromCamera*.5}isOffscreen(e,a,l,d){return l<mr||e>=this.screenRightBoundary||d<mr||a>this.screenBottomBoundary}isInsideGrid(e,a,l,d){return l>=0&&e<this.gridRightBoundary&&d>=0&&a<this.gridBottomBoundary}getViewportMatrix(){const e=u.ag([]);return u.M(e,e,[-100,-100,0]),e}_projectCollisionBox(e,a,l,d,m,y,w,S,P,k,B){let L=1,j=0,G=0,ee=1;const J=e.anchorPointX+w[0],te=e.anchorPointY+w[1];if(y&&!m){const ct=this.projectAndGetPerspectiveRatio(J+1,te,d,P,B),We=ct.x-S.x,Et=Math.atan((ct.y-S.y)/We)+(We<0?Math.PI:0),ii=Math.sin(Et),vi=Math.cos(Et);L=vi,j=ii,G=-ii,ee=vi}else if(!y&&m){const ct=qt(this.transform);L=ct.vecEast[0],j=ct.vecEast[1],G=ct.vecSouth[0],ee=ct.vecSouth[1]}let ae=S.x,ue=S.y,oe=a;m&&(ae=J,ue=te,oe=Math.pow(2,-(this.transform.zoom-l.overscaledZ)),oe*=this.transform.getPitchedTextCorrection(J,te,d),k||(oe*=u.ah(.5+S.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))),k&&(ae+=L*k.x*oe+G*k.y*oe,ue+=j*k.x*oe+ee*k.y*oe);const de=e.x1*oe,ge=e.x2*oe,le=(de+ge)/2,Se=e.y1*oe,Oe=e.y2*oe,ze=(Se+Oe)/2,ke=[{offsetX:de,offsetY:Se},{offsetX:le,offsetY:Se},{offsetX:ge,offsetY:Se},{offsetX:ge,offsetY:ze},{offsetX:ge,offsetY:Oe},{offsetX:le,offsetY:Oe},{offsetX:de,offsetY:Oe},{offsetX:de,offsetY:ze}];let Le=[];for(const{offsetX:ct,offsetY:We}of ke)Le.push(new u.P(ae+L*ct+G*We,ue+j*ct+ee*We));let ot=!1;if(m){const ct=Le.map((We=>this.projectAndGetPerspectiveRatio(We.x,We.y,d,P,B)));ot=ct.some((We=>!We.isOccluded)),Le=ct.map((We=>new u.P(We.x,We.y)))}else ot=!0;return{box:u.aA(Le),allPointsOccluded:!ot}}}class tn{constructor(e,a,l,d){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?a:-a))):d&&l?1:0,this.placed=l}isHidden(){return this.opacity===0&&!this.placed}}class Ei{constructor(e,a,l,d,m){this.text=new tn(e?e.text:null,a,l,m),this.icon=new tn(e?e.icon:null,a,d,m)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class ts{constructor(e,a,l){this.text=e,this.icon=a,this.skipFade=l}}class To{constructor(e,a,l,d,m){this.bucketInstanceId=e,this.featureIndex=a,this.sourceLayerIndex=l,this.bucketIndex=d,this.tileID=m}}class Qc{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 a=++this.maxGroupID;this.collisionGroups[e]={ID:a,predicate:l=>l.collisionGroupID===a}}return this.collisionGroups[e]}}function Jn(f,e,a,l,d){const{horizontalAlign:m,verticalAlign:y}=u.aH(f);return new u.P(-(m-.5)*e+l[0]*d,-(y-.5)*a+l[1]*d)}class is{constructor(e,a,l,d,m){this.transform=e.clone(),this.terrain=a,this.collisionIndex=new Wc(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=l,this.retainedQueryData={},this.collisionGroups=new Qc(d),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=m,m&&(m.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(e){const a=this.terrain;return a?(l,d)=>a.getElevation(e,l,d):null}getBucketParts(e,a,l,d){const m=l.getBucket(a),y=l.latestFeatureIndex;if(!m||!y||a.id!==m.layerIds[0])return;const w=l.collisionBoxArray,S=m.layers[0].layout,P=m.layers[0].paint,k=Math.pow(2,this.transform.zoom-l.tileID.overscaledZ),B=l.tileSize/u.$,L=l.tileID.toUnwrapped(),j=S.get("text-rotation-alignment")==="map",G=u.aC(l,1,this.transform.zoom),ee=u.aD(this.collisionIndex.transform,l,P.get("text-translate"),P.get("text-translate-anchor")),J=u.aD(this.collisionIndex.transform,l,P.get("icon-translate"),P.get("icon-translate-anchor")),te=Fi(j,this.transform,G);this.retainedQueryData[m.bucketInstanceId]=new To(m.bucketInstanceId,y,m.sourceLayerIndex,m.index,l.tileID);const ae={bucket:m,layout:S,translationText:ee,translationIcon:J,unwrappedTileID:L,pitchedLabelPlaneMatrix:te,scale:k,textPixelRatio:B,holdingForFade:l.holdingForFade(),collisionBoxArray:w,partiallyEvaluatedTextSize:u.an(m.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(m.sourceID)};if(d)for(const ue of m.sortKeyRanges){const{sortKey:oe,symbolInstanceStart:de,symbolInstanceEnd:ge}=ue;e.push({sortKey:oe,symbolInstanceStart:de,symbolInstanceEnd:ge,parameters:ae})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:m.symbolInstances.length,parameters:ae})}attemptAnchorPlacement(e,a,l,d,m,y,w,S,P,k,B,L,j,G,ee,J,te,ae,ue,oe){const de=u.aE[e.textAnchor],ge=[e.textOffset0,e.textOffset1],le=Jn(de,l,d,ge,m),Se=this.collisionIndex.placeCollisionBox(a,L,S,P,k,w,y,J,B.predicate,ue,le,oe);if((!ae||this.collisionIndex.placeCollisionBox(ae,L,S,P,k,w,y,te,B.predicate,ue,le,oe).placeable)&&Se.placeable){let Oe;if(this.prevPlacement&&this.prevPlacement.variableOffsets[j.crossTileID]&&this.prevPlacement.placements[j.crossTileID]&&this.prevPlacement.placements[j.crossTileID].text&&(Oe=this.prevPlacement.variableOffsets[j.crossTileID].anchor),j.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[j.crossTileID]={textOffset:ge,width:l,height:d,anchor:de,textBoxScale:m,prevAnchor:Oe},this.markUsedJustification(G,de,j,ee),G.allowVerticalPlacement&&(this.markUsedOrientation(G,ee,j),this.placedOrientations[j.crossTileID]=ee),{shift:le,placedGlyphBoxes:Se}}}placeLayerBucketPart(e,a,l){const{bucket:d,layout:m,translationText:y,translationIcon:w,unwrappedTileID:S,pitchedLabelPlaneMatrix:P,textPixelRatio:k,holdingForFade:B,collisionBoxArray:L,partiallyEvaluatedTextSize:j,collisionGroup:G}=e.parameters,ee=m.get("text-optional"),J=m.get("icon-optional"),te=u.aF(m,"text-overlap","text-allow-overlap"),ae=te==="always",ue=u.aF(m,"icon-overlap","icon-allow-overlap"),oe=ue==="always",de=m.get("text-rotation-alignment")==="map",ge=m.get("text-pitch-alignment")==="map",le=m.get("icon-text-fit")!=="none",Se=m.get("symbol-z-order")==="viewport-y",Oe=ae&&(oe||!d.hasIconData()||J),ze=oe&&(ae||!d.hasTextData()||ee);!d.collisionArrays&&L&&d.deserializeCollisionBoxes(L);const ke=this.retainedQueryData[d.bucketInstanceId].tileID,Le=this._getTerrainElevationFunc(ke),ot=this.transform.getFastPathSimpleProjectionMatrix(ke),ct=(We,Et,ii)=>{var vi,Ii;if(a[We.crossTileID])return;if(B)return void(this.placements[We.crossTileID]=new ts(!1,!1,!1));let Pi=!1,cr=!1,rr=!0,Wt=null,Ri={box:null,placeable:!1,offscreen:null,occluded:!1},Sr={placeable:!1},Ur=null,Hr=null,jn=null,Ga=0,Ds=0,ba=0;Et.textFeatureIndex?Ga=Et.textFeatureIndex:We.useRuntimeCollisionCircles&&(Ga=We.featureIndex),Et.verticalTextFeatureIndex&&(Ds=Et.verticalTextFeatureIndex);const so=Et.textBox;if(so){const ln=nr=>{let _r=u.ao.horizontal;if(d.allowVerticalPlacement&&!nr&&this.prevPlacement){const Nn=this.prevPlacement.placedOrientations[We.crossTileID];Nn&&(this.placedOrientations[We.crossTileID]=Nn,_r=Nn,this.markUsedOrientation(d,_r,We))}return _r},wa=(nr,_r)=>{if(d.allowVerticalPlacement&&We.numVerticalGlyphVertices>0&&Et.verticalTextBox){for(const Nn of d.writingModes)if(Nn===u.ao.vertical?(Ri=_r(),Sr=Ri):Ri=nr(),Ri&&Ri.placeable)break}else Ri=nr()},Mn=We.textAnchorOffsetStartIndex,co=We.textAnchorOffsetEndIndex;if(co===Mn){const nr=(_r,Nn)=>{const ur=this.collisionIndex.placeCollisionBox(_r,te,k,ke,S,ge,de,y,G.predicate,Le,void 0,ot);return ur&&ur.placeable&&(this.markUsedOrientation(d,Nn,We),this.placedOrientations[We.crossTileID]=Nn),ur};wa((()=>nr(so,u.ao.horizontal)),(()=>{const _r=Et.verticalTextBox;return d.allowVerticalPlacement&&We.numVerticalGlyphVertices>0&&_r?nr(_r,u.ao.vertical):{box:null,offscreen:null}})),ln(Ri&&Ri.placeable)}else{let nr=u.aE[(Ii=(vi=this.prevPlacement)===null||vi===void 0?void 0:vi.variableOffsets[We.crossTileID])===null||Ii===void 0?void 0:Ii.anchor];const _r=(ur,uo,Wo)=>{const ds=ur.x2-ur.x1,Cn=ur.y2-ur.y1,Bs=We.textBoxScale,la=le&&ue==="never"?uo:null;let Tr=null,Os=te==="never"?1:2,_u="never";nr&&Os++;for(let Za=0;Za<Os;Za++){for(let Sa=Mn;Sa<co;Sa++){const Yi=d.textAnchorOffsets.get(Sa);if(nr&&Yi.textAnchor!==nr)continue;const Ta=this.attemptAnchorPlacement(Yi,ur,ds,Cn,Bs,de,ge,k,ke,S,G,_u,We,d,Wo,y,w,la,Le);if(Ta&&(Tr=Ta.placedGlyphBoxes,Tr&&Tr.placeable))return Pi=!0,Wt=Ta.shift,Tr}nr?nr=null:_u=te}return l&&!Tr&&(Tr={box:this.collisionIndex.placeCollisionBox(so,"always",k,ke,S,ge,de,y,G.predicate,Le,void 0,ot).box,offscreen:!1,placeable:!1,occluded:!1}),Tr};wa((()=>_r(so,Et.iconBox,u.ao.horizontal)),(()=>{const ur=Et.verticalTextBox;return d.allowVerticalPlacement&&(!Ri||!Ri.placeable)&&We.numVerticalGlyphVertices>0&&ur?_r(ur,Et.verticalIconBox,u.ao.vertical):{box:null,occluded:!0,offscreen:null}})),Ri&&(Pi=Ri.placeable,rr=Ri.offscreen);const Nn=ln(Ri&&Ri.placeable);if(!Pi&&this.prevPlacement){const ur=this.prevPlacement.variableOffsets[We.crossTileID];ur&&(this.variableOffsets[We.crossTileID]=ur,this.markUsedJustification(d,ur.anchor,We,Nn))}}}if(Ur=Ri,Pi=Ur&&Ur.placeable,rr=Ur&&Ur.offscreen,We.useRuntimeCollisionCircles){const ln=d.text.placedSymbolArray.get(We.centerJustifiedTextSymbolIndex),wa=u.ap(d.textSizeData,j,ln),Mn=m.get("text-padding");Hr=this.collisionIndex.placeCollisionCircles(te,ln,d.lineVertexArray,d.glyphOffsetArray,wa,S,P,l,ge,G.predicate,We.collisionCircleDiameter,Mn,y,Le),Hr.circles.length&&Hr.collisionDetected&&!l&&u.w("Collisions detected, but collision boxes are not shown"),Pi=ae||Hr.circles.length>0&&!Hr.collisionDetected,rr=rr&&Hr.offscreen}if(Et.iconFeatureIndex&&(ba=Et.iconFeatureIndex),Et.iconBox){const ln=wa=>this.collisionIndex.placeCollisionBox(wa,ue,k,ke,S,ge,de,w,G.predicate,Le,le&&Wt?Wt:void 0,ot);Sr&&Sr.placeable&&Et.verticalIconBox?(jn=ln(Et.verticalIconBox),cr=jn.placeable):(jn=ln(Et.iconBox),cr=jn.placeable),rr=rr&&jn.offscreen}const Ls=ee||We.numHorizontalGlyphVertices===0&&We.numVerticalGlyphVertices===0,oo=J||We.numIconVertices===0;Ls||oo?oo?Ls||(cr=cr&&Pi):Pi=cr&&Pi:cr=Pi=cr&&Pi;const lo=cr&&jn.placeable;if(Pi&&Ur.placeable&&this.collisionIndex.insertCollisionBox(Ur.box,te,m.get("text-ignore-placement"),d.bucketInstanceId,Sr&&Sr.placeable&&Ds?Ds:Ga,G.ID),lo&&this.collisionIndex.insertCollisionBox(jn.box,ue,m.get("icon-ignore-placement"),d.bucketInstanceId,ba,G.ID),Hr&&Pi&&this.collisionIndex.insertCollisionCircles(Hr.circles,te,m.get("text-ignore-placement"),d.bucketInstanceId,Ga,G.ID),l&&this.storeCollisionData(d.bucketInstanceId,ii,Et,Ur,jn,Hr),We.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(d.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[We.crossTileID]=new ts((Pi||Oe)&&!Ur?.occluded,(cr||ze)&&!jn?.occluded,rr||d.justReloaded),a[We.crossTileID]=!0};if(Se){if(e.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const We=d.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let Et=We.length-1;Et>=0;--Et){const ii=We[Et];ct(d.symbolInstances.get(ii),d.collisionArrays[ii],ii)}}else for(let We=e.symbolInstanceStart;We<e.symbolInstanceEnd;We++)ct(d.symbolInstances.get(We),d.collisionArrays[We],We);d.justReloaded=!1}storeCollisionData(e,a,l,d,m,y){if(l.textBox||l.iconBox){let w,S;this.collisionBoxArrays.has(e)?w=this.collisionBoxArrays.get(e):(w=new Map,this.collisionBoxArrays.set(e,w)),w.has(a)?S=w.get(a):(S={text:null,icon:null},w.set(a,S)),l.textBox&&(S.text=d.box),l.iconBox&&(S.icon=m.box)}if(y){let w=this.collisionCircleArrays[e];w===void 0&&(w=this.collisionCircleArrays[e]=[]);for(let S=0;S<y.circles.length;S+=4)w.push(y.circles[S+0]-mr),w.push(y.circles[S+1]-mr),w.push(y.circles[S+2]),w.push(y.collisionDetected?1:0)}}markUsedJustification(e,a,l,d){let m;m=d===u.ao.vertical?l.verticalPlacedTextSymbolIndex:{left:l.leftJustifiedTextSymbolIndex,center:l.centerJustifiedTextSymbolIndex,right:l.rightJustifiedTextSymbolIndex}[u.aG(a)];const y=[l.leftJustifiedTextSymbolIndex,l.centerJustifiedTextSymbolIndex,l.rightJustifiedTextSymbolIndex,l.verticalPlacedTextSymbolIndex];for(const w of y)w>=0&&(e.text.placedSymbolArray.get(w).crossTileID=m>=0&&w!==m?0:l.crossTileID)}markUsedOrientation(e,a,l){const d=a===u.ao.horizontal||a===u.ao.horizontalOnly?a:0,m=a===u.ao.vertical?a:0,y=[l.leftJustifiedTextSymbolIndex,l.centerJustifiedTextSymbolIndex,l.rightJustifiedTextSymbolIndex];for(const w of y)e.text.placedSymbolArray.get(w).placedOrientation=d;l.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(l.verticalPlacedTextSymbolIndex).placedOrientation=m)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;const a=this.prevPlacement;let l=!1;this.prevZoomAdjustment=a?a.zoomAdjustment(this.transform.zoom):0;const d=a?a.symbolFadeChange(e):1,m=a?a.opacities:{},y=a?a.variableOffsets:{},w=a?a.placedOrientations:{};for(const S in this.placements){const P=this.placements[S],k=m[S];k?(this.opacities[S]=new Ei(k,d,P.text,P.icon),l=l||P.text!==k.text.placed||P.icon!==k.icon.placed):(this.opacities[S]=new Ei(null,d,P.text,P.icon,P.skipFade),l=l||P.text||P.icon)}for(const S in m){const P=m[S];if(!this.opacities[S]){const k=new Ei(P,d,!1,!1);k.isHidden()||(this.opacities[S]=k,l=l||P.text.placed||P.icon.placed)}}for(const S in y)this.variableOffsets[S]||!this.opacities[S]||this.opacities[S].isHidden()||(this.variableOffsets[S]=y[S]);for(const S in w)this.placedOrientations[S]||!this.opacities[S]||this.opacities[S].isHidden()||(this.placedOrientations[S]=w[S]);if(a&&a.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");l?this.lastPlacementChangeTime=e:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=a?a.lastPlacementChangeTime:e)}updateLayerOpacities(e,a){const l={};for(const d of a){const m=d.getBucket(e);m&&d.latestFeatureIndex&&e.id===m.layerIds[0]&&this.updateBucketOpacities(m,d.tileID,l,d.collisionBoxArray)}}updateBucketOpacities(e,a,l,d){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 m=e.layers[0],y=m.layout,w=new Ei(null,0,!1,!1,!0),S=y.get("text-allow-overlap"),P=y.get("icon-allow-overlap"),k=m._unevaluatedLayout.hasValue("text-variable-anchor")||m._unevaluatedLayout.hasValue("text-variable-anchor-offset"),B=y.get("text-rotation-alignment")==="map",L=y.get("text-pitch-alignment")==="map",j=y.get("icon-text-fit")!=="none",G=new Ei(null,0,S&&(P||!e.hasIconData()||y.get("icon-optional")),P&&(S||!e.hasTextData()||y.get("text-optional")),!0);!e.collisionArrays&&d&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(d);const ee=(te,ae,ue)=>{for(let oe=0;oe<ae/4;oe++)te.opacityVertexArray.emplaceBack(ue);te.hasVisibleVertices=te.hasVisibleVertices||ue!==ul},J=this.collisionBoxArrays.get(e.bucketInstanceId);for(let te=0;te<e.symbolInstances.length;te++){const ae=e.symbolInstances.get(te),{numHorizontalGlyphVertices:ue,numVerticalGlyphVertices:oe,crossTileID:de}=ae;let ge=this.opacities[de];l[de]?ge=w:ge||(ge=G,this.opacities[de]=ge),l[de]=!0;const le=ae.numIconVertices>0,Se=this.placedOrientations[ae.crossTileID],Oe=Se===u.ao.vertical,ze=Se===u.ao.horizontal||Se===u.ao.horizontalOnly;if(ue>0||oe>0){const Le=cl(ge.text);ee(e.text,ue,Oe?ul:Le),ee(e.text,oe,ze?ul:Le);const ot=ge.text.isHidden();[ae.rightJustifiedTextSymbolIndex,ae.centerJustifiedTextSymbolIndex,ae.leftJustifiedTextSymbolIndex].forEach((Et=>{Et>=0&&(e.text.placedSymbolArray.get(Et).hidden=ot||Oe?1:0)})),ae.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(ae.verticalPlacedTextSymbolIndex).hidden=ot||ze?1:0);const ct=this.variableOffsets[ae.crossTileID];ct&&this.markUsedJustification(e,ct.anchor,ae,Se);const We=this.placedOrientations[ae.crossTileID];We&&(this.markUsedJustification(e,"left",ae,We),this.markUsedOrientation(e,We,ae))}if(le){const Le=cl(ge.icon),ot=!(j&&ae.verticalPlacedIconSymbolIndex&&Oe);ae.placedIconSymbolIndex>=0&&(ee(e.icon,ae.numIconVertices,ot?Le:ul),e.icon.placedSymbolArray.get(ae.placedIconSymbolIndex).hidden=ge.icon.isHidden()),ae.verticalPlacedIconSymbolIndex>=0&&(ee(e.icon,ae.numVerticalIconVertices,ot?ul:Le),e.icon.placedSymbolArray.get(ae.verticalPlacedIconSymbolIndex).hidden=ge.icon.isHidden())}const ke=J&&J.has(te)?J.get(te):{text:null,icon:null};if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){const Le=e.collisionArrays[te];if(Le){let ot=new u.P(0,0);if(Le.textBox||Le.verticalTextBox){let ct=!0;if(k){const We=this.variableOffsets[de];We?(ot=Jn(We.anchor,We.width,We.height,We.textOffset,We.textBoxScale),B&&ot._rotate(L?-this.transform.bearingInRadians:this.transform.bearingInRadians)):ct=!1}if(Le.textBox||Le.verticalTextBox){let We;Le.textBox&&(We=Oe),Le.verticalTextBox&&(We=ze),Ql(e.textCollisionBox.collisionVertexArray,ge.text.placed,!ct||We,ke.text,ot.x,ot.y)}}if(Le.iconBox||Le.verticalIconBox){const ct=!!(!ze&&Le.verticalIconBox);let We;Le.iconBox&&(We=ct),Le.verticalIconBox&&(We=!ct),Ql(e.iconCollisionBox.collisionVertexArray,ge.icon.placed,We,ke.icon,j?ot.x:0,j?ot.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 this.fadeDuration===0?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,a){const l=this.zoomAtLastRecencyCheck===a?1-this.zoomAdjustment(a):1;return this.zoomAtLastRecencyCheck=a,this.commitTime+this.fadeDuration*l>e}setStale(){this.stale=!0}}function Ql(f,e,a,l,d,m){l&&l.length!==0||(l=[0,0,0,0]);const y=l[0]-mr,w=l[1]-mr,S=l[2]-mr,P=l[3]-mr;f.emplaceBack(e?1:0,a?1:0,d||0,m||0,y,w),f.emplaceBack(e?1:0,a?1:0,d||0,m||0,S,w),f.emplaceBack(e?1:0,a?1:0,d||0,m||0,S,P),f.emplaceBack(e?1:0,a?1:0,d||0,m||0,y,P)}const Hh=Math.pow(2,25),Hu=Math.pow(2,24),rn=Math.pow(2,17),Xu=Math.pow(2,16),Xd=Math.pow(2,9),Jc=Math.pow(2,8),Xh=Math.pow(2,1);function cl(f){if(f.opacity===0&&!f.placed)return 0;if(f.opacity===1&&f.placed)return 4294967295;const e=f.placed?1:0,a=Math.floor(127*f.opacity);return a*Hh+e*Hu+a*rn+e*Xu+a*Xd+e*Jc+a*Xh+e}const ul=0;class $n{constructor(e){this._sortAcrossTiles=e.layout.get("symbol-z-order")!=="viewport-y"&&!e.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(e,a,l,d,m){const y=this._bucketParts;for(;this._currentTileIndex<e.length;)if(a.getBucketParts(y,d,e[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,m())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,y.sort(((w,S)=>w.sortKey-S.sortKey)));this._currentPartIndex<y.length;)if(a.placeLayerBucketPart(y[this._currentPartIndex],this._seenCrossTileIDs,l),this._currentPartIndex++,m())return!0;return!1}}class Jl{constructor(e,a,l,d,m,y,w,S){this.placement=new is(e,a,y,w,S),this._currentPlacementIndex=l.length-1,this._forceFullPlacement=d,this._showCollisionBoxes=m,this._done=!1}isDone(){return this._done}continuePlacement(e,a,l){const d=Ce.now(),m=()=>!this._forceFullPlacement&&Ce.now()-d>2;for(;this._currentPlacementIndex>=0;){const y=a[e[this._currentPlacementIndex]],w=this.placement.collisionIndex.transform.zoom;if(y.type==="symbol"&&(!y.minzoom||y.minzoom<=w)&&(!y.maxzoom||y.maxzoom>w)){if(this._inProgressLayer||(this._inProgressLayer=new $n(y)),this._inProgressLayer.continuePlacement(l[y.source],this.placement,this._showCollisionBoxes,y,m))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}}const Mo=512/u.$/2;class ec{constructor(e,a,l){this.tileID=e,this.bucketInstanceId=l,this._symbolsByKey={};const d=new Map;for(let m=0;m<a.length;m++){const y=a.get(m),w=y.key,S=d.get(w);S?S.push(y):d.set(w,[y])}for(const[m,y]of d){const w={positions:y.map((S=>({x:Math.floor(S.anchorX*Mo),y:Math.floor(S.anchorY*Mo)}))),crossTileIDs:y.map((S=>S.crossTileID))};if(w.positions.length>128){const S=new u.aI(w.positions.length,16,Uint16Array);for(const{x:P,y:k}of w.positions)S.add(P,k);S.finish(),delete w.positions,w.index=S}this._symbolsByKey[m]=w}}getScaledCoordinates(e,a){const{x:l,y:d,z:m}=this.tileID.canonical,{x:y,y:w,z:S}=a.canonical,P=Mo/Math.pow(2,S-m),k=(w*u.$+e.anchorY)*P,B=d*u.$*Mo;return{x:Math.floor((y*u.$+e.anchorX)*P-l*u.$*Mo),y:Math.floor(k-B)}}findMatches(e,a,l){const d=this.tileID.canonical.z<a.canonical.z?1:Math.pow(2,this.tileID.canonical.z-a.canonical.z);for(let m=0;m<e.length;m++){const y=e.get(m);if(y.crossTileID)continue;const w=this._symbolsByKey[y.key];if(!w)continue;const S=this.getScaledCoordinates(y,a);if(w.index){const P=w.index.range(S.x-d,S.y-d,S.x+d,S.y+d).sort();for(const k of P){const B=w.crossTileIDs[k];if(!l[B]){l[B]=!0,y.crossTileID=B;break}}}else if(w.positions)for(let P=0;P<w.positions.length;P++){const k=w.positions[P],B=w.crossTileIDs[P];if(Math.abs(k.x-S.x)<=d&&Math.abs(k.y-S.y)<=d&&!l[B]){l[B]=!0,y.crossTileID=B;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map((({crossTileIDs:e})=>e))}}class Vs{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Yh{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){const a=Math.round((e-this.lng)/360);if(a!==0)for(const l in this.indexes){const d=this.indexes[l],m={};for(const y in d){const w=d[y];w.tileID=w.tileID.unwrapTo(w.tileID.wrap+a),m[w.tileID.key]=w}this.indexes[l]=m}this.lng=e}addBucket(e,a,l){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===a.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let m=0;m<a.symbolInstances.length;m++)a.symbolInstances.get(m).crossTileID=0;this.usedCrossTileIDs[e.overscaledZ]||(this.usedCrossTileIDs[e.overscaledZ]={});const d=this.usedCrossTileIDs[e.overscaledZ];for(const m in this.indexes){const y=this.indexes[m];if(Number(m)>e.overscaledZ)for(const w in y){const S=y[w];S.tileID.isChildOf(e)&&S.findMatches(a.symbolInstances,e,d)}else{const w=y[e.scaledTo(Number(m)).key];w&&w.findMatches(a.symbolInstances,e,d)}}for(let m=0;m<a.symbolInstances.length;m++){const y=a.symbolInstances.get(m);y.crossTileID||(y.crossTileID=l.generate(),d[y.crossTileID]=!0)}return this.indexes[e.overscaledZ]===void 0&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new ec(e,a.symbolInstances,a.bucketInstanceId),!0}removeBucketCrossTileIDs(e,a){for(const l of a.getCrossTileIDsLists())for(const d of l)delete this.usedCrossTileIDs[e][d]}removeStaleBuckets(e){let a=!1;for(const l in this.indexes){const d=this.indexes[l];for(const m in d)e[d[m].bucketInstanceId]||(this.removeBucketCrossTileIDs(l,d[m]),delete d[m],a=!0)}return a}}class Co{constructor(){this.layerIndexes={},this.crossTileIDs=new Vs,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,a,l){let d=this.layerIndexes[e.id];d===void 0&&(d=this.layerIndexes[e.id]=new Yh);let m=!1;const y={};d.handleWrapJump(l);for(const w of a){const S=w.getBucket(e);S&&e.id===S.layerIds[0]&&(S.bucketInstanceId||(S.bucketInstanceId=++this.maxBucketInstanceId),d.addBucket(w.tileID,S,this.crossTileIDs)&&(m=!0),y[S.bucketInstanceId]=!0)}return d.removeStaleBuckets(y)&&(m=!0),m}pruneUnusedLayers(e){const a={};e.forEach((l=>{a[l]=!0}));for(const l in this.layerIndexes)a[l]||delete this.layerIndexes[l]}}var rs="void main() {fragColor=vec4(1.0);}";const La={prelude:li(`#ifdef GL_ES
174precision mediump float;
175#else
176#if !defined(lowp)
177#define lowp
178#endif
179#if !defined(mediump)
180#define mediump
181#endif
182#if !defined(highp)
183#define highp
184#endif
185#endif
186out highp vec4 fragColor;`,`#ifdef GL_ES
187precision highp float;
188#else
189#if !defined(lowp)
190#define lowp
191#endif
192#if !defined(mediump)
193#define mediump
194#endif
195#if !defined(highp)
196#define highp
197#endif
198#endif
199vec2 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
200);}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);
200return (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
201);}
202#ifdef TERRAIN3D
203uniform 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;
204#endif
205const 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) {
206#ifdef TERRAIN3D
207highp 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));
208#else
209return 1.0;
210#endif
211}float calculate_visibility(vec4 pos) {
212#ifdef TERRAIN3D
213vec3 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;
214#else
215return 1.0;
216#endif
217}float ele(vec2 pos) {
218#ifdef TERRAIN3D
219vec4 rgb=(texture(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;
220#else
221return 0.0;
222#endif
223}float get_elevation(vec2 pos) {
224#ifdef TERRAIN3D
225#ifdef GLOBE
226if ((pos.y <-32767.5) || (pos.y > 32766.5)) {return 0.0;}
227#endif
228vec2 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;
229#else
230return 0.0;
231#endif
232}const float PI=3.141592653589793;uniform mat4 u_projection_matrix;`),projectionMercator:li("","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:li("",`#define GLOBE_RADIUS 6371008.8
233uniform 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
234);}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); 
235if (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
236);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:li(`uniform vec4 u_color;uniform float u_opacity;void main() {fragColor=u_color*u_opacity;
237#ifdef OVERDRAW_INSPECTOR
238fragColor=vec4(1.0);
239#endif
240}`,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),backgroundPattern:li(`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;
240uniform 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;
241#ifdef OVERDRAW_INSPECTOR
242fragColor=vec4(1.0);
243#endif
244}`,"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:li(`in vec3 v_data;in float v_visibility;
245#pragma mapbox: define highp vec4 color
246#pragma mapbox: define mediump float radius
247#pragma mapbox: define lowp float blur
248#pragma mapbox: define lowp float opacity
249#pragma mapbox: define highp vec4 stroke_color
250#pragma mapbox: define mediump float stroke_width
251#pragma mapbox: define lowp float stroke_opacity
252void main() {
253#pragma mapbox: initialize highp vec4 color
254#pragma mapbox: initialize mediump float radius
255#pragma mapbox: initialize lowp float blur
256#pragma mapbox: initialize lowp float opacity
257#pragma mapbox: initialize highp vec4 stroke_color
258#pragma mapbox: initialize mediump float stroke_width
259#pragma mapbox: initialize lowp float stroke_opacity
260vec2 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;}
261#ifdef OVERDRAW_INSPECTOR
262fragColor=vec4(1.0);
263#endif
264}`,`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;
265#pragma mapbox: define highp vec4 color
266#pragma mapbox: define mediump float radius
267#pragma mapbox: define lowp float blur
268#pragma mapbox: define lowp float opacity
269#pragma mapbox: define highp vec4 stroke_color
270#pragma mapbox: define mediump float stroke_width
271#pragma mapbox: define lowp float stroke_opacity
272void main(void) {
273#pragma mapbox: initialize highp vec4 color
274#pragma mapbox: initialize mediump float radius
275#pragma mapbox: initialize lowp float blur
276#pragma mapbox: initialize lowp float opacity
277#pragma mapbox: initialize highp vec4 stroke_color
278#pragma mapbox: initialize mediump float stroke_width
279#pragma mapbox: initialize lowp float stroke_opacity
280vec2 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) {
281#ifdef GLOBE
282vec3 center_vector=projectToSphere(circle_center);
283#endif
284float 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 {
285#ifdef GLOBE
286vec4 projected_center=interpolateProjection(circle_center,center_vector,ele);
287#else
288vec4 projected_center=projectTileWithElevation(circle_center,ele);
289#endif
290corner_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);}
291#ifdef GLOBE
292vec2 angles=extrude*angle_scale;vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(corner_position,corner_vector,ele);
293#else
294gl_Position=projectTileWithElevation(corner_position,ele);
295#endif
296} 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:li(rs,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),heatmap:li(`uniform highp float u_intensity;in vec2 v_extrude;
297#pragma mapbox: define highp float weight
298#define GAUSS_COEF 0.3989422804014327
299void main() {
300#pragma mapbox: initialize highp float weight
301float 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);
302#ifdef OVERDRAW_INSPECTOR
303fragColor=vec4(1.0);
304#endif
305}`,`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;
306#pragma mapbox: define highp float weight
307#pragma mapbox: define mediump float radius
308const highp float ZERO=1.0/255.0/16.0;
309#define GAUSS_COEF 0.3989422804014327
310void main(void) {
311#pragma mapbox: initialize highp float weight
312#pragma mapbox: initialize mediump float radius
313vec2 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);
314#ifdef GLOBE
315vec2 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);
316#else
317gl_Position=projectTileFor3D(circle_center+extrude,get_elevation(circle_center));
318#endif
319}`),heatmapTexture:li(`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;
320#ifdef OVERDRAW_INSPECTOR
321fragColor=vec4(0.0);
322#endif
323}`,"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:li("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:li("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:li(`#ifdef GL_ES
324precision highp float;
325#endif
326uniform 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
327{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));
328#ifdef OVERDRAW_INSPECTOR
329fragColor=vec4(1.0);
330#endif
331}`,"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:li("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:li(rs,`in vec2 a_pos;void main() {
332#ifdef GLOBE
333gl_Position=projectTileFor3D(a_pos,0.0);
334#else
335gl_Position=u_projection_matrix*vec4(a_pos,0.0,1.0);
336#endif
337}`),fill:li(`#pragma mapbox: define highp vec4 color
338#pragma mapbox: define lowp float opacity
339void main() {
340#pragma mapbox: initialize highp vec4 color
341#pragma mapbox: initialize lowp float opacity
342fragColor=color*opacity;
343#ifdef OVERDRAW_INSPECTOR
344fragColor=vec4(1.0);
345#endif
346}`,`uniform vec2 u_fill_translate;in vec2 a_pos;
347#pragma mapbox: define highp vec4 color
348#pragma mapbox: define lowp float opacity
349void main() {
350#pragma mapbox: initialize highp vec4 color
351#pragma mapbox: initialize lowp float opacity
352gl_Position=projectTile(a_pos+u_fill_translate,a_pos);}`),fillOutline:li(`in vec2 v_pos;
353#ifdef GLOBE
354in float v_depth;
355#endif
356#pragma mapbox: define highp vec4 outline_color
357#pragma mapbox: define lowp float opacity
358void main() {
359#pragma mapbox: initialize highp vec4 outline_color
360#pragma mapbox: initialize lowp float opacity
361float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=outline_color*(alpha*opacity);
362#ifdef GLOBE
363if (v_depth > 1.0) {discard;}
364#endif
365#ifdef OVERDRAW_INSPECTOR
366fragColor=vec4(1.0);
367#endif
368}`,`uniform vec2 u_world;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos;
369#ifdef GLOBE
370out float v_depth;
371#endif
372#pragma mapbox: define highp vec4 outline_color
373#pragma mapbox: define lowp float opacity
374void main() {
375#pragma mapbox: initialize highp vec4 outline_color
376#pragma mapbox: initialize lowp float opacity
377gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;
378#ifdef GLOBE
379v_depth=gl_Position.z/gl_Position.w;
380#endif
381}`),fillOutlinePattern:li(`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;
382#ifdef GLOBE
383in float v_depth;
384#endif
385#pragma mapbox: define lowp float opacity
386#pragma mapbox: define lowp vec4 pattern_from
387#pragma mapbox: define lowp vec4 pattern_to
388void main() {
389#pragma mapbox: initialize lowp float opacity
390#pragma mapbox: initialize mediump vec4 pattern_from
391#pragma mapbox: initialize mediump vec4 pattern_to
392vec2 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;
393#ifdef GLOBE
394if (v_depth > 1.0) {discard;}
395#endif
396#ifdef OVERDRAW_INSPECTOR
397fragColor=vec4(1.0);
398#endif
399}`,`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;
400#ifdef GLOBE
401out float v_depth;
402#endif
403#pragma mapbox: define lowp float opacity
404#pragma mapbox: define lowp vec4 pattern_from
405#pragma mapbox: define lowp vec4 pattern_to
406#pragma mapbox: define lowp float pixel_ratio_from
407#pragma mapbox: define lowp float pixel_ratio_to
408void main() {
409#pragma mapbox: initialize lowp float opacity
410#pragma mapbox: initialize mediump vec4 pattern_from
411#pragma mapbox: initialize mediump vec4 pattern_to
412#pragma mapbox: initialize lowp float pixel_ratio_from
413#pragma mapbox: initialize lowp float pixel_ratio_to
414vec2 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;
415#ifdef GLOBE
416v_depth=gl_Position.z/gl_Position.w;
417#endif
418}`),fillPattern:li(`#ifdef GL_ES
419precision highp float;
420#endif
421uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;
422#pragma mapbox: define lowp float opacity
423#pragma mapbox: define lowp vec4 pattern_from
424#pragma mapbox: define lowp vec4 pattern_to
425void main() {
426#pragma mapbox: initialize lowp float opacity
427#pragma mapbox: initialize mediump vec4 pattern_from
428#pragma mapbox: initialize mediump vec4 pattern_to
429vec2 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;
430#ifdef OVERDRAW_INSPECTOR
431fragColor=vec4(1.0);
432#endif
433}`,`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;
434#pragma mapbox: define lowp float opacity
435#pragma mapbox: define lowp vec4 pattern_from
436#pragma mapbox: define lowp vec4 pattern_to
437#pragma mapbox: define lowp float pixel_ratio_from
438#pragma mapbox: define lowp float pixel_ratio_to
439void main() {
440#pragma mapbox: initialize lowp float opacity
441#pragma mapbox: initialize mediump vec4 pattern_from
442#pragma mapbox: initialize mediump vec4 pattern_to
443#pragma mapbox: initialize lowp float pixel_ratio_from
444#pragma mapbox: initialize lowp float pixel_ratio_to
445vec2 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_siz
445e_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:li(`in vec4 v_color;void main() {fragColor=v_color;
446#ifdef OVERDRAW_INSPECTOR
447fragColor=vec4(1.0);
448#endif
449}`,`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;
450#ifdef TERRAIN3D
451in vec2 a_centroid;
452#endif
453out vec4 v_color;
454#pragma mapbox: define highp float base
455#pragma mapbox: define highp float height
456#pragma mapbox: define highp vec4 color
457void main() {
458#pragma mapbox: initialize highp float base
459#pragma mapbox: initialize highp float height
460#pragma mapbox: initialize highp vec4 color
461vec3 normal=a_normal_ed.xyz;
462#ifdef TERRAIN3D
463float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
464#else
465float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
466#endif
467base=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;
468#ifdef GLOBE
469vec3 spherePos=projectToSphere(posInTile,a_pos);gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);
470#else
471gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);
472#endif
473float 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);
474#ifdef GLOBE
475mat3 rotMatrix=globeGetRotationMatrix(spherePos);normalForLighting=rotMatrix*normalForLighting;directional=mix(directional,clamp(dot(normalForLighting,u_lightpos_globe),0.0,1.0),u_projection_transition);
476#endif
477directional=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:li(`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;
478#pragma mapbox: define lowp float base
479#pragma mapbox: define lowp float height
480#pragma mapbox: define lowp vec4 pattern_from
481#pragma mapbox: define lowp vec4 pattern_to
482#pragma mapbox: define lowp float pixel_ratio_from
483#pragma mapbox: define lowp float pixel_ratio_to
484void main() {
485#pragma mapbox: initialize lowp float base
486#pragma mapbox: initialize lowp float height
487#pragma mapbox: initialize mediump vec4 pattern_from
488#pragma mapbox: initialize mediump vec4 pattern_to
489#pragma mapbox: initialize lowp float pixel_ratio_from
490#pragma mapbox: initialize lowp float pixel_ratio_to
491vec2 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;
492#ifdef OVERDRAW_INSPECTOR
493fragColor=vec4(1.0);
494#endif
495}`,`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;
496#ifdef TERRAIN3D
497in vec2 a_centroid;
498#endif
499#ifdef GLOBE
500out vec3 v_sphere_pos;
501#endif
502out vec2 v_pos_a;out vec2 v_pos_b;out vec4 v_lighting;
503#pragma mapbox: define lowp float base
504#pragma mapbox: define lowp float height
505#pragma mapbox: define lowp vec4 pattern_from
506#pragma mapbox: define lowp vec4 pattern_to
507#pragma mapbox: define lowp float pixel_ratio_from
508#pragma mapbox: define lowp float pixel_ratio_to
509void main() {
510#pragma mapbox: initialize lowp float base
511#pragma mapbox: initialize lowp float height
512#pragma mapbox: initialize mediump vec4 pattern_from
513#pragma mapbox: initialize mediump vec4 pattern_to
514#pragma mapbox: initialize lowp float pixel_ratio_from
515#pragma mapbox: initialize lowp float pixel_ratio_to
516vec2 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;
517#ifdef TERRAIN3D
518float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
519#else
520float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
521#endif
522base=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;
523#ifdef GLOBE
524vec3 spherePos=projectToSphere(posInTile,a_pos);vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);v_sphere_pos=elevatedPos;gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);
525#else
526gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);
527#endif
528vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0
529? a_pos
530: 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:li(`#ifdef GL_ES
531precision highp float;
532#endif
533uniform 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/p
533ow(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);
534#ifdef OVERDRAW_INSPECTOR
535fragColor=vec4(1.0);
536#endif
537}`,"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:li(`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];
538#define PI 3.141592653589793
539#define STANDARD 0
540#define COMBINED 1
541#define IGOR 2
542#define MULTIDIRECTIONAL 3
543#define BASIC 4
544float 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
545{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
546{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);}
547#ifdef OVERDRAW_INSPECTOR
548fragColor=vec4(1.0);
549#endif
550}`,"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:li(`uniform lowp float u_device_pixel_ratio;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;
551#ifdef GLOBE
552in float v_depth;
553#endif
554#pragma mapbox: define highp vec4 color
555#pragma mapbox: define lowp float blur
556#pragma mapbox: define lowp float opacity
557void main() {
558#pragma mapbox: initialize highp vec4 color
559#pragma mapbox: initialize lowp float blur
560#pragma mapbox: initialize lowp float opacity
561float 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);
562#ifdef GLOBE
563if (v_depth > 1.0) {discard;}
564#endif
565#ifdef OVERDRAW_INSPECTOR
566fragColor=vec4(1.0);
567#endif
568}`,`
569#define scale 0.015873016
570in 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;
571#ifdef GLOBE
572out float v_depth;
573#endif
574#pragma mapbox: define highp vec4 color
575#pragma mapbox: define lowp float blur
576#pragma mapbox: define lowp float opacity
577#pragma mapbox: define mediump float gapwidth
578#pragma mapbox: define lowp float offset
579#pragma mapbox: define mediump float width
580void main() {
581#pragma mapbox: initialize highp vec4 color
582#pragma mapbox: initialize lowp float blur
583#pragma mapbox: initialize lowp float opacity
584#pragma mapbox: initialize mediump float gapwidth
585#pragma mapbox: initialize lowp float offset
586#pragma mapbox: initialize mediump float width
587float 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);
587float 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;
588#ifdef GLOBE
589v_depth=gl_Position.z/gl_Position.w;
590#endif
591#ifdef TERRAIN3D
592v_gamma_scale=1.0;
593#else
594float 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;
595#endif
596v_width2=vec2(outset,inset);}`),lineGradient:li(`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;
597#ifdef GLOBE
598in float v_depth;
599#endif
600#pragma mapbox: define lowp float blur
601#pragma mapbox: define lowp float opacity
602void main() {
603#pragma mapbox: initialize lowp float blur
604#pragma mapbox: initialize lowp float opacity
605float 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);
606#ifdef GLOBE
607if (v_depth > 1.0) {discard;}
608#endif
609#ifdef OVERDRAW_INSPECTOR
610fragColor=vec4(1.0);
611#endif
612}`,`
613#define scale 0.015873016
614in 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;
615#ifdef GLOBE
616out float v_depth;
617#endif
618#pragma mapbox: define lowp float blur
619#pragma mapbox: define lowp float opacity
620#pragma mapbox: define mediump float gapwidth
621#pragma mapbox: define lowp float offset
622#pragma mapbox: define mediump float width
623void main() {
624#pragma mapbox: initialize lowp float blur
625#pragma mapbox: initialize lowp float opacity
626#pragma mapbox: initialize mediump float gapwidth
627#pragma mapbox: initialize lowp float offset
628#pragma mapbox: initialize mediump float width
629float 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;
630#ifdef GLOBE
631v_depth=gl_Position.z/gl_Position.w;
632#endif
633#ifdef TERRAIN3D
634v_gamma_scale=1.0;
635#else
636float 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;
637#endif
638v_width2=vec2(outset,inset);}`),linePattern:li(`#ifdef GL_ES
639precision highp float;
640#endif
641uniform 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;
642#ifdef GLOBE
643in float v_depth;
644#endif
645#pragma mapbox: define lowp vec4 pattern_from
646#pragma mapbox: define lowp vec4 pattern_to
647#pragma mapbox: define lowp float pixel_ratio_from
648#pragma mapbox: define lowp float pixel_ratio_to
649#pragma mapbox: define lowp float blur
650#pragma mapbox: define lowp float opacity
651void main() {
652#pragma mapbox: initialize mediump vec4 pattern_from
653#pragma mapbox: initialize mediump vec4 pattern_to
654#pragma mapbox: initialize lowp float pixel_ratio_from
655#pragma mapbox: initialize lowp float pixel_ratio_to
656#pragma mapbox: initialize lowp float blur
657#pragma mapbox: initialize lowp float opacity
658vec2 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;
659#ifdef GLOBE
660if (v_depth > 1.0) {discard;}
661#endif
662#ifdef OVERDRAW_INSPECTOR
663fragColor=vec4(1.0);
664#endif
665}`,`
666#define scale 0.015873016
667#define LINE_DISTANCE_SCALE 2.0
668in 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;
669#ifdef GLOBE
670out float v_depth;
671#endif
672#pragma mapbox: define lowp float blur
673#pragma mapbox: define lowp float opacity
674#pragma mapbox: define lowp float offset
675#pragma mapbox: define mediump float gapwidth
676#pragma mapbox: define mediump float width
677#pragma mapbox: define lowp float floorwidth
678#pragma mapbox: define lowp vec4 pattern_from
679#pragma mapbox: define lowp vec4 pattern_to
680#pragma mapbox: define lowp float pixel_ratio_from
681#pragma mapbox: define lowp float pixel_ratio_to
682void main() {
683#pragma mapbox: initialize lowp float blur
684#pragma mapbox: initialize lowp float opacity
685#pragma mapbox: initialize lowp float offset
686#pragma mapbox: initialize mediump float gapwidth
687#pragma mapbox: initialize mediump float width
688#pragma mapbox: initialize lowp float floorwidth
689#pragma mapbox: initialize mediump vec4 pattern_from
690#pragma mapbox: initialize mediump vec4 pattern_to
691#pragma mapbox: initialize lowp float pixel_ratio_from
692#pragma mapbox: initialize lowp float pixel_ratio_to
693float 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);
693float 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;
694#ifdef GLOBE
695v_depth=gl_Position.z/gl_Position.w;
696#endif
697#ifdef TERRAIN3D
698v_gamma_scale=1.0;
699#else
700float 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;
701#endif
702v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:li(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;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;
703#ifdef GLOBE
704in float v_depth;
705#endif
706#pragma mapbox: define highp vec4 color
707#pragma mapbox: define lowp float blur
708#pragma mapbox: define lowp float opacity
709#pragma mapbox: define mediump float width
710#pragma mapbox: define lowp float floorwidth
711void main() {
712#pragma mapbox: initialize highp vec4 color
713#pragma mapbox: initialize lowp float blur
714#pragma mapbox: initialize lowp float opacity
715#pragma mapbox: initialize mediump float width
716#pragma mapbox: initialize lowp float floorwidth
717float 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);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*opacity);
718#ifdef GLOBE
719if (v_depth > 1.0) {discard;}
720#endif
721#ifdef OVERDRAW_INSPECTOR
722fragColor=vec4(1.0);
723#endif
724}`,`
725#define scale 0.015873016
726#define LINE_DISTANCE_SCALE 2.0
727in 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_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;out vec2 v_normal;out vec2 v_width2;out vec2 v_tex_a;out vec2 v_tex_b;out float v_gamma_scale;
728#ifdef GLOBE
729out float v_depth;
730#endif
731#pragma mapbox: define highp vec4 color
732#pragma mapbox: define lowp float blur
733#pragma mapbox: define lowp float opacity
734#pragma mapbox: define mediump float gapwidth
735#pragma mapbox: define lowp float offset
736#pragma mapbox: define mediump float width
737#pragma mapbox: define lowp float floorwidth
738void main() {
739#pragma mapbox: initialize highp vec4 color
740#pragma mapbox: initialize lowp float blur
741#pragma mapbox: initialize lowp float opacity
742#pragma mapbox: initialize mediump float gapwidth
743#pragma mapbox: initialize lowp float offset
744#pragma mapbox: initialize mediump float width
745#pragma mapbox: initialize lowp float floorwidth
746float 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;
747#ifdef GLOBE
748v_depth=gl_Position.z/gl_Position.w;
749#endif
750#ifdef TERRAIN3D
751v_gamma_scale=1.0;
752#else
753float 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;
754#endif
755v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}`),raster:li(`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);
756#ifdef OVERDRAW_INSPECTOR
757fragColor=vec4(1.0);
758#endif
759}`,`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;
760#ifdef GLOBE
761if (a_pos.y <-32767.5) {v_pos0.y=0.0;}if (a_pos.y > 32766.5) {v_pos0.y=1.0;}
762#endif
763v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}`),symbolIcon:li(`uniform sampler2D u_texture;in vec2 v_tex;in float v_fade_opacity;
764#pragma mapbox: define lowp float opacity
765void main() {
766#pragma mapbox: initialize lowp float opacity
767lowp float alpha=opacity*v_fade_opacity;fragColor=texture(u_texture,v_tex)*alpha;
768#ifdef OVERDRAW_INSPECTOR
769fragColor=vec4(1.0);
770#endif
771}`,`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;
772#pragma mapbox: define lowp float opacity
773void main() {
774#pragma mapbox: initialize lowp float opacity
775vec2 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 ?
776camera_to_anchor_distance/u_camera_to_center_distance :
777u_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;
778#ifdef GLOBE
779if(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);}
780#endif
781vec4 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:li(`#define SDF_PX 8.0
782uniform 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;
783#pragma mapbox: define highp vec4 fill_color
784#pragma mapbox: define highp vec4 halo_color
785#pragma mapbox: define lowp float opacity
786#pragma mapbox: define lowp float halo_width
787#pragma mapbox: define lowp float halo_blur
788void main() {
789#pragma mapbox: initialize highp vec4 fill_color
790#pragma mapbox: initialize highp vec4 halo_color
791#pragma mapbox: initialize lowp float opacity
792#pragma mapbox: initialize lowp float halo_width
793#pragma mapbox: initialize lowp float halo_blur
794float 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);
795#ifdef OVERDRAW_INSPECTOR
796fragColor=vec4(1.0);
797#endif
798}`,`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;
799#pragma mapbox: define highp vec4 fill_color
800#pragma mapbox: define highp vec4 halo_color
801#pragma mapbox: define lowp float opacity
802#pragma mapbox: define lowp float halo_width
803#pragma mapbox: define lowp float halo_blur
804void main() {
805#pragma mapbox: initialize highp vec4 fill_color
806#pragma mapbox: initialize highp vec4 halo_color
807#pragma mapbox: initialize lowp float opacity
808#pragma mapbox: initialize lowp float halo_width
809#pragma mapbox: initialize lowp float halo_blur
810vec2 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 ?
811camera_to_anchor_distance/u_camera_to_center_distance :
812u_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;
813#ifdef GLOBE
814if(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);}
815#endif
816vec4 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:li(`#define SDF_PX 8.0
817#define SDF 1.0
818#define ICON 0.0
819uniform 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;
820#pragma mapbox: define highp vec4 fill_color
821#pragma mapbox: define highp vec4 halo_color
822#pragma mapbox: define lowp float opacity
823#pragma mapbox: define lowp float halo_width
824#pragma mapbox: define lowp float halo_blur
825void main() {
826#pragma mapbox: initialize highp vec4 fill_color
827#pragma mapbox: initialize highp vec4 halo_color
828#pragma mapbox: initialize lowp float opacity
829#pragma mapbox: initialize lowp float halo_width
830#pragma mapbox: initialize lowp float halo_blur
831float fad
831e_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;
832#ifdef OVERDRAW_INSPECTOR
833fragColor=vec4(1.0);
834#endif
835return;}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);
836#ifdef OVERDRAW_INSPECTOR
837fragColor=vec4(1.0);
838#endif
839}`,`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;
840#pragma mapbox: define highp vec4 fill_color
841#pragma mapbox: define highp vec4 halo_color
842#pragma mapbox: define lowp float opacity
843#pragma mapbox: define lowp float halo_width
844#pragma mapbox: define lowp float halo_blur
845void main() {
846#pragma mapbox: initialize highp vec4 fill_color
847#pragma mapbox: initialize highp vec4 halo_color
848#pragma mapbox: initialize lowp float opacity
849#pragma mapbox: initialize lowp float halo_width
850#pragma mapbox: initialize lowp float halo_blur
851vec2 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 ?
852camera_to_anchor_distance/u_camera_to_center_distance :
853u_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;
854#ifdef GLOBE
855if(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);}
856#endif
857vec4 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:li("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);
857float 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:li("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:li("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:li("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:li(`in 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
858);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:li("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);}")};
vendor: 29,011 bytes, lines 858-907
858function li(f,e){const a=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,l=e.match(/in ([\w]+) ([\w]+)/g),d=f.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),m=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),y=m?m.concat(d):d,w={};return{fragmentSource:f=f.replace(a,((S,P,k,B,L)=>(w[L]=!0,P==="define"?`
859#ifndef HAS_UNIFORM_u_${L}
860in ${k} ${B} ${L};
861#else
862uniform ${k} ${B} u_${L};
863#endif
864`:`
865#ifdef HAS_UNIFORM_u_${L}
866    ${k} ${B} ${L} = u_${L};
867#endif
868`))),vertexSource:e=e.replace(a,((S,P,k,B,L)=>{const j=B==="float"?"vec2":"vec4",G=L.match(/color/)?"color":j;return w[L]?P==="define"?`
869#ifndef HAS_UNIFORM_u_${L}
870uniform lowp float u_${L}_t;
871in ${k} ${j} a_${L};
872out ${k} ${B} ${L};
873#else
874uniform ${k} ${B} u_${L};
875#endif
876`:G==="vec4"?`
877#ifndef HAS_UNIFORM_u_${L}
878    ${L} = a_${L};
879#else
880    ${k} ${B} ${L} = u_${L};
881#endif
882`:`
883#ifndef HAS_UNIFORM_u_${L}
884    ${L} = unpack_mix_${G}(a_${L}, u_${L}_t);
885#else
886    ${k} ${B} ${L} = u_${L};
887#endif
888`:P==="define"?`
889#ifndef HAS_UNIFORM_u_${L}
890uniform lowp float u_${L}_t;
891in ${k} ${j} a_${L};
892#else
893uniform ${k} ${B} u_${L};
894#endif
895`:G==="vec4"?`
896#ifndef HAS_UNIFORM_u_${L}
897    ${k} ${B} ${L} = a_${L};
898#else
899    ${k} ${B} ${L} = u_${L};
900#endif
901`:`
902#ifndef HAS_UNIFORM_u_${L}
903    ${k} ${B} ${L} = unpack_mix_${G}(a_${L}, u_${L}_t);
904#else
905    ${k} ${B} ${L} = u_${L};
906#endif
907`})),staticAttributes:l,staticUniforms:y}}class Gs{constructor(e,a,l){this.vertexBuffer=e,this.indexBuffer=a,this.segments=l}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}var ns=u.aJ([{name:"a_pos",type:"Int16",components:2}]);const xs="#define PROJECTION_MERCATOR",Eo="mercator";class ai{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return Eo}get shaderDefine(){return xs}get shaderPreludeCode(){return La.projectionMercator}get vertexShaderPreludeCode(){return La.projectionMercator.vertexSource}get subdivisionGranularity(){return u.aK.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}get latitudeErrorCorrectionRadians(){return 0}destroy(){}updateGPUdependent(e){}getMeshFromTileID(e,a,l,d,m){if(this._cachedMesh)return this._cachedMesh;const y=new u.aL;y.emplaceBack(0,0),y.emplaceBack(u.$,0),y.emplaceBack(0,u.$),y.emplaceBack(u.$,u.$);const w=e.createVertexBuffer(y,ns.members),S=u.aM.simpleSegment(0,0,4,2),P=new u.aN;P.emplaceBack(1,0,2),P.emplaceBack(1,2,3);const k=e.createIndexBuffer(P);return this._cachedMesh=new Gs(w,k,S),this._cachedMesh}recalculate(){}hasTransition(){return!1}setErrorQueryLatitudeDegrees(e){}}class vs{constructor(e=0,a=0,l=0,d=0){if(isNaN(e)||e<0||isNaN(a)||a<0||isNaN(l)||l<0||isNaN(d)||d<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=e,this.bottom=a,this.left=l,this.right=d}interpolate(e,a,l){return a.top!=null&&e.top!=null&&(this.top=u.C.number(e.top,a.top,l)),a.bottom!=null&&e.bottom!=null&&(this.bottom=u.C.number(e.bottom,a.bottom,l)),a.left!=null&&e.left!=null&&(this.left=u.C.number(e.left,a.left,l)),a.right!=null&&e.right!=null&&(this.right=u.C.number(e.right,a.right,l)),this}getCenter(e,a){const l=u.ah((this.left+e-this.right)/2,0,e),d=u.ah((this.top+a-this.bottom)/2,0,a);return new u.P(l,d)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new vs(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function hl(f,e){if(!f.renderWorldCopies||f.lngRange)return;const a=e.lng-f.center.lng;e.lng+=a>180?-360:a<-180?360:0}function bs(f){return Math.max(0,Math.floor(f))}class Nr{constructor(e,a,l,d,m,y){this._callbacks=e,this._tileSize=512,this._renderWorldCopies=y===void 0||!!y,this._minZoom=a||0,this._maxZoom=l||22,this._minPitch=d??0,this._maxPitch=m??60,this.setMaxBounds(),this._width=0,this._height=0,this._center=new u.S(0,0),this._elevation=0,this._zoom=0,this._tileZoom=bs(this._zoom),this._scale=u.af(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new vs,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0}apply(e,a,l){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=bs(this._zoom),this._scale=u.af(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 vs(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=!l&&e.autoCalculateNearFarZ,a&&this._constrain(),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.getConstrained(this._center,this.zoom).zoom))}get maxZoom(){return this._maxZoom}setMaxZoom(e){this._maxZoom!==e&&(this._maxZoom=e,this.setZoom(this.getConstrained(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){e===void 0?e=!0:e===null&&(e=!1),this._renderWorldCopies=e}get worldSize(){return this._tileSize*this._scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new u.P(this._width,this._height)}get bearing(){return this._bearingInRadians/Math.PI*180}setBearing(e){const a=u.aO(e,-180,180)*Math.PI/180;var l,d,m,y,w,S,P,k,B;this._bearingInRadians!==a&&(this._unmodified=!1,this._bearingInRadians=a,this._calcMatrices(),this._rotationMatrix=ne(),l=this._rotationMatrix,m=-this._bearingInRadians,y=(d=this._rotationMatrix)[0],w=d[1],S=d[2],P=d[3],k=Math.sin(m),B=Math.cos(m),l[0]=y*B+S*k,l[1]=w*B+P*k,l[2]=y*-k+S*B,l[3]=w*-k+P*B)}get rotationMatrix(){return this._rotationMatrix}get pitchInRadians(){return this._pitchInRadians}get pitch(){return this._pitchInRadians/Math.PI*180}setPitch(e){const a=u.ah(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitchInRadians!==a&&(this._unmodified=!1,this._pitchInRadians=a,this._calcMatrices())}get rollInRadians(){return this._rollInRadians}get roll(){return this._rollInRadians/Math.PI*180}setRoll(e){const a=e/180*Math.PI;this._rollInRadians!==a&&(this._unmodified=!1,this._rollInRadians=a,this._calcMatrices())}get fovInRadians(){return this._fovInRadians}get fov(){return u.aP(this._fovInRadians)}setFov(e){e=u.ah(e,.1,150),this.fov!==e&&(this._unmodified=!1,this._fovInRadians=u.ae(e),this._calcMatrices())}get zoom(){return this._zoom}setZoom(e){const a=this.getConstrained(this._center,e).zoom;this._zoom!==a&&(this._unmodified=!1,this._zoom=a,this._tileZoom=Math.max(0,Math.floor(a)),this._scale=u.af(a),this._constrain(),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._constrain(),this._calcMatrices())}get elevation(){return this._elevation}setElevation(e){e!==this._elevation&&(this._elevation=e,this._constrain(),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,a){this._autoCalculateNearFarZ=!1,this._nearZ=e,this._farZ=a,this._calcMatrices()}clearNearFarZOverride(){this._autoCalculateNearFarZ=!0,this._calcMatrices()}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,a,l){this._unmodified=!1,this._edgeInsets.interpolate(e,a,l),this._constrain(),this._calcMatrices()}resize(e,a,l=!0){this._width=e,this._height=a,l&&this._constrain(),this._calcMatrices()}getMaxBounds(){return this._latRange&&this._latRange.length===2&&this._lngRange&&this._lngRange.length===2?new qi([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._constrain()):(this._lngRange=null,this._latRange=[-u.ai,u.ai])}getConstrained(e,a){return this._callbacks.getConstrained(e,a)}getCameraQueryGeometry(e,a){if(a.length===1)return[a[0],e];{const{minX:l,minY:d,maxX:m,maxY:y}=u.a2.fromPoints(a).extend(e);return[new u.P(l,d),new u.P(m,d),new u.P(m,y),new u.P(l,y),new u.P(l,d)]}}_constrain(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;const e=this._unmodified,{center:a,zoom:l}=this.getConstrained(this.center,this.zoom);this.setCenter(a),this.setZoom(l),this._unmodified=e,this._constraining=!1}_calcMatrices(){if(this._width&&this._height){this._pixelsToGLUnits=[2/this._width,-2/this._height];let e=u.ag(new Float64Array(16));u.N(e,e,[this._width/2,-this._height/2,1]),u.M(e,e,[1,-1,0]),this._clipSpaceToPixelsMatrix=e,e=u.ag(new Float64Array(16)),u.N(e,e,[1,-1,1]),u.M(e,e,[-1,-1,0]),u.N(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,a,l,d){const m=l!==void 0?l:this.bearing,y=d=d!==void 0?d:this.pitch,w=u.a1.fromLngLat(e,a),S=-Math.cos(u.ae(y)),P=Math.sin(u.ae(y)),k=P*Math.sin(u.ae(m)),B=-P*Math.cos(u.ae(m));let L=this.elevation;const j=a-L;let G;S*j>=0||Math.abs(S)<.1?(G=1e4,L=a+G*S):G=-j/S;let ee,J,te=u.aQ(1,w.y),ae=0;do{if(ae+=1,ae>10)break;J=G/te,ee=new u.a1(w.x+k*J,w.y+B*J),te=1/ee.meterInMercatorCoordinateUnits()}while(Math.abs(G-J*te)>1e-12);return{center:ee.toLngLat(),elevation:L,zoom:u.ak(this.height/2/Math.tan(this.fovInRadians/2)/J/this.tileSize)}}recalculateZoomAndCenter(e){if(this.elevation-e==0)return;const a=u.aj(1,this.center.lat)*this.worldSize,l=this.cameraToCenterDistance/a,d=u.a1.fromLngLat(this.center,this.elevation),m=Re(this.center,this.elevation,this.pitch,this.bearing,l);this._elevation=e;const y=this.calculateCenterFromCameraLngLatAlt(m.toLngLat(),u.aQ(m.z,d.y),this.bearing,this.pitch);this._elevation=y.elevation,this._center=y.center,this.setZoom(y.zoom)}getCameraPoint(){const e=Math.tan(this.pitchInRadians)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new u.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=u.aj(1,this.center.lat)*this.worldSize;return Re(this.center,this.elevation,this.pitch,this.bearing,this.cameraToCenterDistance/e).toLngLat()}getMercatorTileCoordinates(e){if(!e)return[0,0,1,1];const a=e.canonical.z>=0?1<<e.canonical.z:Math.pow(2,e.canonical.z);return[e.canonical.x/a,e.canonical.y/a,1/a/u.$,1/a/u.$]}}class qr{constructor(e,a){this.min=e,this.max=a,this.center=u.aR([],u.aS([],this.min,this.max),.5)}quadrant(e){const a=[e%2==0,e<2],l=u.aT(this.min),d=u.aT(this.max);for(let m=0;m<a.length;m++)l[m]=a[m]?this.min[m]:this.center[m],d[m]=a[m]?this.center[m]:this.max[m];return d[2]=this.max[2],new qr(l,d)}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 a=!0;for(let l=0;l<e.planes.length;l++){const d=this.intersectsPlane(e.planes[l]);if(d===0)return 0;d===1&&(a=!1)}return a?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 a=e[3],l=e[3];for(let d=0;d<3;d++)e[d]>0?(a+=e[d]*this.min[d],l+=e[d]*this.max[d]):(l+=e[d]*this.min[d],a+=e[d]*this.max[d]);return a>=0?2:l<0?0:1}}class nn{distanceToTile2d(e,a,l,d){const m=d.distanceX([e,a]),y=d.distanceY([e,a]);return Math.hypot(m,y)}getWrap(e,a,l){return l}getTileBoundingVolume(e,a,l,d){var m,y;let w=0,S=0;if(d?.terrain){const k=new u.Z(e.z,a,e.z,e.x,e.y),B=d.terrain.getMinMaxElevation(k);w=(m=B.minElevation)!==null&&m!==void 0?m:Math.min(0,l),S=(y=B.maxElevation)!==null&&y!==void 0?y:Math.max(0,l)}const P=1<<e.z;return new qr([a+e.x/P,e.y/P,w],[a+(e.x+1)/P,(e.y+1)/P,S])}allowVariableZoom(e,a){const l=e.fov*(Math.abs(Math.cos(e.rollInRadians))*e.height+Math.abs(Math.sin(e.rollInRadians))*e.width)/e.height,d=u.ah(78.5-l/2,0,60);return!!a.terrain||e.pitch>d}allowWorldCopies(){return!0}prepareNextFrame(){}}class Dr{constructor(e,a,l){this.points=e,this.planes=a,this.aabb=l}static fromInvProjectionMatrix(e,a=1,l=0,d,m){const y=m?[[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]],w=Math.pow(2,l),S=[[-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((L=>(function(j,G,ee,J){const te=u.aw([],j,G),ae=1/te[3]/ee*J;return u.aY(te,te,[ae,ae,1/te[3],ae])})(L,e,a,w)));d&&(function(L,j,G,ee){const J=ee?4:0,te=ee?0:4;let ae=0;const ue=[],oe=[];for(let le=0;le<4;le++){const Se=u.aU([],L[le+te],L[le+J]),Oe=u.aZ(Se);u.aR(Se,Se,1/Oe),ue.push(Oe),oe.push(Se)}for(let le=0;le<4;le++){const Se=u.a_(L[le+J],oe[le],G);ae=Se!==null&&Se>=0?Math.max(ae,Se):Math.max(ae,ue[le])}const de=(function(le,Se){const Oe=u.aU([],le[Se[0]],le[Se[1]]),ze=u.aU([],le[Se[2]],le[Se[1]]),ke=[0,0,0,0];return u.aV(ke,u.aW([],Oe,ze)),ke[3]=-u.aX(ke,le[Se[0]]),ke})(L,j),ge=(function(le,Se){const Oe=u.a$(le),ze=u.b0([],le,1/Oe),ke=u.aU([],Se,u.aR([],ze,u.aX(Se,ze))),Le=u.a$(ke);if(Le>0){const ot=Math.sqrt(1-ze[3]*ze[3]),ct=u.aR([],ze,-ze[3]),We=u.aS([],ct,u.aR([],ke,ot/Le));return u.b1(Se,We)}return null})(G,de);if(ge!==null){const le=ge/u.aX(oe[0],de);ae=Math.min(ae,le)}for(let le=0;le<4;le++){const Se=Math.min(ae,ue[le]);L[le+te]=[L[le+J][0]+oe[le][0]*Se,L[le+J][1]+oe[le][1]*Se,L[le+J][2]+oe[le][2]*Se,1]}})(S,y[0],d,m);const P=y.map((L=>{const j=u.aU([],S[L[0]],S[L[1]]),G=u.aU([],S[L[2]],S[L[1]]),ee=u.aV([],u.aW([],j,G)),J=-u.aX(ee,S[L[1]]);return ee.concat(J)})),k=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY],B=[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];for(const L of S)for(let j=0;j<3;j++)k[j]=Math.min(k[j],L[j]),B[j]=Math.max(B[j],L[j]);return new Dr(S,P,new qr(k,B))}}class Mi{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,a,l){return this._helper.interpolatePadding(e,a,l)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,a,l=!0){this._helper.resize(e,a,l)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}overrideNearFarZ(e,a){this._helper.overrideNearFarZ(e,a)}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 nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(e,a){}constructor(e,a,l,d,m){this._posMatrixCache=new Map,this._alignedPosMatrixCache=new Map,this._fogMatrixCacheF32=new Map,this._helper=new Nr({calcMatrices:()=>{this._calcMatrices()},getConstrained:(y,w)=>this.getConstrained(y,w)},e,a,l,d,m),this._coveringTilesDetailsProvider=new nn}clone(){const e=new Mi;return e.apply(this),e}apply(e,a,l){this._helper.apply(e,a,l)}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 a=[new u.b2(0,e)];if(this._helper._renderWorldCopies){const l=this.screenPointToMercatorCoordinate(new u.P(0,0)),d=this.screenPointToMercatorCoordinate(new u.P(this._helper._width,0)),m=this.screenPointToMercatorCoordinate(new u.P(this._helper._width,this._helper._height)),y=this.screenPointToMercatorCoordinate(new u.P(0,this._helper._height)),w=Math.floor(Math.min(l.x,d.x,m.x,y.x)),S=Math.floor(Math.max(l.x,d.x,m.x,y.x)),P=1;for(let k=w-P;k<=S+P;k++)k!==0&&a.push(new u.b2(k,e))}return a}getCameraFrustum(){return Dr.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(e){const a=this.screenPointToLocation(this.centerPoint,e),l=e?e.getElevationForLngLatZoom(a,this._helper._tileZoom):0;this._helper.recalculateZoomAndCenter(l)}setLocationAtPoint(e,a){const l=u.aj(this.elevation,this.center.lat),d=this.screenPointToMercatorCoordinateAtZ(a,l),m=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,l),y=u.a1.fromLngLat(e),w=new u.a1(y.x-(d.x-m.x),y.y-(d.y-m.y));this.setCenter(w?.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap())}locationToScreenPoint(e,a){return a?this.coordinatePoint(u.a1.fromLngLat(e),a.getElevationForLngLatZoom(e,this._helper._tileZoom),this._pixelMatrix3D):this.coordinatePoint(u.a1.fromLngLat(e))}screenPointToLocation(e,a){var l;return(l=this.screenPointToMercatorCoordinate(e,a))===null||l===void 0?void 0:l.toLngLat()}screenPointToMercatorCoordinate(e,a){if(a){const l=a.pointCoordinate(e);if(l!=null)return l}return this.screenPointToMercatorCoordinateAtZ(e)}screenPointToMercatorCoordinateAtZ(e,a){const l=a||0,d=[e.x,e.y,0,1],m=[e.x,e.y,1,1];u.aw(d,d,this._pixelMatrixInverse),u.aw(m,m,this._pixelMatrixInverse);const y=d[3],w=m[3],S=d[1]/y,P=m[1]/w,k=d[2]/y,B=m[2]/w,L=k===B?0:(l-k)/(B-k);return new u.a1(u.C.number(d[0]/y,m[0]/w,L)/this.worldSize,u.C.number(S,P,L)/this.worldSize,l)}coordinatePoint(e,a=0,l=this._pixelMatrix){const d=[e.x*this.worldSize,e.y*this.worldSize,a,1];return u.aw(d,d,l),new u.P(d[0]/d[3],d[1]/d[3])}getBounds(){const e=Math.max(0,this._helper._height/2-me(this));return new qi().extend(this.screenPointToLocation(new u.P(0,e))).extend(this.screenPointToLocation(new u.P(this._helper._width,e))).extend(this.screenPointToLocation(new u.P(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new u.P(0,this._helper._height)))}isPointOnMapSurface(e,a){return a?a.pointCoordinate(e)!=null:e.y>this.height/2-me(this)}calculatePosMatrix(e,a=!1,l){var d;const m=(d=e.key)!==null&&d!==void 0?d:u.b3(e.wrap,e.canonical.z,e.canonical.z,e.canonical.x,e.canonical.y),y=a?this._alignedPosMatrixCache:this._posMatrixCache;if(y.has(m)){const P=y.get(m);return l?P.f32:P.f64}const w=ve(e,this.worldSize);u.O(w,a?this._alignedProjMatrix:this._viewProjMatrix,w);const S={f64:w,f32:new Float32Array(w)};return y.set(m,S),l?S.f32:S.f64}calculateFogMatrix(e){const a=e.key,l=this._fogMatrixCacheF32;if(l.has(a))return l.get(a);const d=ve(e,this.worldSize);return u.O(d,this._fogMatrix,d),l.set(a,new Float32Array(d)),l.get(a)}getConstrained(e,a){a=u.ah(+a,this.minZoom,this.maxZoom);const l={center:new u.S(e.lng,e.lat),zoom:a};let d=this._helper._lngRange;if(!this._helper._renderWorldCopies&&d===null){const ue=179.9999999999;d=[-ue,ue]}const m=this.tileSize*u.af(l.zoom);let y=0,w=m,S=0,P=m,k=0,B=0;const{x:L,y:j}=this.size;if(this._helper._latRange){const ue=this._helper._latRange;y=u.U(ue[1])*m,w=u.U(ue[0])*m,w-y<j&&(k=j/(w-y))}d&&(S=u.aO(u.V(d[0])*m,0,m),P=u.aO(u.V(d[1])*m,0,m),P<S&&(P+=m),P-S<L&&(B=L/(P-S)));const{x:G,y:ee}=W(m,e);let J,te;const ae=Math.max(B||0,k||0);if(ae){const ue=new u.P(B?(P+S)/2:G,k?(w+y)/2:ee);return l.center=ce(m,ue).wrap(),l.zoom+=u.ak(ae),l}if(this._helper._latRange){const ue=j/2;ee-ue<y&&(te=y+ue),ee+ue>w&&(te=w-ue)}if(d){const ue=(S+P)/2;let oe=G;this._helper._renderWorldCopies&&(oe=u.aO(G,ue-m/2,ue+m/2));const de=L/2;oe-de<S&&(J=S+de),oe+de>P&&(J=P-de)}if(J!==void 0||te!==void 0){const ue=new u.P(J??G,te??ee);l.center=ce(m,ue).wrap()}return l}calculateCenterFromCameraLngLatAlt(e,a,l,d){return this._helper.calculateCenterFromCameraLngLatAlt(e,a,l,d)}_calculateNearFarZIfNeeded(e,a,l){if(!this._helper.autoCalculateNearFarZ)return;const d=Math.min(this.elevation,this.minElevationForCurrentTile,this.getCameraAltitude()-100),m=e-d*this._helper._pixelPerMeter/Math.cos(a),y=d<0?m:e,w=Math.PI/2+this.pitchInRadians,S=u.ae(this.fov)*(Math.abs(Math.cos(u.ae(this.roll)))*this.height+Math.abs(Math.sin(u.ae(this.roll)))*this.width)/this.height*(.5+l.y/this.height),P=Math.sin(S)*y/Math.sin(u.ah(Math.PI-w-S,.01,Math.PI-.01)),k=me(this),B=Math.atan(k/this._helper.cameraToCenterDistance),L=u.ae(.75),j=B>L?2*B*(.5+l.y/(2*k)):L,G=Math.sin(j)*y/Math.sin(u.ah(Math.PI-w-j,.01,Math.PI-.01)),ee=Math.min(P,G);this._helper._farZ=1.01*(Math.cos(Math.PI/2-a)*ee+y),this._helper._nearZ=this._helper._height/50}_calcMatrices(){if(!this._helper._height)return;const e=this.centerOffset,a=W(this.worldSize,this.center),l=a.x,d=a.y;this._helper._pixelPerMeter=u.aj(1,this.center.lat)*this.worldSize;const m=u.ae(Math.min(this.pitch,Y)),y=Math.max(this._helper.cameraToCenterDistance/2,this._helper.cameraToCenterDistance+this._helper._elevation*this._helper._pixelPerMeter/Math.cos(m));let w;this._calculateNearFarZIfNeeded(y,m,e),w=new Float64Array(16),u.b4(w,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),u.aq(this._invProjMatrix,w),w[8]=2*-e.x/this._helper._width,w[9]=2*e.y/this._helper._height,this._projectionMatrix=u.b5(w),u.N(w,w,[1,-1,1]),u.M(w,w,[0,0,-this._helper.cameraToCenterDistance]),u.b6(w,w,-this.rollInRadians),u.b7(w,w,this.pitchInRadians),u.b6(w,w,-this.bearingInRadians),u.M(w,w,[-l,-d,0]),this._mercatorMatrix=u.N([],w,[this.worldSize,this.worldSize,this.worldSize]),u.N(w,w,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=u.O(new Float64Array(16),this.clipSpaceToPixelsMatrix,w),u.M(w,w,[0,0,-this.elevation]),this._viewProjMatrix=w,this._invViewProjMatrix=u.aq([],w);const S=[0,0,-1,1];u.aw(S,S,this._invViewProjMatrix),this._cameraPosition=[S[0]/S[3],S[1]/S[3],S[2]/S[3]],this._fogMatrix=new Float64Array(16),u.b4(this._fogMatrix,this.fovInRadians,this.width/this.height,y,this._helper._farZ),this._fogMatrix[8]=2*-e.x/this.width,this._fogMatrix[9]=2*e.y/this.height,u.N(this._fogMatrix,this._fogMatrix,[1,-1,1]),u.M(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),u.b6(this._fogMatrix,this._fogMatrix,-this.rollInRadians),u.b7(this._fogMatrix,this._fogMatrix,this.pitchInRadians),u.b6(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),u.M(this._fogMatrix,this._fogMatrix,[-l,-d,0]),u.N(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),u.M(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=u.O(new Float64Array(16),this.clipSpaceToPixelsMatrix,w);const P=this._helper._width%2/2,k=this._helper._height%2/2,B=Math.cos(this.bearingInRadians),L=Math.sin(-this.bearingInRadians),j=l-Math.round(l)+B*P+L*k,G=d-Math.round(d)+B*k+L*P,ee=new Float64Array(w);if(u.M(ee,ee,[j>.5?j-1:j,G>.5?G-1:G,0]),this._alignedProjMatrix=ee,w=u.aq(new Float64Array(16),this._pixelMatrix),!w)throw new Error("failed to invert matrix");this._pixelMatrixInverse=w,this._clearMatrixCaches()}_clearMatrixCaches(){this._posMatrixCache.clear(),this._alignedPosMatrixCache.clear(),this._fogMatrixCacheF32.clear()}maxPitchScaleFactor(){if(!this._pixelMatrixInverse)return 1;const e=this.screenPointToMercatorCoordinate(new u.P(0,0)),a=[e.x*this.worldSize,e.y*this.worldSize,0,1];return u.aw(a,a,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){const e=u.aj(1,this.center.lat)*this.worldSize;return Re(this.center,this.elevation,this.pitch,this.bearing,this._helper.cameraToCenterDistance/e).toLngLat()}lngLatToCameraDepth(e,a){const l=u.a1.fromLngLat(e),d=[l.x*this.worldSize,l.y*this.worldSize,a,1];return u.aw(d,d,this._viewProjMatrix),d[2]/d[3]}getProjectionData(e){const{overscaledTileID:a,aligned:l,applyTerrainMatrix:d}=e,m=this._helper.getMercatorTileCoordinates(a),y=a?this.calculatePosMatrix(a,l,!0):null;let w;return w=a&&a.terrainRttPosMatrix32f&&d?a.terrainRttPosMatrix32f:y||u.b8(),{mainMatrix:w,tileMercatorCoords:m,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:w}}isLocationOccluded(e){return!1}getPixelScale(){return 1}getCircleRadiusCorrection(){return 1}getPitchedTextCorrection(e,a,l){return 1}transformLightDirection(e){return u.aT(e)}getRayDirectionFromPixel(e){throw new Error("Not implemented.")}projectTileCoordinates(e,a,l,d){const m=this.calculatePosMatrix(l);let y;d?(y=[e,a,d(e,a),1],u.aw(y,y,m)):(y=[e,a,0,1],So(y,y,m));const w=y[3];return{point:new u.P(y[0]/w,y[1]/w),signedDistanceFromCamera:w,isOccluded:!1}}populateCache(e){for(const a of e)this.calculatePosMatrix(a)}getMatrixForModel(e,a){const l=u.a1.fromLngLat(e,a),d=l.meterInMercatorCoordinateUnits(),m=u.b9();return u.M(m,m,[l.x,l.y,l.z]),u.b6(m,m,Math.PI),u.b7(m,m,Math.PI/2),u.N(m,m,[-d,d,d]),m}getProjectionDataForCustomLayer(e=!0){const a=new u.Z(0,0,0,0,0),l=this.getProjectionData({overscaledTileID:a,applyGlobeMatrix:e}),d=ve(a,this.worldSize);
vendor: 1,225 bytes, line 907
907u.O(d,this._viewProjMatrix,d),l.tileMercatorCoords=[0,0,1,1];const m=[u.$,u.$,this.worldSize/this._helper.pixelsPerMeter],y=u.ba();return u.N(y,d,m),l.fallbackMatrix=y,l.mainMatrix=y,l}getFastPathSimpleProjectionMatrix(e){return this.calculatePosMatrix(e)}}function as(){u.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}function an(f){if(f.useSlerp)if(f.k<1){const e=u.bb(f.startEulerAngles.roll,f.startEulerAngles.pitch,f.startEulerAngles.bearing),a=u.bb(f.endEulerAngles.roll,f.endEulerAngles.pitch,f.endEulerAngles.bearing),l=new Float64Array(4);u.bc(l,e,a,f.k);const d=u.bd(l);f.tr.setRoll(d.roll),f.tr.setPitch(d.pitch),f.tr.setBearing(d.bearing)}else f.tr.setRoll(f.endEulerAngles.roll),f.tr.setPitch(f.endEulerAngles.pitch),f.tr.setBearing(f.endEulerAngles.bearing);else f.tr.setRoll(u.C.number(f.startEulerAngles.roll,f.endEulerAngles.roll,f.k)),f.tr.setPitch(u.C.number(f.startEulerAngles.pitch,f.endEulerAngles.pitch,f.k)),f.tr.setBearing(u.C.number(f.startEulerAngles.bearing,f.endEulerAngles.bearing,f.k))}function sn(f,e,a,l,d){const m=d.padding,y=W(d.worldSize,a.getNorthWest()),w=W(d.worldSize,a.getNorthEast()),S=W(d.worldSize,a.getSouthEast()),P=W(d.worldSize,a.getSouthWest
vendor: 19,851 bytes, line 907
907()),k=u.ae(-l),B=y.rotate(k),L=w.rotate(k),j=S.rotate(k),G=P.rotate(k),ee=new u.P(Math.max(B.x,L.x,G.x,j.x),Math.max(B.y,L.y,G.y,j.y)),J=new u.P(Math.min(B.x,L.x,G.x,j.x),Math.min(B.y,L.y,G.y,j.y)),te=ee.sub(J),ae=(d.width-(m.left+m.right+e.left+e.right))/te.x,ue=(d.height-(m.top+m.bottom+e.top+e.bottom))/te.y;if(ue<0||ae<0)return void as();const oe=Math.min(u.ak(d.scale*Math.min(ae,ue)),f.maxZoom),de=u.P.convert(f.offset),ge=new u.P((e.left-e.right)/2,(e.top-e.bottom)/2).rotate(u.ae(l)),le=de.add(ge).mult(d.scale/u.af(oe));return{center:ce(d.worldSize,y.add(S).div(2).sub(le)),zoom:oe,bearing:l}}class gr{get useGlobeControls(){return!1}handlePanInertia(e,a){const l=e.mag(),d=Math.abs(me(a));return{easingOffset:e.mult(Math.min(.75*d/l,1)),easingCenter:a.center}}handleMapControlsRollPitchBearingZoom(e,a){e.bearingDelta&&a.setBearing(a.bearing+e.bearingDelta),e.pitchDelta&&a.setPitch(a.pitch+e.pitchDelta),e.rollDelta&&a.setRoll(a.roll+e.rollDelta),e.zoomDelta&&a.setZoom(a.zoom+e.zoomDelta)}handleMapControlsPan(e,a,l){e.around.distSqr(a.centerPoint)<.01||a.setLocationAtPoint(l,e.around)}cameraForBoxAndBearing(e,a,l,d,m){return sn(e,a,l,d,m)}handleJumpToCenterZoom(e,a){e.zoom!==(a.zoom!==void 0?+a.zoom:e.zoom)&&e.setZoom(+a.zoom),a.center!==void 0&&e.setCenter(u.S.convert(a.center))}handleEaseTo(e,a){const l=e.zoom,d=e.padding,m={roll:e.roll,pitch:e.pitch,bearing:e.bearing},y={roll:a.roll===void 0?e.roll:a.roll,pitch:a.pitch===void 0?e.pitch:a.pitch,bearing:a.bearing===void 0?e.bearing:a.bearing},w=a.zoom!==void 0,S=!e.isPaddingEqual(a.padding);let P=!1;const k=w?+a.zoom:e.zoom;let B=e.centerPoint.add(a.offsetAsPoint);const L=e.screenPointToLocation(B),{center:j,zoom:G}=e.getConstrained(u.S.convert(a.center||L),k??l);hl(e,j);const ee=W(e.worldSize,L),J=W(e.worldSize,j).sub(ee),te=u.af(G-l);return P=G!==l,{easeFunc:ae=>{if(P&&e.setZoom(u.C.number(l,G,ae)),u.be(m,y)||an({startEulerAngles:m,endEulerAngles:y,tr:e,k:ae,useSlerp:m.roll!=y.roll}),S&&(e.interpolatePadding(d,a.padding,ae),B=e.centerPoint.add(a.offsetAsPoint)),a.around)e.setLocationAtPoint(a.around,a.aroundPoint);else{const ue=u.af(e.zoom-l),oe=G>l?Math.min(2,te):Math.max(.5,te),de=Math.pow(oe,1-ae),ge=ce(e.worldSize,ee.add(J.mult(ae*de)).mult(ue));e.setLocationAtPoint(e.renderWorldCopies?ge.wrap():ge,B)}},isZooming:P,elevationCenter:j}}handleFlyTo(e,a){const l=a.zoom!==void 0,d=e.zoom,m=e.getConstrained(u.S.convert(a.center||a.locationAtOffset),l?+a.zoom:d),y=m.center,w=m.zoom;hl(e,y);const S=W(e.worldSize,a.locationAtOffset),P=W(e.worldSize,y).sub(S),k=P.mag(),B=u.af(w-d);let L;if(a.minZoom!==void 0){const j=Math.min(+a.minZoom,d,w),G=e.getConstrained(y,j).zoom;L=u.af(G-d)}return{easeFunc:(j,G,ee,J)=>{e.setZoom(j===1?w:d+u.ak(G));const te=j===1?y:ce(e.worldSize,S.add(P.mult(ee)).mult(G));e.setLocationAtPoint(e.renderWorldCopies?te.wrap():te,J)},scaleOfZoom:B,targetCenter:y,scaleOfMinZoom:L,pixelPathLength:k}}}class Ui{constructor(e,a,l){this.blendFunction=e,this.blendColor=a,this.mask=l}}Ui.Replace=[1,0],Ui.disabled=new Ui(Ui.Replace,u.bf.transparent,[!1,!1,!1,!1]),Ui.unblended=new Ui(Ui.Replace,u.bf.transparent,[!0,!0,!0,!0]),Ui.alphaBlended=new Ui([1,771],u.bf.transparent,[!0,!0,!0,!0]);const ss=2305;class jt{constructor(e,a,l){this.enable=e,this.mode=a,this.frontFace=l}}jt.disabled=new jt(!1,1029,ss),jt.backCCW=new jt(!0,1029,ss),jt.frontCCW=new jt(!0,1028,ss);class $t{constructor(e,a,l){this.func=e,this.mask=a,this.range=l}}$t.ReadOnly=!1,$t.ReadWrite=!0,$t.disabled=new $t(519,$t.ReadOnly,[0,1]);const pa=7680;class fi{constructor(e,a,l,d,m,y){this.test=e,this.ref=a,this.mask=l,this.fail=d,this.depthFail=m,this.pass=y}}fi.disabled=new fi({func:519,mask:0},0,0,pa,pa,pa);const Hi=new WeakMap;function gn(f){var e;if(Hi.has(f))return Hi.get(f);{const a=(e=f.getParameter(f.VERSION))===null||e===void 0?void 0:e.startsWith("WebGL 2.0");return Hi.set(f,a),a}}class ea{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 a=e.context,l=a.gl;this._texFormat=l.RGBA,this._texType=l.UNSIGNED_BYTE;const d=new u.aL;d.emplaceBack(-1,-1),d.emplaceBack(2,-1),d.emplaceBack(-1,2);const m=new u.aN;m.emplaceBack(0,1,2),this._fullscreenTriangle=new Gs(a.createVertexBuffer(d,ns.members),a.createIndexBuffer(m),u.aM.simpleSegment(0,0,d.length,m.length)),this._resultBuffer=new Uint8Array(4),a.activeTexture.set(l.TEXTURE1);const y=l.createTexture();l.bindTexture(l.TEXTURE_2D,y),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_S,l.CLAMP_TO_EDGE),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_T,l.CLAMP_TO_EDGE),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MIN_FILTER,l.NEAREST),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MAG_FILTER,l.NEAREST),l.texImage2D(l.TEXTURE_2D,0,this._texFormat,this._texWidth,this._texHeight,0,this._texFormat,this._texType,null),this._fbo=a.createFramebuffer(this._texWidth,this._texHeight,!1,!1),this._fbo.colorAttachment.set(y),gn(l)&&(this._pbo=l.createBuffer(),l.bindBuffer(l.PIXEL_PACK_BUFFER,this._pbo),l.bufferData(l.PIXEL_PACK_BUFFER,4,l.STREAM_READ),l.bindBuffer(l.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,a){const l=this._updateCount;return this._readbackQueue?l>=this._readbackQueue.frameNumberIssued+this._readbackWaitFrames&&this._tryReadback():l>=this._lastReadbackFrame+this._measureWaitFrames&&this._renderErrorTexture(e,a),this._updateCount++,this._measuredError}_bindFramebuffer(){const e=this._cachedRenderContext.context,a=e.gl;e.activeTexture.set(a.TEXTURE1),a.bindTexture(a.TEXTURE_2D,this._fbo.colorAttachment.get()),e.bindFramebuffer.set(this._fbo.framebuffer)}_renderErrorTexture(e,a){const l=this._cachedRenderContext.context,d=l.gl;if(this._bindFramebuffer(),l.viewport.set([0,0,this._texWidth,this._texHeight]),l.clear({color:u.bf.transparent}),this._cachedRenderContext.useProgram("projectionErrorMeasurement").draw(l,d.TRIANGLES,$t.disabled,fi.disabled,Ui.unblended,jt.disabled,((m,y)=>({u_input:m,u_output_expected:y}))(e,a),null,null,"$clipping",this._fullscreenTriangle.vertexBuffer,this._fullscreenTriangle.indexBuffer,this._fullscreenTriangle.segments),this._pbo&&gn(d)){d.bindBuffer(d.PIXEL_PACK_BUFFER,this._pbo),d.readBuffer(d.COLOR_ATTACHMENT0),d.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,0),d.bindBuffer(d.PIXEL_PACK_BUFFER,null);const m=d.fenceSync(d.SYNC_GPU_COMMANDS_COMPLETE,0);d.flush(),this._readbackQueue={frameNumberIssued:this._updateCount,sync:m}}else this._readbackQueue={frameNumberIssued:this._updateCount,sync:null}}_tryReadback(){const e=this._cachedRenderContext.context.gl;if(this._pbo&&this._readbackQueue&&gn(e)){const a=e.clientWaitSync(this._readbackQueue.sync,0,0);if(a===e.WAIT_FAILED)return u.w("WebGL2 clientWaitSync failed."),this._readbackQueue=null,void(this._lastReadbackFrame=this._updateCount);if(a===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=ea._parseRGBA8float(this._resultBuffer),this._lastReadbackFrame=this._updateCount}static _parseRGBA8float(e){let a=0;return a+=e[0]/256,a+=e[1]/65536,a+=e[2]/16777216,e[3]<127&&(a=-a),a/128}}const Zs=u.$/128;function Yu(f,e){const a=f.granularity!==void 0?Math.max(f.granularity,1):1,l=a+(f.generateBorders?2:0),d=a+(f.extendToNorthPole||f.generateBorders?1:0)+(f.extendToSouthPole||f.generateBorders?1:0),m=l+1,y=d+1,w=f.generateBorders?-1:0,S=f.generateBorders||f.extendToNorthPole?-1:0,P=a+(f.generateBorders?1:0),k=a+(f.generateBorders||f.extendToSouthPole?1:0),B=m*y,L=l*d*6,j=m*y>65536;if(j&&e==="16bit")throw new Error("Granularity is too large and meshes would not fit inside 16 bit vertex indices.");const G=j||e==="32bit",ee=new Int16Array(2*B);let J=0;for(let ue=S;ue<=k;ue++)for(let oe=w;oe<=P;oe++){let de=oe/a*u.$;oe===-1&&(de=-Zs),oe===a+1&&(de=u.$+Zs);let ge=ue/a*u.$;ue===-1&&(ge=f.extendToNorthPole?u.bh:-Zs),ue===a+1&&(ge=f.extendToSouthPole?u.bi:u.$+Zs),ee[J++]=de,ee[J++]=ge}const te=G?new Uint32Array(L):new Uint16Array(L);let ae=0;for(let ue=0;ue<d;ue++)for(let oe=0;oe<l;oe++){const de=oe+1+ue*m,ge=oe+(ue+1)*m,le=oe+1+(ue+1)*m;te[ae++]=oe+ue*m,te[ae++]=ge,te[ae++]=de,te[ae++]=de,te[ae++]=ge,te[ae++]=le}return{vertices:ee.buffer.slice(0),indices:te.buffer.slice(0),uses32bitIndices:G}}const qs=new u.aK({fill:new u.bj(128,2),line:new u.bj(512,0),tile:new u.bj(128,32),stencil:new u.bj(128,1),circle:3});class Ao{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 La.projectionGlobe}get vertexShaderPreludeCode(){return La.projectionMercator.vertexSource}get subdivisionGranularity(){return qs}get useGlobeControls(){return!0}get latitudeErrorCorrectionRadians(){return this._errorCorrectionUsable}destroy(){this._errorMeasurement&&this._errorMeasurement.destroy()}updateGPUdependent(e){this._errorMeasurement||(this._errorMeasurement=new ea(e));const a=u.U(this._errorQueryLatitudeDegrees),l=2*Math.atan(Math.exp(Math.PI-a*Math.PI*2))-.5*Math.PI,d=this._errorMeasurement.updateErrorLoop(a,l),m=Ce.now();d!==this._errorMeasurementLastValue&&(this._errorCorrectionPreviousValue=this._errorCorrectionUsable,this._errorMeasurementLastValue=d,this._errorMeasurementLastChangeTime=m);const y=Math.min(Math.max((m-this._errorMeasurementLastChangeTime)/1e3/.5,0),1);this._errorCorrectionUsable=u.bk(this._errorCorrectionPreviousValue,-this._errorMeasurementLastValue,u.bl(y))}_getMeshKey(e){return`${e.granularity.toString(36)}_${e.generateBorders?"b":""}${e.extendToNorthPole?"n":""}${e.extendToSouthPole?"s":""}`}getMeshFromTileID(e,a,l,d,m){const y=(m==="stencil"?qs.stencil:qs.tile).getGranularityForZoomLevel(a.z);return this._getMesh(e,{granularity:y,generateBorders:l,extendToNorthPole:a.y===0&&d,extendToSouthPole:a.y===(1<<a.z)-1&&d})}_getMesh(e,a){const l=this._getMeshKey(a);if(l in this._tileMeshCache)return this._tileMeshCache[l];const d=(function(m,y){const w=Yu(y,"16bit"),S=u.aL.deserialize({arrayBuffer:w.vertices,length:w.vertices.byteLength/2/2}),P=u.aN.deserialize({arrayBuffer:w.indices,length:w.indices.byteLength/2/3});return new Gs(m.createVertexBuffer(S,ns.members),m.createIndexBuffer(P),u.aM.simpleSegment(0,0,S.length,P.length))})(e,a);return this._tileMeshCache[l]=d,d}recalculate(e){}hasTransition(){const e=Ce.now();let a=!1;return a=a||(e-this._errorMeasurementLastChangeTime)/1e3<.7,a=a||this._errorMeasurement&&this._errorMeasurement.awaitingQuery,a}setErrorQueryLatitudeDegrees(e){this._errorQueryLatitudeDegrees=e}}const $s=new u.r({type:new u.D(u.v.projection.type)});class Po extends u.E{constructor(e){super(),this._transitionable=new u.t($s),this.setProjection(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new u.F(0)),this._mercatorProjection=new ai,this._verticalPerspectiveProjection=new Ao}get transitionState(){const e=this.properties.get("type");if(typeof e=="string"&&e==="mercator")return 0;if(typeof e=="string"&&e==="vertical-perspective")return 1;if(e instanceof u.bm){if(e.from==="vertical-perspective"&&e.to==="mercator")return 1-e.transition;if(e.from==="mercator"&&e.to==="vertical-perspective")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,a,l,d,m){return this.currentProjection.getMeshFromTileID(e,a,l,d,m)}setProjection(e){this._transitionable.setValue("type",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 tc(f){const e=dl(f.worldSize,f.center.lat);return 2*Math.PI*e}function Ba(f,e,a,l,d){const m=1/(1<<d),y=e/u.$*m+l*m,w=u.bo((f/u.$*m+a*m)*Math.PI*2+Math.PI,2*Math.PI),S=2*Math.atan(Math.exp(Math.PI-y*Math.PI*2))-.5*Math.PI,P=Math.cos(S),k=new Float64Array(3);return k[0]=Math.sin(w)*P,k[1]=Math.sin(S),k[2]=Math.cos(w)*P,k}function Wr(f){return(function(e,a){const l=Math.cos(a),d=new Float64Array(3);return d[0]=Math.sin(e)*l,d[1]=Math.sin(a),d[2]=Math.cos(e)*l,d})(f.lng*Math.PI/180,f.lat*Math.PI/180)}function dl(f,e){return f/(2*Math.PI)/Math.cos(e*Math.PI/180)}function zo(f){const e=Math.asin(f[1])/Math.PI*180,a=Math.sqrt(f[0]*f[0]+f[2]*f[2]);if(a>1e-6){const l=f[0]/a,d=Math.acos(f[2]/a),m=(l>0?d:-d)/Math.PI*180;return new u.S(u.aO(m,-180,180),e)}return new u.S(0,e)}function ko(f){return Math.cos(f*Math.PI/180)}function vr(f,e){const a=ko(f),l=ko(e);return u.ak(l/a)}function Kh(f,e){const a=f.rotate(e.bearingInRadians),l=e.zoom+vr(e.center.lat,0),d=u.bk(1/ko(e.center.lat),1/ko(Math.min(Math.abs(e.center.lat),60)),u.bn(l,7,3,0,1)),m=360/tc({worldSize:e.worldSize,center:{lat:e.center.lat}});return new u.S(e.center.lng-a.x*m*d,u.ah(e.center.lat+a.y*m,-u.ai,u.ai))}function ic(f){const e=.5*f,a=Math.sin(e),l=Math.cos(e);return Math.log(a+l)-Math.log(l-a)}function Ku(f,e,a,l){const d=f.lat+a*l;if(Math.abs(a)>1){const m=(Math.sign(f.lat+a)!==Math.sign(f.lat)?-Math.abs(f.lat):Math.abs(f.lat))*Math.PI/180,y=Math.abs(f.lat+a)*Math.PI/180,w=ic(m+l*(y-m)),S=ic(m),P=ic(y);return new u.S(f.lng+e*((w-S)/(P-S)),d)}return new u.S(f.lng+e*l,d)}class Wh{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,a,l,d){const m=`${e.z}_${e.x}_${e.y}_${d?.terrain?"t":""}`,y=this._cache.get(m);if(y)return y;const w=this._cachePrevious.get(m);if(w)return this._cache.set(m,w),w;const S=this._boundingVolumeFactory(e,a,l,d);return this._cache.set(m,S),this._hadAnyChanges=!0,S}}class fl{constructor(e,a,l,d){this.min=l,this.max=d,this.points=e,this.planes=a}static fromAabb(e,a){const l=[];for(let d=0;d<8;d++)l.push([1&~d?e[0]:a[0],(d>>1&1)==1?a[1]:e[1],(d>>2&1)==1?a[2]:e[2]]);return new fl(l,[[-1,0,0,a[0]],[1,0,0,-e[0]],[0,-1,0,a[1]],[0,1,0,-e[1]],[0,0,-1,a[2]],[0,0,1,-e[2]]],e,a)}static fromCenterSizeAngles(e,a,l){const d=u.br([],l[0],l[1],l[2]),m=u.bs([],[a[0],0,0],d),y=u.bs([],[0,a[1],0],d),w=u.bs([],[0,0,a[2]],d),S=[...e],P=[...e];for(let B=0;B<8;B++)for(let L=0;L<3;L++){const j=e[L]+m[L]*(1&~B?-1:1)+y[L]*((B>>1&1)==1?1:-1)+w[L]*((B>>2&1)==1?1:-1);S[L]=Math.min(S[L],j),P[L]=Math.max(P[L],j)}const k=[];for(let B=0;B<8;B++){const L=[...e];u.aS(L,L,u.aR([],m,1&~B?-1:1)),u.aS(L,L,u.aR([],y,(B>>1&1)==1?1:-1)),u.aS(L,L,u.aR([],w,(B>>2&1)==1?1:-1)),k.push(L)}return new fl(k,[[...m,-u.aX(m,k[0])],[...y,-u.aX(y,k[0])],[...w,-u.aX(w,k[0])],[-m[0],-m[1],-m[2],-u.aX(m,k[7])],[-y[0],-y[1],-y[2],-u.aX(y,k[7])],[-w[0],-w[1],-w[2],-u.aX(w,k[7])]],S,P)}intersectsFrustum(e){let a=!0;const l=this.points.length,d=this.planes.length,m=e.planes.length,y=e.points.length;for(let w=0;w<m;w++){const S=e.planes[w];let P=0;for(let k=0;k<l;k++){const B=this.points[k];S[0]*B[0]+S[1]*B[1]+S[2]*B[2]+S[3]>=0&&P++}if(P===0)return 0;P<l&&(a=!1)}if(a)return 2;for(let w=0;w<d;w++){const S=this.planes[w];let P=0;for(let k=0;k<y;k++){const B=e.points[k];S[0]*B[0]+S[1]*B[1]+S[2]*B[2]+S[3]>=0&&P++}if(P===0)return 0}return 1}intersectsPlane(e){const a=this.points.length;let l=0;for(let d=0;d<a;d++){const m=this.points[d];e[0]*m[0]+e[1]*m[1]+e[2]*m[2]+e[3]>=0&&l++}return l===a?2:l===0?0:1}}function on(f,e,a){const l=f-e;return l<0?-l:Math.max(0,l-a)}function rc(f,e,a,l,d){const m=f-a;let y;return y=m<0?Math.min(-m,1+m-d):m>1?Math.min(Math.max(m-d,0),1-m):0,Math.max(y,on(e,l,d))}class os{constructor(){this._boundingVolumeCache=new Wh(this._computeTileBoundingVolume)}prepareNextFrame(){this._boundingVolumeCache.swapBuffers()}distanceToTile2d(e,a,l,d){const m=1<<l.z,y=1/m,w=l.x/m,S=l.y/m;let P=2;return P=Math.min(P,rc(e,a,w,S,y)),P=Math.min(P,rc(e,a,w+.5,-S-y,y)),P=Math.min(P,rc(e,a,w+.5,2-S-y,y)),P}getWrap(e,a,l){const d=1<<a.z,m=1/d,y=a.x/d,w=on(e.x,y,m),S=on(e.x,y-1,m),P=on(e.x,y+1,m),k=Math.min(w,S,P);return k===P?1:k===S?-1:0}allowVariableZoom(e,a){return Ct(e,a)>4}allowWorldCopies(){return!1}getTileBoundingVolume(e,a,l,d){return this._boundingVolumeCache.getTileBoundingVolume(e,a,l,d)}_computeTileBoundingVolume(e,a,l,d){var m,y;let w=0,S=0;if(d?.terrain){const P=new u.Z(e.z,a,e.z,e.x,e.y),k=d.terrain.getMinMaxElevation(P);w=(m=k.minElevation)!==null&&m!==void 0?m:Math.min(0,l),S=(y=k.maxElevation)!==null&&y!==void 0?y:Math.max(0,l)}if(w/=u.bu,S/=u.bu,w+=1,S+=1,e.z<=0)return fl.fromAabb([-S,-S,-S],[S,S,S]);if(e.z===1)return fl.fromAabb([e.x===0?-S:0,e.y===0?0:-S,-S],[e.x===0?0:S,e.y===0?S:0,S]);{const P=[Ba(0,0,e.x,e.y,e.z),Ba(u.$,0,e.x,e.y,e.z),Ba(u.$,u.$,e.x,e.y,e.z),Ba(0,u.$,e.x,e.y,e.z)],k=[];for(const ke of P)k.push(u.aR([],ke,S));if(S!==w)for(const ke of P)k.push(u.aR([],ke,w));e.y===0&&k.push([0,1,0]),e.y===(1<<e.z)-1&&k.push([0,-1,0]);const B=[1,1,1],L=[-1,-1,-1];for(const ke of k)for(let Le=0;Le<3;Le++)B[Le]=Math.min(B[Le],ke[Le]),L[Le]=Math.max(L[Le],ke[Le]);const j=Ba(u.$/2,u.$/2,e.x,e.y,e.z),G=u.aW([],[0,1,0],j);u.aV(G,G);const ee=u.aW([],j,G);u.aV(ee,ee);const J=u.aW([],P[2],P[1]);u.aV(J,J);const te=u.aW([],P[0],P[3]);u.aV(te,te),k.push(u.aR([],j,S)),e.y>=(1<<e.z)/2&&k.push(u.aR([],Ba(u.$/2,0,e.x,e.y,e.z),S)),e.y<(1<<e.z)/2&&k.push(u.aR([],Ba(u.$/2,u.$,e.x,e.y,e.z),S));const ae=Io(j,k),ue=Io(ee,k),oe=[-j[0],-j[1],-j[2],ae.max],de=[j[0],j[1],j[2],-ae.min],ge=[-ee[0],-ee[1],-ee[2],ue.max],le=[ee[0],ee[1],ee[2],-ue.min],Se=[...J,0],Oe=[...te,0],ze=[];return e.y===0?ze.push(u.bt(Oe,Se,oe),u.bt(Oe,Se,de)):ze.push(u.bt(ge,Se,oe),u.bt(ge,Se,de),u.bt(ge,Oe,oe),u.bt(ge,Oe,de)),e.y===(1<<e.z)-1?ze.push(u.bt(Oe,Se,oe),u.bt(Oe,Se,de)):ze.push(u.bt(le,Se,oe),u.bt(le,Se,de),u.bt(le,Oe,oe),u.bt(le,Oe,de)),new fl(ze,[oe,de,ge,le,Se,Oe],B,L)}}}function Io(f,e){let a=1/0,l=-1/0;for(const d of e){const m=u.aX(f,d);a=Math.min(a,m),l=Math.max(l,m)}return{min:a,max:l}}
vendor: 4,440 bytes, line 907
907class nc{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,a,l){return this._helper.interpolatePadding(e,a,l)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,a){this._helper.resize(e,a)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}overrideNearFarZ(e,a){this._helper.overrideNearFarZ(e,a)}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 nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(e){}constructor(){this._cachedClippingPlane=u.bv(),this._projectionMatrix=u.b9(),this._globeViewProjMatrix32f=u.b8(),this._globeViewProjMatrixNoCorrection=u.b9(),this._globeViewProjMatrixNoCorrectionInverted=u.b9(),this._globeProjMatrixInverted=u.b9(),this._cameraPosition=u.bp(),this._globeLatitudeErrorCorrectionRadians=0,this._helper=new Nr({calcMatrices:()=>{this._calcMatrices()},getConstrained:(e,a)=>this.getConstrained(e,a)}),this._coveringTilesDetailsProvider=new os}clone(){const e=new nc;return e.apply(this),e}apply(e,a){this._globeLatitudeErrorCorrectionRadians=a||0,this._helper.apply(e)}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._globeViewProjMatrixNoCorrection}get inverseProjectionMatrix(){return this._globeProjMatrixInverted}get cameraPosition(){const e=u.bp();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:a,applyGlobeMatrix:l}=e,d=this._helper.getMercatorTileCoordinates(a);return{mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:d,clippingPlane:this._cachedClippingPlane,projectionTransition:l?1:0,fallbackMatrix:this._globeViewProjMatrix32f}}_computeClippingPlane(e){const a=this.pitchInRadians,l=this.cameraToCenterDistance/e,d=Math.sin(a)*l,m=Math.cos(a)*l+1,y=1/Math.sqrt(d*d+m*m)*1;let w=-d,S=m;const P=Math.sqrt(w*w+S*S);w/=P,S/=P;
vendor: 67,813 bytes, lines 907-909
907const k=[0,w,S];u.bw(k,k,[0,0,0],-this.bearingInRadians),u.bx(k,k,[0,0,0],-1*this.center.lat*Math.PI/180),u.by(k,k,[0,0,0],this.center.lng*Math.PI/180);const B=1/u.aZ(k);return u.aR(k,k,B),[...k,-y*B]}isLocationOccluded(e){return!this.isSurfacePointVisible(Wr(e))}transformLightDirection(e){const a=this._helper._center.lng*Math.PI/180,l=this._helper._center.lat*Math.PI/180,d=Math.cos(l),m=[Math.sin(a)*d,Math.sin(l),Math.cos(a)*d],y=[m[2],0,-m[0]],w=[0,0,0];u.aW(w,y,m),u.aV(y,y),u.aV(w,w);const S=[0,0,0];return u.aV(S,[y[0]*e[0]+w[0]*e[1]+m[0]*e[2],y[1]*e[0]+w[1]*e[1]+m[1]*e[2],y[2]*e[0]+w[2]*e[1]+m[2]*e[2]]),S}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,a,l){const d=(function(w,S,P){const k=1/(1<<P.z);return new u.a1(w/u.$*k+P.x*k,S/u.$*k+P.y*k)})(e,a,l.canonical),m=(y=d.y,[u.bo(d.x*Math.PI*2+Math.PI,2*Math.PI),2*Math.atan(Math.exp(Math.PI-y*Math.PI*2))-.5*Math.PI]);var y;return this.getCircleRadiusCorrection()/Math.cos(m[1])}projectTileCoordinates(e,a,l,d){const m=l.canonical,y=Ba(e,a,m.x,m.y,m.z),w=1+(d?d(e,a):0)/u.bu,S=[y[0]*w,y[1]*w,y[2]*w,1];u.aw(S,S,this._globeViewProjMatrixNoCorrection);const P=this._cachedClippingPlane,k=P[0]*y[0]+P[1]*y[1]+P[2]*y[2]+P[3]<0;return{point:new u.P(S[0]/S[3],S[1]/S[3]),signedDistanceFromCamera:S[3],isOccluded:k}}_calcMatrices(){if(!this._helper._width||!this._helper._height)return;const e=dl(this.worldSize,this.center.lat),a=u.ba(),l=u.ba();this._helper.autoCalculateNearFarZ&&(this._helper._nearZ=.5,this._helper._farZ=this.cameraToCenterDistance+2*e),u.b4(a,this.fovInRadians,this.width/this.height,this._helper._nearZ,this._helper._farZ);const d=this.centerOffset;a[8]=2*-d.x/this._helper._width,a[9]=2*d.y/this._helper._height,this._projectionMatrix=u.b5(a),this._globeProjMatrixInverted=u.ba(),u.aq(this._globeProjMatrixInverted,a),u.M(a,a,[0,0,-this.cameraToCenterDistance]),u.b6(a,a,this.rollInRadians),u.b7(a,a,-this.pitchInRadians),u.b6(a,a,this.bearingInRadians),u.M(a,a,[0,0,-e]);const m=u.bp();m[0]=e,m[1]=e,m[2]=e,u.b7(l,a,this.center.lat*Math.PI/180),u.bz(l,l,-this.center.lng*Math.PI/180),u.N(l,l,m),this._globeViewProjMatrixNoCorrection=l,u.b7(a,a,this.center.lat*Math.PI/180-this._globeLatitudeErrorCorrectionRadians),u.bz(a,a,-this.center.lng*Math.PI/180),u.N(a,a,m),this._globeViewProjMatrix32f=new Float32Array(a),this._globeViewProjMatrixNoCorrectionInverted=u.ba(),u.aq(this._globeViewProjMatrixNoCorrectionInverted,l);const y=u.bp();this._cameraPosition=u.bp(),this._cameraPosition[2]=this.cameraToCenterDistance/e,u.bw(this._cameraPosition,this._cameraPosition,y,-this.rollInRadians),u.bx(this._cameraPosition,this._cameraPosition,y,this.pitchInRadians),u.bw(this._cameraPosition,this._cameraPosition,y,-this.bearingInRadians),u.aS(this._cameraPosition,this._cameraPosition,[0,0,1]),u.bx(this._cameraPosition,this._cameraPosition,y,-this.center.lat*Math.PI/180),u.by(this._cameraPosition,this._cameraPosition,y,this.center.lng*Math.PI/180),this._cachedClippingPlane=this._computeClippingPlane(e);const w=u.b5(this._globeViewProjMatrixNoCorrectionInverted);u.N(w,w,[1,1,-1]),this._cachedFrustum=Dr.fromInvProjectionMatrix(w,1,0,this._cachedClippingPlane,!0)}calculateFogMatrix(e){u.w("calculateFogMatrix is not supported on globe projection.");const a=u.ba();return u.ag(a),a}getVisibleUnwrappedCoordinates(e){return[new u.b2(0,e)]}getCameraFrustum(){return this._cachedFrustum}getClippingPlane(){return this._cachedClippingPlane}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(e){e&&u.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,a){if(!this._globeViewProjMatrixNoCorrection)return 1;const l=Wr(e);u.aR(l,l,1+a/u.bu);const d=u.bv();return u.aw(d,[l[0],l[1],l[2],1],this._globeViewProjMatrixNoCorrection),d[2]/d[3]}populateCache(e){}getBounds(){const e=.5*this.width,a=.5*this.height,l=[new u.P(0,0),new u.P(e,0),new u.P(this.width,0),new u.P(this.width,a),new u.P(this.width,this.height),new u.P(e,this.height),new u.P(0,this.height),new u.P(0,a)],d=[];for(const B of l)d.push(this.unprojectScreenPoint(B));let m=0,y=0,w=0,S=0;const P=this.center;for(const B of d){const L=u.bA(P.lng,B.lng),j=u.bA(P.lat,B.lat);L<y&&(y=L),L>m&&(m=L),j<S&&(S=j),j>w&&(w=j)}const k=[P.lng+y,P.lat+S,P.lng+m,P.lat+w];return this.isSurfacePointOnScreen([0,1,0])&&(k[3]=90,k[0]=-180,k[2]=180),this.isSurfacePointOnScreen([0,-1,0])&&(k[1]=-90,k[0]=-180,k[2]=180),new qi(k)}getConstrained(e,a){const l=u.ah(e.lat,-u.ai,u.ai),d=u.ah(+a,this.minZoom+vr(0,l),this.maxZoom);return{center:new u.S(e.lng,l),zoom:d}}calculateCenterFromCameraLngLatAlt(e,a,l,d){return this._helper.calculateCenterFromCameraLngLatAlt(e,a,l,d)}setLocationAtPoint(e,a){const l=Wr(this.unprojectScreenPoint(a)),d=Wr(e),m=u.bp();u.bB(m);const y=u.bp();u.by(y,l,m,-this.center.lng*Math.PI/180),u.bx(y,y,m,this.center.lat*Math.PI/180);const w=d[0]*d[0]+d[2]*d[2],S=y[0]*y[0];if(w<S)return;const P=Math.sqrt(w-S),k=-P,B=u.bC(d[0],d[2],y[0],P),L=u.bC(d[0],d[2],y[0],k),j=u.bp();u.by(j,d,m,-B);const G=u.bC(j[1],j[2],y[1],y[2]),ee=u.bp();u.by(ee,d,m,-L);const J=u.bC(ee[1],ee[2],y[1],y[2]),te=.5*Math.PI,ae=G>=-te&&G<=te,ue=J>=-te&&J<=te;let oe,de;if(ae&&ue){const Oe=this.center.lng*Math.PI/180,ze=this.center.lat*Math.PI/180;u.bD(B,Oe)+u.bD(G,ze)<u.bD(L,Oe)+u.bD(J,ze)?(oe=B,de=G):(oe=L,de=J)}else if(ae)oe=B,de=G;else{if(!ue)return;oe=L,de=J}const ge=oe/Math.PI*180,le=de/Math.PI*180,Se=this.center.lat;this.setCenter(new u.S(ge,u.ah(le,-90,90))),this.setZoom(this.zoom+vr(Se,this.center.lat))}locationToScreenPoint(e,a){const l=Wr(e);if(a){const d=a.getElevationForLngLatZoom(e,this._helper._tileZoom);u.aR(l,l,1+d/u.bu)}return this._projectSurfacePointToScreen(l)}_projectSurfacePointToScreen(e){const a=u.bv();return u.aw(a,[...e,1],this._globeViewProjMatrixNoCorrection),a[0]/=a[3],a[1]/=a[3],new u.P((.5*a[0]+.5)*this.width,(.5*-a[1]+.5)*this.height)}screenPointToMercatorCoordinate(e,a){if(a){const l=a.pointCoordinate(e);if(l)return l}return u.a1.fromLngLat(this.unprojectScreenPoint(e))}screenPointToLocation(e,a){var l;return(l=this.screenPointToMercatorCoordinate(e,a))===null||l===void 0?void 0:l.toLngLat()}isPointOnMapSurface(e,a){const l=this._cameraPosition,d=this.getRayDirectionFromPixel(e);return!!this.rayPlanetIntersection(l,d)}getRayDirectionFromPixel(e){const a=u.bv();a[0]=e.x/this.width*2-1,a[1]=-1*(e.y/this.height*2-1),a[2]=1,a[3]=1,u.aw(a,a,this._globeViewProjMatrixNoCorrectionInverted),a[0]/=a[3],a[1]/=a[3],a[2]/=a[3];const l=u.bp();l[0]=a[0]-this._cameraPosition[0],l[1]=a[1]-this._cameraPosition[1],l[2]=a[2]-this._cameraPosition[2];const d=u.bp();return u.aV(d,l),d}isSurfacePointVisible(e){const a=this._cachedClippingPlane;return a[0]*e[0]+a[1]*e[1]+a[2]*e[2]+a[3]>=0}isSurfacePointOnScreen(e){if(!this.isSurfacePointVisible(e))return!1;const a=u.bv();return u.aw(a,[...e,1],this._globeViewProjMatrixNoCorrection),a[0]/=a[3],a[1]/=a[3],a[2]/=a[3],a[0]>-1&&a[0]<1&&a[1]>-1&&a[1]<1&&a[2]>-1&&a[2]<1}rayPlanetIntersection(e,a){const l=u.aX(e,a),d=u.bp(),m=u.bp();u.aR(m,a,l),u.aU(d,e,m);const y=1-u.aX(d,d);if(y<0)return null;const w=u.aX(e,e)-1,S=-l+(l<0?1:-1)*Math.sqrt(y),P=w/S,k=S;return{tMin:Math.min(P,k),tMax:Math.max(P,k)}}unprojectScreenPoint(e){const a=this._cameraPosition,l=this.getRayDirectionFromPixel(e),d=this.rayPlanetIntersection(a,l);if(d){const k=u.bp();u.aS(k,a,[l[0]*d.tMin,l[1]*d.tMin,l[2]*d.tMin]);const B=u.bp();return u.aV(B,k),zo(B)}const m=this._cachedClippingPlane,y=m[0]*l[0]+m[1]*l[1]+m[2]*l[2],w=-u.b1(m,a)/y,S=u.bp();if(w>0)u.aS(S,a,[l[0]*w,l[1]*w,l[2]*w]);else{const k=u.bp();u.aS(k,a,[2*l[0],2*l[1],2*l[2]]);const B=u.b1(this._cachedClippingPlane,k);u.aU(S,k,[this._cachedClippingPlane[0]*B,this._cachedClippingPlane[1]*B,this._cachedClippingPlane[2]*B])}const P=(function(k){const B=u.bp();return B[0]=k[0]*-k[3],B[1]=k[1]*-k[3],B[2]=k[2]*-k[3],{center:B,radius:Math.sqrt(1-k[3]*k[3])}})(m);return zo((function(k,B,L){const j=u.bp();u.aU(j,L,k);const G=u.bp();return u.bq(G,k,j,B/u.a$(j)),G})(P.center,P.radius,S))}getMatrixForModel(e,a){const l=u.S.convert(e),d=1/u.bu,m=u.b9();return u.bz(m,m,l.lng/180*Math.PI),u.b7(m,m,-l.lat/180*Math.PI),u.M(m,m,[0,0,1+a/u.bu]),u.b7(m,m,.5*Math.PI),u.N(m,m,[d,d,d]),m}getProjectionDataForCustomLayer(e=!0){const a=this.getProjectionData({overscaledTileID:new u.Z(0,0,0,0,0),applyGlobeMatrix:e});return a.tileMercatorCoords=[0,0,1,1],a}getFastPathSimpleProjectionMatrix(e){}}class ac{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,a,l){return this._helper.interpolatePadding(e,a,l)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,a,l=!0){this._helper.resize(e,a,l)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}overrideNearFarZ(e,a){this._helper.overrideNearFarZ(e,a)}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 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,a){this._globeness=e,this._globeLatitudeErrorCorrectionRadians=a,this._calcMatrices(),this._verticalPerspectiveTransform.getCoveringTilesDetailsProvider().prepareNextFrame(),this._mercatorTransform.getCoveringTilesDetailsProvider().prepareNextFrame()}get currentTransform(){return this.isGlobeRendering?this._verticalPerspectiveTransform:this._mercatorTransform}constructor(){this._globeLatitudeErrorCorrectionRadians=0,this._globeness=1,this._helper=new Nr({calcMatrices:()=>{this._calcMatrices()},getConstrained:(e,a)=>this.getConstrained(e,a)}),this._globeness=1,this._mercatorTransform=new Mi,this._verticalPerspectiveTransform=new nc}clone(){const e=new ac;return e._globeness=this._globeness,e._globeLatitudeErrorCorrectionRadians=this._globeLatitudeErrorCorrectionRadians,e.apply(this),e}apply(e){this._helper.apply(e),this._mercatorTransform.apply(this),this._verticalPerspectiveTransform.apply(this,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 a=this._mercatorTransform.getProjectionData(e),l=this._verticalPerspectiveTransform.getProjectionData(e);return{mainMatrix:this.isGlobeRendering?l.mainMatrix:a.mainMatrix,clippingPlane:l.clippingPlane,tileMercatorCoords:l.tileMercatorCoords,projectionTransition:e.applyGlobeMatrix?this._globeness:0,fallbackMatrix:a.fallbackMatrix}}isLocationOccluded(e){return this.currentTransform.isLocationOccluded(e)}transformLightDirection(e){return this.currentTransform.transformLightDirection(e)}getPixelScale(){return u.bk(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return u.bk(this._mercatorTransform.getCircleRadiusCorrection(),this._verticalPerspectiveTransform.getCircleRadiusCorrection(),this._globeness)}getPitchedTextCorrection(e,a,l){const d=this._mercatorTransform.getPitchedTextCorrection(e,a,l),m=this._verticalPerspectiveTransform.getPitchedTextCorrection(e,a,l);return u.bk(d,m,this._globeness)}projectTileCoordinates(e,a,l,d){return this.currentTransform.projectTileCoordinates(e,a,l,d)}_calcMatrices(){this._helper._width&&this._helper._height&&(this._verticalPerspectiveTransform.apply(this,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,a){return this.currentTransform.lngLatToCameraDepth(e,a)}populateCache(e){this._mercatorTransform.populateCache(e),this._verticalPerspectiveTransform.populateCache(e)}getBounds(){return this.currentTransform.getBounds()}getConstrained(e,a){return this.currentTransform.getConstrained(e,a)}calculateCenterFromCameraLngLatAlt(e,a,l,d){return this._helper.calculateCenterFromCameraLngLatAlt(e,a,l,d)}setLocationAtPoint(e,a){if(!this.isGlobeRendering)return this._mercatorTransform.setLocationAtPoint(e,a),void this.apply(this._mercatorTransform);this._verticalPerspectiveTransform.setLocationAtPoint(e,a),this.apply(this._verticalPerspectiveTransform)}locationToScreenPoint(e,a){return this.currentTransform.locationToScreenPoint(e,a)}screenPointToMercatorCoordinate(e,a){return this.currentTransform.screenPointToMercatorCoordinate(e,a)}screenPointToLocation(e,a){return this.currentTransform.screenPointToLocation(e,a)}isPointOnMapSurface(e,a){return this.currentTransform.isPointOnMapSurface(e,a)}getRayDirectionFromPixel(e){return this._verticalPerspectiveTransform.getRayDirectionFromPixel(e)}getMatrixForModel(e,a){return this.currentTransform.getMatrixForModel(e,a)}getProjectionDataForCustomLayer(e=!0){const a=this._mercatorTransform.getProjectionDataForCustomLayer(e);if(!this.isGlobeRendering)return a;const l=this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(e);return l.fallbackMatrix=a.mainMatrix,l}getFastPathSimpleProjectionMatrix(e){return this.currentTransform.getFastPathSimpleProjectionMatrix(e)}}class _n{get useGlobeControls(){return!0}handlePanInertia(e,a){const l=Kh(e,a);return Math.abs(l.lng-a.center.lng)>180&&(l.lng=a.center.lng+179.5*Math.sign(l.lng-a.center.lng)),{easingCenter:l,easingOffset:new u.P(0,0)}}handleMapControlsRollPitchBearingZoom(e,a){const l=e.around,d=a.screenPointToLocation(l);e.bearingDelta&&a.setBearing(a.bearing+e.bearingDelta),e.pitchDelta&&a.setPitch(a.pitch+e.pitchDelta),e.rollDelta&&a.setRoll(a.roll+e.rollDelta);const m=a.zoom;e.zoomDelta&&a.setZoom(a.zoom+e.zoomDelta);const y=a.zoom-m;if(y===0)return;const w=u.bA(a.center.lng,d.lng),S=w/(Math.abs(w/180)+1),P=u.bA(a.center.lat,d.lat),k=a.getRayDirectionFromPixel(l),B=a.cameraPosition,L=-1*u.aX(B,k),j=u.bp();u.aS(j,B,[k[0]*L,k[1]*L,k[2]*L]);const G=u.aZ(j)-1,ee=Math.exp(.5*-Math.max(G-.3,0)),J=dl(a.worldSize,a.center.lat)/Math.min(a.width,a.height),te=u.bn(J,.9,.5,1,.25),ae=(1-u.af(-y))*Math.min(ee,te),ue=a.center.lat,oe=a.zoom,de=new u.S(a.center.lng+S*ae,u.ah(a.center.lat+P*ae,-u.ai,u.ai));a.setLocationAtPoint(d,l);const ge=a.center,le=u.bn(Math.abs(w),45,85,0,1),Se=u.bn(J,.75,.35,0,1),Oe=Math.pow(Math.max(le,Se),.25),ze=u.bA(ge.lng,de.lng),ke=u.bA(ge.lat,de.lat);a.setCenter(new u.S(ge.lng+ze*Oe,ge.lat+ke*Oe).wrap()),a.setZoom(oe+vr(ue,a.center.lat))}handleMapControlsPan(e,a,l){if(!e.panDelta)return;const d=a.center.lat,m=a.zoom;a.setCenter(Kh(e.panDelta,a).wrap()),a.setZoom(m+vr(d,a.center.lat))}cameraForBoxAndBearing(e,a,l,d,m){const y=sn(e,a,l,d,m),w=a.left/m.width*2-1,S=(m.width-a.right)/m.width*2-1,P=a.top/m.height*-2+1,k=(m.height-a.bottom)/m.height*-2+1,B=u.bA(l.getWest(),l.getEast())<0,L=B?l.getEast():l.getWest(),j=B?l.getWest():l.getEast(),G=Math.max(l.getNorth(),l.getSouth()),ee=Math.min(l.getNorth(),l.getSouth()),J=L+.5*u.bA(L,j),te=G+.5*u.bA(G,ee),ae=m.clone();ae.setCenter(y.center),ae.setBearing(y.bearing),ae.setPitch(0),ae.setRoll(0),ae.setZoom(y.zoom);const ue=ae.modelViewProjectionMatrix,oe=[Wr(l.getNorthWest()),Wr(l.getNorthEast()),Wr(l.getSouthWest()),Wr(l.getSouthEast()),Wr(new u.S(j,te)),Wr(new u.S(L,te)),Wr(new u.S(J,G)),Wr(new u.S(J,ee))],de=Wr(y.center);let ge=Number.POSITIVE_INFINITY;for(const le of oe)w<0&&(ge=_n.getLesserNonNegativeNonNull(ge,_n.solveVectorScale(le,de,ue,"x",w))),S>0&&(ge=_n.getLesserNonNegativeNonNull(ge,_n.solveVectorScale(le,de,ue,"x",S))),P>0&&(ge=_n.getLesserNonNegativeNonNull(ge,_n.solveVectorScale(le,de,ue,"y",P))),k<0&&(ge=_n.getLesserNonNegativeNonNull(ge,_n.solveVectorScale(le,de,ue,"y",k)));if(Number.isFinite(ge)&&ge!==0)return y.zoom=ae.zoom+u.ak(ge),y;as()}handleJumpToCenterZoom(e,a){const l=e.center.lat,d=e.getConstrained(a.center?u.S.convert(a.center):e.center,e.zoom).center;e.setCenter(d.wrap());const m=a.zoom!==void 0?+a.zoom:e.zoom+vr(l,d.lat);e.zoom!==m&&e.setZoom(m)}handleEaseTo(e,a){const l=e.zoom,d=e.center,m=e.padding,y={roll:e.roll,pitch:e.pitch,bearing:e.bearing},w={roll:a.roll===void 0?e.roll:a.roll,pitch:a.pitch===void 0?e.pitch:a.pitch,bearing:a.bearing===void 0?e.bearing:a.bearing},S=a.zoom!==void 0,P=!e.isPaddingEqual(a.padding);let k=!1;const B=a.center?u.S.convert(a.center):d,L=e.getConstrained(B,l).center;hl(e,L);const j=e.clone();j.setCenter(L),j.setZoom(S?+a.zoom:l+vr(d.lat,B.lat)),j.setBearing(a.bearing);const G=new u.P(u.ah(e.centerPoint.x+a.offsetAsPoint.x,0,e.width),u.ah(e.centerPoint.y+a.offsetAsPoint.y,0,e.height));j.setLocationAtPoint(L,G);const ee=(a.offset&&a.offsetAsPoint.mag())>0?j.center:L,J=S?+a.zoom:l+vr(d.lat,ee.lat),te=l+vr(d.lat,0),ae=J+vr(ee.lat,0),ue=u.bA(d.lng,ee.lng),oe=u.bA(d.lat,ee.lat),de=u.af(ae-te);return k=J!==l,{easeFunc:ge=>{if(u.be(y,w)||an({startEulerAngles:y,endEulerAngles:w,tr:e,k:ge,useSlerp:y.roll!=w.roll}),P&&e.interpolatePadding(m,a.padding,ge),a.around)u.w("Easing around a point is not supported under globe projection."),e.setLocationAtPoint(a.around,a.aroundPoint);else{const le=ae>te?Math.min(2,de):Math.max(.5,de),Se=Math.pow(le,1-ge),Oe=Ku(d,ue,oe,ge*Se);e.setCenter(Oe.wrap())}if(k){const le=u.C.number(te,ae,ge)+vr(0,e.center.lat);e.setZoom(le)}},isZooming:k,elevationCenter:ee}}handleFlyTo(e,a){const l=a.zoom!==void 0,d=e.center,m=e.zoom,y=e.padding,w=!e.isPaddingEqual(a.padding),S=e.getConstrained(u.S.convert(a.center||a.locationAtOffset),m).center,P=l?+a.zoom:e.zoom+vr(e.center.lat,S.lat),k=e.clone();k.setCenter(S),k.setZoom(P),k.setBearing(a.bearing);const B=new u.P(u.ah(e.centerPoint.x+a.offsetAsPoint.x,0,e.width),u.ah(e.centerPoint.y+a.offsetAsPoint.y,0,e.height));k.setLocationAtPoint(S,B);const L=k.center;hl(e,L);const j=(function(oe,de,ge){const le=Wr(de),Se=Wr(ge),Oe=u.aX(le,Se),ze=Math.acos(Oe),ke=tc(oe);return ze/(2*Math.PI)*ke})(e,d,L),G=m+vr(d.lat,0),ee=P+vr(L.lat,0),J=u.af(ee-G);let te;if(typeof a.minZoom=="number"){const oe=+a.minZoom+vr(L.lat,0),de=Math.min(oe,G,ee)+vr(0,L.lat),ge=e.getConstrained(L,de).zoom+vr(L.lat,0);te=u.af(ge-G)}const ae=u.bA(d.lng,L.lng),ue=u.bA(d.lat,L.lat);return{easeFunc:(oe,de,ge,le)=>{const Se=Ku(d,ae,ue,ge);w&&e.interpolatePadding(y,a.padding,oe);const Oe=oe===1?L:Se;e.setCenter(Oe.wrap());const ze=G+u.ak(de);e.setZoom(oe===1?P:ze+vr(0,Oe.lat))},scaleOfZoom:J,targetCenter:L,scaleOfMinZoom:te,pixelPathLength:j}}static solveVectorScale(e,a,l,d,m){const y=d==="x"?[l[0],l[4],l[8],l[12]]:[l[1],l[5],l[9],l[13]],w=[l[3],l[7],l[11],l[15]],S=e[0]*y[0]+e[1]*y[1]+e[2]*y[2],P=e[0]*w[0]+e[1]*w[1]+e[2]*w[2],k=a[0]*y[0]+a[1]*y[1]+a[2]*y[2],B=a[0]*w[0]+a[1]*w[1]+a[2]*w[2];return k+m*P===S+m*B||w[3]*(S-k)+y[3]*(B-P)+S*B==k*P?null:(k+y[3]-m*B-m*w[3])/(k-S-m*B+m*P)}static getLesserNonNegativeNonNull(e,a){return a!==null&&a>=0&&a<e?a:e}}class Wu{constructor(e){this._globe=e,this._mercatorCameraHelper=new gr,this._verticalPerspectiveCameraHelper=new _n}get useGlobeControls(){return this._globe.useGlobeRendering}get currentHelper(){return this.useGlobeControls?this._verticalPerspectiveCameraHelper:this._mercatorCameraHelper}handlePanInertia(e,a){return this.currentHelper.handlePanInertia(e,a)}handleMapControlsRollPitchBearingZoom(e,a){return this.currentHelper.handleMapControlsRollPitchBearingZoom(e,a)}handleMapControlsPan(e,a,l){this.currentHelper.handleMapControlsPan(e,a,l)}cameraForBoxAndBearing(e,a,l,d,m){return this.currentHelper.cameraForBoxAndBearing(e,a,l,d,m)}handleJumpToCenterZoom(e,a){this.currentHelper.handleJumpToCenterZoom(e,a)}handleEaseTo(e,a){return this.currentHelper.handleEaseTo(e,a)}handleFlyTo(e,a){return this.currentHelper.handleFlyTo(e,a)}}const eu=(f,e)=>u.y(f,e&&e.filter((a=>a.identifier!=="source.canvas"))),Yd=u.bE();class Qu extends u.E{constructor(e,a={}){var l,d;super(),this._rtlPluginLoaded=()=>{for(const y in this.sourceCaches){const w=this.sourceCaches[y].getSource().type;w!=="vector"&&w!=="geojson"||this.sourceCaches[y].reload()}},this.map=e,this.dispatcher=new zt(Ft(),e._getMapId()),this.dispatcher.registerMessageHandler("GG",((y,w)=>this.getGlyphs(y,w))),this.dispatcher.registerMessageHandler("GI",((y,w)=>this.getImages(y,w))),this.imageManager=new Gt,this.imageManager.setEventedParent(this);const m=((l=e._container)===null||l===void 0?void 0:l.lang)||typeof document<"u"&&((d=document.documentElement)===null||d===void 0?void 0:d.lang)||void 0;this.glyphManager=new fr(e._requestManager,a.localIdeographFontFamily,m),this.lineAtlas=new bt(256,512),this.crossTileSymbolIndex=new Co,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new u.bF,this._loaded=!1,this._availableImages=[],this._globalState={},this._resetUpdates(),this.dispatcher.broadcast("SR",u.bG()),sr().on(gs,this._rtlPluginLoaded),this.on("data",(y=>{if(y.dataType!=="source"||y.sourceDataType!=="metadata")return;const w=this.sourceCaches[y.sourceId];if(!w)return;const S=w.getSource();if(S&&S.vectorLayerIds)for(const P in this._layers){const k=this._layers[P];k.source===S.id&&this._validateLayer(k)}}))}setGlobalStateProperty(e,a){var l,d,m;this._checkLoaded();const y=a===null?(m=(d=(l=this.stylesheet.state)===null||l===void 0?void 0:l[e])===null||d===void 0?void 0:d.default)!==null&&m!==void 0?m:null:a;if(u.bH(y,this._globalState[e]))return this;this._globalState[e]=y,this._applyGlobalStateChanges([e])}getGlobalState(){return this._globalState}setGlobalState(e){this._checkLoaded();const a=[];for(const l in e)!u.bH(this._globalState[l],e[l].default)&&(a.push(l),this._globalState[l]=e[l].default);this._applyGlobalStateChanges(a)}_applyGlobalStateChanges(e){if(e.length===0)return;const a=new Set;for(const l in this._layers){const d=this._layers[l],m=d.getLayoutAffectingGlobalStateRefs(),y=d.getPaintAffectingGlobalStateRefs();for(const w of e)if(m.has(w)&&a.add(d.source),y.has(w))for(const{name:S,value:P}of y.get(w))this._updatePaintProperty(d,S,P)}for(const l in this.sourceCaches)a.has(l)&&(this._reloadSource(l),this._changed=!0)}loadURL(e,a={},l){this.fire(new u.l("dataloading",{dataType:"style"})),a.validate=typeof a.validate!="boolean"||a.validate;const d=this.map._requestManager.transformRequest(e,"Style");this._loadStyleRequest=new AbortController;const m=this._loadStyleRequest;u.j(d,this._loadStyleRequest).then((y=>{this._loadStyleRequest=null,this._load(y.data,a,l)})).catch((y=>{this._loadStyleRequest=null,y&&!m.signal.aborted&&this.fire(new u.k(y))}))}loadJSON(e,a={},l){this.fire(new u.l("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,Ce.frameAsync(this._frameRequest).then((()=>{this._frameRequest=null,a.validate=a.validate!==!1,this._load(e,a,l)})).catch((()=>{}))}loadEmpty(){this.fire(new u.l("dataloading",{dataType:"style"})),this._load(Yd,{validate:!1})}_load(e,a,l){var d,m;let y=a.transformStyle?a.transformStyle(l,e):e;if(!a.validate||!eu(this,u.z(y))){y=Object.assign({},y),this._loaded=!0,this.stylesheet=y;for(const w in y.sources)this.addSource(w,y.sources[w],{validate:!1});y.sprite?this._loadSprite(y.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(y.glyphs),this._createLayers(),this.light=new Ve(this.stylesheet.light),this._setProjectionInternal(((d=this.stylesheet.projection)===null||d===void 0?void 0:d.type)||"mercator"),this.sky=new nt(this.stylesheet.sky),this.map.setTerrain((m=this.stylesheet.terrain)!==null&&m!==void 0?m:null),this.fire(new u.l("data",{dataType:"style"})),this.fire(new u.l("style.load"))}}_createLayers(){var e;const a=u.bI(this.stylesheet.layers);this.dispatcher.broadcast("SL",a),this._order=a.map((l=>l.id)),this._layers={},this.setGlobalState((e=this.stylesheet.state)!==null&&e!==void 0?e:null),this._serializedLayers=null;for(const l of a){const d=u.bJ(l);d.setEventedParent(this,{layer:{id:l.id}}),d.setGlobalState(this._globalState),this._layers[l.id]=d}}_loadSprite(e,a=!1,l=void 0){let d;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,(function(m,y,w,S){return u._(this,void 0,void 0,(function*(){const P=_t(m),k=w>1?"@2x":"",B={},L={};for(const{id:j,url:G}of P){const ee=y.transformRequest(Tt(G,k,".json"),"SpriteJSON");B[j]=u.j(ee,S);const J=y.transformRequest(Tt(G,k,".png"),"SpriteImage");L[j]=ut.getImage(J,S)}return yield Promise.all([...Object.values(B),...Object.values(L)]),(function(j,G){return u._(this,void 0,void 0,(function*(){const ee={};for(const J in j){ee[J]={};const te=Ce.getImageCanvasContext((yield G[J]).data),ae=(yield j[J]).data;for(const ue in ae){const{width:oe,height:de,x:ge,y:le,sdf:Se,pixelRatio:Oe,stretchX:ze,stretchY:ke,content:Le,textFitWidth:ot,textFitHeight:ct}=ae[ue];ee[J][ue]={data:null,pixelRatio:Oe,sdf:Se,stretchX:ze,stretchY:ke,content:Le,textFitWidth:ot,textFitHeight:ct,spriteData:{width:oe,height:de,x:ge,y:le,context:te}}}}return ee}))})(B,L)}))})(e,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then((m=>{if(this._spriteRequest=null,m)for(const y in m){this._spritesImagesIds[y]=[];const w=this._spritesImagesIds[y]?this._spritesImagesIds[y].filter((S=>!(S in m))):[];for(const S of w)this.imageManager.removeImage(S),this._changedImages[S]=!0;for(const S in m[y]){const P=y==="default"?S:`${y}:${S}`;this._spritesImagesIds[y].push(P),P in this.imageManager.images?this.imageManager.updateImage(P,m[y][S],!1):this.imageManager.addImage(P,m[y][S]),a&&(this._changedImages[P]=!0)}}})).catch((m=>{this._spriteRequest=null,d=m,this.fire(new u.k(d))})).finally((()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),a&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new u.l("data",{dataType:"style"})),l&&l(d)}))}_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 u.l("data",{dataType:"style"}))}_validateLayer(e){const a=this.sourceCaches[e.source];if(!a)return;const l=e.sourceLayer;if(!l)return;const d=a.getSource();(d.type==="geojson"||d.vectorLayerIds&&d.vectorLayerIds.indexOf(l)===-1)&&this.fire(new u.k(new Error(`Source layer "${l}" does not exist on source "${d.id}" as specified by style layer "${e.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const e in this.sourceCaches)if(!this.sourceCaches[e].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(e,a=!1){const l=this._serializedAllLayers();if(!e||e.length===0)return Object.values(a?u.bK(l):l);const d=[];for(const m of e)if(l[m]){const y=a?u.bK(l[m]):l[m];d.push(y)}return d}_serializedAllLayers(){let e=this._serializedLayers;if(e)return e;e=this._serializedLayers={};const a=Object.keys(this._layers);for(const l of a){const d=this._layers[l];d.type!=="custom"&&(e[l]=d.serialize())}return e}hasTransitions(){var e,a,l;if(!((e=this.light)===null||e===void 0)&&e.hasTransition()||!((a=this.sky)===null||a===void 0)&&a.hasTransition()||!((l=this.projection)===null||l===void 0)&&l.hasTransition())return!0;for(const d in this.sourceCaches)if(this.sourceCaches[d].hasTransition())return!0;for(const d in this._layers)if(this._layers[d].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(e){if(!this._loaded)return;const a=this._changed;if(a){const d=Object.keys(this._updatedLayers),m=Object.keys(this._removedLayers);(d.length||m.length)&&this._updateWorkerLayers(d,m);for(const y in this._updatedSources){const w=this._updatedSources[y];if(w==="reload")this._reloadSource(y);else{if(w!=="clear")throw new Error(`Invalid action ${w}`);this._clearSource(y)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const y in this._updatedPaintProps)this._layers[y].updateTransitions(e);this.light.updateTransitions(e),this.sky.updateTransitions(e),this._resetUpdates()}const l={};for(const d in this.sourceCaches){const m=this.sourceCaches[d];l[d]=m.used,m.used=!1}for(const d of this._order){const m=this._layers[d];m.recalculate(e,this._availableImages),!m.isHidden(e.zoom)&&m.source&&(this.sourceCaches[m.source].used=!0)}for(const d in l){const m=this.sourceCaches[d];!!l[d]!=!!m.used&&m.fire(new u.l("data",{sourceDataType:"visibility",dataType:"source",sourceId:d}))}this.light.recalculate(e),this.sky.recalculate(e),this.projection.recalculate(e),this.z=e.zoom,a&&this.fire(new u.l("data",{dataType:"style"}))}_updateTilesForChangedImages(){const e=Object.keys(this._changedImages);if(e.length){for(const a in this.sourceCaches)this.sourceCaches[a].reloadTilesForDependencies(["icons","patterns"],e);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const e in this.sourceCaches)this.sourceCaches[e].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(e,a){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(e,!1),removedIds:a})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(e,a={}){var l;this._checkLoaded();const d=this.serialize();if(e=a.transformStyle?a.transformStyle(d,e):e,((l=a.validate)===null||l===void 0||l)&&eu(this,u.z(e)))return!1;(e=u.bK(e)).layers=u.bI(e.layers);const m=u.bL(d,e),y=this._getOperationsToPerform(m);if(y.unimplemented.length>0)throw new Error(`Unimplemented: ${y.unimplemented.join(", ")}.`);if(y.operations.length===0)return!1;for(const w of y.operations)w();return this.stylesheet=e,this._serializedLayers=null,!0}_getOperationsToPerform(e){const a=[],l=[];for(const d of e)switch(d.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":case"setRoll":continue;case"addLayer":a.push((()=>this.addLayer.apply(this,d.args)));break;case"removeLayer":a.push((()=>this.removeLayer.apply(this,d.args)));break;case"setPaintProperty":a.push((()=>this.setPaintProperty.apply(this,d.args)));break;case"setLayoutProperty":a.push((()=>this.setLayoutProperty.apply(this,d.args)));break;case"setFilter":a.push((()=>this.setFilter.apply(this,d.args)));break;case"addSource":a.push((()=>this.addSource.apply(this,d.args)));break;case"removeSource":a.push((()=>this.removeSource.apply(this,d.args)));break;case"setLayerZoomRange":a.push((()=>this.setLayerZoomRange.apply(this,d.args)));break;case"setLight":a.push((()=>this.setLight.apply(this,d.args)));break;case"setGeoJSONSourceData":a.push((()=>this.setGeoJSONSourceData.apply(this,d.args)));break;case"setGlyphs":a.push((()=>this.setGlyphs.apply(this,d.args)));break;case"setSprite":a.push((()=>this.setSprite.apply(this,d.args)));break;case"setTerrain":a.push((()=>this.map.setTerrain.apply(this,d.args)));break;case"setSky":a.push((()=>this.setSky.apply(this,d.args)));break;case"setProjection":this.setProjection.apply(this,d.args);break;case"setGlobalState":a.push((()=>this.setGlobalState.apply(this,d.args)));break;case"setTransition":a.push((()=>{}));break;default:l.push(d.command)}return{operations:a,unimplemented:l}}addImage(e,a){if(this.getImage(e))return this.fire(new u.k(new Error(`An image named "${e}" already exists.`)));this.imageManager.addImage(e,a),this._afterImageUpdated(e)}updateImage(e,a){this.imageManager.updateImage(e,a)}getImage(e){return this.imageManager.getImage(e)}removeImage(e){if(!this.getImage(e))return this.fire(new u.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 u.l("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,a,l={}){if(this._checkLoaded(),this.sourceCaches[e]!==void 0)throw new Error(`Source "${e}" already exists.`);if(!a.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(a).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(a.type)>=0&&this._validate(u.z.source,`sources.${e}`,a,null,l))return;this.map&&this.map._collectResourceTiming&&(a.collectResourceTiming=!0);const d=this.sourceCaches[e]=new oi(e,a,this.dispatcher);d.style=this,d.setEventedParent(this,(()=>({isSourceLoaded:d.loaded(),source:d.serialize(),sourceId:e}))),d.onAdd(this.map),this._changed=!0}removeSource(e){if(this._checkLoaded(),this.sourceCaches[e]===void 0)throw new Error("There is no source with this ID");for(const l in this._layers)if(this._layers[l].source===e)return this.fire(new u.k(new Error(`Source "${e}" cannot be removed while layer "${l}" is using it.`)));const a=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],a.fire(new u.l("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),a.setEventedParent(null),a.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(e,a){if(this._checkLoaded(),this.sourceCaches[e]===void 0)throw new Error(`There is no source with this ID=${e}`);const l=this.sourceCaches[e].getSource();if(l.type!=="geojson")throw new Error(`geojsonSource.type is ${l.type}, which is !== 'geojson`);l.setData(a),this._changed=!0}getSource(e){return this.sourceCaches[e]&&this.sourceCaches[e].getSource()}addLayer(e,a,l={}){this._checkLoaded();const d=e.id;if(this.getLayer(d))return void this.fire(new u.k(new Error(`Layer "${d}" already exists on this map.`)));let m;if(e.type==="custom"){if(eu(this,u.bM(e)))return;m=u.bJ(e)}else{if("source"in e&&typeof e.source=="object"&&(this.addSource(d,e.source),e=u.bK(e),e=u.e(e,{source:d})),this._validate(u.z.layer,`layers.${d}`,e,{arrayIndex:-1},l))return;m=u.bJ(e),this._validateLayer(m),m.setEventedParent(this,{layer:{id:d}})}const y=a?this._order.indexOf(a):this._order.length;if(a&&y===-1)this.fire(new u.k(new Error(`Cannot add layer "${d}" before non-existing layer "${a}".`)));else{if(this._order.splice(y,0,d),this._layerOrderChanged=!0,this._layers[d]=m,this._removedLayers[d]&&m.source&&m.type!=="custom"){const w=this._removedLayers[d];delete this._removedLayers[d],w.type!==m.type?this._updatedSources[m.source]="clear":(this._updatedSources[m.source]="reload",this.sourceCaches[m.source].pause())}this._updateLayer(m),m.onAdd&&m.onAdd(this.map)}}moveLayer(e,a){if(this._checkLoaded(),this._changed=!0,!this._layers[e])return void this.fire(new u.k(new Error(`The layer '${e}' does not exist in the map's style and cannot be moved.`)));if(e===a)return;const l=this._order.indexOf(e);this._order.splice(l,1);const d=a?this._order.indexOf(a):this._order.length;a&&d===-1?this.fire(new u.k(new Error(`Cannot move layer "${e}" before non-existing layer "${a}".`))):(this._order.splice(d,0,e),this._layerOrderChanged=!0)}removeLayer(e){this._checkLoaded();const a=this._layers[e];if(!a)return void this.fire(new u.k(new Error(`Cannot remove non-existing layer "${e}".`)));a.setEventedParent(null);const l=this._order.indexOf(e);this._order.splice(l,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=a,delete this._layers[e],this._serializedLayers&&delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],a.onRemove&&a.onRemove(this.map)}getLayer(e){return this._layers[e]}getLayersOrder(){return[...this._order]}hasLayer(e){return e in this._layers}setLayerZoomRange(e,a,l){this._checkLoaded();const d=this.getLayer(e);d?d.minzoom===a&&d.maxzoom===l||(a!=null&&(d.minzoom=a),l!=null&&(d.maxzoom=l),this._updateLayer(d)):this.fire(new u.k(new Error(`Cannot set the zoom range of non-existing layer "${e}".`)))}setFilter(e,a,l={}){this._checkLoaded();const d=this.getLayer(e);if(d){if(!u.bH(d.filter,a))return a==null?(d.setFilter(void 0),void this._updateLayer(d)):void(this._validate(u.z.filter,`layers.${d.id}.filter`,a,null,l)||(d.setFilter(u.bK(a)),this._updateLayer(d)))}else this.fire(new u.k(new Error(`Cannot filter non-existing layer "${e}".`)))}getFilter(e){return u.bK(this.getLayer(e).filter)}setLayoutProperty(e,a,l,d={}){this._checkLoaded();const m=this.getLayer(e);m?u.bH(m.getLayoutProperty(a),l)||(m.setLayoutProperty(a,l,d),this._updateLayer(m)):this.fire(new u.k(new Error(`Cannot style non-existing layer "${e}".`)))}getLayoutProperty(e,a){const l=this.getLayer(e);if(l)return l.getLayoutProperty(a);this.fire(new u.k(new Error(`Cannot get style of non-existing layer "${e}".`)))}setPaintProperty(e,a,l,d={}){this._checkLoaded();const m=this.getLayer(e);m?u.bH(m.getPaintProperty(a),l)||this._updatePaintProperty(m,a,l,d):this.fire(new u.k(new Error(`Cannot style non-existing layer "${e}".`)))}_updatePaintProperty(e,a,l,d={}){e.setPaintProperty(a,l,d)&&this._updateLayer(e),this._changed=!0,this._updatedPaintProps[e.id]=!0,this._serializedLayers=null}getPaintProperty(e,a){return this.getLayer(e).getPaintProperty(a)}setFeatureState(e,a){this._checkLoaded();const l=e.source,d=e.sourceLayer,m=this.sourceCaches[l];if(m===void 0)return void this.fire(new u.k(new Error(`The source '${l}' does not exist in the map's style.`)));const y=m.getSource().type;y==="geojson"&&d?this.fire(new u.k(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):y!=="vector"||d?(e.id===void 0&&this.fire(new u.k(new Error("The feature id parameter must be provided."))),m.setFeatureState(d,e.id,a)):this.fire(new u.k(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(e,a){this._checkLoaded();const l=e.source,d=this.sourceCaches[l];if(d===void 0)return void this.fire(new u.k(new Error(`The source '${l}' does not exist in the map's style.`)));const m=d.getSource().type,y=m==="vector"?e.sourceLayer:void 0;m!=="vector"||y?a&&typeof e.id!="string"&&typeof e.id!="number"?this.fire(new u.k(new Error("A feature id is required to remove its specific state property."))):d.removeFeatureState(y,e.id,a):this.fire(new u.k(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(e){this._checkLoaded();const a=e.source,l=e.sourceLayer,d=this.sourceCaches[a];if(d!==void 0)return d.getSource().type!=="vector"||l?(e.id===void 0&&this.fire(new u.k(new Error("The feature id parameter must be provided."))),d.getFeatureState(l,e.id)):void this.fire(new u.k(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new u.k(new Error(`The source '${a}' does not exist in the map's style.`)))}getTransition(){return u.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const e=u.bN(this.sourceCaches,(m=>m.serialize())),a=this._serializeByIds(this._order,!0),l=this.map.getTerrain()||void 0,d=this.stylesheet;return u.bO({version:d.version,name:d.name,metadata:d.metadata,light:d.light,sky:d.sky,center:d.center,zoom:d.zoom,bearing:d.bearing,pitch:d.pitch,sprite:d.sprite,glyphs:d.glyphs,transition:d.transition,projection:d.projection,sources:e,layers:a,terrain:l},(m=>m!==void 0))}_updateLayer(e){this._updatedLayers[e.id]=!0,e.source&&!this._updatedSources[e.source]&&this.sourceCaches[e.source].getSource().type!=="raster"&&(this._updatedSources[e.source]="reload",this.sourceCaches[e.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(e){const a=y=>this._layers[y].type==="fill-extrusion",l={},d=[];for(let y=this._order.length-1;y>=0;y--){const w=this._order[y];if(a(w)){l[w]=y;for(const S of e){const P=S[w];if(P)for(const k of P)d.push(k)}}}d.sort(((y,w)=>w.intersectionZ-y.intersectionZ));const m=[];for(let y=this._order.length-1;y>=0;y--){const w=this._order[y];if(a(w))for(let S=d.length-1;S>=0;S--){const P=d[S].feature;if(l[P.layer.id]<y)break;m.push(P),d.pop()}else for(const S of e){const P=S[w];if(P)for(const k of P)m.push(k.feature)}}return m}queryRenderedFeatures(e,a,l){a&&a.filter&&this._validate(u.z.filter,"queryRenderedFeatures.filter",a.filter,null,a);const d={};if(a&&a.layers){if(!(Array.isArray(a.layers)||a.layers instanceof Set))return this.fire(new u.k(new Error("parameters.layers must be an Array or a Set of strings"))),[];for(const P of a.layers){const k=this._layers[P];if(!k)return this.fire(new u.k(new Error(`The layer '${P}' does not exist in the map's style and cannot be queried for features.`))),[];d[k.source]=!0}}const m=[];a.availableImages=this._availableImages;const y=this._serializedAllLayers(),w=a.layers instanceof Set?a.layers:Array.isArray(a.layers)?new Set(a.layers):null,S=Object.assign(Object.assign({},a),{layers:w});for(const P in this.sourceCaches)a.layers&&!d[P]||m.push(Ji(this.sourceCaches[P],this._layers,y,e,S,l,this.map.terrain?(k,B,L)=>this.map.terrain.getElevation(k,B,L):void 0));return this.placement&&m.push((function(P,k,B,L,j,G,ee){const J={},te=G.queryRenderedSymbols(L),ae=[];for(const ue of Object.keys(te).map(Number))ae.push(ee[ue]);ae.sort(zn);for(const ue of ae){const oe=ue.featureIndex.lookupSymbolFeatures(te[ue.bucketInstanceId],k,ue.bucketIndex,ue.sourceLayerIndex,j.filter,j.layers,j.availableImages,P);for(const de in oe){const ge=J[de]=J[de]||[],le=oe[de];le.sort(((Se,Oe)=>{const ze=ue.featureSortOrder;if(ze){const ke=ze.indexOf(Se.featureIndex);return ze.indexOf(Oe.featureIndex)-ke}return Oe.featureIndex-Se.featureIndex}));for(const Se of le)ge.push(Se)}}return(function(ue,oe,de){for(const ge in ue)for(const le of ue[ge])kn(le,de[oe[ge].source]);return ue})(J,P,B)})(this._layers,y,this.sourceCaches,e,S,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(m)}querySourceFeatures(e,a){a&&a.filter&&this._validate(u.z.filter,"querySourceFeatures.filter",a.filter,null,a);const l=this.sourceCaches[e];return l?(function(d,m){const y=d.getRenderableIds().map((P=>d.getTileByID(P))),w=[],S={};for(let P=0;P<y.length;P++){const k=y[P],B=k.tileID.canonical.key;S[B]||(S[B]=!0,k.querySourceFeatures(w,m))}return w})(l,a):[]}getLight(){return this.light.getLight()}setLight(e,a={}){this._checkLoaded();const l=this.light.getLight();let d=!1;for(const y in e)if(!u.bH(e[y],l[y])){d=!0;break}if(!d)return;const m={now:Ce.now(),transition:u.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,a),this.light.updateTransitions(m)}getProjection(){var e;return(e=this.stylesheet)===null||e===void 0?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(e=this.stylesheet)===null||e===void 0?void 0:e.sky}setSky(e,a={}){this._checkLoaded();const l=this.getSky();let d=!1;if(!e&&!l)return;if(e&&!l)d=!0;else if(!e&&l)d=!0;else for(const y in e)if(!u.bH(e[y],l[y])){d=!0;break}if(!d)return;const m={now:Ce.now(),transition:u.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=e,this.sky.setSky(e,a),this.sky.updateTransitions(m)}_setProjectionInternal(e){const a=(function(l){if(Array.isArray(l)){const d=new Po({type:l});return{projection:d,transform:new ac,cameraHelper:new Wu(d)}}switch(l){case"mercator":return{projection:new ai,transform:new Mi,cameraHelper:new gr};case"globe":{const d=new Po({type:["interpolate",["linear"],["zoom"],11,"vertical-perspective",12,"mercator"]});return{projection:d,transform:new ac,cameraHelper:new Wu(d)}}case"vertical-perspective":return{projection:new Ao,transform:new nc,cameraHelper:new _n};default:return u.w(`Unknown projection name: ${l}. Falling back to mercator projection.`),{projection:new ai,transform:new Mi,cameraHelper:new gr}}})(e);this.projection=a.projection,this.map.migrateProjection(a.transform,a.cameraHelper);for(const l in this.sourceCaches)this.sourceCaches[l].reload()}_validate(e,a,l,d,m={}){return(!m||m.validate!==!1)&&eu(this,e.call(u.z,u.e({key:a,style:this.serialize(),value:l,styleSpec:u.v},d)))}_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),sr().off(gs,this._rtlPluginLoaded);for(const a in this._layers)this._layers[a].setEventedParent(null);for(const a in this.sourceCaches){const l=this.sourceCaches[a];l.setEventedParent(null),l.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),e&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(e)}_clearSource(e){this.sourceCaches[e].clearTiles()}_reloadSource(e){this.sourceCaches[e].resume(),this.sourceCaches[e].reload()}_updateSources(e){for(const a in this.sourceCaches)this.sourceCaches[a].update(e,this.map.terrain)}_generateCollisionBoxes(){for(const e in this.sourceCaches)this._reloadSource(e)}_updatePlacement(e,a,l,d,m=!1){let y=!1,w=!1;const S={};for(const P of this._order){const k=this._layers[P];if(k.type!=="symbol")continue;if(!S[k.source]){const L=this.sourceCaches[k.source];S[k.source]=L.getRenderableIds(!0).map((j=>L.getTileByID(j))).sort(((j,G)=>G.tileID.overscaledZ-j.tileID.overscaledZ||(j.tileID.isLessThan(G.tileID)?-1:1)))}const B=this.crossTileSymbolIndex.addLayer(k,S[k.source],e.center.lng);y=y||B}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((m=m||this._layerOrderChanged||l===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(Ce.now(),e.zoom))&&(this.pauseablePlacement=new Jl(e,this.map.terrain,this._order,m,a,l,d,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(Ce.now()),w=!0),y&&this.pauseablePlacement.placement.setStale()),w||y)for(const P of this._order){const k=this._layers[P];k.type==="symbol"&&this.placement.updateLayerOpacities(k,S[k.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(Ce.now())}_releaseSymbolFadeTiles(){for(const e in this.sourceCaches)this.sourceCaches[e].releaseSymbolFadeTiles()}getImages(e,a){return u._(this,void 0,void 0,(function*(){const l=yield this.imageManager.getImages(a.icons);this._updateTilesForChangedImages();const d=this.sourceCaches[a.source];return d&&d.setDependencies(a.tileID.key,a.type,a.icons),l}))}getGlyphs(e,a){return u._(this,void 0,void 0,(function*(){const l=yield this.glyphManager.getGlyphs(a.stacks),d=this.sourceCaches[a.source];return d&&d.setDependencies(a.tileID.key,a.type,[""]),l}))}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(e,a={}){this._checkLoaded(),e&&this._validate(u.z.glyphs,"glyphs",e,null,a)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=e,this.glyphManager.entries={},this.glyphManager.setURL(e))}addSprite(e,a,l={},d){this._checkLoaded();const m=[{id:e,url:a}],y=[..._t(this.stylesheet.sprite),...m];this._validate(u.z.sprite,"sprite",y,null,l)||(this.stylesheet.sprite=y,this._loadSprite(m,!0,d))}removeSprite(e){this._checkLoaded();const a=_t(this.stylesheet.sprite);if(a.find((l=>l.id===e))){if(this._spritesImagesIds[e])for(const l of this._spritesImagesIds[e])this.imageManager.removeImage(l),this._changedImages[l]=!0;a.splice(a.findIndex((l=>l.id===e)),1),this.stylesheet.sprite=a.length>0?a:void 0,delete this._spritesImagesIds[e],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new u.l("data",{dataType:"style"}))}else this.fire(new u.k(new Error(`Sprite "${e}" doesn't exists on this map.`)))}getSprite(){return _t(this.stylesheet.sprite)}setSprite(e,a={},l){this._checkLoaded(),e&&this._validate(u.z.sprite,"sprite",e,null,a)||(this.stylesheet.sprite=e,e?this._loadSprite(e,!0,l):(this._unloadSprite(),l&&l(null)))}}var Kd=u.aJ([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Wd{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(e,a,l,d,m,y,w,S,P){this.context=e;let k=this.boundPaintVertexBuffers.length!==d.length;for(let B=0;!k&&B<d.length;B++)this.boundPaintVertexBuffers[B]!==d[B]&&(k=!0);!this.vao||this.boundProgram!==a||this.boundLayoutVertexBuffer!==l||k||this.boundIndexBuffer!==m||this.boundVertexOffset!==y||this.boundDynamicVertexBuffer!==w||this.boundDynamicVertexBuffer2!==S||this.boundDynamicVertexBuffer3!==P?this.freshBind(a,l,d,m,y,w,S,P):(e.bindVertexArray.set(this.vao),w&&w.bind(),m&&m.dynamicDraw&&m.bind(),S&&S.bind(),P&&P.bind())}freshBind(e,a,l,d,m,y,w,S){const P=e.numAttributes,k=this.context,B=k.gl;this.vao&&this.destroy(),this.vao=k.createVertexArray(),k.bindVertexArray.set(this.vao),this.boundProgram=e,this.boundLayoutVertexBuffer=a,this.boundPaintVertexBuffers=l,this.boundIndexBuffer=d,this.boundVertexOffset=m,this.boundDynamicVertexBuffer=y,this.boundDynamicVertexBuffer2=w,this.boundDynamicVertexBuffer3=S,a.enableAttributes(B,e);for(const L of l)L.enableAttributes(B,e);y&&y.enableAttributes(B,e),w&&w.enableAttributes(B,e),S&&S.enableAttributes(B,e),a.bind(),a.setVertexAttribPointers(B,e,m);for(const L of l)L.bind(),L.setVertexAttribPointers(B,e,m);y&&(y.bind(),y.setVertexAttribPointers(B,e,m)),d&&d.bind(),w&&(w.bind(),w.setVertexAttribPointers(B,e,m)),S&&(S.bind(),S.setVertexAttribPointers(B,e,m)),k.currentNumAttributes=P}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}const tu=(f,e,a,l,d)=>({u_texture:0,u_ele_delta:f,u_fog_matrix:e,u_fog_color:a?a.properties.get("fog-color"):u.bf.white,u_fog_ground_blend:a?a.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:d?0:a?a.calculateFogBlendOpacity(l):0,u_horizon_color:a?a.properties.get("horizon-color"):u.bf.white,u_horizon_fog_blend:a?a.properties.get("horizon-fog-blend"):1,u_is_globe_mode:d?1:0}),Ju={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 Ro(f){const e=[];for(let a=0;a<f.length;a++){if(f[a]===null)continue;const l=f[a].split(" ");e.push(l.pop())}return e}class eh{constructor(e,a,l,d,m,y,w,S,P=[]){const k=e.gl;this.program=k.createProgram();const B=Ro(a.staticAttributes),L=l?l.getBinderAttributes():[],j=B.concat(L),G=La.prelude.staticUniforms?Ro(La.prelude.staticUniforms):[],ee=w.staticUniforms?Ro(w.staticUniforms):[],J=a.staticUniforms?Ro(a.staticUniforms):[],te=l?l.getBinderUniforms():[],ae=G.concat(ee).concat(J).concat(te),ue=[];for(const ze of ae)ue.indexOf(ze)<0&&ue.push(ze);const oe=l?l.defines():[];gn(k)&&oe.unshift("#version 300 es"),m&&oe.push("#define OVERDRAW_INSPECTOR;"),y&&oe.push("#define TERRAIN3D;"),S&&oe.push(S),P&&oe.push(...P);let de=oe.concat(La.prelude.fragmentSource,w.fragmentSource,a.fragmentSource).join(`
908`),ge=oe.concat(La.prelude.vertexSource,w.vertexSource,a.vertexSource).join(`
909`);gn(k)||(de=(function(ze){return ze.replace(/\bin\s/g,"varying ").replace("out highp vec4 fragColor;","").replace(/fragColor/g,"gl_FragColor").replace(/texture\(/g,"texture2D(")})(de),ge=(function(ze){return ze.replace(/\bin\s/g,"attribute ").replace(/\bout\s/g,"varying ").replace(/texture\(/g,"texture2D(")})(ge));const le=k.createShader(k.FRAGMENT_SHADER);if(k.isContextLost())return void(this.failedToCreate=!0);if(k.shaderSource(le,de),k.compileShader(le),!k.getShaderParameter(le,k.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${k.getShaderInfoLog(le)}`);k.attachShader(this.program,le);const Se=k.createShader(k.VERTEX_SHADER);if(k.isContextLost())return void(this.failedToCreate=!0);if(k.shaderSource(Se,ge),k.compileShader(Se),!k.getShaderParameter(Se,k.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${k.getShaderInfoLog(Se)}`);k.attachShader(this.program,Se),this.attributes={};const Oe={};this.numAttributes=j.length;for(let ze=0;ze<this.numAttributes;ze++)j[ze]&&(k.bindAttribLocation(this.program,ze,j[ze]),this.attributes[j[ze]]=ze);if(k.linkProgram(this.program),!k.getProgramParameter(this.program,k.LINK_STATUS))throw new Error(`Program failed to link: ${k.getProgramInfoLog(this.program)}`);k.deleteShader(Se),k.deleteShader(le);for(let ze=0;ze<ue.length;ze++){const ke=ue[ze];if(ke&&!Oe[ke]){const Le=k.getUniformLocation(this.program,ke);Le&&(Oe[ke]=Le)}}this.fixedUniforms=d(e,Oe),this.terrainUniforms=((ze,ke)=>({u_depth:new u.bP(ze,ke.u_depth),u_terrain:new u.bP(ze,ke.u_terrain),u_terrain_dim:new u.bg(ze,ke.u_terrain_dim),u_terrain_matrix:new u.bR(ze,ke.u_terrain_matrix),u_terrain_unpack:new u.bS(ze,ke.u_terrain_unpack),u_terrain_exaggeration:new u.bg(ze,ke.u_terrain_exaggeration)}))(e,Oe),this.projectionUniforms=((ze,ke)=>({u_projection_matrix:new u.bR(ze,ke.u_projection_matrix),u_projection_tile_mercator_coords:new u.bS(ze,ke.u_projection_tile_mercator_coords),u_projection_clipping_plane:new u.bS(ze,ke.u_projection_clipping_plane),u_projection_transition:new u.bg(ze,ke.u_projection_transition),u_projection_fallback_matrix:new u.bR(ze,ke.u_projection_fallback_matrix)}))(e,Oe),this.binderUniforms=l?l.getUniforms(e,Oe):[]}draw(e,a,l,d,m,y,w,S,P,k,B,L,j,G,ee,J,te,ae,ue){const oe=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.setDepthMode(l),e.setStencilMode(d),e.setColorMode(m),e.setCullFace(y),S){e.activeTexture.set(oe.TEXTURE2),oe.bindTexture(oe.TEXTURE_2D,S.depthTexture),e.activeTexture.set(oe.TEXTURE3),oe.bindTexture(oe.TEXTURE_2D,S.texture);for(const ge in this.terrainUniforms)this.terrainUniforms[ge].set(S[ge])}if(P)for(const ge in P)this.projectionUniforms[Ju[ge]].set(P[ge]);if(w)for(const ge in this.fixedUniforms)this.fixedUniforms[ge].set(w[ge]);J&&J.setUniforms(e,this.binderUniforms,G,{zoom:ee});let de=0;switch(a){case oe.LINES:de=2;break;case oe.TRIANGLES:de=3;break;case oe.LINE_STRIP:de=1}for(const ge of j.get()){const le=ge.vaos||(ge.vaos={});(le[k]||(le[k]=new Wd)).bind(e,this,B,J?J.getPaintVertexBuffers():[],L,ge.vertexOffset,te,ae,ue),oe.drawElements(a,ge.primitiveLength*de,oe.UNSIGNED_SHORT,ge.primitiveOffset*de*2)}}}function pl(f,e,a){const l=1/u.aC(a,1,e.transform.tileZoom),d=Math.pow(2,a.tileID.overscaledZ),m=a.tileSize*Math.pow(2,e.transform.tileZoom)/d,y=m*(a.tileID.canonical.x+a.tileID.wrap*d),w=m*a.tileID.canonical.y;return{u_image:0,u_texsize:a.imageAtlasTexture.size,u_scale:[l,f.fromScale,f.toScale],u_fade:f.t,u_pixel_coord_upper:[y>>16,w>>16],u_pixel_coord_lower:[65535&y,65535&w]}}const Rn=(f,e,a,l)=>{const d=f.style.light,m=d.properties.get("position"),y=[m.x,m.y,m.z],w=u.bV();d.properties.get("anchor")==="viewport"&&u.bW(w,f.transform.bearingInRadians),u.bX(y,y,w);const S=f.transform.transformLightDirection(y),P=d.properties.get("color");return{u_lightpos:y,u_lightpos_globe:S,u_lightintensity:d.properties.get("intensity"),u_lightcolor:[P.r,P.g,P.b],u_vertical_gradient:+e,u_opacity:a,u_fill_translate:l}},Qd=(f,e,a,l,d,m,y)=>u.e(Rn(f,e,a,l),pl(m,f,y),{u_height_factor:-Math.pow(2,d.overscaledZ)/y.tileSize/8}),sc=(f,e,a,l)=>u.e(pl(e,f,a),{u_fill_translate:l}),ml=(f,e)=>({u_world:f,u_fill_translate:e}),gl=(f,e,a,l,d)=>u.e(sc(f,e,a,d),{u_world:l}),Qh=(f,e,a,l,d)=>{const m=f.transform;let y,w,S=0;if(a.paint.get("circle-pitch-alignment")==="map"){const P=u.aC(e,1,m.zoom);y=!0,w=[P,P],S=P/(u.$*Math.pow(2,e.tileID.overscaledZ))*2*Math.PI*d}else y=!1,w=m.pixelsToGLUnits;return{u_camera_to_center_distance:m.cameraToCenterDistance,u_scale_with_map:+(a.paint.get("circle-pitch-scale")==="map"),u_pitch_with_map:+y,u_device_pixel_ratio:f.pixelRatio,u_extrude_scale:w,u_globe_extrude_scale:S,u_translate:l}},oc=f=>({u_pixel_extrude_scale:[1/f.width,1/f.height]}),_l=f=>({u_viewport_size:[f.width,f.height]}),Do=(f,e=1)=>({u_color:f,u_overlay:0,u_overlay_scale:e}),Jh=(f,e,a,l)=>{const d=u.aC(f,1,e)/(u.$*Math.pow(2,f.tileID.overscaledZ))*2*Math.PI*l;return{u_extrude_scale:u.aC(f,1,e),u_intensity:a,u_globe_extrude_scale:d}},th=(f,e,a,l)=>{const d=u.L();u.bY(d,0,f.width,f.height,0,0,1);const m=f.context.gl;return{u_matrix:d,u_world:[m.drawingBufferWidth,m.drawingBufferHeight],u_image:a,u_color_ramp:l,u_opacity:e.paint.get("heatmap-opacity")}},ed=(f,e,a)=>{const l=a.paint.get("hillshade-accent-color");let d;switch(a.paint.get("hillshade-method")){case"basic":d=4;break;case"combined":d=1;break;case"igor":d=2;break;case"multidirectional":d=3;break;default:d=0}const m=a.getIlluminationProperties();for(let y=0;y<m.directionRadians.length;y++)a.paint.get("hillshade-illumination-anchor")==="viewport"&&(m.directionRadians[y]+=f.transform.bearingInRadians);return{u_image:0,u_latrange:Lo(0,e.tileID),u_exaggeration:a.paint.get("hillshade-exaggeration"),u_altitudes:m.altitudeRadians,u_azimuths:m.directionRadians,u_accent:l,u_method:d,u_highlights:m.highlightColor,u_shadows:m.shadowColor}},ih=(f,e)=>{const a=e.stride,l=u.L();return u.bY(l,0,u.$,-u.$,0,0,1),u.M(l,l,[0,-u.$,0]),{u_matrix:l,u_image:1,u_dimension:[a,a],u_zoom:f.overscaledZ,u_unpack:e.getUnpackVector()}};function Lo(f,e){const a=Math.pow(2,e.canonical.z),l=e.canonical.y;return[new u.a1(0,l/a).toLngLat().lat,new u.a1(0,(l+1)/a).toLngLat().lat]}const yl=(f,e,a=0)=>({u_image:0,u_unpack:e.getUnpackVector(),u_dimension:[e.stride,e.stride],u_elevation_stops:1,u_color_stops:4,u_color_ramp_size:a,u_opacity:f.paint.get("color-relief-opacity")}),iu=(f,e,a,l)=>{const d=f.transform;return{u_translation:uc(f,e,a),u_ratio:l/u.aC(e,1,d.zoom),u_device_pixel_ratio:f.pixelRatio,u_units_to_pixels:[1/d.pixelsToGLUnits[0],1/d.pixelsToGLUnits[1]]}},lc=(f,e,a,l,d)=>u.e(iu(f,e,a,l),{u_image:0,u_image_height:d}),rh=(f,e,a,l,d)=>{const m=f.transform,y=cc(e,m);return{u_translation:uc(f,e,a),u_texsize:e.imageAtlasTexture.size,u_ratio:l/u.aC(e,1,m.zoom),u_device_pixel_ratio:f.pixelRatio,u_image:0,u_scale:[y,d.fromScale,d.toScale],u_fade:d.t,u_units_to_pixels:[1/m.pixelsToGLUnits[0],1/m.pixelsToGLUnits[1]]}},Hs=(f,e,a,l,d,m)=>{const y=f.lineAtlas,w=cc(e,f.transform),S=a.layout.get("line-cap")==="round",P=y.getDash(d.from,S),k=y.getDash(d.to,S),B=P.width*m.fromScale,L=k.width*m.toScale;return u.e(iu(f,e,a,l),{u_patternscale_a:[w/B,-P.height/2],u_patternscale_b:[w/L,-k.height/2],u_sdfgamma:y.width/(256*Math.min(B,L)*f.pixelRatio)/2,u_image:0,u_tex_y_a:P.y,u_tex_y_b:k.y,u_mix:m.t})};function cc(f,e){return 1/u.aC(f,1,e.tileZoom)}function uc(f,e,a){return u.aD(f.transform,e,a.paint.get("line-translate"),a.paint.get("line-translate-anchor"))}const xl=(f,e,a,l,d)=>{return{u_tl_parent:f,u_scale_parent:e,u_buffer_scale:1,u_fade_t:a.mix,u_opacity:a.opacity*l.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:l.paint.get("raster-brightness-min"),u_brightness_high:l.paint.get("raster-brightness-max"),u_saturation_factor:(y=l.paint.get("raster-saturation"),y>0?1-1/(1.001-y):-y),u_contrast_factor:(m=l.paint.get("raster-contrast"),m>0?1/(1-m):1+m),u_spin_weights:td(l.paint.get("raster-hue-rotate")),u_coords_top:[d[0].x,d[0].y,d[1].x,d[1].y],u_coords_bottom:[d[3].x,d[3].y,d[2].x,d[2].y]};var m,y};function td(f){f*=Math.PI/180;const e=Math.sin(f),a=Math.cos(f);return[(2*a+1)/3,(-Math.sqrt(3)*e-a+1)/3,(Math.sqrt(3)*e-a+1)/3]}const vl=(f,e,a,l,d,m,y,w,S,P,k,B,L)=>{const j=y.transform;return{u_is_size_zoom_constant:+(f==="constant"||f==="source"),u_is_size_feature_constant:+(f==="constant"||f==="camera"),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:j.cameraToCenterDistance,u_pitch:j.pitch/360*2*Math.PI,u_rotate_symbol:+a,u_aspect_ratio:j.width/j.height,u_fade_change:y.options.fadeDuration?y.symbolFadeChange:1,u_label_plane_matrix:w,u_coord_matrix:S,u_is_text:+k,u_pitch_with_map:+l,u_is_along_line:d,u_is_variable_anchor:m,u_texsize:B,u_texture:0,u_translation:P,u_pitched_scale:L}},id=(f,e,a,l,d,m,y,w,S,P,k,B,L,j)=>{const G=y.transform;return u.e(vl(f,e,a,l,d,m,y,w,S,P,k,B,j),{u_gamma_scale:l?Math.cos(G.pitch*Math.PI/180)*G.cameraToCenterDistance:1,u_device_pixel_ratio:y.pixelRatio,u_is_halo:1})},Jd=(f,e,a,l,d,m,y,w,S,P,k,B,L)=>u.e(id(f,e,a,l,d,m,y,w,S,P,!0,k,0,L),{u_texsize_icon:B,u_texture_icon:1}),rd=(f,e)=>({u_opacity:f,u_color:e}),nd=(f,e,a,l,d)=>u.e((function(m,y,w,S){const P=w.imageManager.getPattern(m.from.toString()),k=w.imageManager.getPattern(m.to.toString()),{width:B,height:L}=w.imageManager.getPixelSize(),j=Math.pow(2,S.tileID.overscaledZ),G=S.tileSize*Math.pow(2,w.transform.tileZoom)/j,ee=G*(S.tileID.canonical.x+S.tileID.wrap*j),J=G*S.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:P.tl,u_pattern_br_a:P.br,u_pattern_tl_b:k.tl,u_pattern_br_b:k.br,u_texsize:[B,L],u_mix:y.t,u_pattern_size_a:P.displaySize,u_pattern_size_b:k.displaySize,u_scale_a:y.fromScale,u_scale_b:y.toScale,u_tile_units_to_pixels:1/u.aC(S,1,w.transform.tileZoom),u_pixel_coord_upper:[ee>>16,J>>16],u_pixel_coord_lower:[65535&ee,65535&J]}})(a,d,e,l),{u_opacity:f}),nh=(f,e)=>{},Dn={fillExtrusion:(f,e)=>({u_lightpos:new u.bT(f,e.u_lightpos),u_lightpos_globe:new u.bT(f,e.u_lightpos_globe),u_lightintensity:new u.bg(f,e.u_lightintensity),u_lightcolor:new u.bT(f,e.u_lightcolor),u_vertical_gradient:new u.bg(f,e.u_vertical_gradient),u_opacity:new u.bg(f,e.u_opacity),u_fill_translate:new u.bU(f,e.u_fill_translate)}),fillExtrusionPattern:(f,e)=>({u_lightpos:new u.bT(f,e.u_lightpos),u_lightpos_globe:new u.bT(f,e.u_lightpos_globe),u_lightintensity:new u.bg(f,e.u_lightintensity),u_lightcolor:new u.bT(f,e.u_lightcolor),u_vertical_gradient:new u.bg(f,e.u_vertical_gradient),u_height_factor:new u.bg(f,e.u_height_factor),u_opacity:new u.bg(f,e.u_opacity),u_fill_translate:new u.bU(f,e.u_fill_translate),u_image:new u.bP(f,e.u_image),u_texsize:new u.bU(f,e.u_texsize),u_pixel_coord_upper:new u.bU(f,e.u_pixel_coord_upper),u_pixel_coord_lower:new u.bU(f,e.u_pixel_coord_lower),u_scale:new u.bT(f,e.u_scale),u_fade:new u.bg(f,e.u_fade)}),fill:(f,e)=>({u_fill_translate:new u.bU(f,e.u_fill_translate)}),fillPattern:(f,e)=>({u_image:new u.bP(f,e.u_image),u_texsize:new u.bU(f,e.u_texsize),u_pixel_coord_upper:new u.bU(f,e.u_pixel_coord_upper),u_pixel_coord_lower:new u.bU(f,e.u_pixel_coord_lower),u_scale:new u.bT(f,e.u_scale),u_fade:new u.bg(f,e.u_fade),u_fill_translate:new u.bU(f,e.u_fill_translate)}),fillOutline:(f,e)=>({u_world:new u.bU(f,e.u_world),u_fill_translate:new u.bU(f,e.u_fill_translate)}),fillOutlinePattern:(f,e)=>({u_world:new u.bU(f,e.u_world),u_image:new u.bP(f,e.u_image),u_texsize:new u.bU(f,e.u_texsize),u_pixel_coord_upper:new u.bU(f,e.u_pixel_coord_upper),u_pixel_coord_lower:new u.bU(f,e.u_pixel_coord_lower),u_scale:new u.bT(f,e.u_scale),u_fade:new u.bg(f,e.u_fade),u_fill_translate:new u.bU(f,e.u_fill_translate)}),circle:(f,e)=>({u_camera_to_center_distance:new u.bg(f,e.u_camera_to_center_distance),u_scale_with_map:new u.bP(f,e.u_scale_with_map),u_pitch_with_map:new u.bP(f,e.u_pitch_with_map),u_extrude_scale:new u.bU(f,e.u_extrude_scale),u_device_pixel_ratio:new u.bg(f,e.u_device_pixel_ratio),u_globe_extrude_scale:new u.bg(f,e.u_globe_extrude_scale),u_translate:new u.bU(f,e.u_translate)}),collisionBox:(f,e)=>({u_pixel_extrude_scale:new u.bU(f,e.u_pixel_extrude_scale)}),collisionCircle:(f,e)=>({u_viewport_size:new u.bU(f,e.u_viewport_size)}),debug:(f,e)=>({u_color:new u.bQ(f,e.u_color),u_overlay:new u.bP(f,e.u_overlay),u_overlay_scale:new u.bg(f,e.u_overlay_scale)}),depth:nh,clippingMask:nh,heatmap:(f,e)=>({u_extrude_scale:new u.bg(f,e.u_extrude_scale),u_intensity:new u.bg(f,e.u_intensity),u_globe_extrude_scale:new u.bg(f,e.u_globe_extrude_scale)}),heatmapTexture:(f,e)=>({u_matrix:new u.bR(f,e.u_matrix),u_world:new u.bU(f,e.u_world),u_image:new u.bP(f,e.u_image),u_color_ramp:new u.bP(f,e.u_color_ramp),u_opacity:new u.bg(f,e.u_opacity)}),hillshade:(f,e)=>({u_image:new u.bP(f,e.u_image),u_latrange:new u.bU(f,e.u_latrange),u_exaggeration:new u.bg(f,e.u_exaggeration),u_altitudes:new u.b_(f,e.u_alt
909itudes),u_azimuths:new u.b_(f,e.u_azimuths),u_accent:new u.bQ(f,e.u_accent),u_method:new u.bP(f,e.u_method),u_shadows:new u.bZ(f,e.u_shadows),u_highlights:new u.bZ(f,e.u_highlights)}),hillshadePrepare:(f,e)=>({u_matrix:new u.bR(f,e.u_matrix),u_image:new u.bP(f,e.u_image),u_dimension:new u.bU(f,e.u_dimension),u_zoom:new u.bg(f,e.u_zoom),u_unpack:new u.bS(f,e.u_unpack)}),colorRelief:(f,e)=>({u_image:new u.bP(f,e.u_image),u_unpack:new u.bS(f,e.u_unpack),u_dimension:new u.bU(f,e.u_dimension),u_elevation_stops:new u.bP(f,e.u_elevation_stops),u_color_stops:new u.bP(f,e.u_color_stops),u_color_ramp_size:new u.bP(f,e.u_color_ramp_size),u_opacity:new u.bg(f,e.u_opacity)}),line:(f,e)=>({u_translation:new u.bU(f,e.u_translation),u_ratio:new u.bg(f,e.u_ratio),u_device_pixel_ratio:new u.bg(f,e.u_device_pixel_ratio),u_units_to_pixels:new u.bU(f,e.u_units_to_pixels)}),lineGradient:(f,e)=>({u_translation:new u.bU(f,e.u_translation),u_ratio:new u.bg(f,e.u_ratio),u_device_pixel_ratio:new u.bg(f,e.u_device_pixel_ratio),u_units_to_pixels:new u.bU(f,e.u_units_to_pixels),u_image:new u.bP(f,e.u_image),u_image_height:new u.bg(f,e.u_image_height)}),linePattern:(f,e)=>({u_translation:new u.bU(f,e.u_translation),u_texsize:new u.bU(f,e.u_texsize),u_ratio:new u.bg(f,e.u_ratio),u_device_pixel_ratio:new u.bg(f,e.u_device_pixel_ratio),u_image:new u.bP(f,e.u_image),u_units_to_pixels:new u.bU(f,e.u_units_to_pixels),u_scale:new u.bT(f,e.u_scale),u_fade:new u.bg(f,e.u_fade)}),lineSDF:(f,e)=>({u_translation:new u.bU(f,e.u_translation),u_ratio:new u.bg(f,e.u_ratio),u_device_pixel_ratio:new u.bg(f,e.u_device_pixel_ratio),u_units_to_pixels:new u.bU(f,e.u_units_to_pixels),u_patternscale_a:new u.bU(f,e.u_patternscale_a),u_patternscale_b:new u.bU(f,e.u_patternscale_b),u_sdfgamma:new u.bg(f,e.u_sdfgamma),u_image:new u.bP(f,e.u_image),u_tex_y_a:new u.bg(f,e.u_tex_y_a),u_tex_y_b:new u.bg(f,e.u_tex_y_b),u_mix:new u.bg(f,e.u_mix)}),raster:(f,e)=>({u_tl_parent:new u.bU(f,e.u_tl_parent),u_scale_parent:new u.bg(f,e.u_scale_parent),u_buffer_scale:new u.bg(f,e.u_buffer_scale),u_fade_t:new u.bg(f,e.u_fade_t),u_opacity:new u.bg(f,e.u_opacity),u_image0:new u.bP(f,e.u_image0),u_image1:new u.bP(f,e.u_image1),u_brightness_low:new u.bg(f,e.u_brightness_low),u_brightness_high:new u.bg(f,e.u_brightness_high),u_saturation_factor:new u.bg(f,e.u_saturation_factor),u_contrast_factor:new u.bg(f,e.u_contrast_factor),u_spin_weights:new u.bT(f,e.u_spin_weights),u_coords_top:new u.bS(f,e.u_coords_top),u_coords_bottom:new u.bS(f,e.u_coords_bottom)}),symbolIcon:(f,e)=>({u_is_size_zoom_constant:new u.bP(f,e.u_is_size_zoom_constant),u_is_size_feature_constant:new u.bP(f,e.u_is_size_feature_constant),u_size_t:new u.bg(f,e.u_size_t),u_size:new u.bg(f,e.u_size),u_camera_to_center_distance:new u.bg(f,e.u_camera_to_center_distance),u_pitch:new u.bg(f,e.u_pitch),u_rotate_symbol:new u.bP(f,e.u_rotate_symbol),u_aspect_ratio:new u.bg(f,e.u_aspect_ratio),u_fade_change:new u.bg(f,e.u_fade_change),u_label_plane_matrix:new u.bR(f,e.u_label_plane_matrix),u_coord_matrix:new u.bR(f,e.u_coord_matrix),u_is_text:new u.bP(f,e.u_is_text),u_pitch_with_map:new u.bP(f,e.u_pitch_with_map),u_is_along_line:new u.bP(f,e.u_is_along_line),u_is_variable_anchor:new u.bP(f,e.u_is_variable_anchor),u_texsize:new u.bU(f,e.u_texsize),u_texture:new u.bP(f,e.u_texture),u_translation:new u.bU(f,e.u_translation),u_pitched_scale:new u.bg(f,e.u_pitched_scale)}),symbolSDF:(f,e)=>({u_is_size_zoom_constant:new u.bP(f,e.u_is_size_zoom_constant),u_is_size_feature_constant:new u.bP(f,e.u_is_size_feature_constant),u_size_t:new u.bg(f,e.u_size_t),u_size:new u.bg(f,e.u_size),u_camera_to_center_distance:new u.bg(f,e.u_camera_to_center_distance),u_pitch:new u.bg(f,e.u_pitch),u_rotate_symbol:new u.bP(f,e.u_rotate_symbol),u_aspect_ratio:new u.bg(f,e.u_aspect_ratio),u_fade_change:new u.bg(f,e.u_fade_change),u_label_plane_matrix:new u.bR(f,e.u_label_plane_matrix),u_coord_matrix:new u.bR(f,e.u_coord_matrix),u_is_text:new u.bP(f,e.u_is_text),u_pitch_with_map:new u.bP(f,e.u_pitch_with_map),u_is_along_line:new u.bP(f,e.u_is_along_line),u_is_variable_anchor:new u.bP(f,e.u_is_variable_anchor),u_texsize:new u.bU(f,e.u_texsize),u_texture:new u.bP(f,e.u_texture),u_gamma_scale:new u.bg(f,e.u_gamma_scale),u_device_pixel_ratio:new u.bg(f,e.u_device_pixel_ratio),u_is_halo:new u.bP(f,e.u_is_halo),u_translation:new u.bU(f,e.u_translation),u_pitched_scale:new u.bg(f,e.u_pitched_scale)}),symbolTextAndIcon:(f,e)=>({u_is_size_zoom_constant:new u.bP(f,e.u_is_size_zoom_constant),u_is_size_feature_constant:new u.bP(f,e.u_is_size_feature_constant),u_size_t:new u.bg(f,e.u_size_t),u_size:new u.bg(f,e.u_size),u_camera_to_center_distance:new u.bg(f,e.u_camera_to_center_distance),u_pitch:new u.bg(f,e.u_pitch),u_rotate_symbol:new u.bP(f,e.u_rotate_symbol),u_aspect_ratio:new u.bg(f,e.u_aspect_ratio),u_fade_change:new u.bg(f,e.u_fade_change),u_label_plane_matrix:new u.bR(f,e.u_label_plane_matrix
vendor: 28,300 bytes, line 909
909),u_coord_matrix:new u.bR(f,e.u_coord_matrix),u_is_text:new u.bP(f,e.u_is_text),u_pitch_with_map:new u.bP(f,e.u_pitch_with_map),u_is_along_line:new u.bP(f,e.u_is_along_line),u_is_variable_anchor:new u.bP(f,e.u_is_variable_anchor),u_texsize:new u.bU(f,e.u_texsize),u_texsize_icon:new u.bU(f,e.u_texsize_icon),u_texture:new u.bP(f,e.u_texture),u_texture_icon:new u.bP(f,e.u_texture_icon),u_gamma_scale:new u.bg(f,e.u_gamma_scale),u_device_pixel_ratio:new u.bg(f,e.u_device_pixel_ratio),u_is_halo:new u.bP(f,e.u_is_halo),u_translation:new u.bU(f,e.u_translation),u_pitched_scale:new u.bg(f,e.u_pitched_scale)}),background:(f,e)=>({u_opacity:new u.bg(f,e.u_opacity),u_color:new u.bQ(f,e.u_color)}),backgroundPattern:(f,e)=>({u_opacity:new u.bg(f,e.u_opacity),u_image:new u.bP(f,e.u_image),u_pattern_tl_a:new u.bU(f,e.u_pattern_tl_a),u_pattern_br_a:new u.bU(f,e.u_pattern_br_a),u_pattern_tl_b:new u.bU(f,e.u_pattern_tl_b),u_pattern_br_b:new u.bU(f,e.u_pattern_br_b),u_texsize:new u.bU(f,e.u_texsize),u_mix:new u.bg(f,e.u_mix),u_pattern_size_a:new u.bU(f,e.u_pattern_size_a),u_pattern_size_b:new u.bU(f,e.u_pattern_size_b),u_scale_a:new u.bg(f,e.u_scale_a),u_scale_b:new u.bg(f,e.u_scale_b),u_pixel_coord_upper:new u.bU(f,e.u_pixel_coord_upper),u_pixel_coord_lower:new u.bU(f,e.u_pixel_coord_lower),u_tile_units_to_pixels:new u.bg(f,e.u_tile_units_to_pixels)}),terrain:(f,e)=>({u_texture:new u.bP(f,e.u_texture),u_ele_delta:new u.bg(f,e.u_ele_delta),u_fog_matrix:new u.bR(f,e.u_fog_matrix),u_fog_color:new u.bQ(f,e.u_fog_color),u_fog_ground_blend:new u.bg(f,e.u_fog_ground_blend),u_fog_ground_blend_opacity:new u.bg(f,e.u_fog_ground_blend_opacity),u_horizon_color:new u.bQ(f,e.u_horizon_color),u_horizon_fog_blend:new u.bg(f,e.u_horizon_fog_blend),u_is_globe_mode:new u.bg(f,e.u_is_globe_mode)}),terrainDepth:(f,e)=>({u_ele_delta:new u.bg(f,e.u_ele_delta)}),terrainCoords:(f,e)=>({u_texture:new u.bP(f,e.u_texture),u_terrain_coords_id:new u.bg(f,e.u_terrain_coords_id),u_ele_delta:new u.bg(f,e.u_ele_delta)}),projectionErrorMeasurement:(f,e)=>({u_input:new u.bg(f,e.u_input),u_output_expected:new u.bg(f,e.u_output_expected)}),atmosphere:(f,e)=>({u_sun_pos:new u.bT(f,e.u_sun_pos),u_atmosphere_blend:new u.bg(f,e.u_atmosphere_blend),u_globe_position:new u.bT(f,e.u_globe_position),u_globe_radius:new u.bg(f,e.u_globe_radius),u_inv_proj_matrix:new u.bR(f,e.u_inv_proj_matrix)}),sky:(f,e)=>({u_sky_color:new u.bQ(f,e.u_sky_color),u_horizon_color:new u.bQ(f,e.u_horizon_color),u_horizon:new u.bU(f,e.u_horizon),u_horizon_normal:new u.bU(f,e.u_horizon_normal),u_sky_horizon_blend:new u.bg(f,e.u_sky_horizon_blend),u_sky_blend:new u.bg(f,e.u_sky_blend)})};class bl{constructor(e,a,l){this.context=e;const d=e.gl;this.buffer=d.createBuffer(),this.dynamicDraw=!!l,this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),d.bufferData(d.ELEMENT_ARRAY_BUFFER,a.arrayBuffer,this.dynamicDraw?d.DYNAMIC_DRAW:d.STATIC_DRAW),this.dynamicDraw||delete a.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){const a=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),a.bufferSubData(a.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const hc={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class ls{constructor(e,a,l,d){this.length=a.length,this.attributes=l,this.itemSize=a.bytesPerElement,this.dynamicDraw=d,this.context=e;const m=e.gl;this.buffer=m.createBuffer(),e.bindVertexBuffer.set(this.buffer),m.bufferData(m.ARRAY_BUFFER,a.arrayBuffer,this.dynamicDraw?m.DYNAMIC_DRAW:m.STATIC_DRAW),this.dynamicDraw||delete a.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 a=this.context.gl;this.bind(),a.bufferSubData(a.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,a){for(let l=0;l<this.attributes.length;l++){const d=a.attributes[this.attributes[l].name];d!==void 0&&e.enableVertexAttribArray(d)}}setVertexAttribPointers(e,a,l){for(let d=0;d<this.attributes.length;d++){const m=this.attributes[d],y=a.attributes[m.name];y!==void 0&&e.vertexAttribPointer(y,m.components,e[hc[m.type]],!1,this.itemSize,m.offset+this.itemSize*(l||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class xi{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 ru extends xi{getDefault(){return u.bf.transparent}set(e){const a=this.current;(e.r!==a.r||e.g!==a.g||e.b!==a.b||e.a!==a.a||this.dirty)&&(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class dc extends xi{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}}class ad extends xi{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}}class Xs extends xi{getDefault(){return[!0,!0,!0,!0]}set(e){const a=this.current;(e[0]!==a[0]||e[1]!==a[1]||e[2]!==a[2]||e[3]!==a[3]||this.dirty)&&(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class ws extends xi{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}}class Bo extends xi{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}}class ah extends xi{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(e){const a=this.current;(e.func!==a.func||e.ref!==a.ref||e.mask!==a.mask||this.dirty)&&(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=!1)}}class sd extends xi{getDefault(){const e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}set(e){const a=this.current;(e[0]!==a[0]||e[1]!==a[1]||e[2]!==a[2]||this.dirty)&&(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=!1)}}class Oo extends xi{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const a=this.gl;e?a.enable(a.STENCIL_TEST):a.disable(a.STENCIL_TEST),this.current=e,this.dirty=!1}}class wl extends xi{getDefault(){return[0,1]}set(e){const a=this.current;(e[0]!==a[0]||e[1]!==a[1]||this.dirty)&&(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=!1)}}class nu extends xi{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const a=this.gl;e?a.enable(a.DEPTH_TEST):a.disable(a.DEPTH_TEST),this.current=e,this.dirty=!1}}class od extends xi{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}}class Ys extends xi{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const a=this.gl;e?a.enable(a.BLEND):a.disable(a.BLEND),this.current=e,this.dirty=!1}}class fc extends xi{getDefault(){const e=this.gl;return[e.ONE,e.ZERO]}set(e){const a=this.current;(e[0]!==a[0]||e[1]!==a[1]||this.dirty)&&(this.gl.blendFunc(e[0],e[1]),this.current=e,this.dirty=!1)}}class pc extends xi{getDefault(){return u.bf.transparent}set(e){const a=this.current;(e.r!==a.r||e.g!==a.g||e.b!==a.b||e.a!==a.a||this.dirty)&&(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class mc extends xi{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}}class sh extends xi{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const a=this.gl;e?a.enable(a.CULL_FACE):a.disable(a.CULL_FACE),this.current=e,this.dirty=!1}}class jo extends xi{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}}class gc extends xi{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}}class No extends xi{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}}class ta extends xi{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}}class au extends xi{getDefault(){const e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}set(e){const a=this.current;(e[0]!==a[0]||e[1]!==a[1]||e[2]!==a[2]||e[3]!==a[3]||this.dirty)&&(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class ma extends xi{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const a=this.gl;a.bindFramebuffer(a.FRAMEBUFFER,e),this.current=e,this.dirty=!1}}class su extends xi{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const a=this.gl;a.bindRenderbuffer(a.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class Qr extends xi{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const a=this.gl;a.bindTexture(a.TEXTURE_2D,e),this.current=e,this.dirty=!1}}class Ln extends xi{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const a=this.gl;a.bindBuffer(a.ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class Ss extends xi{getDefault(){return null}set(e){const a=this.gl;a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class Fo extends xi{getDefault(){return null}set(e){var a;if(e===this.current&&!this.dirty)return;const l=this.gl;gn(l)?l.bindVertexArray(e):(a=l.getExtension("OES_vertex_array_object"))===null||a===void 0||a.bindVertexArrayOES(e),this.current=e,this.dirty=!1}}class Uo extends xi{getDefault(){return 4}set(e){if(e===this.current&&!this.dirty)return;const a=this.gl;a.pixelStorei(a.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1}}class _c extends xi{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const a=this.gl;a.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1}}class Ks extends xi{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const a=this.gl;a.pixelStorei(a.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1}}class ia extends xi{constructor(e,a){super(e),this.context=e,this.parent=a}getDefault(){return null}}class oh extends ia{setDirty(){this.dirty=!0}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const a=this.gl;a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}}class Sl extends ia{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const a=this.gl;a.framebufferRenderbuffer(a.FRAMEBUFFER,a.DEPTH_ATTACHMENT,a.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class ni extends ia{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const a=this.gl;a.framebufferRenderbuffer(a.FRAMEBUFFER,a.DEPTH_STENCIL_ATTACHMENT,a.RENDERBUFFER,e),this.current=e,this.dirty=!1}}const yc="Framebuffer is not complete";class ra{constructor(e,a,l,d,m){this.context=e,this.width=a,this.height=l;const y=e.gl,w=this.framebuffer=y.createFramebuffer();if(this.colorAttachment=new oh(e,w),d)this.depthAttachment=m?new ni(e,w):new Sl(e,w);else if(m)throw new Error("Stencil cannot be set without depth");if(y.checkFramebufferStatus(y.FRAMEBUFFER)!==y.FRAMEBUFFER_COMPLETE)throw new Error(yc)}destroy(){const e=this.context.gl,a=this.colorAttachment.get();if(a&&e.deleteTexture(a),this.depthAttachment){const l=this.depthAttachment.get();l&&e.deleteRenderbuffer(l)}e.deleteFramebuffer(this.framebuffer)}}class ou{constructor(e){var a,l;if(this.gl=e,this.clearColor=new ru(this),this.clearDepth=new dc(this),this.clearStencil=new ad(this),this.colorMask=new Xs(this),this.depthMask=new ws(this),this.stencilMask=new Bo(this),this.stencilFunc=new ah(this),this.stencilOp=new sd(this),this.stencilTest=new Oo(this),this.depthRange=new wl(this),this.depthTest=new nu(this),this.depthFunc=new od(this),this.blend=new Ys(this),this.blendFunc=new fc(this),this.blendColor=new pc(this),this.blendEquation=new mc(this),this.cullFace=new sh(this),this.cullFaceSide=new jo(this),this.frontFace=new gc(this),this.program=new No(this),this.activeTexture=new ta(this),this.viewport=new au(this),this.bindFramebuffer=new ma(this),this.bindRenderbuffer=new su(this),this.bindTexture=new Qr(this),this.bindVertexBuffer=new Ln(this),this.bindElementBuffer=new Ss(this),this.bindVertexArray=new Fo(this),this.pixelStoreUnpack=new Uo(this),this.pixelStoreUnpackPremultiplyAlpha=new _c(this),this.pixelStoreUnpackFlipY=new Ks(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),gn(e)){this.HALF_FLOAT=e.HALF_FLOAT;const d=e.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(a=e.RGBA16F)!==null&&a!==void 0?a:d?.RGBA16F_EXT,this.RGB16F=(l=e.RGB16F)!==null&&l!==void 0?l:d?.RGB16F_EXT,e.getExtension("EXT_color_buffer_float")}else{e.getExtension("EXT_color_buffer_half_float"),e.getExtension("OES_texture_half_float_linear");const d=e.getExtension("OES_texture_half_float");this.HALF_FLOAT=d?.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,a){return new bl(this,e,a)}createVertexBuffer(e,a,l){return new ls(this,e,a,l)}createRenderbuffer(e,a,l){const d=this.gl,m=d.createRenderbuffer();return this.bindRenderbuffer.set(m),d.renderbufferStorage(d.RENDERBUFFER,e,a,l),this.bindRenderbuffer.set(null),m}createFramebuffer(e,a,l,d){return new ra(this,e,a,l,d)}clear({color:e,depth:a,stencil:l}){const d=this.gl;let m=0;e&&(m|=d.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),a!==void 0&&(m|=d.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(a),this.depthMask.set(!0)),l!==void 0&&(m|=d.STENCIL_BUFFER_BIT,this.clearStencil.set(l),this.stencilMask.set(255)),d.clear(m)}setCullFace(e){e.enable===!1?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){u.bH(e.blendFunction,Ui.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 gn(this.gl)?this.gl.createVertexArray():(e=this.gl.getExtension("OES_vertex_array_object"))===null||e===void 0?void 0:e.createVertexArrayOES()}deleteVertexArray(e){var a;return gn(this.gl)?this.gl.deleteVertexArray(e):(a=this.gl.getExtension("OES_vertex_array_object"))===null||a===void 0?void 0:a.deleteVertexArrayOES(e)}unbindVAO(){this.bindVertexArray.set(null)}}let yn;function lh(f,e,a,l,d){const m=f.context,y=f.transform,w=m.gl,S=f.useProgram("collisionBox"),P=[];let k=0,B=0;for(let te=0;te<l.length;te++){const ae=l[te],ue=e.getTile(ae).getBucket(a);if(!ue)continue;const oe=d?ue.textCollisionBox:ue.iconCollisionBox,de=ue.collisionCircleArray;de.length>0&&(P.push({circleArray:de,circleOffset:B,coord:ae}),k+=de.length/4,B=k),oe&&S.draw(m,w.LINES,$t.disabled,fi.disabled,f.colorModeForRenderPass(),jt.disabled,oc(f.transform),f.style.map.terrain&&f.style.map.terrain.getTerrainData(ae),y.getProjectionData({overscaledTileID:ae,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),a.id,oe.layoutVertexBuffer,oe.indexBuffer,oe.segments,null,f.transform.zoom,null,null,oe.collisionVertexBuffer)}if(!d||!P.length)return;const L=f.useProgram("collisionCircle"),j=new u.b$;j.resize(4*k),j._trim();let G=0;for(const te of P)for(let ae=0;ae<te.circleArray.length/4;ae++){const ue=4*ae,oe=te.circleArray[ue+0],de=te.circleArray[ue+1],ge=te.circleArray[ue+2],le=te.circleArray[ue+3];j.emplace(G++,oe,de,ge,le,0),j.emplace(G++,oe,de,ge,le,1),j.emplace(G++,oe,de,ge,le,2),j.emplace(G++,oe,de,ge,le,3)}(!yn||yn.length<2*k)&&(yn=(function(te){const ae=2*te,ue=new u.c1;ue.resize(ae),ue._trim();for(let oe=0;oe<ae;oe++){const de=6*oe;ue.uint16[de+0]=4*oe+0,ue.uint16[de+1]=4*oe+1,ue.uint16[de+2]=4*oe+2,ue.uint16[de+3]=4*oe+2,ue.uint16[de+4]=4*oe+3,ue.uint16[de+5]=4*oe+0}return ue})(k));const ee=m.createIndexBuffer(yn,!0),J=m.createVertexBuffer(j,u.c0.members,!0);for(const te of P){const ae=_l(f.transform);L.draw(m,w.TRIANGLES,$t.disabled,fi.disabled,f.colorModeForRenderPass(),jt.disabled,ae,f.style.map.terrain&&f.style.map.terrain.getTerrainData(te.coord),null,a.id,J,ee,u.aM.simpleSegment(0,2*te.circleOffset,te.circleArray.length,te.circleArray.length/2),null,f.transform.zoom,null,null,null)}J.destroy(),ee.destroy()}const lu=u.ag(new Float32Array(16));function Ws(f,e,a,l,d,m){const{horizontalAlign:y,verticalAlign:w}=u.aH(f);return new u.P((-(y-.5)*e/d+l[0])*m,(-(w-.5)*a/d+l[1])*m)}function ch(f,e,a,l,d,m){const y=e.tileAnchorPoint.add(new u.P(e.translation[0],e.translation[1]));if(e.pitchWithMap){let w=l.mult(m);a||(w=w.rotate(-d));const S=y.add(w);return er(S.x,S.y,e.pitchedLabelPlaneMatrix,e.getElevation).point}if(a){const w=Rr(e.tileAnchorPoint.x+1,e.tileAnchorPoint.y,e).point.sub(f),S=Math.atan(w.y/w.x)+(w.x<0?Math.PI:0);return f.add(l.rotate(S))}return f.add(l)}function xc(f,e,a,l,d,m,y,w,S,P,k,B){const L=f.text.placedSymbolArray,j=f.text.dynamicLayoutVertexArray,G=f.icon.dynamicLayoutVertexArray,ee={};j.clear();for(let J=0;J<L.length;J++){const te=L.get(J),ae=te.hidden||!te.crossTileID||f.allowVerticalPlacement&&!te.placedOrientation?null:l[te.crossTileID];if(ae){const ue=new u.P(te.anchorX,te.anchorY),oe={getElevation:B,width:d.width,height:d.height,pitchedLabelPlaneMatrix:m,pitchWithMap:a,transform:d,tileAnchorPoint:ue,translation:P,unwrappedTileID:k},de=a?tr(ue.x,ue.y,oe):Rr(ue.x,ue.y,oe),ge=st(d.cameraToCenterDistance,de.signedDistanceFromCamera);let le=u.ap(f.textSizeData,w,te)*ge/u.aB;a&&(le*=f.tilePixelRatio/y);const{width:Se,height:Oe,anchor:ze,textOffset:ke,textBoxScale:Le}=ae,ot=Ws(ze,Se,Oe,ke,Le,le),ct=d.getPitchedTextCorrection(ue.x+P[0],ue.y+P[1],k),We=ch(de.point,oe,e,ot,-d.bearingInRadians,ct),Et=f.allowVerticalPlacement&&te.placedOrientation===u.ao.vertical?Math.PI/2:0;for(let ii=0;ii<te.numGlyphs;ii++)u.av(j,We,Et);S&&te.associatedIconIndex>=0&&(ee[te.associatedIconIndex]={shiftedAnchor:We,angle:Et})}else es(te.numGlyphs,j)}if(S){G.clear();const J=f.icon.placedSymbolArray;for(let te=0;te<J.length;te++){const ae=J.get(te);if(ae.hidden)es(ae.numGlyphs,G);else{const ue=ee[te];if(ue)for(let oe=0;oe<ae.numGlyphs;oe++)u.av(G,ue.shiftedAnchor,ue.angle);else es(ae.numGlyphs,G)}}f.icon.dynamicLayoutVertexBuffer.updateData(G)}f.text.dynamicLayoutVertexBuffer.updateData(j)}function Ts(f,e,a){return a.iconsInText&&e?"symbolTextAndIcon":f?"symbolSDF":"symbolIcon"}function cs(f,e,a,l,d,m,y,w,S,P,k,B,L){const j=f.context,G=j.gl,ee=f.transform,J=w==="map",te=S==="map",ae=w!=="viewport"&&a.layout.get("symbol-placement")!=="point",ue=J&&!te&&!ae,oe=!a.layout.get("symbol-sort-key").isConstant();let de=!1;const ge=f.getDepthModeForSublayer(0,$t.ReadOnly),le=a._unevaluatedLayout.hasValue("text-variable-anchor")||a._unevaluatedLayout.hasValue("text-variable-anchor-offset"),Se=[],Oe=ee.getCircleRadiusCorrection();for(const ze of l){const ke=e.getTile(ze),Le=ke.getBucket(a);if(!Le)continue;const ot=d?Le.text:Le.icon;if(!ot||!ot.segments.get().length||!ot.hasVisibleVertices)continue;const ct=ot.programConfigurations.get(a.id),We=d||Le.sdfIcons,Et=d?Le.textSizeData:Le.iconSizeData,ii=te||ee.pitch!==0,vi=f.useProgram(Ts(We,d,Le),ct),Ii=u.an(Et,ee.zoom),Pi=f.style.map.terrain&&f.style.map.terrain.getTerrainData(ze);let cr,rr,Wt,Ri,Sr=[0,0],Ur=null;if(d)rr=ke.glyphAtlasTexture,Wt=G.LINEAR,cr=ke.glyphAtlasTexture.size,Le.iconsInText&&(Sr=ke.imageAtlasTexture.size,Ur=ke.imageAtlasTexture,Ri=ii||f.options.rotating||f.options.zooming||Et.kind==="composite"||Et.kind==="camera"?G.LINEAR:G.NEAREST);else{const nr=a.layout.get("icon-size").constantOr(0)!==1||Le.iconsNeedLinear;rr=ke.imageAtlasTexture,Wt=We||f.options.rotating||f.options.zooming||nr||ii?G.LINEAR:G.NEAREST,cr=ke.imageAtlasTexture.size}const Hr=u.aC(ke,1,f.transform.zoom),jn=Fi(J,f.transform,Hr),Ga=u.L();u.aq(Ga,jn);const Ds=Nt(te,J,f.transform,Hr),ba=u.aD(ee,ke,m,y),so=ee.getProjectionData({overscaledTileID:ze,applyGlobeMatrix:!L,applyTerrainMatrix:!0}),Ls=le&&Le.hasTextData(),oo=a.layout.get("icon-text-fit")!=="none"&&Ls&&Le.hasIconData();if(ae){const nr=f.style.map.terrain?(Nn,ur)=>f.style.map.terrain.getElevation(ze,Nn,ur):null,_r=a.layout.get("text-rotation-alignment")==="map";pr(Le,f,d,jn,Ga,te,P,_r,ze.toUnwrapped(),ee.width,ee.height,ba,nr)}const lo=d&&le||oo,ln=ae||lo?lu:te?jn:f.transform.clipSpaceToPixelsMatrix,wa=We&&a.paint.get(d?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let Mn;Mn=We?Le.iconsInText?Jd(Et.kind,Ii,ue,te,ae,lo,f,ln,Ds,ba,cr,Sr,Oe):id(Et.kind,Ii,ue,te,ae,lo,f,ln,Ds,ba,d,cr,0,Oe):vl(Et.kind,Ii,ue,te,ae,lo,f,ln,Ds,ba,d,cr,Oe);const co={program:vi,buffers:ot,uniformValues:Mn,projectionData:so,atlasTexture:rr,atlasTextureIcon:Ur,atlasInterpolation:Wt,atlasInterpolationIcon:Ri,isSDF:We,hasHalo:wa};if(oe&&Le.canOverlap){de=!0;const nr=ot.segments.get();for(const _r of nr)Se.push({segments:new u.aM([_r]),sortKey:_r.sortKey,state:co,terrainData:Pi})}else Se.push({segments:ot.segments,sortKey:0,state:co,terrainData:Pi})}de&&Se.sort(((ze,ke)=>ze.sortKey-ke.sortKey));for(const ze of Se){const ke=ze.state;if(j.activeTexture.set(G.TEXTURE0),ke.atlasTexture.bind(ke.atlasInterpolation,G.CLAMP_TO_EDGE),ke.atlasTextureIcon&&(j.activeTexture.set(G.TEXTURE1),ke.atlasTextureIcon&&ke.atlasTextureIcon.bind(ke.atlasInterpolationIcon,G.CLAMP_TO_EDGE)),ke.isSDF){const Le=ke.uniformValues;ke.hasHalo&&(Le.u_is_halo=1,Qs(ke.buffers,ze.segments,a,f,ke.program,ge,k,B,Le,ke.projectionData,ze.terrainData)),Le.u_is_halo=0}Qs(ke.buffers,ze.segments,a,f,ke.program,ge,k,B,ke.uniformValues,ke.projectionData,ze.terrainData)}}function Qs(f,e,a,l,d,m,y,w,S,P,k){const B=l.context;d.draw(B,B.gl.TRIANGLES,m,y,w,jt.backCCW,S,k,P,a.id,f.layoutVertexBuffer,f.indexBuffer,e,a.paint,l.transform.zoom,f.programConfigurations.get(a.id),f.dynamicLayoutVertexBuffer,f.opacityVertexBuffer)}function Tl(f,e,a,l,d){const m=f.context,y=m.gl,w=fi.disabled,S=new Ui([y.ONE,y.ONE],u.bf.transparent,[!0,!0,!0,!0]),P=e.getBucket(a);if(!P)return;const k=l.key;let B=a.heatmapFbos.get(k);B||(B=xn(m,e.tileSize,e.tileSize),a.heatmapFbos.set(k,B)),m.bindFramebuffer.set(B.framebuffer),m.viewport.set([0,0,e.tileSize,e.tileSize]),m.clear({color:u.bf.transparent});const L=P.programConfigurations.get(a.id),j=f.useProgram("heatmap",L,!d),G=f.transform.getProjectionData({overscaledTileID:e.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),ee=f.style.map.terrain.getTerrainData(l);j.draw(m,y.TRIANGLES,$t.disabled,w,S,jt.disabled,Jh(e,f.transform.zoom,a.paint.get("heatmap-intensity"),1),ee,G,a.id,P.layoutVertexBuffer,P.indexBuffer,P.segments,a.paint,f.transform.zoom,L)}function na(f,e,a,l,d){const m=f.context,y=m.gl,w=f.transform;m.setColorMode(f.colorModeForRenderPass());const S=Oa(m,e),P=a.key,k=e.heatmapFbos.get(P);if(!k)return;m.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,k.colorAttachment.get()),m.activeTexture.set(y.TEXTURE1),S.bind(y.LINEAR,y.CLAMP_TO_EDGE);const B=w.getProjectionData({overscaledTileID:a,applyTerrainMatrix:d,applyGlobeMatrix:!l});f.useProgram("heatmapTexture").draw(m,y.TRIANGLES,$t.disabled,fi.disabled,f.colorModeForRenderPass(),jt.disabled,th(f,e,0,1),null,B,e.id,f.rasterBoundsBuffer,f.quadTriangleIndexBuffer,f.rasterBoundsSegments,e.paint,w.zoom),k.destroy(),e.heatmapFbos.delete(P)}function xn(f,e,a){var l,d;const m=f.gl,y=m.createTexture();m.bindTexture(m.TEXTURE_2D,y),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_S,m.CLAMP_TO_EDGE),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_T,m.CLAMP_TO_EDGE),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MIN_FILTER,m.LINEAR),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MAG_FILTER,m.LINEAR);const w=(l=f.HALF_FLOAT)!==null&&l!==void 0?l:m.UNSIGNED_BYTE,S=(d=f.RGBA16F)!==null&&d!==void 0?d:m.RGBA;m.texImage2D(m.TEXTURE_2D,0,S,e,a,0,m.RGBA,w,null);const P=f.createFramebuffer(e,a,!1,!1);return P.colorAttachment.set(y),P}function Oa(f,e){return e.colorRampTexture||(e.colorRampTexture=new u.T(f,e.colorRamp,f.gl.RGBA)),e.colorRampTexture}function aa(f,e,a,l,d){if(!a||!l||!l.imageAtlas)return;const m=l.imageAtlas.patternPositions;let y=m[a.to.toString()],w=m[a.from.toString()];if(!y&&w&&(y=w),!w&&y&&(w=y),!y||!w){const S=d.getPaintProperty(e);y=m[S],w=m[S]}y&&w&&f.setConstantPatternPositions(y,w)}function ga(f,e,a,l,d,m,y,w){const S=f.context.gl,P="fill-pattern",k=a.paint.get(P),B=k&&k.constantOr(1),L=a.getCrossfadeParameters();let j,G,ee,J,te;const ae=f.transform,ue=a.paint.get("fill-translate"),oe=a.paint.get("fill-translate-anchor");y?(G=B&&!a.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",j=S.LINES):(G=B?"fillPattern":"fill",j=S.TRIANGLES);const de=k.constantOr(null);for(const ge of l){const le=e.getTile(ge);if(B&&!le.patternsLoaded())continue;const Se=le.getBucket(a);if(!Se)continue;const Oe=Se.programConfigurations.get(a.id),ze=f.useProgram(G,Oe),ke=f.style.map.terrain&&f.style.map.terrain.getTerrainData(ge);B&&(f.context.activeTexture.set(S.TEXTURE0),le.imageAtlasTexture.bind(S.LINEAR,S.CLAMP_TO_EDGE),Oe.updatePaintBuffers(L)),aa(Oe,P,de,le,a);const Le=ae.getProjectionData({overscaledTileID:ge,applyGlobeMatrix:!w,applyTerrainMatrix:!0}),ot=u.aD(ae,le,ue,oe);if(y){J=Se.indexBuffer2,te=Se.segments2;const We=[S.drawingBufferWidth,S.drawingBufferHeight];ee=G==="fillOutlinePattern"&&B?gl(f,L,le,We,ot):ml(We,ot)}else J=Se.indexBuffer,te=Se.segments,ee=B?sc(f,L,le,ot):{u_fill_translate:ot};const ct=f.stencilModeForClipping(ge);ze.draw(f.context,j,d,ct,m,jt.backCCW,ee,ke,Le,a.id,Se.layoutVertexBuffer,J,te,a.paint,f.transform.zoom,Oe)}}function Ms(f,e,a,l,d,m,y,w){const S=f.context,P=S.gl,k="fill-extrusion-pattern",B=a.paint.get(k),L=B.constantOr(1),j=a.getCrossfadeParameters(),G=a.paint.get("fill-extrusion-opacity"),ee=B.constantOr(null),J=f.transform;
vendor: 9,220 bytes, line 909
909for(const te of l){const ae=e.getTile(te),ue=ae.getBucket(a);if(!ue)continue;const oe=f.style.map.terrain&&f.style.map.terrain.getTerrainData(te),de=ue.programConfigurations.get(a.id),ge=f.useProgram(L?"fillExtrusionPattern":"fillExtrusion",de);L&&(f.context.activeTexture.set(P.TEXTURE0),ae.imageAtlasTexture.bind(P.LINEAR,P.CLAMP_TO_EDGE),de.updatePaintBuffers(j));const le=J.getProjectionData({overscaledTileID:te,applyGlobeMatrix:!w,applyTerrainMatrix:!0});aa(de,k,ee,ae,a);const Se=u.aD(J,ae,a.paint.get("fill-extrusion-translate"),a.paint.get("fill-extrusion-translate-anchor")),Oe=a.paint.get("fill-extrusion-vertical-gradient"),ze=L?Qd(f,Oe,G,Se,te,j,ae):Rn(f,Oe,G,Se);ge.draw(S,S.gl.TRIANGLES,d,m,y,jt.backCCW,ze,oe,le,a.id,ue.layoutVertexBuffer,ue.indexBuffer,ue.segments,a.paint,f.transform.zoom,de,f.style.map.terrain&&ue.centroidVertexBuffer)}}function Js(f,e,a,l,d,m,y,w,S){var P;const k=f.style.projection,B=f.context,L=f.transform,j=B.gl,G=[`#define NUM_ILLUMINATION_SOURCES ${a.paint.get("hillshade-highlight-color").values.length}`],ee=f.useProgram("hillshade",null,!1,G),J=!f.options.moving;for(const te of l){const ae=e.getTile(te),ue=ae.fbo;if(!ue)continue;const oe=k.getMeshFromTileID(B,te.canonical,w,!0,"raster"),de=(P=f.style.map.terrain)===null||P===void 0?void 0:P.getTerrainData(te);B.activeTexture.set(j.TEXTURE0),j.bindTexture(j.TEXTURE_2D,ue.colorAttachment.get());const ge=L.getProjectionData({overscaledTileID:te,aligned:J,applyGlobeMatrix:!S,applyTerrainMatrix:!0});ee.draw(B,j.TRIANGLES,m,d[te.overscaledZ],y,jt.backCCW,ed(f,ae,a),de,ge,a.id,oe.vertexBuffer,oe.indexBuffer,oe.segments)}}function vc(f,e,a,l,d,m,y,w,S){var P;const k=f.style.projection,B=f.context,L=f.transform,j=B.gl,G=f.useProgram("colorRelief"),ee=!f.options.moving;let J=!0,te=0;for(const ae of l){const ue=e.getTile(ae),oe=ue.dem;if(J){const ze=j.getParameter(j.MAX_TEXTURE_SIZE),{elevationTexture:ke,colorTexture:Le}=a.getColorRampTextures(B,ze,oe.getUnpackVector());B.activeTexture.set(j.TEXTURE1),ke.bind(j.NEAREST,j.CLAMP_TO_EDGE),B.activeTexture.set(j.TEXTURE4),Le.bind(j.LINEAR,j.CLAMP_TO_EDGE),J=!1,te=ke.size[0]}if(!oe||!oe.data)continue;const de=oe.stride,ge=oe.getPixels();if(B.activeTexture.set(j.TEXTURE0),B.pixelStoreUnpackPremultiplyAlpha.set(!1),ue.demTexture=ue.demTexture||f.getTileTexture(de),ue.demTexture){const ze=ue.demTexture;ze.update(ge,{premultiply:!1}),ze.bind(j.LINEAR,j.CLAMP_TO_EDGE)}else ue.demTexture=new u.T(B,ge,j.RGBA,{premultiply:!1}),ue.demTexture.bind(j.LINEAR,j.CLAMP_TO_EDGE);const le=k.getMeshFromTileID(B,ae.canonical,w,!0,"raster"),Se=(P=f.style.map.terrain)===null||P===void 0?void 0:P.getTerrainData(ae),Oe=L.getProjectionData({overscaledTileID:ae,aligned:ee,applyGlobeMatrix:!S,applyTerrainMatrix:!0});G.draw(B,j.TRIANGLES,m,d[ae.overscaledZ],y,jt.backCCW,yl(a,ue.dem,te),Se,Oe,a.id,le.vertexBuffer,le.indexBuffer,le.segments)}}const Ml=[new u.P(0,0),new u.P(u.$,0),new u.P(u.$,u.$),new u.P(0,u.$)];function Lr(f,e,a,l,d,m,y,w,S=!1,P=!1){const k=l[l.length-1].overscaledZ,B=f.context,L=B.gl,j=f.useProgram("raster"),G=f.transform,ee=f.style.projection,J=f.colorModeForRenderPass(),te=!f.options.moving;for(const ae of l){const ue=f.getDepthModeForSublayer(ae.overscaledZ-k,a.paint.get("raster-opacity")===1?$t.ReadWrite:$t.ReadOnly,L.LESS),oe=e.getTile(ae);oe.registerFadeDuration(a.paint.get("raster-fade-duration"));const de=e.findLoadedParent(ae,0),ge=e.findLoadedSibling(ae),le=or(oe,de||ge||null,e,a,f.transform,f.style.map.terrain);let Se,Oe;const ze=a.paint.get("raster-resampling")==="nearest"?L.NEAREST:L.LINEAR;B.activeTexture.set(L.TEXTURE0),oe.texture.bind(ze,L.CLAMP_TO_EDGE,L.LINEAR_MIPMAP_NEAREST),B.activeTexture.set(L.TEXTURE1),de?(de.texture.bind(ze,L.CLAMP_TO_EDGE,L.LINEAR_MIPMAP_NEAREST),Se=Math.pow(2,de.tileID.overscaledZ-oe.tileID.overscaledZ),Oe=[oe.tileID.canonical.x*Se%1,oe.tileID.canonical.y*Se%1]):oe.texture.bind(ze,L.CLAMP_TO_EDGE,L.LINEAR_MIPMAP_NEAREST),oe.texture.useMipmap&&B.extTextureFilterAnisotropic&&f.transform.pitch>20&&L.texParameterf(L.TEXTURE_2D,B.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,B.extTextureFilterAnisotropicMax);const ke=f.style.map.terrain&&f.style.map.terrain.getTerrainData(ae),Le=G.getProjectionData({overscaledTileID:ae,aligned:te,applyGlobeMatrix:!P,applyTerrainMatrix:!0}),ot=xl(Oe||[0,0],Se||1,le,a,w),ct=ee.getMeshFromTileID(B,ae.canonical,m,y,"raster");j.draw(B,L.TRIANGLES,ue,d?d[ae.overscaledZ]:fi.disabled,J,S?jt.frontCCW:jt.backCCW,ot,ke,Le,a.id,ct.vertexBuffer,ct.indexBuffer,ct.segments)}}function or(f,e,a,l,d,m){const y=l.paint.get("raster-fade-duration");if(!m&&y>0){const w=Ce.now(),S=(w-f.timeAdded)/y,P=e?(w-e.timeAdded)/y:-1,k=a.getSource(),B=Ct(d,{tileSize:k.tileSize,roundZoom:k.roundZoom}),L=!e||Math.abs(e.tileID.overscaledZ-B)>Math.abs(f.tileID.overscaledZ-B),j=L&&f.refreshedUponExpiration?1:u.ah(L?S:1-P,0,1);return f.refreshedUponExpiration&&S>=1&&(f.refreshedUponExpiration=!1),e?{opacity:1,mix:1-j}:{opacity:j,mix:0}}return{opacity:1,mix:0}}const Ci=new u.bf(1,0,0,1),eo=new u.bf(0,1,0,1),sa=new u.bf(0,0,1,1),bc=new u.bf(1,0,1,1),Vo=new u.bf(0,1,1,1);function cu(f,e,a,l){Hn(f,0,e+a/2,f.transform.width,a,l)}function lr(f,e,a,l){Hn(f,e-a/2,0,a,f.transform.height,l)}function Hn(f,e,a,l,d,m){const y=f.context,w=y.gl;w.enable(w.SCISSOR_TEST),w.scissor(e*f.pixelRatio,a*f.pixelRatio,l*f.pixelRatio,d*f.pixelRatio),y.clear({color:m}),w.disable(w.SCISSOR_TEST)}function vn(f,e,a){const l=f.context,d=l.gl,m=f.useProgram("debug"),y=$t.disabled,w=fi.disabled,S=f.colorModeForRenderPass(),P="$debug",k=f.style.map.terrain&&f.style.map.terrain.getTerrainData(a);l.activeTexture.set(d.TEXTURE0);const B=e.getTileByID(a.key).latestRawTileData,L=Math.floor((B&&B.byteLength||0)/1024),j=e.getTile(a).tileSize,G=512/Math.min(j,512)*(a.overscaledZ/f.transform.zoom)*.5;let ee=a.canonical.toString();a.overscaledZ!==a.canonical.z&&(ee+=` => ${a.overscaledZ}`),(function(te,ae){te.initDebugOverlayCanvas();const ue=te.debugOverlayCanvas,oe=te.context.gl,de=te.debugOverlayCanvas.getContext("2d");de.clearRect(0,0,ue.width,ue.height),de.shadowColor="white",de.shadowBlur=2,de.lineWidth=1.5,de.strokeStyle="white",de.textBaseline="top",de.font="bold 36px Open Sans, sans-serif",de.fillText(ae,5,5),de.strokeText(ae,5,5),te.debugOverlayTexture.update(ue),te.debugOverlayTexture.bind(oe.LINEAR,oe.CLAMP_TO_EDGE)})(f,`${ee} ${L}kB`);const J=f.transform.getProjectionData({overscaledTileID:a,applyGlobeMatrix:!0,applyTerrainMatrix:!0});m.draw(l,d.TRIANGLES,y,w,Ui.alphaBlended,jt.disabled,Do(u.bf.transparent,G),null,J,P,f.debugBuffer,f.quadTriangleIndexBuffer,f.debugSegments),m.draw(l,d.LINE_STRIP,y,w,S,jt.disabled,Do(u.bf.red),k,J,P,f.debugBuffer,f.tileBorderIndexBuffer,f.debugSegments)}function wc(f,e,a,l){const{isRenderingGlobe:d}=l,m=f.context,y=m.gl,w=f.transform,S=f.colorModeForRenderPass(),P=f.getDepthModeFor3D(),k=f.useProgram("terrain");m.bindFramebuffer.set(null),m.viewport.set([0,0,f.width,f.height]);for(const B of a){const L=e.getTerrainMesh(B.tileID),j=f.renderToTexture.getTexture(B),G=e.getTerrainData(B.tileID);m.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,j.texture);const ee=e.getMeshFrameDelta(w.zoom),J=w.calculateFogMatrix(B.tileID.toUnwrapped()),te=tu(ee,J,f.style.sky,w.pitch,d),ae=w.getProjectionData({overscaledTileID:B.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});k.draw(m,y.TRIANGLES,P,fi.disabled,S,jt.backCCW,te,G,ae,"terrain",L.vertexBuffer,L.indexBuffer,L.segments)}}function Cs(f,e){if(!e.mesh){const a=new u.aL;a.emplaceBack(-1,-1),a.emplaceBack(1,-1),a.emplaceBack(1,1),a.emplaceBack(-1,1);const l=new u.aN;l.emplaceBack(0,1,2),l.emplaceBack(0,2,3),e.mesh=new Gs(f.createVertexBuffer(a,ns.members),f.createIndexBuffer(l),u.aM.simpleSegment(0,0,a.length,l.length))}return e.mesh}class uu{constructor(e,a){this.context=new ou(e),this.transform=a,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:u.ag(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=oi.maxUnderzooming+oi.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Co}resize(e,a,l){if(this.width=Math.floor(e*l),this.height=Math.floor(a*l),this.pixelRatio=l,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const d of this.style._order)this.style._layers[d].resize()}setup(){const e=this.context,a=new u.aL;a.emplaceBack(0,0),a.emplaceBack(u.$,0),a.emplaceBack(0,u.$),a.emplaceBack(u.$,u.$),this.tileExtentBuffer=e.createVertexBuffer(a,ns.members),this.tileExtentSegments=u.aM.simpleSegment(0,0,4,2);const l=new u.aL;l.emplaceBack(0,0),l.emplaceBack(u.$,0),l.emplaceBack(0,u.$),l.emplaceBack(u.$,u.$),this.debugBuffer=e.createVertexBuffer(l,ns.members),this.debugSegments=u.aM.simpleSegment(0,0,4,5);const d=new u.c6;d.emplaceBack(0,0,0,0),d.emplaceBack(u.$,0,u.$,0),d.emplaceBack(0,u.$,0,u.$),d.emplaceBack(u.$,u.$,u.$,u.$),this.rasterBoundsBuffer=e.createVertexBuffer(d,Kd.members),this.rasterBoundsSegments=u.aM.simpleSegment(0,0,4,2);const m=new u.aL;m.emplaceBack(0,0),m.emplaceBack(u.$,0),m.emplaceBack(0,u.$),m.emplaceBack(u.$,u.$),this.rasterBoundsBufferPosOnly=e.createVertexBuffer(m,ns.members),this.rasterBoundsSegmentsPosOnly=u.aM.simpleSegment(0,0,4,5);const y=new u.aL;
vendor: 62,192 bytes, lines 909-911
909y.emplaceBack(0,0),y.emplaceBack(1,0),y.emplaceBack(0,1),y.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(y,ns.members),this.viewportSegments=u.aM.simpleSegment(0,0,4,2);const w=new u.c7;w.emplaceBack(0),w.emplaceBack(1),w.emplaceBack(3),w.emplaceBack(2),w.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(w);const S=new u.aN;S.emplaceBack(1,0,2),S.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(S);const P=this.context.gl;this.stencilClearMode=new fi({func:P.ALWAYS,mask:0},0,255,P.ZERO,P.ZERO,P.ZERO),this.tileExtentMesh=new Gs(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){const e=this.context,a=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const l=u.L();u.bY(l,0,this.width,this.height,0,0,1),u.N(l,l,[a.drawingBufferWidth,a.drawingBufferHeight,0]);const d={mainMatrix:l,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:l};this.useProgram("clippingMask",null,!0).draw(e,a.TRIANGLES,$t.disabled,this.stencilClearMode,Ui.disabled,jt.disabled,null,null,d,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(e,a,l){if(this.currentStencilSource===e.source||!e.isTileClipped()||!a||!a.length)return;this.currentStencilSource=e.source,this.nextStencilID+a.length>256&&this.clearStencil();const d=this.context;d.setColorMode(Ui.disabled),d.setDepthMode($t.disabled);const m={};for(const y of a)m[y.key]=this.nextStencilID++;this._renderTileMasks(m,a,l,!0),this._renderTileMasks(m,a,l,!1),this._tileClippingMaskIDs=m}_renderTileMasks(e,a,l,d){const m=this.context,y=m.gl,w=this.style.projection,S=this.transform,P=this.useProgram("clippingMask");for(const k of a){const B=e[k.key],L=this.style.map.terrain&&this.style.map.terrain.getTerrainData(k),j=w.getMeshFromTileID(this.context,k.canonical,d,!0,"stencil"),G=S.getProjectionData({overscaledTileID:k,applyGlobeMatrix:!l,applyTerrainMatrix:!0});P.draw(m,y.TRIANGLES,$t.disabled,new fi({func:y.ALWAYS,mask:0},B,255,y.KEEP,y.KEEP,y.REPLACE),Ui.disabled,l?jt.disabled:jt.backCCW,null,L,G,"$clipping",j.vertexBuffer,j.indexBuffer,j.segments)}}_renderTilesDepthBuffer(){const e=this.context,a=e.gl,l=this.style.projection,d=this.transform,m=this.useProgram("depth"),y=this.getDepthModeFor3D(),w=Me(d,{tileSize:d.tileSize});for(const S of w){const P=this.style.map.terrain&&this.style.map.terrain.getTerrainData(S),k=l.getMeshFromTileID(this.context,S.canonical,!0,!0,"raster"),B=d.getProjectionData({overscaledTileID:S,applyGlobeMatrix:!0,applyTerrainMatrix:!0});m.draw(e,a.TRIANGLES,y,fi.disabled,Ui.disabled,jt.backCCW,null,P,B,"$clipping",k.vertexBuffer,k.indexBuffer,k.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const e=this.nextStencilID++,a=this.context.gl;return new fi({func:a.NOTEQUAL,mask:255},e,255,a.KEEP,a.KEEP,a.REPLACE)}stencilModeForClipping(e){const a=this.context.gl;return new fi({func:a.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,a.KEEP,a.KEEP,a.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(e){const a=this.context.gl,l=e.sort(((y,w)=>w.overscaledZ-y.overscaledZ)),d=l[l.length-1].overscaledZ,m=l[0].overscaledZ-d+1;if(m>1){this.currentStencilSource=void 0,this.nextStencilID+m>256&&this.clearStencil();const y={};for(let w=0;w<m;w++)y[w+d]=new fi({func:a.GEQUAL,mask:255},w+this.nextStencilID,255,a.KEEP,a.KEEP,a.REPLACE);return this.nextStencilID+=m,[y,l]}return[{[d]:fi.disabled},l]}stencilConfigForOverlapTwoPass(e){const a=this.context.gl,l=e.sort(((y,w)=>w.overscaledZ-y.overscaledZ)),d=l[l.length-1].overscaledZ,m=l[0].overscaledZ-d+1;if(this.clearStencil(),m>1){const y={},w={};for(let S=0;S<m;S++)y[S+d]=new fi({func:a.GREATER,mask:255},m+1+S,255,a.KEEP,a.KEEP,a.REPLACE),w[S+d]=new fi({func:a.GREATER,mask:255},1+S,255,a.KEEP,a.KEEP,a.REPLACE);return this.nextStencilID=2*m+1,[y,w,l]}return this.nextStencilID=3,[{[d]:new fi({func:a.GREATER,mask:255},2,255,a.KEEP,a.KEEP,a.REPLACE)},{[d]:new fi({func:a.GREATER,mask:255},1,255,a.KEEP,a.KEEP,a.REPLACE)},l]}colorModeForRenderPass(){const e=this.context.gl;return this._showOverdrawInspector?new Ui([e.CONSTANT_COLOR,e.ONE],new u.bf(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Ui.unblended:Ui.alphaBlended}getDepthModeForSublayer(e,a,l){if(!this.opaquePassEnabledForLayer())return $t.disabled;const d=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new $t(l||this.context.gl.LEQUAL,a,[d,d])}getDepthModeFor3D(){return new $t(this.context.gl.LEQUAL,$t.ReadWrite,this.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(e,a){var l,d;this.style=e,this.options=a,this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(Ce.now()),this.imageManager.beginFrame();const m=this.style._order,y=this.style.sourceCaches,w={},S={},P={},k={isRenderingToTexture:!1,isRenderingGlobe:((l=e.projection)===null||l===void 0?void 0:l.transitionState)>0};for(const L in y){const j=y[L];j.used&&j.prepare(this.context),w[L]=j.getVisibleCoordinates(!1),S[L]=w[L].slice().reverse(),P[L]=j.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let L=0;L<m.length;L++)if(this.style._layers[m[L]].is3D()){this.opaquePassCutoff=L;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const L of m){const j=this.style._layers[L];if(!j.hasOffscreenPass()||j.isHidden(this.transform.zoom))continue;const G=S[j.source];(j.type==="custom"||G.length)&&this.renderLayer(this,y[j.source],j,G,k)}if((d=this.style.projection)===null||d===void 0||d.updateGPUdependent({context:this.context,useProgram:L=>this.useProgram(L)}),this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:a.showOverdrawInspector?u.bf.black:u.bf.transparent,depth:1}),this.clearStencil(),this.style.sky&&(function(L,j){const G=L.context,ee=G.gl,J=((ge,le,Se)=>{const Oe=Math.cos(le.rollInRadians),ze=Math.sin(le.rollInRadians),ke=me(le),Le=le.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:ge.properties.get("sky-color"),u_horizon_color:ge.properties.get("horizon-color"),u_horizon:[(le.width/2-ke*ze)*Se,(le.height/2+ke*Oe)*Se],u_horizon_normal:[-ze,Oe],u_sky_horizon_blend:ge.properties.get("sky-horizon-blend")*le.height/2*Se,u_sky_blend:Le}})(j,L.style.map.transform,L.pixelRatio),te=new $t(ee.LEQUAL,$t.ReadWrite,[0,1]),ae=fi.disabled,ue=L.colorModeForRenderPass(),oe=L.useProgram("sky"),de=Cs(G,j);oe.draw(G,ee.TRIANGLES,te,ae,ue,jt.disabled,J,null,void 0,"sky",de.vertexBuffer,de.indexBuffer,de.segments)})(this,this.style.sky),this._showOverdrawInspector=a.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=m.length-1;this.currentLayer>=0;this.currentLayer--){const L=this.style._layers[m[this.currentLayer]],j=y[L.source],G=w[L.source];this._renderTileClippingMasks(L,G,!1),this.renderLayer(this,j,L,G,k)}this.renderPass="translucent";let B=!1;for(this.currentLayer=0;this.currentLayer<m.length;this.currentLayer++){const L=this.style._layers[m[this.currentLayer]],j=y[L.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(L,k))continue;this.opaquePassEnabledForLayer()||B||(B=!0,k.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());const G=(L.type==="symbol"?P:S)[L.source];this._renderTileClippingMasks(L,w[L.source],!!this.renderToTexture),this.renderLayer(this,j,L,G,k)}if(k.isRenderingGlobe&&(function(L,j,G){const ee=L.context,J=ee.gl,te=L.useProgram("atmosphere"),ae=new $t(J.LEQUAL,$t.ReadOnly,[0,1]),ue=L.transform,oe=(function(Le,ot){const ct=Le.properties.get("position"),We=[-ct.x,-ct.y,-ct.z],Et=u.ag(new Float64Array(16));return Le.properties.get("anchor")==="map"&&(u.b6(Et,Et,ot.rollInRadians),u.b7(Et,Et,-ot.pitchInRadians),u.b6(Et,Et,ot.bearingInRadians),u.b7(Et,Et,ot.center.lat*Math.PI/180),u.bz(Et,Et,-ot.center.lng*Math.PI/180)),u.c5(We,We,Et),We})(G,L.transform),de=ue.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),ge=j.properties.get("atmosphere-blend")*de.projectionTransition;if(ge===0)return;const le=dl(ue.worldSize,ue.center.lat),Se=ue.inverseProjectionMatrix,Oe=new Float64Array(4);Oe[3]=1,u.aw(Oe,Oe,ue.modelViewProjectionMatrix),Oe[0]/=Oe[3],Oe[1]/=Oe[3],Oe[2]/=Oe[3],Oe[3]=1,u.aw(Oe,Oe,Se),Oe[0]/=Oe[3],Oe[1]/=Oe[3],Oe[2]/=Oe[3],Oe[3]=1;const ze=((Le,ot,ct,We,Et)=>({u_sun_pos:Le,u_atmosphere_blend:ot,u_globe_position:ct,u_globe_radius:We,u_inv_proj_matrix:Et}))(oe,ge,[Oe[0],Oe[1],Oe[2]],le,Se),ke=Cs(ee,j);te.draw(ee,J.TRIANGLES,ae,fi.disabled,Ui.alphaBlended,jt.disabled,ze,null,null,"atmosphere",ke.vertexBuffer,ke.indexBuffer,ke.segments)})(this,this.style.sky,this.style.light),this.options.showTileBoundaries){const L=(function(j,G){let ee=null;const J=Object.values(j._layers).flatMap((oe=>oe.source&&!oe.isHidden(G)?[j.sourceCaches[oe.source]]:[])),te=J.filter((oe=>oe.getSource().type==="vector")),ae=J.filter((oe=>oe.getSource().type!=="vector")),ue=oe=>{(!ee||ee.getSource().maxzoom<oe.getSource().maxzoom)&&(ee=oe)};return te.forEach((oe=>ue(oe))),ee||ae.forEach((oe=>ue(oe))),ee})(this.style,this.transform.zoom);L&&(function(j,G,ee){for(let J=0;J<ee.length;J++)vn(j,G,ee[J])})(this,L,L.getVisibleCoordinates())}this.options.showPadding&&(function(L){const j=L.transform.padding;cu(L,L.transform.height-(j.top||0),3,Ci),cu(L,j.bottom||0,3,eo),lr(L,j.left||0,3,sa),lr(L,L.transform.width-(j.right||0),3,bc);const G=L.transform.centerPoint;(function(ee,J,te,ae){Hn(ee,J-1,te-10,2,20,ae),Hn(ee,J-10,te-1,20,2,ae)})(L,G.x,L.transform.height-G.y,Vo)})(this),this.context.setDefault()}maybeDrawDepthAndCoords(e){if(!this.style||!this.style.map||!this.style.map.terrain)return;const a=this.terrainFacilitator.matrix,l=this.transform.modelViewProjectionMatrix;let d=this.terrainFacilitator.dirty;d||(d=e?!u.c8(a,l):!u.c9(a,l)),d||(d=this.style.map.terrain.sourceCache.anyTilesAfterTime(this.terrainFacilitator.renderTime)),d&&(u.ca(a,l),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,(function(m,y){const w=m.context,S=w.gl,P=m.transform,k=Ui.unblended,B=new $t(S.LEQUAL,$t.ReadWrite,[0,1]),L=y.sourceCache.getRenderableTiles(),j=m.useProgram("terrainDepth");w.bindFramebuffer.set(y.getFramebuffer("depth").framebuffer),w.viewport.set([0,0,m.width/devicePixelRatio,m.height/devicePixelRatio]),w.clear({color:u.bf.transparent,depth:1});for(const G of L){const ee=y.getTerrainMesh(G.tileID),J=y.getTerrainData(G.tileID),te=P.getProjectionData({overscaledTileID:G.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),ae={u_ele_delta:y.getMeshFrameDelta(P.zoom)};j.draw(w,S.TRIANGLES,B,fi.disabled,k,jt.backCCW,ae,J,te,"terrain",ee.vertexBuffer,ee.indexBuffer,ee.segments)}w.bindFramebuffer.set(null),w.viewport.set([0,0,m.width,m.height])})(this,this.style.map.terrain),(function(m,y){const w=m.context,S=w.gl,P=m.transform,k=Ui.unblended,B=new $t(S.LEQUAL,$t.ReadWrite,[0,1]),L=y.getCoordsTexture(),j=y.sourceCache.getRenderableTiles(),G=m.useProgram("terrainCoords");w.bindFramebuffer.set(y.getFramebuffer("coords").framebuffer),w.viewport.set([0,0,m.width/devicePixelRatio,m.height/devicePixelRatio]),w.clear({color:u.bf.transparent,depth:1}),y.coordsIndex=[];for(const ee of j){const J=y.getTerrainMesh(ee.tileID),te=y.getTerrainData(ee.tileID);w.activeTexture.set(S.TEXTURE0),S.bindTexture(S.TEXTURE_2D,L.texture);const ae={u_terrain_coords_id:(255-y.coordsIndex.length)/255,u_texture:0,u_ele_delta:y.getMeshFrameDelta(P.zoom)},ue=P.getProjectionData({overscaledTileID:ee.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});G.draw(w,S.TRIANGLES,B,fi.disabled,k,jt.backCCW,ae,te,ue,"terrain",J.vertexBuffer,J.indexBuffer,J.segments),y.coordsIndex.push(ee.tileID.key)}w.bindFramebuffer.set(null),w.viewport.set([0,0,m.width,m.height])})(this,this.style.map.terrain))}renderLayer(e,a,l,d,m){l.isHidden(this.transform.zoom)||(l.type==="background"||l.type==="custom"||(d||[]).length)&&(this.id=l.id,u.cb(l)?(function(y,w,S,P,k,B){if(y.renderPass!=="translucent")return;const{isRenderingToTexture:L}=B,j=fi.disabled,G=y.colorModeForRenderPass();(S._unevaluatedLayout.hasValue("text-variable-anchor")||S._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&(function(ee,J,te,ae,ue,oe,de,ge,le){const Se=J.transform,Oe=J.style.map.terrain,ze=ue==="map",ke=oe==="map";for(const Le of ee){const ot=ae.getTile(Le),ct=ot.getBucket(te);if(!ct||!ct.text||!ct.text.segments.get().length)continue;const We=u.an(ct.textSizeData,Se.zoom),Et=u.aC(ot,1,J.transform.zoom),ii=Fi(ze,J.transform,Et),vi=te.layout.get("icon-text-fit")!=="none"&&ct.hasIconData();if(We){const Ii=Math.pow(2,Se.zoom-ot.tileID.overscaledZ),Pi=Oe?(cr,rr)=>Oe.getElevation(Le,cr,rr):null;xc(ct,ze,ke,le,Se,ii,Ii,We,vi,u.aD(Se,ot,de,ge),Le.toUnwrapped(),Pi)}}})(P,y,S,w,S.layout.get("text-rotation-alignment"),S.layout.get("text-pitch-alignment"),S.paint.get("text-translate"),S.paint.get("text-translate-anchor"),k),S.paint.get("icon-opacity").constantOr(1)!==0&&cs(y,w,S,P,!1,S.paint.get("icon-translate"),S.paint.get("icon-translate-anchor"),S.layout.get("icon-rotation-alignment"),S.layout.get("icon-pitch-alignment"),S.layout.get("icon-keep-upright"),j,G,L),S.paint.get("text-opacity").constantOr(1)!==0&&cs(y,w,S,P,!0,S.paint.get("text-translate"),S.paint.get("text-translate-anchor"),S.layout.get("text-rotation-alignment"),S.layout.get("text-pitch-alignment"),S.layout.get("text-keep-upright"),j,G,L),w.map.showCollisionBoxes&&(lh(y,w,S,P,!0),lh(y,w,S,P,!1))})(e,a,l,d,this.style.placement.variableOffsets,m):u.cc(l)?(function(y,w,S,P,k){if(y.renderPass!=="translucent")return;const{isRenderingToTexture:B}=k,L=S.paint.get("circle-opacity"),j=S.paint.get("circle-stroke-width"),G=S.paint.get("circle-stroke-opacity"),ee=!S.layout.get("circle-sort-key").isConstant();if(L.constantOr(1)===0&&(j.constantOr(1)===0||G.constantOr(1)===0))return;const J=y.context,te=J.gl,ae=y.transform,ue=y.getDepthModeForSublayer(0,$t.ReadOnly),oe=fi.disabled,de=y.colorModeForRenderPass(),ge=[],le=ae.getCircleRadiusCorrection();for(let Se=0;Se<P.length;Se++){const Oe=P[Se],ze=w.getTile(Oe),ke=ze.getBucket(S);if(!ke)continue;const Le=S.paint.get("circle-translate"),ot=S.paint.get("circle-translate-anchor"),ct=u.aD(ae,ze,Le,ot),We=ke.programConfigurations.get(S.id),Et=y.useProgram("circle",We),ii=ke.layoutVertexBuffer,vi=ke.indexBuffer,Ii=y.style.map.terrain&&y.style.map.terrain.getTerrainData(Oe),Pi={programConfiguration:We,program:Et,layoutVertexBuffer:ii,indexBuffer:vi,uniformValues:Qh(y,ze,S,ct,le),terrainData:Ii,projectionData:ae.getProjectionData({overscaledTileID:Oe,applyGlobeMatrix:!B,applyTerrainMatrix:!0})};if(ee){const cr=ke.segments.get();for(const rr of cr)ge.push({segments:new u.aM([rr]),sortKey:rr.sortKey,state:Pi})}else ge.push({segments:ke.segments,sortKey:0,state:Pi})}ee&&ge.sort(((Se,Oe)=>Se.sortKey-Oe.sortKey));for(const Se of ge){const{programConfiguration:Oe,program:ze,layoutVertexBuffer:ke,indexBuffer:Le,uniformValues:ot,terrainData:ct,projectionData:We}=Se.state;ze.draw(J,te.TRIANGLES,ue,oe,de,jt.backCCW,ot,ct,We,S.id,ke,Le,Se.segments,S.paint,y.transform.zoom,Oe)}})(e,a,l,d,m):u.cd(l)?(function(y,w,S,P,k){if(S.paint.get("heatmap-opacity")===0)return;const B=y.context,{isRenderingToTexture:L,isRenderingGlobe:j}=k;if(y.style.map.terrain){for(const G of P){const ee=w.getTile(G);w.hasRenderableParent(G)||(y.renderPass==="offscreen"?Tl(y,ee,S,G,j):y.renderPass==="translucent"&&na(y,S,G,L,j))}B.viewport.set([0,0,y.width,y.height])}else y.renderPass==="offscreen"?(function(G,ee,J,te){const ae=G.context,ue=ae.gl,oe=G.transform,de=fi.disabled,ge=new Ui([ue.ONE,ue.ONE],u.bf.transparent,[!0,!0,!0,!0]);(function(le,Se,Oe){const ze=le.gl;le.activeTexture.set(ze.TEXTURE1),le.viewport.set([0,0,Se.width/4,Se.height/4]);let ke=Oe.heatmapFbos.get(u.c2);ke?(ze.bindTexture(ze.TEXTURE_2D,ke.colorAttachment.get()),le.bindFramebuffer.set(ke.framebuffer)):(ke=xn(le,Se.width/4,Se.height/4),Oe.heatmapFbos.set(u.c2,ke))})(ae,G,J),ae.clear({color:u.bf.transparent});for(let le=0;le<te.length;le++){const Se=te[le];if(ee.hasRenderableParent(Se))continue;const Oe=ee.getTile(Se),ze=Oe.getBucket(J);if(!ze)continue;const ke=ze.programConfigurations.get(J.id),Le=G.useProgram("heatmap",ke),ot=oe.getProjectionData({overscaledTileID:Se,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),ct=oe.getCircleRadiusCorrection();Le.draw(ae,ue.TRIANGLES,$t.disabled,de,ge,jt.backCCW,Jh(Oe,oe.zoom,J.paint.get("heatmap-intensity"),ct),null,ot,J.id,ze.layoutVertexBuffer,ze.indexBuffer,ze.segments,J.paint,oe.zoom,ke)}ae.viewport.set([0,0,G.width,G.height])})(y,w,S,P):y.renderPass==="translucent"&&(function(G,ee){const J=G.context,te=J.gl;J.setColorMode(G.colorModeForRenderPass());const ae=ee.heatmapFbos.get(u.c2);ae&&(J.activeTexture.set(te.TEXTURE0),te.bindTexture(te.TEXTURE_2D,ae.colorAttachment.get()),J.activeTexture.set(te.TEXTURE1),Oa(J,ee).bind(te.LINEAR,te.CLAMP_TO_EDGE),G.useProgram("heatmapTexture").draw(J,te.TRIANGLES,$t.disabled,fi.disabled,G.colorModeForRenderPass(),jt.disabled,th(G,ee,0,1),null,null,ee.id,G.viewportBuffer,G.quadTriangleIndexBuffer,G.viewportSegments,ee.paint,G.transform.zoom))})(y,S)})(e,a,l,d,m):u.ce(l)?(function(y,w,S,P,k){if(y.renderPass!=="translucent")return;const{isRenderingToTexture:B}=k,L=S.paint.get("line-opacity"),j=S.paint.get("line-width");if(L.constantOr(1)===0||j.constantOr(1)===0)return;const G=y.getDepthModeForSublayer(0,$t.ReadOnly),ee=y.colorModeForRenderPass(),J=S.paint.get("line-dasharray"),te=S.paint.get("line-pattern"),ae=te.constantOr(1),ue=S.paint.get("line-gradient"),oe=S.getCrossfadeParameters(),de=ae?"linePattern":J?"lineSDF":ue?"lineGradient":"line",ge=y.context,le=ge.gl,Se=y.transform;let Oe=!0;for(const ze of P){const ke=w.getTile(ze);if(ae&&!ke.patternsLoaded())continue;const Le=ke.getBucket(S);if(!Le)continue;const ot=Le.programConfigurations.get(S.id),ct=y.context.program.get(),We=y.useProgram(de,ot),Et=Oe||We.program!==ct,ii=y.style.map.terrain&&y.style.map.terrain.getTerrainData(ze),vi=te.constantOr(null);if(vi&&ke.imageAtlas){const Wt=ke.imageAtlas,Ri=Wt.patternPositions[vi.to.toString()],Sr=Wt.patternPositions[vi.from.toString()];Ri&&Sr&&ot.setConstantPatternPositions(Ri,Sr)}const Ii=Se.getProjectionData({overscaledTileID:ze,applyGlobeMatrix:!B,applyTerrainMatrix:!0}),Pi=Se.getPixelScale(),cr=ae?rh(y,ke,S,Pi,oe):J?Hs(y,ke,S,Pi,J,oe):ue?lc(y,ke,S,Pi,Le.lineClipsArray.length):iu(y,ke,S,Pi);if(ae)ge.activeTexture.set(le.TEXTURE0),ke.imageAtlasTexture.bind(le.LINEAR,le.CLAMP_TO_EDGE),ot.updatePaintBuffers(oe);else if(J&&(Et||y.lineAtlas.dirty))ge.activeTexture.set(le.TEXTURE0),y.lineAtlas.bind(ge);else if(ue){const Wt=Le.gradients[S.id];let Ri=Wt.texture;if(S.gradientVersion!==Wt.version){let Sr=256;if(S.stepInterpolant){const Ur=w.getSource().maxzoom,Hr=ze.canonical.z===Ur?Math.ceil(1<<y.transform.maxZoom-ze.canonical.z):1;Sr=u.ah(u.c3(Le.maxLineLength/u.$*1024*Hr),256,ge.maxTextureSize)}Wt.gradient=u.c4({expression:S.gradientExpression(),evaluationKey:"lineProgress",resolution:Sr,image:Wt.gradient||void 0,clips:Le.lineClipsArray}),Wt.texture?Wt.texture.update(Wt.gradient):Wt.texture=new u.T(ge,Wt.gradient,le.RGBA),Wt.version=S.gradientVersion,Ri=Wt.texture}ge.activeTexture.set(le.TEXTURE0),Ri.bind(S.stepInterpolant?le.NEAREST:le.LINEAR,le.CLAMP_TO_EDGE)}const rr=y.stencilModeForClipping(ze);We.draw(ge,le.TRIANGLES,G,rr,ee,jt.disabled,cr,ii,Ii,S.id,Le.layoutVertexBuffer,Le.indexBuffer,Le.segments,S.paint,y.transform.zoom,ot,Le.layoutVertexBuffer2),Oe=!1}})(e,a,l,d,m):u.cf(l)?(function(y,w,S,P,k){const B=S.paint.get("fill-color"),L=S.paint.get("fill-opacity");if(L.constantOr(1)===0)return;const{isRenderingToTexture:j}=k,G=y.colorModeForRenderPass(),ee=S.paint.get("fill-pattern"),J=y.opaquePassEnabledForLayer()&&!ee.constantOr(1)&&B.constantOr(u.bf.transparent).a===1&&L.constantOr(0)===1?"opaque":"translucent";if(y.renderPass===J){const te=y.getDepthModeForSublayer(1,y.renderPass==="opaque"?$t.ReadWrite:$t.ReadOnly);ga(y,w,S,P,te,G,!1,j)}if(y.renderPass==="translucent"&&S.paint.get("fill-antialias")){const te=y.getDepthModeForSublayer(S.getPaintProperty("fill-outline-color")?2:0,$t.ReadOnly);ga(y,w,S,P,te,G,!0,j)}})(e,a,l,d,m):u.cg(l)?(function(y,w,S,P,k){const B=S.paint.get("fill-extrusion-opacity");if(B===0)return;const{isRenderingToTexture:L}=k;if(y.renderPass==="translucent"){const j=new $t(y.context.gl.LEQUAL,$t.ReadWrite,y.depthRangeFor3D);if(B!==1||S.paint.get("fill-extrusion-pattern").constantOr(1))Ms(y,w,S,P,j,fi.disabled,Ui.disabled,L),Ms(y,w,S,P,j,y.stencilModeFor3D(),y.colorModeForRenderPass(),L);else{const G=y.colorModeForRenderPass();Ms(y,w,S,P,j,fi.disabled,G,L)}}})(e,a,l,d,m):u.ch(l)?(function(y,w,S,P,k){if(y.renderPass!=="offscreen"&&y.renderPass!=="translucent")return;const{isRenderingToTexture:B}=k,L=y.context,j=y.style.projection.useSubdivision,G=y.getDepthModeForSublayer(0,$t.ReadOnly),ee=y.colorModeForRenderPass();if(y.renderPass==="offscreen")(function(J,te,ae,ue,oe,de,ge){const le=J.context,Se=le.gl;for(const Oe of ae){const ze=te.getTile(Oe),ke=ze.dem;if(!ke||!ke.data||!ze.needsHillshadePrepare)continue;const Le=ke.dim,ot=ke.stride,ct=ke.getPixels();if(le.activeTexture.set(Se.TEXTURE1),le.pixelStoreUnpackPremultiplyAlpha.set(!1),ze.demTexture=ze.demTexture||J.getTileTexture(ot),ze.demTexture){const Et=ze.demTexture;Et.update(ct,{premultiply:!1}),Et.bind(Se.NEAREST,Se.CLAMP_TO_EDGE)}else ze.demTexture=new u.T(le,ct,Se.RGBA,{premultiply:!1}),ze.demTexture.bind(Se.NEAREST,Se.CLAMP_TO_EDGE);le.activeTexture.set(Se.TEXTURE0);let We=ze.fbo;if(!We){const Et=new u.T(le,{width:Le,height:Le,data:null},Se.RGBA);Et.bind(Se.LINEAR,Se.CLAMP_TO_EDGE),We=ze.fbo=le.createFramebuffer(Le,Le,!0,!1),We.colorAttachment.set(Et.texture)}le.bindFramebuffer.set(We.framebuffer),le.viewport.set([0,0,Le,Le]),J.useProgram("hillshadePrepare").draw(le,Se.TRIANGLES,oe,de,ge,jt.disabled,ih(ze.tileID,ke),null,null,ue.id,J.rasterBoundsBuffer,J.quadTriangleIndexBuffer,J.rasterBoundsSegments),ze.needsHillshadePrepare=!1}})(y,w,P,S,G,fi.disabled,ee),L.viewport.set([0,0,y.width,y.height]);else if(y.renderPass==="translucent")if(j){const[J,te,ae]=y.stencilConfigForOverlapTwoPass(P);Js(y,w,S,ae,J,G,ee,!1,B),Js(y,w,S,ae,te,G,ee,!0,B)}else{const[J,te]=y.getStencilConfigForOverlapAndUpdateStencilID(P);Js(y,w,S,te,J,G,ee,!1,B)}})(e,a,l,d,m):u.ci(l)?(function(y,w,S,P,k){if(y.renderPass!=="translucent"||!P.length)return;const{isRenderingToTexture:B}=k,L=y.style.projection.useSubdivision,j=y.getDepthModeForSublayer(0,$t.ReadOnly),G=y.colorModeForRenderPass();if(L){const[ee,J,te]=y.stencilConfigForOverlapTwoPass(P);vc(y,w,S,te,ee,j,G,!1,B),vc(y,w,S,te,J,j,G,!0,B)}else{const[ee,J]=y.getStencilConfigForOverlapAndUpdateStencilID(P);vc(y,w,S,J,ee,j,G,!1,B)}})(e,a,l,d,m):u.cj(l)?(function(y,w,S,P,k){if(y.renderPass!=="translucent"||S.paint.get("raster-opacity")===0||!P.length)return;const{isRenderingToTexture:B}=k,L=w.getSource(),j=y.style.projection.useSubdivision;if(L instanceof Wn)Lr(y,w,S,P,null,!1,!1,L.tileCoords,L.flippedWindingOrder,B);else if(j){const[G,ee,J]=y.stencilConfigForOverlapTwoPass(P);Lr(y,w,S,J,G,!1,!0,Ml,!1,B),Lr(y,w,S,J,ee,!0,!0,Ml,!1,B)}else{const[G,ee]=y.getStencilConfigForOverlapAndUpdateStencilID(P);Lr(y,w,S,ee,G,!1,!0,Ml,!1,B)}})(e,a,l,d,m):u.ck(l)?(function(y,w,S,P,k){const B=S.paint.get("background-color"),L=S.paint.get("background-opacity");if(L===0)return;const{isRenderingToTexture:j}=k,G=y.context,ee=G.gl,J=y.style.projection,te=y.transform,ae=te.tileSize,ue=S.paint.get("background-pattern");if(y.isPatternMissing(ue))return;const oe=!ue&&B.a===1&&L===1&&y.opaquePassEnabledForLayer()?"opaque":"translucent";if(y.renderPass!==oe)return;const de=fi.disabled,ge=y.getDepthModeForSublayer(0,oe==="opaque"?$t.ReadWrite:$t.ReadOnly),le=y.colorModeForRenderPass(),Se=y.useProgram(ue?"backgroundPattern":"background"),Oe=P||Me(te,{tileSize:ae,terrain:y.style.map.terrain});ue&&(G.activeTexture.set(ee.TEXTURE0),y.imageManager.bind(y.context));const ze=S.getCrossfadeParameters();for(const ke of Oe){const Le=te.getProjectionData({overscaledTileID:ke,applyGlobeMatrix:!j,applyTerrainMatrix:!0}),ot=ue?nd(L,y,ue,{tileID:ke,tileSize:ae},ze):rd(L,B),ct=y.style.map.terrain&&y.style.map.terrain.getTerrainData(ke),We=J.getMeshFromTileID(G,ke.canonical,!1,!0,"raster");Se.draw(G,ee.TRIANGLES,ge,de,le,jt.backCCW,ot,ct,Le,S.id,We.vertexBuffer,We.indexBuffer,We.segments)}})(e,0,l,d,m):u.cl(l)&&(function(y,w,S,P){const{isRenderingGlobe:k}=P,B=y.context,L=S.implementation,j=y.style.projection,G=y.transform,ee=G.getProjectionDataForCustomLayer(k),J={farZ:G.farZ,nearZ:G.nearZ,fov:G.fov*Math.PI/180,modelViewProjectionMatrix:G.modelViewProjectionMatrix,projectionMatrix:G.projectionMatrix,shaderData:{variantName:j.shaderVariantName,vertexShaderPrelude:`const float PI = 3.141592653589793;
910uniform mat4 u_projection_matrix;
911${j.shaderPreludeCode.vertexSource}`,define:j.shaderDefine},defaultProjectionData:ee},te=L.renderingMode?L.renderingMode:"2d";if(y.renderPass==="offscreen"){const ae=L.prerender;ae&&(y.setCustomLayerDefaults(),B.setColorMode(y.colorModeForRenderPass()),ae.call(L,B.gl,J),B.setDirty(),y.setBaseState())}else if(y.renderPass==="translucent"){y.setCustomLayerDefaults(),B.setColorMode(y.colorModeForRenderPass()),B.setStencilMode(fi.disabled);const ae=te==="3d"?y.getDepthModeFor3D():y.getDepthModeForSublayer(0,$t.ReadOnly);B.setDepthMode(ae),L.render(B.gl,J),B.setDirty(),y.setBaseState(),B.bindFramebuffer.set(null)}})(e,0,l,m))}saveTileTexture(e){const a=this._tileTextures[e.size[0]];a?a.push(e):this._tileTextures[e.size[0]]=[e]}getTileTexture(e){const a=this._tileTextures[e];return a&&a.length>0?a.pop():null}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;const a=this.imageManager.getPattern(e.from.toString()),l=this.imageManager.getPattern(e.to.toString());return!a||!l}useProgram(e,a,l=!1,d=[]){this.cache=this.cache||{};const m=!!this.style.map.terrain,y=this.style.projection,w=l?La.projectionMercator:y.shaderPreludeCode,S=l?xs:y.shaderDefine,P=e+(a?a.cacheKey:"")+`/${l?Eo:y.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(m?"/terrain":"")+(d?`/${d.join("/")}`:"");return this.cache[P]||(this.cache[P]=new eh(this.context,La[e],a,Dn[e],this._showOverdrawInspector,m,w,S,d)),this.cache[P]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const 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(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new u.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:e,drawingBufferHeight:a}=this.context.gl;return this.width!==e||this.height!==a}}function oa(f,e){let a,l=!1,d=null,m=null;const y=()=>{d=null,l&&(f.apply(m,a),d=setTimeout(y,e),l=!1)};return(...w)=>(l=!0,m=this,a=w,d||y(),d)}class _a{constructor(e){this._getCurrentHash=()=>{const a=window.location.hash.replace("#","");if(this._hashName){let l;return a.split("&").map((d=>d.split("="))).forEach((d=>{d[0]===this._hashName&&(l=d)})),(l&&l[1]||"").split("/")}return a.split("/")},this._onHashChange=()=>{const a=this._getCurrentHash();if(!this._isValidHash(a))return!1;const l=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(a[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+a[2],+a[1]],zoom:+a[0],bearing:l,pitch:+(a[4]||0)}),!0},this._updateHashUnthrottled=()=>{const a=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,a)},this._removeHash=()=>{const a=this._getCurrentHash();if(a.length===0)return;const l=a.join("/");let d=l;d.split("&").length>0&&(d=d.split("&")[0]),this._hashName&&(d=`${this._hashName}=${l}`);let m=window.location.hash.replace(d,"");m.startsWith("#&")?m=m.slice(0,1)+m.slice(2):m==="#"&&(m="");let y=window.location.href.replace(/(#.+)?$/,m);y=y.replace("&&","&"),window.history.replaceState(window.history.state,null,y)},this._updateHash=oa(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 a=this._map.getCenter(),l=Math.round(100*this._map.getZoom())/100,d=Math.ceil((l*Math.LN2+Math.log(512/360/.5))/Math.LN10),m=Math.pow(10,d),y=Math.round(a.lng*m)/m,w=Math.round(a.lat*m)/m,S=this._map.getBearing(),P=this._map.getPitch();let k="";if(k+=e?`/${y}/${w}/${l}`:`${l}/${w}/${y}`,(S||P)&&(k+="/"+Math.round(10*S)/10),P&&(k+=`/${Math.round(P)}`),this._hashName){const B=this._hashName;let L=!1;const j=window.location.hash.slice(1).split("&").map((G=>{const ee=G.split("=")[0];return ee===B?(L=!0,`${ee}=${k}`):G})).filter((G=>G));return L||j.push(`${B}=${k}`),`#${j.join("&")}`}return`#${k}`}_isValidHash(e){if(e.length<3||e.some(isNaN))return!1;try{new u.S(+e[2],+e[1])}catch{return!1}const a=+e[0],l=+(e[3]||0),d=+(e[4]||0);return a>=this._map.getMinZoom()&&a<=this._map.getMaxZoom()&&l>=-180&&l<=180&&d>=this._map.getMinPitch()&&d<=this._map.getMaxPitch()}}const bn={linearity:.3,easing:u.cm(0,0,.3,1)},ja=u.e({deceleration:2500,maxSpeed:1400},bn),hu=u.e({deceleration:20,maxSpeed:1400},bn),du=u.e({deceleration:1e3,maxSpeed:360},bn),Cl=u.e({deceleration:1e3,maxSpeed:90},bn),Sc=u.e({deceleration:1e3,maxSpeed:360},bn);class to{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:Ce.now(),settings:e})}_drainInertiaBuffer(){const e=this._inertiaBuffer,a=Ce.now();for(;e.length>0&&a-e[0].time>160;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const a={zoom:0,bearing:0,pitch:0,roll:0,pan:new u.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:m}of this._inertiaBuffer)a.zoom+=m.zoomDelta||0,a.bearing+=m.bearingDelta||0,a.pitch+=m.pitchDelta||0,a.roll+=m.rollDelta||0,m.panDelta&&a.pan._add(m.panDelta),m.around&&(a.around=m.around),m.pinchAround&&(a.pinchAround=m.pinchAround);const l=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,d={};if(a.pan.mag()){const m=Es(a.pan.mag(),l,u.e({},ja,e||{})),y=a.pan.mult(m.amount/a.pan.mag()),w=this._map.cameraHelper.handlePanInertia(y,this._map.transform);d.center=w.easingCenter,d.offset=w.easingOffset,Xi(d,m)}if(a.zoom){const m=Es(a.zoom,l,hu);d.zoom=this._map.transform.zoom+m.amount,Xi(d,m)}if(a.bearing){const m=Es(a.bearing,l,du);d.bearing=this._map.transform.bearing+u.ah(m.amount,-179,179),Xi(d,m)}if(a.pitch){const m=Es(a.pitch,l,Cl);d.pitch=this._map.transform.pitch+m.amount,Xi(d,m)}if(a.roll){const m=Es(a.roll,l,Sc);d.roll=this._map.transform.roll+u.ah(m.amount,-179,179),Xi(d,m)}if(d.zoom||d.bearing){const m=a.pinchAround===void 0?a.around:a.pinchAround;d.around=m?this._map.unproject(m):this._map.getCenter()}return this.clear(),u.e(d,{noMoveStart:!0})}}function Xi(f,e){(!f.duration||f.duration<e.duration)&&(f.duration=e.duration,f.easing=e.easing)}function Es(f,e,a){const{maxSpeed:l,linearity:d,deceleration:m}=a,y=u.ah(f*d/(e/1e3),-l,l),w=Math.abs(y)/(m*d);return{easing:a.easing,duration:1e3*w,amount:y*(w/2)}}class Bn extends u.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,a,l,d={}){l=l instanceof MouseEvent?l:new MouseEvent(e,l);const m=ie.mousePos(a.getCanvas(),l),y=a.unproject(m);super(e,u.e({point:m,lngLat:y,originalEvent:l},d)),this._defaultPrevented=!1,this.target=a}}class El extends u.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,a,l){const d=e==="touchend"?l.changedTouches:l.touches,m=ie.touchPos(a.getCanvasContainer(),d),y=m.map((S=>a.unproject(S))),w=m.reduce(((S,P,k,B)=>S.add(P.div(B.length))),new u.P(0,0));super(e,{points:m,point:w,lngLats:y,lngLat:a.unproject(w),originalEvent:l}),this._defaultPrevented=!1}}class uh extends u.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,a,l){super(e,{originalEvent:l}),this._defaultPrevented=!1}}class ld{constructor(e,a){this._map=e,this._clickTolerance=a.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new uh(e.type,this._map,e))}mousedown(e,a){return this._mousedownPos=a,this._firePreventable(new Bn(e.type,this._map,e))}mouseup(e){this._map.fire(new Bn(e.type,this._map,e))}click(e,a){this._mousedownPos&&this._mousedownPos.dist(a)>=this._clickTolerance||this._map.fire(new Bn(e.type,this._map,e))}dblclick(e){return this._firePreventable(new Bn(e.type,this._map,e))}mouseover(e){this._map.fire(new Bn(e.type,this._map,e))}mouseout(e){this._map.fire(new Bn(e.type,this._map,e))}touchstart(e){return this._firePreventable(new El(e.type,this._map,e))}touchmove(e){this._map.fire(new El(e.type,this._map,e))}touchend(e){this._map.fire(new El(e.type,this._map,e))}touchcancel(e){this._map.fire(new El(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Fr{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new Bn(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Bn("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new Bn(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class io{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(u.P.convert(e),this._map.terrain)}}class Go{constructor(e,a){this._map=e,this._tr=new io(e),this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=a.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,a){this.isEnabled()&&e.shiftKey&&e.button===0&&(ie.disableDrag(),this._startPos=this._lastPos=a,this._active=!0)}mousemoveWindow(e,a){if(!this._active)return;const l=a;if(this._lastPos.equals(l)||!this._box&&l.dist(this._startPos)<this._clickTolerance)return;const d=this._startPos;this._lastPos=l,this._box||(this._box=ie.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",e));const m=Math.min(d.x,l.x),y=Math.max(d.x,l.x),w=Math.min(d.y,l.y),S=Math.max(d.y,l.y);ie.setTransform(this._box,`translate(${m}px,${w}px)`),this._box.style.width=y-m+"px",this._box.style.height=S-w+"px"}mouseupWindow(e,a){if(!this._active||e.button!==0)return;const l=this._startPos,d=a;if(this.reset(),ie.suppressClick(),l.x!==d.x||l.y!==d.y)return this._map.fire(new u.l("boxzoomend",{originalEvent:e})),{cameraAnimation:m=>m.fitScreenCoordinates(l,d,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",e)}keydown(e){this._active&&e.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",e))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(ie.remove(this._box),this._box=null),ie.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,a){return this._map.fire(new u.l(e,{originalEvent:a}))}}function us(f,e){if(f.length!==e.length)throw new Error(`The number of touches and points are not equal - touches ${f.length}, points ${e.length}`);const a={};for(let l=0;l<f.length;l++)a[f[l].identifier]=e[l];return a}class fu{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,a,l){(this.centroid||l.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=e.timeStamp),l.length===this.numTouches&&(this.centroid=(function(d){const m=new u.P(0,0);for(const y of d)m._add(y);return m.div(d.length)})(a),this.touches=us(l,a)))}touchmove(e,a,l){if(this.aborted||!this.centroid)return;const d=us(l,a);for(const m in this.touches){const y=d[m];(!y||y.dist(this.touches[m])>30)&&(this.aborted=!0)}}touchend(e,a,l){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),l.length===0){const d=!this.aborted&&this.centroid;if(this.reset(),d)return d}}}class $r{constructor(e){this.singleTap=new fu(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,a,l){this.singleTap.touchstart(e,a,l)}touchmove(e,a,l){this.singleTap.touchmove(e,a,l)}touchend(e,a,l){const d=this.singleTap.touchend(e,a,l);if(d){const m=e.timeStamp-this.lastTime<500,y=!this.lastTap||this.lastTap.dist(d)<30;if(m&&y||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=d,this.count===this.numTaps)return this.reset(),d}}}class wn{constructor(e){this._tr=new io(e),this._zoomIn=new $r({numTouches:1,numTaps:2}),this._zoomOut=new $r({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,a,l){this._zoomIn.touchstart(e,a,l),this._zoomOut.touchstart(e,a,l)}touchmove(e,a,l){this._zoomIn.touchmove(e,a,l),this._zoomOut.touchmove(e,a,l)}touchend(e,a,l){const d=this._zoomIn.touchend(e,a,l),m=this._zoomOut.touchend(e,a,l),y=this._tr;return d?(this._active=!0,e.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:w=>w.easeTo({duration:300,zoom:y.zoom+1,around:y.unproject(d)},{originalEvent:e})}):m?(this._active=!0,e.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:w=>w.easeTo({duration:300,zoom:y.zoom-1,around:y.unproject(m)},{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 Al{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 a=this._moveFunction(...e);if(a.bearingDelta||a.pitchDelta||a.rollDelta||a.around||a.panDelta)return this._active=!0,a}dragStart(e,a){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(e)&&(this._moveStateManager.startMove(e),this._lastPoint=Array.isArray(a)?a[0]:a,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(e,a){if(!this.isEnabled())return;const l=this._lastPoint;if(!l)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e))return void this.reset(e);const d=Array.isArray(a)?a[0]:a;return!this._moved&&d.dist(l)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=d,this._move(l,d))}dragEnd(e){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(e)&&(this._moved&&ie.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 ya=0,Pl=2,cd={[ya]:1,[Pl]:2};class Na{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){const a=ie.mouseButton(e);this._eventButton=a}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!(function(a,l){const d=cd[l];return a.buttons===void 0||(a.buttons&d)!==d})(e,this._eventButton)}isValidEndEvent(e){return ie.mouseButton(e)===this._eventButton}}class hh{constructor(){this._firstTouch=void 0}_isOneFingerTouch(e){return e.targetTouches.length===1}_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 pu{constructor(e=new Na({checkCorrectEvent:()=>!0}),a=new hh){this.mouseMoveStateManager=e,this.oneFingerTouchMoveStateManager=a}_executeRelevantHandler(e,a,l){return e instanceof MouseEvent?a(e):typeof TouchEvent<"u"&&e instanceof TouchEvent?l(e):void 0}startMove(e){this._executeRelevantHandler(e,(a=>this.mouseMoveStateManager.startMove(a)),(a=>this.oneFingerTouchMoveStateManager.startMove(a)))}endMove(e){this._executeRelevantHandler(e,(a=>this.mouseMoveStateManager.endMove(a)),(a=>this.oneFingerTouchMoveStateManager.endMove(a)))}isValidStartEvent(e){return this._executeRelevantHandler(e,(a=>this.mouseMoveStateManager.isValidStartEvent(a)),(a=>this.oneFingerTouchMoveStateManager.isValidStartEvent(a)))}isValidMoveEvent(e){return this._executeRelevantHandler(e,(a=>this.mouseMoveStateManager.isValidMoveEvent(a)),(a=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(a)))}isValidEndEvent(e){return this._executeRelevantHandler(e,(a=>this.mouseMoveStateManager.isValidEndEvent(a)),(a=>this.oneFingerTouchMoveStateManager.isValidEndEvent(a)))}}const zl=f=>{f.mousedown=f.dragStart,f.mousemoveWindow=f.dragMove,f.mouseup=f.dragEnd,f.contextmenu=e=>{e.preventDefault()}};class As{constructor(e,a){this._clickTolerance=e.clickTolerance||1,this._map=a,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new u.P(0,0)}_shouldBePrevented(e){return e<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(e,a,l){return this._calculateTransform(e,a,l)}touchmove(e,a,l){if(this._active){if(!this._shouldBePrevented(l.length))return e.preventDefault(),this._calculateTransform(e,a,l);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",e)}}touchend(e,a,l){this._calculateTransform(e,a,l),this._active&&this._shouldBePrevented(l.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,a,l){l.length>0&&(this._active=!0);const d=us(l,a),m=new u.P(0,0),y=new u.P(0,0);let w=0;for(const P in d){const k=d[P],B=this._touches[P];B&&(m._add(k),y._add(k.sub(B)),w++,d[P]=k)}if(this._touches=d,this._shouldBePrevented(w)||!y.mag())return;const S=y.div(w);return this._sum._add(S),this._sum.mag()<this._clickTolerance?void 0:{around:m.div(w),panDelta:S}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class xa{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(e,a,l){this._firstTwoTouches||l.length<2||(this._firstTwoTouches=[l[0].identifier,l[1].identifier],this._start([a[0],a[1]]))}touchmove(e,a,l){if(!this._firstTwoTouches)return;e.preventDefault();const[d,m]=this._firstTwoTouches,y=yt(l,a,d),w=yt(l,a,m);if(!y||!w)return;const S=this._aroundCenter?null:y.add(w).div(2);return this._move([y,w],S,e)}touchend(e,a,l){if(!this._firstTwoTouches)return;const[d,m]=this._firstTwoTouches,y=yt(l,a,d),w=yt(l,a,m);y&&w||(this._active&&ie.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&e.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function yt(f,e,a){for(let l=0;l<f.length;l++)if(f[l].identifier===a)return e[l]}function Tc(f,e){return Math.log(f/e)/Math.LN2}class Mc extends xa{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,a){const l=this._distance;if(this._distance=e[0].dist(e[1]),this._active||!(Math.abs(Tc(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Tc(this._distance,l),pinchAround:a}}}function kl(f,e){return 180*f.angleWith(e)/Math.PI}class Zo extends xa{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,a,l){const d=this._vector;if(this._vector=e[0].sub(e[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:kl(this._vector,d),pinchAround:a}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());const a=25/(Math.PI*this._minDiameter)*360,l=kl(e,this._startVector);return Math.abs(l)<a}}function Fa(f){return Math.abs(f.y)>Math.abs(f.x)}class Cc extends xa{constructor(e){super(),this._currentTouchCount=0,this._map=e}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(e,a,l){super.touchstart(e,a,l),this._currentTouchCount=l.length}_start(e){this._lastPoints=e,Fa(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,a,l){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const d=e[0].sub(this._lastPoints[0]),m=e[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(d,m,l.timeStamp),this._valid?(this._lastPoints=e,this._active=!0,{pitchDelta:(d.y+m.y)/2*-.5}):void 0}gestureBeginsVertically(e,a,l){if(this._valid!==void 0)return this._valid;const d=e.mag()>=2,m=a.mag()>=2;if(!d&&!m)return;if(!d||!m)return this._firstMove===void 0&&(this._firstMove=l),l-this._firstMove<100&&void 0;const y=e.y>0==a.y>0;return Fa(e)&&Fa(a)&&y}}const ui={panStep:100,bearingStep:15,pitchStep:10};class Ua{constructor(e){this._tr=new io(e);const a=ui;this._panStep=a.panStep,this._bearingStep=a.bearingStep,this._pitchStep=a.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let a=0,l=0,d=0,m=0,y=0;switch(e.keyCode){case 61:case 107:case 171:case 187:a=1;break;case 189:case 109:case 173:a=-1;break;case 37:e.shiftKey?l=-1:(e.preventDefault(),m=-1);break;case 39:e.shiftKey?l=1:(e.preventDefault(),m=1);break;case 38:e.shiftKey?d=1:(e.preventDefault(),y=-1);break;case 40:e.shiftKey?d=-1:(e.preventDefault(),y=1);break;default:return}return this._rotationDisabled&&(l=0,d=0),{cameraAnimation:w=>{const S=this._tr;w.easeTo({duration:300,easeId:"keyboardHandler",easing:dh,zoom:a?Math.round(S.zoom)+a*(e.shiftKey?2:1):S.zoom,bearing:S.bearing+l*this._bearingStep,pitch:S.pitch+d*this._pitchStep,offset:[-m*this._panStep,-y*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 dh(f){return f*(2-f)}const Il=4.000244140625,ro=1/450;class Ps{constructor(e,a){this._onTimeout=l=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(l)},this._map=e,this._tr=new io(e),this._triggerRenderFrame=a,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=ro}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&e.around==="center")}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 a=e.deltaMode===WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY;const l=Ce.now(),d=l-(this._lastWheelEventTime||0);this._lastWheelEventTime=l,a!==0&&a%Il==0?this._type="wheel":a!==0&&Math.abs(a)<4?this._type="trackpad":d>400?(this._type=null,this._lastValue=a,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(d*a)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,a+=this._lastValue)),e.shiftKey&&a&&(a/=4),this._type&&(this._lastWheelEvent=e,this._delta-=a,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 a=ie.mousePos(this._map.getCanvas(),e),l=this._tr;this._aroundPoint=this._aroundCenter?l.transform.locationToScreenPoint(u.S.convert(l.center)):a,this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const e=this._tr.transform;if(typeof this._lastExpectedZoom=="number"){const w=e.zoom-this._lastExpectedZoom;typeof this._startZoom=="number"&&(this._startZoom+=w),typeof this._targetZoom=="number"&&(this._targetZoom+=w)}if(this._delta!==0){const w=this._type==="wheel"&&Math.abs(this._delta)>Il?this._wheelZoomRate:this._defaultZoomRate;let S=2/(1+Math.exp(-Math.abs(this._delta*w)));this._delta<0&&S!==0&&(S=1/S);const P=typeof this._targetZoom!="number"?e.scale:u.af(this._targetZoom);this._targetZoom=e.getConstrained(e.getCameraLngLat(),u.ak(P*S)).zoom,this._type==="wheel"&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const a=typeof this._targetZoom!="number"?e.zoom:this._targetZoom,l=this._startZoom,d=this._easing;let m,y=!1;if(this._type==="wheel"&&l&&d){const w=Ce.now()-this._lastWheelEventTime,S=Math.min((w+5)/200,1),P=d(S);m=u.C.number(l,a,P),S<1?this._frameId||(this._frameId=!0):y=!0}else m=a,y=!0;return this._active=!0,y&&(this._active=!1,this._finishTimeout=setTimeout((()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout}),200)),this._lastExpectedZoom=m,{noInertia:!0,needsRenderFrame:!y,zoomDelta:m-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let a=u.co;if(this._prevEase){const l=this._prevEase,d=(Ce.now()-l.start)/l.duration,m=l.easing(d+.01)-l.easing(d),y=.27/Math.sqrt(m*m+1e-4)*.01,w=Math.sqrt(.0729-y*y);a=u.cm(y,w,.25,1)}return this._prevEase={start:Ce.now(),duration:e,easing:a},a}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class qo{constructor(e,a){this._clickZoom=e,this._tapZoom=a}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class Ec{constructor(e){this._tr=new io(e),this.reset()}reset(){this._active=!1}dblclick(e,a){return e.preventDefault(),{cameraAnimation:l=>{l.easeTo({duration:300,zoom:this._tr.zoom+(e.shiftKey?-1:1),around:this._tr.unproject(a)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class mu{constructor(){this._tap=new $r({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,a,l){if(!this._swipePoint)if(this._tapTime){const d=a[0],m=e.timeStamp-this._tapTime<500,y=this._tapPoint.dist(d)<30;m&&y?l.length>0&&(this._swipePoint=d,this._swipeTouch=l[0].identifier):this.reset()}else this._tap.touchstart(e,a,l)}touchmove(e,a,l){if(this._tapTime){if(this._swipePoint){if(l[0].identifier!==this._swipeTouch)return;const d=a[0],m=d.y-this._swipePoint.y;return this._swipePoint=d,e.preventDefault(),this._active=!0,{zoomDelta:m/128}}}else this._tap.touchmove(e,a,l)}touchend(e,a,l){if(this._tapTime)this._swipePoint&&l.length===0&&this.reset();else{const d=this._tap.touchend(e,a,l);d&&(this._tapTime=e.timeStamp,this._tapPoint=d)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Rl{constructor(e,a,l){this._el=e,this._mousePan=a,this._touchPan=l}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 $o{constructor(e,a,l,d){this._pitchWithRotate=e.pitchWithRotate,this._rollEnabled=e.rollEnabled,this._mouseRotate=a,this._mousePitch=l,this._mouseRoll=d}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 fh{constructor(e,a,l,d){this._el=e,this._touchZoom=a,this._touchRotate=l,this._tapDragZoom=d,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 ph{constructor(e,a){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=e,this._options=a,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=ie.create("div","maplibregl-cooperative-gesture-screen",e);let a=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(a=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const l=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),d=document.createElement("div");d.className="maplibregl-desktop-message",d.textContent=a,this._container.appendChild(d);const m=document.createElement("div");m.className="maplibregl-mobile-message",m.textContent=l,this._container.appendChild(m),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(ie.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,a){this._enabled&&(this._map.fire(new u.l("cooperativegestureprevented",{gestureType:e,originalEvent:a})),this._container.classList.add("maplibregl-show"),setTimeout((()=>{this._container.classList.remove("maplibregl-show")}),100))}}const Sn=f=>f.zoom||f.drag||f.roll||f.pitch||f.rotate;class Ai extends u.l{}function Ho(f){return f.panDelta&&f.panDelta.mag()||f.zoomDelta||f.bearingDelta||f.pitchDelta||f.rollDelta}class Ac{constructor(e,a){this.handleWindowEvent=d=>{this.handleEvent(d,`${d.type}Window`)},this.handleEvent=(d,m)=>{if(d.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const y=d.type==="renderFrame"?void 0:d,w={needsRenderFrame:!1},S={},P={};for(const{handlerName:L,handler:j,allowed:G}of this._handlers){if(!j.isEnabled())continue;let ee;if(this._blockedByActive(P,G,L))j.reset();else if(j[m||d.type]){if(u.cp(d,m||d.type)){const J=ie.mousePos(this._map.getCanvas(),d);ee=j[m||d.type](d,J)}else if(u.cq(d,m||d.type)){const J=this._getMapTouches(d.touches),te=ie.touchPos(this._map.getCanvas(),J);ee=j[m||d.type](d,te,J)}else u.cr(m||d.type)||(ee=j[m||d.type](d));this.mergeHandlerResult(w,S,ee,L,y),ee&&ee.needsRenderFrame&&this._triggerRenderFrame()}(ee||j.isActive())&&(P[L]=j)}const k={};for(const L in this._previousActiveHandlers)P[L]||(k[L]=y);this._previousActiveHandlers=P,(Object.keys(k).length||Ho(w))&&(this._changes.push([w,S,k]),this._triggerRenderFrame()),(Object.keys(P).length||Ho(w))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:B}=w;B&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],B(this._map))},this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new to(e),this._bearingSnap=a.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(a);const l=this._el;this._listeners=[[l,"touchstart",{passive:!0}],[l,"touchmove",{passive:!1}],[l,"touchend",void 0],[l,"touchcancel",void 0],[l,"mousedown",void 0],[l,"mousemove",void 0],[l,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[l,"mouseover",void 0],[l,"mouseout",void 0],[l,"dblclick",void 0],[l,"click",void 0],[l,"keydown",{capture:!1}],[l,"keyup",void 0],[l,"wheel",{passive:!1}],[l,"contextmenu",void 0],[window,"blur",void 0]];for(const[d,m,y]of this._listeners)ie.addEventListener(d,m,d===document?this.handleWindowEvent:this.handleEvent,y)}destroy(){for(const[e,a,l]of this._listeners)ie.removeEventListener(e,a,e===document?this.handleWindowEvent:this.handleEvent,l)}_addDefaultHandlers(e){const a=this._map,l=a.getCanvasContainer();this._add("mapEvent",new ld(a,e));const d=a.boxZoom=new Go(a,e);this._add("boxZoom",d),e.interactive&&e.boxZoom&&d.enable();const m=a.cooperativeGestures=new ph(a,e.cooperativeGestures);this._add("cooperativeGestures",m),e.cooperativeGestures&&m.enable();const y=new wn(a),w=new Ec(a);a.doubleClickZoom=new qo(w,y),this._add("tapZoom",y),this._add("clickZoom",w),e.interactive&&e.doubleClickZoom&&a.doubleClickZoom.enable();const S=new mu;this._add("tapDragZoom",S);const P=a.touchPitch=new Cc(a);this._add("touchPitch",P),e.interactive&&e.touchPitch&&a.touchPitch.enable(e.touchPitch);const k=()=>a.project(a.getCenter()),B=(function({enable:oe,clickTolerance:de,aroundCenter:ge=!0,minPixelCenterThreshold:le=100,rotateDegreesPerPixelMoved:Se=.8},Oe){const ze=new Na({checkCorrectEvent:ke=>ie.mouseButton(ke)===0&&ke.ctrlKey||ie.mouseButton(ke)===2&&!ke.ctrlKey});return new Al({clickTolerance:de,move:(ke,Le)=>{const ot=Oe();if(ge&&Math.abs(ot.y-ke.y)>le)return{bearingDelta:u.cn(new u.P(ke.x,Le.y),Le,ot)};let ct=(Le.x-ke.x)*Se;return ge&&Le.y<ot.y&&(ct=-ct),{bearingDelta:ct}},moveStateManager:ze,enable:oe,assignEvents:zl})})(e,k),L=(function({enable:oe,clickTolerance:de,pitchDegreesPerPixelMoved:ge=-.5}){const le=new Na({checkCorrectEvent:Se=>ie.mouseButton(Se)===0&&Se.ctrlKey||ie.mouseButton(Se)===2});return new Al({clickTolerance:de,move:(Se,Oe)=>({pitchDelta:(Oe.y-Se.y)*ge}),moveStateManager:le,enable:oe,assignEvents:zl})})(e),j=(function({enable:oe,clickTolerance:de,rollDegreesPerPixelMoved:ge=.3},le){const Se=new Na({checkCorrectEvent:Oe=>ie.mouseButton(Oe)===2&&Oe.ctrlKey});return new Al({clickTolerance:de,move:(Oe,ze)=>{const ke=le();let Le=(ze.x-Oe.x)*ge;return ze.y<ke.y&&(Le=-Le),{rollDelta:Le}},moveStateManager:Se,enable:oe,assignEvents:zl})})(e,k);a.dragRotate=new $o(e,B,L,j),this._add("mouseRotate",B,["mousePitch"]),this._add("mousePitch",L,["mouseRotate","mouseRoll"]),this._add("mouseRoll",j,["mousePitch"]),e.interactive&&e.dragRotate&&a.dragRotate.enable();const G=(function({enable:oe,clickTolerance:de}){const ge=new Na({checkCorrectEvent:le=>ie.mouseButton(le)===0&&!le.ctrlKey});return new Al({clickTolerance:de,move:(le,Se)=>({around:Se,panDelta:Se.sub(le)}),activateOnStart:!0,moveStateManager:ge,enable:oe,assignEvents:zl})})(e),ee=new As(e,a);a.dragPan=new Rl(l,G,ee),this._add("mousePan",G),this._add("touchPan",ee,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&a.dragPan.enable(e.dragPan);const J=new Zo,te=new Mc;a.touchZoomRotate=new fh(l,te,J,S),this._add("touchRotate",J,["touchPan","touchZoom"]),this._add("touchZoom",te,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&a.touchZoomRotate.enable(e.touchZoomRotate);const ae=a.scrollZoom=new Ps(a,(()=>
vendor: 4,320 bytes, line 911
911this._triggerRenderFrame()));this._add("scrollZoom",ae,["mousePan"]),e.interactive&&e.scrollZoom&&a.scrollZoom.enable(e.scrollZoom);const ue=a.keyboard=new Ua(a);this._add("keyboard",ue),e.interactive&&e.keyboard&&a.keyboard.enable(),this._add("blockableMapEvent",new Fr(a))}_add(e,a,l){this._handlers.push({handlerName:e,handler:a,allowed:l}),this._handlersById[e]=a}stop(e){if(!this._updatingCamera){for(const{handler:a}of this._handlers)a.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!!Sn(this._eventsInProgress)||this.isZooming()}_blockedByActive(e,a,l){for(const d in e)if(d!==l&&(!a||a.indexOf(d)<0))return!0;return!1}_getMapTouches(e){const a=[];for(const l of e)this._el.contains(l.target)&&a.push(l);return a}mergeHandlerResult(e,a,l,d,m){if(!l)return;u.e(e,l);const y={handlerName:d,originalEvent:l.originalEvent||m};l.zoomDelta!==void 0&&(a.zoom=y),l.panDelta!==void 0&&(a.drag=y),l.rollDelta!==void 0&&(a.roll=y),l.pitchDelta!==void 0&&(a.pitch=y),l.bearingDelta!==void 0&&(a.rotate=y)}_applyChanges(){const e={},a={},l={};for(const[d,m,y]of this._changes)d.panDelta&&(e.panDelta=(e.panDelta||new u.P(0,0))._add(d.panDelta)),d.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+d.zoomDelta),d.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+d.bearingDelta),d.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+d.pitchDelta),d.rollDelta&&(e.rollDelta=(e.rollDelta||0)+d.rollDelta),d.around!==void 0&&(e.around=d.around),d.pinchAround!==void 0&&(e.pinchAround=d.pinchAround),d.noInertia&&(e.noInertia=d.noInertia),u.e(a,m),u.e(l,y);this._updateMapTransform(e,a,l),this._changes=[]}_updateMapTransform(e,a,l){const d=this._map,m=d._getTransformForUpdate(),y=d.terrain;if(!(Ho(e)||y&&this._terrainMovement))return this._fireEvents(a,l,!0);d._stop(!0);let{panDelta:w,zoomDelta:S,bearingDelta:P,pitchDelta:k,rollDelta:B,around:L,pinchAround:j}=e;j!==void 0&&(L=j),L=L||d.transform.centerPoint,y&&!m.isPointOnMapSurface(L)&&(L=m.centerPoint);const G={panDelta:w,zoomDelta:S,rollDelta:B,pitchDelta:k,bearingDelta:P,around:L};this._map.cameraHelper.useGlobeControls&&!m.isPointOnMapSurface(L)&&(L=m.centerPoint);const ee=L.distSqr(m.centerPoint)<.01?m.center:m.screenPointToLocation(w?L.sub(w):L);y?(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(G,m),this._terrainMovement||!a.drag&&!a.zoom?a.drag&&this._terrainMovement?m.setCenter(m.screenPointToLocation(m.centerPoint.sub(w))):this._map.cameraHelper.handleMapControlsPan(G,m,ee):(this._terrainMovement=!0,this._map._elevationFreeze=!0,this._map.cameraHelper.handleMapControlsPan(G,m,ee))):(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(G,m),this._map.cameraHelper.handleMapControlsPan(G,m,ee)),d._applyUpdatedTransform(m),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(a,l,!0)}_fireEvents(e,a,l){const d=Sn(this._eventsInProgress),m=Sn(e),y={};for(const B in e){const{originalEvent:L}=e[B];this._eventsInProgress[B]||(y[`${B}start`]=L),this._eventsInProgress[B]=e[B]}!d&&m&&this._fireEvent("movestart",m.originalEvent);for(const B in y)this._fireEvent(B,y[B]);m&&this._fireEvent("move",m.originalEvent);for(const B in e){const{originalEvent:L}=e[B];this._fireEvent(B,L)}const w={};let S;for(const B in this._eventsInProgress){const{handlerName:L,originalEvent:j}=this._eventsInProgress[B];this._handlersById[L].isActive()||(delete this._eventsInProgress[B],S=a[L]||j,w[`${B}end`]=S)}for(const B in w)this._fireEvent(B,w[B]);const P=Sn(this._eventsInProgress),k=(d||m)&&!P;if(k&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const B=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&B.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(B)}if(l&&k){this._updatingCamera=!0;const B=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),L=j=>j!==0&&-this._bearingSnap<j&&j<this._bearingSnap;!B||!B.essential&&Ce.prefersReducedMotion?(this._map.fire(new u.l("moveend",{originalEvent:S})),L(this._map.getBearing())&&this._map.resetNorth()):(L(B.bearing||this._map.getBearing())&&
vendor: 30,738 bytes, line 911
911(B.bearing=0),B.freezeElevation=!0,this._map.easeTo(B,{originalEvent:S})),this._updatingCamera=!1}}_fireEvent(e,a){this._map.fire(new u.l(e,a?{originalEvent:a}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add((e=>{delete this._frameId,this.handleEvent(new Ai("renderFrame",{timeStamp:e})),this._applyChanges()}))}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class gu extends u.E{constructor(e,a,l){super(),this._renderFrameCallback=()=>{const d=Math.min((Ce.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(d)),d<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=l.bearingSnap,this.cameraHelper=a,this.on("moveend",(()=>{delete this._requestedCameraState}))}migrateProjection(e,a){e.apply(this.transform),this.transform=e,this.cameraHelper=a}getCenter(){return new u.S(this.transform.center.lng,this.transform.center.lat)}setCenter(e,a){return this.jumpTo({center:e},a)}getCenterElevation(){return this.transform.elevation}setCenterElevation(e,a){return this.jumpTo({elevation:e},a),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(e){this._centerClampedToGround=e}panBy(e,a,l){return e=u.P.convert(e).mult(-1),this.panTo(this.transform.center,u.e({offset:e},a),l)}panTo(e,a,l){return this.easeTo(u.e({center:e},a),l)}getZoom(){return this.transform.zoom}setZoom(e,a){return this.jumpTo({zoom:e},a),this}zoomTo(e,a,l){return this.easeTo(u.e({zoom:e},a),l)}zoomIn(e,a){return this.zoomTo(this.getZoom()+1,e,a),this}zoomOut(e,a){return this.zoomTo(this.getZoom()-1,e,a),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(e,a){return e!=this.transform.fov&&(this.transform.setFov(e),this.fire(new u.l("movestart",a)).fire(new u.l("move",a)).fire(new u.l("moveend",a))),this}getBearing(){return this.transform.bearing}setBearing(e,a){return this.jumpTo({bearing:e},a),this}getPadding(){return this.transform.padding}setPadding(e,a){return this.jumpTo({padding:e},a),this}rotateTo(e,a,l){return this.easeTo(u.e({bearing:e},a),l)}resetNorth(e,a){return this.rotateTo(0,u.e({duration:1e3},e),a),this}resetNorthPitch(e,a){return this.easeTo(u.e({bearing:0,pitch:0,roll:0,duration:1e3},e),a),this}snapToNorth(e,a){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,a):this}getPitch(){return this.transform.pitch}setPitch(e,a){return this.jumpTo({pitch:e},a),this}getRoll(){return this.transform.roll}setRoll(e,a){return this.jumpTo({roll:e},a),this}cameraForBounds(e,a){e=qi.convert(e).adjustAntiMeridian();const l=a&&a.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),l,a)}_cameraForBoxAndBearing(e,a,l,d){const m={top:0,bottom:0,right:0,left:0};if(typeof(d=u.e({padding:m,offset:[0,0],maxZoom:this.transform.maxZoom},d)).padding=="number"){const P=d.padding;d.padding={top:P,bottom:P,right:P,left:P}}const y=u.e(m,d.padding);d.padding=y;const w=this.transform,S=new qi(e,a);return this.cameraHelper.cameraForBoxAndBearing(d,y,S,l,w)}fitBounds(e,a,l){return this._fitInternal(this.cameraForBounds(e,a),a,l)}fitScreenCoordinates(e,a,l,d,m){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(u.P.convert(e)),this.transform.screenPointToLocation(u.P.convert(a)),l,d),d,m)}_fitInternal(e,a,l){return e?(delete(a=u.e(e,a)).padding,a.linear?this.easeTo(a,l):this.flyTo(a,l)):this}jumpTo(e,a){this.stop();const l=this._getTransformForUpdate();let d=!1,m=!1,y=!1;const w=l.zoom;this.cameraHelper.handleJumpToCenterZoom(l,e);const S=l.zoom!==w;return"elevation"in e&&l.elevation!==+e.elevation&&l.setElevation(+e.elevation),"bearing"in e&&l.bearing!==+e.bearing&&(d=!0,l.setBearing(+e.bearing)),"pitch"in e&&l.pitch!==+e.pitch&&(m=!0,l.setPitch(+e.pitch)),"roll"in e&&l.roll!==+e.roll&&(y=!0,l.setRoll(+e.roll)),e.padding==null||l.isPaddingEqual(e.padding)||l.setPadding(e.padding),this._applyUpdatedTransform(l),this.fire(new u.l("movestart",a)).fire(new u.l("move",a)),S&&this.fire(new u.l("zoomstart",a)).fire(new u.l("zoom",a)).fire(new u.l("zoomend",a)),d&&this.fire(new u.l("rotatestart",a)).fire(new u.l("rotate",a)).fire(new u.l("rotateend",a)),m&&this.fire(new u.l("pitchstart",a)).fire(new u.l("pitch",a)).fire(new u.l("pitchend",a)),y&&this.fire(new u.l("rollstart",a)).fire(new u.l("roll",a)).fire(new u.l("rollend",a)),this.fire(new u.l("moveend",a))}calculateCameraOptionsFromTo(e,a,l,d=0){const m=u.a1.fromLngLat(e,a),y=u.a1.fromLngLat(l,d),w=y.x-m.x,S=y.y-m.y,P=y.z-m.z,k=Math.hypot(w,S,P);if(k===0)throw new Error("Can't calculate camera options with same From and To");const B=Math.hypot(w,S),L=u.ak(this.transform.cameraToCenterDistance/k/this.transform.tileSize),j=180*Math.atan2(w,-S)/Math.PI;let G=180*Math.acos(B/k)/Math.PI;return G=P<0?90-G:90+G,{center:y.toLngLat(),elevation:d,zoom:L,pitch:G,bearing:j}}calculateCameraOptionsFromCameraLngLatAltRotation(e,a,l,d,m){const y=this.transform.calculateCenterFromCameraLngLatAlt(e,a,l,d);return{center:y.center,elevation:y.elevation,zoom:y.zoom,bearing:l,pitch:d,roll:m}}easeTo(e,a){this._stop(!1,e.easeId),((e=u.e({offset:[0,0],duration:500,easing:u.co},e)).animate===!1||!e.essential&&Ce.prefersReducedMotion)&&(e.duration=0);const l=this._getTransformForUpdate(),d=this.getBearing(),m=l.pitch,y=l.roll,w="bearing"in e?this._normalizeBearing(e.bearing,d):d,S="pitch"in e?+e.pitch:m,P="roll"in e?this._normalizeBearing(e.roll,y):y,k="padding"in e?e.padding:l.padding,B=u.P.convert(e.offset);let L,j;e.around&&(L=u.S.convert(e.around),j=l.locationToScreenPoint(L));const G={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},ee=this.cameraHelper.handleEaseTo(l,{bearing:w,pitch:S,roll:P,padding:k,around:L,aroundPoint:j,offsetAsPoint:B,offset:e.offset,zoom:e.zoom,center:e.center});return this._rotating=this._rotating||d!==w,this._pitching=this._pitching||S!==m,this._rolling=this._rolling||P!==y,this._padding=!l.isPaddingEqual(k),this._zooming=this._zooming||ee.isZooming,this._easeId=e.easeId,this._prepareEase(a,e.noMoveStart,G),this.terrain&&this._prepareElevation(ee.elevationCenter),this._ease((J=>{ee.easeFunc(J),this.terrain&&!e.freezeElevation&&this._updateElevation(J),this._applyUpdatedTransform(l),this._fireMoveEvents(a)}),(J=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(a,J)}),e),this}_prepareEase(e,a,l={}){this._moving=!0,a||l.moving||this.fire(new u.l("movestart",e)),this._zooming&&!l.zooming&&this.fire(new u.l("zoomstart",e)),this._rotating&&!l.rotating&&this.fire(new u.l("rotatestart",e)),this._pitching&&!l.pitching&&this.fire(new u.l("pitchstart",e)),this._rolling&&!l.rolling&&this.fire(new u.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){this._elevationStart!==void 0&&this._elevationCenter!==void 0||this._prepareElevation(this.transform.center),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));const a=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(e<1&&a!==this._elevationTarget){const l=this._elevationTarget-this._elevationStart;this._elevationStart+=e*(l-(a-(l*e+this._elevationStart))/(1-e)),this._elevationTarget=a}this.transform.setElevation(u.C.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 a=e.getCameraLngLat(),l=e.getCameraAltitude(),d=this.terrain?this.terrain.getElevationForLngLatZoom(a,e.zoom):0;if(l<d){const m=this.calculateCameraOptionsFromTo(a,d,e.center,e.elevation);return{pitch:m.pitch,zoom:m.zoom}}return{}}_applyUpdatedTransform(e){const a=[];if(a.push((d=>this._elevateCameraIfInsideTerrain(d))),this.transformCameraUpdate&&a.push((d=>this.transformCameraUpdate(d))),!a.length)return;const l=e.clone();for(const d of a){const m=l.clone(),{center:y,zoom:w,roll:S,pitch:P,bearing:k,elevation:B}=d(m);y&&m.setCenter(y),B!==void 0&&m.setElevation(B),w!==void 0&&m.setZoom(w),S!==void 0&&m.setRoll(S),P!==void 0&&m.setPitch(P),k!==void 0&&m.setBearing(k),l.apply(m)}this.transform.apply(l)}_fireMoveEvents(e){this.fire(new u.l("move",e)),this._zooming&&this.fire(new u.l("zoom",e)),this._rotating&&this.fire(new u.l("rotate",e)),this._pitching&&this.fire(new u.l("pitch",e)),this._rolling&&this.fire(new u.l("roll",e))}_afterEase(e,a){if(this._easeId&&a&&this._easeId===a)return;delete this._easeId;const l=this._zooming,d=this._rotating,m=this._pitching,y=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,l&&this.fire(new u.l("zoomend",e)),d&&this.fire(new u.l("rotateend",e)),m&&this.fire(new u.l("pitchend",e)),y&&this.fire(new u.l("rollend",e)),this.fire(new u.l("moveend",e))}flyTo(e,a){if(!e.essential&&Ce.prefersReducedMotion){const Le=u.Q(e,["center","zoom","bearing","pitch","roll","elevation"]);return this.jumpTo(Le,a)}this.stop(),e=u.e({offset:[0,0],speed:1.2,curve:1.42,easing:u.co},e);const l=this._getTransformForUpdate(),d=l.bearing,m=l.pitch,y=l.roll,w=l.padding,S="bearing"in e?this._normalizeBearing(e.bearing,d):d,P="pitch"in e?+e.pitch:m,k="roll"in e?this._normalizeBearing(e.roll,y):y,B="padding"in e?e.padding:l.padding,L=u.P.convert(e.offset);let j=l.centerPoint.add(L);const G=l.screenPointToLocation(j),ee=this.cameraHelper.handleFlyTo(l,{bearing:S,pitch:P,roll:k,padding:B,locationAtOffset:G,offsetAsPoint:L,center:e.center,minZoom:e.minZoom,zoom:e.zoom});let J=e.curve;const te=Math.max(l.width,l.height),ae=te/ee.scaleOfZoom,ue=ee.pixelPathLength;typeof ee.scaleOfMinZoom=="number"&&(J=Math.sqrt(te/ee.scaleOfMinZoom/ue*2));const oe=J*J;function de(Le){const ot=(ae*ae-te*te+(Le?-1:1)*oe*oe*ue*ue)/(2*(Le?ae:te)*oe*ue);return Math.log(Math.sqrt(ot*ot+1)-ot)}function ge(Le){return(Math.exp(Le)-Math.exp(-Le))/2}function le(Le){return(Math.exp(Le)+Math.exp(-Le))/2}const Se=de(!1);let Oe=function(Le){return le(Se)/le(Se+J*Le)},ze=function(Le){return te*((le(Se)*(ge(ot=Se+J*Le)/le(ot))-ge(Se))/oe)/ue;var ot},ke=(de(!0)-Se)/J;if(Math.abs(ue)<2e-6||!isFinite(ke)){if(Math.abs(te-ae)<1e-6)return this.easeTo(e,a);const Le=ae<te?-1:1;ke=Math.abs(Math.log(ae/te))/J,ze=()=>0,Oe=ot=>Math.exp(Le*J*ot)}return e.duration="duration"in e?+e.duration:1e3*ke/("screenSpeed"in e?+e.screenSpeed/J:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=d!==S,this._pitching=P!==m,this._rolling=k!==y,this._padding=!l.isPaddingEqual(B),this._prepareEase(a,!1),this.terrain&&this._prepareElevation(ee.targetCenter),this._ease((Le=>{const ot=Le*ke,ct=1/Oe(ot),We=ze(ot);this._rotating&&l.setBearing(u.C.number(d,S,Le)),this._pitching&&l.setPitch(u.C.number(m,P,Le)),this._rolling&&l.setRoll(u.C.number(y,k,Le)),this._padding&&(l.interpolatePadding(w,B,Le),j=l.centerPoint.add(L)),ee.easeFunc(Le,ct,We,j),this.terrain&&!e.freezeElevation&&this._updateElevation(Le),this._applyUpdatedTransform(l),this._fireMoveEvents(a)}),(()=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(a)}),e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,a){var l;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const d=this._onEaseEnd;delete this._onEaseEnd,d.call(this,a)}return e||(l=this.handlers)===null||l===void 0||l.stop(!1),this}_ease(e,a,l){l.animate===!1||l.duration===0?(e(1),a()):(this._easeStart=Ce.now(),this._easeOptions=l,this._onEaseFrame=e,this._onEaseEnd=a,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,a){e=u.aO(e,-180,180);const l=Math.abs(e-a);return Math.abs(e-360-a)<l&&(e-=360),Math.abs(e+360-a)<l&&(e+=360),e}queryTerrainElevation(e){return this.terrain?this.terrain.getElevationForLngLatZoom(u.S.convert(e),this.transform.tileZoom):null}}const hs={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class ci{constructor(e=hs){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=a=>{!a||a.sourceDataType!=="metadata"&&a.sourceDataType!=="visibility"&&a.dataType!=="style"&&a.type!=="terrain"||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=e}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=this.options.compact,this._container=ie.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=ie.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=ie.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(){ie.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,a){const l=this._map._getUIString(`AttributionControl.${a}`);e.title=l,e.setAttribute("aria-label",l)}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map((d=>typeof d!="string"?"":d))):typeof this.options.customAttribution=="string"&&e.push(this.options.customAttribution)),this._map.style.stylesheet){const d=this._map.style.stylesheet;this.styleOwner=d.owner,this.styleId=d.id}const a=this._map.style.sourceCaches;for(const d in a){const m=a[d];if(m.used||m.usedForTerrain){const y=m.getSource();y.attribution&&e.indexOf(y.attribution)<0&&e.push(y.attribution)}}e=e.filter((d=>String(d).trim())),e.sort(((d,m)=>d.length-m.length)),e=e.filter(((d,m)=>{for(let y=m+1;y<e.length;y++)if(e[y].indexOf(d)>=0)return!1;return!0}));const l=e.join(" | ");l!==this._attribHTML&&(this._attribHTML=l,e.length?(this._innerContainer.innerHTML=ie.sanitize(l),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Oi{constructor(e={}){this._updateCompact=()=>{const a=this._container.children;if(a.length){const l=a[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&l.classList.add("maplibregl-compact"):l.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=ie.create("div","maplibregl-ctrl");const a=ie.create("a","maplibregl-ctrl-logo");return a.target="_blank",a.rel="noopener nofollow",a.href="https://maplibre.org/",a.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),a.setAttribute("rel","noopener nofollow"),this._container.appendChild(a),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){ie.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class ji{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){const a=++this._id;return this._queue.push({callback:e,id:a,cancelled:!1}),a}remove(e){const a=this._currentlyRunning,l=a?this._queue.concat(a):this._queue;for(const d of l)if(d.id===e)return void(d.cancelled=!0)}run(e=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const a=this._currentlyRunning=this._queue;this._queue=[];for(const l of a)if(!l.cancelled&&(l.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Xo=u.aJ([{name:"a_pos3d",type:"Int16",components:3}]);class St extends u.E{constructor(e){super(),this._lastTilesetChange=Ce.now(),this.sourceCache=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.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(e,a){this.sourceCache.update(e,a),this._renderableTilesKeys=[];const l={};for(const d of Me(e,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:a,calculateTileZoom:this.sourceCache._source.calculateTileZoom}))l[d.key]=!0,this._renderableTilesKeys.push(d.key),this._tiles[d.key]||(d.terrainRttPosMatrix32f=new Float64Array(16),u.bY(d.terrainRttPosMatrix32f,0,u.$,u.$,0,0,1),this._tiles[d.key]=new In(d,this.tileSize),this._lastTilesetChange=Ce.now());for(const d in this._tiles)l[d]||delete this._tiles[d]}freeRtt(e){for(const a in this._tiles){const l=this._tiles[a];(!e||l.tileID.equals(e)||l.tileID.isChildOf(e)||e.isChildOf(l.tileID))&&(l.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map((e=>this.getTileByID(e)))}getTileByID(e){return this._tiles[e]}getTerrainCoords(e,a){return a?this._getTerrainCoordsForTileRanges(e,a):this._getTerrainCoordsForRegularTile(e)}_getTerrainCoordsForRegularTile(e){const a={};for(const l of this._renderableTilesKeys){const d=this._tiles[l].tileID,m=e.clone(),y=u.ba();if(d.canonical.equals(e.canonical))u.bY(y,0,u.$,u.$,0,0,1);else if(d.canonical.isChildOf(e.canonical)){const w=d.canonical.z-e.canonical.z,S=d.canonical.x-(d.canonical.x>>w<<w),P=d.canonical.y-(d.canonical.y>>w<<w),k=u.$>>w;u.bY(y,0,k,k,0,0,1),u.M(y,y,[-S*k,-P*k,0])}else{if(!e.canonical.isChildOf(d.canonical))continue;{const w=e.canonical.z-d.canonical.z,S=e.canonical.x-(e.canonical.x>>w<<w),P=e.canonical.y-(e.canonical.y>>w<<w),k=u.$>>w;u.bY(y,0,u.$,u.$,0,0,1),u.M(y,y,[S*k,P*k,0]),u.N(y,y,[1/2**w,1/2**w,0])}}m.terrainRttPosMatrix32f=new Float32Array(y),a[l]=m}return a}_getTerrainCoordsForTileRanges(e,a){const l={};for(const d of this._renderableTilesKeys){const m=this._tiles[d].tileID;if(!this._isWithinTileRanges(m,a))continue;const y=e.clone(),w=u.ba();if(m.canonical.z===e.canonical.z){const S=e.canonical.x-m.canonical.x,P=e.canonical.y-m.canonical.y;u.bY(w,0,u.$,u.$,0,0,1),u.M(w,w,[S*u.$,P*u.$,0])}else if(m.canonical.z>e.canonical.z){const S=m.canonical.z-e.canonical.z,P=m.canonical.x-(m.canonical.x>>S<<S),k=m.canonical.y-(m.canonical.y>>S<<S),B=e.canonical.x-(m.canonical.x>>S),L=e.canonical.y-(m.canonical.y>>S),j=u.$>>S;u.bY(w,0,j,j,0,0,1),u.M(w,w,[-P*j+B*u.$,-k*j+L*u.$,0])}else{const S=e.canonical.z-m.canonical.z,P=e.canonical.x-(e.canonical.x>>S<<S),k=e.canonical.y-(e.canonical.y>>S<<S),B=(e.canonical.x>>S)-m.canonical.x,L=(e.canonical.y>>S)-m.canonical.y,j=u.$<<S;u.bY(w,0,j,j,0,0,1),u.M(w,w,[P*u.$+B*j,k*u.$+L*j,0])}y.terrainRttPosMatrix32f=new Float32Array(w),l[d]=y}return l}getSourceTile(e,a){const l=this.sourceCache._source;let d=e.overscaledZ-this.deltaZoom;if(d>l.maxzoom&&(d=l.maxzoom),d<l.minzoom)return null;this._sourceTileCache[e.key]||(this._sourceTileCache[e.key]=e.scaledTo(d).key);let m=this.sourceCache.getTileByID(this._sourceTileCache[e.key]);if((!m||!m.dem)&&a)for(;d>=l.minzoom&&(!m||!m.dem);)m=this.sourceCache.getTileByID(e.scaledTo(d--).key);return m}anyTilesAfterTime(e=Date.now()){return this._lastTilesetChange>=e}_isWithinTileRanges(e,a){return a[e.canonical.z]&&e.canonical.x>=a[e.canonical.z].minTileX&&e.canonical.x<=a[e.canonical.z].maxTileX&&e.canonical.y>=a[e.canonical.z].minTileY&&e.canonical.y<=a[e.canonical.z].maxTileY}}class It{constructor(e,a,l){this._meshCache={},this.painter=e,this.sourceCache=new St(a),this.options=l,this.exaggeration=typeof l.exaggeration=="number"?l.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(e,a,l,d=u.$){var m;if(!(a>=0&&a<d&&l>=0&&l<d))return 0;const y=this.getTerrainData(e),w=(m=y.tile)===null||m===void 0?void 0:m.dem;if(!w)return 0;const S=u.cs([],[a/d*u.$,l/d*u.$],y.u_terrain_matrix),P=[S[0]*w.dim,S[1]*w.dim],k=Math.floor(P[0]),B=Math.floor(P[1]),L=P[0]-k,j=P[1]-B;return w.get(k,B)*(1-L)*(1-j)+w.get(k+1,B)*L*(1-j)+w.get(k,B+1)*(1-L)*j+w.get(k+1,B+1)*L*j}getElevationForLngLatZoom(e,a){if(!u.ct(a,e.wrap()))return 0;const{tileID:l,mercatorX:d,mercatorY:m}=this._getOverscaledTileIDFromLngLatZoom(e,a);return this.getElevation(l,d%u.$,m%u.$,u.$)}getElevation(e,a,l,d=u.$){return this.getDEMElevation(e,a,l,d)*this.exaggeration}getTerrainData(e){if(!this._emptyDemTexture){const d=this.painter.context,m=new u.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new u.T(d,m,d.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new u.T(d,new u.R({width:1,height:1}),d.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(d.gl.NEAREST,d.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=u.ag([])}const a=this.sourceCache.getSourceTile(e,!0);if(a&&a.dem&&(!a.demTexture||a.needsTerrainPrepare)){const d=this.painter.context;a.demTexture=this.painter.getTileTexture(a.dem.stride),a.demTexture?a.demTexture.update(a.dem.getPixels(),{premultiply:!1}):a.demTexture=new u.T(d,a.dem.getPixels(),d.gl.RGBA,{premultiply:!1}),a.demTexture.bind(d.gl.NEAREST,d.gl.CLAMP_TO_EDGE),a.needsTerrainPrepare=!1}const l=a&&a+a.tileID.key+e.key;if(l&&!this._demMatrixCache[l]){const d=this.sourceCache.sourceCache._source.maxzoom;let m=e.canonical.z-a.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=d?m=e.canonical.z-d:u.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const y=e.canonical.x-(e.canonical.x>>m<<m),w=e.canonical.y-(e.canonical.y>>m<<m),S=u.cu(new Float64Array(16),[1/(u.$<<m),1/(u.$<<m),0]);u.M(S,S,[y*u.$,w*u.$,0]),this._demMatrixCache[e.key]={matrix:S,coord:e}}return{u_depth:2,u_terrain:3,u_terrain_dim:a&&a.dem&&a.dem.dim||1,u_terrain_matrix:l?this._demMatrixCache[e.key].matrix:this._emptyDemMatrix,u_terrain_unpack:a&&a.dem&&a.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(a&&a.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:a}}getFramebuffer(e){const a=this.painter,l=a.width/devicePixelRatio,d=a.height/devicePixelRatio;return!this._fbo||this._fbo.width===l&&this._fbo.height===d||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new u.T(a.context,{width:l,height:d,data:null},a.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(a.context.gl.NEAREST,a.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new u.T(a.context,{width:l,height:d,data:null},a.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(a.context.gl.NEAREST,a.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=a.context.createFramebuffer(l,d,!0,!1),this._fbo.depthAttachment.set(a.context.createRenderbuffer(a.context.gl.DEPTH_COMPONENT16,l,d))),this._fbo.colorAttachment.set(e==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const e=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const a=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let m=0,y=0;m<this._coordsTextureSize;m++)for(let w=0;w<this._coordsTextureSize;w++,y+=4)a[y+0]=255&w,a[y+1]=255&m,a[y+2]=w>>8<<4|m>>8,a[y+3]=0;const l=new u.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(a.buffer)),d=new u.T(e,l,e.gl.RGBA,{premultiply:!1});return d.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=d,d}pointCoordinate(e){this.painter.maybeDrawDepthAndCoords(!0);const a=new Uint8Array(4),l=this.painter.context,d=l.gl,m=Math.round(e.x*this.painter.pixelRatio/devicePixelRatio),y=Math.round(e.y*this.painter.pixelRatio/devicePixelRatio),w=Math.round(this.painter.height/devicePixelRatio);l.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),d.readPixels(m,w-y-1,1,1,d.RGBA,d.UNSIGNED_BYTE,a),l.bindFramebuffer.set(null);const S=a[0]+(a[2]>>4<<8),P=a[1]+((15&a[2])<<8),k=this.coordsIndex[255-a[3]],B=k&&this.sourceCache.getTileByID(k);if(!B)return null;const L=this._coordsTextureSize,j=(1<<B.tileID.canonical.z)*L;return new u.a1((B.tileID.canonical.x*L+S)/j+B.tileID.wrap,(B.tileID.canonical.y*L+P)/j,this.getElevation(B.tileID,S,P,L))}depthAtPoint(e){const a=new Uint8Array(4),l=this.painter.context,d=l.gl;return l.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),d.readPixels(e.x,this.painter.height/devicePixelRatio-e.y-1,1,1,d.RGBA,d.UNSIGNED_BYTE,a),l.bindFramebuffer.set(null),(a[0]/16777216+a[1]/65536+a[2]/256+a[3])/256}getTerrainMesh(e){var a;const l=((a=this.painter.style.projection)===null||a===void 0?void 0:a.transitionState)>0,d=l&&e.canonical.y===0,m=l&&e.canonical.y===(1<<e.canonical.z)-1,y=`m_${d?"n":""}_${m?"s":""}`;if(this._meshCache[y])return this._meshCache[y];const w=this.painter.context,S=new u.cv,P=new u.aN,k=this.meshSize,B=u.$/k,L=k*k;for(let le=0;le<=k;le++)for(let Se=0;Se<=k;Se++)S.emplaceBack(Se*B,le*B,0);for(let le=0;le<L;le+=k+1)for(let Se=0;Se<k;Se++)P.emplaceBack(Se+le,k+Se+le+1,k+Se+le+2),P.emplaceBack(Se+le,k+Se+le+2,Se+le+1);const j=S.length,G=j+(k+1),ee=(k+1)*k,J=d?u.bh:0,te=d?0:1,ae=m?u.bi:u.$,ue=m?0:1;for(let le=0;le<=k;le++)S.emplaceBack(le*B,J,te);for(let le=0;le<=k;le++)S.emplaceBack(le*B,ae,ue);for(let le=0;le<k;le++)P.emplaceBack(ee+le,G+le,G+le+1),P.emplaceBack(ee+le,G+le+1,ee+le+1),P.emplaceBack(0+le,j+le+1,j+le),P.emplaceBack(0+le,0+le+1,j+le+1);const oe=S.length,de=oe+2*(k+1);for(const le of[0,1])for(let Se=0;Se<=k;Se++)for(const Oe of[0,1])S.emplaceBack(le*u.$,Se*B,Oe);for(let le=0;le<2*k;le+=2)P.emplaceBack(oe+le,oe+le+1,oe+le+3),P.emplaceBack(oe+le,oe+le+3,oe+le+2),P.emplaceBack(de+le,de+le+3,de+le+1),P.emplaceBack(de+le,de+le+2,de+le+3);const ge=new Gs(w.createVertexBuffer(S,Xo.members),w.createIndexBuffer(P),u.aM.simpleSegment(0,0,S.length,P.length));return this._meshCache[y]=ge,ge}getMeshFrameDelta(e){return 2*Math.PI*u.bu/Math.pow(2,Math.max(e,0))/5}getMinTileElevationForLngLatZoom(e,a){var l;const{tileID:d}=this._getOverscaledTileIDFromLngLatZoom(e,a);return(l=this.getMinMaxElevation(d).minElevation)!==null&&l!==void 0?l:0}getMinMaxElevation(e){const a=this.getTerrainData(e).tile,l={minElevation:null,maxElevation:null};return a&&a.dem&&(l.minElevation=a.dem.min*this.exaggeration,l.maxElevation=a.dem.max*this.exaggeration),l}_getOverscaledTileIDFromLngLatZoom(e,a){const l=u.a1.fromLngLat(e.wrap()),d=(1<<a)*u.$,m=l.x*d,y=l.y*d,w=Math.floor(m/u.$),S=Math.floor(y/u.$);return{tileID:new u.Z(a,0,a,w,S),mercatorX:m,mercatorY:y}}}class Yo{constructor(e,a,l){this._context=e,this._size=a,this._tileSize=l,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const e of this._objects)e.texture.destroy(),e.fbo.destroy()}_createObject(e){const a=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),l=new u.T(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return l.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),a.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),a.colorAttachment.set(l.texture),{id:e,fbo:a,texture:l,stamp:-1,inUse:!1}}getObjectForId(e){return this._objects[e]}useObject(e){e.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter((a=>e.id!==a)),this._recentlyUsed.push(e.id)}stampObject(e){e.stamp=++this._stamp}getOrCreateFreeObject(){for(const a of this._recentlyUsed)if(!this._objects[a].inUse)return this._objects[a];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const 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)&&this._objects.some((e=>!e.inUse))===!1}}const va={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0};class zs{constructor(e,a){this.painter=e,this.terrain=a,this.pool=new Yo(e.context,30,a.sourceCache.tileSize*a.qualityFactor)}destruct(){this.pool.destruct()}getTexture(e){return this.pool.getObjectForId(e.rtt[this._stacks.length-1].id).texture}
vendor: 4,234 bytes, line 911
911prepareForRender(e,a){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=e._order.filter((l=>!e._layers[l].isHidden(a))),this._coordsAscending={};for(const l in e.sourceCaches){this._coordsAscending[l]={};const d=e.sourceCaches[l].getVisibleCoordinates(),m=e.sourceCaches[l].getSource(),y=m instanceof Wn?m.terrainTileRanges:null;for(const w of d){const S=this.terrain.sourceCache.getTerrainCoords(w,y);for(const P in S)this._coordsAscending[l][P]||(this._coordsAscending[l][P]=[]),this._coordsAscending[l][P].push(S[P])}}this._coordsAscendingStr={};for(const l of e._order){const d=e._layers[l],m=d.source;if(va[d.type]&&!this._coordsAscendingStr[m]){this._coordsAscendingStr[m]={};for(const y in this._coordsAscending[m])this._coordsAscendingStr[m][y]=this._coordsAscending[m][y].map((w=>w.key)).sort().join()}}for(const l of this._renderableTiles)for(const d in this._coordsAscendingStr){const m=this._coordsAscendingStr[d][l.tileID.key];m&&m!==l.rttCoords[d]&&(l.rtt=[])}}renderLayer(e,a){if(e.isHidden(this.painter.transform.zoom))return!1;const l=Object.assign(Object.assign({},a),{isRenderingToTexture:!0}),d=e.type,m=this.painter,y=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(va[d]&&(this._prevType&&va[this._prevType]||this._stacks.push([]),this._prevType=d,this._stacks[this._stacks.length-1].push(e.id),!y))return!0;if(va[this._prevType]||va[d]&&y){this._prevType=d;const w=this._stacks.length-1,S=this._stacks[w]||[];for(const P of this._renderableTiles){if(this.pool.isFull()&&(wc(this.painter,this.terrain,this._rttTiles,l),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(P),P.rtt[w]){const B=this.pool.getObjectForId(P.rtt[w].id);if(B.stamp===P.rtt[w].stamp){this.pool.useObject(B);continue}}const k=this.pool.getOrCreateFreeObject();this.pool.useObject(k),this.pool.stampObject(k),P.rtt[w]={id:k.id,stamp:k.stamp},m.context.bindFramebuffer.set(k.fbo.framebuffer),m.context.clear({color:u.bf.transparent,stencil:0}),m.currentStencilSource=void 0;for(let B=0;B<S.length;B++){const L=m.style._layers[S[B]],j=L.source?this._coordsAscending[L.source][P.tileID.key]:[P.tileID];m.context.viewport.set([0,0,k.fbo.width,k.fbo.height]),m._renderTileClippingMasks(L,j,!0),m.renderLayer(m,m.style.sourceCaches[L.source],L,j,l),L.source&&(P.rttCoords[L.source]=this._coordsAscendingStr[L.source][P.tileID.key])}}return wc(this.painter,this.terrain,this._rttTiles,l),this._rttTiles=[],this.pool.freeAllObjects(),va[d]}return!1}}const On={"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"},br=H,Xn={hash:!1,interactive:!0,bearingSnap:7,attributionControl:hs,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,maxTileC
vendor: 21,798 bytes, line 911
911acheSize:null,maxTileCacheZoomLevels:u.a.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0},mh={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};class Dl{constructor(e,a,l=!1){this.mousedown=m=>{this.startMove(m,ie.mousePos(this.element,m)),ie.addEventListener(window,"mousemove",this.mousemove),ie.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=m=>{this.move(m,ie.mousePos(this.element,m))},this.mouseup=m=>{this._rotatePitchHandler.dragEnd(m),this.offTemp()},this.touchstart=m=>{m.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=ie.touchPos(this.element,m.targetTouches)[0],this.startMove(m,this._startPos),ie.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),ie.addEventListener(window,"touchend",this.touchend))},this.touchmove=m=>{m.targetTouches.length!==1?this.reset():(this._lastPos=ie.touchPos(this.element,m.targetTouches)[0],this.move(m,this._lastPos))},this.touchend=m=>{m.targetTouches.length===0&&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=a;const d=new pu;this._rotatePitchHandler=new Al({clickTolerance:3,move:(m,y)=>{const w=a.getBoundingClientRect(),S=new u.P((w.bottom-w.top)/2,(w.right-w.left)/2);return{bearingDelta:u.cn(new u.P(m.x,y.y),y,S),pitchDelta:l?-.5*(y.y-m.y):void 0}},moveStateManager:d,enable:!0,assignEvents:()=>{}}),this.map=e,ie.addEventListener(a,"mousedown",this.mousedown),ie.addEventListener(a,"touchstart",this.touchstart,{passive:!1}),ie.addEventListener(a,"touchcancel",this.reset)}startMove(e,a){this._rotatePitchHandler.dragStart(e,a),ie.disableDrag()}move(e,a){const l=this.map,{bearingDelta:d,pitchDelta:m}=this._rotatePitchHandler.dragMove(e,a)||{};d&&l.setBearing(l.getBearing()+d),m&&l.setPitch(l.getPitch()+m)}off(){const e=this.element;ie.removeEventListener(e,"mousedown",this.mousedown),ie.removeEventListener(e,"touchstart",this.touchstart,{passive:!1}),ie.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),ie.removeEventListener(window,"touchend",this.touchend),ie.removeEventListener(e,"touchcancel",this.reset),this.offTemp()}offTemp(){ie.enableDrag(),ie.removeEventListener(window,"mousemove",this.mousemove),ie.removeEventListener(window,"mouseup",this.mouseup),ie.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),ie.removeEventListener(window,"touchend",this.touchend)}}let ki;function wr(f,e,a,l=!1){if(l||!a.getCoveringTilesDetailsProvider().allowWorldCopies())return f?.wrap();const d=new u.S(f.lng,f.lat);if(f=new u.S(f.lng,f.lat),e){const m=new u.S(f.lng-360,f.lat),y=new u.S(f.lng+360,f.lat),w=a.locationToScreenPoint(f).distSqr(e);a.locationToScreenPoint(m).distSqr(e)<w?f=m:a.locationToScreenPoint(y).distSqr(e)<w&&(f=y)}for(;Math.abs(f.lng-a.center.lng)>180;){const m=a.locationToScreenPoint(f);if(m.x>=0&&m.y>=0&&m.x<=a.width&&m.y<=a.height)break;f.lng>a.center.lng?f.lng-=360:f.lng+=360}return f.lng!==d.lng&&a.isPointOnMapSurface(a.locationToScreenPoint(f))?f:d}const Ll={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 no(f,e,a){const l=f.classList;for(const d in Ll)l.remove(`maplibregl-${a}-anchor-${d}`);l.add(`maplibregl-${a}-anchor-${e}`)}class ao extends u.E{constructor(e){if(super(),this._onKeyPress=a=>{const l=a.code,d=a.charCode||a.keyCode;l!=="Space"&&l!=="Enter"&&d!==32&&d!==13||this.togglePopup()},this._onMapClick=a=>{const l=a.originalEvent.target,d=this._element;this._popup&&(l===d||d.contains(l))&&this.togglePopup()},this._update=a=>{if(!this._map)return;const l=this._map.loaded()&&!this._map.isMoving();(a?.type==="terrain"||a?.type==="render"&&!l)&&this._map.once("render",this._update),this._lngLat=wr(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 d="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?d=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(d=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let m="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?m="rotateX(0deg)":this._pitchAlignment==="map"&&(m=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||a&&a.type!=="moveend"||(this._pos=this._pos.round()),ie.setTransform(this._element,`${Ll[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${m} ${d}`),Ce.frameAsync(new AbortController).then((()=>{this._updateOpacity(a&&a.type==="moveend")})).catch((()=>{}))},this._onMove=a=>{if(!this._isDragging){const l=this._clickTolerance||this._map._clickTolerance;this._isDragging=a.point.dist(this._pointerdownPos)>=l}this._isDragging&&(this._pos=a.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new u.l("dragstart"))),this.fire(new u.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),this._state==="active"&&this.fire(new u.l("dragend")),this._state="inactive"},this._addDragHandler=a=>{this._element.contains(a.originalEvent.target)&&(a.preventDefault(),this._positionDelta=a.point.sub(this._pos).add(this._offset),this._pointerdownPos=a.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=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&&e.pitchAlignment!=="auto"?e.pitchAlignment:this._rotationAlignment,this.setOpacity(e?.opacity,e?.opacityWhenCovered),e&&e.element)this._element=e.element,this._offset=u.P.convert(e&&e.offset||[0,0]);else{this._defaultMarker=!0,this._element=ie.create("div");const a=ie.createNS("http://www.w3.org/2000/svg","svg"),l=41,d=27;a.setAttributeNS(null,"display","block"),a.setAttributeNS(null,"height",`${l}px`),a.setAttributeNS(null,"width",`${d}px`),a.setAttributeNS(null,"viewBox",`0 0 ${d} ${l}`);const m=ie.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"stroke","none"),m.setAttributeNS(null,"stroke-width","1"),m.setAttributeNS(null,"fill","none"),m.setAttributeNS(null,"fill-rule","evenodd");const y=ie.createNS("http://www.w3.org/2000/svg","g");y.setAttributeNS(null,"fill-rule","nonzero");const w=ie.createNS("http://www.w3.org/2000/svg","g");w.setAttributeNS(null,"transform","translate(3.0, 29.0)"),w.setAttributeNS(null,"fill","#000000");const S=[{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 te of S){const ae=ie.createNS("http://www.w3.org/2000/svg","ellipse");ae.setAttributeNS(null,"opacity","0.04"),ae.setAttributeNS(null,"cx","10.5"),ae.setAttributeNS(null,"cy","5.80029008"),ae.setAttributeNS(null,"rx",te.rx),ae.setAttributeNS(null,"ry",te.ry),w.appendChild(ae)}const P=ie.createNS("http://www.w3.org/2000/svg","g");P.setAttributeNS(null,"fill",this._color);const k=ie.createNS("http://www.w3.org/2000/svg","path");k.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"),P.appendChild(k);const B=ie.createNS("http://www.w3.org/2000/svg","g");B.setAttributeNS(null,"opacity","0.25"),B.setAttributeNS(null,"fill","#000000");const L=ie.createNS("http://www.w3.org/2000/svg","path");L.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),B.appendChild(L);const j=ie.createNS("http://www.w3.org/2000/svg","g");j.setAttributeNS(null,"transform","translate(6.0, 7.0)"),j.setAttributeNS(null,"fill","#FFFFFF");const G=ie.createNS("http://www.w3.org/2000/svg","g");G.setAttributeNS(null,"transform","translate(8.0, 8.0)");const ee=ie.createNS("http://www.w3.org/2000/svg","circle");ee.setAttributeNS(null,"fill","#000000"),ee.setAttributeNS(null,"opacity","0.25"),ee.setAttributeNS(null,"cx","5.5"),ee.setAttributeNS(null,"cy","5.5"),ee.setAttributeNS(null,"r","5.4999962");const J=ie.createNS("http://www.w3.org/2000/svg","circle");J.setAttributeNS(null,"fill","#FFFFFF"),J.setAttributeNS(null,"cx","5.5"),J.setAttributeNS(null,"cy","5.5"),J.setAttributeNS(null,"r","5.4999962"),G.appendChild(ee),G.appendChild(J),y.appendChild(w),y.appendChild(P),y.appendChild(B),y.appendChild(j),y.appendChild(G),a.appendChild(y),a.setAttributeNS(null,"height",l*this._scale+"px"),a.setAttributeNS(null,"width",d*this._scale+"px"),this._element.appendChild(a),this._offset=u.P.convert(e&&e.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",(a=>{a.preventDefault()})),this._element.addEventListener("mousedown",(a=>{a.preventDefault()})),no(this._element,this._anchor,"marker"),e&&e.className)for(const a of e.className.split(" "))this._element.classList.add(a);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")),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),ie.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=u.S.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 d=Math.abs(13.5)/Math.SQRT2;e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[d,-1*(38.1-13.5+d)],"bottom-right":[-d,-1*(38.1-13.5+d)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}: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 a,l;const d=(a=this._map)===null||a===void 0?void 0:a.terrain,m=this._map.transform.isLocationOccluded(this._lngLat);if(!d||m){const j=m?this._opacityWhenCovered:this._opacity;return void(this._element.style.opacity!==j&&(this._element.style.opacity=j))}if(e)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout((()=>{this._opacityTimeout=null}),100)}const y=this._map,w=y.terrain.depthAtPoint(this._pos),S=y.terrain.getElevationForLngLatZoom(this._lngLat,y.transform.tileZoom);if(y.transform.lngLatToCameraDepth(this._lngLat,S)-w<.006)return void(this._element.style.opacity=this._opacity);const P=-this._offset.y/y.transform.pixelsPerMeter,k=Math.sin(y.getPitch()*Math.PI/180)*P,B=y.terrain.depthAtPoint(new u.P(this._pos.x,this._pos.y-this._offset.y)),L=y.transform.lngLatToCameraDepth(this._lngLat,S+k)-B>.006;!((l=this._popup)===null||l===void 0)&&l.isOpen()&&L&&this._popup.remove(),this._element.style.opacity=L?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(e){return this._offset=u.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&&e!=="auto"?e:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(e,a){return(this._opacity===void 0||e===void 0&&a===void 0)&&(this._opacity="1",this._opacityWhenCovered="0.2"),e!==void 0&&(this._opacity=e),a!==void 0&&(this._opacityWhenCovered=a),this._map&&this._updateOpacity(!0),this}}const Tn={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let ir=0,ks=!1;const Is={maxWidth:100,unit:"metric"};function Ko(f,e,a){const l=a&&a.maxWidth||100,d=f._container.clientHeight/2,m=f._container.clientWidth/2,y=f.unproject([m-l/2,d]),w=f.unproject([m+l/2,d]),S=Math.round(f.project(w).x-f.project(y).x),P=Math.min(l,S,f._container.clientWidth),k=y.distanceTo(w);if(a&&a.unit==="imperial"){const B=3.2808*k;B>5280?Rs(e,P,B/5280,f._getUIString("ScaleControl.Miles")):Rs(e,P,B,f._getUIString("ScaleControl.Feet"))}else a&&a.unit==="nautical"?Rs(e,P,k/1852,f._getUIString("ScaleControl.NauticalMiles")):k>=1e3?Rs(e,P,k/1e3,f._getUIString("ScaleControl.Kilometers")):Rs(e,P,k,f._getUIString("ScaleControl.Meters"))}function Rs(f,e,a,l){const d=(function(m){const y=Math.pow(10,`${Math.floor(m)}`.length-1);let w=m/y;return w=w>=10?10:w>=5?5:w>=3?3:w>=2?2:w>=1?1:(function(S){const P=Math.pow(10,Math.ceil(-Math.log(S)/Math.LN10));return Math.round(S*P)/P})(w),y*w})(a);f.style.width=e*(d/a)+"px",f.innerHTML=`${d}&nbsp;${l}`}const Va={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0},Bl=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Ol(f){if(f){if(typeof f=="number"){const e=Math.round(Math.abs(f)/Math.SQRT2);return{center:new u.P(0,0),top:new u.P(0,f),"top-left":new u.P(e,e),"top-right":new u.P(-e,e),bottom:new u.P(0,-f),"bottom-left":new u.P(e,-e),"bottom-right":new u.P(-e,-e),left:new u.P(f,0),right:new u.P(-f,0)}}if(f instanceof u.P||Array.isArray(f)){const e=u.P.convert(f);return{center:e,top:e,"top-left":e,"top-right":e,bottom:e,"bottom-left":e,"bottom-right":e,left:e,right:e}}return{center:u.P.convert(f.center||[0,0]),top:u.P.convert(f.top||[0,0]),"top-left":u.P.convert(f["top-left"]||[0,0]),"top-right":u.P.convert(f["top-right"]||[0,0]),bottom:u.P.convert(f.bottom||[0,0]),"bottom-left":u.P.convert(f["bottom-left"]||[0,0]),"bottom-right":u.P.convert(f["bottom-right"]||[0,0]),left:u.P.convert(f.left||[0,0]),right:u.P.convert(f.right||[0,0])}}return Ol(new u.P(0,0))}const Pc=H;A.AJAXError=u.cz,A.Event=u.l,A.Evented=u.E,A.LngLat=u.S,A.MercatorCoordinate=u.a1,A.Point=u.P,A.addProtocol=u.cA,A.config=u.a,A.removeProtocol=u.cB,A.AttributionControl=ci,A.BoxZoomHandler=Go,A.CanvasSource=Qn,A.CooperativeGesturesHandler=ph,A.DoubleClickZoomHandler=qo,A.DragPanHandler=Rl,A.DragRotateHandler=$o,A.EdgeInsets=vs,A.FullscreenControl=class extends u.E{constructor(f={}){super(),this._onFullscreenChange=()=>{var e;let a=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((e=a?.shadowRoot)===null||e===void 0)&&e.fullscreenElement;)a=a.shadowRoot.fullscreenElement;a===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,f&&f.container&&(f.container instanceof HTMLElement?this._container=f.container:u.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(f){return this._map=f,this._container||(this._container=this._map.getContainer()),this._controlContainer=ie.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){ie.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const f=this._fullscreenButton=ie.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);ie.create("span","maplibregl-ctrl-icon",f).setAttribute("aria-hidden","true"),f.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const f=this._getTitle();this._fullscreenButton.setAttribute("aria-label",f),this._fullscreenButton.title=f}_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 u.l("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new u.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()}},A.GeoJSONSource=da,A.GeolocateControl=class extends u.E{constructor(f){super(),this._onSuccess=e=>{if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new u.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_E
911RROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(e),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new u.l("geolocate",e)),this._finish()}},this._updateCamera=e=>{const a=new u.S(e.coords.longitude,e.coords.latitude),l=e.coords.accuracy,d=this._map.getBearing(),m=u.e({bearing:d},this.options.fitBoundsOptions),y=qi.fromLngLat(a,l);this._map.fitBounds(y,m,{geolocateSource:!0})},this._updateMarker=e=>{if(e){const a=new u.S(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(a).addTo(this._map),this._userLocationDotMarker.setLngLat(a).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(e.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const a=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=a,this._geolocateButton.setAttribute("aria-label",a),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(e.code===3&&ks)return;this.options.trackUserLocation&&this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new u.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=ie.create("button","maplibregl-ctrl-geolocate",this._container),ie.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(e===!1){u.w("Geolocation support is not available so the GeolocateControl will be disabled.");const a=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=a,this._geolocateButton.setAttribute("aria-label",a)}else{const a=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=a,this._geolocateButton.setAttribute("aria-label",a)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=ie.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new ao({element:this._dotElement}),this._circleElement=ie.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new ao({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",(a=>{const l=a?.[0]instanceof ResizeObserverEntry;a.geolocateSource||this._watchState!=="ACTIVE_LOCK"||l||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 u.l("trackuserlocationend")),this.fire(new u.l("userlocationlostfocus")))}))}},this.options=u.e({},Tn,f)}onAdd(f){return this._map=f,this._container=ie.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),(function(){return u._(this,arguments,void 0,(function*(e=!1){if(ki!==void 0&&!e)return ki;if(window.navigator.permissions===void 0)return ki=!!window.navigator.geolocation,ki;try{ki=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{ki=!!window.navigator.geolocation}return ki}))})().then((e=>this._finishSetupUI(e))),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),ie.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,ir=0,ks=!1}_isOutOfMapMaxBounds(f){const e=this._map.getMaxBounds(),a=f.coords;return e&&(a.longitude<e.getWest()||a.longitude>e.getEast()||a.latitude<e.getSouth()||a.latitude>e.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_E
911RROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadiusIfNeeded(){const f=this._userLocationDotMarker.getLngLat();if(!(this.options.showUserLocation&&this.options.showAccuracyCircle&&this._accuracy&&f))return;const e=this._map.project(f),a=this._map.unproject([e.x+100,e.y]),l=f.distanceTo(a)/100,d=2*this._accuracy/l;this._circleElement.style.width=`${d.toFixed(2)}px`,this._circleElement.style.height=`${d.toFixed(2)}px`}trigger(){if(!this._setup)return u.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 u.l("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":ir--,ks=!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 u.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 u.l("trackuserlocationstart")),this.fire(new u.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(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let f;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),ir++,ir>1?(f={maximumAge:6e5,timeout:0},ks=!0):(f=this.options.positionOptions,ks=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,f)}}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)}},A.GlobeControl=class{constructor(){this._toggleProjection=()=>{var f;const e=(f=this._map.getProjection())===null||f===void 0?void 0:f.type;this._map.setProjection(e!=="mercator"&&e?{type:"mercator"}:{type:"globe"}),this._updateGlobeIcon()},this._updateGlobeIcon=()=>{var f;this._globeButton.classList.remove("maplibregl-ctrl-globe"),this._globeButton.classList.remove("maplibregl-ctrl-globe-enabled"),((f=this._map.getProjection())===null||f===void 0?void 0:f.type)==="globe"?(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(f){return this._map=f,this._container=ie.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=ie.create("button","maplibregl-ctrl-globe",this._container),ie.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(){ie.remove(this._container),this._map.off("styledata",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},A.Hash=_a,A.ImageSource=Wn,A.KeyboardHandler=Ua,A.LngLatBounds=qi,A.LogoControl
vendor: 36,905 bytes, line 911
911=Oi,A.Map=class extends gu{constructor(f){var e,a;u.cw.mark(u.cx.create);const l=Object.assign(Object.assign(Object.assign({},Xn),f),{canvasContextAttributes:Object.assign(Object.assign({},Xn.canvasContextAttributes),f.canvasContextAttributes)});if(l.minZoom!=null&&l.maxZoom!=null&&l.minZoom>l.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(l.minPitch!=null&&l.maxPitch!=null&&l.minPitch>l.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(l.minPitch!=null&&l.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(l.maxPitch!=null&&l.maxPitch>180)throw new Error("maxPitch must be less than or equal to 180");const d=new Mi,m=new gr;if(l.minZoom!==void 0&&d.setMinZoom(l.minZoom),l.maxZoom!==void 0&&d.setMaxZoom(l.maxZoom),l.minPitch!==void 0&&d.setMinPitch(l.minPitch),l.maxPitch!==void 0&&d.setMaxPitch(l.maxPitch),l.renderWorldCopies!==void 0&&d.setRenderWorldCopies(l.renderWorldCopies),super(d,m,{bearingSnap:l.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new ji,this._controls=[],this._mapId=u.a7(),this._contextLost=w=>{w.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new u.l("webglcontextlost",{originalEvent:w}))},this._contextRestored=w=>{this._setupPainter(),this.resize(),this._update(),this.fire(new u.l("webglcontextrestored",{originalEvent:w}))},this._onMapScroll=w=>{if(w.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=l.interactive,this._maxTileCacheSize=l.maxTileCacheSize,this._maxTileCacheZoomLevels=l.maxTileCacheZoomLevels,this._canvasContextAttributes=Object.assign({},l.canvasContextAttributes),this._trackResize=l.trackResize===!0,this._bearingSnap=l.bearingSnap,this._centerClampedToGround=l.centerClampedToGround,this._refreshExpiredTiles=l.refreshExpiredTiles===!0,this._fadeDuration=l.fadeDuration,this._crossSourceCollisions=l.crossSourceCollisions===!0,this._collectResourceTiming=l.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},On),l.locale),this._clickTolerance=l.clickTolerance,this._overridePixelRatio=l.pixelRatio,this._maxCanvasSize=l.maxCanvasSize,this.transformCameraUpdate=l.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=l.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=ut.addThrottleControl((()=>this.isMoving())),this._requestManager=new Ze(l.transformRequest),typeof l.container=="string"){if(this._container=document.getElementById(l.container),!this._container)throw new Error(`Container '${l.container}' not found.`)}else{if(!(l.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=l.container}if(l.maxBounds&&this.setMaxBounds(l.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})),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let w=!1;const S=oa((P=>{this._trackResize&&!this._removed&&(this.resize(P),this.redraw())}),50);this._resizeObserver=new ResizeObserver((P=>{w?S(P):w=!0})),this._resizeObserver.observe(this._container)}this.handlers=new Ac(this,l),this._hash=l.hash&&new _a(typeof l.hash=="string"&&l.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:l.center,elevation:l.elevation,zoom:l.zoom,bearing:l.bearing,pitch:l.pitch,roll:l.roll}),l.bounds&&(this.resize(),this.fitBounds(l.bounds,u.e({},l.fitBoundsOptions,{duration:0}))));const y=typeof l.style=="string"||((a=(e=l.style)===null||e===void 0?void 0:e.projection)===null||a===void 0?void 0:a.type)!=="globe";this.resize(null,y),this._localIdeographFontFamily=l.localIdeographFontFamily,this._validateStyle=l.validateStyle,l.style&&this.setStyle(l.style,{localIdeographFontFamily:l.localIdeographFontFamily}),l.attributionControl&&this.addControl(new ci(typeof l.attributionControl=="boolean"?void 0:l.attributionControl)),l.maplibreLogo&&this.addControl(new Oi,l.logoPosition),this.on("style.load",(()=>{if(y||this._resizeTransform(),this.transform.unmodified){const w=u.Q(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(w)}})),this.on("data",(w=>{this._update(w.dataType==="style"),this.fire(new u.l(`${w.dataType}data`,w))})),this.on("dataloading",(w=>{this.fire(new u.l(`${w.dataType}dataloading`,w))})),this.on("dataabort",(w=>{this.fire(new u.l("sourcedataabort",w))}))}_getMapId(){return this._mapId}setGlobalStateProperty(f,e){return this.style.setGlobalStateProperty(f,e),this._update(!0)}getGlobalState(){return this.style.getGlobalState()}addControl(f,e){if(e===void 0&&(e=f.getDefaultPosition?f.getDefaultPosition():"top-right"),!f||!f.onAdd)return this.fire(new u.k(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const a=f.onAdd(this);this._controls.push(f);const l=this._controlPositions[e];return e.indexOf("bottom")!==-1?l.insertBefore(a,l.firstChild):l.appendChild(a),this}removeControl(f){if(!f||!f.onRemove)return this.fire(new u.k(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const e=this._controls.indexOf(f);return e>-1&&this._controls.splice(e,1),f.onRemove(this),this}hasControl(f){return this._controls.indexOf(f)>-1}coveringTiles(f){return Me(this.transform,f)}calculateCameraOptionsFromTo(f,e,a,l){return l==null&&this.terrain&&(l=this.terrain.getElevationForLngLatZoom(a,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(f,e,a,l)}resize(f,e=!0){const[a,l]=this._containerDimensions(),d=this._getClampedPixelRatio(a,l);if(this._resizeCanvas(a,l,d),this.painter.resize(a,l,d),this.painter.overLimit()){const y=this.painter.context.gl;this._maxCanvasSize=[y.drawingBufferWidth,y.drawingBufferHeight];const w=this._getClampedPixelRatio(a,l);this._resizeCanvas(a,l,w),this.painter.resize(a,l,w)}this._resizeTransform(e);const m=!this._moving;return m&&(this.stop(),this.fire(new u.l("movestart",f)).fire(new u.l("move",f))),this.fire(new u.l("resize",f)),m&&this.fire(new u.l("moveend",f)),this}_resizeTransform(f=!0){var e;const[a,l]=this._containerDimensions();this.transform.resize(a,l,f),(e=this._requestedCameraState)===null||e===void 0||e.resize(a,l,f)}_getClampedPixelRatio(f,e){const{0:a,1:l}=this._maxCanvasSize,d=this.getPixelRatio(),m=f*d,y=e*d;return Math.min(m>a?a/m:1,y>l?l/y:1)*d}getPixelRatio(){var f;return(f=this._overridePixelRatio)!==null&&f!==void 0?f:devicePixelRatio}setPixelRatio(f){this._overridePixelRatio=f,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(f){return this.transform.setMaxBounds(qi.convert(f)),this._update()}setMinZoom(f){if((f=f??-2)>=-2&&f<=this.transform.maxZoom)return this.transform.setMinZoom(f),this._update(),this.getZoom()<f&&this.setZoom(f),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(f){if((f=f??22)>=this.transform.minZoom)return this.transform.setMaxZoom(f),this._update(),this.getZoom()>f&&this.setZoom(f),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(f){if((f=f??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(f>=0&&f<=this.transform.maxPitch)return this.transform.setMinPitch(f),this._update(),this.getPitch()<f&&this.setPitch(f),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(f){if((f=f??60)>180)throw new Error("maxPitch must be less than or equal to 180");if(f>=this.transform.minPitch)return this.transform.setMaxPitch(f),this._update(),this.getPitch()>f&&this.setPitch(f),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(f){return this.transform.setRenderWorldCopies(f),this._update()}project(f){return this.transform.locationToScreenPoint(u.S.convert(f),this.style&&this.terrain)}unproject(f){return this.transform.screenPointToLocation(u.P.convert(f),this.terrain)}isMoving(){var f;return this._moving||((f=this.handlers)===null||f===void 0?void 0:f.isMoving())}isZooming(){var f;return this._zooming||((f=this.handlers)===null||f===void 0?void 0:f.isZooming())}isRotating(){var f;return this._rotating||((f=this.handlers)===null||f===void 0?void 0:f.isRotating())}_createDelegatedListener(f,e,a){if(f==="mouseenter"||f==="mouseover"){let l=!1;return{layers:e,listener:a,delegates:{mousemove:m=>{const y=e.filter((S=>this.getLayer(S))),w=y.length!==0?this.queryRenderedFeatures(m.point,{layers:y}):[];w.length?l||(l=!0,a.call(this,new Bn(f,this,m.originalEvent,{features:w}))):l=!1},mouseout:()=>{l=!1}}}}if(f==="mouseleave"||f==="mouseout"){let l=!1;return{layers:e,listener:a,delegates:{mousemove:y=>{const w=e.filter((S=>this.getLayer(S)));(w.length!==0?this.queryRenderedFeatures(y.point,{layers:w}):[]).length?l=!0:l&&(l=!1,a.call(this,new Bn(f,this,y.originalEvent)))},mouseout:y=>{l&&(l=!1,a.call(this,new Bn(f,this,y.originalEvent)))}}}}{const l=d=>{const m=e.filter((w=>this.getLayer(w))),y=m.length!==0?this.queryRenderedFeatures(d.point,{layers:m}):[];y.length&&(d.features=y,a.call(this,d),delete d.features)};return{layers:e,listener:a,delegates:{[f]:l}}}}_saveDelegatedListener(f,e){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[f]=this._delegatedListeners[f]||[],this._delegatedListeners[f].push(e)}_removeDelegatedListener(f,e,a){if(!this._delegatedListeners||!this._delegatedListeners[f])return;const l=this._delegatedListeners[f];for(let d=0;d<l.length;d++){const m=l[d];if(m.listener===a&&m.layers.length===e.length&&m.layers.every((y=>e.includes(y)))){for(const y in m.delegates)this.off(y,m.delegates[y]);return void l.splice(d,1)}}}on(f,e,a){if(a===void 0)return super.on(f,e);const l=typeof e=="string"?[e]:e,d=this._createDelegatedListener(f,l,a);this._saveDelegatedListener(f,d);for(const m in d.delegates)this.on(m,d.delegates[m]);return{unsubscribe:()=>{this._removeDelegatedListener(f,l,a)}}}once(f,e,a){if(a===void 0)return super.once(f,e);const l=typeof e=="string"?[e]:e,d=this._createDelegatedListener(f,l,a);for(const m in d.delegates){const y=d.delegates[m];d.delegates[m]=(...w)=>{this._removeDelegatedListener(f,l,a),y(...w)}}this._saveDelegatedListener(f,d);for(const m in d.delegates)this.once(m,d.delegates[m]);return this}off(f,e,a){return a===void 0?super.off(f,e):(this._removeDelegatedListener(f,typeof e=="string"?[e]:e,a),this)}queryRenderedFeatures(f,e){if(!this.style)return[];let a;const l=f instanceof u.P||Array.isArray(f),d=l?f:[[0,0],[this.transform.width,this.transform.height]];if(e=e||(l?{}:f)||{},d instanceof u.P||typeof d[0]=="number")a=[u.P.convert(d)];else{const m=u.P.convert(d[0]),y=u.P.convert(d[1]);a=[m,new u.P(y.x,m.y),y,new u.P(m.x,y.y),m]}return this.style.queryRenderedFeatures(a,e,this.transform)}querySourceFeatures(f,e){return this.style.querySourceFeatures(f,e)}setStyle(f,e){return(e=u.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},e)).diff!==!1&&e.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&f?(this._diffStyle(f,e),this):(this._localIdeographFontFamily=e.localIdeographFontFamily,this._updateStyle(f,e))}setTransformRequest(f){return this._requestManager.setTransformRequest(f),this}_getUIString(f){const e=this._locale[f];if(e==null)throw new Error(`Missing UI string '${f}'`);return e}_updateStyle(f,e){var a,l;if(e.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",(()=>this._updateStyle(f,e)));const d=this.style&&e.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!f)),f?(this.style=new Qu(this,e||{}),this.style.setEventedParent(this,{style:this.style}),typeof f=="string"?this.style.loadURL(f,e,d):this.style.loadJSON(f,e,d),this):((l=(a=this.style)===null||a===void 0?void 0:a.projection)===null||l===void 0||l.destroy(),delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Qu(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(f,e){if(typeof f=="string"){const a=this._requestManager.transformRequest(f,"Style");u.j(a,new AbortController).then((l=>{this._updateDiff(l.data,e)})).catch((l=>{l&&this.fire(new u.k(l))}))}else typeof f=="object"&&this._updateDiff(f,e)}_updateDiff(f,e){try{this.style.setState(f,e)&&this._update(!0)}catch(a){u.w(`Unable to perform style diff: ${a.message||a.error||a}.  Rebuilding the style from scratch.`),this._updateStyle(f,e)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():u.w("There is no style added to the map.")}addSource(f,e){return this._lazyInitEmptyStyle(),this.style.addSource(f,e),this._update(!0)}isSourceLoaded(f){const e=this.style&&this.style.sourceCaches[f];if(e!==void 0)return e.loaded();this.fire(new u.k(new Error(`There is no source with ID '${f}'`)))}setTerrain(f){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),f){const e=this.style.sourceCaches[f.source];if(!e)throw new Error(`cannot load terrain, because there exists no source with ID: ${f.source}`);this.terrain===null&&e.reload();for(const a in this.style._layers){const l=this.style._layers[a];l.type==="hillshade"&&l.source===f.source&&u.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."),l.type==="color-relief"&&l.source===f.source&&u.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 It(this.painter,e,f),this.painter.renderToTexture=new zs(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=a=>{var l;a.dataType==="style"?this.terrain.sourceCache.freeRtt():a.dataType==="source"&&a.tile&&(a.sourceId!==f.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))),((l=a.source)===null||l===void 0?void 0:l.type)==="image"?this.terrain.sourceCache.freeRtt():this.terrain.sourceCache.freeRtt(a.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0);return this.fire(new u.l("terrain",{terrain:f})),this}getTerrain(){var f,e;return(e=(f=this.terrain)===null||f===void 0?void 0:f.options)!==null&&e!==void 0?e:null}areTilesLoaded(){const f=this.style&&this.style.sourceCaches;for(const e in f){const a=f[e]._tiles;for(const l in a){const d=a[l];if(d.state!=="loaded"&&d.state!=="errored")return!1}}return!0}removeSource(f){return this.style.removeSource(f),this._update(!0)}getSource(f){return this.style.getSource(f)}setSourceTileLodParams(f,e,a){if(a){const l=this.getSource(a);if(!l)throw new Error(`There is no source with ID "${a}", cannot set LOD parameters`);l.calculateTileZoom=rt(Math.max(1,f),Math.max(1,e))}else for(const l in this.style.sourceCaches)this.style.sourceCaches[l].getSource().calculateTileZoom=rt(Math.max(1,f),Math.max(1,e));return this._update(!0),this}refreshTiles(f,e){const a=this.style.sourceCaches[f];if(!a)throw new Error(`There is no source cache with ID "${f}", cannot refresh tile`);e===void 0?a.reload(!0):a.refreshTiles(e.map((l=>new u.a4(l.z,l.x,l.y))))}addImage(f,e,a={}){const{pixelRatio:l=1,sdf:d=!1,stretchX:m,stretchY:y,content:w,textFitWidth:S,textFitHeight:P}=a;if(this._lazyInitEmptyStyle(),!(e instanceof HTMLImageElement||u.b(e))){if(e.width===void 0||e.height===void 0)return this.fire(new u.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:k,height:B,data:L}=e,j=e;return this.style.addImage(f,{data:new u.R({width:k,height:B},new Uint8Array(L)),pixelRatio:l,stretchX:m,stretchY:y,content:w,textFitWidth:S,textFitHeight:P,sdf:d,version:0,userImage:j}),j.onAdd&&j.onAdd(this,f),this}}{const{width:k,height:B,data:L}=Ce.getImageData(e);this.style.addImage(f,{data:new u.R({width:k,height:B},L),pixelRatio:l,stretchX:m,stretchY:y,content:w,textFitWidth:S,textFitHeight:P,sdf:d,version:0})}}updateImage(f,e){const a=this.style.getImage(f);if(!a)return this.fire(new u.k(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const l=e instanceof HTMLImageElement||u.b(e)?Ce.getImageData(e):e,{width:d,height:m,data:y}=l;if(d===void 0||m===void 0)return this.fire(new u.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(d!==a.data.width||m!==a.data.height)return this.fire(new u.k(new Error("The width and height of the updated image must be that same as the previous version of the image")));const w=!(e instanceof HTMLImageElement||u.b(e));return a.data.replace(y,w),this.style.updateImage(f,a),this}getImage(f){return this.style.getImage(f)}hasImage(f){return f?!!this.style.getImage(f):(this.fire(new u.k(new Error("Missing required image id"))),!1)}removeImage(f){this.style.removeImage(f)}loadImage(f){return ut.getImage(this._requestManager.transformRequest(f,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(f,e){return this._lazyInitEmptyStyle(),this.style.addLayer(f,e),this._update(!0)}moveLayer(f,e){return this.style.moveLayer(f,e),this._update(!0)}removeLayer(f){return this.style.removeLayer(f),this._update(!0)}getLayer(f){return this.style.getLayer(f)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(f,e,a){return this.style.setLayerZoomRange(f,e,a),this._update(!0)}setFilter(f,e,a={}){return this.style.setFilter(f,e,a),this._update(!0)}getFilter(f){return this.style.getFilter(f)}setPaintProperty(f,e,a,l={}){return this.style.setPaintProperty(f,e,a,l),this._update(!0)}getPaintProperty(f,e){return this.style.getPaintProperty(f,e)}setLayoutProperty(f,e,a,l={}){return this.style.setLayoutProperty(f,e,a,l),this._update(!0)}getLayoutProperty(f,e){return this.style.getLayoutProperty(f,e)}setGlyphs(f,e={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(f,e),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(f,e,a={}){return this._lazyInitEmptyStyle(),this.style.addSprite(f,e,a,(l=>{l||this._update(!0)})),this}removeSprite(f){return this._lazyInitEmptyStyle(),this.style.removeSprite(f),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(f,e={}){return this._lazyInitEmptyStyle(),this.style.setSprite(f,e,(a=>{a||this._update(!0)})),this}setLight(f,e={}){return this._lazyInitEmptyStyle(),this.style.setLight(f,e),this._update(!0)}getLight(){return this.style.getLight()}setSky(f,e={}){return this._lazyInitEmptyStyle(),this.style.setSky(f,e),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(f,e){return this.style.setFeatureState(f,e),this._update()}removeFeatureState(f,e){return this.style.removeFeatureState(f,e),this._update()}getFeatureState(f){return this.style.getFeatureState(f)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let f=0,e=0;return this._container&&(f=this._container.clientWidth||400,e=this._container.clientHeight||300),[f,e]}_setupContainer(){const f=this._container;f.classList.add("maplibregl-map");const e=this._canvasContainer=ie.create("div","maplibregl-canvas-container",f);this._interactive&&e.classList.add("maplibregl-interactive"),this._canvas=ie.create("canvas","maplibregl-canvas",e),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");const a=this._containerDimensions(),l=this._getClampedPixelRatio(a[0],a[1]);this._resizeCanvas(a[0],a[1],l);const d=this._controlContainer=ie.create("div","maplibregl-control-container",f),m=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach((y=>{m[y]=ie.create("div",`maplibregl-ctrl-${y} `,d)})),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(f,e,a){this._canvas.width=Math.floor(a*f),this._canvas.height=Math.floor(a*e),this._canvas.style.width=`${f}px`,this._canvas.style.height=`${e}px`}_setupPainter(){const f=Object.assign(Object.assign({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0});let e=null;this._canvas.addEventListener("webglcontextcreationerror",(l=>{e={requestedAttributes:f},l&&(e.statusMessage=l.statusMessage,e.type=l.type)}),{once:!0});let a=null;if(a=this._canvasContextAttributes.contextType?this._canvas.getContext(this._canvasContextAttributes.contextType,f):this._canvas.getContext("webgl2",f)||this._canvas.getContext("webgl",f),!a){const l="Failed to initialize WebGL";throw e?(e.message=l,new Error(JSON.stringify(e))):new Error(l)}this.painter=new uu(a,this.transform),Fe.testSupport(a)}migrateProjection(f,e){super.migrateProjection(f,e),this.painter.transform=f,this.fire(new u.l("projectiontransition",{newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(f){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||f,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(f){return this._update(),this._renderTaskQueue.add(f)}_cancelRenderFrame(f){this._renderTaskQueue.remove(f)}_render(f){var e,a,l,d,m;const y=this._idleTriggered?this._fadeDuration:0,w=((e=this.style.projection)===null||e===void 0?void 0:e.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(f),this._removed)return;let S=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const B=this.transform.zoom,L=Ce.now();this.style.zoomHistory.update(B,L);const j=new u.F(B,{now:L,fadeDuration:y,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition(),globalState:this.style.getGlobalState()}),G=j.crossFadingFactor();G===1&&G===this._crossFadingFactor||(S=!0,this._crossFadingFactor=G),this.style.update(j)}const P=((a=this.style.projection)===null||a===void 0?void 0:a.transitionState)>0!==w;(l=this.style.projection)===null||l===void 0||l.setErrorQueryLatitudeDegrees(this.transform.center.lat),this.transform.setTransitionState((d=this.style.projection)===null||d===void 0?void 0:d.transitionState,(m=this.style.projection)===null||m===void 0?void 0:m.latitudeErrorCorrectionRadians),this.style&&(this._sourcesDirty||P)&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.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,y,this._crossSourceCollisions,P),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:y,showPadding:this.showPadding}),this.fire(new u.l("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,u.cw.mark(u.cx.load),this.fire(new u.l("load"))),this.style&&(this.style.hasTransitions()||S)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const k=this._sourcesDirty||this._styleDirty||this._placementDirty;return k||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new u.l("idle")),!this._loaded||this._fullyLoaded||k||(this._fullyLoaded=!0,u.cw.mark(u.cx.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var f;this._hash&&this._hash.remove();for(const a of this._controls)a.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),ut.removeThrottleControl(this._imageQueueHandle),(f=this._resizeObserver)===null||f===void 0||f.disconnect();const e=this.painter.context.gl.getExtension("WEBGL_lose_context");e?.loseContext&&e.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),ie.remove(this._canvasContainer),ie.remove(this._controlContainer),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),u.cw.clearMetrics(),this._removed=!0,this.fire(new u.l("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,Ce.frame(this._frameRequest,(f=>{u.cw.frame(f),this._frameRequest=null;try{this._render(f)}catch(e){if(!u.cy(e)&&!(function(a){return a.message===yc})(e))throw e}}),(()=>{})))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(f){this._showTileBoundaries!==f&&(this._showTileBoundaries=f,this._update())}get showPadding(){return!!this._showPadding}set showPadding(f){this._showPadding!==f&&(this._showPadding=f,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(f){this._showCollisionBoxes!==f&&(this._showCollisionBoxes=f,f?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(f){this._showOverdrawInspector!==f&&(this._showOverdrawInspector=f,this._update())}get repaint(){return!!this._repaint}set repaint(f){this._repaint!==f&&(this._repaint=f,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(f){this._vertices=f,this._update()}get version(){return br}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(f){return this._lazyInitEmptyStyle(),this.style.setProjection(f),this._update(!0)}},A.MapMouseEvent=Bn,A.MapTouchEvent=El,A.MapWheelEvent=uh,A.Marker=ao,A.NavigationControl=class{constructor(f){this._updateZoomButtons=()=>{const e=this._map.getZoom(),a=e===this._map.getMaxZoom(),l=e===this._map.getMinZoom();this._zoomInButton.disabled=a,this._zoomOutButton.disabled=l,this._zoomInButton.setAttribute("aria-disabled",a.toString()),this._zoomOutButton.setAttribute("aria-disabled",l.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,a)=>{const l=this._map._getUIString(`NavigationControl.${a}`);e.title=l,e.setAttribute("aria-label",l)},this.options=u.e({},mh,f),this._container=ie.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}))),ie.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}))),ie.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=ie.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(f){return this._map=f,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 Dl(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){ie.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(f,e){const a=ie.create("button",f,this._container);return a.type="button",a.addEventListener("click",e),a}},A.Popup=class extends u.E{constructor(f){super(),this._updateOpacity=()=>{this.options.locationOccludedOpacity!==void 0&&(this._container.style.opacity=this._map.transform.isLocationOccluded(this.getLngLat())?`${this.options.locationOccludedOpacity}`:"")},this.remove=()=>(this._content&&ie.remove(this._content),this._container&&(ie.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 u.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=ie.create("div","maplibregl-popup",this._map.getContainer()),this._tip=ie.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const y of this.options.className.split(" "))this._container.classList.add(y);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=wr(this._lngLat,this._flatPos,this._map.transform,this._trackPointer),this._trackPointer&&!e)return;const a=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 l=this.options.anchor;const d=Ol(this.options.offset);if(!l){const y=this._container.offsetWidth,w=this._container.offsetHeight;let S;S=a.y+d.bottom.y<w?["top"]:a.y>this._map.transform.height-w?["bottom"]:[],a.x<y/2?S.push("left"):a.x>this._map.transform.width-y/2&&S.push("right"),l=S.length===0?"bottom":S.join("-")}let m=a.add(d[l]);this.options.subpixelPositioning||(m=m.round()),ie.setTransform(this._container,`${Ll[l]} translate(${m.x}px,${m.y}px)`),no(this._container,l,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=u.e(Object.create(Va),f)}addTo(f){return this._map&&this.remove(),this._map=f,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 u.l("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(f){return this._lngLat=u.S.convert(f),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(f){return this.setDOMContent(document.createTextNode(f))}setHTML(f){const e=document.createDocumentFragment(),a=document.createElement("body");let l;for(a.innerHTML=f;l=a.firstChild,l;)e.appendChild(l);return this.setDOMContent(e)}getMaxWidth(){var f;return(f=this._container)===null||f===void 0?void 0:f.style.maxWidth}setMaxWidth(f){return this.options.maxWidth=f,this._update(),this}setDOMContent(f){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=ie.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(f),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(f){return this._container&&this._container.classList.add(f),this}removeClassName(f){return this._container&&this._container.classList.remove(f),this}setOffset(f){return this.options.offset=f,this._update(),this}toggleClassName(f){if(this._container)return this._container.classList.toggle(f)}setSubpixelPositioning(f){this.options.subpixelPositioning=f}_createCloseButton(){this.options.closeButton&&(this._closeButton=ie.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const f=this._container.querySelector(Bl);
911f&&f.focus()}},A.RasterDEMTileSource=Kr,A.RasterTileSource=ha,A.ScaleControl=class{constructor(f){this._onMove=()=>{Ko(this._map,this._container,this.options)},this.setUnit=e=>{this.options.unit=e,Ko(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Is),f)}getDefaultPosition(){return"bottom-left"}onAdd(f){return this._map=f,this._container=ie.create("div","maplibregl-ctrl maplibregl-ctrl-scale",f.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){ie.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},A.ScrollZoomHandler=Ps,A.Style=Qu,A.TerrainControl=class{constructor(f){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=f}onAdd(f){return this._map=f,this._container=ie.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=ie.create("button","maplibregl-ctrl-terrain",this._container),ie.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(){ie.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},A.TwoFingersTouchPitchHandler=Cc,A.TwoFingersTouchRotateHandler=Zo,A.TwoFingersTouchZoomHandler=Mc,A.TwoFingersTouchZoomRotateHandler=fh,A.VectorTileSource=Kn,A.VideoSource=ms,A.addSourceType=(f,e)=>u._(void 0,void 0,void 0,(function*(){if(Da(f))throw new Error(`A source type called "${f}" already exists.`);((a,l)=>{Qa[a]=l})(f,e)})),A.clearPrewarmedResources=function(){const f=at;f&&(f.isPreloaded()&&f.numActive()===1?(f.release(_e),at=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},A.createTileMesh=Yu,A.getMaxParallelImageRequests=function(){return u.a.MAX_PARALLEL_IMAGE_REQUESTS},A.getRTLTextPluginStatus=function(){return sr().getRTLTextPluginStatus()},A.getVersion=function(){return Pc},A.getWorkerCount=function(){return Xe.workerCount},A.getWorkerUrl=function(){return u.a.WORKER_URL},A.importScriptInWorkers=function(f){return di().broadcast("IS",f)},A.prewarm=function(){Ft().acquire(_e)},A.setMaxParallelImageRequests=function(f){u.a.MAX_PARALLEL_IMAGE_REQUESTS=f},A.setRTLTextPlugin=function(f,e){return sr().setRTLTextPlugin(f,e)},A.setWorkerCount=function(f){Xe.workerCount=f},A.setWorkerUrl=function(f){u.a.WORKER_URL=f}}));var X=z;return X}))})(Yp)),Yp.exports}var Wa=Ax();class Px{constructor(E){this.fencePoints=[],this.fenceMarkerList=[],this._isDrawingFence=!1,this.fences=[],this.currentFenceId=0,this.fenceSourceId="fence",this.fenceLayerId="fence-fill",this.dynamicPolylineSourceId="dynamic-fence",this.dynamicPolylineLayerId="dynamic-fence-line",this.updateDynamicPolyline=z=>{if(!this._isDrawingFence||this.fencePoints.length===0)return;const I=[z.lngLat.lng,z.lngLat.lat],V=[...this.fencePoints,I];this.map.getSource(this.dynamicPolylineSourceId).setData({type:"Feature",geometry:{type:"LineString",coordinates:V},properties:{}})},this.map=E}addFencePoint(E,z=null,I=null,V){if(!this.map)throw new Error("Map not initialized.");if(this.isFenceCompleted()&&!this.isPointInsideFence(E)&&this.startNewFence(),this._isDrawingFence&&this.isClickOnStartingFencePoint(E)){this.closeFence();return}this.fencePoints.push(E);const X=z||"https://cdn-icons-png.flaticon.com/512/484/484167.png",{marker:A}=V(E,X,[30,30],I||void 0);this.fenceMarkerList.push(A),this.fencePoints.length>=3&&this.drawFence(),this.fencePoints.length===1&&this.startFenceDrawing()}startFenceDrawing(){this.map&&(this._isDrawingFence=!0,this.map.addSource(this.dynamicPolylineSourceId,{type:"geojson",data:{type:"Feature",geometry:{type:"LineString",coordinates:[]},properties:{}}}),this.map.addLayer({id:this.dynamicPolylineLayerId,type:"line",source:this.dynamicPolylineSourceId,paint:{"line-color":"#ff0000","line-width":2,"line-dasharray":[2,2]}}),this.map.on("mousemove",this.updateDynamicPolyline))}stopFenceDrawing(){this.map&&(this._isDrawingFence=!1,this.map.getLayer(this.dynamicPolylineLayerId)&&this.map.removeLayer(this.dynamicPolylineLayerId),this.map.getSource(this.dynamicPolylineSourceId)&&this.map.removeSource(this.dynamicPolylineSourceId),this.map.off("mousemove",this.updateDynamicPolyline))}closeFence(){this.fencePoints.length<3||(this.fencePoints.push(this.fencePoints[0]),this.drawFence(),this.stopFenceDrawing())}startNewFence(){if(this.isFenceCompleted()){const E={id:this.currentFenceId++,points:[...this.fencePoints],markers:[...this.fenceMarkerList],sourceId:`${this.fenceSourceId}-${this.currentFenceId}`,layerId:`${this.fenceLayerId}-${this.currentFenceId}`};this.fences.push(E),this.fencePoints=[],this.fenceMarkerList=[],this.stopFenceDrawing(),this.drawAllFences()}}clearFence(){this.map&&(this.fencePoints=[],this.map.getSource(this.fenceSourceId)&&(this.map.removeLayer(this.fenceLayerId),this.map.removeSource(this.fenceSourceId)
911),this.fenceMarkerList.forEach(E=>E.remove()),this.fenceMarkerList=[],this.stopFenceDrawing())}clearAllFences(){this.map&&(this.clearFence(),this.fences.forEach(E=>{this.map.getSource(E.sourceId)&&(this.map.removeLayer(E.layerId),this.map.removeSource(E.sourceId)),E.markers.forEach(z=>z.remove())}),this.fences=[],this.currentFenceId=0)}drawFence(){if(this.fencePoints.length<3)return;const z={type:"Feature",geometry:{type:"Polygon",coordinates:[[...this.fencePoints,this.fencePoints[0]]]},properties:{}};this.map.getSource(this.fenceSourceId)?this.map.getSource(this.fenceSourceId).setData(z):(this.map.addSource(this.fenceSourceId,{type:"geojson",data:z}),this.map.addLayer({id:this.fenceLayerId,type:"fill",source:this.fenceSourceId,layout:{},paint:{"fill-color":"#ff0000","fill-opacity":.3}}))}drawAllFences(){this.fences.forEach(E=>this.drawStoredFence(E)),this.fencePoints.length>=3&&this.drawFence()}drawStoredFence(E){if(E.points.length<3)return;const I={type:"Feature",geometry:{type:"Polygon",coordinates:[[...E.points,E.points[0]]]},properties:{}};this.map.getSource(E.sourceId)?this.map.getSource(E.sourceId).setData(I):(this.map.addSource(E.sourceId,{type:"geojson",data:I}),this.map.addLayer({id:E.layerId,type:"fill",source:E.sourceId,layout:{},paint:{"fill-color":"#ff0000","fill-opacity":.3}}))}isFenceCompleted(){return this.fencePoints.length>=3&&!this._isDrawingFence}isPointInsideFence(E){if(this.fencePoints.length<3)return!1;const z=E[0],I=E[1];let V=!1;for(let X=0,A=this.fencePoints.length-1;X<this.fencePoints.length;A=X++){const u=this.fencePoints[X][0],H=this.fencePoints[X][1],ne=this.fencePoints[A][0],se=this.fencePoints[A][1];H>I!=se>I&&z<(ne-u)*(I-H)/(se-H)+u&&(V=!V)}return V}isClickOnExistingFencePoint(E){for(let z=0;z<this.fencePoints.length;z++){const I=this.fencePoints[z];if(this.calculateDistance(E,I)<5e-4)return!0}return!1}isClickOnStartingFencePoint(E){if(this.fencePoints.length==0)return;const z=this.fencePoints[0];return this.calculateDistance(E,z)<5e-4}calculateDistance(E,z){const I=E[0]-z[0],V=E[1]-z[1];return Math.sqrt(I*I+V*V)}getFencePoints(){return this.fencePoints}getFences(){return this.fences}isDrawingFence(){return this._isDrawingFence}}const gg=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],bm=1,Hf=8;class Om{static from(E){if(!(E instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[z,I]=new Uint8Array(E,0,2);if(z!==219)throw new Error("Data does not appear to be in a KDBush format.");const V=I>>4;if(V!==bm)throw new Error(`Got v${V} data when expected v${bm}.`);const X=gg[I&15];if(!X)throw new Error("Unrecognized array type.");const[A]=new Uint16Array(E,2,1),[u]=new Uint32Array(E,4,1);return new Om(u,A,X,E)}constructor(E,z=64,I=Float64Array,V){if(isNaN(E)||E<0)throw new Error(`Unpexpected numItems value: ${E}.`);this.numItems=+E,this.nodeSize=Math.min(Math.max(+z,2),65535),this.ArrayType=I,this.IndexArrayType=E<65536?Uint16Array:Uint32Array;const X=gg.indexOf(this.ArrayType),A=E*2*this.ArrayType.BYTES_PER_ELEMENT,u=E*this.IndexArrayType.BYTES_PER_ELEMENT,H=(8-u%8)%8;if(X<0)throw new Error(`Unexpected typed array class: ${I}.`);V&&V instanceof ArrayBuffer?(this.data=V,this.ids=new this.IndexArrayType(this.data,Hf,E),this.coords=new this.ArrayType(this.data,Hf+u+H,E*2),this._pos=E*2,this._finished=!0):(this.data=new ArrayBuffer(Hf+A+u+H),this.ids=new this.IndexArrayType(this.data,Hf,E),this.coords=new this.ArrayType(this.data,Hf+u+H,E*2),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,(bm<<4)+X]),new Uint16Array(this.data,2,1)[0]=z,new Uint32Array(this.data,4,1)[0]=E)}add(E,z){const I=this._pos>>1;return this.ids[I]=I,this.coords[this._pos++]=E,this.coords[this._pos++]=z,I}finish(){const E=this._pos>>1;if(E!==this.numItems)throw new Error(`Added ${E} items when expected ${this.numItems}.`);return Am(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(E,z,I,V){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:X,coords:A,nodeSize:u}=this,H=[0,X.length-1,0],ne=[];for(;H.length;){const se=H.pop()||0,we=H.pop()||0,Ce=H.pop()||0;if(we-Ce<=u){for(let xe=Ce;xe<=we;xe++){const et=A[2*xe],qe=A[2*xe+1];et>=E&&et<=I&&qe>=z&&qe<=V&&ne.push(X[xe])}continue}const ie=Ce+we>>1,Fe=A[2*ie],He=A[2*ie+1];Fe>=E&&Fe<=I&&He>=z&&He<=V&&ne.push(X[ie]),(se===0?E<=Fe:z<=He)&&(H.push(Ce),H.push(ie-1),H.push(1-se)),(se===0?I>=Fe:V>=He)&&(H.push(ie+1),H.push(we),H.push(1-se))}return ne}within(E,z,I){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:V,coords:X,nodeSize:A}=this,u=[0,V.length-1,0],H=[],ne=I*I;for(;u.length;){const se=u.pop()||0,we=u.pop()||0,Ce=u.pop()||0;if(we-Ce<=A){for(let xe=Ce;xe<=we;xe++)_g(X[2*xe],X[2*xe+1],E,z)<=ne&&H.push(V[xe]);continue}const ie=Ce+we>>1,Fe=X[2*ie],He=X[2*ie+1];_g(Fe,He,E,z)<=ne&&H.push(V[ie]),(se===0?E-I<=Fe:z-I<=He)&&(u.pu
vendor: 2,797 bytes, line 911
911sh(Ce),u.push(ie-1),u.push(1-se)),(se===0?E+I>=Fe:z+I>=He)&&(u.push(ie+1),u.push(we),u.push(1-se))}return H}}function Am(R,E,z,I,V,X){if(V-I<=z)return;const A=I+V>>1;qg(R,E,A,I,V,X),Am(R,E,z,I,A-1,1-X),Am(R,E,z,A+1,V,1-X)}function qg(R,E,z,I,V,X){for(;V>I;){if(V-I>600){const ne=V-I+1,se=z-I+1,we=Math.log(ne),Ce=.5*Math.exp(2*we/3),ie=.5*Math.sqrt(we*Ce*(ne-Ce)/ne)*(se-ne/2<0?-1:1),Fe=Math.max(I,Math.floor(z-se*Ce/ne+ie)),He=Math.min(V,Math.floor(z+(ne-se)*Ce/ne+ie));qg(R,E,z,Fe,He,X)}const A=E[2*z+X];let u=I,H=V;for(Xf(R,E,I,z),E[2*V+X]>A&&Xf(R,E,I,V);u<H;){for(Xf(R,E,u,H),u++,H--;E[2*u+X]<A;)u++;for(;E[2*H+X]>A;)H--}E[2*I+X]===A?Xf(R,E,I,H):(H++,Xf(R,E,H,V)),H<=z&&(I=H+1),z<=H&&(V=H-1)}}function Xf(R,E,z,I){wm(R,z,I),wm(E,2*z,2*I),wm(E,2*z+1,2*I+1)}function wm(R,E,z){const I=R[E];R[E]=R[z],R[z]=I}function _g(R,E,z,I){const V=R-z,X=E-I;return V*V+X*X}const zx={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:R=>R},yg=Math.fround||(R=>(E=>(R[0]=+E,R[0])))(new Float32Array(1)),qh=2,Vu=3,Sm=4,Uu=5,$g=6;class kx{constructor(E){this.options=Object.assign(Object.create(zx),E),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(E){const{log:z,minZoom:I,maxZoom:V}=this.options;z&&console.time("total time");const X=`prepare ${E.length} points`;z&&console.time(X),this.points=E;const A=[];for(let H=0;H<E.length;H++){const ne=E[H];if(!ne.geometry)continue;const[se,we]=ne.geometry.coordinates,Ce=yg($p(se)),ie=yg(Hp(we));A.push(Ce,ie,1/0,H,-1,1),this.options.reduce&&A.push(0)}let u=this.trees[V+1]=this._createTree(A);z&&console.timeEnd(X);for(let H=V;H>=I;H--){const ne=+Date.now();u=this.trees[H]=this._createTree(this._cluster(u,H)),z&&console.log("z%d: %d clusters in %dms",H,u.numItems,+Date.now()-ne)}return z&&console.timeEnd("total time"),this}getClusters(E,z){let I=((E[0]+180)%360+360)%360-180;const V=Math.max(-90,Math.min(90,E[1]));let X=E[2]===180?180:((E[2]+180)%360+360)%360-180;const A=Math.max(-90,Math.min(90,E[3]));if(E[2]-E[0]>=360)I=-180,X=180;else if(I>X){const we=this.getClusters([I,V,180,A],z),Ce=this.getClusters([-180,V,X,A],z);return we.concat(Ce)}const u=this.trees[this._limitZoom(z)],H=u.range($p(I),Hp(A),$p(X),Hp(V)),ne=u.data,se=[];for(const we of H){const Ce=this.stride*we;se.push(ne[Ce+Uu]>1?xg(ne,Ce,this.clusterProps):this.points[ne[Ce+Vu]])}return se}getChildren(E){const z=this._getOriginId(E),I=this._getOriginZoom(E),V="No cluster with the specified id.",X=this.trees[I];if(!X)throw new Error(V);const A=X.data;if(z*this.stride>=A.length)throw new Error(V);const u=this.options.radius/(this.options.extent*Math.pow(2,I-1)),H=A[z*this.stride],ne=A[z*this.stride+1],se=X.within(H,ne,u),we=[];for(const Ce of se){const ie=Ce*this.stride;
911A[ie+Sm]===E&&we.push(A[ie+Uu]>1?xg(A,ie,this.clusterProps):this.points[A[ie+Vu]])}if(we.length===0)throw new Error(V);return we}getLeaves(E,z,I){z=z||10,I=I||0;const V=[];return this._appendLeaves(V,E,z,I,0),V}getTile(E,z,I){const V=this.trees[this._limitZoom(E)],X=Math.pow(2,E),{extent:A,radius:u}=this.options,H=u/A,ne=(I-H)/X,se=(I+1+H)/X,we={features:[]};return this._addTileFeatures(V.range((z-H)/X,ne,(z+1+H)/X,se),V.data,z,I,X,we),z===0&&this._addTileFeatures(V.range(1-H/X,ne,1,se),V.data,X,I,X,we),z===X-1&&this._addTileFeatures(V.range(0,ne,H/X,se),V.data,-1,I,X,we),we.features.length?we:null}getClusterExpansionZoom(E){let z=this._getOriginZoom(E)-1;for(;z<=this.options.maxZoom;){const I=this.getChildren(E);if(z++,I.length!==1)break;E=I[0].properties.cluster_id}return z}_appendLeaves(E,z,I,V,X){const A=this.getChildren(z);for(const u of A){const H=u.properties;if(H&&H.cluster?X+H.point_count<=V?X+=H.point_count:X=this._appendLeaves(E,H.cluster_id,I,V,X):X<V?X++:E.push(u),E.length===I)break}return X}_createTree(E){const z=new Om(E.length/this.stride|0,this.options.nodeSize,Float32Array);for(let I=0;I<E.length;I+=this.stride)z.add(E[I],E[I+1]);return z.finish(),z.data=E,z}_addTileFeatures(E,z,I,V,X,A){for(const u of E){const H=u*this.stride,ne=z[H+Uu]>1;let se,we,Ce;if(ne)se=Hg(z,H,this.clusterProps),we=z[H],Ce=z[H+1];else{const He=this.points[z[H+Vu]];se=He.properties;const[xe,et]=He.geometry.coordinates;we=$p(xe),Ce=Hp(et)}const ie={type:1,geometry:[[Math.round(this.options.extent*(we*X-I)),Math.round(this.options.extent*(Ce*X-V))]],tags:se};let Fe;ne||this.options.generateId?Fe=z[H+Vu]:Fe=this.points[z[H+Vu]].id,Fe!==void 0&&(ie.id=Fe),A.features.push(ie)}}_limitZoom(E){return Math.max(this.options.minZoom,Math.min(Math.floor(+E),this.options.maxZoom+1))}_cluster(E,z){const{radius:I,extent:V,reduce:X,minPoints:A}=this.options,u=I/(V*Math.pow(2,z)),H=E.data,ne=[],se=this.stride;for(let we=0;we<H.length;we+=se){if(H[we+qh]<=z)continue;H[we+qh]=z;const Ce=H[we],ie=H[we+1],Fe=E.within(H[we],H[we+1],u),He=H[we+Uu];let xe=He;for(const et of Fe){const qe=et*se;H[qe+qh]>z&&(xe+=H[qe+Uu])}if(xe>He&&xe>=A){let et=Ce*He,qe=ie*He,tt,ut=-1;const Ze=((we/se|0)<<5)+(z+1)+this.points.length;for(const _t of Fe){const Tt=_t*se;if(H[Tt+qh]<=z)continue;H[Tt+qh]=z;const xt=H[Tt+Uu];et+=H[Tt]*xt,qe+=H[Tt+1]*xt,H[Tt+Sm]=Ze,X&&(tt||(tt=this._map(H,we,!0),ut=this.clusterProps.length,this.clusterProps.push(tt)),X(tt,this._map(H,Tt)))}H[we+Sm]=Ze,ne.push(et/xe,qe/xe,1/0,Ze,-1,xe),X&&ne.push(ut)}else{for(let et=0;et<se;et++)ne.push(H[we+et]);if(xe>1)for(const et of Fe){const qe=et*se;if(!(H[qe+qh]<=z)){H[qe+qh]=z;for(let tt=0;tt<se;tt++)ne.push(H[qe+tt])}}}}return ne}_getOriginId(E){return E-this.points.length>>5}_getOriginZoom(E){return(E-this.points.length)%32}_map(E,z,I){if(E[z+Uu]>1){const A=this.clusterProps[E[z+$g]];return I?Object.assign({},A):A}const V=this.points[E[z+Vu]].properties,X=this.options.map(V);return I&&X===V?Object.assign({},X):X}}function xg(R,E,z){return{type:"Feature",id:R[E+Vu],properties:Hg(R,E,z),geometry:{type:"Point",coordinates:[Ix(R[E]),Rx(R[E+1])]}}}function Hg(R,E,z){const I=R[E+Uu],V=I>=1e4?`${Math.round(I/1e3)}k`:I>=1e3?`${Math.round(I/100)/10}k`:I,X=R[E+$g],A=X===-1?{}:Object.assign({},z[X]);return Object.assign(A,{cluster:!0,cluster_id:R[E+Vu],point_count:I,point_count_abbreviated:V})}function $p(R){return R/360+.5}function Hp(R){const E=Math.sin(R*Math.PI/180),z=.5-.25*Math.log((1+E)/(1-E))/Math.PI;return z<0?0:z>1?1:z}function Ix(R){return(R-.5)*360}function Rx(R){const E=(180-R*360)*Math.PI/180;return 360*Math.atan(Math.exp(E))/Math.PI-90}class Dx{constructor(E,z={}){this.markers=[],this.renderedMarkers=new Map,this.renderedClusters=new Map,this.map=E,this.options={radius:z.radius||50,maxZoom:z.maxZoom||16,clusterImage:z.clusterImage||null,clusterOnClick:z.clusterOnClick||null,showClusterCount:z.showClusterCount||!1,...z},this.enabled=typeof z.enabled=="boolean"?z.enabled:Object.keys(z).length>0,this.supercluster=new kx({radius:this.options.radius,maxZoom:this.options.maxZoom}),this.setupEventListeners()}setEnabled(E){this.enabled=E,E?this.updateClustering():this.clearRenderedElements()}setupEventListeners(){this.map.on("moveend",()=>this.updateClustering()),this.map.on("zoomend",()=>this.updateClustering())}addMarker(E){return this.markers.push(E),this.updateClustering(),E}removeMarker(E){this.markers=this.markers.filter(z=>z.id!==E),this.updateClustering()}clearAllMarkers(){this.markers=[],this.clearRenderedElements()}
911clearRenderedElements(){this.renderedMarkers.forEach(E=>E.remove()),this.renderedMarkers.clear(),this.renderedClusters.forEach(E=>E.remove()),this.renderedClusters.clear()}updateClustering(){if(!this.enabled){this.clearRenderedElements();return}if(!this.map||this.markers.length===0){this.clearRenderedElements();return}this.clearRenderedElements();const E=this.map.getBounds(),z=Math.floor(this.map.getZoom()),I=this.markers.map(X=>({type:"Feature",geometry:{type:"Point",coordinates:X.lngLat},properties:{markerId:X.id,imageUrl:X.imageUrl,size:X.size,onClick:X.onClick}}));this.supercluster.load(I),this.supercluster.getClusters([E.getWest(),E.getSouth(),E.getEast(),E.getNorth()],z).forEach(X=>{X.properties.cluster?this.renderCluster(X):this.renderIndividualMarker(X)})}renderCluster(E){const z=document.createElement("div");if(z.className="cluster-marker",this.options.clusterImage){if(z.style.cssText=`
912        background-image: url('${this.options.clusterImage}');
913        background-size: contain;
914        background-repeat: no-repeat;
915        background-position: center;
916        width: 40px;
917        height: 40px;
918        cursor: pointer;
919        position: relative;
920      `,this.options.showClusterCount){const V=document.createElement("div");V.style.cssText=`
921          position: absolute;
922          top: -5px;
923          right: -5px;
924          background-color: #ff4444;
925          color: white;
926          font-weight: bold;
927          font-size: 10px;
928          width: 16px;
929          height: 16px;
930          border-radius: 50%;
931          display: flex;
932          align-items: center;
933          justify-content: center;
934          border: 1px solid white;
935          box-shadow: 0 1px 3px rgba(0,0,0,0.3);
936          line-height: 1;
937        `,V.textContent=E.properties.point_count,z.appendChild(V)}}else z.style.cssText=`
938        background-color: #51bbd6;
939        border-radius: 50%;
940        color: white;
941        font-weight: bold;
942        text-align: center;
943        line-height: 40px;
944        width: 40px;
945        height: 40px;
946        cursor: pointer;
947        border: 2px solid white;
948        box-shadow: 0 2px 6px rgba(0,0,0,0.3);
949      `,z.textContent=E.properties.point_count;const I=new Wa.Marker({element:z}).setLngLat(E.geometry.coordinates).addTo(this.map);this.renderedClusters.set(E.id,I),z.addEventListener("click",V=>{if(V.stopPropagation(),this.options.clusterOnClick)this.options.clusterOnClick(E,V);else{const X=this.supercluster.getClusterExpansionZoom(E.id);this.map.easeTo({center:E.geometry.coordinates,zoom:X})}})}renderIndividualMarker(E){const z=this.markers.find(X=>X.id===E.properties.markerId);if(!z)return;const I=document.createElement("div");I.style.backgroundImage=`url('${z.imageUrl}')`,I.style.backgroundSize="contain",I.style.backgroundRepeat="no-repeat",I.style.width=`${z.size?z.size[0]:32}px`,I.style.height=`${z.size?z.size[1]:32}px`,I.style.cursor="pointer";const V=new Wa.Marker({element:I}).setLngLat(z.lngLat).addTo(this.map);this.renderedMarkers.set(z.id,V),z.onClick&&I.addEventListener("click",X=>{X.stopPropagation(),z.onClick(z.lngLat,V,X)})}setClusterImage(E){this.options.clusterImage=E,this.updateClustering()}}class Lx{constructor(E){this.apiKey=E,this.baseUrl="https://mapapi.gebeta.app/api/v1/route"}async geocode(E){if(!this.apiKey)throw new Error("API key is required for geocoding");if(!E)throw new Error("Name is required for geocoding");const z=new URLSearchParams({name:E,apiKey:this.apiKey}),I=`${this.baseUrl}/geocoding?${z.toString()}`,V=await fetch(I),X=await V.json();if(V.ok&&X.msg==="ok")return X.data;throw new Error(X.error?.message||X.msg||"Geocoding failed")}async reverseGeocode(E,z){if(!this.apiKey)throw new Error("API key is required for reverse geocoding");if(E==null||z==null)throw new Error("Latitude and longitude are required");const I=new URLSearchParams({lat:E.toString(),lon:z.toString(),apiKey:this.apiKey}),V=`${this.baseUrl}/revgeocoding?${I.toString()}`,X=await fetch(V),A=await X.json();if(X.ok&&A.msg==="ok")return A.data;throw new Error(A.error?.message||A.msg||"Reverse geocoding failed")}}class Bx{constructor(E,z){this.instructionMarkers=[],this._instructionPopup=null,this.map=E,this.apiKey=z,this.baseUrl="https://mapapi.gebeta.app/api/route/direction/",this.currentRoute=null,this.routeSource=null,this.routeLayer=null,this.markers=[],this._initRouteLayer()}_initRouteLayer(){this.map&&(this.map.getSource("route")||(this.map.addSource("route",{type:"geojson",data:{type:"Feature",properties:{},geometry:{type:"LineString",coordinates:[]}}}),this.map.addLayer({id:"route",type:"line",source:"route",layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":"#007cbf","line-width":4,"line-opacity":.8}}),this.map.addLayer({id:"route-arrows",type:"symbol",source:"route",layout:{"symbol-placement":"line","text-field":"▶","text-size":12,"symbol-spacing":50,"text-keep-upright":!1},paint:{"text-color":"#007cbf","text-halo-color":"#ffffff","text-halo-width":1}})))}async getDirections(E,z,I={}){if(!this.apiKey)throw new Error("API key is required for directions");
949if(!E||!z)throw new Error("Origin and destination are required");const{waypoints:V=[],avgSpeedKmh:X=30}=I,A=new URLSearchParams({origin:`${E.lat},${E.lng}`,destination:`${z.lat},${z.lng}`,apiKey:this.apiKey});if(V.length>0){const se=`[${V.map(we=>`{${we.lat},${we.lng}}`).join(",")}]`;A.append("waypoints",se)}const u=await fetch(`${this.baseUrl}?${A.toString()}`);if(!u.ok){const se=await u.json().catch(()=>({}));throw new Error(`Directions API error: ${u.status} - ${se.message||u.statusText}`)}const H=await u.json(),ne=this._transformApiResponse(H,E,z,X);return this.currentRoute=ne,ne}_transformApiResponse(E,z,I,V=30){const A=(E.direction||[]).map(H=>[H[1],H[0]]),u=(E.instruction||[]).map(H=>({...H,coord:[H.turning_latitude,H.turning_longitude]}));return{...E,geometry:{type:"LineString",coordinates:A},origin:{...z},destination:{...I},distance:E.totalDistance?`${(E.totalDistance/1e3).toFixed(2)} km`:null,duration:E.totalDistance?this._estimateDuration(E.totalDistance,V):null,instructions:u}}_estimateDuration(E,z=30){const V=E/1e3/z,X=Math.round(V*60);if(X<60)return`${X} min`;{const A=Math.floor(X/60),u=X%60;return u>0?`${A}h ${u}m`:`${A}h`}}displayRoute(E,z={}){if(!this.map||!E)return;const{showMarkers:I=!0,originIcon:V=null,destinationIcon:X=null,waypointIcon:A=null,showInstructions:u=!1}=z;this.clearRoute(),E.geometry&&E.geometry.coordinates&&this.map.getSource("route").setData({type:"Feature",properties:{},geometry:{type:"LineString",coordinates:E.geometry.coordinates}}),I&&this._addRouteMarkers(E,{originIcon:V,destinationIcon:X,waypointIcon:A}),u&&Array.isArray(E.instructions)&&E.instructions.length>0&&this._addInstructionMarkers(E.instructions),this._fitMapToRoute(E)}_addRouteMarkers(E,z={}){const{originIcon:I="https://cdn-icons-png.flaticon.com/512/1828/1828640.png",destinationIcon:V="https://cdn-icons-png.flaticon.com/512/3081/3081559.png",waypointIcon:X="https://cdn-icons-png.flaticon.com/512/484/484167.png"}=z;if(this._clearMarkers(),E.origin){const A=this._addMarker([E.origin.lng,E.origin.lat],I,"Origin",[25,25]);this.markers.push(A)}if(E.destination){const A=this._addMarker([E.destination.lng,E.destination.lat],V,"Destination",[25,25]);this.markers.push(A)}E.waypoints&&E.waypoints.length>
9490&&E.waypoints.forEach((A,u)=>{const H=this._addMarker([A.lng,A.lat],X,`Waypoint ${u+1}`,[20,20]);this.markers.push(H)})}_addMarker(E,z,I,V=[30,30]){const X=document.createElement("div");return X.style.backgroundImage=`url('${z}')`,X.style.backgroundSize="contain",X.style.backgroundRepeat="no-repeat",X.style.width=`${V[0]}px`,X.style.height=`${V[1]}px`,X.style.cursor="pointer",X.title=I,new Wa.Marker({element:X}).setLngLat(E).addTo(this.map)}_fitMapToRoute(E){if(!this.map||!E.geometry)return;const z=E.geometry.coordinates;if(z.length===0)return;const I=new Wa.LngLatBounds;z.forEach(V=>{I.extend(V)}),this.map.fitBounds(I,{padding:50,duration:1e3})}clearRoute(){this.map&&(this.map.getSource("route").setData({type:"Feature",properties:{},geometry:{type:"LineString",coordinates:[]}}),this._clearMarkers(),this.instructionMarkers&&(this.instructionMarkers.forEach(E=>E.remove()),this.instructionMarkers=[]),this._instructionPopup&&(this._instructionPopup.remove(),this._instructionPopup=null),this.currentRoute=null)}_clearMarkers(){this.markers.forEach(E=>E.remove()),this.markers=[]}getCurrentRoute(){return this.currentRoute}getRouteSummary(){return this.currentRoute?{distance:this.currentRoute.distance,duration:this.currentRoute.duration,totalDistance:this.currentRoute.totalDistance,timeTaken:this.currentRoute.timetaken,origin:this.currentRoute.origin,destination:this.currentRoute.destination,waypoints:this.currentRoute.waypoints||[]}:null}updateRouteStyle(E={}){if(!this.map)return;const{color:z="#007cbf",width:I=4,opacity:V=.8}=E;this.map.setPaintProperty("route","line-color",z),this.map.setPaintProperty("route","line-width",I),this.map.setPaintProperty("route","line-opacity",V)}_addInstructionMarkers(E){this.map&&(this.instructionMarkers||(this.instructionMarkers=[]),this.instructionMarkers.forEach(z=>z.remove()),this.instructionMarkers=[],E.forEach((z,I)=>{if(!z.coord||z.coord.length!==2)return;const[V,X]=z.coord,A=document.createElement("div");A.style.background="#007cbf",A.style.color="white",A.style.borderRadius="50%",A.style.width="28px",A.style.height="28px",A.style.display="flex",A.style.alignItems="center",A.style.justifyContent="center",A.style.fontWeight="bold",A.style.fontSize="15px",A.style.border="2px solid #fff",A.style.boxShadow="0 1px 4px rgba(0,0,0,0.15)",A.innerText=(I+1).toString(),A.style.cursor="pointer";const u=new Wa.Marker({element:A}).setLngLat([X,V]).addTo(this.map);A.addEventListener("click",H=>{H.stopPropagation(),this.map.flyTo({center:[X,V],zoom:17,speed:1.2}),this._instructionPopup&&this._instructionPopup.remove(),this._instructionPopup=new Wa.Popup({offset:18,closeButton:!1}).setLngLat([X,V]).setHTML(`<div style="font-size:14px; color:#666; width:max-content; border-radius:5%; padding:4px 8px;">
950              ${z.path||""} (~${Math.round(z.distance)}m)
951            </div>`).addTo(this.map)}),this.instructionMarkers.push(u)}))}}class Ox{constructor({apiKey:E}){this.gebetaMaps=null,this.markerList=[],this.fenceManager=null,this.pathLayerIds=[],this.pathSourceIds=[],this.clusteringManager=null,this.geocodingManager=null,this.directionsManager=null,this.apiKey=E,this.apiKey||console.error("An API key or an access token is required."),this.geocodingManager=new Lx(this.apiKey)}addGebetaLogo(){if(!this.gebetaMaps)return;const E=document.createElement("div");E.className="maplibregl-ctrl-bottom-left",this.gebetaMaps.getContainer().appendChild(E)}addAttribution(){this.gebetaMaps&&this.gebetaMaps.addControl(new Wa.AttributionControl({customAttribution:'<a style="margin-bottom:5px;" href="https://www.gebeta.app" target="_blank">© Gebeta Maps</a>'}))}async fetchStaticMap(E,z){try{const I=await fetch(E);if(!I.ok)throw new Error(`HTTP error! status: ${I.status}`);const V=await I.blob(),X=URL.createObjectURL(V),A=document.getElementById(z);A?A.src=X:console.error(`Element with ID '${z}' not found.`)}catch(I){console.error("Error fetching static map:",I)}}add3dLayer(){this.gebetaMaps&&this.gebetaMaps.on("load",()=>{this.gebetaMaps&&(this.gebetaMaps.addSource("3d-tiles",{type:"vector"}),this.gebetaMaps.addLayer({id:"3d-buildings",source:"3d-tiles","source-layer":"buildings",type:"fill-extrusion",minzoom:15,paint:{"fill-extrusion-color":"#aaa","fill-extrusion-height":["interpolate",["linear"],["zoom"],15,0,15.05,["get","height"]],"fill-extrusion-base":["get","min_height"],"fill-extrusion-opacity":.6}}))})}init(E){const z="https://tiles.gebeta.app/styles/standard/style.json";return this.gebetaMaps=new Wa.Map({...E,style:z,attributionControl:!1}),this.addGebetaLogo(),this.addAttribution(),this.fenceManager=new Px(this.gebetaMaps),this.clusteringManager=new Dx(this.gebetaMaps,E.clusteringOptions||{enabled:!1}),this.gebetaMaps&&this.gebetaMaps.on("load",()=>{this.directionsManager=new Bx(this.gebetaMaps,this.apiKey)}),this.gebetaMaps}
951addNavigationControls(E){if(!this.gebetaMaps)throw new Error("Map not initialized");const z=new Wa.NavigationControl(E);return this.gebetaMaps.addControl(z),z}addGeolocateControls(E){if(!this.gebetaMaps)throw new Error("Map not initialized");const z=new Wa.GeolocateControl(E);return this.gebetaMaps.addControl(z),z}getMercatorCoordinate(){return Wa.MercatorCoordinate}addMarker(E){if(!this.gebetaMaps)throw new Error("Map not initialized");const z=new Wa.Marker(E);return this.markerList.push(z),z}addPopup(E){if(!this.gebetaMaps)throw new Error("Map not initialized");return new Wa.Popup(E)}getStaticMap(E,z){const I=`${E}?api_key=${this.apiKey}`;this.fetchStaticMap(I,z)}addImageMarker(E,z,I=[32,32],V,X=10,A){if(!this.gebetaMaps)throw new Error("Map not initialized");const u=document.createElement("div");u.style.backgroundImage=`url('${z}')`,u.style.backgroundSize="contain",u.style.backgroundRepeat="no-repeat",u.style.width=`${I[0]}px`,u.style.height=`${I[1]}px`,u.style.cursor="pointer",u.style.zIndex=X.toString();const H=new Wa.Marker({element:u}).setLngLat(E).addTo(this.gebetaMaps);let ne;return A&&(ne=new Wa.Popup({offset:18}).setHTML(A),H.setPopup(ne)),V&&u.addEventListener("click",se=>{se.stopPropagation(),V(E,H,se)}),this.markerList.push(H),{marker:H,popup:ne}}removeMarker(E){E.remove(),this.markerList=this.markerList.filter(z=>z!==E)}clearAllMarkers(){this.markerList.forEach(E=>E.remove()),this.markerList=[]}getMarkers(){return[...this.markerList]}startFence(){if(!this.fenceManager)throw new Error("FenceManager not initialized");this.fenceManager.startFenceDrawing()}addFencePoint(E,z=null,I=null){if(!this.fenceManager)throw new Error("FenceManager not initialized");this.fenceManager.addFencePoint(E,z,I,(V,X,A,u)=>this.addImageMarker(V,X,A,u))}closeFence(){if(!this.fenceManager)throw new Error("FenceManager not initialized");this.fenceManager.closeFence()}clearFence(){if(!this.fenceManager)throw new Error("FenceManager not initialized");this.fenceManager.clearFence()}clearAllFences(){if(!this.fenceManager)throw new Error("FenceManager not initialized");this.fenceManager.clearAllFences()}getFences(){if(!this.fenceManager)throw new Error("FenceManager not initialized");return this.fenceManager.getFences()}getFencePoints(){if(!this.fenceManager)throw new Error("FenceManager not initialized");return this.fenceManager.getFencePoints()}isDrawingFence(){if(!this.fenceManager)throw new Error("FenceManager not initialized");return this.fenceManager.isDrawingFence()}addPath(E,z){if(!this.gebetaMaps)throw new Error("Map not initialized");const I=z?.color||"#007cbf",V=z?.width||4,X=z?.opacity||.8,A=`path-${Date.now()}-${Math.floor(Math.random()*1e4)}`;this.gebetaMaps.addSource(A,{type:"geojson",data:{type:"Feature",properties:{},geometry:{type:"LineString",coordinates:E}}}),this.gebetaMaps.addLayer({id:A,type:"line",source:A,layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":I,"line-width":V,"line-opacity":X}}),this.pathLayerIds.push(A),this.pathSourceIds.push(A)}clearPaths(){this.gebetaMaps&&(this.pathLayerIds.forEach(E=>{this.gebetaMaps.getLayer(E)&&this.gebetaMaps.removeLayer(E)}),this.pathSourceIds.forEach(E=>{this.gebetaMaps.getSource(E)&&this.gebetaMaps.removeSource(E)}),this.pathLayerIds=[],this.pathSourceIds=[])}addClusteredMarker(E){if(!this.clusteringManager)throw new Error("ClusteringManager not initialized");return this.clusteringManager.addMarker(E)}clearClusteredMarkers(){if(!this.clusteringManager)throw new Error("ClusteringManager not initialized");this.clusteringManager.clearAllMarkers()}updateClustering(){if(!this.clusteringManager)throw new Error("ClusteringManager not initialized");this.clusteringManager.updateClustering()}setClusteringEnabled(E){if(!this.clusteringManager)throw new Error("ClusteringManager not initialized");this.clusteringManager.setEnabled(E)}setClusterImage(E){if(!this.clusteringManager)throw new Error("ClusteringManager not initialized");this.clusteringManager.setClusterImage(E)}async geocode(E){if(!this.geocodingManager)throw new Error("GeocodingManager not initialized");return this.geocodingManager.geocode(E)}async reverseGeocode(E,z){if(!this.geocodingManager)throw new Error("GeocodingManager not initialized");return this.geocodingManager.reverseGeocode(E,z)}async getDirections(E,z,I){if(!this.directionsManager)throw new Error("DirectionsManager not initialized");return this.directionsManager.getDirections(E,z,I)}displayRoute(E,z){if(!this.directionsManager)throw new Error("DirectionsManager not initialized");return this.directionsManager.displayRoute(E,z)}clearRoute(){if(!this.directionsManager)throw new Error("DirectionsManager not initialized");return this.directionsManager.clearRoute()}getCurrentRoute(){if(!this.directionsManager)throw new Error("DirectionsManager not initialized");return this.directionsManager.getCurrentRoute()}getRouteSummary(){if(!this.directionsManager)throw new Error("DirectionsManager not initialized");return this.directionsManager.getRouteSummary()}updateRouteStyle(E){if(!this.directionsManager)throw new Error("DirectionsManager not initialized");return this.directionsManager.updateRouteStyle(E)}remove(){this.gebetaMaps&&(this.gebetaMaps.remove(),this.gebetaMaps=null)}}const jx=({message:R})=>q.jsxs("div",{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",background:"#f8d7da",color:"#721c24",borderRadius:12,fontWeight:500,fontSize:18,flexDirection:"column",gap:8,border:"1px solid #f5c6cb"},children:[q.jsx("span",{children:"⚠️ GebetaMap SDK is not set up correctly."}),q.jsx("span",{children:R||"Please provide a valid Gebeta Maps API key."})]}),Nx=Ae.forwardRef(({apiKey:R,center:E,zoom:z,onMapClick:I,onMapLoaded:V,blockInteractions:X=!1,style:A,clusteringOptions:u},H)=>{const ne=Ae.useRef(null),se=Ae.useRef(null),we=Ae.useMemo(()=>E,[JSON.stringify(E)]),Ce=Ae.useMemo(()=>A,[JSON.stringify(A||{})]),ie=Ae.useMemo(()=>V,[]),Fe=Ae.useMemo(()=>X,[X]);Ae.useImperativeHandle(H,()=>({addImageMarker:(...xe)=>se.current.addImageMarker(...xe),addMarker:(...xe)=>se.current.addMarker(...xe),clearMarkers:()=>se.current.clearAllMarkers(),getMarkers:()=>se.current.getMarkers(),getMapInstance:()=>se.current?se.current.gebetaMaps:null,startFence:()=>se.current.startFence(),addFencePoint:(...xe)=>se.current.addFencePoint(...xe),closeFence:()=>se.current.closeFence(),clearFence:()=>se.current.clearFence(),clearAllFences:()=>se.current.clearAllFences(),getFences:()=>se.current.getFences(),getFencePoints:()=>se.current.getFencePoints(),isDrawingFence:()=>se.current.isDrawingFence(),addPath:(...xe)=>se.current.addPath(...xe),clearPaths:()=>se.current.clearPaths(),addClusteredMarker:(...xe)=>se.current.addClusteredMarker(...xe),clearClusteredMarkers:()=>se.current.clearClusteredMarkers(),updateClustering:()=>se.current.updateClustering(),setClusteringEnabled:xe=>
951se.current.setClusteringEnabled(xe),setClusterImage:xe=>se.current.setClusterImage(xe),geocode:(...xe)=>se.current.geocode(...xe),reverseGeocode:(...xe)=>se.current.reverseGeocode(...xe),getDirections:(...xe)=>se.current.getDirections(...xe),displayRoute:(...xe)=>se.current.displayRoute(...xe),clearRoute:()=>se.current.clearRoute(),getCurrentRoute:()=>se.current.getCurrentRoute(),getRouteSummary:()=>se.current.getRouteSummary(),updateRouteStyle:(...xe)=>se.current.updateRouteStyle(...xe)}),[]);const He=Ae.useMemo(()=>I,[]);return Ae.useEffect(()=>{if(!R||R.trim()===""||!ne.current||se.current)return;const xe=new Ox({apiKey:R}),et=xe.init.bind(xe);xe.init=tt=>{const Ze={...tt,style:"https://tiles.gebeta.app/styles/standard/style.json",attributionControl:!1,transformRequest:(_t,Tt)=>_t.startsWith("https://tiles.gebeta.app")?{url:_t,headers:{Authorization:`Bearer ${R}`}}:{url:_t}};return et(Ze)},se.current=xe;const qe=se.current.init({container:ne.current,center:we,zoom:z,clusteringOptions:u});return se.current.addNavigationControls(),ie&&qe.on("load",()=>{ie()}),Fe&&(qe.dragPan.disable(),qe.dragRotate.disable(),qe.scrollZoom.disable(),qe.keyboard.disable(),qe.doubleClickZoom.disable(),qe.touchZoomRotate.disable()),He&&qe.on("click",tt=>{const ut=[tt.lngLat.lng,tt.lngLat.lat];He(ut,tt)}),()=>{se.current?.remove(),se.current=null}},[R,we,z,He,u,ie,Fe]),!R||R.trim()===""?q.jsx(jx,{message:"GebetaMap SDK is not set. Please provide a valid API key."}):q.jsx("div",{ref:ne,style:{width:"100%",height:"100%",...Ce},"data-testid":"gebeta-map-container"})}),jm=Kc.memo(Nx),Xg=Ae.forwardRef(({currentLocation:R,isLoading:E,timeLeft:z,onMapLoad:I,showOverlay:V=!1},X)=>q.jsxs("div",{className:"relative w-full h-screen overflow-hidden bg-gray-50",children:[!V&&q.jsxs(Ia,{className:"absolute top-2 left-2 right-2 sm:top-4 sm:left-4 sm:right-auto sm:max-w-sm z-10 shadow-lg frosted-glass",children:[q.jsxs(vo,{className:"pb-3",children:[q.jsxs(bo,{className:"text-lg sm:text-xl flex items-center justify-between text-black",children:[q.jsxs("div",{className:"flex items-center gap-2",children:[q.jsx(fx,{className:"w-5 h-5 text-black"}),"Memorize this place..."]}),z>0&&q.jsx("div",{className:"text-2xl font-bold text-black",children:z})]}),q.jsx($h,{className:"text-gray-600",children:"You'll need to find this place on the map!"})]}),E&&q.jsx(Ra,{className:"pt-0",children:q.jsxs("div",{className:"flex items-center justify-center space-x-2",children:[q.jsx($d,{size:"md"}),q.jsx("p",{className:"text-sm text-gray-600",children:"Loading map..."})]})})]}),q.jsx(jm,{ref:X,apiKey:Bm,center:R||[38.7685,9.0161],zoom:15,style:{width:"100%",height:"100%"},onMapLoaded:()=>{I()},blockInteractions:!0}),R&&q.jsx("div",{className:"absolute inset-0 pointer-events-none flex items-center justify-center",children:q.jsx("img",{src:"/pin.png",alt:"Target location",className:"w-8 h-8 animate-pulse drop-shadow-lg"})})]}));Xg.displayName="TileView";const Fx=Ae.memo(Xg),Yg=Ae.forwardRef(({currentMarker:R,isSubmitting:E,onMapClick:z,onSubmitGuess:I,onMapLoad:V},X)=>q.jsxs("div",{className:"relative w-full h-screen overflow-hidden bg-gray-50",children:[q.jsxs(Ia,{className:"absolute top-2 left-2 right-2 sm:top-4 sm:left-4 sm:right-auto sm:max-w-sm z-10 shadow-lg frosted-glass",children:[q.jsxs(vo,{className:"pb-3",children:[q.jsxs(bo,{className:"text-lg sm:text-xl flex items-center gap-2 text-black",children:[q.jsx(qu,{className:"w-5 h-5 text-black"}),"Place your guess!"]}),q.jsx($h,{className:"text-gray-600",children:"Click on the map to place your marker, then click Submit"})]}),R&&q.jsx(Ra,{className:"pt-0",children:q.jsx(kr,{onClick:I,disabled:E,className:"w-full bg-black text-white hover:bg-gray-800",size:"lg",children:E?q.jsxs(q.Fragment,{children:[q.jsx($d,{size:"sm",className:"border-white border-t-transparent mr-2"}),"Submitting..."]}):"Submit Guess"},`submit-${R[0]}-${R[1]}`)})]}),q.jsx(jm,{ref:X,apiKey:Bm,center:[38.7685,9.0161],zoom:6,onMapClick:z,onMapLoaded:()=>{V&&V()},style:{width:"100%",height:"100%"}})]}));Yg.displayName="MapView";const Ux=Ae.memo(Yg),Vx="modulepreload",Gx=function(R){return"/"+R},vg={},Zx=function(E,z,I){let V=Promise.resolve();if(z&&z.length>0){let ne=function(se){return Promise.all(se.map(we=>Promise.resolve(we).then(Ce=>({status:"fulfilled",value:Ce}),Ce=>({status:"rejected",reason:Ce}))))};var A=ne;document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),H=u?.nonce||u?.getAttribute("nonce");V=ne(z.map(se=>{if(se=Gx(se),se in vg)return;vg[se]=!0;const we=se.endsWith(".css"),Ce=we?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${se}"]${Ce}`))return;const ie=document.createElement("link");if(ie.rel=we?"stylesheet":Vx,we||(ie.as="script"),ie.crossOrigin="",ie.href=se,H&&ie.setAttribute("nonce",H),document.head.appendChild(ie),we)return new Promise((Fe,He)=>{ie.addEventListener("load",Fe),ie.addEventListener("error",()=>He(new Error(`Unable to preload CSS for ${se}`)))})}))}function X(u){const H=new Event("vite:preloadError",{cancelable:!0});if(H.payload=u,window.dispatchEvent(H),!H.defaultPrevented)throw u}return V.then(u=>{for(const H of u||[])H.status==="rejected"&&X(H.reason);return E().catch(X)})},Kg=async R=>{const E=document.createElement("canvas"),z=E.getContext("2d");if(!z)throw new Error("Could not get canvas context");E.width=600,E.height=800;const I=z.createLinearGradient(0,0,0,E.height);I.addColorStop(0,"#f8fafc"),I.addColorStop(1,"#e2e8f0"),z.fillStyle=I,z.fillRect(0,0,E.width,E.height),z.fillStyle="rgba(0, 0, 0, 0.02)";for(let qe=0;qe<E.width;qe+=40)for(let tt=0;tt<E.height;tt+=40)(qe+tt)%80===0&&z.fillRect(qe,tt,1,1);const V=60,X=80,A=(E.width-X)/2;try{const qe=await qx("/logo.svg");z.drawImage(qe,A,V,X,X),console.log("Logo loaded successfully")}catch(qe){console.log("Logo failed to load, using fallback:",qe),z.fillStyle="#1a1a1a",z.beginPath(),z.arc(A+X/2,V+X/2,X/2,0,Math.PI*2),z.fill(),z.fillStyle="#ffffff",z.font='bold 48px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',z.textAlign="center",z.fillText("G",A+X/2,V+X/2+16)}z.fillStyle="#1a1a1a",z.font='bold 32px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',z.textAlign="center",z.fillText("Guess the Place",E.width/2,V+X+35),z.fillStyle="#64748b",z.font='18px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',z.fillText("Can you recognize a corner of Ethiopia?",E.width/2,V+X+65);const u=V+X+100;z.fillStyle="#1a1a1a",z.font='bold 24px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',z.textAlign="center",z.fillText(`Great job, ${R.userName}!`,E.width/2,u);const H=u+40,ne=280,se=80,we=(E.width-ne)/2,ie=(qe=>{switch(qe){case"Perfect!":return{bg:"#000000",text:"#ffffff"};case"Excellent":return{bg:"#374151",text:"#ffffff"};case"Great":return{bg:"#4b5563",text:"#ffffff"};case"Good":return{bg:"#9ca3af",text:"#000000"};case"Fair":return{bg:"#d1d5db",text:"#000000"};case"Miss":return{bg:"#e5e7eb",text:"#000000"};default:return{bg:"#6b7280",text:"#ffffff"}}})(R.tier.tier);z.fillStyle=ie.bg,z.fillRect(we,H,ne,se),z.strokeStyle=ie.bg,z.lineWidth=2,z.strokeRect(we,H,ne,se),z.fillStyle=ie.text,z.font='bold 28px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',z.textAlign="center",z.fillText(R.tier.tier,E.width/2,H+35),z.fillStyle=ie.text==="#ffffff"?"rgba(255, 255, 255, 0.8)":"rgba(0, 0, 0, 0.7)",z.font='16px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',z.fillText(R.tier.description,E.width/2,H+60);const Fe=H+se+50;z.fillStyle="#1a1a1a",z.font='bold 20px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',z.textAlign="center",z.fillText("Your Score",E.width/2,Fe),z.fillStyle="#1a1a1a",z.font='bold 48px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',z.fillText(`${R.score} points`,E.width/2,Fe+60);const He=Fe+100;if(z.fillStyle="#64748b",z.font='16px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',z.textAlign="center",R.distance!==null&&z.fillText(`Distance: ${R.distance.toFixed(1)} km`,E.width/2-60,He),R.roundScore!==null&&z.fillText(`Round Score: ${R.roundScore} pts`,E.width/2+60,He),R.isNewBest){const qe=Fe+80,tt=180,ut=35,Ze=(E.width-tt)/2;z.fillStyle="#10b981",z.fillRect(Ze,qe,tt,ut),z.fillStyle="#ffffff",z.font='bold 16px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',z.textAlign="center",z.fillText("NEW BEST!",E.width/2,qe+22)}const xe=E.height-40;z.fillStyle="#64748b",z.font='16px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',z.textAlign="center",z.fillText("Powered by Gebeta",E.width/2,xe);const et=new Date().toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"});z.fillStyle="#9ca3af",z.font='14px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',z.fillText(et,E.width/2,xe+18),z.fillStyle="rgba(0, 0, 0, 0.02)";for(let qe=0;qe<4;qe++){const tt=80+qe%2*440,ut=300+Math.floor(qe/2)*400;z.beginPath(),z.arc(tt,ut,8,0,Math.PI*2),z.fill()}return E.toDataURL("image/png")},qx=R=>new Promise((E,z)=>{const I=new Image;I.crossOrigin="anonymous",I.onload=()=>{console.log("Image loaded:",R,"dimensions:",I.width,"x",I.height),E(I)},I.onerror=V=>{console.error("Failed to load image:",R,V),z(V)},I.src=R}),Nm=(R,E="gebeta-score.png")=>{const z=document.createElement("a");z.download=E,z.href=R,z.style.display="none",document.body.appendChild(z),z.click(),document.body.removeChild(z)},Wg=async R=>{try{const E=await Kg(R);if(window.Telegram?.WebApp){await $x(E,R);return}if(navigator.share&&navigator.canShare)try{const V=await(await fetch(E)).blob(),X=new File([V],"gebeta-score.png",{type:"image/png"});if(navigator.canShare({files:[X]})){await navigator.share({title:"My Gebeta Score!",text:`I scored ${R.score} points in Guess the Place! Can you beat my score?`,files:[X]});return}}catch{console.log("Native sharing failed, falling back to download")}Nm(E)}catch(E){throw console.error("Error sharing image:",E),E}},$x=async(R,E)=>{try{const z=window.Telegram?.WebApp;if(z){const I=`🎯 *My Gebeta Score!*
952
953Score: ${E.score} points
954Distance: ${E.distance?`${Math.round(E.distance)}km`:"Unknown"}
955Tier: ${E.tier.tier}
956${E.isNewBest?"🏆 NEW BEST!":""}
957
958Can you beat my score? Play now!`,V=`https://t.me/share/url?url=${encodeURIComponent("https://t.me/gebetaPlayGeoBot")}&text=${encodeURIComponent(I)}`;z.openTelegramLink(V)}else{const I=`🎯 My Gebeta Score! Score: ${E.score} points. Can you beat my score?`,V=`https://t.me/share/url?url=${encodeURIComponent("https://t.me/gebetaPlayGeoBot")}&text=${encodeURIComponent(I)}`;window.open(V,"_blank")}}catch(z){console.error("Error sharing in Telegram:",z),window.open(R,"_blank")}},Hx=Object.freeze(Object.defineProperty({__proto__:null,downloadShareImage:Nm,generateShareImage:Kg,shareImage:Wg},Symbol.toStringTag,{value:"Module"})),Xx=(R,E)=>{const z=[R[0],E[0]],I=[R[1],E[1]],V=Math.min(...z),X=Math.max(...z),A=Math.min(...I),u=Math.max(...I);return{center:[(V+X)/2,(A+u)/2],zoom:Math.min(12,Math.max(6,15-Math.log2(Math.max(X-V,u-A)*100)))}},Qg=Ae.forwardRef(({currentLocation:R,userGuess:E,distance:z,roundScore:I,score:V,bestScore:X,onPlayAgain:A,onMainMenu:u,submitError:H},ne)=>{const[se,we]=Ae.useState(!1),{user:Ce,hapticFeedback:ie,webApp:Fe}=Qp(),He=R&&E?Xx(R,E):{center:[38.7685,9.0161],zoom:6},xe=async()=>
958{if(Ce)try{we(!0),ie.impactOccurred("medium");const qe=z!=null?ym(z):{tier:"Unknown",color:"#64748b",description:"No distance calculated"};await Wg({userName:Ce.first_name,score:V,distance:z,roundScore:I,tier:qe,isNewBest:V>X}),ie.notificationOccurred("success")}catch(qe){console.error("Error sharing:",qe),ie.notificationOccurred("error")}finally{we(!1)}},et=async()=>{if(Ce)try{we(!0),ie.impactOccurred("medium");const qe=z!=null?ym(z):{tier:"Unknown",color:"#64748b",description:"No distance calculated"},{generateShareImage:tt}=await Zx(async()=>{const{generateShareImage:Ze}=await Promise.resolve().then(()=>Hx);return{generateShareImage:Ze}},void 0),ut=await tt({userName:Ce.first_name,score:V,distance:z,roundScore:I,tier:qe,isNewBest:V>X});Nm(ut,`gebeta-score-${Ce.first_name}-${V}.png`),ie.notificationOccurred("success")}catch(qe){console.error("Error downloading:",qe),ie.notificationOccurred("error")}finally{we(!1)}};return q.jsxs("div",{className:"relative w-full h-screen overflow-hidden bg-gray-50",children:[q.jsxs(Ia,{className:"absolute top-2 left-2 right-2 sm:top-4 sm:left-4 sm:right-auto sm:max-w-sm z-10 shadow-lg frosted-glass",children:[q.jsx(vo,{className:"pb-3",children:q.jsxs(bo,{className:"text-lg sm:text-xl flex items-center gap-2 text-black",children:[q.jsx(ol,{className:"w-5 h-5 text-black"}),"Results"]})}),q.jsxs(Ra,{className:"space-y-4",children:[z!=null&&q.jsx("div",{className:"text-center space-y-2",children:(()=>{const qe=ym(z);return q.jsxs(q.Fragment,{children:[q.jsx("div",{className:`text-2xl font-bold ${qe.color}`,children:qe.tier}),q.jsx("div",{className:"text-sm text-gray-600",children:qe.description})]})})()}),q.jsxs("div",{className:"space-y-2",children:[z!=null&&q.jsxs("div",{className:"flex justify-between items-center",children:[q.jsx("span",{className:"text-sm text-gray-600",children:"Distance:"}),q.jsxs(Kl,{variant:"outline",className:"font-mono",children:[z.toFixed(1)," km"]})]}),I!==void 0&&q.jsxs("div",{className:"flex justify-between items-center",children:[q.jsx("span",{className:"text-sm text-gray-600",children:"Round Score:"}),q.jsxs(Kl,{variant:"secondary",className:"font-mono",children:[I," pts"]})]}),q.jsxs("div",{className:"flex justify-between items-center border-t border-gray-200 pt-2",children:[q.jsx("span",{className:"text-sm font-medium text-black",children:"Total Score:"}),q.jsxs("div",{className:"flex items-center gap-2",children:[q.jsxs(Kl,{className:"font-mono bg-black text-white",children:[V," pts"]}),V>X&&q.jsx(Kl,{className:"font-mono bg-green-600 text-white",children:"New Best!"})]})]})]}),q.jsxs("div",{className:"space-y-2",children:[q.jsxs(kr,{onClick:A,className:"w-full bg-black text-white hover:bg-gray-800",size:"lg",children:[q.jsx(ox,{className:"w-4 h-4 mr-2"}),"Play Again"]}),q.jsxs("div",{className:"flex gap-2",children:[Fe&&q.jsxs(kr,{onClick:xe,disabled:se||!Ce,variant:"outline",className:"flex-1",size:"lg",children:[q.jsx(hx,{className:"w-4 h-4 mr-2"}),se?"Sharing...":"Share"]}),!Fe&&q.jsxs(kr,{onClick:et,disabled:se||!Ce,variant:"outline",className:"flex-1",size:"lg",children:[q.jsx(Wy,{className:"w-4 h-4 mr-2"}),se?"Generating...":"Download"]})]}),q.jsx(kr,{onClick:u,variant:"outline",className:"w-full",size:"lg",children:"Main Menu"})]}),H&&q.jsx("div",{className:"mt-3 p-2 bg-red-50 border border-red-200 rounded-md",children:q.jsx("p",{className:"text-xs text-red-600 text-center",children:H})})]})]}),q.jsx(jm,{ref:ne,apiKey:Bm,center:He.center,zoom:He.zoom,style:{width:"100%",height:"100%"}})]})});Qg.displayName="Results";const Yx=Ae.memo(Qg);function Fm(R,E=[]){let z=[];function I(X,A){const u=Ae.createContext(A),H=z.length;z=[...z,A];const ne=we=>{const{scope:Ce,children:ie,...Fe}=we,He=Ce?.[R]?.[H]||u,xe=Ae.useMemo(()=>Fe,Object.values(Fe));return q.jsx(He.Provider,{value:xe,children:ie})};ne.displayName=X+"Provider";function se(we,Ce){const ie=Ce?.[R]?.[H]||u,Fe=Ae.useContext(ie);if(Fe)return Fe;if(A!==void 0)return A;throw new Error(`\`${we}\` must be used within \`${X}\``)}return[ne,se]}const V=()=>{const X=z.map(A=>Ae.createContext(A));return function(u){const H=u?.[R]||X;return Ae.useMemo(()=>({[`__scope${R}`]:{...u,[R]:H}}),[u,H])}};return V.scopeName=R,[I,Kx(V,...E)]}function Kx(...R){const E=R[0];if(R.length===1)return E;const z=()=>{const I=R.map(V=>({useScope:V(),scopeName:V.scopeName}));return function(X){const A=I.reduce((u,{useScope:H,scopeName:ne})=>{const we=H(X)[`__scope${ne}`];return{...u,...we}},{});return Ae.useMemo(()=>({[`__scope${E.scopeName}`]:A}),[A])}};return z.scopeName=E.scopeName,z}function Gu(R,E,{checkForDefaultPrevented:z=!0}={}){return function(V){if(R?.(V),z===!1||!V.defaultPrevented)return E?.(V)}}var Wp=globalThis?.document?Ae.useLayoutEffect:()=>{},Wx=D_[" useInsertionEffect ".trim().toString()]||Wp;function Jg({prop:R,defaultProp:E,onChange:z=()=>{},caller:I}){const[V,X,A]=Qx({defaultProp:E,onChange:z}),u=R!==void 0,H=u?R:V;{const se=Ae.useRef(R!==void 0);Ae.useEffect(()=>{const we=se.current;we!==u&&console.warn(`${I} is changing from ${we?"controlled":"uncontrolled"} to ${u?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),se.current=u},[u,I])}const ne=Ae.useCallback(se=>{if(u){const we=Jx(se)?se(R):se;we!==R&&A.current?.(we)}else X(se)},[u,R,X,A]);return[H,ne]}function Qx({defaultProp:R,onChange:E}){const[z,I]=Ae.useState(R),V=Ae.useRef(z),X=Ae.useRef(E);return Wx(()=>{X.current=E},[E]),Ae.useEffect(()=>{V.current!==z&&(X.current?.(z),V.current=z)},[z,V]),[z,I,X]}function Jx(R){return typeof R=="function"}function e_(R){const E=Ae.useRef({value:R,previous:R});return Ae.useMemo(()=>(E.current.value!==R&&(E.current.previous=E.current.value,E.current.value=R),E.current.previous),[R])}function t_(R){const[E,z]=Ae.useState(void 0);return Wp(()=>
vendor: 4,257 bytes, line 958
958{if(R){z({width:R.offsetWidth,height:R.offsetHeight});const I=new ResizeObserver(V=>{if(!Array.isArray(V)||!V.length)return;const X=V[0];let A,u;if("borderBoxSize"in X){const H=X.borderBoxSize,ne=Array.isArray(H)?H[0]:H;A=ne.inlineSize,u=ne.blockSize}else A=R.offsetWidth,u=R.offsetHeight;z({width:A,height:u})});return I.observe(R,{box:"border-box"}),()=>I.unobserve(R)}else z(void 0)},[R]),E}function e0(R,E){return Ae.useReducer((z,I)=>E[z][I]??z,R)}var i_=R=>{const{present:E,children:z}=R,I=t0(E),V=typeof z=="function"?z({present:I.isPresent}):Ae.Children.only(z),X=ll(I.ref,i0(V));return typeof z=="function"||I.isPresent?Ae.cloneElement(V,{ref:X}):null};i_.displayName="Presence";function t0(R){const[E,z]=Ae.useState(),I=Ae.useRef(null),V=Ae.useRef(R),X=Ae.useRef("none"),A=R?"mounted":"unmounted",[u,H]=e0(A,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return Ae.useEffect(()=>{const ne=Xp(I.current);X.current=u==="mounted"?ne:"none"},[u]),Wp(()=>{const ne=I.current,se=V.current;if(se!==R){const Ce=X.current,ie=Xp(ne);R?H("MOUNT"):ie==="none"||ne?.display==="none"?H("UNMOUNT"):H(se&&Ce!==ie?"ANIMATION_OUT":"UNMOUNT"),V.current=R}},[R,H]),Wp(()=>{if(E){let ne;const se=E.ownerDocument.defaultView??window,we=ie=>{const He=Xp(I.current).includes(CSS.escape(ie.animationName));if(ie.target===E&&He&&(H("ANIMATION_END"),!V.current)){const xe=E.style.animationFillMode;E.style.animationFillMode="forwards",ne=se.setTimeout(()=>{E.style.animationFillMode==="forwards"&&(E.style.animationFillMode=xe)})}},Ce=ie=>{ie.target===E&&(X.current=Xp(I.current))};return E.addEventListener("animationstart",Ce),E.addEventListener("animationcancel",we),E.addEventListener("animationend",we),()=>{se.clearTimeout(ne),E.removeEventListener("animationstart",Ce),E.removeEventListener("animationcancel",we),E.removeEventListener("animationend",we)}}else H("ANIMATION_END")},[E,H]),{isPresent:["mounted","unmountSuspended"].includes(u),ref:Ae.useCallback(ne=>{I.current=ne?getComputedStyle(ne):null,z(ne)},[])}}function Xp(R){return R?.animationName||"none"}function i0(R){let E=Object.getOwnPropertyDescriptor(R.props,"ref")?.get,z=E&&"isReactWarning"in E&&E.isReactWarning;return z?R.ref:(E=Object.getOwnPropertyDescriptor(R,"ref")?.get,z=E&&"isReactWarning"in E&&E.isReactWarning,z?R.props.ref:R.props.ref||R.ref)}bg();var r0=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],$u=r0.reduce((R,E)=>{const z=Kp(`Primitive.${E}`),I=Ae.forwardRef((V,X)=>{const{asChild:A,...u}=V,H=A?z:E;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),q.jsx(H,{...u,ref:X})});return I.displayName=`Primitive.${E}`,{...R,[E]:I}},{}),Jp="Checkbox",[n0,I0]=Fm(Jp),[a0,Um]=n0(Jp);function s0(R){const{__scopeCheckbox:E,checked:z,children:I,defaultChecked:V,disabled:X,form:A,name:u,onCheckedChange:H,required:ne,value:se="on",internal_do_not_use_render:we}=R,[Ce,ie]=Jg({prop:z,defaultProp:V??!1,onChange:H,caller:Jp}),[Fe,He]=Ae.useState(null),[xe,et]=Ae.useState(null),qe=Ae.useRef(!1),tt=Fe?!!A||!!Fe.closest("form"):!0,ut={checked:Ce,disabled:X,setChecked:ie,control:Fe,setControl:He,name:u,form:A,value:se,hasConsumerStoppedPropagationRef:qe,required:ne,defaultChecked:Zu(V)?!1:V,isFormControl:tt,bubbleInput:xe,setBubbleInput:et};return q.jsx(a0,{scope:E,...ut,children:o0(we)?we(ut):I})}var r_="CheckboxTrigger",n_=Ae.forwardRef(({__scopeCheckbox:R,onKeyDown:E,onClick:z,...I},V)=>{const{control:X,value:A,disabled:u,checked:H,required:ne,setControl:se,setChecked:we,hasConsumerStoppedPropagationRef:Ce,isFormControl:ie,bubbleInput:Fe}=Um(r_,R),He=ll(V,se),xe=Ae.useRef(H);return Ae.useEffect(()=>{const et=X?.form;if(et){const qe=()=>we(xe.current);return et.addEventListener("reset",qe),()=>et.removeEventListener("reset",qe)}},[X,we]),q.jsx($u.button,{type:"button",role:"checkbox","aria-checked":Zu(H)?"mixed":H,"aria-required":ne,"data-state":c_(H),"data-disabled":u?"":void 0,disabled:u,value:A,...I,ref:He,onKeyDown:Gu(E,et=>{et.key==="Enter"&&et.preventDefault()}),onClick:Gu(z,et=>{we(qe=>Zu(qe)?!0:!qe),Fe&&ie&&(Ce.current=et.isPropagationStopped(),Ce.current||et.stopPropagation())})})});
958n_.displayName=r_;var Vm=Ae.forwardRef((R,E)=>{const{__scopeCheckbox:z,name:I,checked:V,defaultChecked:X,required:A,disabled:u,value:H,onCheckedChange:ne,form:se,...we}=R;return q.jsx(s0,{__scopeCheckbox:z,checked:V,defaultChecked:X,disabled:u,required:A,onCheckedChange:ne,name:I,form:se,value:H,internal_do_not_use_render:({isFormControl:Ce})=>q.jsxs(q.Fragment,{children:[q.jsx(n_,{...we,ref:E,__scopeCheckbox:z}),Ce&&q.jsx(l_,{__scopeCheckbox:z})]})})});Vm.displayName=Jp;var a_="CheckboxIndicator",s_=Ae.forwardRef((R,E)=>{const{__scopeCheckbox:z,forceMount:I,...V}=R,X=Um(a_,z);return q.jsx(i_,{present:I||Zu(X.checked)||X.checked===!0,children:q.jsx($u.span,{"data-state":c_(X.checked),"data-disabled":X.disabled?"":void 0,...V,ref:E,style:{pointerEvents:"none",...R.style}})})});s_.displayName=a_;var o_="CheckboxBubbleInput",l_=Ae.forwardRef(({__scopeCheckbox:R,...E},z)=>{const{control:I,hasConsumerStoppedPropagationRef:V,checked:X,defaultChecked:A,required:u,disabled:H,name:ne,value:se,form:we,bubbleInput:Ce,setBubbleInput:ie}=Um(o_,R),Fe=ll(z,ie),He=e_(X),xe=t_(I);Ae.useEffect(()=>{const qe=Ce;if(!qe)return;const tt=window.HTMLInputElement.prototype,Ze=Object.getOwnPropertyDescriptor(tt,"checked").set,_t=!V.current;if(He!==X&&Ze){const Tt=new Event("click",{bubbles:_t});qe.indeterminate=Zu(X),Ze.call(qe,Zu(X)?!1:X),qe.dispatchEvent(Tt)}},[Ce,He,X,V]);const et=Ae.useRef(Zu(X)?!1:X);return q.jsx($u.input,{type:"checkbox","aria-hidden":!0,defaultChecked:A??et.current,required:u,disabled:H,name:ne,value:se,form:we,...E,tabIndex:-1,ref:Fe,style:{...E.style,...xe,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});l_.displayName=o_;function o0(R){return typeof R=="function"}function Zu(R){return R==="indeterminate"}function c_(R){return Zu(R)?"indeterminate":R?"checked":"unchecked"}const u_=Ae.forwardRef(({className:R,...E},z)=>q.jsx(Vm,{ref:z,className:wo("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",R),...E,children:q.jsx(s_,{className:wo("flex items-center justify-center text-current"),children:q.jsx($y,{className:"h-4 w-4"})})}));u_.displayName=Vm.displayName;function h_(R,[E,z]){return Math.min(z,Math.max(E,R))}var l0=Ae.createContext(void 0);function c0(R){const E=Ae.useContext(l0);return R||E||"ltr"}function u0(R){const E=R+"CollectionProvider",[z,I]=Fm(E),[V,X]=z(E,{collectionRef:{current:null},itemMap:new Map}),A=He=>{const{scope:xe,children:et}=He,qe=Kc.useRef(null),tt=Kc.useRef(new Map).current;return q.jsx(V,{scope:xe,itemMap:tt,collectionRef:qe,children:et})};A.displayName=E;const u=R+"CollectionSlot",H=Kp(u),ne=Kc.forwardRef((He,xe)=>{const{scope:et,children:qe}=He,tt=X(u,et),ut=ll(xe,tt.collectionRef);return q.jsx(H,{ref:ut,children:qe})});ne.displayName=u;const se=R+"CollectionItemSlot",we="data-radix-collection-item",Ce=Kp(se),ie=Kc.forwardRef((He,xe)=>{const{scope:et,children:qe,...tt}=He,ut=Kc.useRef(null),Ze=ll(xe,ut),_t=X(se,et);return Kc.useEffect(()=>(_t.itemMap.set(ut,{ref:ut,...tt}),()=>void _t.itemMap.delete(ut))),q.jsx(Ce,{[we]:"",ref:Ze,children:qe})});ie.displayName=se;function Fe(He){const xe=X(R+"CollectionConsumer",He);return Kc.useCallback(()=>{const qe=xe.collectionRef.current;if(!qe)return[];const tt=Array.from(qe.querySelectorAll(`[${we}]`));return Array.from(xe.itemMap.values()).sort((_t,Tt)=>tt.indexOf(_t.ref.current)-tt.indexOf(Tt.ref.current))},[xe.collectionRef,xe.itemMap])}return[{Provider:A,Slot:ne,ItemSlot:ie},Fe,I]}var d_=["PageUp","PageDown"],f_=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],p_={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Hd="Slider",[Pm,h0,d0]=u0(Hd),[m_,R0]=Fm(Hd,[d0]),[f0,em]=m_(Hd),g_=Ae.forwardRef((R,E)=>{const{name:z,min:I=0,max:V=100,step:X=1,orientation:A="horizontal",disabled:u=!1,minStepsBetweenThumbs:H=0,defaultValue:ne=[I],value:se,onValueChange:we=()=>{},onValueCommit:Ce=()=>{},inverted:ie=!1,form:Fe,...He}=R,xe=Ae.useRef(new Set),et=Ae.useRef(0),tt=A==="horizontal"?p0:m0,[ut=[],Ze]=Jg({prop:se,defaultProp:ne,onChange:mi=>{[...xe.current][et.current]?.focus(),we(mi)}}),_t=Ae.useRef(ut);function Tt(mi){const Jt=v0(ut,mi);hi(mi,Jt)}function xt(mi){hi(mi,et.current)}function Gt(){const mi=_t.current[et.current];ut[et.current]!==mi&&Ce(ut)}function hi(mi,Jt,{commit:fr}={commit:!1}){const Ir=T0(X),yi=M0(Math.round((mi-I)/X)*X+I,Ir),Ve=h_(yi,[I,V]);Ze((ht=[])=>{const nt=y0(ht,Ve,Jt);if(S0(nt,H*X)){et.current=nt.indexOf(Ve);const bt=String(nt)!==String(ht);return bt&&fr&&Ce(nt),bt?nt:ht}else return ht})}return q.jsx(f0,{scope:R.__scopeSlider,name:z,disabled:u,min:I,max:V,valueIndexToChangeRef:et,thumbs:xe.current,values:ut,orientation:A,form:Fe,children:q.jsx(Pm.Provider,{scope:R.__scopeSlider,children:q.jsx(Pm.Slot,{scope:R.__scopeSlider,children:q.jsx(tt,{"aria-disabled":u,"data-disabled":u?"":void 0,...He,ref:E,onPointerDown:Gu(He.onPointerDown,()=>{u||(_t.current=ut)}),min:I,max:V,inverted:ie,onSlideStart:u?void 0:Tt,onSlideMove:u?void 0:xt,onSlideEnd:u?void 0:Gt,onHomeKeyDown:()=>!u&&hi(I,0,{commit:!0}),onEndKeyDown:()=>!u&&hi(V,ut.length-1,{commit:!0}),onStepKeyDown:({event:mi,direction:Jt})=>
vendor: 4,551 bytes, line 958
958{if(!u){const yi=d_.includes(mi.key)||mi.shiftKey&&f_.includes(mi.key)?10:1,Ve=et.current,ht=ut[Ve],nt=X*yi*Jt;hi(ht+nt,Ve,{commit:!0})}}})})})})});g_.displayName=Hd;var[__,y_]=m_(Hd,{startEdge:"left",endEdge:"right",size:"width",direction:1}),p0=Ae.forwardRef((R,E)=>{const{min:z,max:I,dir:V,inverted:X,onSlideStart:A,onSlideMove:u,onSlideEnd:H,onStepKeyDown:ne,...se}=R,[we,Ce]=Ae.useState(null),ie=ll(E,tt=>Ce(tt)),Fe=Ae.useRef(void 0),He=c0(V),xe=He==="ltr",et=xe&&!X||!xe&&X;function qe(tt){const ut=Fe.current||we.getBoundingClientRect(),Ze=[0,ut.width],Tt=Gm(Ze,et?[z,I]:[I,z]);return Fe.current=ut,Tt(tt-ut.left)}return q.jsx(__,{scope:R.__scopeSlider,startEdge:et?"left":"right",endEdge:et?"right":"left",direction:et?1:-1,size:"width",children:q.jsx(x_,{dir:He,"data-orientation":"horizontal",...se,ref:ie,style:{...se.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:tt=>{const ut=qe(tt.clientX);A?.(ut)},onSlideMove:tt=>{const ut=qe(tt.clientX);u?.(ut)},onSlideEnd:()=>{Fe.current=void 0,H?.()},onStepKeyDown:tt=>{const Ze=p_[et?"from-left":"from-right"].includes(tt.key);ne?.({event:tt,direction:Ze?-1:1})}})})}),m0=Ae.forwardRef((R,E)=>{const{min:z,max:I,inverted:V,onSlideStart:X,onSlideMove:A,onSlideEnd:u,onStepKeyDown:H,...ne}=R,se=Ae.useRef(null),we=ll(E,se),Ce=Ae.useRef(void 0),ie=!V;function Fe(He){const xe=Ce.current||se.current.getBoundingClientRect(),et=[0,xe.height],tt=Gm(et,ie?[I,z]:[z,I]);return Ce.current=xe,tt(He-xe.top)}return q.jsx(__,{scope:R.__scopeSlider,startEdge:ie?"bottom":"top",endEdge:ie?"top":"bottom",size:"height",direction:ie?1:-1,children:q.jsx(x_,{"data-orientation":"vertical",...ne,ref:we,style:{...ne.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:He=>{const xe=Fe(He.clientY);X?.(xe)},onSlideMove:He=>{const xe=Fe(He.clientY);A?.(xe)},onSlideEnd:()=>{Ce.current=void 0,u?.()},onStepKeyDown:He=>{const et=p_[ie?"from-bottom":"from-top"].includes(He.key);H?.({event:He,direction:et?-1:1})}})})}),x_=Ae.forwardRef((R,E)=>{const{__scopeSlider:z,onSlideStart:I,onSlideMove:V,onSlideEnd:X,onHomeKeyDown:A,onEndKeyDown:u,onStepKeyDown:H,...ne}=R,se=em(Hd,z);return q.jsx($u.span,{...ne,ref:E,onKeyDown:Gu(R.onKeyDown,we=>{we.key==="Home"?(A(we),we.preventDefault()):we.key==="End"?(u(we),we.preventDefault()):d_.concat(f_).includes(we.key)&&(H(we),we.preventDefault())}),onPointerDown:Gu(R.onPointerDown,we=>{const Ce=we.target;Ce.setPointerCapture(we.pointerId),we.preventDefault(),se.thumbs.has(Ce)?Ce.focus():I(we)}),onPointerMove:Gu(R.onPointerMove,we=>{we.target.hasPointerCapture(we.pointerId)&&V(we)}),onPointerUp:Gu(R.onPointerUp,we=>{const Ce=we.target;Ce.hasPointerCapture(we.pointerId)&&(Ce.releasePointerCapture(we.pointerId),X(we))})})}),v_="SliderTrack",b_=Ae.forwardRef((R,E)=>{const{__scopeSlider:z,...I}=R,V=em(v_,z);return q.jsx($u.span,{"data-disabled":V.disabled?"":void 0,"data-orientation":V.orientation,...I,ref:E})});b_.displayName=v_;var zm="SliderRange",w_=Ae.forwardRef((R,E)=>{const{__scopeSlider:z,...I}=R,V=em(zm,z),X=y_(zm,z),A=Ae.useRef(null),u=ll(E,A),H=V.values.length,ne=V.values.map(Ce=>M_(Ce,V.min,V.max)),se=H>1?Math.min(...ne):0,we=100-Math.max(...ne);return q.jsx($u.span,{"data-orientation":V.orientation,"data-disabled":V.disabled?"":void 0,...I,ref:u,style:{...R.style,[X.startEdge]:se+"%",[X.endEdge]:we+"%"}})});w_.displayName=zm;var km="SliderThumb",S_=Ae.forwardRef((R,E)=>{const z=h0(R.__scopeSlider),[I,V]=Ae.useState(null),X=ll(E,u=>V(u)),A=Ae.useMemo(()=>I?z().findIndex(u=>u.ref.current===I):-1,[z,I]);return q.jsx(g0,{...R,ref:X,index:A})}),g0=Ae.forwardRef((R,E)=>{const{__scopeSlider:z,index:I,name:V,...X}=R,A=em(km,z),u=y_(km,z),[H,ne]=Ae.useState(null),se=ll(E,qe=>ne(qe)),we=H?A.form||!!H.closest("form"):!0,Ce=t_(H),ie=A.values[I],Fe=ie===void 0?0:M_(ie,A.min,A.max),He=x0(I,A.values.length),xe=Ce?.[u.size],et=xe?b0(xe,Fe,u.direction):0;return Ae.useEffect(()=>{if(H)return A.thumbs.add(H),()=>{A.thumbs.delete(H)}},[H,A.thumbs]),q.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[u.startEdge]:`calc(${Fe}% + ${et}px)`},children:[q.jsx(Pm.ItemSlot,{scope:R.__scopeSlider,children:q.jsx($u.span,{role:"slider","aria-label":R["aria-label"]||He,"aria-valuemin":A.min,"aria-valuenow":ie,"aria-valuemax":A.max,"aria-orientation":A.orientation,"data-orientation":A.orientation,"data-disabled":A.disabled?"":void 0,tabIndex:A.disabled?void 0:0,...X,ref:se,style:ie===void 0?{display:"none"}:R.style,onFocus:Gu(R.onFocus,()=>{A.valueIndexToChangeRef.current=I})})}
958),we&&q.jsx(T_,{name:V??(A.name?A.name+(A.values.length>1?"[]":""):void 0),form:A.form,value:ie},I)]})});S_.displayName=km;var _0="RadioBubbleInput",T_=Ae.forwardRef(({__scopeSlider:R,value:E,...z},I)=>{const V=Ae.useRef(null),X=ll(V,I),A=e_(E);return Ae.useEffect(()=>{const u=V.current;if(!u)return;const H=window.HTMLInputElement.prototype,se=Object.getOwnPropertyDescriptor(H,"value").set;if(A!==E&&se){const we=new Event("input",{bubbles:!0});se.call(u,E),u.dispatchEvent(we)}},[A,E]),q.jsx($u.input,{style:{display:"none"},...z,ref:X,defaultValue:E})});T_.displayName=_0;function y0(R=[],E,z){const I=[...R];return I[z]=E,I.sort((V,X)=>V-X)}function M_(R,E,z){const X=100/(z-E)*(R-E);return h_(X,[0,100])}function x0(R,E){return E>2?`Value ${R+1} of ${E}`:E===2?["Minimum","Maximum"][R]:void 0}function v0(R,E){if(R.length===1)return 0;const z=R.map(V=>Math.abs(V-E)),I=Math.min(...z);return z.indexOf(I)}function b0(R,E,z){const I=R/2,X=Gm([0,50],[0,I]);return(I-X(E)*z)*z}function w0(R){return R.slice(0,-1).map((E,z)=>R[z+1]-E)}function S0(R,E){if(E>0){const z=w0(R);return Math.min(...z)>=E}return!0}function Gm(R,E){return z=>{if(R[0]===R[1]||E[0]===E[1])return E[0];const I=(E[1]-E[0])/(R[1]-R[0]);return E[0]+I*(z-R[0])}}function T0(R){return(String(R).split(".")[1]||"").length}function M0(R,E){const z=Math.pow(10,E);return Math.round(R*z)/z}var C_=g_,C0=b_,E0=w_,A0=S_;const E_=Ae.forwardRef(({className:R,...E},z)=>q.jsxs(C_,{ref:z,className:wo("relative flex w-full touch-none select-none items-center",R),...E,children:[q.jsx(C0,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-gray-300",children:q.jsx(E0,{className:"absolute h-full bg-black"})}),q.jsx(A0,{className:"block h-5 w-5 rounded-full border-2 border-black bg-white ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-black focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"})]}));E_.displayName=C_.displayName;const A_=Ae.memo(({settings:R,bestScore:E,onClose:z,onUpdateSettings:I,onToggleCity:V,onSelectAllCities:X,onClearAllCities:A,onResetBestScore:u,onResetToDefaults:H})=>q.jsx("div",{className:"fixed inset-0 bg-gray-50 flex items-center justify-center p-4 z-50",children:q.jsxs(Ia,{className:"w-full max-w-2xl max-h-[90vh] overflow-y-auto shadow-lg",children:[q.jsxs(vo,{className:"flex flex-row items-center justify-between",children:[q.jsxs("div",{children:[q.jsx(bo,{className:"text-2xl font-bold text-black",children:"Free Play Settings"}),q.jsx("p",{className:"text-sm text-gray-600 mt-1",children:"These settings only apply to random place selection"})]}),q.jsx(kr,{variant:"ghost",size:"sm",onClick:z,className:"text-gray-600 hover:text-black",children:q.jsx(vx,{className:"w-4 h-4"})})]}),q.jsxs(Ra,{className:"space-y-6",children:[q.jsx("div",{className:"space-y-4",children:q.jsxs("div",{children:[q.jsx("h3",{className:"text-lg font-semibold text-black mb-2",children:"Game Timer"}),q.jsx("div",{className:"space-y-4",children:q.jsxs("div",{children:[q.jsxs("label",{className:"text-sm font-medium text-gray-700",children:["Study Time: ",R.tileViewDuration," seconds"]}),q.jsx(E_,{value:[R.tileViewDuration],onValueChange:([ne])=>I({tileViewDuration:ne}),min:5,max:30,step:1,className:"mt-2"})]})})]})}),q.jsx("div",{className:"space-y-4",children:q.jsxs("div",{children:[q.jsxs("div",{className:"flex items-center justify-between mb-2",children:[q.jsx("h3",{className:"text-lg font-semibold text-black",children:"Select Cities"}),q.jsxs("div",{className:"flex gap-2",children:[q.jsx(kr,{variant:"outline",size:"sm",onClick:X,className:"text-xs",children:"Select All"}),q.jsx(kr,{variant:"outline",size:"sm",onClick:A,className:"text-xs",children:"Clear All"})]})]}),q.jsx("p",{className:"text-sm text-gray-600 mb-4",children:"Choose which cities can appear in the game. At least one city must be selected."}),q.jsx("div",{className:"grid grid-cols-2 gap-3 max-h-60 overflow-y-auto",children:Yf.map(ne=>q.jsxs("div",{className:"flex items-center space-x-2",children:[q.jsx(u_,{id:ne.name,checked:R.selectedCities.includes(ne.name),onCheckedChange:()=>V(ne.name),disabled:R.selectedCities.length===1&&R.selectedCities.includes(ne.name)}),q.jsx("label",{htmlFor:ne.name,className:"text-sm font-medium text-gray-700 cursor-pointer",children:ne.name})]},ne.name))}),q.jsxs("p",{className:"text-xs text-gray-500 mt-2",children:["Selected: ",R.selectedCities.length," cities"]})]})}),q.jsxs("div",{className:"pt-4 border-t border-gray-200 space-y-3",children:[q.jsxs("div",{className:"flex justify-between items-center",children:[q.jsxs("span",{className:"text-sm font-medium text-black",children:["Best Score: ",E]}),q.jsx(kr,{variant:"outline",size:"sm",onClick:u,className:"text-xs",children:"Reset Best Score"})]}),q.jsx(kr,{variant:"outline",onClick:H,className:"w-full",children:"Reset Settings to Defaults"})]})]})]})}));A_.displayName="Settings";function P0({city:R,onClose:E}){const[z,I]=Ae.useState([]),[V,X]=Ae.useState(null),[A,u]=Ae.useState(!1),[H,ne]=Ae.useState(null);Qp(),Ae.useEffect(()=>{se()},[R]);const se=async()=>{u(!0),ne(null);try{const xe=await Kf.getCityLeaderboard(R,50);I(xe.leaderboard),X(xe.userBestScore||null)}catch(xe){ne(xe instanceof Error?xe.message:"Failed to load city leaderboard")}finally{u(!1)}},we=xe=>xe===1?q.jsx(ol,{className:"w-4 h-4 text-black"}):xe===2?q.jsx(Lm,{className:"w-4 h-4 text-gray-600"}):xe===3?q.jsx(Dm,{className:"w-4 h-4 text-gray-600"}):q.jsxs("span",{className:"w-4 h-4 flex items-center justify-center text-xs font-bold text-gray-500",children:["#",xe]}),Ce=xe=>
958xe.toLocaleString(),ie=xe=>xe?xe<1?`${Math.round(xe*1e3)}m`:`${xe.toFixed(1)}km`:"N/A",Fe=xe=>{const et=new Date(xe),tt=new Date().getTime()-et.getTime(),ut=Math.floor(tt/(1e3*60*60*24));return ut===0?"Today":ut===1?"Yesterday":ut<7?`${ut} days ago`:et.toLocaleDateString()},He=xe=>xe>=950?{tier:"Perfect!",color:"bg-black text-white"}:xe>=800?{tier:"Excellent",color:"bg-gray-800 text-white"}:xe>=600?{tier:"Great",color:"bg-gray-600 text-white"}:xe>=400?{tier:"Good",color:"bg-gray-400 text-black"}:xe>=200?{tier:"Fair",color:"bg-gray-300 text-black"}:{tier:"Miss",color:"bg-gray-200 text-black"};return q.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center p-4 z-50",children:q.jsxs(Ia,{className:"w-full max-w-3xl max-h-[90vh] overflow-hidden",children:[q.jsx(vo,{className:"flex flex-row items-center justify-between space-y-0 pb-3",children:q.jsxs("div",{className:"flex items-center gap-2",children:[q.jsx(kr,{variant:"ghost",size:"sm",onClick:E,className:"text-gray-600 hover:text-black",children:q.jsx(Em,{className:"w-4 h-4"})}),q.jsxs("div",{children:[q.jsxs(bo,{className:"text-lg font-medium flex items-center gap-1",children:[q.jsx(qu,{className:"w-4 h-4 text-black"}),R," Leaderboard"]}),q.jsxs("p",{className:"text-xs text-gray-600",children:["Top players in ",R]})]})]})}),q.jsxs(Ra,{className:"space-y-3",children:[V&&q.jsx(Ia,{className:"bg-gray-50 border border-gray-200",children:q.jsx(Ra,{className:"p-3",children:q.jsxs("div",{className:"flex items-center justify-between",children:[q.jsxs("div",{className:"flex items-center gap-2",children:[q.jsx("div",{className:"w-6 h-6 rounded-full bg-black flex items-center justify-center text-white font-bold text-xs",children:"YOU"}),q.jsxs("div",{children:[q.jsxs("div",{className:"text-sm font-medium",children:["Your Best Score in ",R]}),q.jsxs("div",{className:"text-xs text-gray-600",children:[ie(V.distance)," • ",Fe(V.timestamp)]})]})]}),q.jsxs("div",{className:"text-right",children:[q.jsx("div",{className:"text-lg font-bold text-black",children:Ce(V.score)}),q.jsx(Kl,{className:`text-xs ${He(V.score).color}`,children:He(V.score).tier})]})]})})}),A&&q.jsxs("div",{className:"flex items-center justify-center py-6",children:[q.jsx($d,{size:"md"}),q.jsx("span",{className:"ml-2 text-sm text-gray-600",children:"Loading..."})]}),H&&q.jsxs("div",{className:"text-center py-6 text-gray-600",children:[q.jsx("p",{className:"text-sm",children:H}),q.jsx(kr,{variant:"outline",size:"sm",onClick:se,className:"mt-2 text-xs",children:"Try Again"})]}),!A&&!H&&q.jsx("div",{className:"space-y-1 max-h-96 overflow-y-auto",children:z.length===0?q.jsxs("div",{className:"text-center py-6 text-gray-500",children:[q.jsx(ol,{className:"w-8 h-8 mx-auto mb-2 text-gray-300"}),q.jsxs("p",{className:"text-sm",children:["No scores yet for ",R,". Be the first to play!"]})]}):z.map((xe,et)=>q.jsx(Ia,{className:`${et<3?"border-black bg-gray-50":"border-gray-200"}`,children:q.jsx(Ra,{className:"p-3",children:q.jsxs("div",{className:"flex items-center justify-between",children:[q.jsxs("div",{className:"flex items-center gap-2",children:[q.jsx("div",{className:"flex items-center justify-center w-6",children:we(xe.rank||et+1)}),q.jsx("div",{className:"w-6 h-6 rounded-full overflow-hidden flex-shrink-0",children:xe.photo_url?q.jsx("img",{src:xe.photo_url,alt:`${xe.firstName} avatar`,className:"w-full h-full object-cover"}):q.jsx("div",{className:"w-full h-full bg-gray-200 flex items-center justify-center text-xs font-bold",children:xe.firstName?.charAt(0)||"?"})}),q.jsxs("div",{className:"min-w-0 flex-1",children:[q.jsxs("div",{className:"text-sm font-medium truncate",children:[xe.firstName," ",xe.lastName||""]}),q.jsxs("div",{className:"text-xs text-gray-600 flex items-center gap-1",children:[q.jsx(Og,{className:"w-3 h-3"}),Fe(xe.timestamp)]})]})]}),q.jsxs("div",{className:"text-right",children:[q.jsx("div",{className:"text-sm font-bold text-black",children:Ce(xe.score)}),q.jsx("div",{className:"text-xs text-gray-600",children:ie(xe.distance)}),q.jsx(Kl,{className:`text-xs ${He(xe.score).color}`,children:He(xe.score).tier})]})]})})}
958,xe._id))})]})]})})}function z0(){const{webApp:R,user:E}=Qp(),z=Ae.useRef(null),{state:I,startGame:V,startTileView:X,showMap:A,setGuess:u,setLocation:H,showResults:ne,resetGame:se}=G_(),[we,Ce]=Ae.useState(0),ie=Ae.useRef(null),Fe=Ae.useRef(!1),He=Ae.useRef(0),xe=Ae.useRef(!1),et=Ae.useRef(null),qe=Ae.useRef(null),[tt,ut]=Ae.useState(null),[Ze,_t]=Ae.useState(!1),[Tt,xt]=Ae.useState(!1),[Gt,hi]=Ae.useState(!1),[mi,Jt]=Ae.useState(!1),[fr,Ir]=Ae.useState(!1),[yi,Ve]=Ae.useState(!1),[ht,nt]=Ae.useState("Addis Ababa"),[bt,_e]=Ae.useState(()=>{const Yt=localStorage.getItem("gameSettings");return Yt?JSON.parse(Yt):eg}),[Xe,vt]=Ae.useState(()=>{const Yt=localStorage.getItem("bestScore");return Yt?parseInt(Yt):0}),[at,wt]=Ae.useState(()=>{const Yt=localStorage.getItem("cityScores");return Yt?JSON.parse(Yt):{}}),[Ft,zt]=Ae.useState(null),[di,si]=Ae.useState(null);Ae.useEffect(()=>{localStorage.setItem("gameSettings",JSON.stringify(bt))},[bt]),Ae.useEffect(()=>{I.score>Xe&&(vt(I.score),localStorage.setItem("bestScore",I.score.toString()))},[I.score,Xe]),Ae.useEffect(()=>{if(Ft&&I.score>(at[Ft]||0)){const Yt={...at,[Ft]:I.score};wt(Yt),localStorage.setItem("cityScores",JSON.stringify(Yt))}},[I.score,Ft,at]),Ae.useEffect(()=>{I.phase==="results"&&I.currentLocation&&I.userGuess&&R&&E&&(async()=>{try{si(null);const Ti=R.initData,sr=Ft||"Random",In=Ft?"city":"random",ye={score:I.score,city:sr,gameMode:In,distance:I.distance||0,roundScore:I.roundScore||0};(!Ti||Ti.trim()==="")&&(ye.userData=E),await Kf.submitScore(ye,Ti||""),console.log("Score submitted successfully!")}catch(Ti){console.error("Failed to submit score:",Ti),si("Failed to save score. Your progress is still saved locally.")}})()},[I.phase,I.currentLocation,I.userGuess,I.score,I.distance,I.roundScore,R,E,Ft]);const Ji=Yt=>{_e(Ti=>({...Ti,...Yt}))},zn=Yt=>{_e(Ti=>({...Ti,selectedCities:Ti.selectedCities.includes(Yt)?Ti.selectedCities.filter(sr=>sr!==Yt):[...Ti.selectedCities,Yt]}))},kn=()=>{vt(0),localStorage.setItem("bestScore","0")},xr=()=>{_e(Yt=>({...Yt,selectedCities:Yf.map(Ti=>Ti.name)}))},qi=()=>{_e(Yt=>({...Yt,selectedCities:[Yf[0].name]}))};Ae.useEffect(()=>{if(I.phase==="preparing"&&!Ze){_t(!0);const Yt=q_(bt.selectedCities);H(Yt)}},[I.phase,Ze,H,bt.selectedCities]),Ae.useEffect(()=>{qe.current=I.currentLocation},[I.currentLocation]),Ae.useEffect(()=>{if(I.phase==="preparing"&&Ze&&qe.current&&!xe.current){xe.current=!0;const Yt=setTimeout(()=>{et.current=null,X(),Jt(!0),Fe.current=!0},1500);et.current=Yt}},[I.phase,Ze,X]),Ae.useEffect(()=>{I.phase==="tile-view"&&Ze&&Fe.current&&(Jt(!1),Fe.current=!1,xe.current=!1,ie.current&&(clearInterval(ie.current),ie.current=null),He.current=bt.tileViewDuration,Ce(bt.tileViewDuration),ie.current=setInterval(()=>{He.current-=1,Ce(He.current),He.current<=0&&(ie.current&&(clearInterval(ie.current),ie.current=null),A())},1e3))},[I.phase,Ze,bt.tileViewDuration,A]),Ae.useEffect(()=>()=>{ie.current&&(clearInterval(ie.current),ie.current=null)},[I.phase]),Ae.useEffect(()=>{I.phase==="menu"&&(_t(!1),Ce(0),ut(null),xt(!1),hi(!1),Jt(!1),Fe.current=!1,xe.current=!1,ie.current&&(clearInterval(ie.current),ie.current=null))},[I.phase]),Ae.useEffect(()=>{if(I.phase==="results"&&I.currentLocation&&I.userGuess&&z.current&&Tt){const Yt=()=>{if(z.current)try{z.current.clearMarkers(),z.current.clearPaths(),z.current.addImageMarker(I.currentLocation,"/pin.png",[30,30],()=>console.log("Actual location clicked!"),10,"<b>🎯 Actual Location</b>"),z.current.addImageMarker(I.userGuess,"/pin.png",[30,30],()=>console.log("Your guess clicked!"),10,"<b>📍 Your Guess</b>");const Ti=[I.userGuess,I.currentLocation];z.current.addPath(Ti,{color:"#ff4444",width:3,opacity:.8}),console.log("Results visualization added successfully")}catch{setTimeout(Yt,100)}};Yt()}},[I.phase,I.currentLocation,I.userGuess,Tt]);const $i=Ae.useCallback(()=>{xt(!0)},[]),Kn=Ae.useCallback(()=>{console.log("Starting game - resetting state"),zt(null),_t(!1),xe.current=!1,Ce(0),ut(null),xt(!1),hi(!1),Jt(!1),Fe.current=!1,ie.current&&(clearInterval(ie.current),ie.current=null),V()},[V]),ha=Ae.useCallback(Yt=>{zt(Yt),_t(!1),xe.current=!1,Ce(0),ut(null),xt(!1),hi(!1),Jt(!1),Fe.current=!1,ie.current&&(clearInterval(ie.current),ie.current=null);const Ti={...bt,selectedCities:[Yt]};_e(Ti),V()},[bt,V]),Kr=Ae.useCallback(()=>
958{Ir(!0)},[]),da=Ae.useCallback(()=>{Ir(!1)},[]),Wn=Ae.useCallback(Yt=>{nt(Yt),Ve(!0)},[]),ms=Ae.useCallback(()=>{Ve(!1)},[]),Qn=Ae.useCallback(Yt=>{I.phase==="map-view"&&(ut(Yt),z.current&&(z.current.clearMarkers(),z.current.addImageMarker(Yt,"/pin.png",[30,30],()=>console.log("Marker clicked!"),10,"<b>Your Guess</b>")))},[I.phase]),Qa=Ae.useCallback(()=>{tt&&I.phase==="map-view"&&!Gt&&(hi(!0),u(tt),ne(tt))},[tt,I.phase,Gt,u,ne]),Da=Ae.useCallback(()=>{if(_t(!1),Ce(0),ut(null),xt(!1),hi(!1),Jt(!1),si(null),Fe.current=!1,xe.current=!1,ie.current&&(clearInterval(ie.current),ie.current=null),et.current&&(clearTimeout(et.current),et.current=null),se(),Ft){const Yt={...bt,selectedCities:[Ft]};_e(Yt)}else zt(null);V()},[se,V,Ft,bt]),gs=Ae.useCallback(()=>{_t(!1),Ce(0),ut(null),xt(!1),hi(!1),Jt(!1),si(null),Fe.current=!1,xe.current=!1,ie.current&&(clearInterval(ie.current),ie.current=null),se()},[se]);return q.jsxs("div",{className:"min-h-screen bg-gray-50",children:[I.phase==="menu"&&q.jsx(Vg,{onStartGame:Kn,onStartSpecificCity:ha,onOpenSettings:Kr,onOpenCityLeaderboard:Wn,bestScore:Xe,cityScores:at}),(I.phase==="preparing"||I.phase==="tile-view")&&q.jsxs("div",{className:"relative",children:[I.phase==="preparing"&&q.jsx("div",{className:"absolute inset-0 z-20",children:q.jsx(Gg,{})}),q.jsx(Fx,{ref:z,currentLocation:I.currentLocation,isLoading:mi,timeLeft:we,onMapLoad:$i,showOverlay:I.phase==="preparing"})]}),I.phase==="map-view"&&q.jsx(Ux,{ref:z,currentMarker:tt,isSubmitting:Gt,onMapClick:Qn,onSubmitGuess:Qa,onMapLoad:$i}),I.phase==="results"&&q.jsx(Yx,{ref:z,currentLocation:I.currentLocation,userGuess:I.userGuess,distance:I.distance,roundScore:I.roundScore,score:I.score,bestScore:Xe,onPlayAgain:Da,onMainMenu:gs,submitError:di}),fr&&q.jsx(A_,{settings:bt,bestScore:Xe,onClose:da,onUpdateSettings:Ji,onToggleCity:zn,onSelectAllCities:xr,onClearAllCities:qi,onResetBestScore:kn,onResetToDefaults:()=>_e(eg)}),yi&&q.jsx(P0,{city:ht,onClose:ms})]})}function k0(){return q.jsx(Cx,{children:q.jsx(z0,{})})}F_.createRoot(document.getElementById("root")).render(q.jsx(Ae.StrictMode,{children:q.jsx(k0,{})}));

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.